WP_Interactivity_API_Directives_Processor::get_after_opener_tag_and_before_closer_tag_positions()
Gets the positions right after the opener tag and right before the closer tag in a balanced tag.
By default, it positions the cursor in the closer tag of the balanced tag. If $rewind is true, it seeks back to the opener tag.
Метод класса: WP_Interactivity_API_Directives_Processor{}
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
Массив|null
. Start and end byte position, or null when no balanced tag bookmarks.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_after_opener_tag_and_before_closer_tag_positions( $rewind );
- $rewind(true|false)
- Whether to seek back to the opener tag after finding the positions.
По умолчанию: false
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Interactivity_API_Directives_Processor::get_after_opener_tag_and_before_closer_tag_positions() WP Interactivity API Directives Processor::get after opener tag and before closer tag positions WP 6.7.1
private function get_after_opener_tag_and_before_closer_tag_positions( bool $rewind = false ) { // Flushes any changes. $this->get_updated_html(); $bookmarks = $this->get_balanced_tag_bookmarks(); if ( ! $bookmarks ) { return null; } list( $opener_tag, $closer_tag ) = $bookmarks; $after_opener_tag = $this->bookmarks[ $opener_tag ]->start + $this->bookmarks[ $opener_tag ]->length; $before_closer_tag = $this->bookmarks[ $closer_tag ]->start; if ( $rewind ) { $this->seek( $opener_tag ); } $this->release_bookmark( $opener_tag ); $this->release_bookmark( $closer_tag ); return array( $after_opener_tag, $before_closer_tag ); }