WP_HTML_Tag_Processor
class WP_HTML_Tag_Processor
// Constructor: function Object() { [native code] } Core class used to modify attributes in an HTML document for tags matching a query.
Methods 47 methods
| Method / Return | Description |
|---|---|
| __construct() void | Constructor.
Parameters: $html: mixed |
| change_parsing_namespace() bool | Switches parsing mode into a new namespace, such as when
Parameters: $new_namespace: string |
| next_tag() bool | Finds the next tag matching the $query.
Parameters: $query: mixed |
| next_token() bool | Finds the next token in the HTML document. |
| base_class_next_token() bool | Internal method which finds the next token in the HTML document. |
| paused_at_incomplete_token() bool | Whether the processor paused because the input HTML document ended |
| class_list() void | Generator for a foreach loop to step through each class name for the matched tag. |
| has_class() (bool | Returns if a matched tag contains the given ASCII case-insensitive class name.
Parameters: $wanted_class: mixed |
| set_bookmark() bool | Sets a bookmark in the HTML document.
Parameters: $name: mixed |
| release_bookmark() bool | Removes a bookmark that is no longer needed.
Parameters: $name: mixed |
| skip_rawtext() bool | Skips contents of generic rawtext elements.
Parameters: $tag_name: string |
| skip_rcdata() bool | Skips contents of RCDATA elements, namely title and textarea tags.
Parameters: $tag_name: string |
| skip_script_data() bool | Skips contents of script tags. |
| parse_next_tag() bool | Parses the next tag. |
| parse_next_attribute() bool | Parses the next attribute. |
| skip_whitespace() void | Move the internal cursor past any immediate successive whitespace. |
| after_tag() void | Applies attribute updates and cleans up once a tag is fully parsed. |
| class_name_updates_to_attributes_updates() void | Converts class name updates into tag attributes updates |
| apply_attributes_updates() int | Applies attribute updates to HTML document.
Parameters: $shift_this_point: int |
| has_bookmark() bool | Checks whether a bookmark with the given name exists.
Parameters: $bookmark_name: mixed |
| seek() bool | Move the internal cursor in the Tag Processor to a given bookmark's location.
Parameters: $bookmark_name: mixed |
| sort_start_ascending() int | Compare two WP_HTML_Text_Replacement objects.
Parameters: $a: WP_HTML_Text_Replacement, $b: WP_HTML_Text_Replacement |
| get_enqueued_attribute_value() (string | Return the enqueued value for a given attribute, if one exists.
Parameters: $comparable_name: string |
| get_attribute() (string | Returns the value of a requested attribute from a matched tag opener if that attribute exists.
Parameters: $name: mixed |
| get_attribute_names_with_prefix() (array | Gets lowercase names of all attributes matching a given prefix in the current tag.
Parameters: $prefix: mixed |
| get_namespace() string | Returns the namespace of the matched token. |
| get_tag() (string | Returns the uppercase name of the matched tag. |
| get_qualified_tag_name() (string | Returns the adjusted tag name for a given token, taking into |
| get_qualified_attribute_name() (string | Returns the adjusted attribute name for a given attribute, taking into
Parameters: $attribute_name: mixed |
| has_self_closing_flag() bool | Indicates if the currently matched tag contains the self-closing flag. |
| is_tag_closer() bool | Indicates if the current tag token is a tag closer. |
| get_token_type() (string | Indicates the kind of matched token, if any. |
| get_token_name() (string | Returns the node name represented by the token. |
| get_comment_type() (string | Indicates what kind of comment produced the comment node. |
| get_full_comment_text() (string | Returns the text of a matched comment or null if not on a comment type node. |
| subdivide_text_appropriately() bool | Subdivides a matched text node, splitting NULL byte sequences and decoded whitespace as |
| get_modifiable_text() string | Returns the modifiable text for a matched token, or an empty string. |
| set_modifiable_text() bool | Sets the modifiable text for the matched token, if matched.
Parameters: $plaintext_content: string |
| set_attribute() bool | Updates or creates a new attribute on the currently matched tag with the passed value.
Parameters: $name: mixed, $value: mixed |
| remove_attribute() bool | Remove an attribute from the currently-matched tag.
Parameters: $name: mixed |
| add_class() bool | Adds a new class name to the currently matched tag.
Parameters: $class_name: mixed |
| remove_class() bool | Removes a class name from the currently matched tag.
Parameters: $class_name: mixed |
| __toString() string | Returns the string representation of the HTML Tag Processor. |
| get_updated_html() string | Returns the string representation of the HTML Tag Processor. |
| parse_query() void | Parses tag query input into internal search criteria.
Parameters: $query: mixed |
| matches() bool | Checks whether a given tag and its attributes match the search criteria. |
| get_doctype_info() (WP_HTML_Doctype_Info | Gets DOCTYPE declaration info from a DOCTYPE token. |
Properties
| Property / Type | Description |
|---|---|
| $html mixed public | No description available. |
| $last_query mixed public | No description available. |
| $sought_tag_name mixed public | No description available. |
| $sought_class_name mixed public | No description available. |
| $sought_match_offset mixed public | No description available. |
| $stop_on_tag_closers mixed public | No description available. |
| $parser_state mixed public | No description available. |
| $compat_mode mixed public | No description available. |
| $parsing_namespace mixed public | No description available. |
| $comment_type mixed public | No description available. |
| $text_node_classification mixed public | No description available. |
| $bytes_already_parsed mixed public | No description available. |
| $token_starts_at mixed public | No description available. |
| $token_length mixed public | No description available. |
| $tag_name_starts_at mixed public | No description available. |
| $tag_name_length mixed public | No description available. |
| $text_starts_at mixed public | No description available. |
| $text_length mixed public | No description available. |
| $is_closing_tag mixed public | No description available. |
| $attributes mixed public | No description available. |
| $duplicate_attributes mixed public | No description available. |
| $classname_updates mixed public | No description available. |
| $bookmarks mixed public | No description available. |
| $lexical_updates mixed public | No description available. |
| $seek_count mixed public | No description available. |
| $skip_newline_at mixed public | No description available. |