| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: YouTube |
| 4 |
Plugin URI: http://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx |
| 5 |
Description: YouTube Embed and YouTube Gallery WordPress Plugin. Embed a responsive video, YouTube channel, playlist gallery, or live stream |
| 6 |
Version: 11.8 |
| 7 |
Author: EmbedPlus Team |
| 8 |
Author URI: http://www.embedplus.com |
| 9 |
*/ |
| 10 |
|
| 11 |
/* |
| 12 |
YouTube |
| 13 |
Copyright (C) 2017 EmbedPlus.com |
| 14 |
|
| 15 |
This program is free software: you can redistribute it and/or modify |
| 16 |
it under the terms of the GNU General Public License as published by |
| 17 |
the Free Software Foundation, either version 3 of the License, or |
| 18 |
(at your option) any later version. |
| 19 |
|
| 20 |
This program is distributed in the hope that it will be useful, |
| 21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
GNU General Public License for more details. |
| 24 |
|
| 25 |
You should have received a copy of the GNU General Public License |
| 26 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 27 |
|
| 28 |
*/ |
| 29 |
|
| 30 |
//define('WP_DEBUG', true); |
| 31 |
|
| 32 |
class YouTubePrefs |
| 33 |
{ |
| 34 |
|
| 35 |
public static $curltimeout = 20; |
| 36 |
public static $version = '11.8'; |
| 37 |
public static $opt_version = 'version'; |
| 38 |
public static $optembedwidth = null; |
| 39 |
public static $optembedheight = null; |
| 40 |
public static $defaultheight = null; |
| 41 |
public static $defaultwidth = null; |
| 42 |
public static $oembeddata = null; |
| 43 |
public static $opt_center = 'centervid'; |
| 44 |
public static $opt_glance = 'glance'; |
| 45 |
public static $opt_autoplay = 'autoplay'; |
| 46 |
public static $opt_debugmode = 'debugmode'; |
| 47 |
public static $opt_old_script_method = 'old_script_method'; |
| 48 |
public static $opt_cc_load_policy = 'cc_load_policy'; |
| 49 |
public static $opt_iv_load_policy = 'iv_load_policy'; |
| 50 |
public static $opt_loop = 'loop'; |
| 51 |
public static $opt_modestbranding = 'modestbranding'; |
| 52 |
public static $opt_rel = 'rel'; |
| 53 |
public static $opt_showinfo = 'showinfo'; |
| 54 |
public static $opt_playsinline = 'playsinline'; |
| 55 |
public static $opt_autohide = 'autohide'; |
| 56 |
public static $opt_controls = 'controls'; |
| 57 |
public static $opt_theme = 'theme'; |
| 58 |
public static $opt_color = 'color'; |
| 59 |
public static $opt_listType = 'listType'; |
| 60 |
public static $opt_dohl = 'dohl'; |
| 61 |
public static $opt_hl = 'hl'; |
| 62 |
public static $opt_nocookie = 'nocookie'; |
| 63 |
public static $opt_playlistorder = 'playlistorder'; |
| 64 |
public static $opt_acctitle = 'acctitle'; |
| 65 |
public static $opt_pro = 'pro'; |
| 66 |
public static $opt_oldspacing = 'oldspacing'; |
| 67 |
public static $opt_responsive = 'responsive'; |
| 68 |
public static $opt_responsive_all = 'responsive_all'; |
| 69 |
public static $opt_origin = 'origin'; |
| 70 |
public static $opt_widgetfit = 'widgetfit'; |
| 71 |
public static $opt_evselector_light = 'evselector_light'; |
| 72 |
public static $opt_stop_mobile_buffer = 'stop_mobile_buffer'; |
| 73 |
public static $opt_restrict_wizard = 'restrict_wizard'; |
| 74 |
public static $opt_restrict_wizard_roles = 'restrict_wizard_roles'; |
| 75 |
public static $opt_ajax_compat = 'ajax_compat'; |
| 76 |
public static $opt_defaultdims = 'defaultdims'; |
| 77 |
public static $opt_defaultwidth = 'width'; |
| 78 |
public static $opt_defaultheight = 'height'; |
| 79 |
public static $opt_defaultvol = 'defaultvol'; |
| 80 |
public static $opt_vol = 'vol'; |
| 81 |
public static $opt_apikey = 'apikey'; |
| 82 |
public static $opt_migrate = 'migrate'; |
| 83 |
public static $opt_migrate_youtube = 'migrate_youtube'; |
| 84 |
public static $opt_migrate_embedplusvideo = 'migrate_embedplusvideo'; |
| 85 |
public static $opt_gallery_pagesize = 'gallery_pagesize'; |
| 86 |
public static $opt_gallery_apikey = 'gallery_apikey'; |
| 87 |
public static $opt_gallery_columns = 'gallery_columns'; |
| 88 |
public static $opt_gallery_collapse_grid = 'gallery_collapse_grid'; |
| 89 |
public static $opt_gallery_collapse_grid_breaks = 'gallery_collapse_grid_breaks'; |
| 90 |
public static $opt_gallery_scrolloffset = 'gallery_scrolloffset'; |
| 91 |
public static $opt_gallery_showtitle = 'gallery_showtitle'; |
| 92 |
public static $opt_gallery_showpaging = 'gallery_showpaging'; |
| 93 |
public static $opt_gallery_thumbplay = 'gallery_thumbplay'; |
| 94 |
public static $opt_gallery_autonext = 'gallery_autonext'; |
| 95 |
public static $opt_gallery_channelsub = 'gallery_channelsub'; |
| 96 |
public static $opt_gallery_channelsublink = 'gallery_channelsublink'; |
| 97 |
public static $opt_gallery_channelsubtext = 'gallery_channelsubtext'; |
| 98 |
public static $opt_gallery_customarrows = 'gallery_customarrows'; |
| 99 |
public static $opt_gallery_customprev = 'gallery_customprev'; |
| 100 |
public static $opt_gallery_customnext = 'gallery_customnext'; |
| 101 |
public static $opt_not_live_content = 'not_live_content'; |
| 102 |
public static $opt_admin_off_scripts = 'admin_off_scripts'; |
| 103 |
public static $opt_alloptions = 'youtubeprefs_alloptions'; |
| 104 |
public static $alloptions = null; |
| 105 |
public static $yt_options = array(); |
| 106 |
public static $dft_bpts = array(array('bp' => array('min' => 0, 'max' => 767), 'cols' => 1)); |
| 107 |
public static $dft_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber'); |
| 108 |
//public static $epbase = 'http://localhost:2346'; |
| 109 |
public static $epbase = '//www.embedplus.com'; |
| 110 |
public static $double_plugin = false; |
| 111 |
public static $scriptsprinted = 0; |
| 112 |
public static $min = '.min'; |
| 113 |
public static $badentities = array('×', '×', '–', '–', '&', '&', '&'); |
| 114 |
public static $goodliterals = array('x', 'x', '--', '--', '&', '&', '&'); |
| 115 |
public static $wizard_hook = ''; |
| 116 |
public static $get_api_key_msg = 'The ### feature now requires a (free) YouTube API key from Google. Please follow the easy steps <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">in this video</a> to create and save your API key.'; |
| 117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 120 |
|
| 121 |
public static $oldytregex = '@^\s*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))/{0,1}\?)|(?:youtu.be/))([^\s"]+)\s*$@im'; |
| 122 |
public static $ytregex = '@^[\r\t ]*https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))/{0,1}\?)|(?:youtu.be/))([^\s"]+)[\r\t ]*$@im'; |
| 123 |
public static $justurlregex = '@https?://(?:www\.)?(?:(?:youtube.com/(?:(?:watch)|(?:embed)|(?:playlist))/{0,1}\?)|(?:youtu.be/))([^\[\s"]+)@i'; |
| 124 |
|
| 125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 128 |
|
| 129 |
public function __construct() |
| 130 |
{ |
| 131 |
add_action('admin_init', array(get_class(), 'check_double_plugin_warning')); |
| 132 |
|
| 133 |
self::$alloptions = get_option(self::$opt_alloptions); |
| 134 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || self::$alloptions[self::$opt_debugmode] == 1) |
| 135 |
{ |
| 136 |
self::$min = ''; |
| 137 |
} |
| 138 |
|
| 139 |
add_action('admin_notices', array(get_class(), 'separate_version_message')); |
| 140 |
|
| 141 |
if (self::$alloptions == false || version_compare(self::$alloptions[self::$opt_version], self::$version, '<')) |
| 142 |
{ |
| 143 |
self::initoptions(); |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
if (self::$alloptions[self::$opt_oldspacing] == 1) |
| 148 |
{ |
| 149 |
self::$ytregex = self::$oldytregex; |
| 150 |
} |
| 151 |
|
| 152 |
self::$optembedwidth = intval(get_option('embed_size_w')); |
| 153 |
self::$optembedheight = intval(get_option('embed_size_h')); |
| 154 |
|
| 155 |
self::$yt_options = array( |
| 156 |
self::$opt_autoplay, |
| 157 |
self::$opt_cc_load_policy, |
| 158 |
self::$opt_iv_load_policy, |
| 159 |
self::$opt_loop, |
| 160 |
self::$opt_modestbranding, |
| 161 |
self::$opt_rel, |
| 162 |
self::$opt_showinfo, |
| 163 |
self::$opt_playsinline, |
| 164 |
self::$opt_autohide, |
| 165 |
self::$opt_controls, |
| 166 |
self::$opt_hl, |
| 167 |
self::$opt_theme, |
| 168 |
self::$opt_color, |
| 169 |
self::$opt_listType, |
| 170 |
'index', |
| 171 |
'list', |
| 172 |
'start', |
| 173 |
'end' |
| 174 |
); |
| 175 |
|
| 176 |
add_action('media_buttons', array(get_class(), 'media_button_wizard'), 11); |
| 177 |
|
| 178 |
|
| 179 |
self::do_ytprefs(); |
| 180 |
add_action('admin_menu', array(get_class(), 'ytprefs_plugin_menu')); |
| 181 |
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(get_class(), 'my_plugin_action_links')); |
| 182 |
|
| 183 |
if (!is_admin()) |
| 184 |
{ |
| 185 |
if (self::$alloptions[self::$opt_old_script_method] == 1) |
| 186 |
{ |
| 187 |
add_action('wp_print_scripts', array(get_class(), 'jsvars')); |
| 188 |
add_action('wp_enqueue_scripts', array(get_class(), 'jsvars')); |
| 189 |
} |
| 190 |
|
| 191 |
add_action('wp_enqueue_scripts', array(get_class(), 'ytprefsscript'), 100); |
| 192 |
add_action('wp_enqueue_scripts', array(get_class(), 'fitvids'), 101); |
| 193 |
} |
| 194 |
|
| 195 |
add_action("wp_ajax_my_embedplus_glance_vids", array(get_class(), 'my_embedplus_glance_vids')); |
| 196 |
add_action("wp_ajax_my_embedplus_glance_count", array(get_class(), 'my_embedplus_glance_count')); |
| 197 |
add_action("wp_ajax_my_embedplus_dismiss_double_plugin_warning", array(get_class(), 'my_embedplus_dismiss_double_plugin_warning')); |
| 198 |
add_action("wp_ajax_my_embedplus_gallery_page", array(get_class(), 'my_embedplus_gallery_page')); |
| 199 |
add_action("wp_ajax_nopriv_my_embedplus_gallery_page", array(get_class(), 'my_embedplus_gallery_page')); |
| 200 |
add_action('admin_enqueue_scripts', array(get_class(), 'admin_enqueue_scripts'), 10, 1); |
| 201 |
} |
| 202 |
|
| 203 |
public static function separate_version_message() |
| 204 |
{ |
| 205 |
if (current_user_can('manage_options') && self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 10) |
| 206 |
{ |
| 207 |
$class = 'notice notice-error is-dismissible'; |
| 208 |
$message = 'Important message to YouTube Pro users: From version 11.7 onward, you must <a href="https://www.embedplus.com/youtube-pro/download/?prokey=' . esc_attr(self::$alloptions[self::$opt_pro]) . '" target="_blank">download the separate plugin here</a> 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.'; |
| 209 |
|
| 210 |
printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), wp_kses_post($message)); |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
public static function my_plugin_action_links($links) |
| 215 |
{ |
| 216 |
$links[] = '<a href="' . esc_url(admin_url('admin.php?page=youtube-my-preferences')) . '">Settings</a>'; |
| 217 |
$links[] = '<a href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx" target="_blank">Pro Version</a>'; |
| 218 |
return $links; |
| 219 |
} |
| 220 |
|
| 221 |
public static function show_glance_list() |
| 222 |
{ |
| 223 |
$glancehref = self::show_glance(); |
| 224 |
$cnt = self::get_glance_count(); |
| 225 |
|
| 226 |
//display via list |
| 227 |
return |
| 228 |
'<li class="page-count"> |
| 229 |
<a href="' . $glancehref . '" class="thickbox ytprefs_glance_button" id="ytprefs_glance_button" title="YouTube Embeds At a Glance"> |
| 230 |
' . number_format_i18n($cnt) . ' With YouTube |
| 231 |
</a> |
| 232 |
</li>'; |
| 233 |
} |
| 234 |
|
| 235 |
public static function show_glance_table() |
| 236 |
{ |
| 237 |
$glancehref = self::show_glance(); |
| 238 |
$cnt = self::get_glance_count(); |
| 239 |
return |
| 240 |
'<tr> |
| 241 |
<td class="first b"><a title="YouTube Embeds At a Glance" href="' . $glancehref . '" class="thickbox ytprefs_glance_button">' . number_format_i18n($cnt) . '</a></td> |
| 242 |
<td class="t"><a title="YouTube Embeds At a Glance" href="' . $glancehref . '" id="ytprefs_glance_button" class="thickbox ytprefs_glance_button">With YouTube</a></td> |
| 243 |
</tr>'; |
| 244 |
} |
| 245 |
|
| 246 |
public static function get_glance_count() |
| 247 |
{ |
| 248 |
global $wpdb; |
| 249 |
$query_sql = " |
| 250 |
SELECT count(*) as mytotal |
| 251 |
FROM $wpdb->posts |
| 252 |
WHERE (post_content LIKE '%youtube.com/%' OR post_content LIKE '%youtu.be/%') |
| 253 |
AND post_status = 'publish'"; |
| 254 |
|
| 255 |
$query_result = $wpdb->get_results($query_sql, OBJECT); |
| 256 |
|
| 257 |
return intval($query_result[0]->mytotal); |
| 258 |
} |
| 259 |
|
| 260 |
public static function show_glance() |
| 261 |
{ |
| 262 |
$glancehref = admin_url('admin.php?page=youtube-ep-glance') . '&random=' . rand(1, 1000) . '&TB_iframe=true&width=780&height=800'; |
| 263 |
return $glancehref; |
| 264 |
} |
| 265 |
|
| 266 |
public static function try_get_ytid($url) |
| 267 |
{ |
| 268 |
$theytid = null; |
| 269 |
if (strpos($url, 'v=') !== false) |
| 270 |
{ |
| 271 |
$url_params = explode('?', $url); |
| 272 |
$kvp = self::keyvalue($url_params[1], true); |
| 273 |
$theytid = $kvp['v']; |
| 274 |
} |
| 275 |
else if (strpos($url, "youtu.be") !== false) |
| 276 |
{ |
| 277 |
$shortpath = explode('/', parse_url($url, PHP_URL_PATH)); |
| 278 |
$theytid = $shortpath[1]; |
| 279 |
} |
| 280 |
return $theytid; |
| 281 |
} |
| 282 |
|
| 283 |
public static function wizard() |
| 284 |
{ |
| 285 |
?> |
| 286 |
<div class="wrap" id="epyt_wiz_wrap"> |
| 287 |
<div class="smallnote center"> Please periodically check the YouTube plugin tab on your admin panel to review the latest options. </div> |
| 288 |
|
| 289 |
<?php |
| 290 |
$form_valid = true; |
| 291 |
$acc_expand = ''; |
| 292 |
$get_pro_link = self::$epbase . '/dashboard/pro-easy-video-analytics.aspx'; |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
$step1_video_errors = ''; |
| 297 |
$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 then copy that full link in your address bar to paste here.'; |
| 298 |
$step1_playlist_errors = ''; |
| 299 |
$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 then copy that full link in your address bar to paste here.'; |
| 300 |
$step1_channel_errors = ''; |
| 301 |
$step1_channel_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 then copy that full link in your address bar to paste here. If you are sure your link is correct, then your API key may be too restrictive (<a target="_blank" href="https://console.developers.google.com/apis/credentials">https://console.developers.google.com/apis/credentials</a>).'; |
| 302 |
$step1_live_errors = ''; |
| 303 |
$step1_live_error_invalid = 'Sorry, that does not seem to be a valid link to an existing video or channel. Please confirm that the link works in your browser, and then copy that full link in your address bar to paste here. If you are sure your link is correct, then your API key may be too restrictive (<a target="_blank" href="https://console.developers.google.com/apis/credentials">https://console.developers.google.com/apis/credentials</a>).'; |
| 304 |
$if_live_preview = false; |
| 305 |
if (isset($_POST['wizform_submit'])) |
| 306 |
{ |
| 307 |
$submit_type = $_POST['wizform_submit']; |
| 308 |
if ($submit_type === 'step1_video') |
| 309 |
{ |
| 310 |
// validate |
| 311 |
$search = sanitize_text_field(trim($_POST['txtUrl'])); |
| 312 |
|
| 313 |
try |
| 314 |
{ |
| 315 |
if (empty($search)) |
| 316 |
{ |
| 317 |
throw new Exception(); |
| 318 |
} |
| 319 |
if (preg_match(self::$justurlregex, $search)) |
| 320 |
{ |
| 321 |
//$search = esc_url($search); |
| 322 |
|
| 323 |
try |
| 324 |
{ |
| 325 |
$theytid = self::try_get_ytid($search); |
| 326 |
|
| 327 |
if ($theytid == null) |
| 328 |
{ |
| 329 |
$form_valid = false; |
| 330 |
$step1_video_errors = $step1_video_error_invalid; |
| 331 |
$acc_expand = 'h3_video'; |
| 332 |
} |
| 333 |
else |
| 334 |
{ |
| 335 |
|
| 336 |
$odata = self::get_oembed('http://youtube.com/watch?v=' . $theytid, 1920, 1280); |
| 337 |
if (is_object($odata)) |
| 338 |
{ |
| 339 |
?> |
| 340 |
|
| 341 |
<div id="step2_video" class="center"> |
| 342 |
|
| 343 |
<h2> |
| 344 |
<?php |
| 345 |
if (isset($odata->title)) |
| 346 |
{ |
| 347 |
echo sanitize_text_field($odata->title); |
| 348 |
} |
| 349 |
?> |
| 350 |
</h2> |
| 351 |
<p class="center"> |
| 352 |
<a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a> |
| 353 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] https://www.youtube.com/watch?v=<?php echo esc_attr($theytid) ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a> |
| 354 |
</p> |
| 355 |
Or Copy Code: |
| 356 |
<span class="copycode">[embedyt] https://www.youtube.com/watch?v=<?php echo esc_attr($theytid) ?>[/embedyt]</span> |
| 357 |
<div class="clearboth" style="height: 10px;"> |
| 358 |
</div> |
| 359 |
<div class="center relative"> |
| 360 |
<iframe src="https://www.youtube.com/embed/<?php echo esc_attr($theytid) ?>?rel=0" allowfullscreen="" width="854" height="480" frameborder="0"></iframe> |
| 361 |
</div> |
| 362 |
|
| 363 |
</div> |
| 364 |
<?php |
| 365 |
} |
| 366 |
else |
| 367 |
{ |
| 368 |
$form_valid = false; |
| 369 |
$step1_video_errors = $step1_video_error_invalid; |
| 370 |
$acc_expand = 'h3_video'; |
| 371 |
} |
| 372 |
} |
| 373 |
} |
| 374 |
catch (Exception $ex) |
| 375 |
{ |
| 376 |
$form_valid = false; |
| 377 |
$step1_video_errors = $step1_video_error_invalid; |
| 378 |
$acc_expand = 'h3_video'; |
| 379 |
} |
| 380 |
} |
| 381 |
else |
| 382 |
{ |
| 383 |
$search_options = new stdClass(); |
| 384 |
$search_options->q = $search; |
| 385 |
$search_options->pageToken = null; |
| 386 |
?> |
| 387 |
<div id="step2_video_search" class="center"> |
| 388 |
<h2>You searched for: <em class="orange"><?php echo sanitize_text_field($search); ?></em> </h2> |
| 389 |
|
| 390 |
<?php |
| 391 |
$search_page = self::get_search_page($search_options); |
| 392 |
echo $search_page->html; |
| 393 |
?> |
| 394 |
</div> |
| 395 |
<?php |
| 396 |
} |
| 397 |
|
| 398 |
// // if valid, set and display next step |
| 399 |
// if not,form_valid = false and set accordion expander and error messages |
| 400 |
} |
| 401 |
catch (Exception $ex) |
| 402 |
{ |
| 403 |
$form_valid = false; |
| 404 |
$step1_video_errors = $step1_video_error_invalid; |
| 405 |
$acc_expand = 'h3_video'; |
| 406 |
} |
| 407 |
} |
| 408 |
else if ($submit_type === 'step1_playlist') |
| 409 |
{ |
| 410 |
$search = sanitize_text_field(trim($_POST['txtUrlPlaylist'])); |
| 411 |
try |
| 412 |
{ |
| 413 |
if (empty($search)) |
| 414 |
{ |
| 415 |
throw new Exception(); |
| 416 |
} |
| 417 |
if (preg_match(self::$justurlregex, $search)) |
| 418 |
{ |
| 419 |
try |
| 420 |
{ |
| 421 |
$theytid = null; |
| 422 |
try |
| 423 |
{ |
| 424 |
$theytid = self::try_get_ytid($search); |
| 425 |
} |
| 426 |
catch (Exception $ex) |
| 427 |
{ |
| 428 |
|
| 429 |
} |
| 430 |
|
| 431 |
$urlparams = explode('?', $search); |
| 432 |
$qvars = array(); |
| 433 |
parse_str($urlparams[1], $qvars); |
| 434 |
$theplaylistid = $qvars["list"]; |
| 435 |
|
| 436 |
$odata = self::get_oembed('https://youtube.com/playlist?list=' . $theplaylistid, 1920, 1280); |
| 437 |
|
| 438 |
if (is_object($odata)) |
| 439 |
{ |
| 440 |
$rel = 'https://www.youtube.com/embed?listType=playlist&list=' . (esc_attr($theplaylistid) . (empty($theytid) ? '' : '&v=' . esc_attr($theytid))); |
| 441 |
?> |
| 442 |
|
| 443 |
<div id="step2_playlist" class="center"> |
| 444 |
|
| 445 |
<h2> |
| 446 |
<?php |
| 447 |
if (isset($odata->title)) |
| 448 |
{ |
| 449 |
echo 'Playlist: ' . sanitize_text_field($odata->title); |
| 450 |
} |
| 451 |
?> |
| 452 |
</h2> |
| 453 |
<p class="center"> |
| 454 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Playlist</a> |
| 455 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Gallery</a> |
| 456 |
<a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a> |
| 457 |
</p> |
| 458 |
<p> |
| 459 |
Or Copy Code: |
| 460 |
</p> |
| 461 |
<p> |
| 462 |
Playlist Layout: <span class="copycode">[embedyt] <?php echo $rel; ?>[/embedyt]</span> |
| 463 |
</p> |
| 464 |
<p> |
| 465 |
Gallery Layout: <span class="copycode">[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]</span> |
| 466 |
</p> |
| 467 |
<div class="clearboth" style="height: 10px;"> |
| 468 |
</div> |
| 469 |
<div class="center relative"> |
| 470 |
<iframe src="<?php echo $rel; ?>" allowfullscreen="" width="854" height="480" frameborder="0"></iframe> |
| 471 |
</div> |
| 472 |
</div> |
| 473 |
<?php |
| 474 |
} |
| 475 |
else |
| 476 |
{ |
| 477 |
$form_valid = false; |
| 478 |
$step1_playlist_errors = $step1_playlist_error_invalid; |
| 479 |
$acc_expand = 'h3_playlist'; |
| 480 |
} |
| 481 |
} |
| 482 |
catch (Exception $ex) |
| 483 |
{ |
| 484 |
$form_valid = false; |
| 485 |
$step1_playlist_errors = $step1_playlist_error_invalid; |
| 486 |
$acc_expand = 'h3_playlist'; |
| 487 |
} |
| 488 |
} |
| 489 |
} |
| 490 |
catch (Exception $ex) |
| 491 |
{ |
| 492 |
$form_valid = false; |
| 493 |
$step1_playlist_errors = $step1_playlist_error_invalid; |
| 494 |
$acc_expand = 'h3_playlist'; |
| 495 |
} |
| 496 |
} |
| 497 |
else if ($submit_type === 'step1_channel') |
| 498 |
{ |
| 499 |
$search = sanitize_text_field(trim($_POST['txtUrlChannel'])); |
| 500 |
try |
| 501 |
{ |
| 502 |
if (empty($search)) |
| 503 |
{ |
| 504 |
throw new Exception(); |
| 505 |
} |
| 506 |
if (preg_match(self::$justurlregex, $search)) |
| 507 |
{ |
| 508 |
try |
| 509 |
{ |
| 510 |
$theytid = null; |
| 511 |
try |
| 512 |
{ |
| 513 |
$theytid = self::try_get_ytid($search); |
| 514 |
} |
| 515 |
catch (Exception $ex) |
| 516 |
{ |
| 517 |
|
| 518 |
} |
| 519 |
$chanvid = self::get_video_snippet($theytid); |
| 520 |
if ($chanvid) |
| 521 |
{ |
| 522 |
$thechannel = self::get_channel_snippet($chanvid->snippet->channelId); |
| 523 |
|
| 524 |
if ($thechannel) |
| 525 |
{ |
| 526 |
$theplaylistid = $thechannel->contentDetails->relatedPlaylists->uploads; |
| 527 |
$rel = 'https://www.youtube.com/embed?listType=playlist&list=' . (esc_attr($theplaylistid)); |
| 528 |
?> |
| 529 |
|
| 530 |
<div id="step2_channel" class="center"> |
| 531 |
|
| 532 |
<h2> |
| 533 |
<?php |
| 534 |
echo 'Channel: ' . sanitize_text_field($chanvid->snippet->channelTitle); |
| 535 |
?> |
| 536 |
</h2> |
| 537 |
<p class="center"> |
| 538 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Playlist</a> |
| 539 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert as Gallery</a> |
| 540 |
<a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a> |
| 541 |
</p> |
| 542 |
<p> |
| 543 |
Or Copy Code: |
| 544 |
</p> |
| 545 |
<p> |
| 546 |
Playlist Layout: <span class="copycode">[embedyt] <?php echo $rel; ?>[/embedyt]</span> |
| 547 |
</p> |
| 548 |
<p> |
| 549 |
Gallery Layout: <span class="copycode">[embedyt] <?php echo $rel . '&layout=gallery'; ?>[/embedyt]</span> |
| 550 |
</p> |
| 551 |
<div class="clearboth" style="height: 10px;"> |
| 552 |
</div> |
| 553 |
<div class="center relative"> |
| 554 |
<iframe src="<?php echo $rel; ?>" allowfullscreen="" width="854" height="480" frameborder="0"></iframe> |
| 555 |
</div> |
| 556 |
</div> |
| 557 |
<?php |
| 558 |
} |
| 559 |
else |
| 560 |
{ |
| 561 |
$form_valid = false; |
| 562 |
$step1_channel_errors = $step1_channel_error_invalid; |
| 563 |
$acc_expand = 'h3_channel'; |
| 564 |
} |
| 565 |
} |
| 566 |
else |
| 567 |
{ |
| 568 |
$form_valid = false; |
| 569 |
$step1_channel_errors = $step1_channel_error_invalid; |
| 570 |
$acc_expand = 'h3_channel'; |
| 571 |
} |
| 572 |
} |
| 573 |
catch (Exception $ex) |
| 574 |
{ |
| 575 |
$form_valid = false; |
| 576 |
$step1_channel_errors = $step1_channel_error_invalid; |
| 577 |
$acc_expand = 'h3_channel'; |
| 578 |
} |
| 579 |
} |
| 580 |
} |
| 581 |
catch (Exception $ex) |
| 582 |
{ |
| 583 |
$form_valid = false; |
| 584 |
$step1_channel_errors = $step1_channel_error_invalid; |
| 585 |
$acc_expand = 'h3_channel'; |
| 586 |
} |
| 587 |
} |
| 588 |
else if ($submit_type === 'step1_live') |
| 589 |
{ |
| 590 |
$search = sanitize_text_field(trim($_POST['txtUrlLive'])); |
| 591 |
try |
| 592 |
{ |
| 593 |
if (empty($search)) |
| 594 |
{ |
| 595 |
throw new Exception(); |
| 596 |
} |
| 597 |
|
| 598 |
try |
| 599 |
{ |
| 600 |
$thechannel = false; |
| 601 |
$chanmatch = array(); |
| 602 |
preg_match('@/channel/(.+)@', $search, $chanmatch); |
| 603 |
if (!empty($chanmatch)) |
| 604 |
{ |
| 605 |
$thechannel = self::get_channel_snippet($chanmatch[1]); |
| 606 |
} |
| 607 |
else |
| 608 |
{ |
| 609 |
$theytid = null; |
| 610 |
try |
| 611 |
{ |
| 612 |
$theytid = self::try_get_ytid($search); |
| 613 |
} |
| 614 |
catch (Exception $ex) |
| 615 |
{ |
| 616 |
|
| 617 |
} |
| 618 |
$chanvid = self::get_video_snippet($theytid); |
| 619 |
if ($chanvid) |
| 620 |
{ |
| 621 |
$thechannel = self::get_channel_snippet($chanvid->snippet->channelId); |
| 622 |
} |
| 623 |
} |
| 624 |
if ($thechannel) |
| 625 |
{ |
| 626 |
$live_attempt = self::get_live_snippet($thechannel->id); |
| 627 |
if ($live_attempt) |
| 628 |
{ |
| 629 |
$if_live_preview = $live_attempt->id->videoId; |
| 630 |
} |
| 631 |
$rel = 'https://www.youtube.com/embed?live=1&channel=' . (esc_attr($thechannel->id)); |
| 632 |
?> |
| 633 |
|
| 634 |
<div id="step2_channel" class="center"> |
| 635 |
|
| 636 |
<h2> |
| 637 |
<?php |
| 638 |
echo 'Live Stream From Channel: ' . sanitize_text_field($thechannel->snippet->title); |
| 639 |
?> |
| 640 |
</h2> |
| 641 |
<p class="center"> |
| 642 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] <?php echo $rel; ?>[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a> |
| 643 |
<a class="ui-button ui-widget ui-corner-all" href="<?php echo $get_pro_link; ?>" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a> |
| 644 |
</p> |
| 645 |
<p> |
| 646 |
Or Copy Code: |
| 647 |
</p> |
| 648 |
<p> |
| 649 |
<span class="copycode">[embedyt] <?php echo $rel; ?>[/embedyt]</span> |
| 650 |
</p> |
| 651 |
<div class="clearboth" style="height: 10px;"> |
| 652 |
</div> |
| 653 |
<?php |
| 654 |
if ($if_live_preview) |
| 655 |
{ |
| 656 |
?> |
| 657 |
<div class="center relative"> |
| 658 |
<iframe src="https://www.youtube.com/embed/<?php echo esc_attr($if_live_preview) ?>?rel=0" allowfullscreen="" width="854" height="480" frameborder="0"></iframe> |
| 659 |
</div> |
| 660 |
<?php |
| 661 |
} |
| 662 |
?> |
| 663 |
<p> |
| 664 |
<strong>Is your live stream not working?</strong> According to Google/YouTube rules, there must be an active AdSense account that's connected to the live |
| 665 |
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 |
| 666 |
likely just see a blank screen when you embed your stream, even if it is visible on YouTube.com. |
| 667 |
Read more here: <a href="https://support.google.com/youtube/answer/2474026?hl=en" target="_blank">https://support.google.com/youtube/answer/2474026?hl=en</a> |
| 668 |
</p> |
| 669 |
</div> |
| 670 |
<?php |
| 671 |
} |
| 672 |
else |
| 673 |
{ |
| 674 |
$form_valid = false; |
| 675 |
$step1_live_errors = $step1_live_error_invalid; |
| 676 |
$acc_expand = 'h3_live'; |
| 677 |
} |
| 678 |
} |
| 679 |
catch (Exception $ex) |
| 680 |
{ |
| 681 |
$form_valid = false; |
| 682 |
$step1_live_errors = $step1_live_error_invalid; |
| 683 |
$acc_expand = 'h3_live'; |
| 684 |
} |
| 685 |
} |
| 686 |
catch (Exception $ex) |
| 687 |
{ |
| 688 |
$form_valid = false; |
| 689 |
$step1_live_errors = $step1_live_error_invalid; |
| 690 |
$acc_expand = 'h3_live'; |
| 691 |
} |
| 692 |
} |
| 693 |
else |
| 694 |
{ |
| 695 |
$form_valid = false; |
| 696 |
$acc_expand = 'h3none'; |
| 697 |
} |
| 698 |
} |
| 699 |
|
| 700 |
if (!isset($_POST['wizform_submit']) || ($form_valid === false)) |
| 701 |
{ |
| 702 |
if ($form_valid === false) |
| 703 |
{ |
| 704 |
?> |
| 705 |
<script type="text/javascript"> |
| 706 |
var _EPYTWIZ_ = _EPYTWIZ_ || {}; |
| 707 |
_EPYTWIZ_.acc_expand = '<?php echo sanitize_key($acc_expand) ?>';</script> |
| 708 |
<?php |
| 709 |
} |
| 710 |
?> |
| 711 |
|
| 712 |
<div class="wiz-accordion"> |
| 713 |
<h3 class="header-go"><a href="<?php echo admin_url('admin.php?page=youtube-my-preferences#jumpdefaults'); ?>">Check my general YouTube embedding instructions and settings. </a></h3> |
| 714 |
<div class="header-go-content"></div> |
| 715 |
<h3 id="h3_video"><a href="#">Embed a single video.</a></h3> |
| 716 |
<div> |
| 717 |
<h4 class="center">Single video directions</h4> |
| 718 |
<p> |
| 719 |
Search YouTube videos by title below (example: <em>TED talks</em>). Or, if you already have the URL for the video, you can paste it below (example: <em>https://www.youtube.com/watch?v=YVvn8dpSAt0</em> ) |
| 720 |
</p> |
| 721 |
<form name="wizform_video" method="post" action="" class="wizform" id="wizform_video"> |
| 722 |
<div class="center txt-button-align"> |
| 723 |
<input name="txtUrl" maxlength="200" id="txtUrl" class="txturlpastecustom ui-widget ui-widget-content ui-corner-all" placeholder="Search by title or paste URL here" type="text"> <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_video">Submit</button> |
| 724 |
</div> |
| 725 |
<p class="badpaste orange bold" style="display: none;"> |
| 726 |
Please do not paste full embedcode above, only simple links to the YouTube video. |
| 727 |
<br /> |
| 728 |
We have attempted to correct it above, but please doublecheck! |
| 729 |
</p> |
| 730 |
</form> |
| 731 |
<?php echo $step1_video_errors ? '<p class="orange bold">' . $step1_video_errors . '</p>' : ''; ?> |
| 732 |
</div> |
| 733 |
<h3 id="h3_playlist"><a href="#">Embed a playlist. </a></h3> |
| 734 |
<div> |
| 735 |
<h4 class="center">Playlist directions</h4> |
| 736 |
<div class="playlist-tabs"> |
| 737 |
<ul> |
| 738 |
<li><a href="#ptabs-1">Self-contained layout directions</a></li> |
| 739 |
<li><a href="#ptabs-2">Gallery layout directions</a></li> |
| 740 |
</ul> |
| 741 |
<div id="ptabs-1"> |
| 742 |
<img src="<?php echo plugins_url('/images/icon-playlist-self.jpg', __FILE__) ?>" class="icon-playlist" /> |
| 743 |
<ol> |
| 744 |
<li>Go to the page for the playlist that lists all of its videos (<a href="https://www.youtube.com/playlist?list=PL70DEC2B0568B5469" target="_blank">Example »</a>). </li> |
| 745 |
<li>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).</li> |
| 746 |
<li>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...")</li> |
| 747 |
<li>Click "Get Playlist" to continue.</li> |
| 748 |
</ol> |
| 749 |
<div class="clearboth"> |
| 750 |
</div> |
| 751 |
</div> |
| 752 |
<div id="ptabs-2"> |
| 753 |
<img src="<?php echo plugins_url('/images/icon-playlist-gallery.jpg', __FILE__) ?>" class="icon-playlist" /> |
| 754 |
<ol> |
| 755 |
<li>Go to the page for the playlist that lists all of its videos (<a href="https://www.youtube.com/playlist?list=PL70DEC2B0568B5469" target="_blank">Example »</a>). </li> |
| 756 |
<li>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...")</li> |
| 757 |
<li>Click "Get Playlist" to continue.</li> |
| 758 |
</ol> |
| 759 |
<div class="clearboth"> |
| 760 |
</div> |
| 761 |
</div> |
| 762 |
</div> |
| 763 |
|
| 764 |
<form name="wizform_playlist" method="post" action="" class="wizform" id="wizform_playlist"> |
| 765 |
<div class="center txt-button-align"> |
| 766 |
<input name="txtUrlPlaylist" maxlength="200" id="txtUrlPlaylist" class="txturlpastecustom ui-widget ui-widget-content ui-corner-all" placeholder="Paste the playlist link here" type="text"> |
| 767 |
<button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_playlist">Get Playlist</button> |
| 768 |
</div> |
| 769 |
</form> |
| 770 |
<?php echo $step1_playlist_errors ? '<p class="orange bold">' . $step1_playlist_errors . '</p>' : ''; ?> |
| 771 |
</div> |
| 772 |
<h3 id="h3_channel"><a href="#">Embed a channel. </a></h3> |
| 773 |
<div> |
| 774 |
<h4 class="center">Channel directions</h4> |
| 775 |
<?php |
| 776 |
if (!self::has_api_key()) |
| 777 |
{ |
| 778 |
echo str_replace('###', '"search for channel"', self::$get_api_key_msg); |
| 779 |
} |
| 780 |
else |
| 781 |
{ |
| 782 |
?> |
| 783 |
<p> |
| 784 |
Enter a link to any video that belongs to the user's channel. Example: https://www.youtube.com/watch?v=YVvn8dpSAt0 |
| 785 |
</p> |
| 786 |
<form name="wizform_channel" method="post" action="" class="wizform" id="wizform_channel"> |
| 787 |
<div class="center txt-button-align"> |
| 788 |
<input name="txtUrlChannel" maxlength="200" id="txtUrlChannel" class="txturlpastecustom ui-widget ui-widget-content ui-corner-all" placeholder="Paste YouTube link here" type="text"> <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_channel">Get Channel</button> |
| 789 |
</div> |
| 790 |
<p class="badpaste orange bold" style="display: none;"> |
| 791 |
Please do not paste full embedcode above, only simple links to the YouTube video. |
| 792 |
<br /> |
| 793 |
We have attempted to correct it above, but please doublecheck! |
| 794 |
</p> |
| 795 |
</form> |
| 796 |
<?php echo $step1_channel_errors ? '<p class="orange bold">' . $step1_channel_errors . '</p>' : ''; ?> |
| 797 |
<?php |
| 798 |
} |
| 799 |
?> |
| 800 |
</div> |
| 801 |
<h3 id="h3_live"><a href="#">Embed a live stream. <sup class="orange">NEW</sup> </a></h3> |
| 802 |
<div> |
| 803 |
<h4 class="center">Live stream directions (<a href="https://www.youtube.com/watch?v=dEQMTUke48E" target="_blank">Video tutorial here »</a>)</h4> |
| 804 |
<?php |
| 805 |
if (!self::has_api_key()) |
| 806 |
{ |
| 807 |
echo str_replace('###', 'live stream', self::$get_api_key_msg); |
| 808 |
} |
| 809 |
else |
| 810 |
{ |
| 811 |
?> |
| 812 |
<ol> |
| 813 |
<li>Enter in the URL of the channel that the live feed belongs to. |
| 814 |
<ul class="ul-disc"> |
| 815 |
<li><small>Example: https://www.youtube.com/<strong>channel</strong>/UCnM5iMGiKsZg-iOlIO2ZkdQ </small></li> |
| 816 |
<li><small>(If you do not know the exact channel URL, enter in the URL to any single video that belongs to that channel, to automatically retrieve the channel URL. Example: https://www.youtube.com/watch?v=fIW8Vvfbojc )</small></li> |
| 817 |
</ul> |
| 818 |
</li> |
| 819 |
<li>On the YouTube plugin admin settings page, enter in the "Default Not Live Content" field what content should display while your channel is <em>not</em> currently streaming. |
| 820 |
</li> |
| 821 |
</ol> |
| 822 |
<form name="wizform_live" method="post" action="" class="wizform" id="wizform_live"> |
| 823 |
<div class="center txt-button-align"> |
| 824 |
<input name="txtUrlLive" maxlength="200" id="txtUrlLive" class="ui-widget ui-widget-content ui-corner-all" placeholder="Paste YouTube link here" type="text"> <button name="wizform_submit" class="ui-button ui-widget ui-corner-all" type="submit" value="step1_live">Submit</button> |
| 825 |
</div> |
| 826 |
</form> |
| 827 |
<?php echo $step1_live_errors ? '<p class="orange bold">' . $step1_live_errors . '</p>' : ''; ?> |
| 828 |
<?php |
| 829 |
} |
| 830 |
?> |
| 831 |
</div> |
| 832 |
<h3 class="header-go"><a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx'; ?>">Check my performance, blocked countries, deleted videos, etc. (PRO) </a></h3> |
| 833 |
<div class="header-go-content"></div> |
| 834 |
</div> |
| 835 |
<a id="lnkYthealth" class="ythealth imglink" href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank"> |
| 836 |
<img src="<?php echo plugins_url('/images/ythealth.png', __FILE__) ?>"> |
| 837 |
<div class="tip"> |
| 838 |
<span class=orange>(PRO)</span> Click to request an instant YouTube diagnostic report to see what (if any) important service problems that Google/YouTube are having right now that might affect your embeds, playlists, and analytics. This report includes issues affecting all types of embeds (standard and advanced players) and sites (not just WordPress). It also considers different devices; e.g. phones, tablets, and PCs. |
| 839 |
</div> |
| 840 |
</a> |
| 841 |
<?php |
| 842 |
} |
| 843 |
?> |
| 844 |
</div> |
| 845 |
<?php |
| 846 |
} |
| 847 |
|
| 848 |
public static function has_api_key() |
| 849 |
{ |
| 850 |
if (isset(self::$alloptions[self::$opt_apikey]) && strlen(trim(self::$alloptions[self::$opt_apikey])) > 0) |
| 851 |
{ |
| 852 |
return true; |
| 853 |
} |
| 854 |
|
| 855 |
return false; |
| 856 |
} |
| 857 |
|
| 858 |
public static function get_live_snippet($channel) |
| 859 |
{ |
| 860 |
$apiEndpoint = 'https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&maxResults=1&type=video&eventType=live&safeSearch=none&videoEmbeddable=true&key=' . self::$alloptions[self::$opt_apikey] |
| 861 |
. '&channelId=' . urlencode($channel); |
| 862 |
$apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout)); |
| 863 |
|
| 864 |
if (is_wp_error($apiResult)) |
| 865 |
{ |
| 866 |
return false; |
| 867 |
} |
| 868 |
|
| 869 |
$jsonResult = json_decode($apiResult['body']); |
| 870 |
|
| 871 |
if (isset($jsonResult->error)) |
| 872 |
{ |
| 873 |
return false; |
| 874 |
} |
| 875 |
|
| 876 |
if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items) && count($jsonResult->items)) |
| 877 |
{ |
| 878 |
return $jsonResult->items[0]; |
| 879 |
} |
| 880 |
|
| 881 |
return false; |
| 882 |
} |
| 883 |
|
| 884 |
public static function get_video_snippet($vid) |
| 885 |
{ |
| 886 |
$apiEndpoint = 'https://www.googleapis.com/youtube/v3/videos?part=snippet&maxResults=1&key=' . self::$alloptions[self::$opt_apikey] |
| 887 |
. '&id=' . urlencode($vid); |
| 888 |
$apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout)); |
| 889 |
|
| 890 |
if (is_wp_error($apiResult)) |
| 891 |
{ |
| 892 |
return false; |
| 893 |
} |
| 894 |
|
| 895 |
$jsonResult = json_decode($apiResult['body']); |
| 896 |
|
| 897 |
if (isset($jsonResult->error)) |
| 898 |
{ |
| 899 |
return false; |
| 900 |
} |
| 901 |
|
| 902 |
if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items) && count($jsonResult->items)) |
| 903 |
{ |
| 904 |
return $jsonResult->items[0]; |
| 905 |
} |
| 906 |
|
| 907 |
return false; |
| 908 |
} |
| 909 |
|
| 910 |
public static function get_channel_snippet($channid) |
| 911 |
{ |
| 912 |
$apiEndpoint = 'https://www.googleapis.com/youtube/v3/channels?part=contentDetails,snippet&key=' . self::$alloptions[self::$opt_apikey] |
| 913 |
. '&id=' . urlencode($channid); |
| 914 |
$apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout)); |
| 915 |
|
| 916 |
if (is_wp_error($apiResult)) |
| 917 |
{ |
| 918 |
return false; |
| 919 |
} |
| 920 |
|
| 921 |
$jsonResult = json_decode($apiResult['body']); |
| 922 |
|
| 923 |
if (isset($jsonResult->error)) |
| 924 |
{ |
| 925 |
return false; |
| 926 |
} |
| 927 |
|
| 928 |
if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items) && count($jsonResult->items)) |
| 929 |
{ |
| 930 |
return $jsonResult->items[0]; |
| 931 |
} |
| 932 |
|
| 933 |
return false; |
| 934 |
} |
| 935 |
|
| 936 |
public static function get_search_page($options) |
| 937 |
{ |
| 938 |
$gallobj = new stdClass(); |
| 939 |
$pageSize = 20; |
| 940 |
|
| 941 |
if (!self::has_api_key()) |
| 942 |
{ |
| 943 |
$gallobj->html = '<div>' . str_replace('###', 'search', self::$get_api_key_msg) . '</div>'; |
| 944 |
return $gallobj; |
| 945 |
} |
| 946 |
|
| 947 |
$apiEndpoint = 'https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=' . $pageSize . '&type=video&safeSearch=none&videoEmbeddable=true&key=' . self::$alloptions[self::$opt_apikey] |
| 948 |
. '&q=' . urlencode($options->q); |
| 949 |
if (!empty($options->pageToken)) |
| 950 |
{ |
| 951 |
$apiEndpoint .= '&pageToken=' . $options->pageToken; |
| 952 |
} |
| 953 |
|
| 954 |
$code = ''; |
| 955 |
$apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout)); |
| 956 |
|
| 957 |
if (is_wp_error($apiResult)) |
| 958 |
{ |
| 959 |
$gallobj->html = '<div>Sorry, there was a YouTube API error: <em>' . htmlspecialchars(strip_tags($apiResult->get_error_message())) . '</em>' . |
| 960 |
' Please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.' . |
| 961 |
'</div>'; |
| 962 |
return $gallobj; |
| 963 |
} |
| 964 |
|
| 965 |
$jsonResult = json_decode($apiResult['body']); |
| 966 |
|
| 967 |
if (isset($jsonResult->error)) |
| 968 |
{ |
| 969 |
if (isset($jsonResult->error->message)) |
| 970 |
{ |
| 971 |
$gallobj->html = '<div>Sorry, there was a YouTube API error: <em>' . htmlspecialchars(strip_tags($jsonResult->error->message)) . '</em>' . |
| 972 |
' Please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.' . |
| 973 |
'</div>'; |
| 974 |
return $gallobj; |
| 975 |
} |
| 976 |
$gallobj->html = '<div>Sorry, there may be an issue with your YouTube API key. Please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.</div>'; |
| 977 |
return $gallobj; |
| 978 |
} |
| 979 |
|
| 980 |
$totalResults = $jsonResult->pageInfo->totalResults; |
| 981 |
|
| 982 |
$nextPageToken = ''; |
| 983 |
$prevPageToken = ''; |
| 984 |
if (isset($jsonResult->nextPageToken)) |
| 985 |
{ |
| 986 |
$nextPageToken = $jsonResult->nextPageToken; |
| 987 |
} |
| 988 |
|
| 989 |
if (isset($jsonResult->prevPageToken)) |
| 990 |
{ |
| 991 |
$prevPageToken = $jsonResult->prevPageToken; |
| 992 |
} |
| 993 |
|
| 994 |
$cnt = 0; |
| 995 |
|
| 996 |
$code .= '<div class="epyt-search-results">'; |
| 997 |
|
| 998 |
if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items)) |
| 999 |
{ |
| 1000 |
foreach ($jsonResult->items as $item) |
| 1001 |
{ |
| 1002 |
|
| 1003 |
$thumb = new stdClass(); |
| 1004 |
|
| 1005 |
$thumb->id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null; |
| 1006 |
$thumb->id = $thumb->id ? $thumb->id : $item->id->videoId; |
| 1007 |
$thumb->title = $item->snippet->title; |
| 1008 |
|
| 1009 |
if (isset($item->snippet->thumbnails->high->url)) |
| 1010 |
{ |
| 1011 |
$thumb->img = $item->snippet->thumbnails->high->url; |
| 1012 |
$thumb->quality = 'high'; |
| 1013 |
} |
| 1014 |
elseif (isset($item->snippet->thumbnails->default->url)) |
| 1015 |
{ |
| 1016 |
$thumb->img = $item->snippet->thumbnails->default->url; |
| 1017 |
$thumb->quality = 'default'; |
| 1018 |
} |
| 1019 |
elseif (isset($item->snippet->thumbnails->medium->url)) |
| 1020 |
{ |
| 1021 |
$thumb->img = $item->snippet->thumbnails->medium->url; |
| 1022 |
$thumb->quality = 'medium'; |
| 1023 |
} |
| 1024 |
else |
| 1025 |
{ |
| 1026 |
$thumb->img = plugins_url('/images/deleted-video-thumb.png', __FILE__); |
| 1027 |
$thumb->quality = 'medium'; |
| 1028 |
} |
| 1029 |
|
| 1030 |
|
| 1031 |
$code .= self::get_search_result_html($thumb, $options); |
| 1032 |
$cnt++; |
| 1033 |
$code .= '<div class="clear-both"></div>'; |
| 1034 |
} |
| 1035 |
} |
| 1036 |
|
| 1037 |
$code .= '<div class="clear-both"></div></div>'; |
| 1038 |
|
| 1039 |
$totalPages = ceil($totalResults / $pageSize); |
| 1040 |
$pagination = '<div class="epyt-pagination">'; |
| 1041 |
|
| 1042 |
$txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev'); |
| 1043 |
$pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-q="' . esc_attr($options->q) |
| 1044 |
. '" data-pagetoken="' . esc_attr($prevPageToken) |
| 1045 |
. '"><div class="arrow">«</div> <div>' . $txtprev . '</div></div>'; |
| 1046 |
|
| 1047 |
|
| 1048 |
$pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">'; |
| 1049 |
$pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>'; |
| 1050 |
$pagination .= '</div>'; |
| 1051 |
|
| 1052 |
$txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next'); |
| 1053 |
$pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-q="' . esc_attr($options->q) |
| 1054 |
. '" data-pagetoken="' . esc_attr($nextPageToken) |
| 1055 |
. '"><div>' . $txtnext . '</div> <div class="arrow">»</div></div>'; |
| 1056 |
|
| 1057 |
$pagination .= '<div class="epyt-loader"><img alt="loading" width="16" height="11" src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>'; |
| 1058 |
$pagination .= '</div>'; |
| 1059 |
|
| 1060 |
$code = $pagination . $code . $pagination; |
| 1061 |
$gallobj->html = $code; |
| 1062 |
return $gallobj; |
| 1063 |
} |
| 1064 |
|
| 1065 |
public static function get_search_result_html($thumb, $options) |
| 1066 |
{ |
| 1067 |
$get_pro_link = self::$epbase . '/dashboard/pro-easy-video-analytics.aspx'; |
| 1068 |
$escId = esc_attr($thumb->id); |
| 1069 |
$code = ''; |
| 1070 |
|
| 1071 |
$code .= '<div class="resultdiv" data-vid="' . $escId . '"> |
| 1072 |
<div class="resultinfo"> |
| 1073 |
<a class="pointer thumb load-movie" style="background-image: url(' . esc_url($thumb->img) . ')"></a> |
| 1074 |
<a class="resulttitle pointer load-movie"><span class="ui-icon ui-icon-circle-triangle-e"></span> ' . sanitize_text_field($thumb->title) . '</a> |
| 1075 |
<br> |
| 1076 |
<span style="display: block;" id="scrollwatch' . $escId . '"></span> |
| 1077 |
<div class="resultsubinfo"> |
| 1078 |
<p> |
| 1079 |
<a class="ui-button ui-widget ui-corner-all" href="' . $get_pro_link . '" target="_blank"><span class="ui-icon ui-icon-gear"></span> Customize (PRO)</a> |
| 1080 |
<a class="ui-button ui-widget ui-corner-all inserttopost" rel="[embedyt] https://www.youtube.com/watch?v=' . $escId . '[/embedyt]"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span> Insert Into Editor</a> |
| 1081 |
</p> |
| 1082 |
Or Copy Code: |
| 1083 |
<span class="copycode">[embedyt] https://www.youtube.com/watch?v=' . $escId . '[/embedyt]</span> |
| 1084 |
</div> |
| 1085 |
</div> |
| 1086 |
</div> |
| 1087 |
<div id="moviecontainer' . $escId . '" class="center moviecontainer relative" style="display: none;"> |
| 1088 |
Preview: <a id="closeme' . $escId . '" class="closeme" data-vid="' . $escId . '"> |
| 1089 |
× |
| 1090 |
</a> |
| 1091 |
<div id="watch' . $escId . '"> |
| 1092 |
</div> |
| 1093 |
</div>'; |
| 1094 |
|
| 1095 |
return $code; |
| 1096 |
} |
| 1097 |
|
| 1098 |
public static function glance_page() |
| 1099 |
{ |
| 1100 |
?> |
| 1101 |
<div class="wrap"> |
| 1102 |
<style type="text/css"> |
| 1103 |
#wphead {display:none;} |
| 1104 |
#wpbody{margin-left: 0px;} |
| 1105 |
.wrap {font-family: Arial; padding: 0px 10px 0px 10px; line-height: 180%;} |
| 1106 |
.bold {font-weight: bold;} |
| 1107 |
.orange {color: #f85d00;} |
| 1108 |
#adminmenuback {display: none;} |
| 1109 |
#adminmenu, adminmenuwrap {display: none;} |
| 1110 |
#wpcontent, .auto-fold #wpcontent {margin-left: 0px;} |
| 1111 |
#wpadminbar {display:none;} |
| 1112 |
html.wp-toolbar {padding: 0px;} |
| 1113 |
#footer, #wpfooter, .auto-fold #wpfooter {display: none;} |
| 1114 |
#wpfooter {clear: both} |
| 1115 |
.acctitle {background-color: #dddddd; border-radius: 5px; padding: 7px 15px 7px 15px; cursor: pointer; margin: 10px; font-weight: bold; font-size: 12px;} |
| 1116 |
.acctitle:hover {background-color: #cccccc;} |
| 1117 |
.accbox {display: none; position: relative; margin: 5px 8px 30px 15px; clear: both; line-height: 180%;} |
| 1118 |
.accclose {position: absolute; top: -38px; right: 5px; cursor: pointer; width: 24px; height: 24px;} |
| 1119 |
.accloader {padding-right: 20px;} |
| 1120 |
.accthumb {display: block; width: 300px; float: left; margin-right: 25px;} |
| 1121 |
.accinfo {width: 300px; float: left;} |
| 1122 |
.accvidtitle {font-weight: bold; font-size: 16px;} |
| 1123 |
.accthumb img {width: 300px; height: auto; display: block;} |
| 1124 |
.clearboth {clear: both;} |
| 1125 |
.pad20 {padding: 20px;} |
| 1126 |
.center {text-align: center;} |
| 1127 |
</style> |
| 1128 |
<script type="text/javascript"> |
| 1129 |
function accclose(ele) |
| 1130 |
{ |
| 1131 |
jQuery(ele).parent('.accbox').hide(400); |
| 1132 |
} |
| 1133 |
|
| 1134 |
(function ($j) |
| 1135 |
{ |
| 1136 |
$j(document).ready(function () { |
| 1137 |
|
| 1138 |
|
| 1139 |
$j('.acctitle').click(function () { |
| 1140 |
var $acctitle = $j(this); |
| 1141 |
var $accbox = $j(this).parent().children('.accbox'); |
| 1142 |
var pid = $accbox.attr("data-postid"); |
| 1143 |
$acctitle.prepend('<img alt="loading" class="accloader" src="<?php echo plugins_url('images/ajax-loader.gif', __FILE__) ?>" />'); |
| 1144 |
jQuery.ajax({ |
| 1145 |
type: "post", |
| 1146 |
dataType: "json", |
| 1147 |
timeout: 30000, |
| 1148 |
url: window._EPYTA_.wpajaxurl, |
| 1149 |
data: {action: 'my_embedplus_glance_vids', postid: pid}, |
| 1150 |
success: function (response) { |
| 1151 |
if (response.type === "success") { |
| 1152 |
$accbox.html(response.data), |
| 1153 |
$accbox.show(400); |
| 1154 |
} else { |
| 1155 |
} |
| 1156 |
}, |
| 1157 |
error: function (xhr, ajaxOptions, thrownError) { |
| 1158 |
|
| 1159 |
}, |
| 1160 |
complete: function () { |
| 1161 |
$acctitle.children('.accloader').remove(); |
| 1162 |
} |
| 1163 |
|
| 1164 |
}); |
| 1165 |
}); |
| 1166 |
}); |
| 1167 |
})(jQuery);</script> |
| 1168 |
<?php |
| 1169 |
global $wpdb; |
| 1170 |
$query_sql = " |
| 1171 |
SELECT SQL_CALC_FOUND_ROWS * |
| 1172 |
FROM $wpdb->posts |
| 1173 |
WHERE (post_content LIKE '%youtube.com/%' OR post_content LIKE '%youtu.be/%') |
| 1174 |
AND post_status = 'publish' |
| 1175 |
order by post_date DESC LIMIT 0, 10"; |
| 1176 |
|
| 1177 |
$query_result = $wpdb->get_results($query_sql, OBJECT); |
| 1178 |
|
| 1179 |
if ($query_result !== null) |
| 1180 |
{ |
| 1181 |
$total = $wpdb->get_var("SELECT FOUND_ROWS();"); |
| 1182 |
global $post; |
| 1183 |
echo '<h2><img alt="YouTube Plugin Icon" src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> 10 Latest Posts/Pages with YouTube Videos (' . $total . ' Total)</h2>'; |
| 1184 |
?> |
| 1185 |
|
| 1186 |
We recommend using this page as an easy way to check the results of the global default settings you make on your recent embeds. Or, simply use it as an index to jump right to your posts that contain YouTube embeds. |
| 1187 |
|
| 1188 |
<?php |
| 1189 |
if ($total > 0) |
| 1190 |
{ |
| 1191 |
echo '<ul class="accord">'; |
| 1192 |
foreach ($query_result as $post) |
| 1193 |
{ |
| 1194 |
echo '<li>'; |
| 1195 |
setup_postdata($post); |
| 1196 |
the_title('<div class="acctitle">', ' »</div>'); |
| 1197 |
echo '<div class="accbox" data-postid="' . $post->ID . '"></div><div class="clearboth"></div></li>'; |
| 1198 |
} |
| 1199 |
echo '</ul>'; |
| 1200 |
} |
| 1201 |
else |
| 1202 |
{ |
| 1203 |
echo '<p class="center bold orange">You currently do not have any YouTube embeds yet.</p>'; |
| 1204 |
} |
| 1205 |
} |
| 1206 |
|
| 1207 |
wp_reset_postdata(); |
| 1208 |
?> |
| 1209 |
To remove this feature from your dashboard, simply uncheck <i>Show "At a Glance" Embed Links</i> in the <a target="_blank" href="<?php echo admin_url('admin.php?page=youtube-my-preferences#jumpdefaults') ?>">plugin settings page »</a>. |
| 1210 |
|
| 1211 |
</div> |
| 1212 |
<?php |
| 1213 |
} |
| 1214 |
|
| 1215 |
public static function my_embedplus_glance_vids() |
| 1216 |
{ |
| 1217 |
$result = array(); |
| 1218 |
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') |
| 1219 |
{ |
| 1220 |
$postid = intval($_REQUEST['postid']); |
| 1221 |
$currpost = get_post($postid); |
| 1222 |
|
| 1223 |
$thehtml = '<img alt="close" class="accclose" onclick="accclose(this)" src="' . plugins_url('images/accclose.png', __FILE__) . '" />'; |
| 1224 |
|
| 1225 |
$matches = Array(); |
| 1226 |
$ismatch = preg_match_all(self::$justurlregex, $currpost->post_content, $matches); |
| 1227 |
|
| 1228 |
if ($ismatch) |
| 1229 |
{ |
| 1230 |
foreach ($matches[0] as $match) |
| 1231 |
{ |
| 1232 |
$link = trim(preg_replace('/&/i', '&', $match)); |
| 1233 |
$link = preg_replace('/\s/', '', $link); |
| 1234 |
$link = trim(str_replace(self::$badentities, self::$goodliterals, $link)); |
| 1235 |
|
| 1236 |
$linkparamstemp = explode('?', $link); |
| 1237 |
|
| 1238 |
$linkparams = array(); |
| 1239 |
if (count($linkparamstemp) > 1) |
| 1240 |
{ |
| 1241 |
$linkparams = self::keyvalue($linkparamstemp[1], true); |
| 1242 |
} |
| 1243 |
if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v'])) |
| 1244 |
{ |
| 1245 |
$vtemp = explode('/', $linkparamstemp[0]); |
| 1246 |
$linkparams['v'] = array_pop($vtemp); |
| 1247 |
} |
| 1248 |
|
| 1249 |
$vidid = $linkparams['v']; |
| 1250 |
|
| 1251 |
if ($vidid != null) |
| 1252 |
{ |
| 1253 |
try |
| 1254 |
{ |
| 1255 |
$odata = self::get_oembed('https://youtube.com/watch?v=' . $vidid, 1920, 1280); |
| 1256 |
$postlink = get_permalink($postid); |
| 1257 |
if ($odata != null && !is_wp_error($odata)) |
| 1258 |
{ |
| 1259 |
$_name = esc_attr(sanitize_text_field($odata->title)); |
| 1260 |
$_description = esc_attr(sanitize_text_field($odata->author_name)); |
| 1261 |
$_thumbnailUrl = esc_url("https://i.ytimg.com/vi/" . $vidid . "/0.jpg"); |
| 1262 |
|
| 1263 |
$thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img alt="YouTube Video" src="' . $_thumbnailUrl . '" /></a>'; |
| 1264 |
$thehtml .= '<div class="accinfo">'; |
| 1265 |
$thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>'; |
| 1266 |
$thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>'; |
| 1267 |
$thehtml .= '</div>'; |
| 1268 |
$thehtml .= '<div class="clearboth pad20"></div>'; |
| 1269 |
} |
| 1270 |
else |
| 1271 |
{ |
| 1272 |
$thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.'; |
| 1273 |
$thehtml .= '<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx">Activate delete video tracking to catch these cases »</a>'; |
| 1274 |
$thehtml .= '</strong>'; |
| 1275 |
} |
| 1276 |
} |
| 1277 |
catch (Exception $ex) |
| 1278 |
{ |
| 1279 |
|
| 1280 |
} |
| 1281 |
} |
| 1282 |
else if (isset($linkparams['list'])) |
| 1283 |
{ |
| 1284 |
// if playlist |
| 1285 |
try |
| 1286 |
{ |
| 1287 |
$odata = self::get_oembed('https://youtube.com/playlist?list=' . $linkparams['list'], 1920, 1280); |
| 1288 |
$postlink = get_permalink($postid); |
| 1289 |
if ($odata != null && !is_wp_error($odata)) |
| 1290 |
{ |
| 1291 |
$_name = esc_attr(sanitize_text_field($odata->title)); |
| 1292 |
$_description = esc_attr(sanitize_text_field($odata->author_name)); |
| 1293 |
$_thumbnailUrl = esc_url($odata->thumbnail_url); |
| 1294 |
|
| 1295 |
$thehtml .= '<a target="_blank" href="' . $postlink . '" class="accthumb"><img alt="YouTube Video" src="' . $_thumbnailUrl . '" /></a>'; |
| 1296 |
$thehtml .= '<div class="accinfo">'; |
| 1297 |
$thehtml .= '<a target="_blank" href="' . $postlink . '" class="accvidtitle">' . $_name . '</a>'; |
| 1298 |
$thehtml .= '<div class="accdesc">' . (strlen($_description) > 400 ? substr($_description, 0, 400) . "..." : $_description) . '</div>'; |
| 1299 |
$thehtml .= '</div>'; |
| 1300 |
$thehtml .= '<div class="clearboth pad20"></div>'; |
| 1301 |
} |
| 1302 |
else |
| 1303 |
{ |
| 1304 |
$thehtml .= '<p class="center bold orange">This <a target="_blank" href="' . $postlink . '">post/page</a> contains a video that has been removed from YouTube.'; |
| 1305 |
$thehtml .= '<br><a target="_blank" href="https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx">Activate delete video tracking to catch these cases »</a>'; |
| 1306 |
$thehtml .= '</strong>'; |
| 1307 |
} |
| 1308 |
} |
| 1309 |
catch (Exception $ex) |
| 1310 |
{ |
| 1311 |
|
| 1312 |
} |
| 1313 |
} |
| 1314 |
} |
| 1315 |
} |
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
if ($currpost != null) |
| 1320 |
{ |
| 1321 |
$result['type'] = 'success'; |
| 1322 |
$result['data'] = $thehtml; |
| 1323 |
} |
| 1324 |
else |
| 1325 |
{ |
| 1326 |
$result['type'] = 'error'; |
| 1327 |
} |
| 1328 |
echo json_encode($result); |
| 1329 |
} |
| 1330 |
else |
| 1331 |
{ |
| 1332 |
$result['type'] = 'error'; |
| 1333 |
header("Location: " . $_SERVER["HTTP_REFERER"]); |
| 1334 |
} |
| 1335 |
die(); |
| 1336 |
} |
| 1337 |
|
| 1338 |
public static function my_embedplus_glance_count() |
| 1339 |
{ |
| 1340 |
$result = array(); |
| 1341 |
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') |
| 1342 |
{ |
| 1343 |
$thehtml = ''; |
| 1344 |
|
| 1345 |
try |
| 1346 |
{ |
| 1347 |
if (version_compare(get_bloginfo('version'), '3.8', '>=')) |
| 1348 |
{ |
| 1349 |
$result['container'] = '#dashboard_right_now ul'; |
| 1350 |
$thehtml .= self::show_glance_list(); |
| 1351 |
} |
| 1352 |
else |
| 1353 |
{ |
| 1354 |
$result['container'] = '#dashboard_right_now .table_content table tbody'; |
| 1355 |
$thehtml .= self::show_glance_table(); |
| 1356 |
} |
| 1357 |
$result['type'] = 'success'; |
| 1358 |
$result['data'] = $thehtml; |
| 1359 |
} |
| 1360 |
catch (Exception $e) |
| 1361 |
{ |
| 1362 |
$result['type'] = 'error'; |
| 1363 |
} |
| 1364 |
|
| 1365 |
echo json_encode($result); |
| 1366 |
} |
| 1367 |
else |
| 1368 |
{ |
| 1369 |
$result['type'] = 'error'; |
| 1370 |
header("Location: " . $_SERVER["HTTP_REFERER"]); |
| 1371 |
} |
| 1372 |
die(); |
| 1373 |
} |
| 1374 |
|
| 1375 |
public static function user_in_roles_any($user, $roles) |
| 1376 |
{ |
| 1377 |
foreach ($user->roles as $idx => $r) |
| 1378 |
{ |
| 1379 |
if (in_array($r, $roles)) |
| 1380 |
{ |
| 1381 |
return true; |
| 1382 |
} |
| 1383 |
} |
| 1384 |
return false; |
| 1385 |
} |
| 1386 |
|
| 1387 |
public static function media_button_wizard() |
| 1388 |
{ |
| 1389 |
$curr_user = wp_get_current_user(); |
| 1390 |
if ( |
| 1391 |
$curr_user->ID // logged in |
| 1392 |
&& isset(self::$alloptions[self::$opt_restrict_wizard]) && self::$alloptions[self::$opt_restrict_wizard] == 1 // restricting |
| 1393 |
&& is_array(self::$alloptions[self::$opt_restrict_wizard_roles]) && !self::user_in_roles_any($curr_user, self::$alloptions[self::$opt_restrict_wizard_roles]) |
| 1394 |
) |
| 1395 |
{ |
| 1396 |
return; |
| 1397 |
} |
| 1398 |
|
| 1399 |
add_thickbox(); |
| 1400 |
|
| 1401 |
$wizhref = admin_url('admin.php?page=youtube-ep-wizard') . |
| 1402 |
'&random=' . rand(1, 1000) . |
| 1403 |
'&TB_iframe=true&width=950&height=800'; |
| 1404 |
?> |
| 1405 |
<a href="<?php echo $wizhref; ?>" class="thickbox button ytprefs_media_link" id="ytprefs_wiz_button" title="Visual YouTube Search Tool and Wizard - For easier embedding"><span></span> YouTube</a> |
| 1406 |
<?php |
| 1407 |
} |
| 1408 |
|
| 1409 |
public static function check_double_plugin_warning() |
| 1410 |
{ |
| 1411 |
if (is_plugin_active('embedplus-for-wordpress/embedplus.php')) |
| 1412 |
{ |
| 1413 |
add_action('admin_notices', array(get_class(), "double_plugin_warning")); |
| 1414 |
} |
| 1415 |
} |
| 1416 |
|
| 1417 |
public static function double_plugin_warning() |
| 1418 |
{ |
| 1419 |
global $pagenow; |
| 1420 |
$user_id = get_current_user_id(); |
| 1421 |
if ($pagenow != 'plugins.php' || get_user_meta($user_id, 'embedplus_double_plugin_warning', true) != 1) |
| 1422 |
{ |
| 1423 |
//echo '<div class="error">' . $_SERVER['QUERY_STRING'] .'</div>'; |
| 1424 |
if ($pagenow == 'plugins.php' || strpos($_SERVER['QUERY_STRING'], 'youtube-my-preferences') !== false || |
| 1425 |
strpos($_SERVER['QUERY_STRING'], 'embedplus-video-analytics-dashboard') !== false || |
| 1426 |
strpos($_SERVER['QUERY_STRING'], 'youtube-ep-analytics-dashboard') !== false || |
| 1427 |
strpos($_SERVER['QUERY_STRING'], 'embedplus-official-options') !== false) |
| 1428 |
{ |
| 1429 |
?> |
| 1430 |
<style type="text/css"> |
| 1431 |
.embedpluswarning img |
| 1432 |
{ |
| 1433 |
vertical-align: text-bottom; |
| 1434 |
} |
| 1435 |
div.bgyellow {background-color: #FCFC94; position: relative;} |
| 1436 |
a.epxout, a.epxout:hover {font-weight: bold; color: #ffffff; background-color: #ff8888; text-decoration: none; |
| 1437 |
border-radius: 20px; font-size: 15px; position: absolute; top: 3px; right: 3px; |
| 1438 |
line-height: 20px; text-align: center; width: 20px; height: 20px; display: block; cursor: pointer;} |
| 1439 |
</style> |
| 1440 |
<div class="error bgyellow embedpluswarningbox"> |
| 1441 |
<p class="embedpluswarning"> |
| 1442 |
<?php |
| 1443 |
if ($pagenow == 'plugins.php') |
| 1444 |
{ |
| 1445 |
echo '<a class="epxout">×</a>'; |
| 1446 |
} |
| 1447 |
?> |
| 1448 |
Seems like you have two different YouTube plugins by the EmbedPlus Team installed: <b><img alt="YouTube Icon" src="<?php echo plugins_url('images/youtubeicon16.png', __FILE__) ?>" /> YouTube</b> and <b><img alt="YouTube Icon" src="<?php echo plugins_url('images/btn_embedpluswiz.png', __FILE__) ?>" /> Advanced YouTube Embed.</b> We strongly suggest keeping only the one you prefer, so that they don't conflict with each other while trying to create your embeds.</p> |
| 1449 |
</div> |
| 1450 |
<iframe allowTransparency="true" src="<?php echo self::$epbase . '/both-plugins-conflict.aspx' ?>" style="width:2px; height: 2px;" ></iframe> |
| 1451 |
<script type="text/javascript"> |
| 1452 |
(function ($) { |
| 1453 |
$(document).ready(function () { |
| 1454 |
$('.epxout').click(function () { |
| 1455 |
$.ajax({ |
| 1456 |
type: "post", |
| 1457 |
dataType: "json", |
| 1458 |
timeout: 30000, |
| 1459 |
url: window._EPYTA_.wpajaxurl, |
| 1460 |
data: {action: 'my_embedplus_dismiss_double_plugin_warning'}, |
| 1461 |
success: function (response) { |
| 1462 |
if (response.type === "success") { |
| 1463 |
$(".embedpluswarningbox").hide(); |
| 1464 |
} |
| 1465 |
}, |
| 1466 |
error: function (xhr, ajaxOptions, thrownError) { |
| 1467 |
}, |
| 1468 |
complete: function () { |
| 1469 |
} |
| 1470 |
}); |
| 1471 |
}); |
| 1472 |
}); |
| 1473 |
})(jQuery);</script> |
| 1474 |
<?php |
| 1475 |
} |
| 1476 |
} |
| 1477 |
} |
| 1478 |
|
| 1479 |
public static function my_embedplus_dismiss_double_plugin_warning() |
| 1480 |
{ |
| 1481 |
$result = array(); |
| 1482 |
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') |
| 1483 |
{ |
| 1484 |
$user_id = get_current_user_id(); |
| 1485 |
update_user_meta($user_id, 'embedplus_double_plugin_warning', 1); |
| 1486 |
$result['type'] = 'success'; |
| 1487 |
echo json_encode($result); |
| 1488 |
} |
| 1489 |
else |
| 1490 |
{ |
| 1491 |
$result['type'] = 'error'; |
| 1492 |
header("Location: " . $_SERVER["HTTP_REFERER"]); |
| 1493 |
} |
| 1494 |
die(); |
| 1495 |
} |
| 1496 |
|
| 1497 |
public static function jsvars() |
| 1498 |
{ |
| 1499 |
$loggedin = current_user_can('edit_posts'); |
| 1500 |
if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts])) |
| 1501 |
{ |
| 1502 |
?> |
| 1503 |
<script data-cfasync="false"> |
| 1504 |
window._EPYT_ = window._EPYT_ || { |
| 1505 |
ajaxurl: "<?php echo admin_url('admin-ajax.php'); ?>", |
| 1506 |
security: "<?php echo wp_create_nonce('embedplus-nonce'); ?>", |
| 1507 |
gallery_scrolloffset: <?php echo intval(self::$alloptions[self::$opt_gallery_scrolloffset]) ?>, |
| 1508 |
eppathtoscripts: "<?php echo plugins_url('scripts/', __FILE__); ?>", |
| 1509 |
epresponsiveselector: <?php echo self::get_responsiveselector(); ?>, |
| 1510 |
version: "<?php echo self::$alloptions[self::$opt_version] ?>", |
| 1511 |
epdovol: true, |
| 1512 |
evselector: '<?php echo self::get_evselector(); ?>', |
| 1513 |
ajax_compat: <?php echo self::$alloptions[self::$opt_ajax_compat] == '1' ? 'true' : 'false' ?>, |
| 1514 |
stopMobileBuffer: <?php echo self::$alloptions[self::$opt_stop_mobile_buffer] == '1' ? 'true' : 'false' ?> |
| 1515 |
};</script> |
| 1516 |
<?php |
| 1517 |
} |
| 1518 |
} |
| 1519 |
|
| 1520 |
public static function fitvids() |
| 1521 |
{ |
| 1522 |
$loggedin = current_user_can('edit_posts'); |
| 1523 |
if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts])) |
| 1524 |
{ |
| 1525 |
wp_enqueue_script('__ytprefsfitvids__', plugins_url('scripts/fitvids' . self::$min . '.js', __FILE__), array('__ytprefs__'), false, true); |
| 1526 |
} |
| 1527 |
} |
| 1528 |
|
| 1529 |
public static function initoptions() |
| 1530 |
{ |
| 1531 |
$arroptions = get_option(self::$opt_alloptions); |
| 1532 |
if ($arroptions !== false) |
| 1533 |
{ |
| 1534 |
$bak = str_replace('.', '_', $arroptions[self::$opt_version]); |
| 1535 |
add_option(self::$opt_alloptions . '_backup_' . $bak, $arroptions); |
| 1536 |
} |
| 1537 |
|
| 1538 |
// backup settings for migration |
| 1539 |
if (isset($arroptions[self::$opt_pro]) && strlen(trim($arroptions[self::$opt_pro])) > 10) |
| 1540 |
{ |
| 1541 |
add_option(self::$opt_alloptions . '_migrate', $arroptions); |
| 1542 |
} |
| 1543 |
|
| 1544 |
//vanilla defaults |
| 1545 |
$_center = 0; |
| 1546 |
$_glance = 1; |
| 1547 |
$_autoplay = get_option('youtubeprefs_autoplay', 0); |
| 1548 |
$_cc_load_policy = get_option('youtubeprefs_cc_load_policy', 0); |
| 1549 |
$_iv_load_policy = get_option('youtubeprefs_iv_load_policy', 1); |
| 1550 |
$_loop = get_option('youtubeprefs_loop', 0); |
| 1551 |
$_modestbranding = get_option('youtubeprefs_modestbranding', 0); |
| 1552 |
$_rel = get_option('youtubeprefs_rel', 1); |
| 1553 |
$_showinfo = get_option('youtubeprefs_showinfo', 1); |
| 1554 |
$_theme = get_option('youtubeprefs_theme', 'dark'); |
| 1555 |
$_color = get_option('youtubeprefs_color', 'red'); |
| 1556 |
$_autohide = 2; |
| 1557 |
$_pro = ''; |
| 1558 |
$_nocookie = 0; |
| 1559 |
$_playlistorder = 0; |
| 1560 |
$_acctitle = 0; |
| 1561 |
$_migrate = 0; |
| 1562 |
$_migrate_youtube = 0; |
| 1563 |
$_migrate_embedplusvideo = 0; |
| 1564 |
$_controls = 2; |
| 1565 |
$_oldspacing = 1; |
| 1566 |
$_responsive = 0; |
| 1567 |
$_responsive_all = 1; |
| 1568 |
$_widgetfit = 1; |
| 1569 |
$_evselector_light = 0; |
| 1570 |
$_stop_mobile_buffer = 1; |
| 1571 |
$_restrict_wizard = 0; |
| 1572 |
$_restrict_wizard_roles = self::$dft_roles; |
| 1573 |
$_ajax_compat = 0; |
| 1574 |
$_defaultdims = 0; |
| 1575 |
$_defaultwidth = ''; |
| 1576 |
$_defaultheight = ''; |
| 1577 |
$_playsinline = 0; |
| 1578 |
$_origin = 0; |
| 1579 |
$_defaultvol = 0; |
| 1580 |
$_vol = ''; |
| 1581 |
$_apikey = ''; |
| 1582 |
$_hl = ''; |
| 1583 |
$_dohl = 0; |
| 1584 |
$_gallery_columns = 3; |
| 1585 |
$_gallery_collapse_grid = 0; |
| 1586 |
$_gallery_collapse_grid_breaks = self::$dft_bpts; |
| 1587 |
$_gallery_scrolloffset = 20; |
| 1588 |
$_gallery_showtitle = 1; |
| 1589 |
$_gallery_showpaging = 1; |
| 1590 |
$_gallery_autonext = 0; |
| 1591 |
$_gallery_thumbplay = 1; |
| 1592 |
$_gallery_channelsub = 0; |
| 1593 |
$_gallery_channelsublink = ''; |
| 1594 |
$_gallery_channelsubtext = 'Subscribe to my channel'; |
| 1595 |
$_gallery_customarrows = 0; |
| 1596 |
$_gallery_customprev = 'Prev'; |
| 1597 |
$_gallery_customnext = 'Next'; |
| 1598 |
$_gallery_pagesize = 15; |
| 1599 |
$_not_live_content = ''; |
| 1600 |
$_debugmode = 0; |
| 1601 |
$_admin_off_scripts = 0; |
| 1602 |
$_old_script_method = 0; |
| 1603 |
|
| 1604 |
//update vanilla to previous settings if exists |
| 1605 |
if ($arroptions !== false) |
| 1606 |
{ |
| 1607 |
$_center = self::tryget($arroptions, self::$opt_center, 0); |
| 1608 |
$_glance = self::tryget($arroptions, self::$opt_glance, 1); |
| 1609 |
$_autoplay = self::tryget($arroptions, self::$opt_autoplay, 0); |
| 1610 |
$_cc_load_policy = self::tryget($arroptions, self::$opt_cc_load_policy, 0); |
| 1611 |
$_iv_load_policy = self::tryget($arroptions, self::$opt_iv_load_policy, 1); |
| 1612 |
$_loop = self::tryget($arroptions, self::$opt_loop, 0); |
| 1613 |
$_modestbranding = self::tryget($arroptions, self::$opt_modestbranding, 0); |
| 1614 |
$_rel = self::tryget($arroptions, self::$opt_rel, 1); |
| 1615 |
$_showinfo = self::tryget($arroptions, self::$opt_showinfo, 1); |
| 1616 |
$_theme = self::tryget($arroptions, self::$opt_theme, 'dark'); |
| 1617 |
$_color = self::tryget($arroptions, self::$opt_color, 'red'); |
| 1618 |
$_autohide = self::tryget($arroptions, self::$opt_autohide, 2); |
| 1619 |
$_pro = self::tryget($arroptions, self::$opt_pro, ''); |
| 1620 |
$_nocookie = self::tryget($arroptions, self::$opt_nocookie, 0); |
| 1621 |
$_playlistorder = self::tryget($arroptions, self::$opt_playlistorder, 0); |
| 1622 |
$_acctitle = self::tryget($arroptions, self::$opt_acctitle, 0); |
| 1623 |
$_migrate = self::tryget($arroptions, self::$opt_migrate, 0); |
| 1624 |
$_migrate_youtube = self::tryget($arroptions, self::$opt_migrate_youtube, 0); |
| 1625 |
$_migrate_embedplusvideo = self::tryget($arroptions, self::$opt_migrate_embedplusvideo, 0); |
| 1626 |
$_controls = self::tryget($arroptions, self::$opt_controls, 2); |
| 1627 |
$_oldspacing = self::tryget($arroptions, self::$opt_oldspacing, 1); |
| 1628 |
$_responsive = self::tryget($arroptions, self::$opt_responsive, 0); |
| 1629 |
$_responsive_all = self::tryget($arroptions, self::$opt_responsive_all, 1); |
| 1630 |
$_widgetfit = self::tryget($arroptions, self::$opt_widgetfit, 1); |
| 1631 |
$_evselector_light = self::tryget($arroptions, self::$opt_evselector_light, 0); |
| 1632 |
$_stop_mobile_buffer = self::tryget($arroptions, self::$opt_stop_mobile_buffer, 1); |
| 1633 |
$_restrict_wizard = self::tryget($arroptions, self::$opt_restrict_wizard, 0); |
| 1634 |
$_restrict_wizard_roles = self::tryget($arroptions, self::$opt_restrict_wizard_roles, self::$dft_roles); |
| 1635 |
$_ajax_compat = self::tryget($arroptions, self::$opt_ajax_compat, 0); |
| 1636 |
$_defaultdims = self::tryget($arroptions, self::$opt_defaultdims, 0); |
| 1637 |
$_defaultwidth = self::tryget($arroptions, self::$opt_defaultwidth, ''); |
| 1638 |
$_defaultheight = self::tryget($arroptions, self::$opt_defaultheight, ''); |
| 1639 |
$_playsinline = self::tryget($arroptions, self::$opt_playsinline, 0); |
| 1640 |
$_origin = self::tryget($arroptions, self::$opt_origin, 0); |
| 1641 |
$_defaultvol = self::tryget($arroptions, self::$opt_defaultvol, 0); |
| 1642 |
$_vol = self::tryget($arroptions, self::$opt_vol, ''); |
| 1643 |
$_apikey = self::tryget($arroptions, self::$opt_apikey, ''); |
| 1644 |
$_hl = self::tryget($arroptions, self::$opt_hl, ''); |
| 1645 |
$_dohl = self::tryget($arroptions, self::$opt_dohl, 0); |
| 1646 |
$_gallery_pagesize = self::tryget($arroptions, self::$opt_gallery_pagesize, 15); |
| 1647 |
$_gallery_columns = self::tryget($arroptions, self::$opt_gallery_columns, 3); |
| 1648 |
$_gallery_collapse_grid = self::tryget($arroptions, self::$opt_gallery_collapse_grid, 0); |
| 1649 |
$_gallery_collapse_grid_breaks = self::tryget($arroptions, self::$opt_gallery_collapse_grid_breaks, self::$dft_bpts); |
| 1650 |
$_gallery_scrolloffset = self::tryget($arroptions, self::$opt_gallery_scrolloffset, 20); |
| 1651 |
$_gallery_showtitle = self::tryget($arroptions, self::$opt_gallery_showtitle, 1); |
| 1652 |
$_gallery_showpaging = self::tryget($arroptions, self::$opt_gallery_showpaging, 1); |
| 1653 |
$_gallery_autonext = self::tryget($arroptions, self::$opt_gallery_autonext, 0); |
| 1654 |
$_gallery_thumbplay = self::tryget($arroptions, self::$opt_gallery_thumbplay, 1); |
| 1655 |
$_gallery_channelsub = self::tryget($arroptions, self::$opt_gallery_channelsub, $_gallery_channelsub); |
| 1656 |
$_gallery_channelsublink = self::tryget($arroptions, self::$opt_gallery_channelsublink, $_gallery_channelsublink); |
| 1657 |
$_gallery_channelsubtext = self::tryget($arroptions, self::$opt_gallery_channelsubtext, $_gallery_channelsubtext); |
| 1658 |
$_gallery_customarrows = self::tryget($arroptions, self::$opt_gallery_customarrows, $_gallery_customarrows); |
| 1659 |
$_gallery_customnext = self::tryget($arroptions, self::$opt_gallery_customnext, $_gallery_customnext); |
| 1660 |
$_gallery_customprev = self::tryget($arroptions, self::$opt_gallery_customprev, $_gallery_customprev); |
| 1661 |
$_not_live_content = self::tryget($arroptions, self::$opt_not_live_content, $_not_live_content); |
| 1662 |
$_debugmode = self::tryget($arroptions, self::$opt_debugmode, 0); |
| 1663 |
$_admin_off_scripts = self::tryget($arroptions, self::$opt_admin_off_scripts, $_admin_off_scripts); |
| 1664 |
$_old_script_method = self::tryget($arroptions, self::$opt_old_script_method, 0); |
| 1665 |
} |
| 1666 |
else |
| 1667 |
{ |
| 1668 |
$_oldspacing = 0; |
| 1669 |
} |
| 1670 |
|
| 1671 |
$all = array( |
| 1672 |
self::$opt_version => self::$version, |
| 1673 |
self::$opt_center => $_center, |
| 1674 |
self::$opt_glance => $_glance, |
| 1675 |
self::$opt_autoplay => $_autoplay, |
| 1676 |
self::$opt_cc_load_policy => $_cc_load_policy, |
| 1677 |
self::$opt_iv_load_policy => $_iv_load_policy, |
| 1678 |
self::$opt_loop => $_loop, |
| 1679 |
self::$opt_modestbranding => $_modestbranding, |
| 1680 |
self::$opt_rel => $_rel, |
| 1681 |
self::$opt_showinfo => $_showinfo, |
| 1682 |
self::$opt_theme => $_theme, |
| 1683 |
self::$opt_color => $_color, |
| 1684 |
self::$opt_autohide => $_autohide, |
| 1685 |
self::$opt_pro => $_pro, |
| 1686 |
self::$opt_nocookie => $_nocookie, |
| 1687 |
self::$opt_playlistorder => $_playlistorder, |
| 1688 |
self::$opt_acctitle => $_acctitle, |
| 1689 |
self::$opt_migrate => $_migrate, |
| 1690 |
self::$opt_migrate_youtube => $_migrate_youtube, |
| 1691 |
self::$opt_migrate_embedplusvideo => $_migrate_embedplusvideo, |
| 1692 |
self::$opt_controls => $_controls, |
| 1693 |
self::$opt_oldspacing => $_oldspacing, |
| 1694 |
self::$opt_responsive => $_responsive, |
| 1695 |
self::$opt_responsive_all => $_responsive_all, |
| 1696 |
self::$opt_widgetfit => $_widgetfit, |
| 1697 |
self::$opt_evselector_light => $_evselector_light, |
| 1698 |
self::$opt_stop_mobile_buffer => $_stop_mobile_buffer, |
| 1699 |
self::$opt_restrict_wizard => $_restrict_wizard, |
| 1700 |
self::$opt_restrict_wizard_roles => $_restrict_wizard_roles, |
| 1701 |
self::$opt_ajax_compat => $_ajax_compat, |
| 1702 |
self::$opt_defaultdims => $_defaultdims, |
| 1703 |
self::$opt_defaultwidth => $_defaultwidth, |
| 1704 |
self::$opt_defaultheight => $_defaultheight, |
| 1705 |
self::$opt_playsinline => $_playsinline, |
| 1706 |
self::$opt_origin => $_origin, |
| 1707 |
self::$opt_defaultvol => $_defaultvol, |
| 1708 |
self::$opt_vol => $_vol, |
| 1709 |
self::$opt_apikey => $_apikey, |
| 1710 |
self::$opt_hl => $_hl, |
| 1711 |
self::$opt_dohl => $_dohl, |
| 1712 |
self::$opt_gallery_columns => $_gallery_columns, |
| 1713 |
self::$opt_gallery_collapse_grid => $_gallery_collapse_grid, |
| 1714 |
self::$opt_gallery_collapse_grid_breaks => $_gallery_collapse_grid_breaks, |
| 1715 |
self::$opt_gallery_scrolloffset => $_gallery_scrolloffset, |
| 1716 |
self::$opt_gallery_showtitle => $_gallery_showtitle, |
| 1717 |
self::$opt_gallery_showpaging => $_gallery_showpaging, |
| 1718 |
self::$opt_gallery_autonext => $_gallery_autonext, |
| 1719 |
self::$opt_gallery_thumbplay => $_gallery_thumbplay, |
| 1720 |
self::$opt_gallery_channelsub => $_gallery_channelsub, |
| 1721 |
self::$opt_gallery_channelsublink => $_gallery_channelsublink, |
| 1722 |
self::$opt_gallery_channelsubtext => $_gallery_channelsubtext, |
| 1723 |
self::$opt_gallery_customarrows => $_gallery_customarrows, |
| 1724 |
self::$opt_gallery_customprev => $_gallery_customprev, |
| 1725 |
self::$opt_gallery_customnext => $_gallery_customnext, |
| 1726 |
self::$opt_gallery_pagesize => $_gallery_pagesize, |
| 1727 |
self::$opt_not_live_content => $_not_live_content, |
| 1728 |
self::$opt_debugmode => $_debugmode, |
| 1729 |
self::$opt_admin_off_scripts => $_admin_off_scripts, |
| 1730 |
self::$opt_old_script_method => $_old_script_method |
| 1731 |
); |
| 1732 |
|
| 1733 |
update_option(self::$opt_alloptions, $all); |
| 1734 |
update_option('embed_autourls', 1); |
| 1735 |
self::$alloptions = get_option(self::$opt_alloptions); |
| 1736 |
} |
| 1737 |
|
| 1738 |
public static function tryget($array, $key, $default = null) |
| 1739 |
{ |
| 1740 |
return isset($array[$key]) ? $array[$key] : $default; |
| 1741 |
} |
| 1742 |
|
| 1743 |
public static function wp_above_version($ver) |
| 1744 |
{ |
| 1745 |
global $wp_version; |
| 1746 |
if (version_compare($wp_version, $ver, '>=')) |
| 1747 |
{ |
| 1748 |
return true; |
| 1749 |
} |
| 1750 |
return false; |
| 1751 |
} |
| 1752 |
|
| 1753 |
public static function do_ytprefs() |
| 1754 |
{ |
| 1755 |
//add_filter('autoptimize_filter_js_exclude', array(get_class(), 'ao_override_jsexclude'), 10, 1); |
| 1756 |
if (!is_admin()) |
| 1757 |
{ |
| 1758 |
add_filter('the_content', array(get_class(), 'apply_prefs_content'), 1); |
| 1759 |
add_filter('widget_text', array(get_class(), 'apply_prefs_widget'), 1); |
| 1760 |
//add_filter('bjll/skip_classes', array(get_class(), 'bjll_skip_classes'), 10, 2); |
| 1761 |
|
| 1762 |
add_shortcode('embedyt', array(get_class(), 'apply_prefs_shortcode')); |
| 1763 |
if (self::$alloptions[self::$opt_migrate] == 1) |
| 1764 |
{ |
| 1765 |
if (self::$alloptions[self::$opt_migrate_youtube] == 1) |
| 1766 |
{ |
| 1767 |
add_shortcode('youtube', array(get_class(), 'apply_prefs_shortcode_youtube')); |
| 1768 |
add_shortcode('youtube_video', array(get_class(), 'apply_prefs_shortcode_youtube')); |
| 1769 |
} |
| 1770 |
if (self::$alloptions[self::$opt_migrate_embedplusvideo] == 1) |
| 1771 |
{ |
| 1772 |
add_shortcode('embedplusvideo', array(get_class(), 'apply_prefs_shortcode_embedplusvideo')); |
| 1773 |
} |
| 1774 |
} |
| 1775 |
} |
| 1776 |
} |
| 1777 |
|
| 1778 |
public static function ao_override_jsexclude($exclude) |
| 1779 |
{ |
| 1780 |
if (strpos($exclude, 'ytprefs' . self::$min . '.js') === false) |
| 1781 |
{ |
| 1782 |
return $exclude . ',ytprefs' . self::$min . '.js,__ytprefs__'; |
| 1783 |
} |
| 1784 |
return $exclude; |
| 1785 |
} |
| 1786 |
|
| 1787 |
public static function apply_prefs_shortcode($atts, $content = null) |
| 1788 |
{ |
| 1789 |
$content = trim($content); |
| 1790 |
$currfilter = current_filter(); |
| 1791 |
if (preg_match(self::$justurlregex, $content)) |
| 1792 |
{ |
| 1793 |
return self::get_html(array($content), $currfilter == 'widget_text' ? false : true); |
| 1794 |
} |
| 1795 |
return ''; |
| 1796 |
} |
| 1797 |
|
| 1798 |
public static function apply_prefs_shortcode_youtube($atts, $content = null) |
| 1799 |
{ |
| 1800 |
$content = 'https://www.youtube.com/watch?v=' . trim($content); |
| 1801 |
$currfilter = current_filter(); |
| 1802 |
if (preg_match(self::$justurlregex, $content)) |
| 1803 |
{ |
| 1804 |
return self::get_html(array($content), $currfilter == 'widget_text' ? false : true); |
| 1805 |
} |
| 1806 |
return ''; |
| 1807 |
} |
| 1808 |
|
| 1809 |
public static function apply_prefs_shortcode_embedplusvideo($atts, $content = null) |
| 1810 |
{ |
| 1811 |
$atts = shortcode_atts(array( |
| 1812 |
"height" => self::$defaultheight, |
| 1813 |
"width" => self::$defaultwidth, |
| 1814 |
"vars" => "", |
| 1815 |
"standard" => "", |
| 1816 |
"id" => "ep" . rand(10000, 99999) |
| 1817 |
), $atts); |
| 1818 |
|
| 1819 |
$epvars = $atts['vars']; |
| 1820 |
$epvars = preg_replace('/\s/', '', $epvars); |
| 1821 |
$epvars = preg_replace('/¬/', '¬', $epvars); |
| 1822 |
$epvars = str_replace('&', '&', $epvars); |
| 1823 |
|
| 1824 |
$epparams = self::keyvalue($epvars, true); |
| 1825 |
|
| 1826 |
if (isset($epparams) && isset($epparams['ytid'])) |
| 1827 |
{ |
| 1828 |
$start = isset($epparams['start']) && is_numeric($epparams['start']) ? '&start=' . intval($epparams['start']) : ''; |
| 1829 |
$end = isset($epparams['end']) && is_numeric($epparams['end']) ? '&end=' . intval($epparams['end']) : ''; |
| 1830 |
$end = isset($epparams['stop']) && is_numeric($epparams['stop']) ? '&end=' . intval($epparams['stop']) : ''; |
| 1831 |
|
| 1832 |
$url = 'https://www.youtube.com/watch?v=' . trim($epparams['ytid']) . $start . $end; |
| 1833 |
|
| 1834 |
$currfilter = current_filter(); |
| 1835 |
if (preg_match(self::$justurlregex, $url)) |
| 1836 |
{ |
| 1837 |
return self::get_html(array($url), $currfilter == 'widget_text' ? false : true); |
| 1838 |
} |
| 1839 |
} |
| 1840 |
return ''; |
| 1841 |
} |
| 1842 |
|
| 1843 |
public static function apply_prefs_content($content) |
| 1844 |
{ |
| 1845 |
$content = preg_replace_callback(self::$ytregex, array(get_class(), "get_html_content"), $content); |
| 1846 |
return $content; |
| 1847 |
} |
| 1848 |
|
| 1849 |
public static function apply_prefs_widget($content) |
| 1850 |
{ |
| 1851 |
$content = preg_replace_callback(self::$ytregex, array(get_class(), "get_html_widget"), $content); |
| 1852 |
return $content; |
| 1853 |
} |
| 1854 |
|
| 1855 |
public static function get_html_content($m) |
| 1856 |
{ |
| 1857 |
return self::get_html($m, true); |
| 1858 |
} |
| 1859 |
|
| 1860 |
public static function get_html_widget($m) |
| 1861 |
{ |
| 1862 |
return self::get_html($m, false); |
| 1863 |
} |
| 1864 |
|
| 1865 |
public static function get_gallery_page($options) |
| 1866 |
{ |
| 1867 |
$gallobj = new stdClass(); |
| 1868 |
|
| 1869 |
$options->pageSize = min(intval($options->pageSize), 50); |
| 1870 |
$options->columns = intval($options->columns); |
| 1871 |
$options->showTitle = intval($options->showTitle); |
| 1872 |
$options->showPaging = intval($options->showPaging); |
| 1873 |
$options->autonext = intval($options->autonext); |
| 1874 |
$options->thumbplay = intval($options->thumbplay); |
| 1875 |
|
| 1876 |
if (empty($options->apiKey)) |
| 1877 |
{ |
| 1878 |
$gallobj->html = '<div>Please enter your YouTube API key to embed galleries.</div>'; |
| 1879 |
return $gallobj; |
| 1880 |
} |
| 1881 |
|
| 1882 |
$apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status&playlistId=' . $options->playlistId |
| 1883 |
. '&maxResults=' . $options->pageSize |
| 1884 |
. '&key=' . $options->apiKey; |
| 1885 |
if ($options->pageToken != null) |
| 1886 |
{ |
| 1887 |
$apiEndpoint .= '&pageToken=' . $options->pageToken; |
| 1888 |
} |
| 1889 |
|
| 1890 |
$code = ''; |
| 1891 |
$init_id = null; |
| 1892 |
|
| 1893 |
$apiResult = wp_remote_get($apiEndpoint, array('timeout' => self::$curltimeout)); |
| 1894 |
|
| 1895 |
if (is_wp_error($apiResult)) |
| 1896 |
{ |
| 1897 |
$gallobj->html = '<div>Sorry, there was a YouTube API error: <em>' . htmlspecialchars(strip_tags($apiResult->get_error_message())) . '</em>' . |
| 1898 |
' Please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.' . |
| 1899 |
'</div>'; |
| 1900 |
return $gallobj; |
| 1901 |
} |
| 1902 |
|
| 1903 |
if (self::$alloptions[self::$opt_debugmode] == 1 && current_user_can('manage_options')) |
| 1904 |
{ |
| 1905 |
$redactedEndpoint = preg_replace('@&key=[^&]+@i', '&key=PRIVATE', $apiEndpoint); |
| 1906 |
$active_plugins = get_option('active_plugins'); |
| 1907 |
$gallobj->html = '<pre onclick="_EPADashboard_.selectText(this);" class="epyt-debug">CLICK this debug text to auto-select all. Then, COPY the selection.' . "\n\n" . |
| 1908 |
'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) . '</pre>'; |
| 1909 |
return $gallobj; |
| 1910 |
} |
| 1911 |
|
| 1912 |
$jsonResult = json_decode($apiResult['body']); |
| 1913 |
|
| 1914 |
if (isset($jsonResult->error)) |
| 1915 |
{ |
| 1916 |
if (isset($jsonResult->error->message)) |
| 1917 |
{ |
| 1918 |
$gallobj->html = '<div>Sorry, there was a YouTube API error: <em>' . htmlspecialchars(strip_tags($jsonResult->error->message)) . '</em>' . |
| 1919 |
' Please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.' . |
| 1920 |
'</div>'; |
| 1921 |
return $gallobj; |
| 1922 |
} |
| 1923 |
$gallobj->html = '<div>Sorry, there may be an issue with your YouTube API key. Please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.</div>'; |
| 1924 |
return $gallobj; |
| 1925 |
} |
| 1926 |
|
| 1927 |
|
| 1928 |
|
| 1929 |
$resultsPerPage = $options->pageSize; // $jsonResult->pageInfo->resultsPerPage; |
| 1930 |
$totalResults = $jsonResult->pageInfo->totalResults; |
| 1931 |
|
| 1932 |
$nextPageToken = ''; |
| 1933 |
$prevPageToken = ''; |
| 1934 |
if (isset($jsonResult->nextPageToken)) |
| 1935 |
{ |
| 1936 |
$nextPageToken = $jsonResult->nextPageToken; |
| 1937 |
} |
| 1938 |
|
| 1939 |
if (isset($jsonResult->prevPageToken)) |
| 1940 |
{ |
| 1941 |
$prevPageToken = $jsonResult->prevPageToken; |
| 1942 |
} |
| 1943 |
|
| 1944 |
$cnt = 0; |
| 1945 |
$colclass = ' epyt-cols-' . $options->columns . ' '; |
| 1946 |
$code .= '<div class="epyt-gallery-allthumbs ' . $colclass . '">'; |
| 1947 |
|
| 1948 |
if (isset($jsonResult->items) && $jsonResult->items != null && is_array($jsonResult->items)) |
| 1949 |
{ |
| 1950 |
// sort items |
| 1951 |
usort($jsonResult->items, array(get_class(), 'compare_vid_date')); // sorts in place |
| 1952 |
|
| 1953 |
foreach ($jsonResult->items as $item) |
| 1954 |
{ |
| 1955 |
|
| 1956 |
$thumb = new stdClass(); |
| 1957 |
|
| 1958 |
$thumb->id = isset($item->snippet->resourceId->videoId) ? $item->snippet->resourceId->videoId : null; |
| 1959 |
$thumb->id = $thumb->id ? $thumb->id : $item->id->videoId; |
| 1960 |
$thumb->title = $options->showTitle ? $item->snippet->title : ''; |
| 1961 |
$thumb->privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null; |
| 1962 |
|
| 1963 |
if ($cnt == 0 && $options->pageToken == null) |
| 1964 |
{ |
| 1965 |
$init_id = $thumb->id; |
| 1966 |
} |
| 1967 |
|
| 1968 |
if ($thumb->privacyStatus == 'private') |
| 1969 |
{ |
| 1970 |
$thumb->img = plugins_url('/images/private.png', __FILE__); |
| 1971 |
$thumb->quality = 'medium'; |
| 1972 |
} |
| 1973 |
else |
| 1974 |
{ |
| 1975 |
if (isset($item->snippet->thumbnails->high->url)) |
| 1976 |
{ |
| 1977 |
$thumb->img = $item->snippet->thumbnails->high->url; |
| 1978 |
$thumb->quality = 'high'; |
| 1979 |
} |
| 1980 |
elseif (isset($item->snippet->thumbnails->default->url)) |
| 1981 |
{ |
| 1982 |
$thumb->img = $item->snippet->thumbnails->default->url; |
| 1983 |
$thumb->quality = 'default'; |
| 1984 |
} |
| 1985 |
elseif (isset($item->snippet->thumbnails->medium->url)) |
| 1986 |
{ |
| 1987 |
$thumb->img = $item->snippet->thumbnails->medium->url; |
| 1988 |
$thumb->quality = 'medium'; |
| 1989 |
} |
| 1990 |
else |
| 1991 |
{ |
| 1992 |
$thumb->img = plugins_url('/images/deleted-video-thumb.png', __FILE__); |
| 1993 |
$thumb->quality = 'medium'; |
| 1994 |
} |
| 1995 |
} |
| 1996 |
|
| 1997 |
$code .= self::get_thumbnail_html($thumb, $options); |
| 1998 |
$cnt++; |
| 1999 |
|
| 2000 |
if ($cnt % $options->columns === 0) |
| 2001 |
{ |
| 2002 |
$code .= '<div class="epyt-gallery-rowbreak"></div>'; |
| 2003 |
} |
| 2004 |
} |
| 2005 |
} |
| 2006 |
|
| 2007 |
$code .= '<div class="epyt-gallery-clear"></div></div>'; |
| 2008 |
|
| 2009 |
$totalPages = ceil($totalResults / $resultsPerPage); |
| 2010 |
$pagination = '<div class="epyt-pagination">'; |
| 2011 |
|
| 2012 |
$txtprev = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customprev] : _('Prev'); |
| 2013 |
$pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-prev ' . (empty($prevPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId) |
| 2014 |
. '" data-pagesize="' . intval($options->pageSize) |
| 2015 |
. '" data-pagetoken="' . esc_attr($prevPageToken) |
| 2016 |
. '" data-columns="' . intval($options->columns) |
| 2017 |
. '" data-showtitle="' . intval($options->showTitle) |
| 2018 |
. '" data-showpaging="' . intval($options->showPaging) |
| 2019 |
. '" data-autonext="' . intval($options->autonext) |
| 2020 |
. '" data-thumbplay="' . intval($options->thumbplay) |
| 2021 |
. '"><div class="arrow">«</div> <div>' . $txtprev . '</div></div>'; |
| 2022 |
|
| 2023 |
|
| 2024 |
$pagination .= '<div class="epyt-pagenumbers ' . ($totalPages > 1 ? '' : 'hide') . '">'; |
| 2025 |
$pagination .= '<div class="epyt-current">1</div><div class="epyt-pageseparator"> / </div><div class="epyt-totalpages">' . $totalPages . '</div>'; |
| 2026 |
$pagination .= '</div>'; |
| 2027 |
|
| 2028 |
$txtnext = self::$alloptions[self::$opt_gallery_customarrows] ? self::$alloptions[self::$opt_gallery_customnext] : _('Next'); |
| 2029 |
$pagination .= '<div tabindex="0" role="button" class="epyt-pagebutton epyt-next' . (empty($nextPageToken) ? ' hide ' : '') . '" data-playlistid="' . esc_attr($options->playlistId) |
| 2030 |
. '" data-pagesize="' . intval($options->pageSize) |
| 2031 |
. '" data-pagetoken="' . esc_attr($nextPageToken) |
| 2032 |
. '" data-columns="' . intval($options->columns) |
| 2033 |
. '" data-showtitle="' . intval($options->showTitle) |
| 2034 |
. '" data-showpaging="' . intval($options->showPaging) |
| 2035 |
. '" data-autonext="' . intval($options->autonext) |
| 2036 |
. '" data-thumbplay="' . intval($options->thumbplay) |
| 2037 |
. '"><div>' . $txtnext . '</div> <div class="arrow">»</div></div>'; |
| 2038 |
|
| 2039 |
$pagination .= '<div class="epyt-loader"><img alt="loading" width="16" height="11" src="' . plugins_url('images/gallery-page-loader.gif', __FILE__) . '"></div>'; |
| 2040 |
$pagination .= '</div>'; |
| 2041 |
|
| 2042 |
if ($options->showPaging == 0) |
| 2043 |
{ |
| 2044 |
$pagination = '<div class="epyt-pagination"></div>'; |
| 2045 |
} |
| 2046 |
$code = $pagination . $code . $pagination; |
| 2047 |
$gallobj->html = $code; |
| 2048 |
$gallobj->init_id = $init_id; |
| 2049 |
return $gallobj; |
| 2050 |
} |
| 2051 |
|
| 2052 |
public static function compare_vid_date($a, $b) |
| 2053 |
{ |
| 2054 |
if ($a->snippet->publishedAt == $b->snippet->publishedAt) |
| 2055 |
{ |
| 2056 |
return 0; |
| 2057 |
} |
| 2058 |
return ($a->snippet->publishedAt > $b->snippet->publishedAt) ? -1 : 1; |
| 2059 |
} |
| 2060 |
|
| 2061 |
public static function get_thumbnail_html($thumb, $options) |
| 2062 |
{ |
| 2063 |
$escId = esc_attr($thumb->id); |
| 2064 |
$code = ''; |
| 2065 |
$code .= '<div tabindex="0" role="button" data-videoid="' . $escId . '" class="epyt-gallery-thumb">'; |
| 2066 |
$code .= '<div class="epyt-gallery-img-box"><div class="epyt-gallery-img" style="background-image: url(' . esc_url($thumb->img) . ')">' . |
| 2067 |
'<div class="epyt-gallery-playhover"><img alt="play" class="epyt-play-img" width="30" height="23" src="' . plugins_url('images/playhover.png', __FILE__) . '" /><div class="epyt-gallery-playcrutch"></div></div>' . |
| 2068 |
'</div></div>'; |
| 2069 |
if (!empty($thumb->title)) |
| 2070 |
{ |
| 2071 |
$code .= '<div class="epyt-gallery-title">' . esc_html($thumb->title) . '</div>'; |
| 2072 |
} |
| 2073 |
else |
| 2074 |
{ |
| 2075 |
$code .= '<div class="epyt-gallery-notitle"><span>' . esc_html($thumb->title) . '</span></div>'; |
| 2076 |
} |
| 2077 |
$code .= '</div>'; |
| 2078 |
return $code; |
| 2079 |
} |
| 2080 |
|
| 2081 |
public static function my_embedplus_gallery_page() |
| 2082 |
{ |
| 2083 |
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') |
| 2084 |
{ |
| 2085 |
//check_ajax_referer('embedplus-nonce', 'security'); |
| 2086 |
$options = (object) $_POST['options']; |
| 2087 |
$options->apiKey = self::$alloptions[self::$opt_apikey]; |
| 2088 |
echo self::get_gallery_page($options)->html; |
| 2089 |
die(); |
| 2090 |
} |
| 2091 |
} |
| 2092 |
|
| 2093 |
public static function get_html($m, $iscontent) |
| 2094 |
{ |
| 2095 |
//$time_start = microtime(true); |
| 2096 |
|
| 2097 |
$link = trim(str_replace(self::$badentities, self::$goodliterals, $m[0])); |
| 2098 |
|
| 2099 |
$link = preg_replace('/\s/', '', $link); |
| 2100 |
$linkparamstemp = explode('?', $link); |
| 2101 |
|
| 2102 |
$linkparams = array(); |
| 2103 |
if (count($linkparamstemp) > 1) |
| 2104 |
{ |
| 2105 |
$linkparams = self::keyvalue($linkparamstemp[1], true); |
| 2106 |
} |
| 2107 |
if (strpos($linkparamstemp[0], 'youtu.be') !== false && !isset($linkparams['v'])) |
| 2108 |
{ |
| 2109 |
$vtemp = explode('/', $linkparamstemp[0]); |
| 2110 |
$linkparams['v'] = array_pop($vtemp); |
| 2111 |
} |
| 2112 |
|
| 2113 |
if (isset($linkparams['channel']) && isset($linkparams['live']) && $linkparams['live'] == '1') |
| 2114 |
{ |
| 2115 |
$live_error_msg = ' To embed live videos, please make sure you performed the <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">steps in this video</a> to create and save a proper server API key.'; |
| 2116 |
if (isset(self::$alloptions[self::$opt_apikey])) |
| 2117 |
{ |
| 2118 |
|
| 2119 |
try |
| 2120 |
{ |
| 2121 |
$ytapilink_live = 'https://www.googleapis.com/youtube/v3/search?order=date&maxResults=1&type=video&eventType=live&safeSearch=none&videoEmbeddable=true&channelId=' . $linkparams['channel'] . '&part=snippet&key=' . self::$alloptions[self::$opt_apikey]; |
| 2122 |
$apidata_live = wp_remote_get($ytapilink_live, array('timeout' => self::$curltimeout)); |
| 2123 |
if (!is_wp_error($apidata_live)) |
| 2124 |
{ |
| 2125 |
$raw = wp_remote_retrieve_body($apidata_live); |
| 2126 |
if (!empty($raw)) |
| 2127 |
{ |
| 2128 |
$json = json_decode($raw, true); |
| 2129 |
if (!isset($json['error']) && is_array($json) && count($json['items'])) |
| 2130 |
{ |
| 2131 |
$linkparams['v'] = $json['items'][0]['id']['videoId']; |
| 2132 |
} |
| 2133 |
else if (isset($json['error'])) |
| 2134 |
{ |
| 2135 |
return $live_error_msg; |
| 2136 |
} |
| 2137 |
} |
| 2138 |
} |
| 2139 |
} |
| 2140 |
catch (Exception $ex) |
| 2141 |
{ |
| 2142 |
return $live_error_msg; |
| 2143 |
} |
| 2144 |
} |
| 2145 |
else |
| 2146 |
{ |
| 2147 |
return $live_error_msg; |
| 2148 |
} |
| 2149 |
|
| 2150 |
if (!isset($linkparams['v'])) |
| 2151 |
{ |
| 2152 |
return apply_filters('the_content', trim(self::$alloptions[self::$opt_not_live_content])); |
| 2153 |
} |
| 2154 |
} |
| 2155 |
|
| 2156 |
$youtubebaseurl = 'youtube'; |
| 2157 |
$voloutput = ''; |
| 2158 |
$acctitle = ''; |
| 2159 |
|
| 2160 |
$finalparams = $linkparams + self::$alloptions; |
| 2161 |
|
| 2162 |
self::init_dimensions($link, $linkparams, $finalparams); |
| 2163 |
|
| 2164 |
if (self::$alloptions[self::$opt_nocookie] == 1) |
| 2165 |
{ |
| 2166 |
$youtubebaseurl = 'youtube-nocookie'; |
| 2167 |
} |
| 2168 |
|
| 2169 |
if (self::$alloptions[self::$opt_defaultvol] == 1) |
| 2170 |
{ |
| 2171 |
$voloutput = ' data-vol="' . self::$alloptions[self::$opt_vol] . '" '; |
| 2172 |
} |
| 2173 |
|
| 2174 |
if (self::$alloptions[self::$opt_dohl] == 1) |
| 2175 |
{ |
| 2176 |
$locale = get_locale(); |
| 2177 |
$finalparams[self::$opt_hl] = $locale; |
| 2178 |
} |
| 2179 |
else |
| 2180 |
{ |
| 2181 |
unset($finalparams[self::$opt_hl]); |
| 2182 |
} |
| 2183 |
|
| 2184 |
$centercode = ''; |
| 2185 |
if ($finalparams[self::$opt_center] == 1) |
| 2186 |
{ |
| 2187 |
$centercode = ' style="display: block; margin: 0px auto;" '; |
| 2188 |
} |
| 2189 |
|
| 2190 |
if (self::$alloptions[self::$opt_acctitle] == 1) |
| 2191 |
{ |
| 2192 |
try |
| 2193 |
{ |
| 2194 |
//attr escape |
| 2195 |
if (self::$oembeddata) |
| 2196 |
{ |
| 2197 |
$acctitle = self::$oembeddata->title; |
| 2198 |
} |
| 2199 |
else |
| 2200 |
{ |
| 2201 |
|
| 2202 |
if (isset($linkparams['list'])) |
| 2203 |
{ |
| 2204 |
$odata = self::get_oembed('https://youtube.com/playlist?list=' . $linkparams['list'], 1920, 1280); |
| 2205 |
if (is_object($odata) && isset($odata->title)) |
| 2206 |
{ |
| 2207 |
$acctitle = $odata->title; |
| 2208 |
} |
| 2209 |
} |
| 2210 |
else |
| 2211 |
{ |
| 2212 |
$odata = self::get_oembed('https://youtube.com/watch?v=' . $linkparams['v'], 1920, 1280); |
| 2213 |
if (is_object($odata) && isset($odata->title)) |
| 2214 |
{ |
| 2215 |
$acctitle = $odata->title; |
| 2216 |
} |
| 2217 |
} |
| 2218 |
} |
| 2219 |
|
| 2220 |
if ($acctitle) |
| 2221 |
{ |
| 2222 |
$acctitle = ' title="' . esc_attr($acctitle) . '" '; |
| 2223 |
} |
| 2224 |
} |
| 2225 |
catch (Exception $e) |
| 2226 |
{ |
| 2227 |
|
| 2228 |
} |
| 2229 |
} |
| 2230 |
|
| 2231 |
// playlist cleanup |
| 2232 |
$videoidoutput = isset($linkparams['v']) ? $linkparams['v'] : ''; |
| 2233 |
|
| 2234 |
if ((self::$alloptions[self::$opt_playlistorder] == 1 || isset($finalparams['plindex'])) && isset($finalparams['list'])) |
| 2235 |
{ |
| 2236 |
try |
| 2237 |
{ |
| 2238 |
$videoidoutput = ''; |
| 2239 |
if (isset($finalparams['plindex'])) |
| 2240 |
{ |
| 2241 |
$finalparams['index'] = intval($finalparams['plindex']); |
| 2242 |
} |
| 2243 |
} |
| 2244 |
catch (Exception $ex) |
| 2245 |
{ |
| 2246 |
|
| 2247 |
} |
| 2248 |
} |
| 2249 |
|
| 2250 |
$galleryWrapper1 = ''; |
| 2251 |
$galleryWrapper2 = ''; |
| 2252 |
$galleryCode = ''; |
| 2253 |
$galleryid_ifm_data = ''; |
| 2254 |
if ( |
| 2255 |
isset($finalparams['layout']) && strtolower($finalparams['layout']) == 'gallery' && isset($finalparams['list']) |
| 2256 |
) |
| 2257 |
{ |
| 2258 |
$gallery_options = new stdClass(); |
| 2259 |
$gallery_options->playlistId = $finalparams['list']; |
| 2260 |
$gallery_options->pageToken = null; |
| 2261 |
$gallery_options->pageSize = $finalparams[self::$opt_gallery_pagesize]; |
| 2262 |
$gallery_options->columns = intval($finalparams[self::$opt_gallery_columns]); |
| 2263 |
$gallery_options->showTitle = intval($finalparams[self::$opt_gallery_showtitle]); |
| 2264 |
$gallery_options->showPaging = intval($finalparams[self::$opt_gallery_showpaging]); |
| 2265 |
$gallery_options->autonext = intval($finalparams[self::$opt_gallery_autonext]); |
| 2266 |
$gallery_options->thumbplay = intval($finalparams[self::$opt_gallery_thumbplay]); |
| 2267 |
$gallery_options->apiKey = self::$alloptions[self::$opt_apikey]; |
| 2268 |
|
| 2269 |
$galleryid = 'epyt_gallery_' . rand(10000, 99999); |
| 2270 |
$galleryid_ifm_data = ' data-epytgalleryid="' . $galleryid . '" '; |
| 2271 |
|
| 2272 |
$subbutton = ''; |
| 2273 |
if (self::$alloptions[self::$opt_gallery_channelsub] == 1) |
| 2274 |
{ |
| 2275 |
$subbutton = '<div class="epyt-gallery-subscribe"><a target="_blank" class="epyt-gallery-subbutton" href="' . |
| 2276 |
esc_url(self::$alloptions[self::$opt_gallery_channelsublink]) . '?sub_confirmation=1"><img alt="subscribe" src="' . plugins_url('images/play-subscribe.png', __FILE__) . '" />' . |
| 2277 |
htmlspecialchars(self::$alloptions[self::$opt_gallery_channelsubtext], ENT_QUOTES) . '</a></div>'; |
| 2278 |
} |
| 2279 |
|
| 2280 |
$gallery_page_obj = self::get_gallery_page($gallery_options); |
| 2281 |
|
| 2282 |
$galleryWrapper1 = '<div class="epyt-gallery" data-currpage="1" id="' . $galleryid . '">'; |
| 2283 |
$galleryWrapper2 = '</div>'; |
| 2284 |
$galleryCode = $subbutton . '<div class="epyt-gallery-list">' . $gallery_page_obj->html . '</div>'; |
| 2285 |
$videoidoutput = isset($gallery_page_obj->init_id) ? $gallery_page_obj->init_id : ''; |
| 2286 |
} |
| 2287 |
|
| 2288 |
if (!empty($voloutput) && isset($finalparams['autoplay']) && $finalparams['autoplay'] == 1) |
| 2289 |
{ |
| 2290 |
$voloutput .= ' data-epautoplay="1" '; |
| 2291 |
$finalparams['autoplay'] = 0; |
| 2292 |
} |
| 2293 |
|
| 2294 |
$code1 = '<iframe ' . $centercode . ' id="_ytid_' . rand(10000, 99999) . '" width="' . self::$defaultwidth . '" height="' . self::$defaultheight . |
| 2295 |
'" src="https://www.' . $youtubebaseurl . '.com/embed/' . $videoidoutput . '?'; |
| 2296 |
$code2 = '" class="__youtube_prefs__' . ($iscontent ? '' : ' __youtube_prefs_widget__') . |
| 2297 |
'"' . $voloutput . $acctitle . $galleryid_ifm_data . ' allowfullscreen data-no-lazy="1" data-skipgform_ajax_framebjll=""></iframe>'; |
| 2298 |
|
| 2299 |
$origin = ''; |
| 2300 |
|
| 2301 |
try |
| 2302 |
{ |
| 2303 |
if (self::$alloptions[self::$opt_origin] == 1) |
| 2304 |
{ |
| 2305 |
$url_parts = parse_url(site_url()); |
| 2306 |
$origin = 'origin=' . $url_parts['scheme'] . '://' . $url_parts['host'] . '&'; |
| 2307 |
} |
| 2308 |
} |
| 2309 |
catch (Exception $e) |
| 2310 |
{ |
| 2311 |
$origin = ''; |
| 2312 |
} |
| 2313 |
$finalsrc = 'enablejsapi=1&' . $origin; |
| 2314 |
|
| 2315 |
if (count($finalparams) > 1) |
| 2316 |
{ |
| 2317 |
foreach ($finalparams as $key => $value) |
| 2318 |
{ |
| 2319 |
if (in_array($key, self::$yt_options)) |
| 2320 |
{ |
| 2321 |
if (!empty($galleryCode) && ($key == 'listType' || $key == 'list')) |
| 2322 |
{ |
| 2323 |
|
| 2324 |
} |
| 2325 |
else |
| 2326 |
{ |
| 2327 |
if (!(isset($finalparams['live']) && $key == 'loop')) |
| 2328 |
{ |
| 2329 |
$finalsrc .= htmlspecialchars($key) . '=' . htmlspecialchars($value) . '&'; |
| 2330 |
if ($key == 'loop' && $value == 1 && !isset($finalparams['list'])) |
| 2331 |
{ |
| 2332 |
$finalsrc .= 'playlist=' . $finalparams['v'] . '&'; |
| 2333 |
} |
| 2334 |
} |
| 2335 |
} |
| 2336 |
} |
| 2337 |
} |
| 2338 |
} |
| 2339 |
|
| 2340 |
$code = $galleryWrapper1 . $code1 . $finalsrc . $code2 . $galleryCode . $galleryWrapper2; |
| 2341 |
//. '<!--' . $m[0] . '-->'; |
| 2342 |
self::$defaultheight = null; |
| 2343 |
self::$defaultwidth = null; |
| 2344 |
self::$oembeddata = null; |
| 2345 |
|
| 2346 |
return $code; |
| 2347 |
} |
| 2348 |
|
| 2349 |
public static function debuglog($str) |
| 2350 |
{ |
| 2351 |
$handle = fopen(__DIR__ . "\\debug.txt", "a+"); |
| 2352 |
fwrite($handle, $str); |
| 2353 |
fclose($handle); |
| 2354 |
} |
| 2355 |
|
| 2356 |
public static function keyvalue($qry, $includev) |
| 2357 |
{ |
| 2358 |
$ytvars = explode('&', $qry); |
| 2359 |
$ytkvp = array(); |
| 2360 |
foreach ($ytvars as $k => $v) |
| 2361 |
{ |
| 2362 |
$kvp = explode('=', $v); |
| 2363 |
if (count($kvp) == 2 && ($includev || strtolower($kvp[0]) != 'v')) |
| 2364 |
{ |
| 2365 |
$ytkvp[$kvp[0]] = $kvp[1]; |
| 2366 |
} |
| 2367 |
} |
| 2368 |
|
| 2369 |
return $ytkvp; |
| 2370 |
} |
| 2371 |
|
| 2372 |
public static function secondsToDuration($seconds) |
| 2373 |
{ |
| 2374 |
$remaining = $seconds; |
| 2375 |
$parts = array(); |
| 2376 |
$multipliers = array( |
| 2377 |
'hours' => 3600, |
| 2378 |
'minutes' => 60, |
| 2379 |
'seconds' => 1 |
| 2380 |
); |
| 2381 |
|
| 2382 |
foreach ($multipliers as $type => $m) |
| 2383 |
{ |
| 2384 |
$parts[$type] = (int) ($remaining / $m); |
| 2385 |
$remaining -= ($parts[$type] * $m); |
| 2386 |
} |
| 2387 |
|
| 2388 |
return $parts; |
| 2389 |
} |
| 2390 |
|
| 2391 |
public static function formatDuration($parts) |
| 2392 |
{ |
| 2393 |
$default = array( |
| 2394 |
'hours' => 0, |
| 2395 |
'minutes' => 0, |
| 2396 |
'seconds' => 0 |
| 2397 |
); |
| 2398 |
|
| 2399 |
extract(array_merge($default, $parts)); |
| 2400 |
|
| 2401 |
return "T{$hours}H{$minutes}M{$seconds}S"; |
| 2402 |
} |
| 2403 |
|
| 2404 |
public static function init_dimensions($url, $urlkvp, $finalparams) |
| 2405 |
{ |
| 2406 |
// get default dimensions; try embed size in settings, then try theme's content width, then just 480px |
| 2407 |
if (self::$defaultwidth == null) |
| 2408 |
{ |
| 2409 |
global $content_width; |
| 2410 |
if (empty($content_width)) |
| 2411 |
{ |
| 2412 |
$content_width = $GLOBALS['content_width']; |
| 2413 |
} |
| 2414 |
|
| 2415 |
if (isset($urlkvp['width']) && is_numeric($urlkvp['width'])) |
| 2416 |
{ |
| 2417 |
self::$defaultwidth = $urlkvp['width']; |
| 2418 |
} |
| 2419 |
else if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultwidth]) && is_numeric(self::$alloptions[self::$opt_defaultwidth]))) |
| 2420 |
{ |
| 2421 |
self::$defaultwidth = self::$alloptions[self::$opt_defaultwidth]; |
| 2422 |
} |
| 2423 |
else if (self::$optembedwidth) |
| 2424 |
{ |
| 2425 |
self::$defaultwidth = self::$optembedwidth; |
| 2426 |
} |
| 2427 |
else if ($content_width) |
| 2428 |
{ |
| 2429 |
self::$defaultwidth = $content_width; |
| 2430 |
} |
| 2431 |
else |
| 2432 |
{ |
| 2433 |
self::$defaultwidth = 480; |
| 2434 |
} |
| 2435 |
|
| 2436 |
|
| 2437 |
|
| 2438 |
if (isset($urlkvp['height']) && is_numeric($urlkvp['height'])) |
| 2439 |
{ |
| 2440 |
self::$defaultheight = $urlkvp['height']; |
| 2441 |
} |
| 2442 |
else if (self::$alloptions[self::$opt_defaultdims] == 1 && (isset(self::$alloptions[self::$opt_defaultheight]) && is_numeric(self::$alloptions[self::$opt_defaultheight]))) |
| 2443 |
{ |
| 2444 |
self::$defaultheight = self::$alloptions[self::$opt_defaultheight]; |
| 2445 |
} |
| 2446 |
else |
| 2447 |
{ |
| 2448 |
self::$defaultheight = self::get_aspect_height($url, $urlkvp, $finalparams); |
| 2449 |
} |
| 2450 |
} |
| 2451 |
} |
| 2452 |
|
| 2453 |
public static function get_oembed($url, $height, $width) |
| 2454 |
{ |
| 2455 |
require_once( ABSPATH . WPINC . '/class-oembed.php' ); |
| 2456 |
$oembed = _wp_oembed_get_object(); |
| 2457 |
$args = array(); |
| 2458 |
$args['width'] = $width; |
| 2459 |
$args['height'] = $height; |
| 2460 |
$args['discover'] = false; |
| 2461 |
self::$oembeddata = $oembed->fetch('https://www.youtube.com/oembed', $url, $args); |
| 2462 |
return self::$oembeddata; |
| 2463 |
} |
| 2464 |
|
| 2465 |
public static function get_aspect_height($url, $urlkvp, $finalparams) |
| 2466 |
{ |
| 2467 |
|
| 2468 |
// attempt to get aspect ratio correct height from oEmbed |
| 2469 |
$aspectheight = round((self::$defaultwidth * 9) / 16, 0); |
| 2470 |
|
| 2471 |
|
| 2472 |
if ($url) |
| 2473 |
{ |
| 2474 |
$odata = self::get_oembed($url, self::$defaultwidth, self::$defaultwidth); |
| 2475 |
|
| 2476 |
if ($odata) |
| 2477 |
{ |
| 2478 |
$aspectheight = $odata->height; |
| 2479 |
} |
| 2480 |
} |
| 2481 |
|
| 2482 |
if ($finalparams[self::$opt_controls] != 0 && $finalparams[self::$opt_autohide] != 1) |
| 2483 |
{ |
| 2484 |
//add 28 for YouTube's own bar: DEPRECATED |
| 2485 |
//$aspectheight += 28; |
| 2486 |
} |
| 2487 |
return $aspectheight; |
| 2488 |
} |
| 2489 |
|
| 2490 |
public static function ytprefs_plugin_menu() |
| 2491 |
{ |
| 2492 |
add_menu_page('YouTube Settings', 'YouTube Free', 'manage_options', 'youtube-my-preferences', array(get_class(), 'ytprefs_show_options'), plugins_url('images/youtubeicon16.png', __FILE__), '10.000392854349'); |
| 2493 |
add_submenu_page('youtube-my-preferences', '', '', 'manage_options', 'youtube-my-preferences', array(get_class(), 'ytprefs_show_options')); |
| 2494 |
|
| 2495 |
add_submenu_page(null, 'YouTube Posts', 'YouTube Posts', 'manage_options', 'youtube-ep-glance', array(get_class(), 'glance_page')); |
| 2496 |
self::$wizard_hook = add_submenu_page(null, 'YouTube Wizard', 'YouTube Wizard', 'edit_posts', 'youtube-ep-wizard', array(get_class(), 'wizard')); |
| 2497 |
} |
| 2498 |
|
| 2499 |
public static function custom_admin_pointers_check() |
| 2500 |
{ |
| 2501 |
//return false; // ooopointer shut all off; |
| 2502 |
$admin_pointers = self::custom_admin_pointers(); |
| 2503 |
foreach ($admin_pointers as $pointer => $array) |
| 2504 |
{ |
| 2505 |
if ($array['active']) |
| 2506 |
{ |
| 2507 |
return true; |
| 2508 |
} |
| 2509 |
} |
| 2510 |
} |
| 2511 |
|
| 2512 |
public static function glance_script() |
| 2513 |
{ |
| 2514 |
add_thickbox(); |
| 2515 |
?> |
| 2516 |
<script type="text/javascript"> |
| 2517 |
function widen_ytprefs_glance() { |
| 2518 |
setTimeout(function () { |
| 2519 |
jQuery("#TB_window").animate({marginLeft: '-' + parseInt((780 / 2), 10) + 'px', width: '780px'}, 300); |
| 2520 |
jQuery("#TB_window iframe").animate({width: '780px'}, 300); |
| 2521 |
}, 15); |
| 2522 |
} |
| 2523 |
|
| 2524 |
(function ($j) |
| 2525 |
{ |
| 2526 |
$j(document).ready(function () { |
| 2527 |
|
| 2528 |
$j.ajax({ |
| 2529 |
type: "post", |
| 2530 |
dataType: "json", |
| 2531 |
timeout: 30000, |
| 2532 |
url: window._EPYTA_.wpajaxurl, |
| 2533 |
data: {action: 'my_embedplus_glance_count'}, |
| 2534 |
success: function (response) { |
| 2535 |
if (response.type === "success") { |
| 2536 |
$j(response.container).append(response.data); |
| 2537 |
$j(".ytprefs_glance_button").click(widen_ytprefs_glance); |
| 2538 |
$j(window).resize(widen_ytprefs_glance); |
| 2539 |
if (typeof ep_do_pointers === 'function') |
| 2540 |
{ |
| 2541 |
//ep_do_pointers($j); |
| 2542 |
} |
| 2543 |
} else { |
| 2544 |
} |
| 2545 |
}, |
| 2546 |
error: function (xhr, ajaxOptions, thrownError) { |
| 2547 |
|
| 2548 |
}, |
| 2549 |
complete: function () { |
| 2550 |
} |
| 2551 |
}); |
| 2552 |
}); |
| 2553 |
})(jQuery);</script> |
| 2554 |
<?php |
| 2555 |
} |
| 2556 |
|
| 2557 |
public static function custom_admin_pointers_footer() |
| 2558 |
{ |
| 2559 |
$admin_pointers = self::custom_admin_pointers(); |
| 2560 |
?> |
| 2561 |
<script type="text/javascript"> |
| 2562 |
/* <![CDATA[ */ |
| 2563 |
function ep_do_pointers($) |
| 2564 |
{ |
| 2565 |
<?php |
| 2566 |
foreach ($admin_pointers as $pointer => $array) |
| 2567 |
{ |
| 2568 |
if ($array['active']) |
| 2569 |
{ |
| 2570 |
?> |
| 2571 |
$('<?php echo $array['anchor_id']; ?>').pointer({ |
| 2572 |
content: '<?php echo $array['content']; ?>', |
| 2573 |
position: { |
| 2574 |
edge: '<?php echo $array['edge']; ?>', |
| 2575 |
align: '<?php echo $array['align']; ?>' |
| 2576 |
}, |
| 2577 |
close: function () { |
| 2578 |
$.post(window._EPYTA_.wpajaxurl, { |
| 2579 |
pointer: '<?php echo $pointer; ?>', |
| 2580 |
action: 'dismiss-wp-pointer' |
| 2581 |
}); |
| 2582 |
} |
| 2583 |
}).pointer('open'); |
| 2584 |
<?php |
| 2585 |
} |
| 2586 |
} |
| 2587 |
?> |
| 2588 |
} |
| 2589 |
|
| 2590 |
ep_do_pointers(jQuery); // switch off all pointers via js ooopointer |
| 2591 |
/* ]]> */ |
| 2592 |
</script> |
| 2593 |
<?php |
| 2594 |
} |
| 2595 |
|
| 2596 |
public static function custom_admin_pointers() |
| 2597 |
{ |
| 2598 |
$dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true)); |
| 2599 |
$version = str_replace('.', '_', self::$version); // replace all periods in version with an underscore |
| 2600 |
$prefix = 'custom_admin_pointers' . $version . '_'; |
| 2601 |
|
| 2602 |
$new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer |
| 2603 |
|
| 2604 |
$new_pointer_content .= '<p>'; // ooopointer |
| 2605 |
if (!(self::$alloptions[self::$opt_pro] && strlen(trim(self::$alloptions[self::$opt_pro])) > 0)) |
| 2606 |
{ |
| 2607 |
$new_pointer_content .= __("This update includes role settings for the wizard, improved AJAX theme compatibility, and many more bug fixes for the Free and <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">Pro versions »</a>"); |
| 2608 |
} |
| 2609 |
else |
| 2610 |
{ |
| 2611 |
$new_pointer_content .= __("This update includes role settings for the wizard, improved AJAX theme compatibility, and many more bug fixes for the Free and Pro versions. " . '<strong>Important message to YouTube Pro users</strong>: From version 11.7 onward, you must <a href="https://www.embedplus.com/youtube-pro/download/?prokey=' . esc_attr(self::$alloptions[self::$opt_pro]) . '" target="_blank">download the separate plugin here</a> 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.'); |
| 2612 |
} |
| 2613 |
$new_pointer_content .= '</p>'; |
| 2614 |
|
| 2615 |
return array( |
| 2616 |
$prefix . 'new_items' => array( |
| 2617 |
'content' => $new_pointer_content, |
| 2618 |
'anchor_id' => 'a.toplevel_page_youtube-my-preferences', //'#ytprefs_glance_button', |
| 2619 |
'edge' => 'top', |
| 2620 |
'align' => 'left', |
| 2621 |
'active' => (!in_array($prefix . 'new_items', $dismissed) ) |
| 2622 |
), |
| 2623 |
); |
| 2624 |
} |
| 2625 |
|
| 2626 |
public static function postchecked($idx) |
| 2627 |
{ |
| 2628 |
return isset($_POST[$idx]) && $_POST[$idx] == (true || 'on'); |
| 2629 |
} |
| 2630 |
|
| 2631 |
public static function ytprefs_show_options() |
| 2632 |
{ |
| 2633 |
if (!current_user_can('manage_options')) |
| 2634 |
{ |
| 2635 |
wp_die(__('You do not have sufficient permissions to access this page.')); |
| 2636 |
} |
| 2637 |
|
| 2638 |
if (self::$double_plugin) |
| 2639 |
{ |
| 2640 |
self::double_plugin_warning(); |
| 2641 |
} |
| 2642 |
|
| 2643 |
$ytprefs_submitted = 'ytprefs_submitted'; |
| 2644 |
|
| 2645 |
// Read in existing option values from database |
| 2646 |
|
| 2647 |
$all = get_option(self::$opt_alloptions); |
| 2648 |
|
| 2649 |
// See if the user has posted us some information |
| 2650 |
// If they did, this hidden field will be set to 'Y' |
| 2651 |
if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y') |
| 2652 |
{ |
| 2653 |
// Read their posted values |
| 2654 |
|
| 2655 |
$new_options = array(); |
| 2656 |
$new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0; |
| 2657 |
$new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0; |
| 2658 |
$new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0; |
| 2659 |
$new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0; |
| 2660 |
$new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0; |
| 2661 |
$new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0; |
| 2662 |
$new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0; |
| 2663 |
$new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3; |
| 2664 |
$new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0; |
| 2665 |
$new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0; |
| 2666 |
$new_options[self::$opt_rel] = self::postchecked(self::$opt_rel) ? 1 : 0; |
| 2667 |
$new_options[self::$opt_showinfo] = self::postchecked(self::$opt_showinfo) ? 1 : 0; |
| 2668 |
$new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0; |
| 2669 |
$new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0; |
| 2670 |
$new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 2 : 0; |
| 2671 |
$new_options[self::$opt_autohide] = self::postchecked(self::$opt_autohide) ? 1 : 2; |
| 2672 |
$new_options[self::$opt_theme] = self::postchecked(self::$opt_theme) ? 'dark' : 'light'; |
| 2673 |
$new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white'; |
| 2674 |
$new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0; |
| 2675 |
$new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0; |
| 2676 |
$new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0; |
| 2677 |
$new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0; |
| 2678 |
$new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0; |
| 2679 |
$new_options[self::$opt_migrate_embedplusvideo] = self::postchecked(self::$opt_migrate_embedplusvideo) ? 1 : 0; |
| 2680 |
$new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0; |
| 2681 |
$new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0; |
| 2682 |
$new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0; |
| 2683 |
$new_options[self::$opt_evselector_light] = self::postchecked(self::$opt_evselector_light) ? 1 : 0; |
| 2684 |
$new_options[self::$opt_stop_mobile_buffer] = self::postchecked(self::$opt_stop_mobile_buffer) ? 1 : 0; |
| 2685 |
$new_options[self::$opt_restrict_wizard] = self::postchecked(self::$opt_restrict_wizard) ? 1 : 0; |
| 2686 |
$new_options[self::$opt_ajax_compat] = self::postchecked(self::$opt_ajax_compat) ? 1 : 0; |
| 2687 |
$new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0; |
| 2688 |
$new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0; |
| 2689 |
$new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0; |
| 2690 |
$new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0; |
| 2691 |
$new_options[self::$opt_gallery_showpaging] = self::postchecked(self::$opt_gallery_showpaging) ? 1 : 0; |
| 2692 |
$new_options[self::$opt_gallery_autonext] = self::postchecked(self::$opt_gallery_autonext) ? 1 : 0; |
| 2693 |
$new_options[self::$opt_gallery_thumbplay] = self::postchecked(self::$opt_gallery_thumbplay) ? 1 : 0; |
| 2694 |
$new_options[self::$opt_gallery_channelsub] = self::postchecked(self::$opt_gallery_channelsub) ? 1 : 0; |
| 2695 |
$new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0; |
| 2696 |
$new_options[self::$opt_gallery_collapse_grid] = self::postchecked(self::$opt_gallery_collapse_grid) ? 1 : 0; |
| 2697 |
|
| 2698 |
|
| 2699 |
$_restrict_wizard_roles = self::$dft_roles; |
| 2700 |
try |
| 2701 |
{ |
| 2702 |
$_restrict_wizard_roles = is_array($_POST[self::$opt_restrict_wizard_roles]) ? $_POST[self::$opt_restrict_wizard_roles] : $_restrict_wizard_roles; |
| 2703 |
} |
| 2704 |
catch (Exception $ex) |
| 2705 |
{ |
| 2706 |
|
| 2707 |
} |
| 2708 |
$new_options[self::$opt_restrict_wizard_roles] = $_restrict_wizard_roles; |
| 2709 |
|
| 2710 |
|
| 2711 |
$_defaultwidth = ''; |
| 2712 |
try |
| 2713 |
{ |
| 2714 |
$_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth; |
| 2715 |
} |
| 2716 |
catch (Exception $ex) |
| 2717 |
{ |
| 2718 |
|
| 2719 |
} |
| 2720 |
$new_options[self::$opt_defaultwidth] = $_defaultwidth; |
| 2721 |
|
| 2722 |
$_defaultheight = ''; |
| 2723 |
try |
| 2724 |
{ |
| 2725 |
$_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight; |
| 2726 |
} |
| 2727 |
catch (Exception $ex) |
| 2728 |
{ |
| 2729 |
|
| 2730 |
} |
| 2731 |
$new_options[self::$opt_defaultheight] = $_defaultheight; |
| 2732 |
|
| 2733 |
$_responsive_all = 1; |
| 2734 |
try |
| 2735 |
{ |
| 2736 |
$_responsive_all = is_numeric(trim($_POST[self::$opt_responsive_all])) ? intval(trim($_POST[self::$opt_responsive_all])) : $_responsive_all; |
| 2737 |
} |
| 2738 |
catch (Exception $ex) |
| 2739 |
{ |
| 2740 |
|
| 2741 |
} |
| 2742 |
$new_options[self::$opt_responsive_all] = $_responsive_all; |
| 2743 |
|
| 2744 |
$_vol = ''; |
| 2745 |
try |
| 2746 |
{ |
| 2747 |
$_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol; |
| 2748 |
} |
| 2749 |
catch (Exception $ex) |
| 2750 |
{ |
| 2751 |
|
| 2752 |
} |
| 2753 |
$new_options[self::$opt_vol] = $_vol; |
| 2754 |
|
| 2755 |
$_gallery_pagesize = 15; |
| 2756 |
try |
| 2757 |
{ |
| 2758 |
$_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize; |
| 2759 |
} |
| 2760 |
catch (Exception $ex) |
| 2761 |
{ |
| 2762 |
|
| 2763 |
} |
| 2764 |
$new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize; |
| 2765 |
|
| 2766 |
|
| 2767 |
$_gallery_columns = 3; |
| 2768 |
try |
| 2769 |
{ |
| 2770 |
$_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns; |
| 2771 |
} |
| 2772 |
catch (Exception $ex) |
| 2773 |
{ |
| 2774 |
|
| 2775 |
} |
| 2776 |
$new_options[self::$opt_gallery_columns] = $_gallery_columns; |
| 2777 |
|
| 2778 |
|
| 2779 |
$_gallery_collapse_grid_breaks = self::$dft_bpts; |
| 2780 |
try |
| 2781 |
{ |
| 2782 |
$_gallery_collapse_grid_breaks = is_array($_POST[self::$opt_gallery_collapse_grid_breaks]) ? $_POST[self::$opt_gallery_collapse_grid_breaks] : $_gallery_collapse_grid_breaks; |
| 2783 |
} |
| 2784 |
catch (Exception $ex) |
| 2785 |
{ |
| 2786 |
|
| 2787 |
} |
| 2788 |
$new_options[self::$opt_gallery_collapse_grid_breaks] = $_gallery_collapse_grid_breaks; |
| 2789 |
|
| 2790 |
|
| 2791 |
|
| 2792 |
$_gallery_scrolloffset = 20; |
| 2793 |
try |
| 2794 |
{ |
| 2795 |
$_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset; |
| 2796 |
} |
| 2797 |
catch (Exception $ex) |
| 2798 |
{ |
| 2799 |
|
| 2800 |
} |
| 2801 |
$new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset; |
| 2802 |
|
| 2803 |
$_gallery_channelsublink = ''; |
| 2804 |
try |
| 2805 |
{ |
| 2806 |
$_gallery_channelsublink = trim(strip_tags($_POST[self::$opt_gallery_channelsublink])); |
| 2807 |
$pieces = explode('?', $_gallery_channelsublink); |
| 2808 |
$_gallery_channelsublink = trim($pieces[0]); |
| 2809 |
} |
| 2810 |
catch (Exception $ex) |
| 2811 |
{ |
| 2812 |
$_gallery_channelsublink = ''; |
| 2813 |
} |
| 2814 |
$new_options[self::$opt_gallery_channelsublink] = $_gallery_channelsublink; |
| 2815 |
|
| 2816 |
|
| 2817 |
$_gallery_channelsubtext = ''; |
| 2818 |
try |
| 2819 |
{ |
| 2820 |
$_gallery_channelsubtext = stripslashes(trim($_POST[self::$opt_gallery_channelsubtext])); |
| 2821 |
} |
| 2822 |
catch (Exception $ex) |
| 2823 |
{ |
| 2824 |
$_gallery_channelsubtext = ''; |
| 2825 |
} |
| 2826 |
$new_options[self::$opt_gallery_channelsubtext] = $_gallery_channelsubtext; |
| 2827 |
|
| 2828 |
|
| 2829 |
$_gallery_custom_prev = 'Prev'; |
| 2830 |
try |
| 2831 |
{ |
| 2832 |
$_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev])); |
| 2833 |
} |
| 2834 |
catch (Exception $ex) |
| 2835 |
{ |
| 2836 |
$_gallery_custom_prev = 'Prev'; |
| 2837 |
} |
| 2838 |
$new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev; |
| 2839 |
|
| 2840 |
|
| 2841 |
$_gallery_custom_next = 'Next'; |
| 2842 |
try |
| 2843 |
{ |
| 2844 |
$_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext])); |
| 2845 |
} |
| 2846 |
catch (Exception $ex) |
| 2847 |
{ |
| 2848 |
$_gallery_custom_next = 'Next'; |
| 2849 |
} |
| 2850 |
$new_options[self::$opt_gallery_customnext] = $_gallery_custom_next; |
| 2851 |
|
| 2852 |
|
| 2853 |
$_not_live_content = ''; |
| 2854 |
try |
| 2855 |
{ |
| 2856 |
$_not_live_content = wp_kses_post($_POST[self::$opt_not_live_content]); |
| 2857 |
} |
| 2858 |
catch (Exception $ex) |
| 2859 |
{ |
| 2860 |
$_not_live_content = ''; |
| 2861 |
} |
| 2862 |
$new_options[self::$opt_not_live_content] = $_not_live_content; |
| 2863 |
|
| 2864 |
|
| 2865 |
$_apikey = ''; |
| 2866 |
try |
| 2867 |
{ |
| 2868 |
$_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey]))); |
| 2869 |
} |
| 2870 |
catch (Exception $ex) |
| 2871 |
{ |
| 2872 |
$_apikey = ''; |
| 2873 |
} |
| 2874 |
$new_options[self::$opt_apikey] = $_apikey; |
| 2875 |
|
| 2876 |
|
| 2877 |
$all = $new_options + $all; |
| 2878 |
|
| 2879 |
update_option(self::$opt_alloptions, $all); |
| 2880 |
?> |
| 2881 |
<div class="updated"><p><strong><?php _e('Changes saved.'); ?></strong></p></div> |
| 2882 |
<?php |
| 2883 |
} |
| 2884 |
|
| 2885 |
|
| 2886 |
// Now display the settings editing screen |
| 2887 |
|
| 2888 |
echo '<div class="wrap" style="max-width: 1000px;">'; |
| 2889 |
|
| 2890 |
// header |
| 2891 |
|
| 2892 |
echo "<h2>" . '<img alt="YouTube Plugin Icon" src="' . plugins_url('images/youtubeicon16.png', __FILE__) . '" /> ' . __('YouTube Settings') . "</h2>"; |
| 2893 |
|
| 2894 |
// settings form |
| 2895 |
?> |
| 2896 |
|
| 2897 |
<style type="text/css"> |
| 2898 |
.wrap {font-family: Arial; color: #000000;} |
| 2899 |
#ytform p { line-height: 20px; margin-bottom: 11px; } |
| 2900 |
#ytform ul li {margin-left: 30px; list-style: disc outside none;} |
| 2901 |
.ytindent {padding: 0px 0px 0px 20px; font-size: 12px;} |
| 2902 |
.ytindent ul, .ytindent p {font-size: 12px;} |
| 2903 |
.shadow {-webkit-box-shadow: 0px 0px 20px 0px #000000; box-shadow: 0px 0px 20px 0px #000000;} |
| 2904 |
.gopro {margin: 0px;} |
| 2905 |
.gopro img {vertical-align: middle; |
| 2906 |
width: 19px; |
| 2907 |
height: 19px; |
| 2908 |
padding-bottom: 4px;} |
| 2909 |
.gopro li {margin-bottom: 0px;} |
| 2910 |
.orange {color: #f85d00;} |
| 2911 |
.bold {font-weight: bold;} |
| 2912 |
.grey{color: #888888;} |
| 2913 |
#goprobox {border-radius: 15px; padding: 10px 15px 15px 15px; margin-top: 15px; border: 3px solid #CCE5EC; position: relative;} |
| 2914 |
#nonprosupport {border-radius: 15px; padding: 10px 15px 20px 15px; border: 3px solid #ff6655;} |
| 2915 |
.pronon {font-weight: bold; color: #f85d00;} |
| 2916 |
ul.reglist li {margin: 0px 0px 0px 30px; list-style: disc outside none;} |
| 2917 |
.procol {width: 475px; float: left;} |
| 2918 |
.ytindent .procol ul {font-size: 11px;} |
| 2919 |
.smallnote, .ytindent .smallnote {font-style: italic; font-size: 10px;} |
| 2920 |
.italic {font-style: italic;} |
| 2921 |
.ytindent h3 {font-size: 15px; line-height: 22px; margin: 5px 0px 10px 0px;} |
| 2922 |
#wizleftlink {float: left; display: block; width: 240px; font-style: italic; text-align: center; text-decoration: none;} |
| 2923 |
.button-primary {font-weight: bold; white-space: nowrap;} |
| 2924 |
p.submit {margin: 10px 0 0 0; padding: 10px 0 5px 0;} |
| 2925 |
.wp-core-ui p.submit .button-primary {font-size: 20px; height: 50px; padding: 0 20px 1px; |
| 2926 |
background: #2ea2cc; /* Old browsers */ |
| 2927 |
background: -moz-linear-gradient(top, #2ea2cc 0%, #007396 98%); /* FF3.6+ */ |
| 2928 |
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2ea2cc), color-stop(98%,#007396)); /* Chrome,Safari4+ */ |
| 2929 |
background: -webkit-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Chrome10+,Safari5.1+ */ |
| 2930 |
background: -o-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* Opera 11.10+ */ |
| 2931 |
background: -ms-linear-gradient(top, #2ea2cc 0%,#007396 98%); /* IE10+ */ |
| 2932 |
background: linear-gradient(to bottom, #2ea2cc 0%,#007396 98%); /* W3C */ |
| 2933 |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#007396',GradientType=0 ); /* IE6-9 */ |
| 2934 |
} |
| 2935 |
p.submit em {display: inline-block; padding-left: 20px; vertical-align: middle; width: 240px; margin-top: -6px;} |
| 2936 |
#opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 320px;vertical-align: top;} |
| 2937 |
#goprobox h3 {font-size: 13px;} |
| 2938 |
.chx {border-left: 5px solid rgba(100, 100, 100,.1); margin-bottom: 20px;} |
| 2939 |
.chx p {margin: 0px 0px 5px 0px;} |
| 2940 |
.cuz {background-image: linear-gradient(to bottom,#4983FF,#0C5597) !important; color: #ffffff;} |
| 2941 |
.brightpro {background-image: linear-gradient(to bottom,#ff5500,#cc2200) !important; color: #ffffff;} |
| 2942 |
#boxdefaultdims {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultdims] ? '' : 'display: none;' ?>} |
| 2943 |
#boxcustomarrows {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_customarrows] ? 'display: block;' : 'display: none;' ?>} |
| 2944 |
#boxchannelsub {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_gallery_channelsub] ? 'display: block;' : 'display: none;' ?>} |
| 2945 |
#box_collapse_grid {font-weight: bold; padding: 0px 10px; <?php echo isset($all[self::$opt_gallery_collapse_grid]) && $all[self::$opt_gallery_collapse_grid] ? 'display: block;' : 'display: none;' ?>} |
| 2946 |
#box_restrict_wizard {padding: 0px 10px; <?php echo isset($all[self::$opt_restrict_wizard]) && $all[self::$opt_restrict_wizard] ? 'display: block;' : 'display: none;' ?>} |
| 2947 |
#box_restrict_wizard label {display: block; margin: 5px 10px;} |
| 2948 |
.textinput {border-width: 2px !important;} |
| 2949 |
h3.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;} |
| 2950 |
h3.sect a {text-decoration: none; color: #E20000;} |
| 2951 |
h3.sect a.button-primary {color: #ffffff;} |
| 2952 |
h4.sect {border-radius: 10px; background-color: #D9E9F7; padding: 5px 5px 5px 10px; position: relative; font-weight: bold;} |
| 2953 |
|
| 2954 |
.ytnav {margin-bottom: 15px;} |
| 2955 |
.ytnav a {font-weight: bold; display: inline-block; padding: 5px 10px; margin: 0px 15px 0px 0px; border: 1px solid #cccccc; border-radius: 6px; |
| 2956 |
text-decoration: none; background-color: #ffffff;} |
| 2957 |
.ytnav a:last-child {margin-right: 0;} |
| 2958 |
.jumper {height: 25px;} |
| 2959 |
.ssschema {float: right; width: 350px; height: auto; margin-right: 10px;} |
| 2960 |
.ssfb {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px;} |
| 2961 |
.totop {position: absolute; right: 20px; top: 5px; color: #444444; font-size: 10px;} |
| 2962 |
input[type=checkbox] {border: 1px solid #000000;} |
| 2963 |
.chktitle {display: inline-block; padding: 1px 5px 1px 5px; border-radius: 3px; background-color: #ffffff; border: 1px solid #dddddd;} |
| 2964 |
b, strong {font-weight: bold;} |
| 2965 |
input.checkbox[disabled], input[type=radio][disabled] {border: 1px dashed #444444;} |
| 2966 |
.pad10 {padding: 10px;} |
| 2967 |
#boxdohl {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_dohl] ? '' : 'display: none;' ?>} |
| 2968 |
#boxdefaultvol {font-weight: bold; padding: 0px 10px; <?php echo $all[self::$opt_defaultvol] ? '' : 'display: none;' ?>} |
| 2969 |
.vol-output {display: none; width: 30px; color: #008800;} |
| 2970 |
.vol-range {background-color: #dddddd; border-radius: 3px; cursor: pointer;} |
| 2971 |
input#vol {vertical-align: middle;} |
| 2972 |
.vol-seeslider {display: none;} |
| 2973 |
.indent-option {margin-left: 25px;} |
| 2974 |
#boxmigratelist { <?php echo $all[self::$opt_migrate] ? '' : 'display: none;' ?>} |
| 2975 |
#boxresponsive_all { <?php echo $all[self::$opt_responsive] ? '' : 'display: none;' ?> padding-left: 25px; border-left: 5px solid rgba(100, 100, 100,.1); margin-left: 5px;} |
| 2976 |
.apikey-msg {display: inline-block; width: 45%; vertical-align: top;} |
| 2977 |
.apikey-video{margin-left: 3%; display: inline-block; width: 50%; position: relative; padding-top: 29%} |
| 2978 |
.apikey-video iframe{display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0;} |
| 2979 |
#boxnocookie {display: inline-block; border-radius: 3px; padding: 2px 4px 2px 4px; color: red; background-color: yellow; font-weight: bold; <?php echo $all[self::$opt_nocookie] ? '' : 'display: none;' ?>} |
| 2980 |
.strike {text-decoration: line-through;} |
| 2981 |
.upgchecks { padding: 20px; border-radius: 15px; border: 1px dotted #777777; background-color: #fcfcfc; } |
| 2982 |
.clearboth {clear: both;} |
| 2983 |
div.hr {clear: both; border-bottom: 1px dotted #A8BDD8; margin: 20px 0 20px 0;} |
| 2984 |
.wp-pointer-buttons a.close {margin-top: 0 !important;} |
| 2985 |
.pad20{padding: 20px 0 20px 0;} |
| 2986 |
.ssgallery {float: right; width: 130px; height: auto; margin-left: 15px; border: 3px solid #ffffff;} |
| 2987 |
.sssubscribe{display: block; width: 400px; height: auto;} |
| 2988 |
.ssaltgallery {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px; width: 350px;} |
| 2989 |
.sspopupplayer {float: right; height: auto; margin-right: 10px; margin-left: 15px; margin-bottom: 10px; width: 350px;} |
| 2990 |
.sswizardbutton { max-width: 70%; height: auto;} |
| 2991 |
.save-changes-follow {position: fixed; z-index: 10000; bottom: 0; right: 0; background-color: #ffffff; padding: 0 20px; border-top-left-radius: 20px; border: 2px solid #aaaaaa; border-right-width: 0; border-bottom-width: 0; |
| 2992 |
-webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); |
| 2993 |
-moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); |
| 2994 |
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); } |
| 2995 |
|
| 2996 |
</style> |
| 2997 |
|
| 2998 |
<div class="ytindent"> |
| 2999 |
<br> |
| 3000 |
<div class="ytnav"> |
| 3001 |
<a href="#jumpapikey">API Key</a> |
| 3002 |
<a href="#jumpdefaults">Defaults</a> |
| 3003 |
<a href="#jumpwiz">Visual Wizard</a> |
| 3004 |
<a href="#jumpcompat">Compatibility</a> |
| 3005 |
<a href="#jumpgallery">Galleries</a> |
| 3006 |
<a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a> |
| 3007 |
<a href="#jumphowto">Embed Manually</a> |
| 3008 |
<a href="#jumpsupport">Support</a> |
| 3009 |
</div> |
| 3010 |
|
| 3011 |
<form name="form1" method="post" action="" id="ytform"> |
| 3012 |
<input type="hidden" name="<?php echo $ytprefs_submitted; ?>" value="Y"> |
| 3013 |
|
| 3014 |
<div class="jumper" id="jumpapikey"></div> |
| 3015 |
<h3 class="sect"> |
| 3016 |
YouTube API Key |
| 3017 |
</h3> |
| 3018 |
<p> |
| 3019 |
Some features (such as galleries, and some wizard features) now require you to create a free YouTube API key from Google. |
| 3020 |
</p> |
| 3021 |
<p> |
| 3022 |
<b class="chktitle">YouTube API Key:</b> |
| 3023 |
<input type="text" name="<?php echo self::$opt_apikey; ?>" id="<?php echo self::$opt_apikey; ?>" value="<?php echo trim($all[self::$opt_apikey]); ?>" class="textinput" style="width: 250px;"> |
| 3024 |
<a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">Click this link »</a> and follow the video to get your API key. Don't worry, it's an easy process. |
| 3025 |
</p> |
| 3026 |
|
| 3027 |
|
| 3028 |
<div class="jumper" id="jumpdefaults"></div> |
| 3029 |
<h3 class="sect"> |
| 3030 |
<?php _e("Default YouTube Options") ?> <a href="#top" class="totop">▲ top</a> |
| 3031 |
</h3> |
| 3032 |
<p> |
| 3033 |
<?php _e("One of the benefits of using this plugin is that you can set site-wide default options for all your videos (click \"Save Changes\" when finished). However, you can also override them (and more) on a per-video basis. Directions on how to do that are in the next section.") ?> |
| 3034 |
</p> |
| 3035 |
|
| 3036 |
<div class="ytindent chx"> |
| 3037 |
<p> |
| 3038 |
<input name="<?php echo self::$opt_restrict_wizard; ?>" id="<?php echo self::$opt_restrict_wizard; ?>" <?php checked($all[self::$opt_restrict_wizard], 1); ?> type="checkbox" class="checkbox"> |
| 3039 |
<label for="<?php echo self::$opt_restrict_wizard; ?>"> |
| 3040 |
<b class="chktitle">Restrict Wizard Button:</b> <sup class="orange">NEW</sup> Select which roles can use the YouTube wizard button. For example, you may wish to hide the button from contributors submitting content on the front end. |
| 3041 |
</label> |
| 3042 |
<br> |
| 3043 |
<span id="box_restrict_wizard" class="chx"> |
| 3044 |
<?php |
| 3045 |
foreach (self::$dft_roles as $idx => $role) |
| 3046 |
{ |
| 3047 |
?> |
| 3048 |
<label> |
| 3049 |
<input type="checkbox" name="<?php echo self::$opt_restrict_wizard_roles . '[]' ?>" value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, $all[self::$opt_restrict_wizard_roles]) ? 'checked' : '' ?>> |
| 3050 |
<?php echo esc_html(ucfirst($role)); ?>s |
| 3051 |
</label> |
| 3052 |
<?php |
| 3053 |
} |
| 3054 |
?> |
| 3055 |
</span> |
| 3056 |
</p> |
| 3057 |
<p> |
| 3058 |
<input name="<?php echo self::$opt_glance; ?>" id="<?php echo self::$opt_glance; ?>" <?php checked($all[self::$opt_glance], 1); ?> type="checkbox" class="checkbox"> |
| 3059 |
<label for="<?php echo self::$opt_glance; ?>"><?php _e('<b class="chktitle">At a glance:</b> Show "At a Glance" Embed Links on the dashboard homepage.') ?></label> |
| 3060 |
</p> |
| 3061 |
<p> |
| 3062 |
<input name="<?php echo self::$opt_center; ?>" id="<?php echo self::$opt_center; ?>" <?php checked($all[self::$opt_center], 1); ?> type="checkbox" class="checkbox"> |
| 3063 |
<label for="<?php echo self::$opt_center; ?>"><?php _e('<b class="chktitle">Centering:</b> Automatically center all your videos (not necessary if all your videos span the whole width of your blog).') ?></label> |
| 3064 |
</p> |
| 3065 |
<p> |
| 3066 |
<input name="<?php echo self::$opt_autoplay; ?>" id="<?php echo self::$opt_autoplay; ?>" <?php checked($all[self::$opt_autoplay], 1); ?> type="checkbox" class="checkbox"> |
| 3067 |
<label for="<?php echo self::$opt_autoplay; ?>"><?php _e('<b class="chktitle">Autoplay:</b> Automatically start playing your videos.') ?></label> |
| 3068 |
</p> |
| 3069 |
<p> |
| 3070 |
<input name="<?php echo self::$opt_iv_load_policy; ?>" id="<?php echo self::$opt_iv_load_policy; ?>" <?php checked($all[self::$opt_iv_load_policy], 1); ?> type="checkbox" class="checkbox"> |
| 3071 |
<label for="<?php echo self::$opt_iv_load_policy; ?>"><?php _e('<b class="chktitle">Annotations:</b> Show annotations by default.') ?></label> |
| 3072 |
</p> |
| 3073 |
<p> |
| 3074 |
<input name="<?php echo self::$opt_loop; ?>" id="<?php echo self::$opt_loop; ?>" <?php checked($all[self::$opt_loop], 1); ?> type="checkbox" class="checkbox"> |
| 3075 |
<label for="<?php echo self::$opt_loop; ?>"><?php _e('<b class="chktitle">Looping:</b> Loop all your videos.') ?></label> |
| 3076 |
</p> |
| 3077 |
<p> |
| 3078 |
<input name="<?php echo self::$opt_modestbranding; ?>" id="<?php echo self::$opt_modestbranding; ?>" <?php checked($all[self::$opt_modestbranding], 1); ?> type="checkbox" class="checkbox"> |
| 3079 |
<label for="<?php echo self::$opt_modestbranding; ?>"><?php _e('<b class="chktitle">Modest Branding:</b> No YouTube logo will be shown on the control bar. Instead, the logo will only show as a watermark when the video is paused/stopped.') ?></label> |
| 3080 |
</p> |
| 3081 |
<p> |
| 3082 |
<input name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>" <?php checked($all[self::$opt_rel], 1); ?> type="checkbox" class="checkbox"> |
| 3083 |
<label for="<?php echo self::$opt_rel; ?>"><?php _e('<b class="chktitle">Related Videos:</b> Show related and recommended videos during pause and at the end of playback.') ?></label> |
| 3084 |
</p> |
| 3085 |
<p> |
| 3086 |
<input name="<?php echo self::$opt_showinfo; ?>" id="<?php echo self::$opt_showinfo; ?>" <?php checked($all[self::$opt_showinfo], 1); ?> type="checkbox" class="checkbox"> |
| 3087 |
<label for="<?php echo self::$opt_showinfo; ?>"><?php _e('<b class="chktitle">Show Title:</b> Show the video title and other info.') ?></label> |
| 3088 |
</p> |
| 3089 |
<p> |
| 3090 |
<input name="<?php echo self::$opt_acctitle; ?>" id="<?php echo self::$opt_acctitle; ?>" <?php checked($all[self::$opt_acctitle], 1); ?> type="checkbox" class="checkbox"> |
| 3091 |
<label for="<?php echo self::$opt_acctitle; ?>"><b class="chktitle">Accessible Title Attributes: </b> Improve accessibility by using title attributes for screen reader support. It should help your site pass functional accessibility evaluations (FAE). </label> |
| 3092 |
</p> |
| 3093 |
<p> |
| 3094 |
<input name="<?php echo self::$opt_theme; ?>" id="<?php echo self::$opt_theme; ?>" <?php checked($all[self::$opt_theme], 'dark'); ?> type="checkbox" class="checkbox"> |
| 3095 |
<label for="<?php echo self::$opt_theme; ?>"><?php _e('<b class="chktitle strike">Dark Theme:</b> Use the dark theme (uncheck to use light theme). <b>Note: YouTube has deprecated this option and will always use the dark theme.</b>') ?></label> |
| 3096 |
</p> |
| 3097 |
<p> |
| 3098 |
<input name="<?php echo self::$opt_color; ?>" id="<?php echo self::$opt_color; ?>" <?php checked($all[self::$opt_color], 'red'); ?> type="checkbox" class="checkbox"> |
| 3099 |
<label for="<?php echo self::$opt_color; ?>"><?php _e('<b class="chktitle">Red Progress Bar:</b> Use the red progress bar (uncheck to use a white progress bar). Note: Using white will disable the modestbranding option.') ?></label> |
| 3100 |
</p> |
| 3101 |
<p> |
| 3102 |
<input name="<?php echo self::$opt_defaultdims; ?>" id="<?php echo self::$opt_defaultdims; ?>" <?php checked($all[self::$opt_defaultdims], 1); ?> type="checkbox" class="checkbox"> |
| 3103 |
<span id="boxdefaultdims"> |
| 3104 |
Width: <input type="text" name="<?php echo self::$opt_defaultwidth; ?>" id="<?php echo self::$opt_defaultwidth; ?>" value="<?php echo trim($all[self::$opt_defaultwidth]); ?>" class="textinput" style="width: 50px;"> |
| 3105 |
Height: <input type="text" name="<?php echo self::$opt_defaultheight; ?>" id="<?php echo self::$opt_defaultheight; ?>" value="<?php echo trim($all[self::$opt_defaultheight]); ?>" class="textinput" style="width: 50px;"> |
| 3106 |
</span> |
| 3107 |
|
| 3108 |
<label for="<?php echo self::$opt_defaultdims; ?>"><?php _e('<b class="chktitle">Default Dimensions:</b> Make your videos have a default size. (NOTE: Checking the responsive option will override this size setting) ') ?></label> |
| 3109 |
</p> |
| 3110 |
<p> |
| 3111 |
<input name="<?php echo self::$opt_responsive; ?>" id="<?php echo self::$opt_responsive; ?>" <?php checked($all[self::$opt_responsive], 1); ?> type="checkbox" class="checkbox"> |
| 3112 |
<label for="<?php echo self::$opt_responsive; ?>"><?php _e('<b class="chktitle">Responsive Video Sizing:</b> Make your videos responsive so that they dynamically fit in all screen sizes (smart phone, PC and tablet). NOTE: While this is checked, any custom hardcoded widths and heights you may have set will dynamically change too. <b>Do not check this if your theme already handles responsive video sizing.</b>') ?></label> |
| 3113 |
<div id="boxresponsive_all"> |
| 3114 |
<input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>1" value="1" <?php checked($all[self::$opt_responsive_all], 1); ?> > |
| 3115 |
<label for="<?php echo self::$opt_responsive_all; ?>1">Responsive for all YouTube videos</label> |
| 3116 |
<input type="radio" name="<?php echo self::$opt_responsive_all; ?>" id="<?php echo self::$opt_responsive_all; ?>0" value="0" <?php checked($all[self::$opt_responsive_all], 0); ?> > |
| 3117 |
<label for="<?php echo self::$opt_responsive_all; ?>0">Responsive for only videos embedded via this plugin</label> |
| 3118 |
</div> |
| 3119 |
</p> |
| 3120 |
<p> |
| 3121 |
<input name="<?php echo self::$opt_widgetfit; ?>" id="<?php echo self::$opt_widgetfit; ?>" <?php checked($all[self::$opt_widgetfit], 1); ?> type="checkbox" class="checkbox"> |
| 3122 |
<label for="<?php echo self::$opt_widgetfit; ?>"><?php _e('<b class="chktitle">Autofit Widget Videos:</b> Make each video that you embed in a widget area automatically fit the width of its container.') ?></label> |
| 3123 |
</p> |
| 3124 |
<p> |
| 3125 |
<input name="<?php echo self::$opt_playsinline; ?>" id="<?php echo self::$opt_playsinline; ?>" <?php checked($all[self::$opt_playsinline], 1); ?> type="checkbox" class="checkbox"> |
| 3126 |
<label for="<?php echo self::$opt_playsinline; ?>"> |
| 3127 |
<b class="chktitle">iOS Playback:</b> Check this to allow your embeds to play inline within your page when viewed on iOS (iPhone and iPad) browsers. Uncheck it to have iOS launch your embeds in fullscreen instead. |
| 3128 |
<em>Disclaimer: YouTube/Google has issues with this iOS related parameter, but we are providing it here in the event that they support it consistently.</em> |
| 3129 |
</label> |
| 3130 |
</p> |
| 3131 |
<p> |
| 3132 |
<input name="<?php echo self::$opt_origin; ?>" id="<?php echo self::$opt_origin; ?>" <?php checked($all[self::$opt_origin], 1); ?> type="checkbox" class="checkbox"> |
| 3133 |
<label for="<?php echo self::$opt_origin; ?>"><b class="chktitle">Extra Player Security: </b> |
| 3134 |
Add site origin information with each embed code as an extra security measure. In YouTube's/Google's own words, checking this option "protects against malicious third-party JavaScript being injected into your page and hijacking control of your YouTube player." We especially recommend checking it as it adds higher security than the built-in YouTube embedding method that comes with the current version of WordPress (i.e. oembed). |
| 3135 |
</label> |
| 3136 |
</p> |
| 3137 |
<p> |
| 3138 |
<input name="<?php echo self::$opt_nocookie; ?>" id="<?php echo self::$opt_nocookie; ?>" <?php checked($all[self::$opt_nocookie], 1); ?> type="checkbox" class="checkbox"> |
| 3139 |
<span id="boxnocookie"> |
| 3140 |
Uncheck this option if you are planning to embed galleries and playlists on your site. Furthermore, videos on mobile devices may have problems if you leave this checked. |
| 3141 |
</span> |
| 3142 |
<label for="<?php echo self::$opt_nocookie; ?>"> |
| 3143 |
<b class="chktitle">No Cookies:</b> Prevent YouTube from leaving tracking cookies on your visitors browsers unless they actual play the videos. This is coded to apply this behavior on links in your past post as well. <b>NOTE: Research shows that YouTube's support of Do Not Track can be error-prone. </b> |
| 3144 |
</label> |
| 3145 |
</p> |
| 3146 |
<p> |
| 3147 |
<input name="<?php echo self::$opt_controls; ?>" id="<?php echo self::$opt_controls; ?>" <?php checked($all[self::$opt_controls], 2); ?> type="checkbox" class="checkbox"> |
| 3148 |
<label for="<?php echo self::$opt_controls; ?>"><b class="chktitle">Show Controls:</b> Show the player's control bar. Unchecking this option creates a cleaner look but limits what your viewers can control (play position, volume, etc.).</label> |
| 3149 |
</p> |
| 3150 |
<p> |
| 3151 |
<input name="<?php echo self::$opt_autohide; ?>" id="<?php echo self::$opt_autohide; ?>" <?php checked($all[self::$opt_autohide], 1); ?> type="checkbox" class="checkbox"> |
| 3152 |
<label for="<?php echo self::$opt_autohide; ?>"><b class="chktitle strike">Autohide Controls:</b> Slide away the control bar after the video starts playing. It will automatically slide back in again if you mouse over the video. If you unchecked "Show Controls" above, then what you select for Autohide does not matter since there are no controls to even hide. |
| 3153 |
<strong>Note: YouTube has deprecated this option, and will always autohide the controls.</strong> |
| 3154 |
</label> |
| 3155 |
</p> |
| 3156 |
<p> |
| 3157 |
<input name="<?php echo self::$opt_defaultvol; ?>" id="<?php echo self::$opt_defaultvol; ?>" <?php checked($all[self::$opt_defaultvol], 1); ?> type="checkbox" class="checkbox"> |
| 3158 |
<label for="<?php echo self::$opt_defaultvol; ?>"> |
| 3159 |
<b class="chktitle">Volume Initialization: </b> |
| 3160 |
Set an initial volume level for all of your embedded videos. Check this and you'll see a <span class="vol-seeslider">slider</span> <span class="vol-seetextbox">textbox</span> for setting the start volume to a value between 0 (mute) and 100 (max) percent. Leaving it unchecked means you want the visitor's default behavior. This feature is experimental and is less predictable on a page with more than one embed. Read more about why you might want to <a href="<?php echo self::$epbase ?>/mute-volume-youtube-wordpress.aspx" target="_blank">initialize YouTube embed volume here »</a> |
| 3161 |
</label> |
| 3162 |
<span id="boxdefaultvol"> |
| 3163 |
Volume: <span class="vol-output"></span> <input min="0" max="100" step="1" type="text" name="<?php echo self::$opt_vol; ?>" id="<?php echo self::$opt_vol; ?>" value="<?php echo trim($all[self::$opt_vol]); ?>" > |
| 3164 |
</span> |
| 3165 |
</p> |
| 3166 |
|
| 3167 |
<p> |
| 3168 |
<input name="<?php echo self::$opt_cc_load_policy; ?>" id="<?php echo self::$opt_cc_load_policy; ?>" <?php checked($all[self::$opt_cc_load_policy], 1); ?> type="checkbox" class="checkbox"> |
| 3169 |
<label for="<?php echo self::$opt_cc_load_policy; ?>"><?php _e('<b class="chktitle">Closed Captions:</b> Turn on closed captions by default.') ?></label> |
| 3170 |
</p> |
| 3171 |
<p> |
| 3172 |
<input name="<?php echo self::$opt_dohl; ?>" id="<?php echo self::$opt_dohl; ?>" <?php checked($all[self::$opt_dohl], 1); ?> type="checkbox" class="checkbox"> |
| 3173 |
<label for="<?php echo self::$opt_dohl; ?>"><b class="chktitle">Player Localization / Internationalization: </b> |
| 3174 |
Automatically detect your site's default language (using get_locale) and set your YouTube embeds interface language so that it matches. Specifically, this will set the player's tooltips and caption track if your language is natively supported by YouTube. We suggest checking this if English is not your site's default language. <a href="<?php echo self::$epbase ?>/youtube-iso-639-1-language-codes.aspx" target="_blank">See here for more details »</a></label> |
| 3175 |
</p> |
| 3176 |
<p> |
| 3177 |
<input name="<?php echo self::$opt_playlistorder; ?>" id="<?php echo self::$opt_playlistorder; ?>" <?php checked($all[self::$opt_playlistorder], 1); ?> type="checkbox" class="checkbox"> |
| 3178 |
<label for="<?php echo self::$opt_playlistorder; ?>"> |
| 3179 |
<b class="chktitle">Playlist Ordering:</b> |
| 3180 |
Check this option if you want your playlists to begin with the latest added video by default. (Unchecking this will force playlists to always start with your selected specific video, even if you add videos to the playlist later). |
| 3181 |
Note that this is not for setting the thumbnail list order of galleries, just the standard playlist player that YouTube provides. |
| 3182 |
</label> |
| 3183 |
</p> |
| 3184 |
<p> |
| 3185 |
<label for="<?php echo self::$opt_not_live_content; ?>"> |
| 3186 |
<b class="chktitle">Default "Not Live" Content:</b> <sup class="orange">NEW</sup> |
| 3187 |
Below, enter what you would like to appear while your channel is not currently streaming live. |
| 3188 |
</label> |
| 3189 |
<?php |
| 3190 |
wp_editor( |
| 3191 |
wp_kses_post($all[self::$opt_not_live_content]), self::$opt_not_live_content, array('textarea_rows' => 5) |
| 3192 |
); |
| 3193 |
?> |
| 3194 |
</p> |
| 3195 |
|
| 3196 |
|
| 3197 |
</div> |
| 3198 |
|
| 3199 |
|
| 3200 |
|
| 3201 |
<div class="jumper" id="jumpwiz"></div> |
| 3202 |
<h3 class="sect">Visual YouTube Wizard <a href="#top" class="totop">▲ top</a></h3> |
| 3203 |
|
| 3204 |
<p> |
| 3205 |
While you're writing your post or page, you have the ability to search YouTube and insert videos, playlists, and even galleries right from your editor tab. |
| 3206 |
Simply click the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button found above |
| 3207 |
your editor to start the wizard (see image below to locate this button). There, you'll have several options for different types of embeds. |
| 3208 |
Each embed code will have an <span class="button-primary cuz">▼ Insert Into Editor</span> button that |
| 3209 |
you can click to directly embed the desired video link to your post without having to copy and paste. |
| 3210 |
</p> |
| 3211 |
<p> |
| 3212 |
<b class="orange">Even more options are available to PRO users!</b> If you download our PRO version, you can simply click the <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank" class="button-primary cuz">► Customize</a> button within the wizard to further personalize your embeds without having to enter special codes yourself. The customize button will allow you to easily override most of the above default options for that embed. |
| 3213 |
<br> |
| 3214 |
<br> |
| 3215 |
<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank" style="text-decoration: none;"><img style="width: 500px; margin: 0 auto; display: block;" src="<?php echo plugins_url('images/ssprowizard.png', __FILE__) ?>" ></a> |
| 3216 |
</p> |
| 3217 |
|
| 3218 |
|
| 3219 |
<div class="jumper" id="jumpprosettings"></div> |
| 3220 |
<div class="upgchecks"> |
| 3221 |
<h3 class="sect">Want the PRO Features?</h3> |
| 3222 |
<p class="orange">Below are descriptions for some of our PRO features for enhanced SEO and performance, once you purchase and install our separate PRO plugin (the PRO plugin works for all your past embed links).</p> |
| 3223 |
<p> |
| 3224 |
<img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgalleryall.jpg', __FILE__) ?>" /> |
| 3225 |
<select disabled> |
| 3226 |
<option value="">Gallery Style</option> |
| 3227 |
</select> |
| 3228 |
<label> |
| 3229 |
<b class="chktitle">Alternate Gallery Styling: </b> <span class="pronon">(PRO Users)</span> |
| 3230 |
Switch from the grid style of the FREE version to another gallery style. Right now, we provide a vertical (single column) and horizontal (single row) list style as alternatives to the grid, with more designs coming. These current alternatives were inspired by the standard YouTube playlist player's "table of contents," except our gallery's video lists are always visible and shown under the playing video. |
| 3231 |
<a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here »</a> |
| 3232 |
</label> |
| 3233 |
</p> |
| 3234 |
|
| 3235 |
<div class="hr"></div> |
| 3236 |
<p> |
| 3237 |
<img class="ssaltgallery" src="<?php echo plugins_url('images/ssverticallayout.png', __FILE__) ?>" /> |
| 3238 |
<input disabled type="checkbox" class="checkbox"> |
| 3239 |
<label> |
| 3240 |
<b class="chktitle">Show Gallery Descriptions (for vertical list styling): </b> <span class="pronon">(PRO Users)</span> |
| 3241 |
For the vertical list layout, this option will show full video descriptions (taken directly from YouTube.com) with each thumbnail. Note: these descriptions only apply the vertical list layout; other layouts don't have enough room. |
| 3242 |
</label> |
| 3243 |
</p> |
| 3244 |
<div class="hr"></div> |
| 3245 |
<p> |
| 3246 |
<img class="ssaltgallery" src="<?php echo plugins_url('images/ssaltgallerycircles.jpg', __FILE__) ?>" /> |
| 3247 |
<select disabled> |
| 3248 |
<option value="">Select Thumbnail Shape</option> |
| 3249 |
</select> |
| 3250 |
<label> |
| 3251 |
<b class="chktitle">Gallery Thumbnail Shape: </b> <span class="pronon">(PRO Users)</span> |
| 3252 |
Differentiate your gallery by showing different thumbnail shapes. We currently offer rectangle and circle shapes. |
| 3253 |
<a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">Read more here »</a> |
| 3254 |
</label> |
| 3255 |
</p> |
| 3256 |
|
| 3257 |
<div class="hr"></div> |
| 3258 |
<p> |
| 3259 |
<img class="sspopupplayer" src="<?php echo plugins_url('images/sspopupplayer.jpg', __FILE__) ?>" /> |
| 3260 |
<label> |
| 3261 |
<b class="chktitle">Gallery Video Display Mode: </b> <sup class="orange">NEW</sup> <span class="pronon">(PRO Users)</span> |
| 3262 |
Display your gallery videos simply above the thumbnails (default), or as a popup lightbox. |
| 3263 |
</label> |
| 3264 |
<br> |
| 3265 |
<input type="radio" disabled> Default <input type="radio" disabled> Popup lightbox |
| 3266 |
</p> |
| 3267 |
|
| 3268 |
<div class="hr"></div> |
| 3269 |
<p> |
| 3270 |
<input disabled type="checkbox" class="checkbox"> |
| 3271 |
<label> |
| 3272 |
<b class="chktitle">Faster Page Loads (Caching): </b> <span class="pronon">(PRO Users)</span> |
| 3273 |
Use embed caching to speed up your page loads. By default, WordPress needs to request information from YouTube.com's servers for every video you embed, every time a page is loaded. These data requests can add time to your total page load time. Turn on this feature to cache that data (instead of having to request for the same information every time you load a page). This should then make your pages that have videos load faster. It's been noted that even small speed ups in page load can help increase visitor engagement, retention, and conversions. Caching also makes galleries run faster. |
| 3274 |
</label> |
| 3275 |
<div class="indent-option"> |
| 3276 |
<label> |
| 3277 |
<b class="chktitle">Cache Lifetime (hours): </b> |
| 3278 |
<input disabled value="24" type="number"> |
| 3279 |
Tip: If your pages rarely change, you may wish to set this to a much higher value than 24 hours. |
| 3280 |
</label> |
| 3281 |
</div> |
| 3282 |
</p> |
| 3283 |
<div class="hr"></div> |
| 3284 |
|
| 3285 |
<p> |
| 3286 |
<input disabled type="checkbox" class="checkbox"> |
| 3287 |
<label> |
| 3288 |
<b class="chktitle">Video SEO Tags:</b> <span class="pronon">(PRO Users)</span> Update your YouTube embeds with Google, Bing, and Yahoo friendly schema markup for videos. |
| 3289 |
</label> |
| 3290 |
</p> |
| 3291 |
<div class="hr"></div> |
| 3292 |
<p> |
| 3293 |
<input disabled type="checkbox" class="checkbox"> |
| 3294 |
<label> |
| 3295 |
<b class="chktitle">Special Lazy-Loading Effects:</b> <span class="pronon">(PRO Users)</span> |
| 3296 |
Add eye-catching special effects that will make your YouTube embeds bounce, flip, pulse, or slide as they lazy load on the screen. Check this box to select your desired effect. <a target="_blank" href="<?php echo self::$epbase ?>/add-special-effects-to-youtube-embeds-in-wordpress.aspx">Read more here »</a> |
| 3297 |
</label> |
| 3298 |
</p> |
| 3299 |
<div class="hr"></div> |
| 3300 |
<p> |
| 3301 |
<input disabled type="checkbox" class="checkbox"> |
| 3302 |
<label> |
| 3303 |
<b class="chktitle">Facebook Open Graph Markup:</b> <span class="pronon">(PRO Users)</span> Include Facebook Open Graph markup with the videos you embed with this plugin. We follow the guidelines for videos as described here: <a href="https://developers.facebook.com/docs/sharing/webmasters#media" target="_blank">https://developers.facebook.com/docs/sharing/webmasters#media</a> |
| 3304 |
</label> |
| 3305 |
</p> |
| 3306 |
<div class="hr"></div> |
| 3307 |
<p> |
| 3308 |
<img class="ssfb" src="<?php echo plugins_url('images/youtube_thumbnail_sample.jpg', __FILE__) ?>" /> |
| 3309 |
<input disabled type="checkbox" class="checkbox"> |
| 3310 |
<label> |
| 3311 |
<b class="chktitle">Featured Thumbnail Images:</b> <span class="pronon">(PRO Users)</span> |
| 3312 |
Automatically grab the thumbnail image of the first video embedded in each post or page, and use it as the featured image. |
| 3313 |
All you have to do is click Update on a post or page and the plugin does the rest! |
| 3314 |
(Example shown on the right) <a target="_blank" href="<?php echo self::$epbase ?>/add-youtube-video-thumbnails-featured-image-wordpress.aspx">Read more here »</a> |
| 3315 |
</label> |
| 3316 |
</p> |
| 3317 |
<div class="hr"></div> |
| 3318 |
<p> |
| 3319 |
<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" target="_blank">Purchase and download the PRO plugin to get the above and several other features »</a> |
| 3320 |
</p> |
| 3321 |
<div class="clearboth"></div> |
| 3322 |
</div> |
| 3323 |
|
| 3324 |
<hr> |
| 3325 |
|
| 3326 |
|
| 3327 |
|
| 3328 |
|
| 3329 |
|
| 3330 |
|
| 3331 |
|
| 3332 |
<div class="jumper" id="jumpcompat"></div> |
| 3333 |
<h3 class="sect">Compatibility Settings <a href="#top" class="totop">▲ top</a></h3> |
| 3334 |
<p> |
| 3335 |
With tens of thousands of active users, our plugin may not work with every plugin out there. Below are some settings you may wish to try out. |
| 3336 |
</p> |
| 3337 |
<div class="ytindent chx"> |
| 3338 |
<p> |
| 3339 |
<input name="<?php echo self::$opt_old_script_method; ?>" id="<?php echo self::$opt_old_script_method; ?>" <?php checked($all[self::$opt_old_script_method], 1); ?> type="checkbox" class="checkbox"> |
| 3340 |
<label for="<?php echo self::$opt_old_script_method; ?>"> |
| 3341 |
<b class="chktitle">Use Legacy Scripts: </b> |
| 3342 |
This is a legacy option for users with theme issues that require backwards compatibility (v.10.5 or earlier). It may also help with caching plugin or CDN plugin issues. |
| 3343 |
</label> |
| 3344 |
</p> |
| 3345 |
<p> |
| 3346 |
<input name="<?php echo self::$opt_admin_off_scripts; ?>" id="<?php echo self::$opt_admin_off_scripts; ?>" <?php checked($all[self::$opt_admin_off_scripts], 1); ?> type="checkbox" class="checkbox"> |
| 3347 |
<label for="<?php echo self::$opt_admin_off_scripts; ?>"> |
| 3348 |
<b class="chktitle">Turn Off Scripts While Editing: </b> |
| 3349 |
Front-end editors and visual pagebuilders often run Javascript while you're in edit mode. Check this to turn off this plugin's Javascript during edit mode, if you see conflicts. |
| 3350 |
Don't worry, all other visitors to your site will still view your site normally. |
| 3351 |
</label> |
| 3352 |
</p> |
| 3353 |
<p> |
| 3354 |
<input name="<?php echo self::$opt_migrate; ?>" id="<?php echo self::$opt_migrate; ?>" <?php checked($all[self::$opt_migrate], 1); ?> type="checkbox" class="checkbox"> |
| 3355 |
<label for="<?php echo self::$opt_migrate; ?>"> |
| 3356 |
<b class="chktitle">Migrate Shortcodes: </b> Inherit shortcodes from other plugins. This is useful for when a plugin becomes deprecated, or you simply prefer this plugin's features. |
| 3357 |
</label> |
| 3358 |
<div id="boxmigratelist"> |
| 3359 |
<ul> |
| 3360 |
<li><input name="<?php echo self::$opt_migrate_embedplusvideo; ?>" id="<?php echo self::$opt_migrate_embedplusvideo; ?>" <?php checked($all[self::$opt_migrate_embedplusvideo], 1); ?> type="checkbox" class="checkbox"><label for="<?php echo self::$opt_migrate_embedplusvideo; ?>"><b>"YouTube Advanced Embed":</b> <code>[embedplusvideo]</code> shortcode</label></li> |
| 3361 |
<li><input name="<?php echo self::$opt_migrate_youtube; ?>" id="<?php echo self::$opt_migrate_youtube; ?>" <?php checked($all[self::$opt_migrate_youtube], 1); ?> type="checkbox" class="checkbox"><label for="<?php echo self::$opt_migrate_youtube; ?>"><b>"YouTube Embed":</b> <code>[youtube]</code> and <code>[youtube_video]</code> shortcodes</label></li> |
| 3362 |
<li class="smallnote orange" style="list-style: none;">This feature is beta. More shortcodes coming.</li> |
| 3363 |
</ul> |
| 3364 |
|
| 3365 |
</div> |
| 3366 |
</p> |
| 3367 |
<p> |
| 3368 |
<input name="<?php echo self::$opt_oldspacing; ?>" id="<?php echo self::$opt_oldspacing; ?>" <?php checked($all[self::$opt_oldspacing], 1); ?> type="checkbox" class="checkbox"> |
| 3369 |
<label for="<?php echo self::$opt_oldspacing; ?>"> |
| 3370 |
<b class="chktitle">Legacy Spacing:</b> Continue the spacing style from version 4.0 and older. Those versions required you to manually add spacing above and below your video. Unchecking this will automatically add the spacing. |
| 3371 |
</label> |
| 3372 |
</p> |
| 3373 |
<p> |
| 3374 |
<input name="<?php echo self::$opt_evselector_light; ?>" id="<?php echo self::$opt_evselector_light; ?>" <?php checked($all[self::$opt_evselector_light], 1); ?> type="checkbox" class="checkbox"> |
| 3375 |
<label for="<?php echo self::$opt_evselector_light; ?>"> |
| 3376 |
<b class="chktitle">Theme Video Problems: </b> |
| 3377 |
Check this option if you're having issues with autoplayed videos or background videos etc. that have been generated by your theme. |
| 3378 |
</label> |
| 3379 |
</p> |
| 3380 |
<p> |
| 3381 |
<input name="<?php echo self::$opt_stop_mobile_buffer; ?>" id="<?php echo self::$opt_stop_mobile_buffer; ?>" <?php checked($all[self::$opt_stop_mobile_buffer], 1); ?> type="checkbox" class="checkbox"> |
| 3382 |
<label for="<?php echo self::$opt_stop_mobile_buffer; ?>"> |
| 3383 |
<b class="chktitle">Mobile Autoplay Problems: </b> |
| 3384 |
Autoplay works for desktop, but mobile devices don't allow autoplay due to network carrier data charges. For mobile devices, this option may help the player to properly display the video for the visitor to click on. |
| 3385 |
</label> |
| 3386 |
</p> |
| 3387 |
<p> |
| 3388 |
<input name="<?php echo self::$opt_ajax_compat; ?>" id="<?php echo self::$opt_ajax_compat; ?>" <?php checked($all[self::$opt_ajax_compat], 1); ?> type="checkbox" class="checkbox"> |
| 3389 |
<label for="<?php echo self::$opt_ajax_compat; ?>"> |
| 3390 |
<b class="chktitle">Ajax Theme:</b> <sup class="orange">BETA</sup> |
| 3391 |
If you have a theme that loads pages with AJAX transitions, try checking this option. |
| 3392 |
</label> |
| 3393 |
</p> |
| 3394 |
<p> |
| 3395 |
<input name="<?php echo self::$opt_debugmode; ?>" id="<?php echo self::$opt_debugmode; ?>" <?php checked($all[self::$opt_debugmode], 1); ?> type="checkbox" class="checkbox"> |
| 3396 |
<label for="<?php echo self::$opt_debugmode; ?>"> |
| 3397 |
<b class="chktitle">Debug Mode: </b> If you ask for support, we may ask you to turn on debug mode here. |
| 3398 |
It may print out some diagnostic info so that we can help you solve your issue. |
| 3399 |
</label> |
| 3400 |
</p> |
| 3401 |
|
| 3402 |
</div> |
| 3403 |
|
| 3404 |
|
| 3405 |
|
| 3406 |
|
| 3407 |
<div class="jumper" id="jumpgallery"></div> |
| 3408 |
<h3 class="sect">Gallery Settings and Directions <a href="#top" class="totop">▲ top</a></h3> |
| 3409 |
<img class="ssgallery" src="<?php echo plugins_url('images/ssgallery.png', __FILE__) ?>"> |
| 3410 |
<p> |
| 3411 |
<a target="_blank" href="<?php echo self::$epbase ?>/responsive-youtube-playlist-channel-gallery-for-wordpress.aspx">You can now make playlist embeds (and channel-playlist embeds) have a gallery layout »</a>. <strong>First, you must obtain your YouTube API key</strong>. |
| 3412 |
Don't worry, it's an easy process. Just <a href="https://www.youtube.com/watch?v=LpKDFT40V0U" target="_blank">click this link »</a> and follow the video on that page to get your server API key. Since Google updates their API Key generation directions frequently, follow the general steps shown in the video. |
| 3413 |
Then paste your API key in the "YouTube API Key" box at the top of this screen, and click the "Save Changes" button. |
| 3414 |
</p> |
| 3415 |
|
| 3416 |
<p> |
| 3417 |
Below are the settings for galleries: |
| 3418 |
</p> |
| 3419 |
<div class="ytindent chx"> |
| 3420 |
|
| 3421 |
<p> |
| 3422 |
<label for="<?php echo self::$opt_gallery_pagesize; ?>"><b class="chktitle">Gallery Page Size:</b></label> |
| 3423 |
<select name="<?php echo self::$opt_gallery_pagesize; ?>" id="<?php echo self::$opt_gallery_pagesize; ?>" style="width: 60px;"> |
| 3424 |
<?php |
| 3425 |
$gps_val = intval(trim($all[self::$opt_gallery_pagesize])); |
| 3426 |
$gps_val = min($gps_val, 50); |
| 3427 |
for ($gps = 1; $gps <= 50; $gps++) |
| 3428 |
{ |
| 3429 |
?><option <?php echo $gps_val == $gps ? 'selected' : '' ?> value="<?php echo $gps ?>"><?php echo $gps ?></option> |
| 3430 |
<?php |
| 3431 |
} |
| 3432 |
?> |
| 3433 |
</select> |
| 3434 |
Enter how many thumbnails per page should be shown at once (YouTube allows a maximum of 50 per page). |
| 3435 |
</p> |
| 3436 |
<p> |
| 3437 |
<label for="<?php echo self::$opt_gallery_columns; ?>"><b class="chktitle">Number of Columns:</b></label> |
| 3438 |
<input name="<?php echo self::$opt_gallery_columns; ?>" id="<?php echo self::$opt_gallery_columns; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo trim($all[self::$opt_gallery_columns]); ?>"> |
| 3439 |
Enter how many thumbnails can fit per row. |
| 3440 |
</p> |
| 3441 |
<p> |
| 3442 |
<input name="<?php echo self::$opt_gallery_collapse_grid; ?>" id="<?php echo self::$opt_gallery_collapse_grid; ?>" <?php checked($all[self::$opt_gallery_collapse_grid], 1); ?> type="checkbox" class="checkbox"> |
| 3443 |
<label for="<?php echo self::$opt_gallery_collapse_grid; ?>"> |
| 3444 |
<b class="chktitle">Stack Thumbnails for Mobile:</b> Check this option to responsively stack thumbnails on smaller screens, for the grid layout. |
| 3445 |
</label> |
| 3446 |
<span id="box_collapse_grid"> |
| 3447 |
<?php |
| 3448 |
foreach ($all[self::$opt_gallery_collapse_grid_breaks] as $idx => $bpts) |
| 3449 |
{ |
| 3450 |
?> |
| 3451 |
On screens up to |
| 3452 |
<input type="number" name="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][max]'; ?>" |
| 3453 |
id="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][max]'; ?>" |
| 3454 |
value="<?php echo intval(trim($bpts['bp']['max'])); ?>" class="textinput" style="width: 70px;">px wide, stack thumbnails to 1 column. |
| 3455 |
<input type="hidden" name="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][cols]'; ?>" |
| 3456 |
id="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][cols]'; ?>" |
| 3457 |
value="<?php echo intval(trim($bpts['cols'])); ?>"> |
| 3458 |
<input type="hidden" name="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][min]'; ?>" |
| 3459 |
id="<?php echo self::$opt_gallery_collapse_grid_breaks . '[' . $idx . '][bp][min]'; ?>" |
| 3460 |
value="<?php echo intval(trim($bpts['bp']['min'])); ?>"> |
| 3461 |
<?php |
| 3462 |
} |
| 3463 |
?> |
| 3464 |
<span class="smallnote grey pad20"><br>Note: a common mobile screen width is 767 pixels.</span> |
| 3465 |
</span> |
| 3466 |
</p> |
| 3467 |
<p> |
| 3468 |
<input name="<?php echo self::$opt_gallery_showpaging; ?>" id="<?php echo self::$opt_gallery_showpaging; ?>" <?php checked($all[self::$opt_gallery_showpaging], 1); ?> type="checkbox" class="checkbox"> |
| 3469 |
<label for="<?php echo self::$opt_gallery_showpaging; ?>"><b class="chktitle">Show Pagination:</b> Show the Next/Previous buttons and page numbering.</label> |
| 3470 |
</p> |
| 3471 |
<p> |
| 3472 |
<input name="<?php echo self::$opt_gallery_customarrows; ?>" id="<?php echo self::$opt_gallery_customarrows; ?>" <?php checked($all[self::$opt_gallery_customarrows], 1); ?> type="checkbox" class="checkbox"> |
| 3473 |
<label for="<?php echo self::$opt_gallery_customarrows; ?>"> |
| 3474 |
<b class="chktitle">Custom Next/Previous Text:</b> If you want your gallery viewers to see something besides "Next" and "Prev" when browsing through thumbnails, enter your replacement text here. This feature can be quite useful for non-English sites. For example, a French site might replace Prev with Précédent and Next with Suivant. |
| 3475 |
</label> |
| 3476 |
<span id="boxcustomarrows"> |
| 3477 |
Previous Page: <input type="text" name="<?php echo self::$opt_gallery_customprev; ?>" id="<?php echo self::$opt_gallery_customprev; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_customprev])); ?>" class="textinput" style="width: 100px;"> |
| 3478 |
Next Page: <input type="text" name="<?php echo self::$opt_gallery_customnext; ?>" id="<?php echo self::$opt_gallery_customnext; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_customnext])); ?>" class="textinput" style="width: 100px;"> |
| 3479 |
</span> |
| 3480 |
</p> |
| 3481 |
<p> |
| 3482 |
<input name="<?php echo self::$opt_gallery_channelsub; ?>" id="<?php echo self::$opt_gallery_channelsub; ?>" <?php checked($all[self::$opt_gallery_channelsub], 1); ?> type="checkbox" class="checkbox"> |
| 3483 |
<label for="<?php echo self::$opt_gallery_channelsub; ?>"> |
| 3484 |
<b class="chktitle">Show Subscribe Button: </b> Are you the channel owner for all your galleries? Check this box to add a "Subscribe" button to all your galleries as shown below. This might help you convert your site's visitors to YouTube subscribers of your channel. |
| 3485 |
</label> |
| 3486 |
<span id="boxchannelsub"> |
| 3487 |
Channel URL: <input type="text" placeholder="https://www.youtube.com/user/YourChannel" name="<?php echo self::$opt_gallery_channelsublink; ?>" id="<?php echo self::$opt_gallery_channelsublink; ?>" value="<?php echo esc_url(trim($all[self::$opt_gallery_channelsublink])); ?>" class="textinput" style="width: 200px;"> |
| 3488 |
Button text: <input type="text" name="<?php echo self::$opt_gallery_channelsubtext; ?>" id="<?php echo self::$opt_gallery_channelsubtext; ?>" value="<?php echo esc_attr(trim($all[self::$opt_gallery_channelsubtext])); ?>" class="textinput" style="width: 200px;"> |
| 3489 |
</span> |
| 3490 |
</p> |
| 3491 |
<p><img class="sssubscribe" src="<?php echo plugins_url('images/sssubscribe.png', __FILE__) ?>"></p> |
| 3492 |
|
| 3493 |
<p> |
| 3494 |
<label for="<?php echo self::$opt_gallery_scrolloffset; ?>"><b class="chktitle">Scroll Offset:</b></label> |
| 3495 |
<input name="<?php echo self::$opt_gallery_scrolloffset; ?>" id="<?php echo self::$opt_gallery_scrolloffset; ?>" type="number" class="textinput" style="width: 60px;" value="<?php echo trim($all[self::$opt_gallery_scrolloffset]); ?>"> |
| 3496 |
After you click on a thumbnail, the gallery will automatically smooth scroll up to the actual player. If you need it to scroll a few pixels further, increase this number. |
| 3497 |
</p> |
| 3498 |
<p> |
| 3499 |
<input name="<?php echo self::$opt_gallery_showtitle; ?>" id="<?php echo self::$opt_gallery_showtitle; ?>" <?php checked($all[self::$opt_gallery_showtitle], 1); ?> type="checkbox" class="checkbox"> |
| 3500 |
<label for="<?php echo self::$opt_gallery_showtitle; ?>"><b class="chktitle">Show Thumbnail Title:</b> Show titles with each thumbnail.</label> |
| 3501 |
</p> |
| 3502 |
<p> |
| 3503 |
<input name="<?php echo self::$opt_gallery_autonext; ?>" id="<?php echo self::$opt_gallery_autonext; ?>" <?php checked($all[self::$opt_gallery_autonext], 1); ?> type="checkbox" class="checkbox"> |
| 3504 |
<label for="<?php echo self::$opt_gallery_autonext; ?>"><b class="chktitle">Automatic Continuous Play:</b> Automatically play the next video in the gallery as soon as the current video finished.</label> |
| 3505 |
</p> |
| 3506 |
<p> |
| 3507 |
<input name="<?php echo self::$opt_gallery_thumbplay; ?>" id="<?php echo self::$opt_gallery_thumbplay; ?>" <?php checked($all[self::$opt_gallery_thumbplay], 1); ?> type="checkbox" class="checkbox"> |
| 3508 |
<label for="<?php echo self::$opt_gallery_thumbplay; ?>"><b class="chktitle">Thumbnail Click Plays Video:</b> Clicking on a gallery thumbnail autoplays the video. Uncheck this and visitors must also click the video's play button after clicking the thumbnail.</label> |
| 3509 |
</p> |
| 3510 |
<div class="pad20"> |
| 3511 |
<p> |
| 3512 |
Ready to get started with an actual gallery? Just click the plugin wizard button and pick your desired gallery embedding choice. |
| 3513 |
</p> |
| 3514 |
<p><img class="sswizardbutton" src="<?php echo plugins_url('images/sswizardbutton.jpg', __FILE__) ?>"></p> |
| 3515 |
</div> |
| 3516 |
</div> |
| 3517 |
|
| 3518 |
|
| 3519 |
<div class="jumper" id="jumphowto"></div> |
| 3520 |
<h3 class="sect"> |
| 3521 |
Manually Embed a YouTube Video or Playlist <a class="smallnote" href="#jumpgallery">(For gallery directions, go here »)</a> |
| 3522 |
<a href="#top" class="totop">▲ top</a> |
| 3523 |
</h3> |
| 3524 |
<p> |
| 3525 |
<strong>We recommend using the wizard in your editor to embed.</strong> However, if you choose to manually embed code, follow the instructions below. |
| 3526 |
</p> |
| 3527 |
<p> |
| 3528 |
<b>For videos:</b> <i>Method 1 - </i> 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?<br> |
| 3529 |
<i>Method 2 - </i> 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 <code>[embedyt]...[/embedyt]</code> shortcode. <b>Tip for embedding videos on the same line:</b> 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). |
| 3530 |
</p> |
| 3531 |
<p> |
| 3532 |
<b>For galleries:</b> <a href="#jumpgallery">Click here</a> to scroll down to gallery settings and directions. |
| 3533 |
</p> |
| 3534 |
<p> |
| 3535 |
<b>For self-contained playlists:</b> Go to the page for the playlist that lists all of its videos (<a target="_blank" href="http://www.youtube.com/playlist?list=PL70DEC2B0568B5469">Example »</a>). 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 <code>[embedyt]...[/embedyt]</code> shortcode. |
| 3536 |
</p> |
| 3537 |
<p> |
| 3538 |
<b>For self-contained channel playlists:</b> At your editor, click on the <img style="vertical-align: text-bottom;" src="<?php echo plugins_url('images/wizbuttonbig.png', __FILE__) ?>"> wizard button and choose the option <i>Search for a video or channel to insert in my editor.</i> Then, click on the <i>channel playlist</i> option there (instead of <i>single video</i>). Search for the channel username and follow the rest of the directions there. |
| 3539 |
</p> |
| 3540 |
<p> |
| 3541 |
<b>Examples:</b><br><br> |
| 3542 |
<img style="width: 900px; height: auto;" class="shadow" src="<?php echo plugins_url('images/sshowto.png', __FILE__) ?>" /> |
| 3543 |
</p> |
| 3544 |
<p> |
| 3545 |
Always follow these rules for any URL: |
| 3546 |
</p> |
| 3547 |
<ul class="reglist"> |
| 3548 |
<li>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: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt]</code>)</li> |
| 3549 |
<li>Make sure the URL is <strong>not</strong> an active hyperlink (i.e., it should just be plain text). Otherwise, highlight the URL and click the "unlink" button in your editor: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/></li> |
| 3550 |
<li>Make sure you did <strong>not</strong> 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): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li> |
| 3551 |
<li>If you really want to align the video, try wrapping the link with the shortcode first. For example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt]</code> 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:<br> |
| 3552 |
<code>[embedyt]http://www.youtube.com/watch?v=ABCDEF[/embedyt] [embedyt]http://www.youtube.com/watch?v=GHIJK[/embedyt]</code> |
| 3553 |
</ul> |
| 3554 |
|
| 3555 |
|
| 3556 |
<h3 class="sect"> |
| 3557 |
<?php _e("How To Manually Override Defaults / Other Options") ?> <a href="#top" class="totop">▲ top</a> |
| 3558 |
</h3> |
| 3559 |
<p>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 '&'. |
| 3560 |
<br><span class="orange">PRO users: You can use the big <a href="<?php echo self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=protab' ?>" target="_blank">customize</a> buttons that you will see inside the wizard, instead of memorizing the following codes.</span> |
| 3561 |
<?php |
| 3562 |
_e('<ul>'); |
| 3563 |
_e("<li><strong>width</strong> - Sets the width of your player. If omitted, the default width will be the width of your theme's content.<em> Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&width=500</strong>&height=350</em></li>"); |
| 3564 |
_e("<li><strong>height</strong> - Sets the height of your player. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500<strong>&height=350</strong></em> </li>"); |
| 3565 |
_e("<li><strong>autoplay</strong> - Set this to 1 to autoplay the video (or 0 to play the video once). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&autoplay=1</strong></em> </li>"); |
| 3566 |
_e("<li><strong>cc_load_policy</strong> - Set this to 1 to turn on closed captioning (or 0 to leave them off). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&cc_load_policy=1</strong></em> </li>"); |
| 3567 |
_e("<li><strong>iv_load_policy</strong> - Set this to 3 to turn off annotations (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&iv_load_policy=3</strong></em> </li>"); |
| 3568 |
_e("<li><strong>loop</strong> - Set this to 1 to loop the video (or 0 to not loop). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&loop=1</strong></em> </li>"); |
| 3569 |
_e("<li><strong>modestbranding</strong> - Set this to 1 to remove the YouTube logo while playing (or 0 to show the logo). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&modestbranding=1</strong></em> </li>"); |
| 3570 |
_e("<li><strong>rel</strong> - Set this to 0 to not show related videos at the end of playing (or 1 to show them). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&rel=0</strong></em> </li>"); |
| 3571 |
_e("<li><strong>showinfo</strong> - Set this to 0 to hide the video title and other info (or 1 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&showinfo=0</strong></em> </li>"); |
| 3572 |
_e("<li><strong>color</strong> - 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. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&color=white</strong></em> </li>"); |
| 3573 |
_e("<li><strong>controls</strong> - Set this to 0 to completely hide the video controls (or 2 to show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&controls=0</strong></em> </li>"); |
| 3574 |
_e("<li><strong>autohide</strong> - Set this to 1 to slide away the control bar after the video starts playing. It will automatically slide back in again if you mouse over the video. (Set to 2 to always show it). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&autohide=1</strong></em> </li>"); |
| 3575 |
_e("<li><strong>playsinline</strong> - 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). <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&playsinline=1</strong></em> </li>"); |
| 3576 |
_e("<li><strong>origin</strong> - Set this to 1 to add the 'origin' parameter for extra JavaScript security. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA<strong>&origin=1</strong></em> </li>"); |
| 3577 |
_e('</ul>'); |
| 3578 |
|
| 3579 |
_e("<p>You can also start and end each individual video at particular times. Like the above, each option should begin with '&'</p>"); |
| 3580 |
_e('<ul>'); |
| 3581 |
_e("<li><strong>start</strong> - Sets the time (in seconds) to start the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&start=20</strong></em> </li>"); |
| 3582 |
_e("<li><strong>end</strong> - Sets the time (in seconds) to stop the video. <em>Example: http://www.youtube.com/watch?v=quwebVjAEJA&width=500&height=350<strong>&end=100</strong></em> </li>"); |
| 3583 |
_e('</ul>'); |
| 3584 |
?> |
| 3585 |
<div class="save-changes-follow"> <?php self::save_changes_button(isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y'); ?> </div> |
| 3586 |
</form> |
| 3587 |
<div class="jumper" id="jumppro"></div> |
| 3588 |
<div id="goprobox"> |
| 3589 |
<h3 class="sect"> |
| 3590 |
<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary" target="_blank">Want to go PRO? (Low Prices) »</a> |
| 3591 |
PRO users help keep new features coming and our coffee cups filled. Go PRO and get these perks in return: |
| 3592 |
</h3> |
| 3593 |
<div class="procol"> |
| 3594 |
<ul class="gopro"> |
| 3595 |
<li> |
| 3596 |
<img src="<?php echo plugins_url('images/iconcache.png', __FILE__) ?>"> |
| 3597 |
Faster Page Loads (Caching) |
| 3598 |
</li> |
| 3599 |
<li> |
| 3600 |
<img src="<?php echo plugins_url('images/iconwizard.png', __FILE__) ?>"> |
| 3601 |
Full Visual Embedding Wizard (Easily customize embeds without memorizing codes) |
| 3602 |
</li> |
| 3603 |
<li> |
| 3604 |
<img src="<?php echo plugins_url('images/icongallery.png', __FILE__) ?>"> |
| 3605 |
Alternate Gallery Styling (popup/lightbox player, slider and list layouts, and more) |
| 3606 |
</li> |
| 3607 |
<li> |
| 3608 |
<img src="<?php echo plugins_url('images/iconfx.png', __FILE__) ?>"> |
| 3609 |
Add eye-catching special effects as your videos load |
| 3610 |
</li> |
| 3611 |
<li> |
| 3612 |
<img src="<?php echo plugins_url('images/deletechecker.png', __FILE__) ?>"> |
| 3613 |
Deleted Video Checker (alerts you if YouTube deletes videos you embedded) |
| 3614 |
</li> |
| 3615 |
<li> |
| 3616 |
<img src="<?php echo plugins_url('images/globe.png', __FILE__) ?>"> |
| 3617 |
Alerts when visitors from different countries are blocked from viewing your embeds |
| 3618 |
</li> |
| 3619 |
<li> |
| 3620 |
<img src="<?php echo plugins_url('images/mobilecompat.png', __FILE__) ?>"> |
| 3621 |
Check if your embeds have restrictions that can block mobile viewing |
| 3622 |
</li> |
| 3623 |
|
| 3624 |
</ul> |
| 3625 |
</div> |
| 3626 |
<div class="procol" style="max-width: 465px;"> |
| 3627 |
<ul class="gopro"> |
| 3628 |
<li> |
| 3629 |
<img src="<?php echo plugins_url('images/videothumbs.png', __FILE__) ?>"> |
| 3630 |
Featured thumbnail images (just click 'Update') |
| 3631 |
</li> |
| 3632 |
<li> |
| 3633 |
<img src="<?php echo plugins_url('images/prioritysupport.png', __FILE__) ?>"> |
| 3634 |
Priority support (Puts your request in front) |
| 3635 |
</li> |
| 3636 |
<li> |
| 3637 |
<img src="<?php echo plugins_url('images/bulletgraph45.png', __FILE__) ?>"> |
| 3638 |
User-friendly video analytics dashboard |
| 3639 |
</li> |
| 3640 |
|
| 3641 |
<li id="fbstuff"> |
| 3642 |
<img src="<?php echo plugins_url('images/iconfb.png', __FILE__) ?>"> |
| 3643 |
Automatic Open Graph tagging for Facebook |
| 3644 |
</li> |
| 3645 |
<!-- <li> |
| 3646 |
<img src="<?php echo plugins_url('images/iconythealth.png', __FILE__) ?>"> |
| 3647 |
Instant YouTube embed diagnostic reports |
| 3648 |
</li> --> |
| 3649 |
<li> |
| 3650 |
<img src="<?php echo plugins_url('images/vseo.png', __FILE__) ?>"> |
| 3651 |
Automatic tagging for video SEO (will even work for your old embeds) |
| 3652 |
</li> |
| 3653 |
<li> |
| 3654 |
<img src="<?php echo plugins_url('images/iconvolume.png', __FILE__) ?>"> |
| 3655 |
Fine-Grained Volume Initialization – Individual video volume settings in the wizard |
| 3656 |
</li> |
| 3657 |
|
| 3658 |
<li> |
| 3659 |
<img src="<?php echo plugins_url('images/infinity.png', __FILE__) ?>"> |
| 3660 |
Unlimited PRO upgrades and downloads |
| 3661 |
</li> |
| 3662 |
<!-- <li> |
| 3663 |
<img src="<?php echo plugins_url('images/questionsale.png', __FILE__) ?>"> |
| 3664 |
What else? You tell us! |
| 3665 |
</li> --> |
| 3666 |
</ul> |
| 3667 |
</div> |
| 3668 |
<div style="clear: both;"></div> |
| 3669 |
<br> |
| 3670 |
<a href="<?php echo self::$epbase ?>/dashboard/pro-easy-video-analytics.aspx" class="button-primary brightpro" target="_blank">Click here to go PRO »</a> |
| 3671 |
</div> |
| 3672 |
|
| 3673 |
<div class="jumper" id="jumpsupport"></div> |
| 3674 |
<div id="nonprosupport"> |
| 3675 |
<h3 class="bold">Support tips for all users (Free and PRO)</h3> |
| 3676 |
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: |
| 3677 |
<ul class="reglist"> |
| 3678 |
<li>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: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK&width=400&height=250[/embedyt]</code>)</li> |
| 3679 |
<li>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: <img src="<?php echo plugins_url('images/unlink.png', __FILE__) ?>"/>.</li> |
| 3680 |
<li>Make sure you did <strong>not</strong> 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): <img src="<?php echo plugins_url('images/erase.png', __FILE__) ?>"/></li> |
| 3681 |
<li>Try wrapping the URL with the <code>[embedyt]...[/embedyt]</code> shortcode. For example: <code>[embedyt]http://www.youtube.com/watch?v=ABCDEFGHIJK[/embedyt]</code> 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:<br> |
| 3682 |
<code>[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]</code> |
| 3683 |
<br> 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) |
| 3684 |
</li> |
| 3685 |
<li>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.</li> |
| 3686 |
<li>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.</li> |
| 3687 |
<li>If your videos always appear full size, try turning off "Responsive video sizing."</li> |
| 3688 |
<li>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.</li> |
| 3689 |
</ul> |
| 3690 |
<p> |
| 3691 |
Deactivating the No Cookies option has also been proven to solve player errors. |
| 3692 |
</p> |
| 3693 |
<p> |
| 3694 |
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. <a href="https://www.youtube.com/subscription_center?add_user=EmbedPlus" target="_blank">Subscribe for tips and updates here »</a> |
| 3695 |
</p> |
| 3696 |
</div> |
| 3697 |
<br> |
| 3698 |
|
| 3699 |
<div class="ytnav"> |
| 3700 |
<a href="#jumpapikey">API Key</a> |
| 3701 |
<a href="#jumpdefaults">Defaults</a> |
| 3702 |
<a href="#jumpwiz">Visual Wizard</a> |
| 3703 |
<a href="#jumpcompat">Compatibility</a> |
| 3704 |
<a href="#jumpgallery">Galleries</a> |
| 3705 |
<a target="_blank" href="<?php echo self::$epbase . "/dashboard/pro-easy-video-analytics.aspx?ref=protab" ?>" style="border-color: #888888;">Upgrade?</a> |
| 3706 |
<a href="#jumphowto">Embed Manually</a> |
| 3707 |
<a href="#jumpsupport">Support</a> |
| 3708 |
</div> |
| 3709 |
|
| 3710 |
</div> |
| 3711 |
<script type="text/javascript"> |
| 3712 |
|
| 3713 |
function savevalidate() |
| 3714 |
{ |
| 3715 |
var valid = true; |
| 3716 |
var alertmessage = ''; |
| 3717 |
if (jQuery("#<?php echo self::$opt_defaultdims; ?>").is(":checked")) |
| 3718 |
{ |
| 3719 |
if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_defaultwidth; ?>").val())) && |
| 3720 |
jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_defaultheight; ?>").val())))) |
| 3721 |
{ |
| 3722 |
alertmessage += "Please enter valid numbers for default height and width, or uncheck the option."; |
| 3723 |
jQuery("#boxdefaultdims input").css("background-color", "#ffcccc").css("border", "2px solid #000000"); |
| 3724 |
valid = false; |
| 3725 |
} |
| 3726 |
} |
| 3727 |
|
| 3728 |
if (jQuery("#<?php echo self::$opt_gallery_customarrows; ?>").is(":checked")) |
| 3729 |
{ |
| 3730 |
if (!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_customprev; ?>").val()) || |
| 3731 |
!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_customnext; ?>").val())) |
| 3732 |
{ |
| 3733 |
alertmessage += "Please enter valid text for both the custom gallery Prev and Next buttons, or uncheck the option."; |
| 3734 |
jQuery("#boxcustomarrows input").css("background-color", "#ffcccc").css("border", "2px solid #000000"); |
| 3735 |
valid = false; |
| 3736 |
} |
| 3737 |
} |
| 3738 |
|
| 3739 |
|
| 3740 |
if (jQuery("#<?php echo self::$opt_gallery_channelsub; ?>").is(":checked")) |
| 3741 |
{ |
| 3742 |
if (!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_channelsublink; ?>").val()) || |
| 3743 |
!jQuery.trim(jQuery("#<?php echo self::$opt_gallery_channelsubtext; ?>").val())) |
| 3744 |
{ |
| 3745 |
alertmessage += "Please enter valid text for both the subscribe text and subscribe URL, or uncheck the option."; |
| 3746 |
jQuery("#boxchannelsub input").css("background-color", "#ffcccc").css("border", "2px solid #000000"); |
| 3747 |
valid = false; |
| 3748 |
} |
| 3749 |
} |
| 3750 |
|
| 3751 |
|
| 3752 |
if (jQuery("#<?php echo self::$opt_gallery_collapse_grid; ?>").is(":checked")) |
| 3753 |
{ |
| 3754 |
var emptyStacks = []; |
| 3755 |
jQuery("#box_collapse_grid input").each(function () { |
| 3756 |
var val = jQuery(this).val(); |
| 3757 |
if (jQuery.trim(val) === '' || !jQuery.isNumeric(val)) |
| 3758 |
{ |
| 3759 |
emptyStacks.push(this); |
| 3760 |
jQuery(this).css("background-color", "#ffcccc").css("outline", "2px solid #000000"); |
| 3761 |
} |
| 3762 |
}); |
| 3763 |
if (emptyStacks.length) |
| 3764 |
{ |
| 3765 |
alertmessage += "Please enter a valid number for the gallery stacking screen width."; |
| 3766 |
valid = false; |
| 3767 |
} |
| 3768 |
} |
| 3769 |
|
| 3770 |
|
| 3771 |
|
| 3772 |
if (jQuery("#<?php echo self::$opt_defaultvol; ?>").is(":checked")) |
| 3773 |
{ |
| 3774 |
if (!(jQuery.isNumeric(jQuery.trim(jQuery("#<?php echo self::$opt_vol; ?>").val())))) |
| 3775 |
{ |
| 3776 |
alertmessage += "Please enter a number between 0 and 100 for the default volume, or uncheck the option."; |
| 3777 |
jQuery("#boxdefaultvol input").css("background-color", "#ffcccc").css("border", "2px solid #000000"); |
| 3778 |
valid = false; |
| 3779 |
} |
| 3780 |
} |
| 3781 |
|
| 3782 |
if (!valid) |
| 3783 |
{ |
| 3784 |
alert(alertmessage); |
| 3785 |
} |
| 3786 |
return valid; |
| 3787 |
} |
| 3788 |
|
| 3789 |
|
| 3790 |
jQuery(document).ready(function ($) { |
| 3791 |
jQuery('#<?php echo self::$opt_defaultdims; ?>').change(function () |
| 3792 |
{ |
| 3793 |
if (jQuery(this).is(":checked")) |
| 3794 |
{ |
| 3795 |
jQuery("#boxdefaultdims").show(500); |
| 3796 |
} else |
| 3797 |
{ |
| 3798 |
jQuery("#boxdefaultdims").hide(500); |
| 3799 |
} |
| 3800 |
|
| 3801 |
}); |
| 3802 |
jQuery('#<?php echo self::$opt_gallery_customarrows; ?>').change(function () |
| 3803 |
{ |
| 3804 |
if (jQuery(this).is(":checked")) |
| 3805 |
{ |
| 3806 |
jQuery("#boxcustomarrows").show(500); |
| 3807 |
} else |
| 3808 |
{ |
| 3809 |
jQuery("#boxcustomarrows").hide(500); |
| 3810 |
} |
| 3811 |
|
| 3812 |
}); |
| 3813 |
jQuery('#<?php echo self::$opt_gallery_collapse_grid; ?>').change(function () |
| 3814 |
{ |
| 3815 |
if (jQuery(this).is(":checked")) |
| 3816 |
{ |
| 3817 |
jQuery("#box_collapse_grid").show(500); |
| 3818 |
} else |
| 3819 |
{ |
| 3820 |
jQuery("#box_collapse_grid").hide(500); |
| 3821 |
} |
| 3822 |
}); |
| 3823 |
jQuery('#<?php echo self::$opt_restrict_wizard; ?>').change(function () |
| 3824 |
{ |
| 3825 |
if (jQuery(this).is(":checked")) |
| 3826 |
{ |
| 3827 |
jQuery("#box_restrict_wizard").show(500); |
| 3828 |
} else |
| 3829 |
{ |
| 3830 |
jQuery("#box_restrict_wizard").hide(500); |
| 3831 |
} |
| 3832 |
}); |
| 3833 |
|
| 3834 |
jQuery('#<?php echo self::$opt_gallery_channelsub; ?>').change(function () |
| 3835 |
{ |
| 3836 |
if (jQuery(this).is(":checked")) |
| 3837 |
{ |
| 3838 |
jQuery("#boxchannelsub").show(500); |
| 3839 |
} else |
| 3840 |
{ |
| 3841 |
jQuery("#boxchannelsub").hide(500); |
| 3842 |
} |
| 3843 |
|
| 3844 |
}); |
| 3845 |
jQuery('#<?php echo self::$opt_responsive; ?>').change(function () |
| 3846 |
{ |
| 3847 |
if (jQuery(this).is(":checked")) |
| 3848 |
{ |
| 3849 |
jQuery("#boxresponsive_all").show(500); |
| 3850 |
} else |
| 3851 |
{ |
| 3852 |
jQuery("#boxresponsive_all").hide(500); |
| 3853 |
} |
| 3854 |
}); |
| 3855 |
jQuery('#<?php echo self::$opt_migrate; ?>').change(function () |
| 3856 |
{ |
| 3857 |
if (jQuery(this).is(":checked")) |
| 3858 |
{ |
| 3859 |
jQuery("#boxmigratelist").show(500); |
| 3860 |
} else |
| 3861 |
{ |
| 3862 |
jQuery("#boxmigratelist").hide(500); |
| 3863 |
} |
| 3864 |
}); |
| 3865 |
jQuery('#<?php echo self::$opt_nocookie; ?>').change(function () |
| 3866 |
{ |
| 3867 |
if (jQuery(this).is(":checked")) |
| 3868 |
{ |
| 3869 |
jQuery("#boxnocookie").show(500); |
| 3870 |
} else |
| 3871 |
{ |
| 3872 |
jQuery("#boxnocookie").hide(500); |
| 3873 |
} |
| 3874 |
|
| 3875 |
}); |
| 3876 |
jQuery('#<?php echo self::$opt_defaultvol; ?>').change(function () |
| 3877 |
{ |
| 3878 |
if (jQuery(this).is(":checked")) |
| 3879 |
{ |
| 3880 |
jQuery("#boxdefaultvol").show(500); |
| 3881 |
} else |
| 3882 |
{ |
| 3883 |
jQuery("#boxdefaultvol").hide(500); |
| 3884 |
} |
| 3885 |
|
| 3886 |
}); |
| 3887 |
var rangedetect = document.createElement("input"); |
| 3888 |
rangedetect.setAttribute("type", "range"); |
| 3889 |
var canrange = rangedetect.type !== "text"; |
| 3890 |
//canrange = false; |
| 3891 |
if (canrange) |
| 3892 |
{ |
| 3893 |
$("input#vol").prop("type", "range").addClass("vol-range").on("input change", function () { |
| 3894 |
$('.vol-output').text($(this).val() > 0 ? $(this).val() + '%' : 'Mute'); |
| 3895 |
}); |
| 3896 |
$('.vol-output').css("display", "inline-block").text($("input#vol").val() > 0 ? $("input#vol").val() + '%' : 'Mute'); |
| 3897 |
$('.vol-seeslider').show(); |
| 3898 |
$('.vol-seetextbox').hide(); |
| 3899 |
} else |
| 3900 |
{ |
| 3901 |
$("input#vol").width(40); |
| 3902 |
} |
| 3903 |
|
| 3904 |
});</script> |
| 3905 |
<?php |
| 3906 |
if (function_exists('add_thickbox')) |
| 3907 |
{ |
| 3908 |
add_thickbox(); |
| 3909 |
} |
| 3910 |
?> |
| 3911 |
|
| 3912 |
<?php |
| 3913 |
} |
| 3914 |
|
| 3915 |
public static function save_changes_button($submitted) |
| 3916 |
{ |
| 3917 |
$button_label = 'Save Changes'; |
| 3918 |
if ($submitted) |
| 3919 |
{ |
| 3920 |
$button_label = 'Changes Saved'; |
| 3921 |
?> |
| 3922 |
<script type="text/javascript"> |
| 3923 |
jQuery(document).ready(function () { |
| 3924 |
setTimeout(function () { |
| 3925 |
jQuery('input.ytprefs-submit').val('Save Changes'); |
| 3926 |
}, 3000); |
| 3927 |
});</script> |
| 3928 |
<?php |
| 3929 |
} |
| 3930 |
?> |
| 3931 |
<p class="submit"> |
| 3932 |
<input type="submit" onclick="return savevalidate();" name="Submit" class="button-primary ytprefs-submit" value="<?php _e($button_label) ?>" /> |
| 3933 |
<em>If you're using a separate caching plugin and you do not see your changes after saving, you might want to reset your cache.</em> |
| 3934 |
</p> |
| 3935 |
<?php |
| 3936 |
} |
| 3937 |
|
| 3938 |
public static function ytprefsscript() |
| 3939 |
{ |
| 3940 |
$loggedin = current_user_can('edit_posts'); |
| 3941 |
if (!($loggedin && self::$alloptions[self::$opt_admin_off_scripts])) |
| 3942 |
{ |
| 3943 |
wp_enqueue_style( |
| 3944 |
'__EPYT__style', plugins_url('styles/ytprefs' . self::$min . '.css', __FILE__) |
| 3945 |
); |
| 3946 |
$cols = floatval(self::$alloptions[self::$opt_gallery_columns]); |
| 3947 |
$cols = $cols == 0 ? 3.0 : $cols; |
| 3948 |
$colwidth = 100.0 / $cols; |
| 3949 |
$custom_css = " |
| 3950 |
.epyt-gallery-thumb { |
| 3951 |
width: " . round($colwidth, 3) . "%; |
| 3952 |
} |
| 3953 |
"; |
| 3954 |
|
| 3955 |
if (self::$alloptions[self::$opt_gallery_collapse_grid] == 1) |
| 3956 |
{ |
| 3957 |
foreach (self::$alloptions[self::$opt_gallery_collapse_grid_breaks] as $idx => $bpts) |
| 3958 |
{ |
| 3959 |
$custom_css .= " |
| 3960 |
@media (min-width:" . $bpts['bp']['min'] . "px) and (max-width: " . $bpts['bp']['max'] . "px) { |
| 3961 |
.epyt-gallery-rowbreak { |
| 3962 |
display: none; |
| 3963 |
} |
| 3964 |
.epyt-gallery-allthumbs[class*=\"epyt-cols\"] .epyt-gallery-thumb { |
| 3965 |
width: " . round(100.0 / intval($bpts['cols']), 3) . "% !important; |
| 3966 |
} |
| 3967 |
}"; |
| 3968 |
} |
| 3969 |
} |
| 3970 |
|
| 3971 |
wp_add_inline_style('__EPYT__style', $custom_css); |
| 3972 |
|
| 3973 |
wp_enqueue_script('__ytprefs__', plugins_url('scripts/ytprefs' . self::$min . '.js', __FILE__), array('jquery')); |
| 3974 |
|
| 3975 |
if (self::$alloptions[self::$opt_old_script_method] != 1) |
| 3976 |
{ |
| 3977 |
$my_script_vars = array( |
| 3978 |
'ajaxurl' => admin_url('admin-ajax.php'), |
| 3979 |
'security' => wp_create_nonce('embedplus-nonce'), |
| 3980 |
'gallery_scrolloffset' => intval(self::$alloptions[self::$opt_gallery_scrolloffset]), |
| 3981 |
'eppathtoscripts' => plugins_url('scripts/', __FILE__), |
| 3982 |
'epresponsiveselector' => self::get_responsiveselector(), |
| 3983 |
'epdovol' => true, |
| 3984 |
'version' => self::$alloptions[self::$opt_version], |
| 3985 |
'evselector' => self::get_evselector(), |
| 3986 |
'ajax_compat' => self::$alloptions[self::$opt_ajax_compat] == '1' ? true : false, |
| 3987 |
'stopMobileBuffer' => self::$alloptions[self::$opt_stop_mobile_buffer] == '1' ? true : false |
| 3988 |
); |
| 3989 |
|
| 3990 |
wp_localize_script('__ytprefs__', '_EPYT_', $my_script_vars); |
| 3991 |
} |
| 3992 |
|
| 3993 |
////////////////////// cloudflare accomodation |
| 3994 |
//add_filter('script_loader_tag', array(get_class(), 'set_cfasync'), 10, 3); |
| 3995 |
} |
| 3996 |
} |
| 3997 |
|
| 3998 |
public static function set_cfasync($tag, $handle, $src) |
| 3999 |
{ |
| 4000 |
if ('__ytprefs__' !== $handle) |
| 4001 |
{ |
| 4002 |
return $tag; |
| 4003 |
} |
| 4004 |
return str_replace('<script', '<script data-cfasync="false" ', $tag); |
| 4005 |
} |
| 4006 |
|
| 4007 |
public static function get_evselector() |
| 4008 |
{ |
| 4009 |
$evselector = 'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]'; |
| 4010 |
|
| 4011 |
if (self::$alloptions[self::$opt_evselector_light] == 1) |
| 4012 |
{ |
| 4013 |
$evselector = 'iframe.__youtube_prefs__[src]'; |
| 4014 |
} |
| 4015 |
|
| 4016 |
return $evselector; |
| 4017 |
} |
| 4018 |
|
| 4019 |
public static function get_responsiveselector() |
| 4020 |
{ |
| 4021 |
$responsiveselector = '[]'; |
| 4022 |
if (self::$alloptions[self::$opt_widgetfit] == 1) |
| 4023 |
{ |
| 4024 |
$responsiveselector = '["iframe.__youtube_prefs_widget__"]'; |
| 4025 |
} |
| 4026 |
if (self::$alloptions[self::$opt_responsive] == 1) |
| 4027 |
{ |
| 4028 |
if (self::$alloptions[self::$opt_responsive_all] == 1) |
| 4029 |
{ |
| 4030 |
$responsiveselector = '["iframe[src*=\'youtube.com\']","iframe[src*=\'youtube-nocookie.com\']","iframe[data-ep-src*=\'youtube.com\']","iframe[data-ep-src*=\'youtube-nocookie.com\']","iframe[data-ep-gallerysrc*=\'youtube.com\']"]'; |
| 4031 |
} |
| 4032 |
else |
| 4033 |
{ |
| 4034 |
$responsiveselector = '["iframe.__youtube_prefs__"]'; |
| 4035 |
} |
| 4036 |
} |
| 4037 |
return $responsiveselector; |
| 4038 |
} |
| 4039 |
|
| 4040 |
public static function admin_enqueue_scripts($hook) |
| 4041 |
{ |
| 4042 |
wp_enqueue_style('embedplusyoutube', plugins_url() . '/youtube-embed-plus/scripts/embedplus_mce' . self::$min . '.css'); |
| 4043 |
wp_enqueue_script('__ytprefs_admin__', plugins_url('scripts/ytprefs-admin' . self::$min . '.js', __FILE__), array('jquery'), self::$version, false); |
| 4044 |
$admin_script_vars = array( |
| 4045 |
'wpajaxurl' => admin_url('admin-ajax.php') |
| 4046 |
//'epblogwidth' => self::get_blogwidth(), |
| 4047 |
//'epprokey' => self::$alloptions[self::$opt_pro], |
| 4048 |
//'epbasesite' => self::$epbase, |
| 4049 |
//'epversion' => self::$version, |
| 4050 |
//'myytdefaults' => http_build_query(self::$alloptions), |
| 4051 |
//'eppluginadminurl' => admin_url('admin.php?page=youtube-my-preferences') |
| 4052 |
); |
| 4053 |
wp_localize_script('__ytprefs_admin__', '_EPYTA_', $admin_script_vars); |
| 4054 |
|
| 4055 |
|
| 4056 |
|
| 4057 |
|
| 4058 |
if ((get_bloginfo('version') >= '3.3') && self::custom_admin_pointers_check()) |
| 4059 |
{ |
| 4060 |
add_action('admin_print_footer_scripts', array(get_class(), 'custom_admin_pointers_footer')); |
| 4061 |
wp_enqueue_script('wp-pointer'); |
| 4062 |
wp_enqueue_style('wp-pointer'); |
| 4063 |
} |
| 4064 |
|
| 4065 |
if (self::$alloptions['glance'] == 1) |
| 4066 |
{ |
| 4067 |
add_action('admin_print_footer_scripts', array(get_class(), 'glance_script')); |
| 4068 |
} |
| 4069 |
|
| 4070 |
if ($hook == self::$wizard_hook) |
| 4071 |
{ |
| 4072 |
wp_enqueue_style('__ytprefs_admin__wizard_ui', plugins_url() . '/youtube-embed-plus/styles/jquery-ui' . self::$min . '.css'); |
| 4073 |
wp_enqueue_style('__ytprefs_admin__wizard', plugins_url() . '/youtube-embed-plus/styles/ytprefs-wizard' . self::$min . '.css'); |
| 4074 |
wp_enqueue_script('__ytprefs_admin__wizard_script', plugins_url('scripts/ytprefs-wizard' . self::$min . '.js', __FILE__), array('jquery-ui-accordion', 'jquery-ui-tabs')); |
| 4075 |
} |
| 4076 |
} |
| 4077 |
|
| 4078 |
public static function get_blogwidth() |
| 4079 |
{ |
| 4080 |
$blogwidth = null; |
| 4081 |
try |
| 4082 |
{ |
| 4083 |
$embed_size_w = intval(get_option('embed_size_w')); |
| 4084 |
|
| 4085 |
global $content_width; |
| 4086 |
if (empty($content_width)) |
| 4087 |
{ |
| 4088 |
$content_width = $GLOBALS['content_width']; |
| 4089 |
} |
| 4090 |
|
| 4091 |
$blogwidth = $embed_size_w ? $embed_size_w : ($content_width ? $content_width : 450); |
| 4092 |
} |
| 4093 |
catch (Exception $ex) |
| 4094 |
{ |
| 4095 |
|
| 4096 |
} |
| 4097 |
|
| 4098 |
$blogwidth = preg_replace('/\D/', '', $blogwidth); //may have px |
| 4099 |
|
| 4100 |
return $blogwidth; |
| 4101 |
} |
| 4102 |
|
| 4103 |
} |
| 4104 |
|
| 4105 |
$youtubeplgplus = new YouTubePrefs(); |
| 4106 |
|
| 4107 |
|
| 4108 |
|
| 4109 |
|
| 4110 |
|