Why Use Design Basics for Your Custom Home Plan?
You will work with skilled designers who understands important structural issues.
Our Modified Home Plans are drafted to the same high standards and go through the same stringent review process to ensure accuracy.
Your Vision - Our Expertise
You will receive no-cost technical support throughout the construction.
Meet The Designer: Carl
With more than 35 years working with Design Basics, Carl leads our design team as Senior Designer. He has designed 1000’s of single- and multi-family homes, ranging from 800 square feet to over 18,000 square feet for clients throughout North America, as well as in Russia, China, and other international locations. Carl is instrumental in helping Design Basics’ customers realize their dream home.
Carl holds an associate degree in drafting and design, and a bachelor’s degree in construction engineering.
Email or call Carl at 1.800.947.7526 x 130 today to inquire about or start your project!
You’ll get exactly what you want, but the design process can take quite some time.
Recent Projects
Thoughtful design today translates to higher resale tomorrow.
Testimonials
Don't just take our word from it - see what home builders and buyers have to say about their experience working with Design Basics.
I wish everything I dealt with in life was as painless and easy as my experience with Design Basics. Carl Cuozzo was very patient and great to work with and not daunted with a unique request on making changes to a plan that we found as a good starting point and modified to be what we wanted.
Mike W.
You have a great team,. Carl was very helpful to me.
Shawn S.
This a very solid plan and sells well for us.
Justin Harney
Harney Homes of MurfreesboroIt’s a fantastic house – I don’t know how you did it – it’s affordability!
Steve Carlisle
Stonehill Homes Of Indiana IncWe love the open feel & versatility of the plan. Few foundation jogs make this an affordable plan to build.
Krisina Philbin
Story Home of OmahaPlan has a great flow and fits our infill older lots like a glove with little modifications. Home walks bigger than the 1500 sqft advertised in the plans.
Travis Beatty
A and B Development of WilmingtonIt's a relatively simple design with great curb appeal and a user friendly floor plan. It's a great use of space - every room is perfectly sized.
Joel Fox
Fox Builders LlcIt’s been a good plan for that size of home and price point.
Howard Zimmerman
Debenhaus Homes IncCurrent Dir: /var/www/designbasics/wp-includes/ [DIR] ID3 [ delete | rename ] [DIR] IXR [ delete | rename ] [DIR] PHPMailer [ delete | rename ] [DIR] Requests [ delete | rename ] [DIR] SimplePie [ delete | rename ] [DIR] Text [ delete | rename ] [FILE] admin-bar.php [ edit | delete | rename ] [DIR] assets [ delete | rename ] [FILE] atomlib.php [ edit | delete | rename ] [FILE] author-template.php [ edit | delete | rename ] [DIR] block-bindings [ delete | rename ] [FILE] block-bindings.php [ edit | delete | rename ] [FILE] block-editor.php [ edit | delete | rename ] [FILE] block-i18n.json [ edit | delete | rename ] [DIR] block-patterns [ delete | rename ] [FILE] block-patterns.php [ edit | delete | rename ] [DIR] block-supports [ delete | rename ] [FILE] block-template-utils.php [ edit | delete | rename ] [FILE] block-template.php [ edit | delete | rename ] [DIR] blocks [ delete | rename ] [FILE] blocks.php [ edit | delete | rename ] [FILE] bookmark-template.php [ edit | delete | rename ] [FILE] bookmark.php [ edit | delete | rename ] [FILE] cache-compat.php [ edit | delete | rename ] [FILE] cache.php [ edit | delete | rename ] [FILE] canonical.php [ edit | delete | rename ] [FILE] capabilities.php [ edit | delete | rename ] [FILE] category-template.php [ edit | delete | rename ] [FILE] category.php [ edit | delete | rename ] [DIR] certificates [ delete | rename ] [FILE] class-IXR.php [ edit | delete | rename ] [FILE] class-avif-info.php [ edit | delete | rename ] [FILE] class-feed.php [ edit | delete | rename ] [FILE] class-http.php [ edit | delete | rename ] [FILE] class-json.php [ edit | delete | rename ] [FILE] class-oembed.php [ edit | delete | rename ] [FILE] class-phpass.php [ edit | delete | rename ] [FILE] class-phpmailer.php [ edit | delete | rename ] [FILE] class-pop3.php [ edit | delete | rename ] [FILE] class-requests.php [ edit | delete | rename ] [FILE] class-simplepie.php [ edit | delete | rename ] [FILE] class-smtp.php [ edit | delete | rename ] [FILE] class-snoopy.php [ edit | delete | rename ] [FILE] class-walker-category-dropdown.php [ edit | delete | rename ] [FILE] class-walker-category.php [ edit | delete | rename ] [FILE] class-walker-comment.php [ edit | delete | rename ] [FILE] class-walker-nav-menu.php [ edit | delete | rename ] [FILE] class-walker-page-dropdown.php [ edit | delete | rename ] [FILE] class-walker-page.php [ edit | delete | rename ] [FILE] class-wp-admin-bar.php [ edit | delete | rename ] [FILE] class-wp-ajax-response.php [ edit | delete | rename ] [FILE] class-wp-application-passwords.php [ edit | delete | rename ] [FILE] class-wp-block-bindings-registry.php [ edit | delete | rename ] [FILE] class-wp-block-bindings-source.php [ edit | delete | rename ] [FILE] class-wp-block-editor-context.php [ edit | delete | rename ] [FILE] class-wp-block-list.php [ edit | delete | rename ] [FILE] class-wp-block-parser-block.php [ edit | delete | rename ] [FILE] class-wp-block-parser-frame.php [ edit | delete | rename ] [FILE] class-wp-block-parser.php [ edit | delete | rename ] [FILE] class-wp-block-pattern-categories-registry.php [ edit | delete | rename ] [FILE] class-wp-block-patterns-registry.php [ edit | delete | rename ] [FILE] class-wp-block-styles-registry.php [ edit | delete | rename ] [FILE] class-wp-block-supports.php [ edit | delete | rename ] [FILE] class-wp-block-template.php [ edit | delete | rename ] [FILE] class-wp-block-type-registry.php [ edit | delete | rename ] [FILE] class-wp-block-type.php [ edit | delete | rename ] [FILE] class-wp-block.php [ edit | delete | rename ] [FILE] class-wp-classic-to-block-menu-converter.php [ edit | delete | rename ] [FILE] class-wp-comment-query.php [ edit | delete | rename ] [FILE] class-wp-comment.php [ edit | delete | rename ] [FILE] class-wp-customize-control.php [ edit | delete | rename ] [FILE] class-wp-customize-manager.php [ edit | delete | rename ] [FILE] class-wp-customize-nav-menus.php [ edit | delete | rename ] [FILE] class-wp-customize-panel.php [ edit | delete | rename ] [FILE] class-wp-customize-section.php [ edit | delete | rename ] [FILE] class-wp-customize-setting.php [ edit | delete | rename ] [FILE] class-wp-customize-widgets.php [ edit | delete | rename ] [FILE] class-wp-date-query.php [ edit | delete | rename ] [FILE] class-wp-dependencies.php [ edit | delete | rename ] [FILE] class-wp-dependency.php [ edit | delete | rename ] [FILE] class-wp-duotone.php [ edit | delete | rename ] [FILE] class-wp-editor.php [ edit | delete | rename ] [FILE] class-wp-embed.php [ edit | delete | rename ] [FILE] class-wp-error.php [ edit | delete | rename ] [FILE] class-wp-fatal-error-handler.php [ edit | delete | rename ] [FILE] class-wp-feed-cache-transient.php [ edit | delete | rename ] [FILE] class-wp-feed-cache.php [ edit | delete | rename ] [FILE] class-wp-hook.php [ edit | delete | rename ] [FILE] class-wp-http-cookie.php [ edit | delete | rename ] [FILE] class-wp-http-curl.php [ edit | delete | rename ] [FILE] class-wp-http-encoding.php [ edit | delete | rename ] [FILE] class-wp-http-ixr-client.php [ edit | delete | rename ] [FILE] class-wp-http-proxy.php [ edit | delete | rename ] [FILE] class-wp-http-requests-hooks.php [ edit | delete | rename ] [FILE] class-wp-http-requests-response.php [ edit | delete | rename ] [FILE] class-wp-http-response.php [ edit | delete | rename ] [FILE] class-wp-http-streams.php [ edit | delete | rename ] [FILE] class-wp-http.php [ edit | delete | rename ] [FILE] class-wp-image-editor-gd.php [ edit | delete | rename ] [FILE] class-wp-image-editor-imagick.php [ edit | delete | rename ] [FILE] class-wp-image-editor.php [ edit | delete | rename ] [FILE] class-wp-list-util.php [ edit | delete | rename ] [FILE] class-wp-locale-switcher.php [ edit | delete | rename ] [FILE] class-wp-locale.php [ edit | delete | rename ] [FILE] class-wp-matchesmapregex.php [ edit | delete | rename ] [FILE] class-wp-meta-query.php [ edit | delete | rename ] [FILE] class-wp-metadata-lazyloader.php [ edit | delete | rename ] [FILE] class-wp-navigation-fallback.php [ edit | delete | rename ] [FILE] class-wp-network-query.php [ edit | delete | rename ] [FILE] class-wp-network.php [ edit | delete | rename ] [FILE] class-wp-object-cache.php [ edit | delete | rename ] [FILE] class-wp-oembed-controller.php [ edit | delete | rename ] [FILE] class-wp-oembed.php [ edit | delete | rename ] [FILE] class-wp-paused-extensions-storage.php [ edit | delete | rename ] [FILE] class-wp-plugin-dependencies.php [ edit | delete | rename ] [FILE] class-wp-post-type.php [ edit | delete | rename ] [FILE] class-wp-post.php [ edit | delete | rename ] [FILE] class-wp-query.php [ edit | delete | rename ] [FILE] class-wp-recovery-mode-cookie-service.php [ edit | delete | rename ] [FILE] class-wp-recovery-mode-email-service.php [ edit | delete | rename ] [FILE] class-wp-recovery-mode-key-service.php [ edit | delete | rename ] [FILE] class-wp-recovery-mode-link-service.php [ edit | delete | rename ] [FILE] class-wp-recovery-mode.php [ edit | delete | rename ] [FILE] class-wp-rewrite.php [ edit | delete | rename ] [FILE] class-wp-role.php [ edit | delete | rename ] [FILE] class-wp-roles.php [ edit | delete | rename ] [FILE] class-wp-script-modules.php [ edit | delete | rename ] [FILE] class-wp-scripts.php [ edit | delete | rename ] [FILE] class-wp-session-tokens.php [ edit | delete | rename ] [FILE] class-wp-simplepie-file.php [ edit | delete | rename ] [FILE] class-wp-simplepie-sanitize-kses.php [ edit | delete | rename ] [FILE] class-wp-site-query.php [ edit | delete | rename ] [FILE] class-wp-site.php [ edit | delete | rename ] [FILE] class-wp-styles.php [ edit | delete | rename ] [FILE] class-wp-tax-query.php [ edit | delete | rename ] [FILE] class-wp-taxonomy.php [ edit | delete | rename ] [FILE] class-wp-term-query.php [ edit | delete | rename ] [FILE] class-wp-term.php [ edit | delete | rename ] [FILE] class-wp-text-diff-renderer-inline.php [ edit | delete | rename ] [FILE] class-wp-text-diff-renderer-table.php [ edit | delete | rename ] [FILE] class-wp-textdomain-registry.php [ edit | delete | rename ] [FILE] class-wp-theme-json-data.php [ edit | delete | rename ] [FILE] class-wp-theme-json-resolver.php [ edit | delete | rename ] [FILE] class-wp-theme-json-schema.php [ edit | delete | rename ] [FILE] class-wp-theme-json.php [ edit | delete | rename ] [FILE] class-wp-theme.php [ edit | delete | rename ] [FILE] class-wp-token-map.php [ edit | delete | rename ] [FILE] class-wp-user-meta-session-tokens.php [ edit | delete | rename ] [FILE] class-wp-user-query.php [ edit | delete | rename ] [FILE] class-wp-user-request.php [ edit | delete | rename ] [FILE] class-wp-user.php [ edit | delete | rename ] [FILE] class-wp-walker.php [ edit | delete | rename ] [FILE] class-wp-widget-factory.php [ edit | delete | rename ] [FILE] class-wp-widget.php [ edit | delete | rename ] [FILE] class-wp-xmlrpc-server.php [ edit | delete | rename ] [FILE] class-wp.php [ edit | delete | rename ] [FILE] class-wpdb.php [ edit | delete | rename ] [FILE] class.wp-dependencies.php [ edit | delete | rename ] [FILE] class.wp-scripts.php [ edit | delete | rename ] [FILE] class.wp-styles.php [ edit | delete | rename ] [FILE] comment-template.php [ edit | delete | rename ] [FILE] comment.php [ edit | delete | rename ] [FILE] compat.php [ edit | delete | rename ] [FILE] cron.php [ edit | delete | rename ] [DIR] css [ delete | rename ] [DIR] customize [ delete | rename ] [FILE] date.php [ edit | delete | rename ] [FILE] default-constants.php [ edit | delete | rename ] [FILE] default-filters.php [ edit | delete | rename ] [FILE] default-widgets.php [ edit | delete | rename ] [FILE] deprecated.php [ edit | delete | rename ] [FILE] embed-template.php [ edit | delete | rename ] [FILE] embed.php [ edit | delete | rename ] [FILE] error-protection.php [ edit | delete | rename ] [FILE] feed-atom-comments.php [ edit | delete | rename ] [FILE] feed-atom.php [ edit | delete | rename ] [FILE] feed-rdf.php [ edit | delete | rename ] [FILE] feed-rss.php [ edit | delete | rename ] [FILE] feed-rss2-comments.php [ edit | delete | rename ] [FILE] feed-rss2.php [ edit | delete | rename ] [FILE] feed.php [ edit | delete | rename ] [DIR] fonts [ delete | rename ] [FILE] fonts.php [ edit | delete | rename ] [FILE] formatting.php [ edit | delete | rename ] [FILE] functions.php [ edit | delete | rename ] [FILE] functions.wp-scripts.php [ edit | delete | rename ] [FILE] functions.wp-styles.php [ edit | delete | rename ] [FILE] general-template.php [ edit | delete | rename ] [FILE] global-styles-and-settings.php [ edit | delete | rename ] [DIR] html-api [ delete | rename ] [FILE] http.php [ edit | delete | rename ] [FILE] https-detection.php [ edit | delete | rename ] [FILE] https-migration.php [ edit | delete | rename ] [DIR] images [ delete | rename ] [DIR] interactivity-api [ delete | rename ] [DIR] js [ delete | rename ] [FILE] kses.php [ edit | delete | rename ] [DIR] l10n [ delete | rename ] [FILE] l10n.php [ edit | delete | rename ] [FILE] link-template.php [ edit | delete | rename ] [FILE] load.php [ edit | delete | rename ] [FILE] locale.php [ edit | delete | rename ] [FILE] media-template.php [ edit | delete | rename ] [FILE] media.php [ edit | delete | rename ] [FILE] meta.php [ edit | delete | rename ] [FILE] ms-blogs.php [ edit | delete | rename ] [FILE] ms-default-constants.php [ edit | delete | rename ] [FILE] ms-default-filters.php [ edit | delete | rename ] [FILE] ms-deprecated.php [ edit | delete | rename ] [FILE] ms-files.php [ edit | delete | rename ] [FILE] ms-functions.php [ edit | delete | rename ] [FILE] ms-load.php [ edit | delete | rename ] [FILE] ms-network.php [ edit | delete | rename ] [FILE] ms-settings.php [ edit | delete | rename ] [FILE] ms-site.php [ edit | delete | rename ] [FILE] nav-menu-template.php [ edit | delete | rename ] [FILE] nav-menu.php [ edit | delete | rename ] [FILE] option.php [ edit | delete | rename ] [DIR] php-compat [ delete | rename ] [FILE] pluggable-deprecated.php [ edit | delete | rename ] [FILE] pluggable.php [ edit | delete | rename ] [FILE] plugin.php [ edit | delete | rename ] [DIR] pomo [ delete | rename ] [FILE] post-formats.php [ edit | delete | rename ] [FILE] post-template.php [ edit | delete | rename ] [FILE] post-thumbnail-template.php [ edit | delete | rename ] [FILE] post.php [ edit | delete | rename ] [FILE] query.php [ edit | delete | rename ] [FILE] registration-functions.php [ edit | delete | rename ] [FILE] registration.php [ edit | delete | rename ] [DIR] rest-api [ delete | rename ] [FILE] rest-api.php [ edit | delete | rename ] [FILE] revision.php [ edit | delete | rename ] [FILE] rewrite.php [ edit | delete | rename ] [FILE] robots-template.php [ edit | delete | rename ] [FILE] rss-functions.php [ edit | delete | rename ] [FILE] rss.php [ edit | delete | rename ] [FILE] script-loader.php [ edit | delete | rename ] [FILE] script-modules.php [ edit | delete | rename ] [FILE] session.php [ edit | delete | rename ] [FILE] shortcodes.php [ edit | delete | rename ] [DIR] sitemaps [ delete | rename ] [FILE] sitemaps.php [ edit | delete | rename ] [DIR] sodium_compat [ delete | rename ] [FILE] spl-autoload-compat.php [ edit | delete | rename ] [DIR] style-engine [ delete | rename ] [FILE] style-engine.php [ edit | delete | rename ] [FILE] taxonomy.php [ edit | delete | rename ] [FILE] template-canvas.php [ edit | delete | rename ] [FILE] template-loader.php [ edit | delete | rename ] [FILE] template.php [ edit | delete | rename ] [DIR] theme-compat [ delete | rename ] [FILE] theme-i18n.json [ edit | delete | rename ] [FILE] theme-previews.php [ edit | delete | rename ] [FILE] theme-templates.php [ edit | delete | rename ] [FILE] theme.json [ edit | delete | rename ] [FILE] theme.php [ edit | delete | rename ] [FILE] update.php [ edit | delete | rename ] [FILE] user.php [ edit | delete | rename ] [FILE] vars.php [ edit | delete | rename ] [FILE] version.php [ edit | delete | rename ] [DIR] widgets [ delete | rename ] [FILE] widgets.php [ edit | delete | rename ] [FILE] wp-db.php [ edit | delete | rename ] [FILE] wp-diff.php [ edit | delete | rename ] Viewing: /var/www/designbasics/wp-includes/class-wp-block-parser.php <?php /** * Block Serialization Parser * * @package WordPress */ /** * Class WP_Block_Parser * * Parses a document and constructs a list of parsed block objects * * @since 5.0.0 * @since 4.0.0 returns arrays not objects, all attributes are arrays */ class WP_Block_Parser { /** * Input document being parsed * * @example "Pre-text\n<!-- wp:paragraph -->This is inside a block!<!-- /wp:paragraph -->" * * @since 5.0.0 * @var string */ public $document; /** * Tracks parsing progress through document * * @since 5.0.0 * @var int */ public $offset; /** * List of parsed blocks * * @since 5.0.0 * @var WP_Block_Parser_Block[] */ public $output; /** * Stack of partially-parsed structures in memory during parse * * @since 5.0.0 * @var WP_Block_Parser_Frame[] */ public $stack; /** * 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. * * @since 5.0.0 * * @param string $document Input document being parsed. * @return array[] */ public function parse( $document ) { $this->document = $document; $this->offset = 0; $this->output = array(); $this->stack = array(); while ( $this->proceed() ) { continue; } return $this->output; } /** * 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. * * @internal * @since 5.0.0 * @return bool */ public function proceed() { $next_token = $this->next_token(); list( $token_type, $block_name, $attrs, $start_offset, $token_length ) = $next_token; $stack_depth = count( $this->stack ); // we may have some HTML soup before the next block. $leading_html_start = $start_offset > $this->offset ? $this->offset : null; switch ( $token_type ) { case 'no-more-tokens': // if not in a block then flush output. if ( 0 === $stack_depth ) { $this->add_freeform(); return false; } /* * Otherwise we have a problem * This is an error * * we have options * - treat it all as freeform text * - assume an implicit closer (easiest when not nesting) */ // for the easy case we'll assume an implicit closer. if ( 1 === $stack_depth ) { $this->add_block_from_stack(); return false; } /* * for the nested case where it's more difficult we'll * have to assume that multiple closers are missing * and so we'll collapse the whole stack piecewise */ while ( 0 < count( $this->stack ) ) { $this->add_block_from_stack(); } return false; case 'void-block': /* * easy case is if we stumbled upon a void block * in the top-level of the document */ if ( 0 === $stack_depth ) { if ( isset( $leading_html_start ) ) { $this->output[] = (array) $this->freeform( substr( $this->document, $leading_html_start, $start_offset - $leading_html_start ) ); } $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ); $this->offset = $start_offset + $token_length; return true; } // otherwise we found an inner block. $this->add_inner_block( new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length ); $this->offset = $start_offset + $token_length; return true; case 'block-opener': // track all newly-opened blocks on the stack. array_push( $this->stack, new WP_Block_Parser_Frame( new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length, $start_offset + $token_length, $leading_html_start ) ); $this->offset = $start_offset + $token_length; return true; case 'block-closer': /* * if we're missing an opener we're in trouble * This is an error */ if ( 0 === $stack_depth ) { /* * we have options * - assume an implicit opener * - assume _this_ is the opener * - give up and close out the document */ $this->add_freeform(); return false; } // if we're not nesting then this is easy - close the block. if ( 1 === $stack_depth ) { $this->add_block_from_stack( $start_offset ); $this->offset = $start_offset + $token_length; return true; } /* * otherwise we're nested and we have to close out the current * block and add it as a new innerBlock to the parent */ $stack_top = array_pop( $this->stack ); $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); $stack_top->block->innerHTML .= $html; $stack_top->block->innerContent[] = $html; $stack_top->prev_offset = $start_offset + $token_length; $this->add_inner_block( $stack_top->block, $stack_top->token_start, $stack_top->token_length, $start_offset + $token_length ); $this->offset = $start_offset + $token_length; return true; default: // This is an error. $this->add_freeform(); return false; } } /** * 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 * * @internal * @since 5.0.0 * @since 4.6.1 fixed a bug in attribute parsing which caused catastrophic backtracking on invalid block comments * @return array */ public function next_token() { $matches = null; /* * aye the magic * we're using a single RegExp to tokenize the block comment delimiters * we're also using a trick here because the only difference between a * block opener and a block closer is the leading `/` before `wp:` (and * a closer has no attributes). we can trap them both and process the * match back in PHP to see which one it was. */ $has_match = preg_match( '/<!--\s+(?P<closer>\/)?wp:(?P<namespace>[a-z][a-z0-9_-]*\/)?(?P<name>[a-z][a-z0-9_-]*)\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s', $this->document, $matches, PREG_OFFSET_CAPTURE, $this->offset ); // if we get here we probably have catastrophic backtracking or out-of-memory in the PCRE. if ( false === $has_match ) { return array( 'no-more-tokens', null, null, null, null ); } // we have no more tokens. if ( 0 === $has_match ) { return array( 'no-more-tokens', null, null, null, null ); } list( $match, $started_at ) = $matches[0]; $length = strlen( $match ); $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1]; $is_void = isset( $matches['void'] ) && -1 !== $matches['void'][1]; $namespace = $matches['namespace']; $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/'; $name = $namespace . $matches['name'][0]; $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1]; /* * Fun fact! It's not trivial in PHP to create "an empty associative array" since all arrays * are associative arrays. If we use `array()` we get a JSON `[]` */ $attrs = $has_attrs ? json_decode( $matches['attrs'][0], /* as-associative */ true ) : array(); /* * This state isn't allowed * This is an error */ if ( $is_closer && ( $is_void || $has_attrs ) ) { // we can ignore them since they don't hurt anything. } if ( $is_void ) { return array( 'void-block', $name, $attrs, $started_at, $length ); } if ( $is_closer ) { return array( 'block-closer', $name, null, $started_at, $length ); } return array( 'block-opener', $name, $attrs, $started_at, $length ); } /** * Returns a new block object for freeform HTML * * @internal * @since 3.9.0 * * @param string $inner_html HTML content of block. * @return WP_Block_Parser_Block freeform block object. */ public function freeform( $inner_html ) { return new WP_Block_Parser_Block( null, array(), array(), $inner_html, array( $inner_html ) ); } /** * Pushes a length of text from the input document * to the output list as a freeform block. * * @internal * @since 5.0.0 * @param null $length how many bytes of document text to output. */ public function add_freeform( $length = null ) { $length = $length ? $length : strlen( $this->document ) - $this->offset; if ( 0 === $length ) { return; } $this->output[] = (array) $this->freeform( substr( $this->document, $this->offset, $length ) ); } /** * Given a block structure from memory pushes * a new block to the output list. * * @internal * @since 5.0.0 * @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. */ public function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) { $parent = $this->stack[ count( $this->stack ) - 1 ]; $parent->block->innerBlocks[] = (array) $block; $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); if ( ! empty( $html ) ) { $parent->block->innerHTML .= $html; $parent->block->innerContent[] = $html; } $parent->block->innerContent[] = null; $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; } /** * Pushes the top block from the parsing stack to the output list. * * @internal * @since 5.0.0 * @param int|null $end_offset byte offset into document for where we should stop sending text output as HTML. */ public function add_block_from_stack( $end_offset = null ) { $stack_top = array_pop( $this->stack ); $prev_offset = $stack_top->prev_offset; $html = isset( $end_offset ) ? substr( $this->document, $prev_offset, $end_offset - $prev_offset ) : substr( $this->document, $prev_offset ); if ( ! empty( $html ) ) { $stack_top->block->innerHTML .= $html; $stack_top->block->innerContent[] = $html; } if ( isset( $stack_top->leading_html_start ) ) { $this->output[] = (array) $this->freeform( substr( $this->document, $stack_top->leading_html_start, $stack_top->token_start - $stack_top->leading_html_start ) ); } $this->output[] = (array) $stack_top->block; } } /** * WP_Block_Parser_Block class. * * Required for backward compatibility in WordPress Core. */ require_once __DIR__ . '/class-wp-block-parser-block.php'; /** * WP_Block_Parser_Frame class. * * Required for backward compatibility in WordPress Core. */ require_once __DIR__ . '/class-wp-block-parser-frame.php';