$total_match ) { $placeholder = ''; if ( cmplz_use_placeholder('youtube') && isset($matches[1][0]) ) { $youtube_id = $matches[1][0]; $youtube_url = "https://www.youtube.com/watch?v=$youtube_id"; $placeholder = 'data-placeholder-image="'.cmplz_placeholder( false, $youtube_url).'" '; } $new_match = str_replace('yotu-playlist', 'cmplz-yotu-playlist cmplz-placeholder-element ', $total_match); $new_match = str_replace('data-page=', $placeholder.' data-service="youtube" data-page=', $new_match); $output = str_replace($total_match, $new_match, $output); } } } return $output; } add_filter('cmplz_cookie_blocker_output', 'cmplz_yotuwp_cookieblocker'); /** * Add some css * @return void */ function cmplz_yotu_css() { if ( cmplz_uses_thirdparty('youtube') ) { ?> .cmplz-yotu-playlist { max-height:400px; } ', ''), '', $script); wp_add_inline_script( 'cmplz-cookiebanner', $script); } } add_action( 'wp_enqueue_scripts', 'cmplz_yotuwp_handle_youtube',PHP_INT_MAX ); function cmplz_yotuwp_whitelist($tags){ $tags[] = 'cmplz_maybe_trigger_yotuwp'; return $tags; } add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_yotuwp_whitelist'); add_filter( 'cmplz_known_script_tags', 'cmplz_yotuwp_iframetags' ); function cmplz_yotuwp_iframetags( $tags ) { $tags[] = array( 'name' => 'youtube', 'placeholder' => 'youtube', 'category' => 'marketing', 'urls' => array( 'yotuwp-easy-youtube-embed', 'yotuwp-pro', 'yotuwp.data', 'var yotujs', ), ); return $tags; } /** * Add services to the list of detected items, so it will get set as default, and will be added to the notice about it * * @param $services * * @return array */ function cmplz_yotuwp_detected_services( $services ) { if ( ! in_array( 'youtube', $services ) ) { $services[] = 'youtube'; } return $services; } add_filter( 'cmplz_detected_services', 'cmplz_yotuwp_detected_services' );