PHP
6 days ago
LICENSE.md
6 days ago
README.md
6 days ago
class-xmlattributetoken.php
6 days ago
class-xmldecoder.php
6 days ago
class-xmlelement.php
6 days ago
class-xmlnativecursorprocessor.php
6 days ago
class-xmlprocessor.php
6 days ago
class-xmlunsupportedexception.php
6 days ago
composer.json
6 days ago
class-xmlattributetoken.php
114 lines
| 1 | <?php |
| 2 | namespace WordPress\XML; |
| 3 | |
| 4 | /** |
| 5 | * XML API: XMLAttributeToken class |
| 6 | * |
| 7 | * @package WordPress |
| 8 | * @subpackage XML-API |
| 9 | * @since 6.2.0 |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Core class used by the XML tag processor as a data structure for the attribute token, |
| 14 | * allowing to drastically improve performance. |
| 15 | * |
| 16 | * This class is for internal usage of the XMLProcessor class. |
| 17 | * |
| 18 | * @see XMLProcessor |
| 19 | */ |
| 20 | class XMLAttributeToken { |
| 21 | /** |
| 22 | * Attribute name. |
| 23 | * |
| 24 | * @since 6.2.0 |
| 25 | * |
| 26 | * @var string |
| 27 | */ |
| 28 | public $qualified_name; |
| 29 | |
| 30 | /** |
| 31 | * Attribute value. |
| 32 | * |
| 33 | * @since 6.2.0 |
| 34 | * |
| 35 | * @var int |
| 36 | */ |
| 37 | public $value_starts_at; |
| 38 | |
| 39 | /** |
| 40 | * How many bytes the value occupies in the input XML. |
| 41 | * |
| 42 | * @since 6.2.0 |
| 43 | * |
| 44 | * @var int |
| 45 | */ |
| 46 | public $value_length; |
| 47 | |
| 48 | /** |
| 49 | * The string offset where the attribute name starts. |
| 50 | * |
| 51 | * @since 6.2.0 |
| 52 | * |
| 53 | * @var int |
| 54 | */ |
| 55 | public $start; |
| 56 | |
| 57 | /** |
| 58 | * Byte length of text spanning the attribute inside a tag. |
| 59 | * |
| 60 | * This span starts at the first character of the attribute name |
| 61 | * and it ends after one of three cases: |
| 62 | * |
| 63 | * - at the end of the attribute name for boolean attributes. |
| 64 | * - at the end of the value for unquoted attributes. |
| 65 | * - at the final single or double quote for quoted attributes. |
| 66 | * |
| 67 | * @var int |
| 68 | */ |
| 69 | public $length; |
| 70 | |
| 71 | /** |
| 72 | * Namespace prefix. |
| 73 | * |
| 74 | * @var string |
| 75 | */ |
| 76 | public $namespace_prefix; |
| 77 | |
| 78 | /** |
| 79 | * Local name. |
| 80 | * |
| 81 | * @var string |
| 82 | */ |
| 83 | public $local_name; |
| 84 | |
| 85 | /** |
| 86 | * Namespace. |
| 87 | * |
| 88 | * @var string |
| 89 | */ |
| 90 | public $namespace; |
| 91 | |
| 92 | /** |
| 93 | * Constructor. |
| 94 | * |
| 95 | * @param int $value_start Attribute value. |
| 96 | * @param int $value_length Number of bytes attribute value spans. |
| 97 | * @param int $start The string offset where the attribute name starts. |
| 98 | * @param int $length Byte length of the entire attribute name or name and value pair expression. |
| 99 | * @param string $namespace_prefix Namespace prefix. |
| 100 | * @param string $local_name Local name. |
| 101 | * @param string $namespace_name Namespace. |
| 102 | */ |
| 103 | public function __construct( $value_start, $value_length, $start, $length, $namespace_prefix = null, $local_name = null, $namespace_name = null ) { |
| 104 | $this->value_starts_at = $value_start; |
| 105 | $this->value_length = $value_length; |
| 106 | $this->start = $start; |
| 107 | $this->length = $length; |
| 108 | $this->namespace_prefix = $namespace_prefix; |
| 109 | $this->local_name = $local_name; |
| 110 | $this->namespace = $namespace_name; |
| 111 | $this->qualified_name = $namespace_prefix ? $namespace_prefix . ':' . $local_name : $local_name; |
| 112 | } |
| 113 | } |
| 114 |