diff --git a/includes/sanitizers/class-amp-base-sanitizer.php b/includes/sanitizers/class-amp-base-sanitizer.php index e371ce2b853..3a832acdf93 100644 --- a/includes/sanitizers/class-amp-base-sanitizer.php +++ b/includes/sanitizers/class-amp-base-sanitizer.php @@ -70,11 +70,11 @@ abstract class AMP_Base_Sanitizer { protected $root_element; /** - * The plugin that is outputting markup, if any. + * The plugin or theme that is outputting markup, if any. * * @var null|string */ - public $current_plugin_output = null; + public $current_source = null; /** * AMP_Base_Sanitizer constructor. @@ -326,7 +326,7 @@ public function maybe_enforce_https_src( $src, $force_https = false ) { public function remove_invalid_child( $child ) { $child->parentNode->removeChild( $child ); if ( isset( $this->args[ AMP_Validation_Utils::CALLBACK_KEY ] ) ) { - call_user_func( $this->args[ AMP_Validation_Utils::CALLBACK_KEY ], $child, $this->current_plugin_output ); + call_user_func( $this->args[ AMP_Validation_Utils::CALLBACK_KEY ], $child, $this->current_source ); } } @@ -349,7 +349,7 @@ public function remove_invalid_attribute( $element, $attribute ) { } if ( $attribute ) { $element->removeAttributeNode( $attribute ); - call_user_func( $this->args[ AMP_Validation_Utils::CALLBACK_KEY ], $attribute, $this->current_plugin_output ); + call_user_func( $this->args[ AMP_Validation_Utils::CALLBACK_KEY ], $attribute, $this->current_source ); } } elseif ( is_string( $attribute ) ) { $element->removeAttribute( $attribute ); @@ -371,9 +371,9 @@ public function capture_current_source( $node ) { if ( ! isset( $matches[1], $matches[2] ) ) { return; } elseif ( 'after' === $matches[1] ) { - $this->current_plugin_output = $matches[2]; + $this->current_source = $matches[2]; } elseif ( 'before' === $matches[1] ) { - $this->current_plugin_output = null; + $this->current_source = null; } } diff --git a/tests/test-class-amp-base-sanitizer.php b/tests/test-class-amp-base-sanitizer.php index 4048481abfe..2a58f321b04 100644 --- a/tests/test-class-amp-base-sanitizer.php +++ b/tests/test-class-amp-base-sanitizer.php @@ -305,12 +305,12 @@ public function test_capture_current_source() { $closing_comment = 'after:amp'; $node = $dom->createComment( $closing_comment ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); - $this->assertEquals( null, $sanitizer->current_plugin_output ); + $this->assertEquals( null, $sanitizer->current_source ); $sanitizer->capture_current_source( $node ); - $this->assertEquals( 'amp', $sanitizer->current_plugin_output ); + $this->assertEquals( 'amp', $sanitizer->current_source ); $opening_comment = $dom->createComment( 'before:amp' ); $sanitizer->capture_current_source( $opening_comment ); - $this->assertEquals( null, $sanitizer->current_plugin_output ); + $this->assertEquals( null, $sanitizer->current_source ); } } diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 169974076d8..4df00d4266f 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -864,10 +864,10 @@ public function test_capture_current_source() { $node = $dom->createComment( $comment_after ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); $sanitizer->capture_current_source( $node ); - $this->assertEquals( 'amp', $sanitizer->current_plugin_output ); + $this->assertEquals( 'amp', $sanitizer->current_source ); $closing_comment = $dom->createComment( $comment_before ); $sanitizer->capture_current_source( $closing_comment ); - $this->assertEquals( null, $sanitizer->current_plugin_output ); + $this->assertEquals( null, $sanitizer->current_source ); } }