equal
deleted
inserted
replaced
|
1 <?php |
|
2 /** |
|
3 * HTML API: WP_HTML_Text_Replacement class |
|
4 * |
|
5 * @package WordPress |
|
6 * @subpackage HTML-API |
|
7 * @since 6.2.0 |
|
8 */ |
|
9 |
|
10 /** |
|
11 * Core class used by the HTML tag processor as a data structure for replacing |
|
12 * existing content from start to end, allowing to drastically improve performance. |
|
13 * |
|
14 * This class is for internal usage of the WP_HTML_Tag_Processor class. |
|
15 * |
|
16 * @access private |
|
17 * @since 6.2.0 |
|
18 * @since 6.5.0 Replace `end` with `length` to more closely match `substr()`. |
|
19 * |
|
20 * @see WP_HTML_Tag_Processor |
|
21 */ |
|
22 class WP_HTML_Text_Replacement { |
|
23 /** |
|
24 * Byte offset into document where replacement span begins. |
|
25 * |
|
26 * @since 6.2.0 |
|
27 * |
|
28 * @var int |
|
29 */ |
|
30 public $start; |
|
31 |
|
32 /** |
|
33 * Byte length of span being replaced. |
|
34 * |
|
35 * @since 6.5.0 |
|
36 * |
|
37 * @var int |
|
38 */ |
|
39 public $length; |
|
40 |
|
41 /** |
|
42 * Span of text to insert in document to replace existing content from start to end. |
|
43 * |
|
44 * @since 6.2.0 |
|
45 * |
|
46 * @var string |
|
47 */ |
|
48 public $text; |
|
49 |
|
50 /** |
|
51 * Constructor. |
|
52 * |
|
53 * @since 6.2.0 |
|
54 * |
|
55 * @param int $start Byte offset into document where replacement span begins. |
|
56 * @param int $length Byte length of span in document being replaced. |
|
57 * @param string $text Span of text to insert in document to replace existing content from start to end. |
|
58 */ |
|
59 public function __construct( $start, $length, $text ) { |
|
60 $this->start = $start; |
|
61 $this->length = $length; |
|
62 $this->text = $text; |
|
63 } |
|
64 } |