Version Description
Kill some poor coding practices that throws debug notices - thanks to John James Jacoby.
Download this release
Release Info
Developer | alanft |
Plugin | Widget Logic |
Version | 0.48 |
Comparing to | |
See all releases |
Code changes from version 0.47 to 0.48
- readme.txt +5 -2
- widget_logic.php +7 -7
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: alanft
|
|
3 |
Donate link: http://www.justgiving.com/widgetlogic_cancerresearchuk
|
4 |
Tags: widget, admin, conditional tags, filter, context
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Widget Logic lets you control on which pages widgets appear. It uses any of WP's conditional tags. It also adds a 'widget_content' filter.
|
10 |
|
@@ -127,6 +127,9 @@ function make_alternating_widget_styles($content='')
|
|
127 |
|
128 |
== Changelog ==
|
129 |
|
|
|
|
|
|
|
130 |
= 0.47 =
|
131 |
FINALLY tracked down the elusive 'wp_reset_query' option resetting bug.
|
132 |
|
3 |
Donate link: http://www.justgiving.com/widgetlogic_cancerresearchuk
|
4 |
Tags: widget, admin, conditional tags, filter, context
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 3.1
|
7 |
+
Stable tag: 0.48
|
8 |
|
9 |
Widget Logic lets you control on which pages widgets appear. It uses any of WP's conditional tags. It also adds a 'widget_content' filter.
|
10 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
= 0.48 =
|
131 |
+
Kill some poor coding practices that throws debug notices - thanks to John James Jacoby.
|
132 |
+
|
133 |
= 0.47 =
|
134 |
FINALLY tracked down the elusive 'wp_reset_query' option resetting bug.
|
135 |
|
widget_logic.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Widget Logic
|
|
4 |
Plugin URI: http://freakytrigger.co.uk/wordpress-setup/
|
5 |
Description: Control widgets with WP's conditional tags is_home etc
|
6 |
Author: Alan Trewartha
|
7 |
-
Version: 0.
|
8 |
Author URI: http://freakytrigger.co.uk/author/alan/
|
9 |
*/
|
10 |
|
@@ -115,7 +115,7 @@ function widget_logic_extra_control()
|
|
115 |
if (is_callable($callback))
|
116 |
call_user_func_array($callback, $params); // go to the original control function
|
117 |
|
118 |
-
$value=htmlspecialchars(stripslashes($wl_options[$id]),ENT_QUOTES);
|
119 |
|
120 |
// dealing with multiple widgets - get the number. if -1 this is the 'template' for the admin interface
|
121 |
if (is_array($params[0]) && isset($params[0]['number'])) $number=$params[0]['number'];
|
@@ -134,7 +134,7 @@ add_action('wp_head', 'widget_logic_redirect_callback');
|
|
134 |
function widget_logic_redirect_callback()
|
135 |
{ global $wp_registered_widgets;
|
136 |
foreach ( $wp_registered_widgets as $id => $widget )
|
137 |
-
{ if (
|
138 |
{ array_push($wp_registered_widgets[$id]['params'],$id);
|
139 |
$wp_registered_widgets[$id]['callback_wl_redirect']=$wp_registered_widgets[$id]['callback'];
|
140 |
$wp_registered_widgets[$id]['callback']='widget_logic_redirected_callback';
|
@@ -151,16 +151,16 @@ function widget_logic_redirected_callback()
|
|
151 |
$callback=$wp_registered_widgets[$id]['callback_wl_redirect']; // find the real callback
|
152 |
|
153 |
$wl_options = get_option('widget_logic'); // do we want the widget?
|
154 |
-
$wl_value=($wl_options[$id])?stripslashes($wl_options[$id]):"true";
|
155 |
-
$wl_value=(stristr($wl_value, "return"))
|
156 |
|
157 |
// before we execute the condtional code, perhaps we want to wp_reset_query...
|
158 |
-
if ($wl_options['widget_logic-options-wp_reset_query']=='checked' &&
|
159 |
{ wp_reset_query(); $wp_reset_query_is_done=true; }
|
160 |
|
161 |
$wl_value=(eval($wl_value) && is_callable($callback));
|
162 |
if ( $wl_value )
|
163 |
-
{ if ($wl_options['widget_logic-options-filter']!='checked')
|
164 |
call_user_func_array($callback, $params); // if so callback with original params!
|
165 |
else
|
166 |
{ ob_start();
|
4 |
Plugin URI: http://freakytrigger.co.uk/wordpress-setup/
|
5 |
Description: Control widgets with WP's conditional tags is_home etc
|
6 |
Author: Alan Trewartha
|
7 |
+
Version: 0.48
|
8 |
Author URI: http://freakytrigger.co.uk/author/alan/
|
9 |
*/
|
10 |
|
115 |
if (is_callable($callback))
|
116 |
call_user_func_array($callback, $params); // go to the original control function
|
117 |
|
118 |
+
$value = !empty( $wl_options[$id ] ) ? htmlspecialchars( stripslashes( $wl_options[$id ] ),ENT_QUOTES ) : '';
|
119 |
|
120 |
// dealing with multiple widgets - get the number. if -1 this is the 'template' for the admin interface
|
121 |
if (is_array($params[0]) && isset($params[0]['number'])) $number=$params[0]['number'];
|
134 |
function widget_logic_redirect_callback()
|
135 |
{ global $wp_registered_widgets;
|
136 |
foreach ( $wp_registered_widgets as $id => $widget )
|
137 |
+
{ if ( empty( $wp_registered_widgets[$id]['callback_wl_redirect'] ) )
|
138 |
{ array_push($wp_registered_widgets[$id]['params'],$id);
|
139 |
$wp_registered_widgets[$id]['callback_wl_redirect']=$wp_registered_widgets[$id]['callback'];
|
140 |
$wp_registered_widgets[$id]['callback']='widget_logic_redirected_callback';
|
151 |
$callback=$wp_registered_widgets[$id]['callback_wl_redirect']; // find the real callback
|
152 |
|
153 |
$wl_options = get_option('widget_logic'); // do we want the widget?
|
154 |
+
$wl_value = ( !empty( $wl_options[$id] ) ) ? stripslashes( $wl_options[$id] ) : "true";
|
155 |
+
$wl_value = ( stristr( $wl_value, "return" ) ) ? $wl_value : "return (" . $wl_value . ");";
|
156 |
|
157 |
// before we execute the condtional code, perhaps we want to wp_reset_query...
|
158 |
+
if ( !empty( $wl_options['widget_logic-options-wp_reset_query'] ) && ( $wl_options['widget_logic-options-wp_reset_query'] == 'checked' ) && empty( $wp_reset_query_is_done ) )
|
159 |
{ wp_reset_query(); $wp_reset_query_is_done=true; }
|
160 |
|
161 |
$wl_value=(eval($wl_value) && is_callable($callback));
|
162 |
if ( $wl_value )
|
163 |
+
{ if ( !empty( $wl_options['widget_logic-options-filter'] ) && ( $wl_options['widget_logic-options-filter'] != 'checked' ) )
|
164 |
call_user_func_array($callback, $params); // if so callback with original params!
|
165 |
else
|
166 |
{ ob_start();
|