@@ -164,15 +164,6 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
164
164
*/
165
165
private $ bookmark_counter = 0 ;
166
166
167
- /**
168
- * Refers to the currently-matched tag, if any.
169
- *
170
- * @since 6.4.0
171
- *
172
- * @var WP_HTML_Token|null
173
- */
174
- private $ current_token = null ;
175
-
176
167
/**
177
168
* Stores an explanation for why something failed, if it did.
178
169
*
@@ -451,7 +442,7 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ) {
451
442
return false ;
452
443
}
453
444
454
- $ this ->current_token = new WP_HTML_Token (
445
+ $ this ->state -> current_token = new WP_HTML_Token (
455
446
$ this ->bookmark_tag (),
456
447
$ this ->get_tag (),
457
448
$ this ->is_tag_closer (),
@@ -538,7 +529,7 @@ private function step_in_body() {
538
529
}
539
530
540
531
$ this ->reconstruct_active_formatting_elements ();
541
- $ this ->insert_html_element ( $ this ->current_token );
532
+ $ this ->insert_html_element ( $ this ->state -> current_token );
542
533
$ this ->state ->frameset_ok = false ;
543
534
544
535
return true ;
@@ -558,7 +549,7 @@ private function step_in_body() {
558
549
$ this ->close_a_p_element ();
559
550
}
560
551
561
- $ this ->insert_html_element ( $ this ->current_token );
552
+ $ this ->insert_html_element ( $ this ->state -> current_token );
562
553
return true ;
563
554
564
555
/*
@@ -590,7 +581,7 @@ private function step_in_body() {
590
581
*/
591
582
case '-P ' :
592
583
if ( ! $ this ->state ->stack_of_open_elements ->has_p_in_button_scope () ) {
593
- $ this ->insert_html_element ( $ this ->current_token );
584
+ $ this ->insert_html_element ( $ this ->state -> current_token );
594
585
}
595
586
596
587
$ this ->close_a_p_element ();
@@ -612,8 +603,8 @@ private function step_in_body() {
612
603
}
613
604
614
605
$ this ->reconstruct_active_formatting_elements ();
615
- $ this ->insert_html_element ( $ this ->current_token );
616
- $ this ->state ->active_formatting_elements ->push ( $ this ->current_token );
606
+ $ this ->insert_html_element ( $ this ->state -> current_token );
607
+ $ this ->state ->active_formatting_elements ->push ( $ this ->state -> current_token );
617
608
return true ;
618
609
619
610
/*
@@ -633,8 +624,8 @@ private function step_in_body() {
633
624
case '+TT ' :
634
625
case '+U ' :
635
626
$ this ->reconstruct_active_formatting_elements ();
636
- $ this ->insert_html_element ( $ this ->current_token );
637
- $ this ->state ->active_formatting_elements ->push ( $ this ->current_token );
627
+ $ this ->insert_html_element ( $ this ->state -> current_token );
628
+ $ this ->state ->active_formatting_elements ->push ( $ this ->state -> current_token );
638
629
return true ;
639
630
640
631
/*
@@ -662,15 +653,15 @@ private function step_in_body() {
662
653
*/
663
654
case '+IMG ' :
664
655
$ this ->reconstruct_active_formatting_elements ();
665
- $ this ->insert_html_element ( $ this ->current_token );
656
+ $ this ->insert_html_element ( $ this ->state -> current_token );
666
657
return true ;
667
658
668
659
/*
669
660
* > Any other start tag
670
661
*/
671
662
case '+SPAN ' :
672
663
$ this ->reconstruct_active_formatting_elements ();
673
- $ this ->insert_html_element ( $ this ->current_token );
664
+ $ this ->insert_html_element ( $ this ->state -> current_token );
674
665
return true ;
675
666
676
667
/*
@@ -796,15 +787,17 @@ public function release_bookmark( $bookmark_name ) {
796
787
*/
797
788
public function seek ( $ bookmark_name ) {
798
789
$ actual_bookmark_name = "_ {$ bookmark_name }" ;
799
- $ processor_started_at = $ this ->current_token ? $ this ->bookmarks [ $ this ->current_token ->bookmark_name ]->start : 0 ;
790
+ $ processor_started_at = $ this ->state ->current_token
791
+ ? $ this ->bookmarks [ $ this ->state ->current_token ->bookmark_name ]->start
792
+ : 0 ;
800
793
$ bookmark_starts_at = $ this ->bookmarks [ $ actual_bookmark_name ]->start ;
801
794
$ direction = $ bookmark_starts_at > $ processor_started_at ? 'forward ' : 'backward ' ;
802
795
803
796
switch ( $ direction ) {
804
797
case 'forward ' :
805
798
// When moving forwards, re-parse the document until reaching the same location as the original bookmark.
806
799
while ( $ this ->step () ) {
807
- if ( $ bookmark_starts_at === $ this ->bookmarks [ $ this ->current_token ->bookmark_name ]->start ) {
800
+ if ( $ bookmark_starts_at === $ this ->bookmarks [ $ this ->state -> current_token ->bookmark_name ]->start ) {
808
801
return true ;
809
802
}
810
803
}
0 commit comments