WP_Interactivity_API_Directives_Processor::get_content_between_balanced_template_tags()publicWP 6.5.0

Returns the content between two balanced template tags.

It positions the cursor in the closer tag of the balanced template tag, if it exists.

Метод класса: WP_Interactivity_API_Directives_Processor{}

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

Строку|null. The content between the current opener template tag and its matching closer tag or null if it doesn't find the matching closing tag or the current tag is not a template opener tag.

Использование

$WP_Interactivity_API_Directives_Processor = new WP_Interactivity_API_Directives_Processor();
$WP_Interactivity_API_Directives_Processor->get_content_between_balanced_template_tags();

Список изменений

С версии 6.5.0 Введена.

Код WP_Interactivity_API_Directives_Processor::get_content_between_balanced_template_tags() WP 6.7.1

public function get_content_between_balanced_template_tags() {
	if ( 'TEMPLATE' !== $this->get_tag() ) {
		return null;
	}

	$positions = $this->get_after_opener_tag_and_before_closer_tag_positions();
	if ( ! $positions ) {
		return null;
	}
	list( $after_opener_tag, $before_closer_tag ) = $positions;

	return substr( $this->html, $after_opener_tag, $before_closer_tag - $after_opener_tag );
}