[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Block Serialization Parser
File Size: | 404 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 2 files wp-includes/class-wp-block-parser-block.php wp-includes/class-wp-block-parser-frame.php |
WP_Block_Parser:: (7 methods):
parse()
proceed()
next_token()
freeform()
add_freeform()
add_inner_block()
add_block_from_stack()
Class: WP_Block_Parser - X-Ref
Class WP_Block_Parserparse( $document ) X-Ref |
Parses a document and returns a list of block structures When encountering an invalid parse will return a best-effort parse. In contrast to the specification parser this does not return an error on invalid inputs. return: array[] param: string $document Input document being parsed. |
proceed() X-Ref |
Processes the next token from the input document and returns whether to proceed eating more tokens This is the "next step" function that essentially takes a token as its input and decides what to do with that token before descending deeper into a nested block tree or continuing along the document or breaking out of a level of nesting. return: bool |
next_token() X-Ref |
Scans the document from where we last left off and finds the next valid token to parse if it exists Returns the type of the find: kind of find, block information, attributes return: array |
freeform( $inner_html ) X-Ref |
Returns a new block object for freeform HTML return: WP_Block_Parser_Block freeform block object. param: string $inner_html HTML content of block. |
add_freeform( $length = null ) X-Ref |
Pushes a length of text from the input document to the output list as a freeform block. param: null $length how many bytes of document text to output. |
add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) X-Ref |
Given a block structure from memory pushes a new block to the output list. param: WP_Block_Parser_Block $block The block to add to the output. param: int $token_start Byte offset into the document where the first token for the block starts. param: int $token_length Byte length of entire block from start of opening token to end of closing token. param: int|null $last_offset Last byte offset into document if continuing form earlier output. |
add_block_from_stack( $end_offset = null ) X-Ref |
Pushes the top block from the parsing stack to the output list. param: int|null $end_offset byte offset into document for where we should stop sending text output as HTML. |
Generated : Sat Nov 23 08:20:01 2024 | Cross-referenced by PHPXref |