cookies_addons-1.0.3/modules/cookies_addons_embed_video/cookies_addons_embed_video.module
modules/cookies_addons_embed_video/cookies_addons_embed_video.module
<?php
/**
* @file
* Primary module hooks for Cookies Addons embed video 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 a YouTube url.
*/
function _cookies_addons_embed_video_is_youtube(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]);
}
