Widget Options - Version 3.8.5

Version Description

  • Compatible with Latest WordPress
  • Fixed Display Issue with PeepSo Widgets
  • Fixed Display Issue with WPML added languages
Download this release

Release Info

Developer mej
Plugin Icon 128x128 Widget Options
Version 3.8.5
Comparing to
See all releases

Code changes from version 3.8.4 to 3.8.5

Files changed (3) hide show
  1. includes/widgets/display.php +29 -18
  2. plugin.php +2 -2
  3. readme.txt +8 -2
includes/widgets/display.php CHANGED
@@ -21,6 +21,10 @@ if( !function_exists( 'widgetopts_display_callback' ) ):
21
  function widgetopts_display_callback( $instance, $widget, $args ){
22
  global $widget_options, $current_user;
23
 
 
 
 
 
24
  $hidden = false;
25
  $opts = ( isset( $instance[ 'extended_widget_opts-'. $widget->id ] ) ) ? $instance[ 'extended_widget_opts-'. $widget->id ] : array();
26
  $visibility = array( 'show' => array(), 'hide' => array() );
@@ -89,9 +93,12 @@ if( !function_exists( 'widgetopts_display_callback' ) ):
89
  $visibility['categories'] = array();
90
  }
91
 
92
- if( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' && array_key_exists( get_query_var('cat') , $visibility['categories']) ){
 
 
 
93
  $hidden = true; //hide if exists on hidden pages
94
- }elseif( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' && !array_key_exists( get_query_var('cat') , $visibility['categories']) ){
95
  $hidden = true; //hide if doesn't exists on visible pages
96
  }elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' ){
97
  $hidden = true; //hide to all categories
@@ -215,8 +222,12 @@ if( !function_exists( 'widgetopts_display_callback' ) ):
215
  return false;
216
  }
217
  // echo $type;
218
- }elseif ( $is_types && is_page() ) {
219
  global $post;
 
 
 
 
220
  //do post type condition first
221
  if( isset( $visibility['types'] ) && isset( $visibility['types']['page'] ) ){
222
  if( $visibility_opts == 'hide' && array_key_exists( 'page' , $visibility['types']) ){
@@ -229,9 +240,9 @@ if( !function_exists( 'widgetopts_display_callback' ) ):
229
  if( !isset( $visibility['pages'] ) ){
230
  $visibility['pages'] = array();
231
  }
232
- if( $visibility_opts == 'hide' && array_key_exists( $post->ID , $visibility['pages']) ){
233
  $hidden = true; //hide if exists on hidden pages
234
- }elseif( $visibility_opts == 'show' && !array_key_exists( $post->ID , $visibility['pages']) ){
235
  $hidden = true; //hide if doesn't exists on visible pages
236
  }
237
  }
@@ -384,14 +395,14 @@ if( !function_exists( 'widgetopts_display_callback' ) ):
384
  if ( stristr($display_logic,"return")===false ){
385
  $display_logic="return (" . $display_logic . ");";
386
  }
387
- $display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
388
- try {
389
- if ( !eval( $display_logic ) ){
390
- return false;
391
- }
392
- } catch (ParseError $e) {
393
- return false;
394
- }
395
  }
396
  }
397
 
@@ -442,13 +453,13 @@ endif;
442
  $instance = get_option( 'widget_' . $id_base );
443
 
444
  $num = substr( $params[0]['widget_id'], -1 );
445
- if( isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'] ) ){
446
  $num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'];
447
  } elseif( isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback']) && is_array($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'])){
448
- if (isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]) && isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number)) {
449
- $num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number;
450
- }
451
- }
452
  if( isset( $instance[ $num ] ) ){
453
  $opts = ( isset( $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] ) ) ? $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] : array();
454
  }else{
21
  function widgetopts_display_callback( $instance, $widget, $args ){
22
  global $widget_options, $current_user;
23
 
24
+ // WPML FIX
25
+ $hasWPML = has_filter('wpml_current_language');
26
+ $default_language = $hasWPML ? apply_filters( 'wpml_default_language', NULL ) : false;
27
+
28
  $hidden = false;
29
  $opts = ( isset( $instance[ 'extended_widget_opts-'. $widget->id ] ) ) ? $instance[ 'extended_widget_opts-'. $widget->id ] : array();
30
  $visibility = array( 'show' => array(), 'hide' => array() );
93
  $visibility['categories'] = array();
94
  }
95
 
96
+ // WPML TRANSLATION OBJECT FIX
97
+ $category_id = ($hasWPML) ? apply_filters( 'wpml_object_id', get_query_var('cat'), 'category', true, $default_language ) : get_query_var('cat');
98
+
99
+ if( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' && array_key_exists( $category_id , $visibility['categories']) ){
100
  $hidden = true; //hide if exists on hidden pages
101
+ }elseif( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' && !array_key_exists( $category_id , $visibility['categories']) ){
102
  $hidden = true; //hide if doesn't exists on visible pages
103
  }elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' ){
104
  $hidden = true; //hide to all categories
222
  return false;
223
  }
224
  // echo $type;
225
+ }elseif ( $is_types && (is_page() || get_post_type(get_the_ID()) == 'page') ) {
226
  global $post;
227
+
228
+ // WPML FIX
229
+ $pageID = ($hasWPML) ? apply_filters( 'wpml_object_id', $post->ID, $post->post_type, true, $default_language ) : $post->ID;
230
+
231
  //do post type condition first
232
  if( isset( $visibility['types'] ) && isset( $visibility['types']['page'] ) ){
233
  if( $visibility_opts == 'hide' && array_key_exists( 'page' , $visibility['types']) ){
240
  if( !isset( $visibility['pages'] ) ){
241
  $visibility['pages'] = array();
242
  }
243
+ if( $visibility_opts == 'hide' && array_key_exists( $pageID , $visibility['pages']) ){
244
  $hidden = true; //hide if exists on hidden pages
245
+ }elseif( $visibility_opts == 'show' && !array_key_exists( $pageID , $visibility['pages']) ){
246
  $hidden = true; //hide if doesn't exists on visible pages
247
  }
248
  }
395
  if ( stristr($display_logic,"return")===false ){
396
  $display_logic="return (" . $display_logic . ");";
397
  }
398
+ $display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
399
+ try {
400
+ if ( !eval( $display_logic ) ){
401
+ return false;
402
+ }
403
+ } catch (ParseError $e) {
404
+ return false;
405
+ }
406
  }
407
  }
408
 
453
  $instance = get_option( 'widget_' . $id_base );
454
 
455
  $num = substr( $params[0]['widget_id'], -1 );
456
+ if( isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'] ) ){
457
  $num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'];
458
  } elseif( isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback']) && is_array($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'])){
459
+ if (isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]) && isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number)) {
460
+ $num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number;
461
+ }
462
+ }
463
  if( isset( $instance[ $num ] ) ){
464
  $opts = ( isset( $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] ) ) ? $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] : array();
465
  }else{
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Widget Options
4
  * Plugin URI: https://widget-options.com/
5
  * Description: Additional Widget options for better widget control. Get <strong><a href="http://widget-options.com/" target="_blank" >Extended Widget Options for WordPress</a></strong> for complete widget controls. Thanks!
6
- * Version: 3.8.4
7
  * Author: Widget Options Team
8
  * Author URI: https://widget-options.com/
9
  * Text Domain: widget-options
@@ -85,7 +85,7 @@ final class WP_Widget_Options {
85
 
86
  // Plugin version.
87
  if ( ! defined( 'WIDGETOPTS_VERSION' ) ) {
88
- define( 'WIDGETOPTS_VERSION', '3.8.4' );
89
  }
90
 
91
  // Plugin Folder Path.
3
  * Plugin Name: Widget Options
4
  * Plugin URI: https://widget-options.com/
5
  * Description: Additional Widget options for better widget control. Get <strong><a href="http://widget-options.com/" target="_blank" >Extended Widget Options for WordPress</a></strong> for complete widget controls. Thanks!
6
+ * Version: 3.8.5
7
  * Author: Widget Options Team
8
  * Author URI: https://widget-options.com/
9
  * Text Domain: widget-options
85
 
86
  // Plugin version.
87
  if ( ! defined( 'WIDGETOPTS_VERSION' ) ) {
88
+ define( 'WIDGETOPTS_VERSION', '3.8.5' );
89
  }
90
 
91
  // Plugin Folder Path.
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: marketingfire, phpbits, flowdee
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FMKC2SLPTULP8
4
  Tags: widgets, restrict widgets, display widgets, widget logic, hide widgets, hide widget, sidebar, widget content, display widget, widget options, widget option, widget, widget css, CSS, widget classes, widget styling, widget ID, widget custom class, widget visibility, widget ninja, jetpack visibility, siteorigin, siteorigin pagebuilder, pagebuilder by siteorigin
5
  Requires at least: 4.0
6
- Tested up to: 5.9
7
  Requires PHP: 5.6
8
- Stable tag: 3.8.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -154,6 +154,12 @@ Widget Options is a featured pack fully lightweight plugin. Using Query Monitor
154
 
155
  == Changelog ==
156
 
 
 
 
 
 
 
157
  = 3.8.4 =
158
 
159
  * Fixed PHP Notice: Undefined variable
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FMKC2SLPTULP8
4
  Tags: widgets, restrict widgets, display widgets, widget logic, hide widgets, hide widget, sidebar, widget content, display widget, widget options, widget option, widget, widget css, CSS, widget classes, widget styling, widget ID, widget custom class, widget visibility, widget ninja, jetpack visibility, siteorigin, siteorigin pagebuilder, pagebuilder by siteorigin
5
  Requires at least: 4.0
6
+ Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 3.8.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
154
 
155
  == Changelog ==
156
 
157
+ = 3.8.5 =
158
+
159
+ * Compatible with Latest WordPress
160
+ * Fixed Display Issue with PeepSo Widgets
161
+ * Fixed Display Issue with WPML added languages
162
+
163
  = 3.8.4 =
164
 
165
  * Fixed PHP Notice: Undefined variable