. */ //define('WP_DEBUG', true); class YouTubePrefs { public static $version = '10.1'; 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_cc_load_policy = 'cc_load_policy'; 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_showinfo = 'showinfo'; 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_wmode = 'wmode'; public static $opt_vq = 'vq'; public static $opt_html5 = 'html5'; public static $opt_dohl = 'dohl'; public static $opt_hl = 'hl'; public static $opt_ssl = 'ssl'; public static $opt_ogvideo = 'ogvideo'; public static $opt_nocookie = 'nocookie'; public static $opt_acctitle = 'acctitle'; public static $opt_pro = 'pro'; public static $opt_oldspacing = 'oldspacing'; public static $opt_responsive = 'responsive'; public static $opt_origin = 'origin'; public static $opt_widgetfit = 'widgetfit'; public static $opt_defaultdims = 'defaultdims'; public static $opt_defaultwidth = 'width'; public static $opt_defaultheight = 'height'; public static $opt_defaultvol = 'defaultvol'; public static $opt_vol = 'vol'; public static $opt_apikey = 'apikey'; public static $opt_schemaorg = 'schemaorg'; public static $opt_ftpostimg = 'ftpostimg'; public static $opt_spdc = 'spdc'; public static $opt_spdcexp = 'spdcexp'; public static $opt_migrate = 'migrate'; public static $opt_migrate_youtube = 'migrate_youtube'; public static $spdcprefix = 'ytpref'; public static $spdcall = 'youtubeprefs_spdcall'; public static $opt_dynload = 'dynload'; public static $opt_dyntype = 'dyntype'; public static $opt_alloptions = 'youtubeprefs_alloptions'; public static $alloptions = null; public static $yt_options = array(); //public static $epbase = 'http://localhost:2346'; public static $epbase = '//www.embedplus.com'; public static $double_plugin = false; public static $scriptsprinted = 0; public static $badentities = array('×', '×', '–', '–', '&'); public static $goodliterals = array('x', 'x', '--', '--', '&'); /* listType */ /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// //public static $ytregex = '@^[\r\n]{0,1}[[:blank:]]*https?://(?:www\.)?(?:(?:youtube.com/watch\?)|(?:youtu.be/))([^\s"]+)[[:blank:]]*[\r\n]{0,1}$@im'; public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im'; public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im'; public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed))/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i'; /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// public function __construct() { add_action('admin_init', array("YouTubePrefs", 'check_double_plugin_warning')); self::$alloptions = get_option(self::$opt_alloptions); if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<')) { self::initoptions(); } if (self::$alloptions[self::$opt_oldspacing] == 1) { self::$ytregex = self::$oldytregex; } self::$optembedwidth = intval(get_option('embed_size_w')); self::$optembedheight = intval(get_option('embed_size_h')); self::$yt_options = array( self::$opt_autoplay, self::$opt_cc_load_policy, self::$opt_iv_load_policy, self::$opt_loop, self::$opt_modestbranding, self::$opt_rel, self::$opt_showinfo, self::$opt_playsinline, self::$opt_autohide, self::$opt_controls, self::$opt_html5, self::$opt_hl, self::$opt_theme, self::$opt_color, self::$opt_listType, self::$opt_wmode, self::$opt_vq, 'list', 'start', 'end' ); add_action('media_buttons', 'YouTubePrefs::media_button_wizard', 11); //$embedplusmce_wiz = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplus_youtubeprefs_wiz', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce_wiz.js'); //$embedplusmce_prefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplus_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce_prefs.js'); //$epstatsmce_youtubeprefs = new Add_new_tinymce_btn_Youtubeprefs('|', 'embedplusstats_youtubeprefs', plugins_url() . '/youtube-embed-plus/scripts/embedplusstats_mce.js'); self::do_ytprefs(); add_action('admin_menu', 'YouTubePrefs::ytprefs_plugin_menu'); if (!is_admin()) { add_action('wp_print_scripts', array('YouTubePrefs', 'jsvars')); add_action('wp_enqueue_scripts', array('YouTubePrefs', 'fitvids')); if (self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0 && self::$alloptions[self::$opt_ogvideo] == 1) { add_action('wp_head', array('YouTubePrefs', 'do_ogvideo')); } } } public static function show_glance_list() { $glancehref = self::show_glance(); $cnt = self::get_glance_count(); //display via list return '
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.';
if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0))
{
$thehtml .='
Activate delete video tracking to catch these cases »';
}
$thehtml .= '';
}
}
catch (Exception $ex)
{
}
}
else if (false) // if playlist
{
}
}
}
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 (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
$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 media_button_wizard()
{
add_thickbox();
$wizhref = self::$epbase . '/wpembedcode-simple-search.aspx?pluginversion=' . YouTubePrefs::$version .
'&wpversion=' . get_bloginfo('version') .
'&settingsurl=' . urlencode(admin_url('admin.php?page=youtube-my-preferences#jumpdefaults')) .
'&dashurl=' . urlencode(admin_url('admin.php?page=youtube-ep-analytics-dashboard')) .
'&blogwidth=' . YouTubePrefs::get_blogwidth() .
'&domain=' . urlencode(site_url()) .
'&prokey=' . urlencode(YouTubePrefs::$alloptions[YouTubePrefs::$opt_pro]) .
'&myytdefaults=' . urlencode(http_build_query(YouTubePrefs::$alloptions)) .
'&random=' . rand(1, 1000) .
'&TB_iframe=true&width=950&height=800';
?>
YouTube
' . $_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)
{
?>
PRO Analytics', 'manage_options', 'youtube-ep-analytics-dashboard', 'YouTubePrefs::epstats_show_options');
}
else
{
add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options', plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349');
add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', 'YouTubePrefs::ytprefs_show_options');
add_submenu_page('youtube-my-preferences', 'YouTube PRO', '
' . __('YouTube Analytics Dashboard') . "Logging you in below... (You can also click here to launch your dashboard in a new tab)
'; } else { //// header echo "This tab is here to provide direct access to analytics. Graphs and other data about your site will show below after you activate PRO.
'; // ooopointer if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)) { $new_pointer_content .= __('(1) Adds the ability to automatically migrate from another plugin shortcode, for FREE and PRO versions. (2) Adds a new caching parameter and caching tips for PRO users ».'); } else { $new_pointer_content .= __('(1) Adds the ability to automatically migrate from another plugin shortcode, for FREE and PRO versions. (2) Adds a new caching parameter and caching tips for PRO users.'); } $new_pointer_content .= '
'; return array( $prefix . 'new_items' => array( 'content' => $new_pointer_content, 'anchor_id' => 'a.toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button', 'edge' => 'top', 'align' => 'left', 'active' => (!in_array($prefix . 'new_items', $dismissed) ) ), ); } public static function postchecked($idx) { return isset($_POST[$idx]) && $_POST[$idx] == (true || 'on'); } public static function ytprefs_show_options() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } if (self::$double_plugin) { //add_action('admin_notices', array("YouTubePrefs", "double_plugin_warning")); self::double_plugin_warning(); } // variables for the field and option names $ytprefs_submitted = 'ytprefs_submitted'; // Read in existing option values from database $all = get_option(self::$opt_alloptions); // See if the user has posted us some information // If they did, this hidden field will be set to 'Y' if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y') { // Read their posted values $new_options = array(); $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0; $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0; $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0; $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0; $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3; $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0; $new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0; $new_options[self::$opt_rel] = self::postchecked(self::$opt_rel) ? 1 : 0; $new_options[self::$opt_showinfo] = self::postchecked(self::$opt_showinfo) ? 1 : 0; $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0; $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0; $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 2 : 0; $new_options[self::$opt_autohide] = self::postchecked(self::$opt_autohide) ? 1 : 2; $new_options[self::$opt_html5] = self::postchecked(self::$opt_html5) ? 1 : 0; $new_options[self::$opt_theme] = self::postchecked(self::$opt_theme) ? 'dark' : 'light'; $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white'; $new_options[self::$opt_wmode] = self::postchecked(self::$opt_wmode) ? 'opaque' : 'transparent'; $new_options[self::$opt_vq] = self::postchecked(self::$opt_vq) ? 'hd720' : ''; $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0; $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0; $new_options[self::$opt_ogvideo] = self::postchecked(self::$opt_ogvideo) ? 1 : 0; $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0; $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0; //$new_options[self::$opt_ssl] = self::postchecked(self::$opt_ssl) ? 1 : 0; $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0; $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0; $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0; $new_options[self::$opt_schemaorg] = self::postchecked(self::$opt_schemaorg) ? 1 : 0; $new_options[self::$opt_ftpostimg] = self::postchecked(self::$opt_ftpostimg) ? 1 : 0; $new_options[self::$opt_spdc] = self::postchecked(self::$opt_spdc) ? 1 : 0; $new_options[self::$opt_dynload] = self::postchecked(self::$opt_dynload) ? 1 : 0; $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0; $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0; $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0; $_defaultwidth = ''; try { $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth; } catch (Exception $ex) { } $new_options[self::$opt_defaultwidth] = $_defaultwidth; $_defaultheight = ''; try { $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight; } catch (Exception $ex) { } $new_options[self::$opt_defaultheight] = $_defaultheight; $_vol = ''; try { $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol; } catch (Exception $ex) { } $new_options[self::$opt_vol] = $_vol; $_apikey = ''; try { $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey]))); } catch (Exception $ex) { $_apikey = ''; } $new_options[self::$opt_apikey] = $_apikey; $_hl = ''; try { $temphl = strtolower(trim($_POST[self::$opt_hl])); $_hl = preg_match('/^[a-z][a-z]$/i', $temphl) ? $temphl : ''; } catch (Exception $ex) { } $new_options[self::$opt_hl] = $_hl; $_dyntype = ''; try { $tempdyntype = trim($_POST[self::$opt_dyntype]); $_dyntype = preg_match('/^[a-zA-Z-]+$/i', $tempdyntype) ? $tempdyntype : ''; } catch (Exception $ex) { } $new_options[self::$opt_dyntype] = $_dyntype; $_spdcexp = 24; try { $_spdcexp = is_numeric(trim($_POST[self::$opt_spdcexp])) ? intval(trim($_POST[self::$opt_spdcexp])) : $_spdcexp; } catch (Exception $ex) { } $new_options[self::$opt_spdcexp] = $_spdcexp; $all = $new_options + $all; update_option(self::$opt_alloptions, $all); try { self::spdcpurge(); if ($all[self::$opt_spdc] == 1) { wp_remote_get(site_url()); } } catch (Exception $ex) { } ?>
Automatic tagging for video SEO (will even work for your old embeds)
Deleted Video Checker (alerts you if YouTube deletes videos you embedded)
Alerts when visitors from different countries are blocked from viewing your embeds
Check if your embeds have restrictions that can block mobile viewing
Priority support (Puts your request in front)
User-friendly video analytics dashboard
Unlimited PRO upgrades and downloads
[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt])
. ?>)
[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]
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 »
PRO users: Below, We've enabled the ability to have priority support with our team. Use this to get one-on-one help with any issues you might have or to send us suggestions for future features. We typically respond within minutes during normal work hours. We're always happy to accept any testimonials you might have as well.
0)) { ?>