IP : 18.191.246.216Hostname : server86.web-hosting.comKernel : Linux server86.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
servlmvm/
public_html/
wp-includes/
class-wp-block-supports.php/
/
/** * Tracks the current block to be rendered. * * @since 5.6.0 * @var array */ public static $block_to_render = null;
/** * Container for the main instance of the class. * * @since 5.6.0 * @var WP_Block_Supports|null */ private static $instance = null;
/** * Utility method to retrieve the main instance of the class. * * The instance will be created if it does not exist yet. * * @since 5.6.0 * * @return WP_Block_Supports The main instance. */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); }
return self::$instance; }
/** * Initializes the block supports. It registers the block supports block attributes. * * @since 5.6.0 */ public static function init() { $instance = self::get_instance(); $instance->register_attributes(); }
/** * Registers a block support. * * @since 5.6.0 * * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/ * * @param string $block_support_name Block support name. * @param array $block_support_config Array containing the properties of the block support. */ public function register( $block_support_name, $block_support_config ) { $this->block_supports[ $block_support_name ] = array_merge( $block_support_config, array( 'name' => $block_support_name ) ); }
/** * Generates an array of HTML attributes, such as classes, by applying to * the given block all of the features that the block supports. * * @since 5.6.0 * * @return string[] Array of HTML attribute values keyed by their name. */ public function apply_block_supports() { $block_type = WP_Block_Type_Registry::get_instance()->get_registered( self::$block_to_render['blockName'] );
// If no render_callback, assume styles have been previously handled. if ( ! $block_type || empty( $block_type ) ) { return array(); }
/** * Generates a string of attributes by applying to the current block being * rendered all of the features that the block supports. * * @since 5.6.0 * * @param string[] $extra_attributes Optional. Array of extra attributes to render on the block wrapper. * @return string String of HTML attributes. */ function get_block_wrapper_attributes( $extra_attributes = array() ) { $new_attributes = WP_Block_Supports::get_instance()->apply_block_supports();
// This is hardcoded on purpose. // We only support a fixed list of attributes. $attributes_to_merge = array( 'style', 'class', 'id', 'aria-label' ); $attributes = array(); foreach ( $attributes_to_merge as $attribute_name ) { if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) { continue; }