Widget Context - Version 0.7.2

Version Description

= 0.7.1 = Confirm that plugin works with the latest version of WordPress.

= 0.7 = Bug fix: check for active sidebars only after $paged has been set.

= 0.6 = Performance improvements - don't check if sidebar has any widgets on every widget load.

Download this release

Release Info

Developer kasparsd
Plugin Icon 128x128 Widget Context
Version 0.7.2
Comparing to
See all releases

Code changes from version 0.7.1 to 0.7.2

Files changed (3) hide show
  1. readme.txt +3 -2
  2. screenshot-1.png +0 -0
  3. widget-context.php +8 -9
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: kasparsd
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kaspars%40konstruktors%2ecom&item_name=Widget%20Context%20Plugin%20for%20WordPress&no_shipping=1&no_note=1&tax=0&currency_code=EUR&lc=LV&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: widget, widget context, context, logic, widget logic, cms
5
  Requires at least: 2.8
6
- Tested up to: 3.4.2
7
- Stable tag: 0.7.1
8
 
9
  Show widgets in context - only on certain posts, front page, category or tag pages etc.
10
 
@@ -23,6 +23,7 @@ For news and updates regarding this plugin, check http://konstruktors.com/blog/
23
 
24
  == Changelog ==
25
 
 
26
  * **0.7.1** - Confirm that the plugin works with the latest version of WP.
27
  * **0.7** - Bug fix: check for active sidebars only after $paged has been set.
28
  * **0.6** - Don't check for used sidebars on each widget load. Allow absolute URLs in the URL check.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kaspars%40konstruktors%2ecom&item_name=Widget%20Context%20Plugin%20for%20WordPress&no_shipping=1&no_note=1&tax=0&currency_code=EUR&lc=LV&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: widget, widget context, context, logic, widget logic, cms
5
  Requires at least: 2.8
6
+ Tested up to: 3.5.1
7
+ Stable tag: 0.7.2
8
 
9
  Show widgets in context - only on certain posts, front page, category or tag pages etc.
10
 
23
 
24
  == Changelog ==
25
 
26
+ * **0.7.2** - Fix PHP warnings/notices
27
  * **0.7.1** - Confirm that the plugin works with the latest version of WP.
28
  * **0.7** - Bug fix: check for active sidebars only after $paged has been set.
29
  * **0.6** - Don't check for used sidebars on each widget load. Allow absolute URLs in the URL check.
screenshot-1.png CHANGED
Binary file
widget-context.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Widget Context
4
  Plugin URI: http://konstruktors.com/
5
  Description: Display widgets in context.
6
- Version: 0.7.1
7
  Author: Kaspars Dambis
8
  Author URI: http://konstruktors.com/
9
 
@@ -154,7 +154,7 @@ class widget_context {
154
 
155
  foreach ($wp_registered_widgets as $widget_id => $widget_data) {
156
  // Check if widget will be shown
157
- $do_show = $this->check_widget_visibility($this->context_options[$widget_id]);
158
 
159
  if (!$do_show) { // If not shown, remove it temporeraly from the list of existing widgets
160
  unregister_sidebar_widget($widget_id);
@@ -276,13 +276,11 @@ class widget_context {
276
  if (!is_single() && !is_page()) {
277
  if (preg_match('/<!--more(.*?)?-->/', $pure_content, $matches)) {
278
  $pure_content = explode($matches[0], $pure_content, 2);
279
- $words_in_post = str_word_count(strip_tags($pure_content[0]));
280
  }
281
  } else {
282
- $words_in_post = str_word_count(strip_tags($pure_content));
283
  }
284
-
285
- $this->words_on_page += $words_in_post;
286
  }
287
  }
288
  }
@@ -304,6 +302,7 @@ class widget_context {
304
  // Split on line breaks
305
  $split_urls = split("[\n ]+", (string)$vis_settings['url']['urls']);
306
  $current_url = $this->get_current_url();
 
307
  foreach ($split_urls as $id => $check_url) {
308
  $check_url = trim($check_url);
309
  if ($check_url !== '') {
@@ -346,8 +345,9 @@ class widget_context {
346
 
347
  // Check for word count
348
  $word_count_to_check = (int)$vis_settings['location']['word_count'];
349
-
350
- if ($vis_settings['location']['check_wordcount'] == 'on' && $word_count_to_check > 1) {
 
351
  $check_type = $vis_settings['location']['check_wordcount_type'];
352
 
353
  if (($check_type == 'more') && ($this->words_on_page > $word_count_to_check)) {
@@ -593,4 +593,3 @@ class widget_context {
593
  }
594
  }
595
 
596
- ?>
3
  Plugin Name: Widget Context
4
  Plugin URI: http://konstruktors.com/
5
  Description: Display widgets in context.
6
+ Version: 0.7.2
7
  Author: Kaspars Dambis
8
  Author URI: http://konstruktors.com/
9
 
154
 
155
  foreach ($wp_registered_widgets as $widget_id => $widget_data) {
156
  // Check if widget will be shown
157
+ $do_show = ( isset($this->context_options[$widget_id]) ) ? $this->check_widget_visibility($this->context_options[$widget_id]) : true;
158
 
159
  if (!$do_show) { // If not shown, remove it temporeraly from the list of existing widgets
160
  unregister_sidebar_widget($widget_id);
276
  if (!is_single() && !is_page()) {
277
  if (preg_match('/<!--more(.*?)?-->/', $pure_content, $matches)) {
278
  $pure_content = explode($matches[0], $pure_content, 2);
279
+ $this->words_on_page += str_word_count(strip_tags($pure_content[0]));
280
  }
281
  } else {
282
+ $this->words_on_page += str_word_count(strip_tags($pure_content));
283
  }
 
 
284
  }
285
  }
286
  }
302
  // Split on line breaks
303
  $split_urls = split("[\n ]+", (string)$vis_settings['url']['urls']);
304
  $current_url = $this->get_current_url();
305
+ $ignore_url = false;
306
  foreach ($split_urls as $id => $check_url) {
307
  $check_url = trim($check_url);
308
  if ($check_url !== '') {
345
 
346
  // Check for word count
347
  $word_count_to_check = (int)$vis_settings['location']['word_count'];
348
+
349
+ $ignore_word_count = false;
350
+ if (isset($vis_settings['location']['check_wordcount']) && $vis_settings['location']['check_wordcount'] == 'on' && $word_count_to_check > 1) {
351
  $check_type = $vis_settings['location']['check_wordcount_type'];
352
 
353
  if (($check_type == 'more') && ($this->words_on_page > $word_count_to_check)) {
593
  }
594
  }
595