diff options
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php index ae77ff714..ec1dac417 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php @@ -235,6 +235,7 @@ class Attribute 'filterProtocolUrlAttribute', 'rewriteImageProxyUrl', 'secureIframeSrc', + 'removeYouTubeAutoplay' ); /** @@ -405,6 +406,25 @@ class Attribute } /** + * Removes YouTube autoplay from iframes + * + * @access public + * @param string $tag Tag name + * @param array $attribute Atttributes name + * @param string $value Attribute value + * @return boolean + */ + public function removeYouTubeAutoplay($tag, $attribute, &$value) + { + $regex = '%^(https://(?:www\.)?youtube.com/.*\?.*autoplay=)(1)(.*)%i'; + if ($tag === 'iframe' && $attribute === 'src' && preg_match($regex, $value)) { + $value = preg_replace($regex, '${1}0$3', $value); + } + + return true; + } + + /** * Rewrite image url to use with a proxy * * @access public |