cookies_addons-1.0.3/modules/cookies_addons_embed_iframe/cookies_addons_embed_iframe.module
modules/cookies_addons_embed_iframe/cookies_addons_embed_iframe.module
<?php
/**
* @file
* Primary module hooks for Cookies Addons embed iframe module.
*/
/**
* Check if the src attribute is a YouTube iframe.
*
* @param string $src
* The string from the src attribute.
*
* @return bool
* TRUE if this is no YouTube iframe.
*/
function _cookies_addons_embed_iframe_is_iframe(string $src) {
preg_match_all(
'/^(?!(?:https?:)?(?:\/\/)?(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/\S*?[^\w\s-])((?!videoseries)[\w-]{11})(?=[^\w-]|$)(?![?=&+%\w.-]*(?:[\'"][^<>]*>|<\/a>))[?=&+%\w.-]*).*$/im',
htmlspecialchars_decode($src),
$matches
);
return isset($matches[0][0]);
}
