Grouped backports for the 6.8 branch.
- Interactivity API: Skip binding event handler attributes. The corresponding `data-wp-on--` attribute should be used instead. - Customize: Introduce a fix for themes that pass a stringable object through the `template_include` filter despite it being documented as only accepting a string. Built from https://develop.svn.wordpress.org/branches/6.8@61922 git-svn-id: http://core.svn.wordpress.org/branches/6.8@61204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -174,7 +174,9 @@ final class WP_Block_Patterns_Registry {
|
|||||||
$patterns = &$this->registered_patterns;
|
$patterns = &$this->registered_patterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern_path = realpath( $patterns[ $pattern_name ]['filePath'] ?? '' );
|
$file_path = $patterns[ $pattern_name ]['filePath'] ?? '';
|
||||||
|
$is_stringy = is_string( $file_path ) || ( is_object( $file_path ) && method_exists( $file_path, '__toString' ) );
|
||||||
|
$pattern_path = $is_stringy ? realpath( (string) $file_path ) : null;
|
||||||
if (
|
if (
|
||||||
! isset( $patterns[ $pattern_name ]['content'] ) &&
|
! isset( $patterns[ $pattern_name ]['content'] ) &&
|
||||||
is_string( $pattern_path ) &&
|
is_string( $pattern_path ) &&
|
||||||
|
|||||||
@@ -868,6 +868,20 @@ final class WP_Interactivity_API {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip if the bound attribute is an event handler.
|
||||||
|
if ( str_starts_with( $bound_attribute, 'on' ) ) {
|
||||||
|
_doing_it_wrong(
|
||||||
|
__METHOD__,
|
||||||
|
sprintf(
|
||||||
|
/* translators: %s: The directive, e.g. data-wp-on--click. */
|
||||||
|
__( 'Binding event handler attributes is not supported. Please use "%s" instead.' ),
|
||||||
|
esc_attr( 'data-wp-on--' . substr( $bound_attribute, 2 ) )
|
||||||
|
),
|
||||||
|
'6.8.5'
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$attribute_value = $p->get_attribute( $attribute_name );
|
$attribute_value = $p->get_attribute( $attribute_name );
|
||||||
$result = $this->evaluate( $attribute_value );
|
$result = $this->evaluate( $attribute_value );
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,8 @@ if ( wp_using_themes() ) {
|
|||||||
* @param string $template The path of the template to include.
|
* @param string $template The path of the template to include.
|
||||||
*/
|
*/
|
||||||
$template = apply_filters( 'template_include', $template );
|
$template = apply_filters( 'template_include', $template );
|
||||||
$template = is_string( $template ) ? realpath( $template ) : null;
|
$is_stringy = is_string( $template ) || ( is_object( $template ) && method_exists( $template, '__toString' ) );
|
||||||
|
$template = $is_stringy ? realpath( (string) $template ) : null;
|
||||||
if (
|
if (
|
||||||
is_string( $template ) &&
|
is_string( $template ) &&
|
||||||
( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&
|
( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user