@@ -23,6 +23,9 @@ function get_supports(): array {
23
23
* @return string|null The normalized HTML or null if not supported.
24
24
*/
25
25
function get_normalized_html ( string $ html , array $ options ): ?string {
26
+ $ cfacn = new ReflectionMethod ( WP_HTML_Processor::class, 'create_fragment_at_current_node ' );
27
+ $ cfacn ->setAccessible ( true );
28
+
26
29
if (
27
30
method_exists ( WP_HTML_Processor::class, 'create_fragment_at_current_node ' ) &&
28
31
$ options ['context_html ' ]
@@ -40,7 +43,7 @@ function get_normalized_html( string $html, array $options ): ?string {
40
43
* @var WP_HTML_Processor|null $processor
41
44
* @disregard P1013
42
45
*/
43
- $ processor = $ context_processor -> create_fragment_at_current_node ( $ html );
46
+ $ processor = $ cfacn -> invoke ( $ context_processor , $ html );
44
47
}
45
48
} else {
46
49
$ processor = WP_HTML_Processor::create_full_parser ( $ html );
@@ -73,6 +76,9 @@ function get_tree( string $html, array $options ): array {
73
76
$ processor_bookmarks = new ReflectionProperty ( WP_HTML_Processor::class, 'bookmarks ' );
74
77
$ processor_bookmarks ->setAccessible ( true );
75
78
79
+ $ cfacn = new ReflectionMethod ( WP_HTML_Processor::class, 'create_fragment_at_current_node ' );
80
+ $ cfacn ->setAccessible ( true );
81
+
76
82
$ is_fragment_processor = false ;
77
83
78
84
$ compat_mode = 'BackCompat ' ;
@@ -121,7 +127,7 @@ function get_tree( string $html, array $options ): array {
121
127
* @var WP_HTML_Processor|null $processor
122
128
* @disregard P1013
123
129
*/
124
- $ processor = $ context_processor -> create_fragment_at_current_node ( $ html );
130
+ $ processor = $ cfacn -> invoke ( $ context_processor , $ html );
125
131
}
126
132
127
133
if ( ! isset ( $ processor ) ) {
0 commit comments