= $this->get_all_registered(); if ( ! $all_templates ) { return null; } foreach ( $all_templates as $template ) { if ( $template->slug === $template_slug ) { return $template; } } return null; } /** * Retrieves registered templates matching a query. * * @since 6.7.0 * * @param array $query { * Arguments to retrieve templates. Optional, empty by default. * * @type string[] $slug__in List of slugs to include. * @type string[] $slug__not_in List of slugs to skip. * @type string $post_type Post type to get the templates for. * } * @return WP_Block_Template[] Associative array of `$template_name => $template` pairs. */ public function get_by_query( $query = array() ) { $all_templates = $this->get_all_registered(); if ( ! $all_templates ) { return array(); } $query = wp_parse_args( $query, array( 'slug__in' => array(), 'slug__not_in' => array(), 'post_type' => '', ) ); $slugs_to_include = $query['slug__in']; $slugs_to_skip = $query['slug__not_in']; $post_type = $query['post_type']; $matching_templates = array(); foreach ( $all_templates as $template_name => $template ) { if ( $slugs_to_include && ! in_array( $template->slug, $slugs_to_include, true ) ) { continue; } if ( $slugs_to_skip && in_array( $template->slug, $slugs_to_skip, true ) ) { continue; } if ( $post_type && ! in_array( $post_type, $template->post_types, true ) ) { continue; } $matching_templates[ $template_name ] = $template; } return $matching_templates; } /** * Checks if a template is registered. * * @since 6.7.0 * * @param string $template_name Template name. * @return bool True if the template is registered, false otherwise. */ public function is_registered( $template_name ) { return isset( $this->registered_templates[ $template_name ] ); } /** * Unregisters a template. * * @since 6.7.0 * * @param string $template_name Template name including namespace. * @return WP_Block_Template|WP_Error The unregistered template on success, or WP_Error on failure. */ public function unregister( $template_name ) { if ( ! $this->is_registered( $template_name ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Template name. */ sprintf( __( 'Template "%s" is not registered.' ), $template_name ), '6.7.0' ); /* translators: %s: Template name. */ return new WP_Error( 'template_not_registered', __( 'Template "%s" is not registered.' ) ); } $unregistered_template = $this->registered_templates[ $template_name ]; unset( $this->registered_templates[ $template_name ] ); return $unregistered_template; } /** * Utility method to retrieve the main instance of the class. * * The instance will be created if it does not exist yet. * * @since 6.7.0 * * @return WP_Block_Templates_Registry The main instance. */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } null, 'color' => isset( $border['color'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'color' ) ? $border['color'] : null, 'style' => isset( $border['style'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'style' ) ? $border['style'] : null, ); $border_block_styles[ $side ] = $border_side_values; } } // Collect classes and styles. $attributes = array(); $styles = wp_style_engine_get_styles( array( 'border' => $border_block_styles ) ); if ( ! empty( $styles['classnames'] ) ) { $attributes['class'] = $styles['classnames']; } if ( ! empty( $styles['css'] ) ) { $attributes['style'] = $styles['css']; } return $attributes; } /** * Checks whether the current block type supports the border feature requested. * * If the `__experimentalBorder` support flag is a boolean `true` all border * support features are available. Otherwise, the specific feature's support * flag nested under `experimentalBorder` must be enabled for the feature * to be opted into. * * @since 5.8.0 * @access private * * @param WP_Block_Type $block_type Block type to check for support. * @param string $feature Name of the feature to check support for. * @param mixed $default_value Fallback value for feature support, defaults to false. * @return bool Whether the feature is supported. */ function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) { // Check if all border support features have been opted into via `"__experimentalBorder": true`. if ( $block_type instanceof WP_Block_Type ) { $block_type_supports_border = isset( $block_type->supports['__experimentalBorder'] ) ? $block_type->supports['__experimentalBorder'] : $default_value; if ( true === $block_type_supports_border ) { return true; } } // Check if the specific feature has been opted into individually // via nested flag under `__experimentalBorder`. return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default_value ); } // Register the block support. WP_Block_Supports::get_instance()->register( 'border', array( 'register_attribute' => 'wp_register_border_support', 'apply' => 'wp_apply_border_support', ) );
Fatal error: Uncaught Error: Class "WP_Block_Parser_Block" not found in /htdocs/wp-includes/class-wp-block-parser.php:312 Stack trace: #0 /htdocs/wp-includes/class-wp-block-parser.php(330): WP_Block_Parser->freeform('OceanWP') #1 /htdocs/wp-includes/class-wp-block-parser.php(102): WP_Block_Parser->add_freeform() #2 /htdocs/wp-includes/class-wp-block-parser.php(69): WP_Block_Parser->proceed() #3 /htdocs/wp-includes/blocks.php(2226): WP_Block_Parser->parse('OceanWP') #4 /htdocs/wp-includes/blocks.php(1820): parse_blocks('OceanWP') #5 /htdocs/wp-includes/formatting.php(5200): filter_block_content('OceanWP', Array, Array) #6 /htdocs/wp-includes/class-wp-hook.php(324): wp_pre_kses_block_attributes('OceanWP', Array, Array) #7 /htdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters('OceanWP', Array) #8 /htdocs/wp-includes/kses.php(946): apply_filters('pre_kses', 'OceanWP', Array, Array) #9 /htdocs/wp-includes/kses.php(754): wp_kses_hook('OceanWP', Array, Array) #10 /htdocs/wp-includes/class-wp-theme.php(961): wp_kses('OceanWP', Array) #11 /htdocs/wp-includes/class-wp-theme.php(893): WP_Theme->sanitize_header('Name', 'OceanWP') #12 /htdocs/wp-includes/class-wp-theme.php(595): WP_Theme->get('Name') #13 /htdocs/wp-content/plugins/ocean-extra/ocean-extra.php(145): WP_Theme->__get('name') #14 /htdocs/wp-content/plugins/ocean-extra/ocean-extra.php(222): Ocean_Extra->__construct() #15 /htdocs/wp-content/plugins/ocean-extra/ocean-extra.php(31): Ocean_Extra::instance() #16 /htdocs/wp-content/plugins/ocean-extra/ocean-extra.php(34): Ocean_Extra() #17 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #18 /htdocs/wp-config.php(100): require_once('/htdocs/wp-sett...') #19 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #20 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #21 /htdocs/index.php(17): require('/htdocs/wp-blog...') #22 {main} thrown in /htdocs/wp-includes/class-wp-block-parser.php on line 312