YouTube - Version 13.1.2.5

Version Description

Download this release

Release Info

Developer embedplus
Plugin Icon 128x128 YouTube
Version 13.1.2.5
Comparing to
See all releases

Code changes from version 13.1.2.4 to 13.1.2.5

Files changed (4) hide show
  1. readme.txt +5 -1
  2. scripts/fitvids.js +8 -0
  3. scripts/fitvids.min.js +1 -1
  4. youtube.php +377 -293
readme.txt CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Embed Plus for YouTube - Gallery, Channel, Playlist, Live Stream
4
  Tags: youtube gallery, video gallery, youtube channel, youtube live, live stream
5
  Requires at least: 4.0
6
  Tested up to: 5.3
7
- Stable tag: 13.1.2.4
8
  License: GPLv3 or later
9
 
10
  YouTube Embed WordPress Plugin. Embed a responsive video, YouTube channel gallery, playlist gallery, or YouTube.com live stream (with GDPR options)
@@ -147,6 +147,10 @@ You can also start and end each individual video at particular times. Like the a
147
 
148
  == Changelog ==
149
 
 
 
 
 
150
  = Embed Plus for YouTube WordPress Plugin 13.1.2.4 =
151
  * Pagination and autonext allow the current video to play
152
  * Pagination on mobile fix
4
  Tags: youtube gallery, video gallery, youtube channel, youtube live, live stream
5
  Requires at least: 4.0
6
  Tested up to: 5.3
7
+ Stable tag: 13.1.2.5
8
  License: GPLv3 or later
9
 
10
  YouTube Embed WordPress Plugin. Embed a responsive video, YouTube channel gallery, playlist gallery, or YouTube.com live stream (with GDPR options)
147
 
148
  == Changelog ==
149
 
150
+ = Embed Plus for YouTube WordPress Plugin 13.1.2.5 =
151
+ * Improve responsive sizing aspect ratio in widgets
152
+ * Fix issue: some users receive 403 error when saving
153
+
154
  = Embed Plus for YouTube WordPress Plugin 13.1.2.4 =
155
  * Pagination and autonext allow the current video to play
156
  * Pagination on mobile fix
scripts/fitvids.js CHANGED
@@ -48,6 +48,14 @@ var epdofitvids = epdofitvids || function ($)
48
  if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) {
49
  return;
50
  }
 
 
 
 
 
 
 
 
51
  var height = (this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10)))) ? parseInt($this.attr('height'), 10) : $this.height(),
52
  width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
53
  aspectRatio = height / width;
48
  if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) {
49
  return;
50
  }
51
+ if ($this.is('[data-origwidth]:not([width])'))
52
+ {
53
+ $this.attr('width', $this.data('origwidth'));
54
+ }
55
+ if ($this.is('[data-origheight]:not([height])'))
56
+ {
57
+ $this.attr('height', $this.data('origheight'));
58
+ }
59
  var height = (this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10)))) ? parseInt($this.attr('height'), 10) : $this.height(),
60
  width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
61
  aspectRatio = height / width;
scripts/fitvids.min.js CHANGED
@@ -1,2 +1,2 @@
1
 
2
- var epdofitvids=epdofitvids||function(a){a.fn.fitVidsEP=function(b){if(_EPYT_.epresponsiveselector.constructor!==Array){_EPYT_.epresponsiveselector=JSON.parse(_EPYT_.epresponsiveselector)}var c={customSelector:null};if(!document.getElementById("fit-vids-style")){var f=document.createElement("div"),d=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0],e="&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>";f.className="fit-vids-style";f.id="fit-vids-style";f.style.display="none";f.innerHTML=e;d.parentNode.insertBefore(f,d)}if(b){a.extend(c,b)}return this.each(function(){var g=_EPYT_.epresponsiveselector;if(c.customSelector){g.push(c.customSelector)}var h=a(this).find(g.join(","));h=h.not("object object");h.each(function(){var o=a(this);if(this.tagName.toLowerCase()==="embed"&&o.parent("object").length||o.parent(".fluid-width-video-wrapper").length){return}var i=(this.tagName.toLowerCase()==="object"||(o.attr("height")&&!isNaN(parseInt(o.attr("height"),10))))?parseInt(o.attr("height"),10):o.height(),l=!isNaN(parseInt(o.attr("width"),10))?parseInt(o.attr("width"),10):o.width(),m=i/l;if(!o.attr("id")){var n="fitvid"+Math.floor(Math.random()*999999);o.attr("id",n)}var k=document.createElement("div");k.className="fluid-width-video-wrapper";try{o.wrap(k).parent(".fluid-width-video-wrapper").attr("style","padding-top: "+(m*100)+"% !important;");o.removeAttr("height").removeAttr("width")}catch(j){}})})};a(document).ready(function(){a("body").fitVidsEP();a(document).ajaxSuccess(function(c,d,b){if(d&&d.responseText&&d.responseText.indexOf("<iframe ")!==-1){a("body").fitVidsEP()}})});return true};try{epdofitvids(window.jQuery)}catch(err){};
1
 
2
+ var epdofitvids=epdofitvids||function(a){a.fn.fitVidsEP=function(b){if(_EPYT_.epresponsiveselector.constructor!==Array){_EPYT_.epresponsiveselector=JSON.parse(_EPYT_.epresponsiveselector)}var c={customSelector:null};if(!document.getElementById("fit-vids-style")){var f=document.createElement("div"),d=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0],e="&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>";f.className="fit-vids-style";f.id="fit-vids-style";f.style.display="none";f.innerHTML=e;d.parentNode.insertBefore(f,d)}if(b){a.extend(c,b)}return this.each(function(){var g=_EPYT_.epresponsiveselector;if(c.customSelector){g.push(c.customSelector)}var h=a(this).find(g.join(","));h=h.not("object object");h.each(function(){var o=a(this);if(this.tagName.toLowerCase()==="embed"&&o.parent("object").length||o.parent(".fluid-width-video-wrapper").length){return}if(o.is("[data-origwidth]:not([width])")){o.attr("width",o.data("origwidth"))}if(o.is("[data-origheight]:not([height])")){o.attr("height",o.data("origheight"))}var i=(this.tagName.toLowerCase()==="object"||(o.attr("height")&&!isNaN(parseInt(o.attr("height"),10))))?parseInt(o.attr("height"),10):o.height(),l=!isNaN(parseInt(o.attr("width"),10))?parseInt(o.attr("width"),10):o.width(),m=i/l;if(!o.attr("id")){var n="fitvid"+Math.floor(Math.random()*999999);o.attr("id",n)}var k=document.createElement("div");k.className="fluid-width-video-wrapper";try{o.wrap(k).parent(".fluid-width-video-wrapper").attr("style","padding-top: "+(m*100)+"% !important;");o.removeAttr("height").removeAttr("width")}catch(j){}})})};a(document).ready(function(){a("body").fitVidsEP();a(document).ajaxSuccess(function(c,d,b){if(d&&d.responseText&&d.responseText.indexOf("<iframe ")!==-1){a("body").fitVidsEP()}})});return true};try{epdofitvids(window.jQuery)}catch(err){};
youtube.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Embed Plus for YouTube - Gallery, Channel, Playlist, Live Stream
4
  Plugin URI: https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?ref=plugin
5
  Description: YouTube Embed and YouTube Gallery WordPress Plugin. Embed a responsive video, YouTube channel, playlist gallery, or live stream
6
- Version: 13.1.2.4
7
  Author: Embed Plus for YouTube Team
8
  Author URI: https://www.embedplus.com
9
  */
@@ -34,7 +34,7 @@ class YouTubePrefs
34
 
35
  public static $folder_name = 'youtube-embed-plus';
36
  public static $curltimeout = 30;
37
- public static $version = '13.1.2.4';
38
  public static $opt_version = 'version';
39
  public static $optembedwidth = null;
40
  public static $optembedheight = null;
@@ -107,6 +107,7 @@ class YouTubePrefs
107
  public static $opt_gallery_customnext = 'gallery_customnext';
108
  public static $opt_not_live_content = 'not_live_content';
109
  public static $opt_admin_off_scripts = 'admin_off_scripts';
 
110
  public static $opt_onboarded = 'onboarded';
111
  public static $opt_alloptions = 'youtubeprefs_alloptions';
112
  public static $alloptions = null;
@@ -253,6 +254,7 @@ class YouTubePrefs
253
  add_filter('ytprefs_filter_the_content_light', array(get_class(), 'filter_the_content_light'));
254
 
255
  add_action("wp_ajax_my_embedplus_onboarding_save_ajax", array(get_class(), 'onboarding_save_ajax'));
 
256
  add_action("wp_ajax_my_embedplus_onboarding_save_apikey_ajax", array(get_class(), 'onboarding_save_apikey_ajax'));
257
  add_action("wp_ajax_my_embedplus_glance_vids", array(get_class(), 'my_embedplus_glance_vids'));
258
  add_action("wp_ajax_my_embedplus_glance_count", array(get_class(), 'my_embedplus_glance_count'));
@@ -1750,6 +1752,7 @@ class YouTubePrefs
1750
  $_not_live_content = '';
1751
  $_debugmode = 0;
1752
  $_admin_off_scripts = 0;
 
1753
  $_onboarded = 0;
1754
  $_old_script_method = 0;
1755
 
@@ -1836,6 +1839,7 @@ class YouTubePrefs
1836
  $_gallery_customprev = self::tryget($arroptions, self::$opt_gallery_customprev, $_gallery_customprev);
1837
  $_not_live_content = self::tryget($arroptions, self::$opt_not_live_content, $_not_live_content);
1838
  $_admin_off_scripts = self::tryget($arroptions, self::$opt_admin_off_scripts, $_admin_off_scripts);
 
1839
  $_onboarded = 0; // self::tryget($arroptions, self::$opt_onboarded, $_onboarded);
1840
 
1841
  $_vi_active = self::tryget($arroptions, self::$opt_vi_active, $_vi_active);
@@ -1922,6 +1926,7 @@ class YouTubePrefs
1922
  self::$opt_not_live_content => $_not_live_content,
1923
  self::$opt_debugmode => $_debugmode,
1924
  self::$opt_admin_off_scripts => $_admin_off_scripts,
 
1925
  self::$opt_onboarded => $_onboarded,
1926
  self::$opt_old_script_method => $_old_script_method,
1927
  self::$opt_vi_active => $_vi_active,
@@ -2919,7 +2924,7 @@ class YouTubePrefs
2919
  $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
2920
 
2921
  $new_pointer_content .= '<p>'; // ooopointer
2922
- $new_pointer_content .= "This update fixes pagination and autonext issues for Free and <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">Pro versions</a>.";
2923
  if (self::vi_logged_in())
2924
  {
2925
  $new_pointer_content .= "<br><br><strong>Note:</strong> You are currently logged into the vi intelligence feature. vi support is being deprecated in the next version. Please contact ext@embedplus.com for questions.";
@@ -3002,288 +3007,12 @@ class YouTubePrefs
3002
 
3003
  // See if the user has posted us some information
3004
  // If they did, this hidden field will be set to 'Y'
3005
- if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y')
3006
- {
3007
- check_admin_referer('_epyt_save', '_epyt_nonce');
3008
- // Read their posted values
3009
-
3010
- $new_options = array();
3011
- $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
3012
- $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
3013
- $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
3014
- $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
3015
- $new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0;
3016
- $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
3017
- $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
3018
- $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
3019
- $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
3020
- $new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0;
3021
- $new_options[self::$opt_fs] = self::postchecked(self::$opt_fs) ? 1 : 0;
3022
- $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0;
3023
- $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0;
3024
- $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 1 : 0;
3025
- $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white';
3026
- $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0;
3027
- $new_options[self::$opt_gdpr_consent] = self::postchecked(self::$opt_gdpr_consent) ? 1 : 0;
3028
- $new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0;
3029
- $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0;
3030
- $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0;
3031
- $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0;
3032
- $new_options[self::$opt_migrate_embedplusvideo] = self::postchecked(self::$opt_migrate_embedplusvideo) ? 1 : 0;
3033
- $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
3034
- $new_options[self::$opt_frontend_only] = self::postchecked(self::$opt_frontend_only) ? 1 : 0;
3035
- $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
3036
- $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0;
3037
- $new_options[self::$opt_evselector_light] = self::postchecked(self::$opt_evselector_light) ? 1 : 0;
3038
- $new_options[self::$opt_stop_mobile_buffer] = self::postchecked(self::$opt_stop_mobile_buffer) ? 1 : 0;
3039
- $new_options[self::$opt_restrict_wizard] = self::postchecked(self::$opt_restrict_wizard) ? 1 : 0;
3040
- $new_options[self::$opt_ajax_compat] = self::postchecked(self::$opt_ajax_compat) ? 1 : 0;
3041
- $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
3042
- $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
3043
- $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
3044
- $new_options[self::$opt_onboarded] = self::postchecked(self::$opt_onboarded) ? 1 : 0;
3045
- $new_options[self::$opt_gallery_hideprivate] = self::postchecked(self::$opt_gallery_hideprivate) ? 1 : 0;
3046
- $new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0;
3047
- $new_options[self::$opt_gallery_showpaging] = self::postchecked(self::$opt_gallery_showpaging) ? 1 : 0;
3048
- $new_options[self::$opt_gallery_autonext] = self::postchecked(self::$opt_gallery_autonext) ? 1 : 0;
3049
- $new_options[self::$opt_gallery_thumbplay] = self::postchecked(self::$opt_gallery_thumbplay) ? 1 : 0;
3050
- $new_options[self::$opt_gallery_channelsub] = self::postchecked(self::$opt_gallery_channelsub) ? 1 : 0;
3051
- $new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0;
3052
- $new_options[self::$opt_gallery_collapse_grid] = self::postchecked(self::$opt_gallery_collapse_grid) ? 1 : 0;
3053
- $new_options[self::$opt_vi_hide_monetize_tab] = self::postchecked(self::$opt_vi_hide_monetize_tab) ? 1 : 0;
3054
-
3055
- $_rel = 0;
3056
- try
3057
- {
3058
- $_rel = is_numeric(trim($_POST[self::$opt_rel])) ? intval(trim($_POST[self::$opt_rel])) : $_rel;
3059
- }
3060
- catch (Exception $ex)
3061
- {
3062
-
3063
- }
3064
- $new_options[self::$opt_rel] = $_rel;
3065
-
3066
-
3067
- $_gdpr_consent_message = '';
3068
- try
3069
- {
3070
- $_gdpr_consent_message = wp_kses_post(stripslashes($_POST[self::$opt_gdpr_consent_message]));
3071
- }
3072
- catch (Exception $ex)
3073
- {
3074
- $_gdpr_consent_message = '';
3075
- }
3076
- $new_options[self::$opt_gdpr_consent_message] = $_gdpr_consent_message;
3077
-
3078
- $_gdpr_consent_button = '';
3079
- try
3080
- {
3081
- $_gdpr_consent_button = wp_kses_post(stripslashes($_POST[self::$opt_gdpr_consent_button]));
3082
- }
3083
- catch (Exception $ex)
3084
- {
3085
- $_gdpr_consent_button = '';
3086
- }
3087
- $new_options[self::$opt_gdpr_consent_button] = $_gdpr_consent_button;
3088
-
3089
- $_ytapi_load = 'light';
3090
- try
3091
- {
3092
- $_ytapi_load_temp = $_POST[self::$opt_ytapi_load];
3093
- if (in_array($_ytapi_load_temp, array('always', 'light', 'never')))
3094
- {
3095
- $_ytapi_load = $_ytapi_load_temp;
3096
- }
3097
- }
3098
- catch (Exception $ex)
3099
- {
3100
-
3101
- }
3102
- $new_options[self::$opt_ytapi_load] = $_ytapi_load;
3103
-
3104
- $_restrict_wizard_roles = self::$dft_roles;
3105
- try
3106
- {
3107
- $_restrict_wizard_roles = is_array($_POST[self::$opt_restrict_wizard_roles]) ? $_POST[self::$opt_restrict_wizard_roles] : $_restrict_wizard_roles;
3108
- }
3109
- catch (Exception $ex)
3110
- {
3111
-
3112
- }
3113
- $new_options[self::$opt_restrict_wizard_roles] = $_restrict_wizard_roles;
3114
-
3115
-
3116
- $_defaultwidth = '';
3117
- try
3118
- {
3119
- $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth;
3120
- }
3121
- catch (Exception $ex)
3122
- {
3123
-
3124
- }
3125
- $new_options[self::$opt_defaultwidth] = $_defaultwidth;
3126
-
3127
- $_defaultheight = '';
3128
- try
3129
- {
3130
- $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight;
3131
- }
3132
- catch (Exception $ex)
3133
- {
3134
-
3135
- }
3136
- $new_options[self::$opt_defaultheight] = $_defaultheight;
3137
-
3138
- $_responsive_all = 1;
3139
- try
3140
- {
3141
- $_responsive_all = is_numeric(trim($_POST[self::$opt_responsive_all])) ? intval(trim($_POST[self::$opt_responsive_all])) : $_responsive_all;
3142
- }
3143
- catch (Exception $ex)
3144
- {
3145
-
3146
- }
3147
- $new_options[self::$opt_responsive_all] = $_responsive_all;
3148
-
3149
- $_vol = '';
3150
- try
3151
- {
3152
- $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol;
3153
- }
3154
- catch (Exception $ex)
3155
- {
3156
-
3157
- }
3158
- $new_options[self::$opt_vol] = $_vol;
3159
-
3160
- $_gallery_pagesize = 15;
3161
- try
3162
- {
3163
- $_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize;
3164
- }
3165
- catch (Exception $ex)
3166
- {
3167
-
3168
- }
3169
- $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
3170
-
3171
-
3172
- $_gallery_columns = 3;
3173
- try
3174
- {
3175
- $_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns;
3176
- }
3177
- catch (Exception $ex)
3178
- {
3179
-
3180
- }
3181
- $new_options[self::$opt_gallery_columns] = $_gallery_columns;
3182
-
3183
-
3184
- $_gallery_collapse_grid_breaks = self::$dft_bpts;
3185
- try
3186
- {
3187
- $_gallery_collapse_grid_breaks = is_array($_POST[self::$opt_gallery_collapse_grid_breaks]) ? $_POST[self::$opt_gallery_collapse_grid_breaks] : $_gallery_collapse_grid_breaks;
3188
- }
3189
- catch (Exception $ex)
3190
- {
3191
-
3192
- }
3193
- $new_options[self::$opt_gallery_collapse_grid_breaks] = $_gallery_collapse_grid_breaks;
3194
-
3195
-
3196
-
3197
- $_gallery_scrolloffset = 20;
3198
- try
3199
- {
3200
- $_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset;
3201
- }
3202
- catch (Exception $ex)
3203
- {
3204
-
3205
- }
3206
- $new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset;
3207
-
3208
- $_gallery_channelsublink = '';
3209
- try
3210
- {
3211
- $_gallery_channelsublink = trim(strip_tags($_POST[self::$opt_gallery_channelsublink]));
3212
- $pieces = explode('?', $_gallery_channelsublink);
3213
- $_gallery_channelsublink = trim($pieces[0]);
3214
- }
3215
- catch (Exception $ex)
3216
- {
3217
- $_gallery_channelsublink = '';
3218
- }
3219
- $new_options[self::$opt_gallery_channelsublink] = $_gallery_channelsublink;
3220
-
3221
-
3222
- $_gallery_channelsubtext = '';
3223
- try
3224
- {
3225
- $_gallery_channelsubtext = stripslashes(trim($_POST[self::$opt_gallery_channelsubtext]));
3226
- }
3227
- catch (Exception $ex)
3228
- {
3229
- $_gallery_channelsubtext = '';
3230
- }
3231
- $new_options[self::$opt_gallery_channelsubtext] = $_gallery_channelsubtext;
3232
-
3233
-
3234
- $_gallery_custom_prev = 'Prev';
3235
- try
3236
- {
3237
- $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
3238
- }
3239
- catch (Exception $ex)
3240
- {
3241
- $_gallery_custom_prev = 'Prev';
3242
- }
3243
- $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
3244
-
3245
-
3246
- $_gallery_custom_next = 'Next';
3247
- try
3248
- {
3249
- $_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext]));
3250
- }
3251
- catch (Exception $ex)
3252
- {
3253
- $_gallery_custom_next = 'Next';
3254
- }
3255
- $new_options[self::$opt_gallery_customnext] = $_gallery_custom_next;
3256
-
3257
-
3258
- $_not_live_content = '';
3259
- try
3260
- {
3261
- $_not_live_content = wp_kses_post(stripslashes($_POST[self::$opt_not_live_content]));
3262
- }
3263
- catch (Exception $ex)
3264
- {
3265
- $_not_live_content = '';
3266
- }
3267
- $new_options[self::$opt_not_live_content] = $_not_live_content;
3268
-
3269
-
3270
- $_apikey = '';
3271
- try
3272
- {
3273
- $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
3274
- }
3275
- catch (Exception $ex)
3276
- {
3277
- $_apikey = '';
3278
- }
3279
- $new_options[self::$opt_apikey] = $_apikey;
3280
-
3281
-
3282
- $all = $new_options + $all;
3283
-
3284
- update_option(self::$opt_alloptions, $all);
3285
  ?>
3286
- <div class="updated"><p><strong><?php _e('Changes saved.'); ?> <em>If you're using a separate caching plugin and you do not see your changes after saving, <strong class="orange">you need to reset your cache.</strong></em></strong></p></div>
3287
  <?php
3288
  }
3289
  ?>
@@ -3328,6 +3057,14 @@ class YouTubePrefs
3328
  background: linear-gradient(to bottom, #2ea2cc 0%,#007396 98%); /* W3C */
3329
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#007396',GradientType=0 ); /* IE6-9 */
3330
  }
 
 
 
 
 
 
 
 
3331
  p.submit em {display: inline-block; padding-left: 20px; vertical-align: middle; width: 240px; margin-top: -6px;}
3332
  #opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 320px;vertical-align: top;}
3333
  #goprobox h3 {font-size: 14px;}
@@ -3524,7 +3261,7 @@ class YouTubePrefs
3524
  <br>
3525
  </label>
3526
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>-1" value="-1" <?php checked($all[self::$opt_rel], -1); ?>>
3527
- <label for="<?php echo self::$opt_rel; ?>-1">Hide related videos at the end of playback <sup class="orange">new</sup></label> &nbsp;&nbsp;
3528
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>0" value="0" <?php checked($all[self::$opt_rel], 0); ?>>
3529
  <label for="<?php echo self::$opt_rel; ?>0">Show related videos only from the video's channel</label> &nbsp;&nbsp;
3530
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>1" value="1" <?php checked($all[self::$opt_rel], 1); ?>>
@@ -3941,6 +3678,13 @@ class YouTubePrefs
3941
  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.
3942
  </p>
3943
  <div class="ytindent chx">
 
 
 
 
 
 
 
3944
  <p>
3945
  <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">
3946
  <label for="<?php echo self::$opt_old_script_method; ?>">
@@ -3979,7 +3723,7 @@ class YouTubePrefs
3979
  <p>
3980
  <input name="<?php echo self::$opt_frontend_only; ?>" id="<?php echo self::$opt_frontend_only; ?>" <?php checked($all[self::$opt_frontend_only], 1); ?> type="checkbox" class="checkbox">
3981
  <label for="<?php echo self::$opt_frontend_only; ?>">
3982
- <b class="chktitle">Don't Run Shortcode In Admin:</b> <sup class="orange">new</sup>
3983
  Checking this will only allow the shortcode to run on the front-end of your website, and not in the admin area.
3984
  </label>
3985
  </p>
@@ -4248,8 +3992,9 @@ class YouTubePrefs
4248
  <script type="text/javascript">
4249
  (function ($)
4250
  {
4251
- window.savevalidate = function ()
4252
  {
 
4253
  var valid = true;
4254
  var $tabFocus = '';
4255
  var alertmessage = '';
@@ -4330,7 +4075,46 @@ class YouTubePrefs
4330
  var tabSelector = '.wrap-ytprefs .nav-tab-wrapper .nav-tab[href=#' + $tabFocus.attr('id') + ']';
4331
  $(tabSelector).click();
4332
  }
4333
- return valid;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4334
  };
4335
 
4336
  var mydomain = escape("http://" + window.location.host.toString());
@@ -4359,9 +4143,9 @@ class YouTubePrefs
4359
  $('.wrap-ytprefs .nav-tab-wrapper a[href="' + window.location.hash + '"]').click();
4360
  }
4361
 
4362
- $('#ytform').on('submit', function ()
4363
  {
4364
- return window.savevalidate();
4365
  });
4366
 
4367
  jQuery('#<?php echo self::$opt_defaultdims; ?>').change(function ()
@@ -4528,6 +4312,306 @@ class YouTubePrefs
4528
  }
4529
  }
4530
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4531
  public static function onboarding_save_valid(&$input)
4532
  {
4533
  $messages = array();
@@ -4748,7 +4832,7 @@ class YouTubePrefs
4748
  <br>
4749
  </label>
4750
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>-1" value="-1" <?php checked($all[self::$opt_rel], -1); ?>>
4751
- <label for="<?php echo self::$opt_rel; ?>-1">Hide related videos at the end of playback <sup class="orange">new</sup></label> &nbsp;&nbsp;
4752
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>0" value="0" <?php checked($all[self::$opt_rel], 0); ?>>
4753
  <label for="<?php echo self::$opt_rel; ?>0">Show related videos only from the video's channel</label> &nbsp;&nbsp;
4754
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>1" value="1" <?php checked($all[self::$opt_rel], 1); ?>>
@@ -4975,14 +5059,14 @@ class YouTubePrefs
4975
  {
4976
  setTimeout(function ()
4977
  {
4978
- jQuery('input.ytprefs-submit').val('Save Changes');
4979
  }, 3000);
4980
  });</script>
4981
  <?php
4982
  }
4983
  ?>
4984
  <p class="submit">
4985
- <input type="submit" name="Submit" class="button-primary ytprefs-submit" value="<?php _e($button_label) ?>" />
4986
  <em>If you're using a separate caching plugin and you do not see your changes after saving, <strong class="orange">you need to reset your cache.</strong></em>
4987
  </p>
4988
  <?php
3
  Plugin Name: Embed Plus for YouTube - Gallery, Channel, Playlist, Live Stream
4
  Plugin URI: https://www.embedplus.com/dashboard/pro-easy-video-analytics.aspx?ref=plugin
5
  Description: YouTube Embed and YouTube Gallery WordPress Plugin. Embed a responsive video, YouTube channel, playlist gallery, or live stream
6
+ Version: 13.1.2.5
7
  Author: Embed Plus for YouTube Team
8
  Author URI: https://www.embedplus.com
9
  */
34
 
35
  public static $folder_name = 'youtube-embed-plus';
36
  public static $curltimeout = 30;
37
+ public static $version = '13.1.2.5';
38
  public static $opt_version = 'version';
39
  public static $optembedwidth = null;
40
  public static $optembedheight = null;
107
  public static $opt_gallery_customnext = 'gallery_customnext';
108
  public static $opt_not_live_content = 'not_live_content';
109
  public static $opt_admin_off_scripts = 'admin_off_scripts';
110
+ public static $opt_ajax_save = 'ajax_save';
111
  public static $opt_onboarded = 'onboarded';
112
  public static $opt_alloptions = 'youtubeprefs_alloptions';
113
  public static $alloptions = null;
254
  add_filter('ytprefs_filter_the_content_light', array(get_class(), 'filter_the_content_light'));
255
 
256
  add_action("wp_ajax_my_embedplus_onboarding_save_ajax", array(get_class(), 'onboarding_save_ajax'));
257
+ add_action("wp_ajax_my_embedplus_settings_save_ajax", array(get_class(), 'settings_save_ajax'));
258
  add_action("wp_ajax_my_embedplus_onboarding_save_apikey_ajax", array(get_class(), 'onboarding_save_apikey_ajax'));
259
  add_action("wp_ajax_my_embedplus_glance_vids", array(get_class(), 'my_embedplus_glance_vids'));
260
  add_action("wp_ajax_my_embedplus_glance_count", array(get_class(), 'my_embedplus_glance_count'));
1752
  $_not_live_content = '';
1753
  $_debugmode = 0;
1754
  $_admin_off_scripts = 0;
1755
+ $_ajax_save = 1;
1756
  $_onboarded = 0;
1757
  $_old_script_method = 0;
1758
 
1839
  $_gallery_customprev = self::tryget($arroptions, self::$opt_gallery_customprev, $_gallery_customprev);
1840
  $_not_live_content = self::tryget($arroptions, self::$opt_not_live_content, $_not_live_content);
1841
  $_admin_off_scripts = self::tryget($arroptions, self::$opt_admin_off_scripts, $_admin_off_scripts);
1842
+ $_ajax_save = self::tryget($arroptions, self::$opt_ajax_save, $_ajax_save);
1843
  $_onboarded = 0; // self::tryget($arroptions, self::$opt_onboarded, $_onboarded);
1844
 
1845
  $_vi_active = self::tryget($arroptions, self::$opt_vi_active, $_vi_active);
1926
  self::$opt_not_live_content => $_not_live_content,
1927
  self::$opt_debugmode => $_debugmode,
1928
  self::$opt_admin_off_scripts => $_admin_off_scripts,
1929
+ self::$opt_ajax_save => $_ajax_save,
1930
  self::$opt_onboarded => $_onboarded,
1931
  self::$opt_old_script_method => $_old_script_method,
1932
  self::$opt_vi_active => $_vi_active,
2924
  $new_pointer_content = '<h3>' . __('New Update') . '</h3>'; // ooopointer
2925
 
2926
  $new_pointer_content .= '<p>'; // ooopointer
2927
+ $new_pointer_content .= "This update supports better responsive sizing in widgets and fixes a &quot;save settings&quot; issue for Free and <a target=_blank href=" . self::$epbase . '/dashboard/pro-easy-video-analytics.aspx?ref=frompointer' . ">Pro versions</a>.";
2928
  if (self::vi_logged_in())
2929
  {
2930
  $new_pointer_content .= "<br><br><strong>Note:</strong> You are currently logged into the vi intelligence feature. vi support is being deprecated in the next version. Please contact ext@embedplus.com for questions.";
3007
 
3008
  // See if the user has posted us some information
3009
  // If they did, this hidden field will be set to 'Y'
3010
+ if (isset($_POST[$ytprefs_submitted]) && $_POST[$ytprefs_submitted] == 'Y' && check_admin_referer('_epyt_save', '_epyt_nonce'))
3011
+ {
3012
+ $result = self::settings_save($all);
3013
+ $all = get_option(self::$opt_alloptions);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3014
  ?>
3015
+ <div class="updated"><p><strong><?php echo wp_kses_post($result['message']) ?></strong></p></div>
3016
  <?php
3017
  }
3018
  ?>
3057
  background: linear-gradient(to bottom, #2ea2cc 0%,#007396 98%); /* W3C */
3058
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#007396',GradientType=0 ); /* IE6-9 */
3059
  }
3060
+ .wp-core-ui p.submit .button-primary[disabled] {
3061
+ opacity: .4;
3062
+ transition: opacity ease-in-out .3s;
3063
+ }
3064
+ .wp-core-ui p.submit .button-primary[disabled]:after {
3065
+ content: url(<?php echo admin_url('images/wpspin_light.gif') ?>);
3066
+ padding-left: 3px;
3067
+ }
3068
  p.submit em {display: inline-block; padding-left: 20px; vertical-align: middle; width: 240px; margin-top: -6px;}
3069
  #opt_pro {box-shadow: 0px 0px 5px 0px #1870D5; width: 320px;vertical-align: top;}
3070
  #goprobox h3 {font-size: 14px;}
3261
  <br>
3262
  </label>
3263
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>-1" value="-1" <?php checked($all[self::$opt_rel], -1); ?>>
3264
+ <label for="<?php echo self::$opt_rel; ?>-1">Hide related videos at the end of playback</label> &nbsp;&nbsp;
3265
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>0" value="0" <?php checked($all[self::$opt_rel], 0); ?>>
3266
  <label for="<?php echo self::$opt_rel; ?>0">Show related videos only from the video's channel</label> &nbsp;&nbsp;
3267
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>1" value="1" <?php checked($all[self::$opt_rel], 1); ?>>
3678
  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.
3679
  </p>
3680
  <div class="ytindent chx">
3681
+ <p>
3682
+ <input name="<?php echo self::$opt_ajax_save; ?>" id="<?php echo self::$opt_ajax_save; ?>" <?php checked($all[self::$opt_ajax_save], 1); ?> type="checkbox" class="checkbox">
3683
+ <label for="<?php echo self::$opt_ajax_save; ?>">
3684
+ <b class="chktitle">Save Settings with AJAX: </b> <sup class="orange">new</sup>
3685
+ Turn this option off if you are having trouble saving your settings.
3686
+ </label>
3687
+ </p>
3688
  <p>
3689
  <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">
3690
  <label for="<?php echo self::$opt_old_script_method; ?>">
3723
  <p>
3724
  <input name="<?php echo self::$opt_frontend_only; ?>" id="<?php echo self::$opt_frontend_only; ?>" <?php checked($all[self::$opt_frontend_only], 1); ?> type="checkbox" class="checkbox">
3725
  <label for="<?php echo self::$opt_frontend_only; ?>">
3726
+ <b class="chktitle">Don't Run Shortcode In Admin:</b>
3727
  Checking this will only allow the shortcode to run on the front-end of your website, and not in the admin area.
3728
  </label>
3729
  </p>
3992
  <script type="text/javascript">
3993
  (function ($)
3994
  {
3995
+ window.savevalidate = function (e)
3996
  {
3997
+ var $formDefaults = $(e.target);
3998
  var valid = true;
3999
  var $tabFocus = '';
4000
  var alertmessage = '';
4075
  var tabSelector = '.wrap-ytprefs .nav-tab-wrapper .nav-tab[href=#' + $tabFocus.attr('id') + ']';
4076
  $(tabSelector).click();
4077
  }
4078
+ if (!$formDefaults.find('#ajax_save').is(':checked'))
4079
+ {
4080
+ return valid;
4081
+ }
4082
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////// MAIN PREFS AJAX SAVE
4083
+ if (valid)
4084
+ {
4085
+ e.preventDefault();
4086
+ (window.tinyMCE || window.tinymce).triggerSave();
4087
+ $formDefaults.find('.ytprefs-submit').prop('disabled', true);
4088
+
4089
+ var formData = $formDefaults.ytprefsFormJSON();
4090
+ formData.action = 'my_embedplus_settings_save_ajax';
4091
+
4092
+ $.ajax({
4093
+ type: "post",
4094
+ dataType: "json",
4095
+ timeout: 30000,
4096
+ url: window._EPYTA_ ? window._EPYTA_.wpajaxurl : ajaxurl,
4097
+ data: formData,
4098
+ success: function (response)
4099
+ {
4100
+ alertify.alert(response ? response.message : 'Sorry, there was an error submitting your settings.', function ()
4101
+ {
4102
+ if (response.type == 'success')
4103
+ {
4104
+ window.top.location.href = window._EPYTA_.admin_url_ytprefs;
4105
+ }
4106
+ });
4107
+ },
4108
+ error: function (xhr, ajaxOptions, thrownError)
4109
+ {
4110
+ alertify.alert('Sorry, there was an error saving your settings. ' + (thrownError ? thrownError : ''));
4111
+ },
4112
+ complete: function ()
4113
+ {
4114
+ $formDefaults.find('.ytprefs-submit').prop('disabled', false);
4115
+ }
4116
+ });
4117
+ }
4118
  };
4119
 
4120
  var mydomain = escape("http://" + window.location.host.toString());
4143
  $('.wrap-ytprefs .nav-tab-wrapper a[href="' + window.location.hash + '"]').click();
4144
  }
4145
 
4146
+ $('#ytform').on('submit', function (e)
4147
  {
4148
+ return window.savevalidate(e);
4149
  });
4150
 
4151
  jQuery('#<?php echo self::$opt_defaultdims; ?>').change(function ()
4312
  }
4313
  }
4314
 
4315
+ public static function settings_save($all)
4316
+ {
4317
+ $new_options = array();
4318
+ $new_options[self::$opt_center] = self::postchecked(self::$opt_center) ? 1 : 0;
4319
+ $new_options[self::$opt_glance] = self::postchecked(self::$opt_glance) ? 1 : 0;
4320
+ $new_options[self::$opt_autoplay] = self::postchecked(self::$opt_autoplay) ? 1 : 0;
4321
+ $new_options[self::$opt_debugmode] = self::postchecked(self::$opt_debugmode) ? 1 : 0;
4322
+ $new_options[self::$opt_admin_off_scripts] = self::postchecked(self::$opt_admin_off_scripts) ? 1 : 0;
4323
+ $new_options[self::$opt_old_script_method] = self::postchecked(self::$opt_old_script_method) ? 1 : 0;
4324
+ $new_options[self::$opt_cc_load_policy] = self::postchecked(self::$opt_cc_load_policy) ? 1 : 0;
4325
+ $new_options[self::$opt_iv_load_policy] = self::postchecked(self::$opt_iv_load_policy) ? 1 : 3;
4326
+ $new_options[self::$opt_loop] = self::postchecked(self::$opt_loop) ? 1 : 0;
4327
+ $new_options[self::$opt_modestbranding] = self::postchecked(self::$opt_modestbranding) ? 1 : 0;
4328
+ $new_options[self::$opt_fs] = self::postchecked(self::$opt_fs) ? 1 : 0;
4329
+ $new_options[self::$opt_playsinline] = self::postchecked(self::$opt_playsinline) ? 1 : 0;
4330
+ $new_options[self::$opt_origin] = self::postchecked(self::$opt_origin) ? 1 : 0;
4331
+ $new_options[self::$opt_controls] = self::postchecked(self::$opt_controls) ? 1 : 0;
4332
+ $new_options[self::$opt_color] = self::postchecked(self::$opt_color) ? 'red' : 'white';
4333
+ $new_options[self::$opt_nocookie] = self::postchecked(self::$opt_nocookie) ? 1 : 0;
4334
+ $new_options[self::$opt_gdpr_consent] = self::postchecked(self::$opt_gdpr_consent) ? 1 : 0;
4335
+ $new_options[self::$opt_playlistorder] = self::postchecked(self::$opt_playlistorder) ? 1 : 0;
4336
+ $new_options[self::$opt_acctitle] = self::postchecked(self::$opt_acctitle) ? 1 : 0;
4337
+ $new_options[self::$opt_migrate] = self::postchecked(self::$opt_migrate) ? 1 : 0;
4338
+ $new_options[self::$opt_migrate_youtube] = self::postchecked(self::$opt_migrate_youtube) ? 1 : 0;
4339
+ $new_options[self::$opt_migrate_embedplusvideo] = self::postchecked(self::$opt_migrate_embedplusvideo) ? 1 : 0;
4340
+ $new_options[self::$opt_oldspacing] = self::postchecked(self::$opt_oldspacing) ? 1 : 0;
4341
+ $new_options[self::$opt_frontend_only] = self::postchecked(self::$opt_frontend_only) ? 1 : 0;
4342
+ $new_options[self::$opt_responsive] = self::postchecked(self::$opt_responsive) ? 1 : 0;
4343
+ $new_options[self::$opt_widgetfit] = self::postchecked(self::$opt_widgetfit) ? 1 : 0;
4344
+ $new_options[self::$opt_evselector_light] = self::postchecked(self::$opt_evselector_light) ? 1 : 0;
4345
+ $new_options[self::$opt_stop_mobile_buffer] = self::postchecked(self::$opt_stop_mobile_buffer) ? 1 : 0;
4346
+ $new_options[self::$opt_restrict_wizard] = self::postchecked(self::$opt_restrict_wizard) ? 1 : 0;
4347
+ $new_options[self::$opt_ajax_compat] = self::postchecked(self::$opt_ajax_compat) ? 1 : 0;
4348
+ $new_options[self::$opt_defaultdims] = self::postchecked(self::$opt_defaultdims) ? 1 : 0;
4349
+ $new_options[self::$opt_defaultvol] = self::postchecked(self::$opt_defaultvol) ? 1 : 0;
4350
+ $new_options[self::$opt_dohl] = self::postchecked(self::$opt_dohl) ? 1 : 0;
4351
+ $new_options[self::$opt_onboarded] = self::postchecked(self::$opt_onboarded) ? 1 : 0;
4352
+ $new_options[self::$opt_gallery_hideprivate] = self::postchecked(self::$opt_gallery_hideprivate) ? 1 : 0;
4353
+ $new_options[self::$opt_gallery_showtitle] = self::postchecked(self::$opt_gallery_showtitle) ? 1 : 0;
4354
+ $new_options[self::$opt_gallery_showpaging] = self::postchecked(self::$opt_gallery_showpaging) ? 1 : 0;
4355
+ $new_options[self::$opt_gallery_autonext] = self::postchecked(self::$opt_gallery_autonext) ? 1 : 0;
4356
+ $new_options[self::$opt_gallery_thumbplay] = self::postchecked(self::$opt_gallery_thumbplay) ? 1 : 0;
4357
+ $new_options[self::$opt_gallery_channelsub] = self::postchecked(self::$opt_gallery_channelsub) ? 1 : 0;
4358
+ $new_options[self::$opt_gallery_customarrows] = self::postchecked(self::$opt_gallery_customarrows) ? 1 : 0;
4359
+ $new_options[self::$opt_gallery_collapse_grid] = self::postchecked(self::$opt_gallery_collapse_grid) ? 1 : 0;
4360
+ $new_options[self::$opt_vi_hide_monetize_tab] = self::postchecked(self::$opt_vi_hide_monetize_tab) ? 1 : 0;
4361
+
4362
+ $_rel = 0;
4363
+ try
4364
+ {
4365
+ $_rel = is_numeric(trim($_POST[self::$opt_rel])) ? intval(trim($_POST[self::$opt_rel])) : $_rel;
4366
+ }
4367
+ catch (Exception $ex)
4368
+ {
4369
+
4370
+ }
4371
+ $new_options[self::$opt_rel] = $_rel;
4372
+
4373
+
4374
+ $_gdpr_consent_message = '';
4375
+ try
4376
+ {
4377
+ $_gdpr_consent_message = wp_kses_post(stripslashes($_POST[self::$opt_gdpr_consent_message]));
4378
+ }
4379
+ catch (Exception $ex)
4380
+ {
4381
+ $_gdpr_consent_message = '';
4382
+ }
4383
+ $new_options[self::$opt_gdpr_consent_message] = $_gdpr_consent_message;
4384
+
4385
+ $_gdpr_consent_button = '';
4386
+ try
4387
+ {
4388
+ $_gdpr_consent_button = wp_kses_post(stripslashes($_POST[self::$opt_gdpr_consent_button]));
4389
+ }
4390
+ catch (Exception $ex)
4391
+ {
4392
+ $_gdpr_consent_button = '';
4393
+ }
4394
+ $new_options[self::$opt_gdpr_consent_button] = $_gdpr_consent_button;
4395
+
4396
+ $_ytapi_load = 'light';
4397
+ try
4398
+ {
4399
+ $_ytapi_load_temp = $_POST[self::$opt_ytapi_load];
4400
+ if (in_array($_ytapi_load_temp, array('always', 'light', 'never')))
4401
+ {
4402
+ $_ytapi_load = $_ytapi_load_temp;
4403
+ }
4404
+ }
4405
+ catch (Exception $ex)
4406
+ {
4407
+
4408
+ }
4409
+ $new_options[self::$opt_ytapi_load] = $_ytapi_load;
4410
+
4411
+ $_restrict_wizard_roles = self::$dft_roles;
4412
+ try
4413
+ {
4414
+ $_restrict_wizard_roles = is_array($_POST[self::$opt_restrict_wizard_roles]) ? $_POST[self::$opt_restrict_wizard_roles] : $_restrict_wizard_roles;
4415
+ }
4416
+ catch (Exception $ex)
4417
+ {
4418
+
4419
+ }
4420
+ $new_options[self::$opt_restrict_wizard_roles] = $_restrict_wizard_roles;
4421
+
4422
+
4423
+ $_defaultwidth = '';
4424
+ try
4425
+ {
4426
+ $_defaultwidth = is_numeric(trim($_POST[self::$opt_defaultwidth])) ? intval(trim($_POST[self::$opt_defaultwidth])) : $_defaultwidth;
4427
+ }
4428
+ catch (Exception $ex)
4429
+ {
4430
+
4431
+ }
4432
+ $new_options[self::$opt_defaultwidth] = $_defaultwidth;
4433
+
4434
+ $_defaultheight = '';
4435
+ try
4436
+ {
4437
+ $_defaultheight = is_numeric(trim($_POST[self::$opt_defaultheight])) ? intval(trim($_POST[self::$opt_defaultheight])) : $_defaultheight;
4438
+ }
4439
+ catch (Exception $ex)
4440
+ {
4441
+
4442
+ }
4443
+ $new_options[self::$opt_defaultheight] = $_defaultheight;
4444
+
4445
+ $_responsive_all = 1;
4446
+ try
4447
+ {
4448
+ $_responsive_all = is_numeric(trim($_POST[self::$opt_responsive_all])) ? intval(trim($_POST[self::$opt_responsive_all])) : $_responsive_all;
4449
+ }
4450
+ catch (Exception $ex)
4451
+ {
4452
+
4453
+ }
4454
+ $new_options[self::$opt_responsive_all] = $_responsive_all;
4455
+
4456
+ $_vol = '';
4457
+ try
4458
+ {
4459
+ $_vol = is_numeric(trim($_POST[self::$opt_vol])) ? intval(trim($_POST[self::$opt_vol])) : $_vol;
4460
+ }
4461
+ catch (Exception $ex)
4462
+ {
4463
+
4464
+ }
4465
+ $new_options[self::$opt_vol] = $_vol;
4466
+
4467
+ $_gallery_pagesize = 15;
4468
+ try
4469
+ {
4470
+ $_gallery_pagesize = is_numeric(trim($_POST[self::$opt_gallery_pagesize])) ? intval(trim($_POST[self::$opt_gallery_pagesize])) : $_gallery_pagesize;
4471
+ }
4472
+ catch (Exception $ex)
4473
+ {
4474
+
4475
+ }
4476
+ $new_options[self::$opt_gallery_pagesize] = $_gallery_pagesize;
4477
+
4478
+
4479
+ $_gallery_columns = 3;
4480
+ try
4481
+ {
4482
+ $_gallery_columns = is_numeric(trim($_POST[self::$opt_gallery_columns])) ? intval(trim($_POST[self::$opt_gallery_columns])) : $_gallery_columns;
4483
+ }
4484
+ catch (Exception $ex)
4485
+ {
4486
+
4487
+ }
4488
+ $new_options[self::$opt_gallery_columns] = $_gallery_columns;
4489
+
4490
+
4491
+ $_gallery_collapse_grid_breaks = self::$dft_bpts;
4492
+ try
4493
+ {
4494
+ $_gallery_collapse_grid_breaks = is_array($_POST[self::$opt_gallery_collapse_grid_breaks]) ? $_POST[self::$opt_gallery_collapse_grid_breaks] : $_gallery_collapse_grid_breaks;
4495
+ }
4496
+ catch (Exception $ex)
4497
+ {
4498
+
4499
+ }
4500
+ $new_options[self::$opt_gallery_collapse_grid_breaks] = $_gallery_collapse_grid_breaks;
4501
+
4502
+
4503
+
4504
+ $_gallery_scrolloffset = 20;
4505
+ try
4506
+ {
4507
+ $_gallery_scrolloffset = is_numeric(trim($_POST[self::$opt_gallery_scrolloffset])) ? intval(trim($_POST[self::$opt_gallery_scrolloffset])) : $_gallery_scrolloffset;
4508
+ }
4509
+ catch (Exception $ex)
4510
+ {
4511
+
4512
+ }
4513
+ $new_options[self::$opt_gallery_scrolloffset] = $_gallery_scrolloffset;
4514
+
4515
+ $_gallery_channelsublink = '';
4516
+ try
4517
+ {
4518
+ $_gallery_channelsublink = trim(strip_tags($_POST[self::$opt_gallery_channelsublink]));
4519
+ $pieces = explode('?', $_gallery_channelsublink);
4520
+ $_gallery_channelsublink = trim($pieces[0]);
4521
+ }
4522
+ catch (Exception $ex)
4523
+ {
4524
+ $_gallery_channelsublink = '';
4525
+ }
4526
+ $new_options[self::$opt_gallery_channelsublink] = $_gallery_channelsublink;
4527
+
4528
+
4529
+ $_gallery_channelsubtext = '';
4530
+ try
4531
+ {
4532
+ $_gallery_channelsubtext = stripslashes(trim($_POST[self::$opt_gallery_channelsubtext]));
4533
+ }
4534
+ catch (Exception $ex)
4535
+ {
4536
+ $_gallery_channelsubtext = '';
4537
+ }
4538
+ $new_options[self::$opt_gallery_channelsubtext] = $_gallery_channelsubtext;
4539
+
4540
+
4541
+ $_gallery_custom_prev = 'Prev';
4542
+ try
4543
+ {
4544
+ $_gallery_custom_prev = trim(strip_tags($_POST[self::$opt_gallery_customprev]));
4545
+ }
4546
+ catch (Exception $ex)
4547
+ {
4548
+ $_gallery_custom_prev = 'Prev';
4549
+ }
4550
+ $new_options[self::$opt_gallery_customprev] = $_gallery_custom_prev;
4551
+
4552
+
4553
+ $_gallery_custom_next = 'Next';
4554
+ try
4555
+ {
4556
+ $_gallery_custom_next = trim(strip_tags($_POST[self::$opt_gallery_customnext]));
4557
+ }
4558
+ catch (Exception $ex)
4559
+ {
4560
+ $_gallery_custom_next = 'Next';
4561
+ }
4562
+ $new_options[self::$opt_gallery_customnext] = $_gallery_custom_next;
4563
+
4564
+
4565
+ $_not_live_content = '';
4566
+ try
4567
+ {
4568
+ $_not_live_content = wp_kses_post(stripslashes($_POST[self::$opt_not_live_content]));
4569
+ }
4570
+ catch (Exception $ex)
4571
+ {
4572
+ $_not_live_content = '';
4573
+ }
4574
+ $new_options[self::$opt_not_live_content] = $_not_live_content;
4575
+
4576
+
4577
+ $_apikey = '';
4578
+ try
4579
+ {
4580
+ $_apikey = trim(str_replace(array(' ', "'", '"'), array('', '', ''), strip_tags($_POST[self::$opt_apikey])));
4581
+ }
4582
+ catch (Exception $ex)
4583
+ {
4584
+ $_apikey = '';
4585
+ }
4586
+ $new_options[self::$opt_apikey] = $_apikey;
4587
+
4588
+
4589
+ $all = $new_options + $all;
4590
+
4591
+ update_option(self::$opt_alloptions, $all);
4592
+ return array(
4593
+ 'type' => 'success',
4594
+ 'message' => 'Changes were saved. <em>If you are using a separate caching plugin and you do not see your changes after saving, <strong class="orange">you need to reset your cache.</strong></em>'
4595
+ );
4596
+ }
4597
+
4598
+ public static function settings_save_ajax()
4599
+ {
4600
+ $result = array();
4601
+ if (check_ajax_referer('_epyt_save', '_epyt_nonce', false) && current_user_can('manage_options'))
4602
+ {
4603
+ $all = get_option(self::$opt_alloptions);
4604
+ $result = self::settings_save($all);
4605
+ }
4606
+ else
4607
+ {
4608
+ $result['type'] = 'error';
4609
+ $result['message'] = 'Sorry, there was a problem saving your settings.';
4610
+ }
4611
+ echo json_encode($result);
4612
+ die();
4613
+ }
4614
+
4615
  public static function onboarding_save_valid(&$input)
4616
  {
4617
  $messages = array();
4832
  <br>
4833
  </label>
4834
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>-1" value="-1" <?php checked($all[self::$opt_rel], -1); ?>>
4835
+ <label for="<?php echo self::$opt_rel; ?>-1">Hide related videos at the end of playback</label> &nbsp;&nbsp;
4836
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>0" value="0" <?php checked($all[self::$opt_rel], 0); ?>>
4837
  <label for="<?php echo self::$opt_rel; ?>0">Show related videos only from the video's channel</label> &nbsp;&nbsp;
4838
  <input type="radio" name="<?php echo self::$opt_rel; ?>" id="<?php echo self::$opt_rel; ?>1" value="1" <?php checked($all[self::$opt_rel], 1); ?>>
5059
  {
5060
  setTimeout(function ()
5061
  {
5062
+ jQuery('.ytprefs-submit').text('Save Changes');
5063
  }, 3000);
5064
  });</script>
5065
  <?php
5066
  }
5067
  ?>
5068
  <p class="submit">
5069
+ <button type="submit" name="Submit" class="button-primary ytprefs-submit"><?php _e($button_label) ?></button>
5070
  <em>If you're using a separate caching plugin and you do not see your changes after saving, <strong class="orange">you need to reset your cache.</strong></em>
5071
  </p>
5072
  <?php