Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-inclu.../block-su...
File: custom-classname.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Custom classname block support flag.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @since 5.6.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Registers the custom classname block attribute for block types that support it.
[9] Fix | Delete
*
[10] Fix | Delete
* @since 5.6.0
[11] Fix | Delete
* @access private
[12] Fix | Delete
*
[13] Fix | Delete
* @param WP_Block_Type $block_type Block Type.
[14] Fix | Delete
*/
[15] Fix | Delete
function wp_register_custom_classname_support( $block_type ) {
[16] Fix | Delete
$has_custom_classname_support = block_has_support( $block_type, 'customClassName', true );
[17] Fix | Delete
[18] Fix | Delete
if ( $has_custom_classname_support ) {
[19] Fix | Delete
if ( ! $block_type->attributes ) {
[20] Fix | Delete
$block_type->attributes = array();
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
if ( ! array_key_exists( 'className', $block_type->attributes ) ) {
[24] Fix | Delete
$block_type->attributes['className'] = array(
[25] Fix | Delete
'type' => 'string',
[26] Fix | Delete
);
[27] Fix | Delete
}
[28] Fix | Delete
}
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Adds the custom classnames to the output.
[33] Fix | Delete
*
[34] Fix | Delete
* @since 5.6.0
[35] Fix | Delete
* @access private
[36] Fix | Delete
*
[37] Fix | Delete
* @param WP_Block_Type $block_type Block Type.
[38] Fix | Delete
* @param array $block_attributes Block attributes.
[39] Fix | Delete
*
[40] Fix | Delete
* @return array Block CSS classes and inline styles.
[41] Fix | Delete
*/
[42] Fix | Delete
function wp_apply_custom_classname_support( $block_type, $block_attributes ) {
[43] Fix | Delete
$has_custom_classname_support = block_has_support( $block_type, 'customClassName', true );
[44] Fix | Delete
$attributes = array();
[45] Fix | Delete
if ( $has_custom_classname_support ) {
[46] Fix | Delete
$has_custom_classnames = array_key_exists( 'className', $block_attributes );
[47] Fix | Delete
[48] Fix | Delete
if ( $has_custom_classnames ) {
[49] Fix | Delete
$attributes['class'] = $block_attributes['className'];
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
return $attributes;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
// Register the block support.
[57] Fix | Delete
WP_Block_Supports::get_instance()->register(
[58] Fix | Delete
'custom-classname',
[59] Fix | Delete
array(
[60] Fix | Delete
'register_attribute' => 'wp_register_custom_classname_support',
[61] Fix | Delete
'apply' => 'wp_apply_custom_classname_support',
[62] Fix | Delete
)
[63] Fix | Delete
);
[64] Fix | Delete
[65] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function