Gets the positions right after the opener tag and right before the closer tag in a balanced tag.
Description
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.
Parameters
$rewind
booloptional- Whether to seek back to the opener tag after finding the positions. Defaults to false.
Default:
false
Source
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 );
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.