| 1 |
<?php |
| 2 |
/** |
| 3 |
* HTML Tag Processor: Attribute token structure class. |
| 4 |
* |
| 5 |
* @package WordPress |
| 6 |
* @subpackage HTML |
| 7 |
* @since 6.2.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
/** |
| 11 |
* Data structure for the attribute token that allows to drastically improve performance. |
| 12 |
* |
| 13 |
* This class is for internal usage of the WP_HTML_Tag_Processor class. |
| 14 |
* |
| 15 |
* @access private |
| 16 |
* @since 6.2.0 |
| 17 |
* |
| 18 |
* @see WP_HTML_Tag_Processor |
| 19 |
*/ |
| 20 |
class WP_HTML_Attribute_Token { |
| 21 |
/** |
| 22 |
* Attribute name. |
| 23 |
* |
| 24 |
* @since 6.2.0 |
| 25 |
* @var string |
| 26 |
*/ |
| 27 |
public $name; |
| 28 |
|
| 29 |
/** |
| 30 |
* Attribute value. |
| 31 |
* |
| 32 |
* @since 6.2.0 |
| 33 |
* @var int |
| 34 |
*/ |
| 35 |
public $value_starts_at; |
| 36 |
|
| 37 |
/** |
| 38 |
* How many bytes the value occupies in the input HTML. |
| 39 |
* |
| 40 |
* @since 6.2.0 |
| 41 |
* @var int |
| 42 |
*/ |
| 43 |
public $value_length; |
| 44 |
|
| 45 |
/** |
| 46 |
* The string offset where the attribute name starts. |
| 47 |
* |
| 48 |
* @since 6.2.0 |
| 49 |
* @var int |
| 50 |
*/ |
| 51 |
public $start; |
| 52 |
|
| 53 |
/** |
| 54 |
* The string offset after the attribute value or its name. |
| 55 |
* |
| 56 |
* @since 6.2.0 |
| 57 |
* @var int |
| 58 |
*/ |
| 59 |
public $end; |
| 60 |
|
| 61 |
/** |
| 62 |
* Whether the attribute is a boolean attribute with value `true`. |
| 63 |
* |
| 64 |
* @since 6.2.0 |
| 65 |
* @var bool |
| 66 |
*/ |
| 67 |
public $is_true; |
| 68 |
|
| 69 |
/** |
| 70 |
* Constructor. |
| 71 |
* |
| 72 |
* @since 6.2.0 |
| 73 |
* |
| 74 |
* @param string $name Attribute name. |
| 75 |
* @param int $value_start Attribute value. |
| 76 |
* @param int $value_length Number of bytes attribute value spans. |
| 77 |
* @param int $start The string offset where the attribute name starts. |
| 78 |
* @param int $end The string offset after the attribute value or its name. |
| 79 |
* @param bool $is_true Whether the attribute is a boolean attribute with true value. |
| 80 |
*/ |
| 81 |
public function __construct( $name, $value_start, $value_length, $start, $end, $is_true ) { |
| 82 |
$this->name = $name; |
| 83 |
$this->value_starts_at = $value_start; |
| 84 |
$this->value_length = $value_length; |
| 85 |
$this->start = $start; |
| 86 |
$this->end = $end; |
| 87 |
$this->is_true = $is_true; |
| 88 |
} |
| 89 |
} |
| 90 |
|