.
*/
//define('WP_DEBUG', true);
class YouTubePrefs
{
public static $folder_name = 'youtube-embed-plus';
public static $curltimeout = 30;
public static $version = '13.4.2';
public static $opt_version = 'version';
public static $optembedwidth = null;
public static $optembedheight = null;
public static $defaultheight = null;
public static $defaultwidth = null;
public static $oembeddata = null;
public static $opt_center = 'centervid';
public static $opt_glance = 'glance';
public static $opt_autoplay = 'autoplay';
public static $opt_debugmode = 'debugmode';
public static $opt_old_script_method = 'old_script_method';
public static $opt_cc_load_policy = 'cc_load_policy';
public static $opt_cc_lang_pref = 'cc_lang_pref';
public static $opt_iv_load_policy = 'iv_load_policy';
public static $opt_loop = 'loop';
public static $opt_modestbranding = 'modestbranding';
public static $opt_rel = 'rel';
public static $opt_fs = 'fs';
public static $opt_playsinline = 'playsinline';
public static $opt_autohide = 'autohide';
public static $opt_controls = 'controls';
public static $opt_theme = 'theme';
public static $opt_color = 'color';
public static $opt_listType = 'listType';
public static $opt_dohl = 'dohl';
public static $opt_hl = 'hl';
public static $opt_nocookie = 'nocookie';
public static $opt_gb_compat = 'gb_compat';
public static $opt_gdpr_consent = 'gdpr_consent';
public static $opt_gdpr_consent_message = 'gdpr_consent_message';
public static $opt_gdpr_consent_button = 'gdpr_consent_button';
public static $gdpr_cookie_name = 'ytprefs_gdpr_consent';
public static $opt_playlistorder = 'playlistorder';
public static $opt_acctitle = 'acctitle';
public static $opt_pro = 'pro';
public static $opt_oldspacing = 'oldspacing';
public static $opt_frontend_only = 'frontend_only';
public static $opt_responsive = 'responsive';
public static $opt_responsive_all = 'responsive_all';
public static $opt_origin = 'origin';
public static $opt_widgetfit = 'widgetfit';
public static $opt_evselector_light = 'evselector_light';
public static $opt_stop_mobile_buffer = 'stop_mobile_buffer';
public static $opt_restrict_wizard = 'restrict_wizard';
public static $opt_restrict_wizard_roles = 'restrict_wizard_roles';
public static $opt_ajax_compat = 'ajax_compat';
public static $opt_ytapi_load = 'ytapi_load';
public static $opt_defaultdims = 'defaultdims';
public static $opt_defaultwidth = 'width';
public static $opt_defaultheight = 'height';
public static $opt_pause_others = 'pause_others';
public static $opt_defaultvol = 'defaultvol';
public static $opt_vol = 'vol';
public static $opt_apikey = 'apikey';
public static $opt_migrate = 'migrate';
public static $opt_migrate_youtube = 'migrate_youtube';
public static $opt_migrate_embedplusvideo = 'migrate_embedplusvideo';
public static $opt_gallery_pagesize = 'gallery_pagesize';
public static $opt_gallery_columns = 'gallery_columns';
public static $opt_gallery_collapse_grid = 'gallery_collapse_grid';
public static $opt_gallery_collapse_grid_breaks = 'gallery_collapse_grid_breaks';
public static $opt_gallery_scrolloffset = 'gallery_scrolloffset';
public static $opt_gallery_hideprivate = 'gallery_hideprivate';
public static $opt_gallery_showtitle = 'gallery_showtitle';
public static $opt_gallery_showpaging = 'gallery_showpaging';
public static $opt_gallery_thumbplay = 'gallery_thumbplay';
public static $opt_gallery_autonext = 'gallery_autonext';
public static $opt_gallery_channelsub = 'gallery_channelsub';
public static $opt_gallery_channelsublink = 'gallery_channelsublink';
public static $opt_gallery_channelsubtext = 'gallery_channelsubtext';
public static $opt_gallery_customarrows = 'gallery_customarrows';
public static $opt_gallery_customprev = 'gallery_customprev';
public static $opt_gallery_customnext = 'gallery_customnext';
public static $opt_not_live_content = 'not_live_content';
public static $opt_not_live_on = 'not_live_on';
public static $opt_admin_off_scripts = 'admin_off_scripts';
public static $opt_defer_js = 'defer_js';
public static $opt_defer_jquery = 'defer_jquery';
public static $opt_ajax_save = 'ajax_save';
public static $opt_onboarded = 'onboarded';
public static $opt_show_pointer = 'show_pointer';
public static $opt_alloptions = 'youtubeprefs_alloptions';
public static $alloptions = null;
public static $yt_options = array();
public static $dft_bpts = array(array('bp' => array('min' => 0, 'max' => 767), 'cols' => 1));
public static $dft_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
public static $epbase = 'https://www.embedplus.com';
public static $double_plugin = false;
public static $scriptsprinted = 0;
public static $min = '.min';
public static $badentities = array('×', '×', '–', '–', '&', '&', '&');
public static $goodliterals = array('x', 'x', '--', '--', '&', '&', '&');
public static $wizard_hook = '';
public static $onboarding_hook = '';
public static $admin_page_hooks = array();
public static $the_content_filters = array(
'wptexturize',
'wpautop',
'shortcode_unautop',
'prepend_attachment',
'wp_make_content_images_responsive',
'wp_filter_content_tags',
'do_shortcode',
'convert_smilies'
);
public static $get_api_key_msg = 'The ### feature now requires a (free) YouTube API key from Google. Please follow the easy steps in this video to create and save your API key.';
public static $boilerplate_api_error_message = ' Please make sure you performed the steps in this video to create and save a proper server API key.';
public static $dft_gdpr_consent_message = '
Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.
';
}
public static function get_glance_count()
{
global $wpdb;
$query_sql = "
SELECT count(*) as mytotal
FROM $wpdb->posts
WHERE (post_content LIKE '%youtube.com/%' OR post_content LIKE '%youtu.be/%')
AND post_status = 'publish'";
$query_result = $wpdb->get_results($query_sql, OBJECT);
return intval($query_result[0]->mytotal);
}
public static function show_glance()
{
$glancehref = admin_url('admin.php?page=youtube-ep-glance') . '&random=' . rand(1, 1000) . '&TB_iframe=true&width=780&height=800';
return $glancehref;
}
public static function glance_page()
{
?>
posts
WHERE (post_content LIKE '%youtube.com/%' OR post_content LIKE '%youtu.be/%')
AND post_status = 'publish'
order by post_date DESC LIMIT 0, 10";
$query_result = $wpdb->get_results($query_sql, OBJECT);
if ($query_result !== null)
{
$total = $wpdb->get_var("SELECT FOUND_ROWS();");
global $post;
echo '
';
?>
We recommend using this page as an easy way to check the results of the global default settings you make (e.g. hide annotations) on your recent embeds. Or, simply use it as an index to jump right to your posts that contain YouTube embeds.
0)
{
echo '
';
foreach ($query_result as $post)
{
echo '
';
setup_postdata($post);
the_title('
', ' »
');
echo '
';
}
echo '
';
}
else
{
echo '
You currently do not have any YouTube embeds yet.
';
}
}
wp_reset_postdata();
?>
To remove this feature from your dashboard, simply uncheck Show "At a Glance" Embed Links in the plugin settings page ».
This post/page contains a video that has been removed from YouTube.';
$thehtml .= ' Activate delete video tracking to catch these cases »';
$thehtml .= '';
}
}
catch (Exception $ex)
{
}
}
}
}
if ($currpost != null)
{
$result['type'] = 'success';
$result['data'] = $thehtml;
}
else
{
$result['type'] = 'error';
}
echo json_encode($result);
}
else
{
$result['type'] = 'error';
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
die();
}
public static function my_embedplus_glance_count()
{
$result = array();
if (self::is_ajax())
{
$thehtml = '';
try
{
if (version_compare(get_bloginfo('version'), '3.8', '>='))
{
$result['container'] = '#dashboard_right_now ul';
$thehtml .= self::show_glance_list();
}
else
{
$result['container'] = '#dashboard_right_now .table_content table tbody';
$thehtml .= self::show_glance_table();
}
$result['type'] = 'success';
$result['data'] = $thehtml;
}
catch (Exception $e)
{
$result['type'] = 'error';
}
echo json_encode($result);
}
else
{
$result['type'] = 'error';
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
die();
}
public static function try_get_ytid($url)
{
$theytid = null;
if (strpos($url, 'v=') !== false)
{
$url_params = explode('?', $url);
$kvp = self::keyvalue($url_params[1], true);
$theytid = $kvp['v'];
}
else if (strpos($url, "youtu.be") !== false)
{
$shortpath = explode('/', parse_url($url, PHP_URL_PATH));
$theytid = $shortpath[1];
}
return $theytid;
}
public static function wizard()
{
?>
Please periodically check the YouTube plugin tab on your admin panel to review the latest options.
the owner of the video allowed embed sharing permissions (otherwise, contact the owner of the video to allow embedding). Then copy that full link in your address bar to paste here. If you are sure your link is correct, then (1) your API key may be too restrictive (check here) or (2) you have reached your Google quota (check here). You can apply to Google for a quota increase here.';
$step1_video_errors = '';
$step1_video_error_invalid = 'Sorry, that does not seem to be a link to an existing video. Please confirm that the link works in your browser, and that the owner of the video allowed embed sharing permissions (otherwise, contact the owner of the video to allow embedding). Then copy that full link in your address bar to paste here.';
$step1_playlist_errors = '';
$step1_playlist_error_invalid = 'Sorry, that does not seem to be a link to an existing playlist. Please confirm that the link works in your browser, and that the owner of the playlist allowed embed sharing permissions (otherwise, contact the owner of the video to allow embedding). Then copy that full link in your address bar to paste here.';
$step1_channel_errors = '';
$step1_channel_error_invalid = 'Sorry, that does not seem to be a link to an existing video. ' . $step1_api_error_msg;
$step1_live_errors = '';
$step1_live_error_invalid = 'Sorry, that does not seem to be a valid link to an existing live video. ' . $step1_api_error_msg;
$step1_livechannel_errors = '';
$step1_livechannel_error_invalid = 'Sorry, that does not seem to be a link to an existing channel.';
$if_live_preview = false;
$theytid = null;
$theplaylistid = null;
$submit_type = null;
if (isset($_POST['wizform_submit']))
{
check_admin_referer('_epyt_wiz', '_epyt_nonce');
$submit_type = sanitize_text_field($_POST['wizform_submit']);
if ($submit_type === 'step1_video')
{
// validate
$search = sanitize_text_field(trim($_POST['txtUrl']));
try
{
if (empty($search))
{
throw new Exception();
}
if (preg_match(self::$justurlregex, $search))
{
//$search = esc_url($search);
try
{
$theytid = self::try_get_ytid($search);
if ($theytid == null)
{
$form_valid = false;
$step1_video_errors = $step1_video_error_invalid;
$acc_expand = 'h3_video';
}
else
{
$odata = self::get_oembed('http://youtube.com/watch?v=' . $theytid, 1920, 1280);
if (is_object($odata))
{
?>
Is your live stream not working? According to Google/YouTube rules, there must be an active AdSense account that's connected to the live
stream's channel (for monetization) in order embed the stream. If you own the channel, we suggest that you attach an AdSense account. Otherwise, you will
likely just see a blank screen when you embed your stream, even if it is visible on YouTube.com.
Read more here: https://support.google.com/youtube/answer/2474026?hl=en
Paste the url of a single video below (example: https://www.youtube.com/watch?v=YVvn8dpSAt0 )
' . $step1_video_errors . '' : ''; ?>
Note: You can also search YouTube videos by title in the text box above (example: TED talks). However, searching will use a significant amount of your YouTube API quota.
Go to the page for the playlist that lists all of its videos (Example »).
You may then click on the video that you want the playlist to start with (this step only applies to self-contained playlists. You cannot pick a starter for gallery layout directions).
Copy the URL in your browser and paste it in the textbox below. You'll notice that a playlist URL contains the playlist ID (e.g. "PL...")
Click "Get Playlist" to continue.
Go to the page for the playlist that lists all of its videos (Example »).
Copy the URL in your browser and paste it in the textbox below. You'll notice that a playlist URL contains the playlist ID (e.g. "PL...")
If you already know the direct link to the channel ID, enter it below. Example: https://www.youtube.com/channel/UCnM5iMGiKsZg-iOlIO2ZkdQ
Note: the following format will not work: https://www.youtube.com/c/customchannelname If you cannot locate the proper channel ID format above, then try the other method below.
Or, simply enter a link to any single video that belongs to the user's channel, and the plugin will find the channel for you. Example: https://www.youtube.com/watch?v=YVvn8dpSAt0
Important: You can embed any public livestreams or premieres from any channel that YouTube/Google has approved to be Eligible and Enabled.
If you're trying to embed a livestream from your own channel, you can check make sure it is Eligible and Enabled by visiting here.
You are verified if you see the word "Enabled" at the bottom of the box that is labeled "Embed live streams." Note that verification can only be done directly through YouTube/Google with the link above, and this plugin cannot automatically do that.
YouTube/Google also requires Monetization enabled. You can read more here »
This will embed a specific live stream or premiere video.
Paste in the direct URL of the live stream or premiere below and click Submit. Example: https://www.youtube.com/watch?v=5qap5aO4i9A
On the next screen, customize or insert your video.
' . $step1_live_errors . '' : ''; ?>
This will embed a video that will automatically display the next upcoming live stream from a channel.
Enter the link to the channel page below (note the word "channel" should be in the link). Example: https://www.youtube.com/channel/UCL0iAkpqV5YaIVG7xkDtS4Q
' . $step1_livechannel_errors . '' : ''; ?>
Note: For now, the "Not Live" custom content feature is not available for channel-based embeds. YouTube's standard countdown will appear in the video until the scheduled stream goes live.
';
return $code;
}
public static function user_in_roles_any($user, $roles)
{
foreach ($user->roles as $idx => $r)
{
if (in_array($r, $roles))
{
return true;
}
}
return false;
}
public static function is_restrict_wizard()
{
$curr_user = wp_get_current_user();
if (
$curr_user->ID // logged in
&& isset(self::$alloptions[self::$opt_restrict_wizard]) && self::$alloptions[self::$opt_restrict_wizard] == 1 // restricting
&& is_array(self::$alloptions[self::$opt_restrict_wizard_roles]) && !self::user_in_roles_any($curr_user, self::$alloptions[self::$opt_restrict_wizard_roles])
)
{
return true;
}
return false;
}
public static function media_button_wizard()
{
if (self::is_restrict_wizard())
{
return;
}
add_thickbox();
$wizhref = admin_url('admin.php?page=youtube-ep-wizard') .
'&random=' . rand(1, 1000) .
'&TB_iframe=true&width=950&height=800';
?>
YouTube Video Ad
' . $_SERVER['QUERY_STRING'] .'';
if ($pagenow == 'plugins.php' || strpos($_SERVER['QUERY_STRING'], 'youtube-my-preferences') !== false ||
strpos($_SERVER['QUERY_STRING'], 'embedplus-video-analytics-dashboard') !== false ||
strpos($_SERVER['QUERY_STRING'], 'youtube-ep-analytics-dashboard') !== false ||
strpos($_SERVER['QUERY_STRING'], 'embedplus-official-options') !== false)
{
?>
×';
}
?>
Seems like you have two different YouTube plugins by the EmbedPlus Team installed: YouTube and Advanced YouTube Embed. We strongly suggest keeping only the one you prefer, so that they don't conflict with each other while trying to create your embeds.
CLICK this debug text to auto-select all. Then, COPY the selection.' . "\n\n" .
'THIS IS DEBUG MODE OUTPUT. UNCHECK THE OPTION IN THE SETTINGS PAGE ONCE YOU ARE DONE DEBUGGING TO PUT THINGS BACK TO NORMAL.' . "\n\n" . $redactedEndpoint . "\n\n" . print_r($apiResult, true) . "\n\nActive Plugins\n\n" . print_r($active_plugins, true) . '
';
$finalsrc = '';
}
$code = $galleryWrapper1 . $code1 . $finalsrc . $code2 . $galleryCode . $galleryWrapper2;
//. '';
self::$defaultheight = null;
self::$defaultwidth = null;
self::$oembeddata = null;
return $code;
}
public static function using_gutenberg()
{
global $wp_version;
if ((version_compare($wp_version, '5.0', '>=') && !is_plugin_active('classic-editor/classic-editor.php')) || is_plugin_active('gutenberg/gutenberg.php'))
{
return true;
}
return false;
}
public static function gdpr_mode()
{
return (bool) self::$alloptions[self::$opt_gdpr_consent] && filter_input(INPUT_COOKIE, self::$gdpr_cookie_name, FILTER_SANITIZE_NUMBER_INT) != 1;
}
public static function filter_the_content_light($content)
{
//global $wp_filter;
//$the_content_filters_current = $wp_filter['the_content']->callbacks;
for ($i = 0; $i < count(self::$the_content_filters); $i++)
{
if (function_exists(self::$the_content_filters[$i]) && !(self::wp_above_version('5.5') && self::$the_content_filters[$i] === 'wp_make_content_images_responsive'))
{
$content = call_user_func(self::$the_content_filters[$i], $content);
}
}
return $content;
}
public static function debuglog($str)
{
$handle = fopen(__DIR__ . "\\debug.txt", "a+");
fwrite($handle, $str);
fclose($handle);
}
public static function keyvalue($qry, $includev)
{
$ytvars = explode('&', $qry);
$ytkvp = array();
foreach ($ytvars as $k => $v)
{
$kvp = explode('=', $v);
if (count($kvp) == 2 && ($includev || strtolower($kvp[0]) != 'v'))
{
$ytkvp[$kvp[0]] = $kvp[1];
}
}
return $ytkvp;
}
public static function secondsToDuration($seconds)
{
$remaining = $seconds;
$parts = array();
$multipliers = array(
'hours' => 3600,
'minutes' => 60,
'seconds' => 1
);
foreach ($multipliers as $type => $m)
{
$parts[$type] = (int) ($remaining / $m);
$remaining -= ($parts[$type] * $m);
}
return $parts;
}
public static function formatDuration($parts)
{
$default = array(
'hours' => 0,
'minutes' => 0,
'seconds' => 0
);
extract(array_merge($default, $parts));
return "T{$hours}H{$minutes}M{$seconds}S";
}
public static function init_dimensions($url, $urlkvp, $finalparams)
{
// get default dimensions; try embed size in settings, then try theme's content width, then just 480px
if (self::$defaultwidth == null)
{
global $content_width;
if (empty($content_width))
{
$content_width = $GLOBALS['content_width'];
}
if (isset($urlkvp['width']) && is_numeric($urlkvp['width']))
{
self::$defaultwidth = $urlkvp['width'];
}
else if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultwidth]) && is_numeric(self::$alloptions[self::$opt_defaultwidth])))
{
self::$defaultwidth = self::$alloptions[self::$opt_defaultwidth];
}
else if (self::$optembedwidth)
{
self::$defaultwidth = self::$optembedwidth;
}
else if ($content_width)
{
self::$defaultwidth = $content_width;
}
else
{
self::$defaultwidth = 480;
}
if (isset($urlkvp['height']) && is_numeric($urlkvp['height']))
{
self::$defaultheight = $urlkvp['height'];
}
else if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultheight]) && is_numeric(self::$alloptions[self::$opt_defaultheight])))
{
self::$defaultheight = self::$alloptions[self::$opt_defaultheight];
}
else
{
self::$defaultheight = self::get_aspect_height($url, self::$defaultwidth);
}
}
}
public static function get_oembed($url, $height, $width)
{
if (stripos($url, 'listType=playlist') !== false && stripos($url, '/embed') !== false)
{
$url = str_replace('/embed', '/playlist', $url);
}
if (file_exists(ABSPATH . WPINC . '/class-wp-oembed.php'))
{
require_once(ABSPATH . WPINC . '/class-wp-oembed.php');
}
else
{
require_once(ABSPATH . WPINC . '/class-oembed.php');
}
$oembed = _wp_oembed_get_object();
$args = array();
$args['width'] = $width;
$args['height'] = $height;
$args['discover'] = false;
self::$oembeddata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args);
return self::$oembeddata;
}
public static function get_aspect_height($url, $widthbox)
{
// attempt to get aspect ratio correct height from oEmbed
$aspectheight = round(($widthbox * 9) / 16, 0);
if ($url)
{
$odata = self::get_oembed($url, $widthbox, $widthbox);
if ($odata)
{
$aspectheight = $odata->height;
}
}
return $aspectheight;
}
public static function ytprefs_plugin_menu()
{
self::$admin_page_hooks[] = add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', array(get_class(), 'ytprefs_show_options'), 'dashicons-video-alt3', '10.000392854349');
self::$admin_page_hooks[] = add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', array(get_class(), 'ytprefs_show_options'));
include_once(EPYTVI_INCLUDES_PATH . 'vi_admin_menu.php');
self::$admin_page_hooks[] = add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', array(get_class(), 'glance_page'));
self::$admin_page_hooks[] = self::$wizard_hook = add_submenu_page(null, 'YouTube Wizard', 'YouTube Wizard', 'edit_posts', 'youtube-ep-wizard', array(get_class(), 'wizard'));
self::$admin_page_hooks[] = self::$onboarding_hook = add_submenu_page(null, 'YouTube Setup', 'YouTube Setup', 'manage_options', 'youtube-ep-onboarding', array(get_class(), 'ytprefs_show_onboarding'));
}
public static function custom_admin_pointers_check()
{
if (!self::$alloptions[self::$opt_show_pointer])
{
return false;
}
$admin_pointers = self::custom_admin_pointers();
foreach ($admin_pointers as $pointer => $array)
{
if ($array['active'])
{
return true;
}
}
}
public static function glance_script()
{
add_thickbox();
?>
' . __('New Update') . ''; // ooopointer
$new_pointer_content .= '
'; // ooopointer
$new_pointer_content .= "This update adds compatability for WordPress 5.7+ and the latest version of jQuery for both Free and Pro versions.";
if (self::vi_logged_in())
{
$new_pointer_content .= "
Note: You are currently logged into the vi intelligence feature. vi support is being deprecated in the next version, so we recommend taking the vi ads down from your site. Please contact ext@embedplus.com for questions.";
}
if (!empty(self::$alloptions[self::$opt_pro]) && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)
{
$new_pointer_content .= ' Important message to YouTube Pro users: From version 11.7 onward, you must download the separate plugin here to regain your Pro features. All your settings will automatically migrate after installing the separate Pro download. Thank you for your support and patience during this transition.';
}
$new_pointer_content .= '
For videos:Method 1 - Do you already have a URL to the video you want to embed in a post, page, or even a widget? All you have to do is paste it on its own line, as shown below (including the https:// part). Easy, eh? Method 2 - If you want to do some formatting (e.g. add HTML to center a video) or have two or more videos next to each other on the same line, wrap each link with the [embedyt]...[/embedyt] shortcode. Tip for embedding videos on the same line: As shown in the example image below, decrease the size of each video so that they fit together on the same line (See the "How To Override Defaults" section for height and width instructions).
For galleries:Click here to scroll down to gallery settings and directions.
For self-contained playlists: Go to the page for the playlist that lists all of its videos (Example »). Click on the video that you want the playlist to start with. Copy and paste that browser URL into your blog on its own line. If you want the first video to always be the latest video in your playlist, check the option "Playlist Ordering" in the settings down below (you will also see this option available if you use the Pro Wizard). If you want to have two or more playlists next to each other on the same line, wrap each link with the [embedyt]...[/embedyt] shortcode.
For self-contained channel playlists: At your editor, click on the wizard button and choose the option Search for a video or channel to insert in my editor. Then, click on the channel playlist option there (instead of single video). Search for the channel username and follow the rest of the directions there.
For directly embedding in your theme with PHP:
If you need to use PHP directly, we still recommend using the wizard to create the shortcode--but instead of pressing the "Insert" button, just copy the shortcode the wizard gives you. Then use the do_shortcode() function in your theme, like this:
<?php echo do_shortcode('[embedyt]....[/embedyt]'); ?>
Examples:
Always follow these rules for any URL:
Make sure the URL is really on its own line by itself. Or, if you need multiple videos on the same line, make sure each URL is wrapped properly with the shortcode (Example: [embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt])
Make sure the URL is not an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor:
Make sure you did not format or align the URL in any way. If your URL still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes):
If you really want to align the video, try wrapping the link with the shortcode first. For example: [embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt] Using the shortcode also allows you to have two or more videos next to each other on the same line. Just put the shortcoded links together on the same line. For example: [embedyt]http://www.youtube.com/watch?v=ABCDEF[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK[/embedyt]
Suppose you have a few videos that need to be different from the above defaults. You can add options to the end of a link as displayed below to override the above defaults. Each option should begin with '&'.
PRO users: You can use the big customize buttons that you will see inside the wizard, instead of memorizing the following codes.
');
_e("
width - Sets the width of your player. If omitted, the default width will be the width of your theme's content. Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350
");
_e("
height - Sets the height of your player. Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350
");
_e("
autoplay - Set this to 1 to autoplay the video (or 0 to play the video once). Example: http://www.youtube.com/watch?v=quwebVjAEJA&autoplay=1 (Note: Desktop browsers like Chrome and Safari are moving towards preventing autoplay for any video. But, your chances are improved if you set your videos to initially start muted.)
");
_e("
cc_load_policy - Set this to 1 to turn on closed captioning (or 0 to leave them off). Example: http://www.youtube.com/watch?v=quwebVjAEJA&cc_load_policy=1
");
_e("
iv_load_policy - Set this to 3 to turn off annotations (or 1 to show them). Example: http://www.youtube.com/watch?v=quwebVjAEJA&iv_load_policy=3
");
_e("
loop - Set this to 1 to loop the video (or 0 to not loop). Example: http://www.youtube.com/watch?v=quwebVjAEJA&loop=1
");
_e("
modestbranding - Set this to 1 to remove the YouTube logo while playing (or 0 to show the logo). Example: http://www.youtube.com/watch?v=quwebVjAEJA&modestbranding=1
");
_e("
rel - Set this to 0 to not show related videos at the end of playing (or 1 to show them). Example: http://www.youtube.com/watch?v=quwebVjAEJA&rel=0
");
_e("
fs - Set this to 0 to hide the fullscreen button (or 1 to show it). Example: http://www.youtube.com/watch?v=quwebVjAEJA&fs=0
");
_e("
color - Set this to 'white' to make the player have a white progress bar (or 'red' for a red progress bar). Note: Using white will disable the modestbranding option. Example: http://www.youtube.com/watch?v=quwebVjAEJA&color=white
");
_e("
controls - Set this to 0 to completely hide the video controls (or 1 to show it). Example: http://www.youtube.com/watch?v=quwebVjAEJA&controls=0
");
_e("
playsinline - Set this to 1 to allow videos play inline with the page on iOS browsers. (Set to 0 to have iOS launch videos in fullscreen instead). Example: http://www.youtube.com/watch?v=quwebVjAEJA&playsinline=1
");
_e("
origin - Set this to 1 to add the 'origin' parameter for extra JavaScript security. Example: http://www.youtube.com/watch?v=quwebVjAEJA&origin=1
");
_e('');
_e("
You can also start and end each individual video at particular times. Like the above, each option should begin with '&'
");
_e('
');
_e("
start - Sets the time (in seconds) to start the video. Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&start=20
");
_e("
end - Sets the time (in seconds) to stop the video. Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350&end=100
");
_e('
');
?>
type="checkbox" class="checkbox">
>
described here » to further improve your page speeds.', 'youtube-embed-plus'); ?>
Want the PRO Features?
Below are descriptions for some of our PRO features for more gallery customization options, faster page loading, enhanced SEO, and more. Simply purchase and install our separate PRO plugin (the PRO plugin automatically works for all your past embed links).
We've found that a common support request has been from users that are pasting video links on single lines, as required, but are not seeing the video embed show up. One of these suggestions is usually the fix:
Make sure the URL is really on its own line by itself. Or, if you need multiple videos on the same line, make sure each URL is wrapped properly with the shortcode (Example: [embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt])
Make sure the URL is not an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor: .
Make sure you did not format or align the URL in any way. If your URL still appears in your actual post instead of a video, highlight it and click the "remove formatting" button (formatting can be invisible sometimes):
Try wrapping the URL with the [embedyt]...[/embedyt] shortcode. For example: [embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt] Using the shortcode also allows you to have two or more videos next to each other on the same line. Just put the shortcoded links together on the same line. For example: [embedyt]http://www.youtube.com/watch?v=ABCDEF&width=400&height=250[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK&width=400&height=250[/embedyt] TIP: As shown above, decrease the size of each video so that they fit together on the same line (See the "How To Override Defaults" section for height and width instructions)
If you upload a new video to a playlist or channel and that video is not yet showing up on a gallery you embedded, you should clear/reset any caching plugins you have. This will force your site to retrieve the freshest version of your playlist and/or channel video listing. If you don't reset you cache, then you'll have to wait until cache lifetime expires.
Finally, there's a slight chance your custom theme is the issue, if you have one. To know for sure, we suggest temporarily switching to one of the default WordPress themes (e.g., "Twenty Fourteen") just to see if your video does appear. If it suddenly works, then your custom theme is the issue. You can switch back when done testing.
If your videos always appear full size, try turning off "Responsive video sizing."
If none of the above work, you can contact us here if you still have issues: ext@embedplus.com. We'll try to respond within a week.
Deactivating the No Cookies option has also been proven to solve player errors.
We also have a YouTube channel. We use it to provide users with some helper videos and a way to keep updated on new features as they are introduced. Subscribe for tips and updates here »
'success',
'message' => 'Changes were saved. If you are using a separate caching plugin and you do not see your changes after saving, you need to reset your cache.'
);
}
public static function settings_save_ajax()
{
$result = array();
if (check_ajax_referer('_epyt_save', '_epyt_nonce', false) && current_user_can('manage_options'))
{
$all = get_option(self::$opt_alloptions);
$result = self::settings_save($all);
}
else
{
$result['type'] = 'error';
$result['message'] = 'Sorry, there was a problem saving your settings.';
}
echo json_encode($result);
die();
}
public static function onboarding_save_valid(&$input)
{
$messages = array();
try
{
$input[self::$opt_modestbranding] = intval($input[self::$opt_modestbranding]);
$input[self::$opt_responsive] = intval($input[self::$opt_responsive]);
$input[self::$opt_responsive_all] = intval($input[self::$opt_responsive_all]);
$input[self::$opt_defer_js] = intval($input[self::$opt_defer_js]);
$input[self::$opt_gallery_pagesize] = intval($input[self::$opt_gallery_pagesize]);
$input[self::$opt_gallery_columns] = intval($input[self::$opt_gallery_columns]);
$input[self::$opt_not_live_content] = wp_kses_post(stripslashes($input[self::$opt_not_live_content]));
$input[self::$opt_not_live_on] = intval($input[self::$opt_not_live_on]);
if (!in_array($input[self::$opt_ytapi_load], array('always', 'light', 'never')))
{
$input[self::$opt_ytapi_load] = 'light';
}
$input[self::$opt_gdpr_consent] = intval($input[self::$opt_gdpr_consent]);
$input[self::$opt_gdpr_consent_message] = wp_kses_post(stripslashes($input[self::$opt_gdpr_consent_message]));
$input[self::$opt_gdpr_consent_button] = wp_kses_post(stripslashes($input[self::$opt_gdpr_consent_button]));
$input[self::$opt_nocookie] = intval($input[self::$opt_nocookie]);
}
catch (Exception $ex)
{
$messages[] = 'Please enter valid data.';
}
if (empty($messages))
{
return true;
}
return $messages;
}
public static function onboarding_save()
{
$result = array();
$default = array(
self::$opt_rel => 1,
self::$opt_modestbranding => 0,
self::$opt_responsive => 0,
self::$opt_responsive_all => 0,
self::$opt_defer_js => 0,
self::$opt_gallery_pagesize => 15,
self::$opt_gallery_columns => 3,
self::$opt_not_live_content => '',
self::$opt_not_live_on => 0,
self::$opt_ytapi_load => 'light',
self::$opt_gdpr_consent => 0,
self::$opt_gdpr_consent_message => self::$dft_gdpr_consent_message,
self::$opt_gdpr_consent_button => 'Accept YouTube Content',
self::$opt_nocookie => 0
);
$input = shortcode_atts($default, stripslashes_deep($_POST));
$valid = self::onboarding_save_valid($input);
if ($valid === true)
{
self::update_option_set($input);
$result['type'] = 'success';
}
else
{
$result['type'] = 'error';
$result['message'] = implode(' ', $valid);
}
return $result;
}
public static function onboarding_save_ajax()
{
$result = array();
if (self::is_ajax() && self::ajax_referer() && current_user_can('manage_options'))
{
$result = self::onboarding_save();
}
else
{
$result['type'] = 'error';
$result['message'] = 'Sorry, there was a problem saving the data.';
}
echo json_encode($result);
die();
}
public static function onboarding_save_apikey_valid(&$input)
{
$messages = array();
try
{
$input[self::$opt_apikey] = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($input[self::$opt_apikey])));
}
catch (Exception $ex)
{
$messages[] = 'Please enter a valid API key.';
}
if (empty($messages))
{
return true;
}
return $messages;
}
public static function onboarding_save_apikey()
{
$result = array();
$default = array(
self::$opt_apikey => '',
);
$input = shortcode_atts($default, stripslashes_deep($_POST));
$valid = self::onboarding_save_apikey_valid($input);
if ($valid === true)
{
self::update_option_set($input);
$result['type'] = 'success';
}
else
{
$result['type'] = 'error';
$result['message'] = implode(' ', $valid);
}
return $result;
}
public static function onboarding_save_apikey_ajax()
{
$result = array();
if (self::is_ajax() && self::ajax_referer() && current_user_can('manage_options'))
{
$result = self::onboarding_save_apikey();
}
else
{
$result['type'] = 'error';
$result['message'] = 'Sorry, there was a problem saving the data.';
}
echo json_encode($result);
die();
}
public static function ytprefs_show_onboarding()
{
if (!current_user_can('manage_options'))
{
wp_die(__('You do not have sufficient permissions to access this page.'));
}
if (self::$double_plugin)
{
self::double_plugin_warning();
}
$all = get_option(self::$opt_alloptions);
$do_once = array(
self::$opt_onboarded => 1
);
self::update_option_set($do_once);
?>
YouTube Setup Guide
With so many options available in this plugin, we created this easy setup guide to help you quickly learn about its most common settings and newest features. We hope it will get you embedding videos, galleries, and/or live streams sooner.
You'll have an opportunity to see and set many other options after completing this setup guide.
Below, check all that apply: I'm interested in embedding...
');
if ($item_valid === true)
{
self::update_option_set($item);
$message = 'Settings were successfully saved. Now you can turn on vi ads above. Note: changes may take a few minutes to appear on your website. If you are using a separate caching plugin, you need to reset your cache to see any changes.';
}
else
{
$notice = wp_kses_post(implode(' ', $item_valid));
}
}
?>