Version Description
Fixed the issue when in some cases the plugin displayed user logic errors in the Widgets section and this didn't allow to save the widgets. https://wordpress.org/support/topic/an-error-has-occurred-please-reload-the-page-and-try-again-3/
Fixed ini_set() related warnings for some rare hosting configurations. https://wordpress.org/support/topic/ini_set-diabled-warning/
Download this release
Release Info
Developer | wpchefgadget |
Plugin | Widget Logic |
Version | 5.7.3 |
Comparing to | |
See all releases |
Code changes from version 5.7.2 to 5.7.3
- readme.txt +9 -2
- widget_logic.php +18 -31
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: wpchefgadget, alanft
|
|
3 |
Donate link: http://www.justgiving.com/widgetlogic_cancerresearchuk
|
4 |
Tags: widget, admin, conditional tags, filter, context
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag: 5.7.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Widget Logic lets you control on which pages widgets appear using WP's conditional tags. It also adds a 'widget_content' filter.
|
@@ -119,6 +119,13 @@ Tighten up your definitions with PHPs 'logical AND' &&, for example:
|
|
119 |
|
120 |
== Changelog ==
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
= 5.7.2 =
|
123 |
Removed conflicts with outdated WP versions.
|
124 |
|
3 |
Donate link: http://www.justgiving.com/widgetlogic_cancerresearchuk
|
4 |
Tags: widget, admin, conditional tags, filter, context
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.7.4
|
7 |
+
Stable tag: 5.7.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Widget Logic lets you control on which pages widgets appear using WP's conditional tags. It also adds a 'widget_content' filter.
|
119 |
|
120 |
== Changelog ==
|
121 |
|
122 |
+
= 5.7.3 =
|
123 |
+
Fixed the issue when in some cases the plugin displayed user logic errors in the Widgets section and this didn't allow to save the widgets.
|
124 |
+
https://wordpress.org/support/topic/an-error-has-occurred-please-reload-the-page-and-try-again-3/
|
125 |
+
|
126 |
+
Fixed ini_set() related warnings for some rare hosting configurations.
|
127 |
+
https://wordpress.org/support/topic/ini_set-diabled-warning/
|
128 |
+
|
129 |
= 5.7.2 =
|
130 |
Removed conflicts with outdated WP versions.
|
131 |
|
widget_logic.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Widget Logic
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/widget-logic/
|
5 |
Description: Control widgets with WP's conditional tags is_home etc
|
6 |
-
Version: 5.7.
|
7 |
Author: wpchefgadget, alanft
|
8 |
|
9 |
Text Domain: widget-logic
|
@@ -35,13 +35,6 @@ function widget_logic_init()
|
|
35 |
{
|
36 |
load_plugin_textdomain( 'widget-logic', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
37 |
|
38 |
-
/*
|
39 |
-
if ( ! )
|
40 |
-
return;
|
41 |
-
|
42 |
-
if ( )
|
43 |
-
return;
|
44 |
-
*/
|
45 |
if ( is_admin() )
|
46 |
{
|
47 |
if ( get_option('widget_logic_version') != WIDGET_LOGIC_VERSION )
|
@@ -107,13 +100,18 @@ function widget_logic_sidebars_widgets_filter_add()
|
|
107 |
// CALLED VIA 'widget_update_callback' FILTER (ajax update of a widget)
|
108 |
function widget_logic_ajax_update_callback($instance, $new_instance, $old_instance, $this_widget)
|
109 |
{
|
|
|
|
|
110 |
global $wl_options;
|
111 |
$widget_id=$this_widget->id;
|
112 |
if ( isset($_POST[$widget_id.'-widget_logic']))
|
113 |
{
|
114 |
$wl_options[$widget_id]=trim($_POST[$widget_id.'-widget_logic']);
|
115 |
-
update_option('widget_logic', $wl_options);
|
|
|
|
|
116 |
}
|
|
|
117 |
return $instance;
|
118 |
}
|
119 |
|
@@ -308,23 +306,6 @@ function widget_logic_extra_control()
|
|
308 |
}
|
309 |
// output our extra widget logic field
|
310 |
echo "<p><label for='".$id_disp."-widget_logic'>". __('Widget logic:','widget-logic'). " <textarea class='widefat' type='text' name='".$id_disp."-widget_logic' id='".$id_disp."-widget_logic' >".$value."</textarea></label></p>";
|
311 |
-
if ( !empty($wl_options['widget_logic-options-show_errors']) && trim($value) && version_compare( PHP_VERSION, '7.0', '>=' ) )
|
312 |
-
{
|
313 |
-
$test = '$result = ('.trim(stripslashes($wl_options[$id ])).'); return true;';
|
314 |
-
try {
|
315 |
-
eval($test);
|
316 |
-
} catch ( Error $e )
|
317 |
-
{
|
318 |
-
?>
|
319 |
-
<div class="notice notice-error inline">
|
320 |
-
<p>
|
321 |
-
The code triggered a PHP error. It might still work on the front-end though b/c of different code environment.
|
322 |
-
<br><code><?php esc_html_e($e->getMessage()) ?></code>
|
323 |
-
</p>
|
324 |
-
</div>
|
325 |
-
<?php
|
326 |
-
}
|
327 |
-
}
|
328 |
}
|
329 |
|
330 |
|
@@ -372,22 +353,28 @@ function widget_logic_filter_sidebars_widgets($sidebars_widgets)
|
|
372 |
|
373 |
if (stristr($wl_value,"return")===false)
|
374 |
$wl_value="return (" . $wl_value . ");";
|
375 |
-
|
376 |
-
$
|
|
|
|
|
|
|
377 |
try {
|
378 |
-
if (
|
379 |
ini_set( 'display_errors', 'On' );
|
380 |
|
381 |
if (!eval($wl_value))
|
382 |
unset($sidebars_widgets[$widget_area][$pos]);
|
383 |
|
384 |
-
|
|
|
385 |
}
|
386 |
catch ( Error $e ) {
|
387 |
if ( current_user_can('manage_options') && !empty($wl_options['widget_logic-options-show_errors']) )
|
388 |
trigger_error( 'Invalid Widget Logic: '.$e->getMessage(), E_USER_WARNING );
|
389 |
|
390 |
-
|
|
|
|
|
391 |
continue;
|
392 |
}
|
393 |
|
3 |
Plugin Name: Widget Logic
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/widget-logic/
|
5 |
Description: Control widgets with WP's conditional tags is_home etc
|
6 |
+
Version: 5.7.3
|
7 |
Author: wpchefgadget, alanft
|
8 |
|
9 |
Text Domain: widget-logic
|
35 |
{
|
36 |
load_plugin_textdomain( 'widget-logic', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
if ( is_admin() )
|
39 |
{
|
40 |
if ( get_option('widget_logic_version') != WIDGET_LOGIC_VERSION )
|
100 |
// CALLED VIA 'widget_update_callback' FILTER (ajax update of a widget)
|
101 |
function widget_logic_ajax_update_callback($instance, $new_instance, $old_instance, $this_widget)
|
102 |
{
|
103 |
+
//var_dump( $new_instance ); exit;
|
104 |
+
$capt = $instance->_captured_options;
|
105 |
global $wl_options;
|
106 |
$widget_id=$this_widget->id;
|
107 |
if ( isset($_POST[$widget_id.'-widget_logic']))
|
108 |
{
|
109 |
$wl_options[$widget_id]=trim($_POST[$widget_id.'-widget_logic']);
|
110 |
+
//update_option('widget_logic', $wl_options);
|
111 |
+
|
112 |
+
unset( $_POST[$widget_id.'-widget_logic'], $_REQUEST[$widget_id.'-widget_logic'] );
|
113 |
}
|
114 |
+
$instance->_captured_options = $capt;
|
115 |
return $instance;
|
116 |
}
|
117 |
|
306 |
}
|
307 |
// output our extra widget logic field
|
308 |
echo "<p><label for='".$id_disp."-widget_logic'>". __('Widget logic:','widget-logic'). " <textarea class='widefat' type='text' name='".$id_disp."-widget_logic' id='".$id_disp."-widget_logic' >".$value."</textarea></label></p>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
|
353 |
|
354 |
if (stristr($wl_value,"return")===false)
|
355 |
$wl_value="return (" . $wl_value . ");";
|
356 |
+
|
357 |
+
$show_errors = !empty($wl_options['widget_logic-options-show_errors']) && current_user_can('manage_options');
|
358 |
+
|
359 |
+
if ( $show_errors )
|
360 |
+
$save = ini_get('display_errors');
|
361 |
try {
|
362 |
+
if ( $show_errors )
|
363 |
ini_set( 'display_errors', 'On' );
|
364 |
|
365 |
if (!eval($wl_value))
|
366 |
unset($sidebars_widgets[$widget_area][$pos]);
|
367 |
|
368 |
+
if ( $show_errors )
|
369 |
+
ini_set( 'display_errors', $save );
|
370 |
}
|
371 |
catch ( Error $e ) {
|
372 |
if ( current_user_can('manage_options') && !empty($wl_options['widget_logic-options-show_errors']) )
|
373 |
trigger_error( 'Invalid Widget Logic: '.$e->getMessage(), E_USER_WARNING );
|
374 |
|
375 |
+
if ( $show_errors )
|
376 |
+
ini_set( 'display_errors', $save );
|
377 |
+
|
378 |
continue;
|
379 |
}
|
380 |
|