AVH Extended Categories Widgets - Version 3.5

Version Description

Download this release

Release Info

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

Code changes from version 3.4.2 to 3.5

2.8/class/avh-ec.core.php CHANGED
@@ -27,12 +27,12 @@ class AVH_EC_Core
27
  */
28
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
29
 
30
- $this->version = '3.4.2';
31
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
32
  $this->db_options_core = 'avhec';
33
  $this->db_options_tax_meta = 'avhec-tax_meta';
34
 
35
- add_action('init', array(&$this, 'handleInitializePlugin'), 10);
36
  }
37
 
38
  /**
@@ -56,20 +56,20 @@ class AVH_EC_Core
56
  $info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
57
 
58
  // Set class property for info
59
- $this->info = array('home'=>get_option('home'), 'siteurl'=>$info['siteurl'], 'plugin_dir'=>$info['plugin_dir'], 'lang_dir'=>$info['lang_dir'], 'graphics_url'=>$info['graphics_url']);
60
 
61
  // Set the default options
62
- $this->default_options_general = array('version'=>$this->version, 'dbversion'=>$db_version, 'alternative_name_select_category'=>'');
63
 
64
  // Set the default category group options
65
  $no_group_id = $catgrp->getTermIDBy('slug', 'none');
66
  $home_group_id = $catgrp->getTermIDBy('slug', 'home');
67
  $default_group_id = $catgrp->getTermIDBy('slug', 'all');
68
- $this->default_options_category_group = array('no_group'=>$no_group_id, 'home_group'=>$home_group_id, 'default_group'=>$default_group_id);
69
 
70
- $this->default_options_sp_category_group = array('home_group'=>$home_group_id, 'category_group'=>$default_group_id, 'day_group'=>$default_group_id, 'month_group'=>$default_group_id, 'year_group'=>$default_group_id, 'author_group'=>$default_group_id, 'search_group'=>$default_group_id);
71
 
72
- $this->default_options = array('general'=>$this->default_options_general, 'cat_group'=>$this->default_options_category_group, 'widget_titles'=>array(), 'sp_cat_group'=>$this->default_options_sp_category_group);
73
 
74
  /**
75
  * Set the options for the program
@@ -83,9 +83,18 @@ class AVH_EC_Core
83
  }
84
 
85
  $this->handleTextdomain();
 
86
 
87
  }
88
 
 
 
 
 
 
 
 
 
89
  /**
90
  * Loads the i18n
91
  *
@@ -289,7 +298,7 @@ class AVH_EC_Core
289
  {
290
  $mywalker = new AVH_Walker_CategoryDropdown();
291
 
292
- $defaults = array('show_option_all'=>'', 'show_option_none'=>'', 'orderby'=>'id', 'order'=>'ASC', 'show_last_update'=>0, 'show_count'=>0, 'hide_empty'=>1, 'child_of'=>0, 'exclude'=>'', 'echo'=>1, 'selected'=>0, 'hierarchical'=>0, 'name'=>'cat', 'class'=>'postform', 'depth'=>0, 'tab_index'=>0, 'walker'=>$mywalker);
293
 
294
  $defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
295
 
@@ -379,7 +388,7 @@ class AVH_EC_Core
379
  function avh_wp_list_categories ($args = '', $selectedonly)
380
  {
381
  $mywalker = new AVHEC_Walker_Category();
382
- $defaults = array('show_option_all'=>'', 'orderby'=>'name', 'order'=>'ASC', 'show_last_update'=>0, 'style'=>'list', 'show_count'=>0, 'hide_empty'=>1, 'use_desc_for_title'=>1, 'child_of'=>0, 'feed'=>'', 'feed_type'=>'', 'feed_image'=>'', 'exclude'=>'', 'exclude_tree'=>'', 'current_category'=>0, 'hierarchical'=>true, 'title_li'=>__('Categories'), 'echo'=>1, 'depth'=>0, 'walker'=>$mywalker);
383
 
384
  $r = wp_parse_args($args, $defaults);
385
 
@@ -491,7 +500,7 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
491
 
492
  // flat display
493
  if (- 1 == $max_depth) {
494
- $empty_array = array();
495
  foreach ($elements as $e)
496
  $this->display_element($e, $empty_array, 1, 0, $args, $output);
497
  return $output;
@@ -503,8 +512,8 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
503
  * children_elements is two dimensional array, eg.
504
  * children_elements[10][] contains all sub-elements whose parent is 10.
505
  */
506
- $top_level_elements = array();
507
- $children_elements = array();
508
  foreach ($elements as $e) {
509
  if (0 == $e->$parent_field)
510
  $top_level_elements[] = $e;
@@ -521,8 +530,8 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
521
  $first = array_slice($elements, 0, 1);
522
  $root = $first[0];
523
 
524
- $top_level_elements = array();
525
- $children_elements = array();
526
  foreach ($elements as $e) {
527
  if ($root->$parent_field == $e->$parent_field)
528
  $top_level_elements[] = $e;
@@ -539,7 +548,7 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
539
  * then we got orphans, which should be displayed regardless
540
  */
541
  if ((0 == $max_depth) && count($children_elements) > 0) {
542
- $empty_array = array();
543
  foreach ($children_elements as $orphans)
544
  foreach ($orphans as $op)
545
  $this->display_element($op, $empty_array, 1, 0, $args, $output);
@@ -569,7 +578,7 @@ class AVHEC_Walker_Category extends Walker
569
  * @todo Decouple this
570
  * @var array
571
  */
572
- var $db_fields = array('parent'=>'parent', 'id'=>'term_id');
573
 
574
  /**
575
  * @see Walker::start_lvl()
27
  */
28
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
29
 
30
+ $this->version = '3.5';
31
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
32
  $this->db_options_core = 'avhec';
33
  $this->db_options_tax_meta = 'avhec-tax_meta';
34
 
35
+ add_action('init', array ( &$this, 'handleInitializePlugin' ), 10);
36
  }
37
 
38
  /**
56
  $info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
57
 
58
  // Set class property for info
59
+ $this->info = array ( 'home' => get_option('home'), 'siteurl' => $info['siteurl'], 'plugin_dir' => $info['plugin_dir'], 'lang_dir' => $info['lang_dir'], 'graphics_url' => $info['graphics_url'] );
60
 
61
  // Set the default options
62
+ $this->default_options_general = array ( 'version' => $this->version, 'dbversion' => $db_version, 'alternative_name_select_category' => '' );
63
 
64
  // Set the default category group options
65
  $no_group_id = $catgrp->getTermIDBy('slug', 'none');
66
  $home_group_id = $catgrp->getTermIDBy('slug', 'home');
67
  $default_group_id = $catgrp->getTermIDBy('slug', 'all');
68
+ $this->default_options_category_group = array ( 'no_group' => $no_group_id, 'home_group' => $home_group_id, 'default_group' => $default_group_id );
69
 
70
+ $this->default_options_sp_category_group = array ( 'home_group' => $home_group_id, 'category_group' => $default_group_id, 'day_group' => $default_group_id, 'month_group' => $default_group_id, 'year_group' => $default_group_id, 'author_group' => $default_group_id, 'search_group' => $default_group_id );
71
 
72
+ $this->default_options = array ( 'general' => $this->default_options_general, 'cat_group' => $this->default_options_category_group, 'widget_titles' => array (), 'sp_cat_group' => $this->default_options_sp_category_group );
73
 
74
  /**
75
  * Set the options for the program
83
  }
84
 
85
  $this->handleTextdomain();
86
+ add_filter('get_terms_orderby', array ( &$this, 'applyOrderFilter' ), 10, 2);
87
 
88
  }
89
 
90
+ function applyOrderFilter ($orderby, $args)
91
+ {
92
+ if ($args['orderby'] == 'avhec_3rdparty_mycategoryorder')
93
+ return 't.term_order';
94
+ else
95
+ return $orderby;
96
+ }
97
+
98
  /**
99
  * Loads the i18n
100
  *
298
  {
299
  $mywalker = new AVH_Walker_CategoryDropdown();
300
 
301
+ $defaults = array ( 'show_option_all' => '', 'show_option_none' => '', 'orderby' => 'id', 'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'walker' => $mywalker );
302
 
303
  $defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
304
 
388
  function avh_wp_list_categories ($args = '', $selectedonly)
389
  {
390
  $mywalker = new AVHEC_Walker_Category();
391
+ $defaults = array ( 'show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0, 'hierarchical' => true, 'title_li' => __('Categories'), 'echo' => 1, 'depth' => 0, 'walker' => $mywalker );
392
 
393
  $r = wp_parse_args($args, $defaults);
394
 
500
 
501
  // flat display
502
  if (- 1 == $max_depth) {
503
+ $empty_array = array ();
504
  foreach ($elements as $e)
505
  $this->display_element($e, $empty_array, 1, 0, $args, $output);
506
  return $output;
512
  * children_elements is two dimensional array, eg.
513
  * children_elements[10][] contains all sub-elements whose parent is 10.
514
  */
515
+ $top_level_elements = array ();
516
+ $children_elements = array ();
517
  foreach ($elements as $e) {
518
  if (0 == $e->$parent_field)
519
  $top_level_elements[] = $e;
530
  $first = array_slice($elements, 0, 1);
531
  $root = $first[0];
532
 
533
+ $top_level_elements = array ();
534
+ $children_elements = array ();
535
  foreach ($elements as $e) {
536
  if ($root->$parent_field == $e->$parent_field)
537
  $top_level_elements[] = $e;
548
  * then we got orphans, which should be displayed regardless
549
  */
550
  if ((0 == $max_depth) && count($children_elements) > 0) {
551
+ $empty_array = array ();
552
  foreach ($children_elements as $orphans)
553
  foreach ($orphans as $op)
554
  $this->display_element($op, $empty_array, 1, 0, $args, $output);
578
  * @todo Decouple this
579
  * @var array
580
  */
581
+ var $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' );
582
 
583
  /**
584
  * @see Walker::start_lvl()
2.8/class/avh-ec.widgets.php CHANGED
@@ -217,6 +217,9 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
217
  $options['name'] = __('Name', 'avh-ec');
218
  $options['count'] = __('Count', 'avh-ec');
219
  $options['slug'] = __('Slug', 'avh-ec');
 
 
 
220
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
221
  unset($options);
222
 
217
  $options['name'] = __('Name', 'avh-ec');
218
  $options['count'] = __('Count', 'avh-ec');
219
  $options['slug'] = __('Slug', 'avh-ec');
220
+ if (is_plugin_active('my-category-order/mycategoryorder.php')) {
221
+ $options['avhec_3rdparty_mycategoryorder'] = __('My Category Order', 'avh-ec');
222
+ }
223
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
224
  unset($options);
225
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: petervanderdoes
3
  Donate link: http://blog.avirtualhome.com/wordpress-plugins/
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
- Tested up to: 3.2.1
7
- Stable tag: 3.4.2
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
@@ -25,7 +25,7 @@ The replacement widget gives you the following customizable options:
25
  * Hide empty categories.
26
  * Show categories hierarchical.
27
  * Show categories up to a certain depth. (Requires WordPress 2.8 or higher).
28
- * Sort by ID, Name, Count, Slug.
29
  * Sort ascending or descending.
30
  * Show RSS link after the category as text or image.
31
  * Select which categories to show. (Requires WordPress 2.5.1 or higher).
@@ -134,9 +134,11 @@ Whether Widget 2 shows Movie or Music depends on the creation order of groups. I
134
  None
135
 
136
  == Changelog ==
 
 
 
137
  = Version 3.4.2 =
138
  * Bugfix: Fails to display the Category Group Widget when the widget is to display any group.
139
- * Foo line
140
 
141
  = Version 3.4.1 =
142
  * Bugfix: Problems with multiple category group widgets.
3
  Donate link: http://blog.avirtualhome.com/wordpress-plugins/
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
+ Tested up to: 3.3
7
+ Stable tag: 3.5
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
25
  * Hide empty categories.
26
  * Show categories hierarchical.
27
  * Show categories up to a certain depth. (Requires WordPress 2.8 or higher).
28
+ * Sort by ID, Name, Count, Slug and manual order set by the plugin My Category Order.
29
  * Sort ascending or descending.
30
  * Show RSS link after the category as text or image.
31
  * Select which categories to show. (Requires WordPress 2.5.1 or higher).
134
  None
135
 
136
  == Changelog ==
137
+ = Version 3.5 =
138
+ * RFC: Adds the ability for the widgets to sort the categories as set with plugin My Category Order. This plugin allows to order categories manually.
139
+
140
  = Version 3.4.2 =
141
  * Bugfix: Fails to display the Category Group Widget when the widget is to display any group.
 
142
 
143
  = Version 3.4.1 =
144
  * Bugfix: Problems with multiple category group widgets.
widget-pre2.8.php CHANGED
@@ -9,7 +9,7 @@ function widget_extended_categories_init ()
9
 
10
  function widget_extended_categories ($args, $number = 1)
11
  {
12
- $version = '3.4.2';
13
  // Check for version
14
  require (ABSPATH . WPINC . '/version.php');
15
  if (version_compare($wp_version, '2.5.1', '<')) {
9
 
10
  function widget_extended_categories ($args, $number = 1)
11
  {
12
+ $version = '3.5';
13
  // Check for version
14
  require (ABSPATH . WPINC . '/version.php');
15
  if (version_compare($wp_version, '2.5.1', '<')) {
widget_extended_categories.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: AVH Extended Categories Widgets
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: 3.4.2
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9
 
3
  Plugin Name: AVH Extended Categories Widgets
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: 3.5
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9