From 2ab2784cf8608fdab8a3cb3f078560cf895d215a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuomas=20V=C3=A4limaa?= Date: Tue, 9 May 2023 14:40:34 +0300 Subject: [PATCH] Spotify support --- src/Plugin/Filter/IframeCookieConsent.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Plugin/Filter/IframeCookieConsent.php b/src/Plugin/Filter/IframeCookieConsent.php index 976b8a9..27314f4 100644 --- a/src/Plugin/Filter/IframeCookieConsent.php +++ b/src/Plugin/Filter/IframeCookieConsent.php @@ -30,8 +30,8 @@ public function process($text, $langcode) { $html5 = new HTML5(); libxml_use_internal_errors(true); $dom = $html5->loadHTML(mb_convert_encoding($text, 'HTML-ENTITIES', 'UTF-8')); - // Youtube regex pattern. - $regex_pattern = "/(youtube.com|youtu.be)\/(embed)?(\?v=)?(\S+)?/"; + // Spotify & Youtube regex pattern. + $regex_pattern = "/(open.spotify.com|youtube.com|youtu.be)\/(embed)?(\?v=)?(\S+)?/"; $match = NULL; // Loop all content iframes. @@ -59,7 +59,7 @@ public function process($text, $langcode) { $optout->setAttribute('class', 'cookieconsent-optout-' . $consent_cat); // Use a helper to create string including html. $helper = new \DOMDocument(); - $helper->loadHTML($this->t('Please accept marketing-cookies to watch this video.')); + $helper->loadHTML($this->t('Please accept marketing-cookies to watch this content.')); // Put optout html string inside optout div. $optout->appendChild($dom->importNode($helper->documentElement, TRUE)); // Insert optin element before iframe.