WP_HTML_Tag_Processor::next_tag()
Finds the next tag matching the $query.
Метод класса: WP_HTML_Tag_Processor{}
Хуков нет.
Возвращает
true|false
. Whether a tag was matched.
Использование
$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor(); $WP_HTML_Tag_Processor->next_tag( $query );
- $query(массив|строка|null)
Which tag name to find, having which class, etc.
По умолчанию: to find any tag
-
tag_name(строка|null)
Which tag to find, or null for "any tag." -
match_offset(int|null)
Find the Nth tag matching all search criteria.
1 for "first" tag, 3 for "third," etc.
По умолчанию: first tag -
class_name(строка|null)
Tag must contain this whole class name to match. - tag_closers(строка|null)
"visit" or "skip": whether to stop on tag closers, e.g. </div>.
-
Список изменений
С версии 6.2.0 | Введена. |
С версии 6.5.0 | No longer processes incomplete tokens at end of document; pauses the processor at start of token. |
Код WP_HTML_Tag_Processor::next_tag() WP HTML Tag Processor::next tag WP 6.6.2
public function next_tag( $query = null ) { $this->parse_query( $query ); $already_found = 0; do { if ( false === $this->next_token() ) { return false; } if ( self::STATE_MATCHED_TAG !== $this->parser_state ) { continue; } if ( $this->matches() ) { ++$already_found; } } while ( $already_found < $this->sought_match_offset ); return true; }