Skip to content

Commit 6c22d69

Browse files
Code Modernization: Use str_starts_with() in WP_Duotone class methods.
This aims to make the code more readable and consistent, as the function is already used extensively in core files. WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9. Follow-up to [55703], [58313]. Props Soean, mukesh27. Fixes #64773. git-svn-id: https://develop.svn.wordpress.org/trunk@61781 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b8855c4 commit 6c22d69

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/wp-includes/class-wp-duotone.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ public static function restore_image_outer_container( $block_content ) {
11931193

11941194
$inner_classnames = explode( ' ', $tags->get_attribute( 'class' ) );
11951195
foreach ( $inner_classnames as $classname ) {
1196-
if ( 0 === strpos( $classname, 'wp-duotone' ) ) {
1196+
if ( str_starts_with( $classname, 'wp-duotone' ) ) {
11971197
$tags->remove_class( $classname );
11981198
$tags->seek( 'wrapper-div' );
11991199
$tags->add_class( $classname );

0 commit comments

Comments
 (0)