@@ -462,50 +462,47 @@ private function replace_html( string $block_content, string $attribute_name, $s
462462 }
463463
464464 private static function get_block_bindings_processor ( string $ block_content ) {
465- static $ internal_processor_class = null ;
466- if ( null === $ internal_processor_class ) {
467- $ internal_processor_class = new class ('' , WP_HTML_Processor::CONSTRUCTOR_UNLOCK_CODE ) extends WP_HTML_Processor {
468- /**
469- * Replace the rich text content between a tag opener and matching closer.
470- *
471- * When stopped on a tag opener, replace the content enclosed by it and its
472- * matching closer with the provided rich text.
473- *
474- * @param string $rich_text The rich text to replace the original content with.
475- * @return bool True on success.
476- */
477- public function replace_rich_text ( $ rich_text ) {
478- if ( $ this ->is_tag_closer () ) {
479- return false ;
480- }
465+ $ internal_processor_class = new class ('' , WP_HTML_Processor::CONSTRUCTOR_UNLOCK_CODE ) extends WP_HTML_Processor {
466+ /**
467+ * Replace the rich text content between a tag opener and matching closer.
468+ *
469+ * When stopped on a tag opener, replace the content enclosed by it and its
470+ * matching closer with the provided rich text.
471+ *
472+ * @param string $rich_text The rich text to replace the original content with.
473+ * @return bool True on success.
474+ */
475+ public function replace_rich_text ( $ rich_text ) {
476+ if ( $ this ->is_tag_closer () ) {
477+ return false ;
478+ }
481479
482- $ depth = $ this ->get_current_depth ();
480+ $ depth = $ this ->get_current_depth ();
483481
484- $ this ->set_bookmark ( '_wp_block_bindings_tag_opener ' );
485- // The bookmark names are prefixed with `_` so the key below has an extra `_`.
486- $ tag_opener = $ this ->bookmarks ['__wp_block_bindings_tag_opener ' ];
487- $ start = $ tag_opener ->start + $ tag_opener ->length ;
488- $ this ->release_bookmark ( '_wp_block_bindings_tag_opener ' );
482+ $ this ->set_bookmark ( '_wp_block_bindings_tag_opener ' );
483+ // The bookmark names are prefixed with `_` so the key below has an extra `_`.
484+ $ tag_opener = $ this ->bookmarks ['__wp_block_bindings_tag_opener ' ];
485+ $ start = $ tag_opener ->start + $ tag_opener ->length ;
486+ $ this ->release_bookmark ( '_wp_block_bindings_tag_opener ' );
489487
490- // Find matching tag closer.
491- while ( $ this ->next_token () && $ this ->get_current_depth () >= $ depth ) {
492- }
488+ // Find matching tag closer.
489+ while ( $ this ->next_token () && $ this ->get_current_depth () >= $ depth ) {
490+ }
493491
494- $ this ->set_bookmark ( '_wp_block_bindings_tag_closer ' );
495- $ tag_closer = $ this ->bookmarks ['__wp_block_bindings_tag_closer ' ];
496- $ end = $ tag_closer ->start ;
497- $ this ->release_bookmark ( '_wp_block_bindings_tag_closer ' );
492+ $ this ->set_bookmark ( '_wp_block_bindings_tag_closer ' );
493+ $ tag_closer = $ this ->bookmarks ['__wp_block_bindings_tag_closer ' ];
494+ $ end = $ tag_closer ->start ;
495+ $ this ->release_bookmark ( '_wp_block_bindings_tag_closer ' );
498496
499- $ this ->lexical_updates [] = new WP_HTML_Text_Replacement (
500- $ start ,
501- $ end - $ start ,
502- $ rich_text
503- );
497+ $ this ->lexical_updates [] = new WP_HTML_Text_Replacement (
498+ $ start ,
499+ $ end - $ start ,
500+ $ rich_text
501+ );
504502
505- return true ;
506- }
507- };
508- }
503+ return true ;
504+ }
505+ };
509506
510507 return $ internal_processor_class ::create_fragment ( $ block_content );
511508 }
0 commit comments