Skip to content

Commit 567f3ed

Browse files
committed
Use __METHOD__ in _deprecated_function(); update comments
1 parent a9ed369 commit 567f3ed

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

includes/embeds/class-amp-twitter-embed-handler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function shortcode( $attr ) {
148148
* @return string Rendered oEmbed.
149149
*/
150150
public function oembed( $matches ) {
151-
_deprecated_function( __FUNCTION__, '1.1' );
151+
_deprecated_function( __METHOD__, '1.1' );
152152
$id = false;
153153

154154
if ( isset( $matches['tweet'] ) && is_numeric( $matches['tweet'] ) ) {
@@ -239,12 +239,13 @@ public function sanitize_raw_embeds( $dom ) {
239239
}
240240

241241
/**
242-
* Checks whether it's a twitter blockquote or not
242+
* Checks whether it's a twitter blockquote or not.
243243
*
244244
* @param DOMElement $node The DOMNode to adjust and replace.
245245
* @return bool Whether node is for raw embed.
246246
*/
247247
private function is_tweet_raw_embed( $node ) {
248+
// Skip processing blockquotes that have already been passed through while being wrapped with <amp-twitter>.
248249
if ( $node->parentNode && 'amp-twitter' === $node->parentNode->nodeName ) {
249250
return false;
250251
}

tests/php/test-amp-twitter-embed.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@ public function get_scripts_data() {
190190
}
191191

192192
/**
193+
* Test get_scripts().
194+
*
193195
* @dataProvider get_scripts_data
196+
*
197+
* @param string $source Source content.
198+
* @param array $expected Expected scripts.
194199
*/
195200
public function test__get_scripts( $source, $expected ) {
196201
$embed = new AMP_Twitter_Embed_Handler();
@@ -212,7 +217,7 @@ public function test__get_scripts( $source, $expected ) {
212217
/**
213218
* Data for test__raw_embed_sanitizer.
214219
*
215-
* @return array
220+
* @return array Data.
216221
*/
217222
public function get_raw_embed_dataset() {
218223
return [

0 commit comments

Comments
 (0)