@@ -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 );
@@ -78,6 +81,9 @@ function get_tree( string $html, array $options ): array {
78
81
$ processor_bookmarks = new ReflectionProperty ( WP_HTML_Processor::class, 'bookmarks ' );
79
82
$ processor_bookmarks ->setAccessible ( true );
80
83
84
+ $ cfacn = new ReflectionMethod ( WP_HTML_Processor::class, 'create_fragment_at_current_node ' );
85
+ $ cfacn ->setAccessible ( true );
86
+
81
87
$ is_fragment_processor = false ;
82
88
83
89
$ compat_mode = 'BackCompat ' ;
@@ -126,7 +132,7 @@ function get_tree( string $html, array $options ): array {
126
132
* @var WP_HTML_Processor|null $processor
127
133
* @disregard P1013
128
134
*/
129
- $ processor = $ context_processor -> create_fragment_at_current_node ( $ html );
135
+ $ processor = $ cfacn -> invoke ( $ context_processor , $ html );
130
136
}
131
137
132
138
if ( ! isset ( $ processor ) ) {
0 commit comments