AVH Extended Categories Widgets - Version 1.5

Version Description

Download this release

Release Info

Developer petervanderdoes
Plugin Icon wp plugin AVH Extended Categories Widgets
Version 1.5
Comparing to
See all releases

Code changes from version 1.4.1 to 1.5

Files changed (2) hide show
  1. readme.txt +6 -3
  2. widget_extended_categories.php +54 -10
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Extended Categories Widget ===
2
- Contributors: petervanderdoes, datafeedr.com
3
  Donate link: http://blog.avirtualhome.com/wordpress-plugins/
4
  Tags: extended, categories, widget
5
  Requires at least: 2.3
6
- Tested up to: 2.7
7
- Stable tag: 1.4.1
8
 
9
  Replacement of the category widget to allow for greater customization of the category widget.
10
 
@@ -18,6 +18,7 @@ Replacement of the category widget to allow for greater customization of the cat
18
  * Show categories hierarchical.
19
  * Sort by ID, Name,Count.
20
  * Sort ascending or descending.
 
21
  * Select which categories to show. (Requires WordPress 2.5.1 or higher)
22
 
23
  == Installation ==
@@ -40,6 +41,8 @@ I created a support site at http://forums.avirtualhome.com where you can ask que
40
  None
41
 
42
  == Arbitrary section ==
 
 
43
  * Version 1.4.1
44
  * Bugfix: Problem when using multiple widgets with the dropdown option.
45
  * Version 1.4
1
  === Extended Categories Widget ===
2
+ Contributors: petervanderdoes
3
  Donate link: http://blog.avirtualhome.com/wordpress-plugins/
4
  Tags: extended, categories, widget
5
  Requires at least: 2.3
6
+ Tested up to: 2.7.1
7
+ Stable tag: 1.5
8
 
9
  Replacement of the category widget to allow for greater customization of the category widget.
10
 
18
  * Show categories hierarchical.
19
  * Sort by ID, Name,Count.
20
  * Sort ascending or descending.
21
+ * Show RSS link after the category as text or image.
22
  * Select which categories to show. (Requires WordPress 2.5.1 or higher)
23
 
24
  == Installation ==
41
  None
42
 
43
  == Arbitrary section ==
44
+ * Version 1.5
45
+ * RFC: Option to show RSS feed after categories
46
  * Version 1.4.1
47
  * Bugfix: Problem when using multiple widgets with the dropdown option.
48
  * Version 1.4
widget_extended_categories.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Extended Category Widget
4
  Plugin URI: http://blog.avirtualhome.com/wordpress-plugins
5
  Description: Replacement of the category widget to allow for greater customization of the category widget.
6
- Version: 1.4.1
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9
 
@@ -31,7 +31,7 @@ function widget_extended_categories_init() {
31
  }
32
 
33
  function widget_extended_categories($args, $number = 1) {
34
- $version = '1.4.1';
35
  // Check for version
36
  global $wp_version;
37
  if ( version_compare($wp_version, '2.5.1', '<') ) {
@@ -46,16 +46,47 @@ function widget_extended_categories_init() {
46
  $e = $options [$number]['hide_empty'] ? '1' : '0';
47
  $s = $options [$number]['sort_column'] ? $options [$number]['sort_column'] : 'name';
48
  $o = $options [$number]['sort_order'] ? $options [$number]['sort_order'] : 'asc';
49
- $title = empty ( $options [$number]['title'] ) ? __ ( 'Categories' ) : $options [$number]['title'];
 
 
 
 
 
 
 
 
 
 
50
  $style = empty ( $options [$number]['style'] ) ? 'list' : $options [$number]['style'];
51
  if ($avh_extcat_canselectcats) {
52
  if ($options [$number]['post_category']) {
53
  $post_category = unserialize ( $options [$number]['post_category'] );
54
  $included_cats = implode ( ",", $post_category );
55
  }
56
- $cat_args = array ('include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'hide_empty' => $e, 'hierarchical' => $h, 'title_li' => '', 'show_option_none' => __ ( 'Select Category' ), 'name' => 'ec-cat-'.$number );
 
 
 
 
 
 
 
 
 
 
 
57
  } else {
58
- $cat_args = array ('orderby' => $s, 'order' => $o, 'show_count' => $c, 'hide_empty' => $e, 'hierarchical' => $h, 'title_li' => '', 'show_option_none' => __ ( 'Select Category' ), 'name' => 'ec-cat-'.$number);
 
 
 
 
 
 
 
 
 
 
59
  }
60
  echo $before_widget;
61
  echo '<!-- AVH Extended Categories version ' . $version .' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
@@ -105,6 +136,8 @@ function widget_extended_categories_init() {
105
  $newoptions [$number]['sort_column'] = strip_tags ( stripslashes ( $_POST ['categories-sort_column-' . $number] ) );
106
  $newoptions [$number]['sort_order'] = strip_tags ( stripslashes ( $_POST ['categories-sort_order-' . $number] ) );
107
  $newoptions [$number]['style'] = strip_tags ( stripslashes ( $_POST ['categories-style-' . $number] ) );
 
 
108
  if ($avh_extcat_canselectcats) {
109
  if (in_array ( '-1', $_POST ['post_category-' . $number], true )) {
110
  $newoptions [$number]['post_category'] = false;
@@ -133,6 +166,8 @@ function widget_extended_categories_init() {
133
  $sort_order_d = ($options [$number]['sort_order'] == 'desc') ? ' SELECTED' : '';
134
  $style_list = ($options [$number]['style'] == 'list') ? ' SELECTED' : '';
135
  $style_drop = ($options [$number]['style'] == 'drop') ? ' SELECTED' : '';
 
 
136
  if ($avh_extcat_canselectcats) {
137
  $selected_cats = ($options [$number]['post_category'] != '') ? unserialize ( $options [$number]['post_category'] ) : false;
138
  }
@@ -175,6 +210,15 @@ function widget_extended_categories_init() {
175
  <option value='drop' <?php echo $style_drop; ?>>Drop down</option>
176
  </select>
177
  </label>
 
 
 
 
 
 
 
 
 
178
  <?php
179
  if ($avh_extcat_canselectcats) {
180
  echo ' <b>Include these categories</b><hr />';
@@ -292,11 +336,11 @@ class AVH_Walker_Category_Checklist extends Walker {
292
  /**
293
  * Creates the categories checklist
294
  *
295
- * @param unknown_type $post_id
296
- * @param unknown_type $descendants_and_self
297
- * @param unknown_type $selected_cats
298
- * @param unknown_type $popular_cats
299
- * @param unknown_type $number
300
  */
301
  function avh_wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $number ) {
302
  $walker = new AVH_Walker_Category_Checklist;
3
  Plugin Name: Extended Category Widget
4
  Plugin URI: http://blog.avirtualhome.com/wordpress-plugins
5
  Description: Replacement of the category widget to allow for greater customization of the category widget.
6
+ Version: 1.5
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9
 
31
  }
32
 
33
  function widget_extended_categories($args, $number = 1) {
34
+ $version = '1.5';
35
  // Check for version
36
  global $wp_version;
37
  if ( version_compare($wp_version, '2.5.1', '<') ) {
46
  $e = $options [$number]['hide_empty'] ? '1' : '0';
47
  $s = $options [$number]['sort_column'] ? $options [$number]['sort_column'] : 'name';
48
  $o = $options [$number]['sort_order'] ? $options [$number]['sort_order'] : 'asc';
49
+ $r = $options [$number]['rssfeed'] ? 'RSS' : '';
50
+ $i = $options [$number]['rssimage'] ? $options [$number]['rssimage'] : '';
51
+ if (empty($r)) {
52
+ $i='';
53
+ }
54
+ if (!empty($i)){
55
+ if (! file_exists(ABSPATH . '/'. $i)) {
56
+ $i='';
57
+ }
58
+ }
59
+ $title = empty ( $options [$number]['title'] ) ? __ ( 'Categories' ) : attribute_escape($options [$number]['title']);
60
  $style = empty ( $options [$number]['style'] ) ? 'list' : $options [$number]['style'];
61
  if ($avh_extcat_canselectcats) {
62
  if ($options [$number]['post_category']) {
63
  $post_category = unserialize ( $options [$number]['post_category'] );
64
  $included_cats = implode ( ",", $post_category );
65
  }
66
+ $cat_args = array (
67
+ 'include' => $included_cats,
68
+ 'orderby' => $s,
69
+ 'order' => $o,
70
+ 'show_count' => $c,
71
+ 'hide_empty' => $e,
72
+ 'hierarchical' => $h,
73
+ 'title_li' => '',
74
+ 'show_option_none' => __ ( 'Select Category' ),
75
+ 'feed' => $r,
76
+ 'feed_image' => $i,
77
+ 'name' => 'ec-cat-'.$number );
78
  } else {
79
+ $cat_args = array (
80
+ 'orderby' => $s,
81
+ 'order' => $o,
82
+ 'show_count' => $c,
83
+ 'hide_empty' => $e,
84
+ 'hierarchical' => $h,
85
+ 'title_li' => '',
86
+ 'show_option_none' => __ ( 'Select Category' ),
87
+ 'feed' => $r,
88
+ 'feed_image' => $i,
89
+ 'name' => 'ec-cat-'.$number);
90
  }
91
  echo $before_widget;
92
  echo '<!-- AVH Extended Categories version ' . $version .' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
136
  $newoptions [$number]['sort_column'] = strip_tags ( stripslashes ( $_POST ['categories-sort_column-' . $number] ) );
137
  $newoptions [$number]['sort_order'] = strip_tags ( stripslashes ( $_POST ['categories-sort_order-' . $number] ) );
138
  $newoptions [$number]['style'] = strip_tags ( stripslashes ( $_POST ['categories-style-' . $number] ) );
139
+ $newoptions [$number]['rssfeed'] = isset ( $_POST ['categories-rssfeed-' . $number] );
140
+ $newoptions [$number]['rssimage'] = attribute_escape ( $_POST ['categories-rssimage-' . $number] );
141
  if ($avh_extcat_canselectcats) {
142
  if (in_array ( '-1', $_POST ['post_category-' . $number], true )) {
143
  $newoptions [$number]['post_category'] = false;
166
  $sort_order_d = ($options [$number]['sort_order'] == 'desc') ? ' SELECTED' : '';
167
  $style_list = ($options [$number]['style'] == 'list') ? ' SELECTED' : '';
168
  $style_drop = ($options [$number]['style'] == 'drop') ? ' SELECTED' : '';
169
+ $rssfeed = $options [$number]['rssfeed'] ? 'checked="checked"' : '';
170
+ $rssimage = htmlspecialchars ( $options [$number]['rssimage'], ENT_QUOTES );
171
  if ($avh_extcat_canselectcats) {
172
  $selected_cats = ($options [$number]['post_category'] != '') ? unserialize ( $options [$number]['post_category'] ) : false;
173
  }
210
  <option value='drop' <?php echo $style_drop; ?>>Drop down</option>
211
  </select>
212
  </label>
213
+
214
+ <label for="categories-rssfeed-<?php echo $number; ?>" style="line-height: 35px; display: block;">Show RSS Feed
215
+ <input class="checkbox" type="checkbox" <?php echo $rssfeed; ?> id="categories-rssfeed-<?php echo $number; ?>" name="categories-rssfeed-<?php echo $number; ?>" />
216
+ </label>
217
+
218
+ <label for="categories-rssimage-<?php echo $number; ?>"><?php _e ( 'Full path to RSS image:' ); ?>
219
+ <input style="width: 250px;" id="categories-rssimage-<?php echo $number; ?>" name="categories-rssimage-<?php echo $number; ?>" type="text" value="<?php echo $rssimage; ?>" />
220
+ </label>
221
+
222
  <?php
223
  if ($avh_extcat_canselectcats) {
224
  echo ' <b>Include these categories</b><hr />';
336
  /**
337
  * Creates the categories checklist
338
  *
339
+ * @param int $post_id
340
+ * @param int $descendants_and_self
341
+ * @param array $selected_cats
342
+ * @param array $popular_cats
343
+ * @param int $number
344
  */
345
  function avh_wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $number ) {
346
  $walker = new AVH_Walker_Category_Checklist;