PluginProbe
Gutenberg / 23.3.2
Gutenberg v23.3.2
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / packages / block-serialization-default-parser / class-wp-block-parser-frame.php

class-wp-block-parser-frame.php in Gutenberg 23.3.2, at packages/block-serialization-default-parser/class-wp-block-parser-frame.php

80 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Block Serialization Parser
4 *
5 * @package WordPress
6 */
7
8 /**
9 * Class WP_Block_Parser_Frame
10 *
11 * Holds partial blocks in memory while parsing
12 *
13 * @internal
14 * @since 5.0.0
15 */
16 class WP_Block_Parser_Frame {
17 /**
18 * Full or partial block
19 *
20 * @since 5.0.0
21 * @var WP_Block_Parser_Block
22 */
23 public $block;
24
25 /**
26 * Byte offset into document for start of parse token
27 *
28 * @since 5.0.0
29 * @var int
30 */
31 public $token_start;
32
33 /**
34 * Byte length of entire parse token string
35 *
36 * @since 5.0.0
37 * @var int
38 */
39 public $token_length;
40
41 /**
42 * Byte offset into document for after parse token ends
43 * (used during reconstruction of stack into parse production)
44 *
45 * @since 5.0.0
46 * @var int
47 */
48 public $prev_offset;
49
50 /**
51 * Byte offset into document where leading HTML before token starts
52 *
53 * @since 5.0.0
54 * @var int
55 */
56 public $leading_html_start;
57
58 /**
59 * Constructor
60 *
61 * Will populate object properties from the provided arguments.
62 *
63 * @since 5.0.0
64 *
65 * @param WP_Block_Parser_Block $block Full or partial block.
66 * @param int $token_start Byte offset into document for start of parse token.
67 * @param int $token_length Byte length of entire parse token string.
68 * @param int|null $prev_offset Optional. Byte offset into document for after parse token ends. Default null.
69 * @param int|null $leading_html_start Optional. Byte offset into document where leading HTML before token starts.
70 * Default null.
71 */
72 public function __construct( $block, $token_start, $token_length, $prev_offset = null, $leading_html_start = null ) {
73 $this->block = $block;
74 $this->token_start = $token_start;
75 $this->token_length = $token_length;
76 $this->prev_offset = $prev_offset ?? $token_start + $token_length;
77 $this->leading_html_start = $leading_html_start;
78 }
79 }
80