AVH Extended Categories Widgets - Version 3.1

Version Description

Download this release

Release Info

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

Code changes from version 3.0.2 to 3.1

2.8/class/avh-ec.admin.php CHANGED
@@ -33,13 +33,6 @@ class AVH_EC_Admin
33
  add_action( 'admin_menu', array (&$this, 'actionAdminMenu' ) );
34
  add_filter( 'plugin_action_links_extended-categories-widget/widget_extended_categories.php', array (&$this, 'filterPluginActions' ), 10, 2 );
35
 
36
- // Register Style and Scripts
37
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
38
- wp_register_script( 'avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array ('jquery' ), $this->core->version, true );
39
- wp_register_style( 'avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array ('wp-admin' ), $this->core->version, 'screen' );
40
-
41
-
42
-
43
  // Actions used for editing posts
44
  add_action( 'load-post.php', array (&$this, 'actionLoadPostPage' ) );
45
  add_action( 'load-page.php', array (&$this, 'actionLoadPostPage' ) );
@@ -173,6 +166,11 @@ class AVH_EC_Admin
173
  function actionAdminMenu ()
174
  {
175
 
 
 
 
 
 
176
  // Metaboxes for the Category Group on the post and page pages
177
  add_meta_box( 'avhec_category_group_box_ID', __( 'Category Group', 'avh-ec' ), array (&$this, 'metaboxPostCategoryGroup' ), 'post', 'side', 'core' );
178
  add_meta_box( 'avhec_category_group_box_ID', __( 'Category Group', 'avh-ec' ), array (&$this, 'metaboxPostCategoryGroup' ), 'page', 'side', 'core' );
@@ -186,9 +184,16 @@ class AVH_EC_Admin
186
  $this->hooks['menu_faq'] = add_submenu_page( $folder, 'AVH Extended Categories:' . __( 'F.A.Q', 'avh-ec' ), __( 'F.A.Q', 'avh-ec' ), 'manage_options', 'avhec-faq', array (&$this, 'doMenuFAQ' ) );
187
 
188
  // Add actions for menu pages
 
189
  add_action( 'load-' . $this->hooks['menu_overview'], array (&$this, 'actionLoadPageHook_Overview' ) );
 
 
190
  add_action( 'load-' . $this->hooks['menu_general'], array (&$this, 'actionLoadPageHook_General' ) );
 
 
191
  add_action( 'load-' . $this->hooks['menu_category_groups'], array (&$this, 'actionLoadPageHook_CategoryGroup' ) );
 
 
192
  add_action( 'load-' . $this->hooks['menu_faq'], array (&$this, 'actionLoadPageHook_faq' ) );
193
  }
194
 
@@ -203,14 +208,18 @@ class AVH_EC_Admin
203
 
204
  add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
205
 
206
- // WordPress core Styles and Scripts
207
  wp_enqueue_script( 'common' );
208
  wp_enqueue_script( 'wp-lists' );
209
  wp_enqueue_script( 'postbox' );
210
- wp_admin_css( 'css/dashboard' );
211
 
212
- // Plugin Style and Scripts
213
  wp_enqueue_script( 'avhec-categorygroup-js' );
 
 
 
 
 
214
  wp_enqueue_style( 'avhec-admin-css' );
215
  }
216
 
@@ -272,14 +281,17 @@ class AVH_EC_Admin
272
 
273
  add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
274
 
275
- // WordPress core Styles and Scripts
276
  wp_enqueue_script( 'common' );
277
  wp_enqueue_script( 'wp-lists' );
278
  wp_enqueue_script( 'postbox' );
 
 
279
  wp_admin_css( 'css/dashboard' );
280
 
281
  // Plugin Style and Scripts
282
  wp_enqueue_style( 'avhec-admin-css' );
 
283
  }
284
 
285
  /**
@@ -427,16 +439,20 @@ class AVH_EC_Admin
427
  add_meta_box( 'avhecBoxCategoryGroupList', __( 'Group Overview', 'avh-ec' ), array (&$this, 'metaboxCategoryGroupList' ), $this->hooks['menu_category_groups'], 'side', 'core' );
428
 
429
  add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
430
-
431
- // WordPress core Styles and Scripts
432
  wp_enqueue_script( 'common' );
433
  wp_enqueue_script( 'wp-lists' );
434
  wp_enqueue_script( 'postbox' );
 
 
435
  wp_enqueue_script( 'avhec-categorygroup-js' );
 
 
436
  wp_admin_css( 'css/dashboard' );
437
 
438
- // Plugin Style and Scripts
439
  wp_enqueue_style( 'avhec-admin-css' );
 
440
  }
441
 
442
  /**
@@ -670,9 +686,11 @@ class AVH_EC_Admin
670
  wp_enqueue_script( 'common' );
671
  wp_enqueue_script( 'wp-lists' );
672
  wp_enqueue_script( 'postbox' );
 
 
673
  wp_admin_css( 'css/dashboard' );
674
 
675
- // Plugin Style and Scripts
676
  wp_enqueue_style( 'avhec-admin-css' );
677
 
678
  }
@@ -856,8 +874,7 @@ class AVH_EC_Admin
856
  *
857
  * @param $columns
858
  * @return Array
859
- * @see print_column_headers
860
- * @see get_column_headers
861
  */
862
  function filterManageCategoriesGroupColumns ( $columns )
863
  {
33
  add_action( 'admin_menu', array (&$this, 'actionAdminMenu' ) );
34
  add_filter( 'plugin_action_links_extended-categories-widget/widget_extended_categories.php', array (&$this, 'filterPluginActions' ), 10, 2 );
35
 
 
 
 
 
 
 
 
36
  // Actions used for editing posts
37
  add_action( 'load-post.php', array (&$this, 'actionLoadPostPage' ) );
38
  add_action( 'load-page.php', array (&$this, 'actionLoadPostPage' ) );
166
  function actionAdminMenu ()
167
  {
168
 
169
+ // Register Style and Scripts
170
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
171
+ wp_register_script( 'avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array ('jquery' ), $this->core->version, true );
172
+ wp_register_style( 'avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array ('wp-admin' ), $this->core->version, 'screen' );
173
+
174
  // Metaboxes for the Category Group on the post and page pages
175
  add_meta_box( 'avhec_category_group_box_ID', __( 'Category Group', 'avh-ec' ), array (&$this, 'metaboxPostCategoryGroup' ), 'post', 'side', 'core' );
176
  add_meta_box( 'avhec_category_group_box_ID', __( 'Category Group', 'avh-ec' ), array (&$this, 'metaboxPostCategoryGroup' ), 'page', 'side', 'core' );
184
  $this->hooks['menu_faq'] = add_submenu_page( $folder, 'AVH Extended Categories:' . __( 'F.A.Q', 'avh-ec' ), __( 'F.A.Q', 'avh-ec' ), 'manage_options', 'avhec-faq', array (&$this, 'doMenuFAQ' ) );
185
 
186
  // Add actions for menu pages
187
+ // Overview Menu
188
  add_action( 'load-' . $this->hooks['menu_overview'], array (&$this, 'actionLoadPageHook_Overview' ) );
189
+
190
+ // General Options Menu
191
  add_action( 'load-' . $this->hooks['menu_general'], array (&$this, 'actionLoadPageHook_General' ) );
192
+
193
+ // Category Groups Menu
194
  add_action( 'load-' . $this->hooks['menu_category_groups'], array (&$this, 'actionLoadPageHook_CategoryGroup' ) );
195
+
196
+ // FAQ Menu
197
  add_action( 'load-' . $this->hooks['menu_faq'], array (&$this, 'actionLoadPageHook_faq' ) );
198
  }
199
 
208
 
209
  add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
210
 
211
+ // WordPress core Scripts
212
  wp_enqueue_script( 'common' );
213
  wp_enqueue_script( 'wp-lists' );
214
  wp_enqueue_script( 'postbox' );
 
215
 
216
+ // Plugin Scripts
217
  wp_enqueue_script( 'avhec-categorygroup-js' );
218
+
219
+ // WordPress core Styles
220
+ wp_admin_css( 'css/dashboard' );
221
+
222
+ // Plugin Style
223
  wp_enqueue_style( 'avhec-admin-css' );
224
  }
225
 
281
 
282
  add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
283
 
284
+ // WordPress core Scripts
285
  wp_enqueue_script( 'common' );
286
  wp_enqueue_script( 'wp-lists' );
287
  wp_enqueue_script( 'postbox' );
288
+
289
+ // WordPress core Styles
290
  wp_admin_css( 'css/dashboard' );
291
 
292
  // Plugin Style and Scripts
293
  wp_enqueue_style( 'avhec-admin-css' );
294
+
295
  }
296
 
297
  /**
439
  add_meta_box( 'avhecBoxCategoryGroupList', __( 'Group Overview', 'avh-ec' ), array (&$this, 'metaboxCategoryGroupList' ), $this->hooks['menu_category_groups'], 'side', 'core' );
440
 
441
  add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
442
+ // WordPress core Scripts
 
443
  wp_enqueue_script( 'common' );
444
  wp_enqueue_script( 'wp-lists' );
445
  wp_enqueue_script( 'postbox' );
446
+
447
+ // Plugin Scripts
448
  wp_enqueue_script( 'avhec-categorygroup-js' );
449
+
450
+ // WordPress core Styles
451
  wp_admin_css( 'css/dashboard' );
452
 
453
+ // Plugin Style
454
  wp_enqueue_style( 'avhec-admin-css' );
455
+
456
  }
457
 
458
  /**
686
  wp_enqueue_script( 'common' );
687
  wp_enqueue_script( 'wp-lists' );
688
  wp_enqueue_script( 'postbox' );
689
+
690
+ // WordPress core Styles
691
  wp_admin_css( 'css/dashboard' );
692
 
693
+ // Plugin Style
694
  wp_enqueue_style( 'avhec-admin-css' );
695
 
696
  }
874
  *
875
  * @param $columns
876
  * @return Array
877
+ * @see print_column_headers, get_column_headers
 
878
  */
879
  function filterManageCategoriesGroupColumns ( $columns )
880
  {
2.8/class/avh-ec.core.php CHANGED
@@ -23,12 +23,11 @@ class AVH_EC_Core
23
  */
24
  $catgrp = & AVH_EC_Singleton::getInstance( 'AVH_EC_Category_Group' );
25
 
26
- $this->version = '3.0.2';
27
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
28
  $db_version = 2;
29
  $this->db_options_core = 'avhec';
30
 
31
-
32
  $info['siteurl'] = get_option( 'siteurl' );
33
  $info['plugin_dir'] = AVHEC_PLUGIN_DIR;
34
  $info['lang_dir'] = AVHEC_WORKING_DIR . '/lang';
@@ -56,12 +55,10 @@ class AVH_EC_Core
56
 
57
  // Check if we have to do updates
58
  if ( (! isset( $this->options['general']['dbversion'] )) || $this->options['general']['dbversion'] < $db_version ) {
59
- $this->doUpdateOptions($db_version);
60
  }
61
 
62
  $this->handleTextdomain();
63
-
64
- wp_register_style( 'avhec-widget-css', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->version, 'screen' );
65
  }
66
 
67
  /**
@@ -86,14 +83,13 @@ class AVH_EC_Core
86
 
87
  }
88
 
89
-
90
  /**
91
  * Checks if running version is newer and do upgrades if necessary
92
  *
93
  * @since 1.2.3
94
  *
95
  */
96
- function doUpdateOptions ($db_version)
97
  {
98
  $options = $this->getOptions();
99
 
@@ -399,7 +395,7 @@ class AVH_EC_Core
399
  if ( empty( $r['current_category'] ) && is_category() )
400
  $r['current_category'] = $wp_query->get_queried_object_id();
401
 
402
- if ( $hierarchical && (! $selectedonly) ) {
403
  $depth = $r['depth'];
404
  } else {
405
  $depth = - 1; // Flat.
@@ -573,7 +569,7 @@ class AVHEC_Walker_Category extends Walker
573
 
574
  $cat_name = esc_attr( $category->name );
575
  $cat_name = apply_filters( 'list_cats', $cat_name, $category );
576
- $link = '<div id="avhec-widget-line"><a href="' . get_category_link( $category->term_id ) . '" ';
577
  if ( $use_desc_for_title == 0 || empty( $category->description ) )
578
  $link .= 'title="' . sprintf( __( 'View all posts filed under %s' ), $cat_name ) . '"';
579
  else
@@ -582,7 +578,7 @@ class AVHEC_Walker_Category extends Walker
582
  $link .= $cat_name . '</a>';
583
 
584
  if ( (! empty( $feed_image )) || (! empty( $feed )) ) {
585
- $link .= '<div id="avhec-widget-rss"> ';
586
 
587
  if ( empty( $feed_image ) )
588
  $link .= '(';
@@ -611,7 +607,7 @@ class AVHEC_Walker_Category extends Walker
611
  }
612
 
613
  if ( isset( $show_count ) && $show_count )
614
- $link .= '<div id="avhec-widget-count"> (' . intval( $category->count ) . ')</div>';
615
 
616
  if ( isset( $show_date ) && $show_date ) {
617
  $link .= ' ' . gmdate( 'Y-m-d', $category->last_update_timestamp );
23
  */
24
  $catgrp = & AVH_EC_Singleton::getInstance( 'AVH_EC_Category_Group' );
25
 
26
+ $this->version = '3.1';
27
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
28
  $db_version = 2;
29
  $this->db_options_core = 'avhec';
30
 
 
31
  $info['siteurl'] = get_option( 'siteurl' );
32
  $info['plugin_dir'] = AVHEC_PLUGIN_DIR;
33
  $info['lang_dir'] = AVHEC_WORKING_DIR . '/lang';
55
 
56
  // Check if we have to do updates
57
  if ( (! isset( $this->options['general']['dbversion'] )) || $this->options['general']['dbversion'] < $db_version ) {
58
+ $this->doUpdateOptions( $db_version );
59
  }
60
 
61
  $this->handleTextdomain();
 
 
62
  }
63
 
64
  /**
83
 
84
  }
85
 
 
86
  /**
87
  * Checks if running version is newer and do upgrades if necessary
88
  *
89
  * @since 1.2.3
90
  *
91
  */
92
+ function doUpdateOptions ( $db_version )
93
  {
94
  $options = $this->getOptions();
95
 
395
  if ( empty( $r['current_category'] ) && is_category() )
396
  $r['current_category'] = $wp_query->get_queried_object_id();
397
 
398
+ if ( $hierarchical ) {
399
  $depth = $r['depth'];
400
  } else {
401
  $depth = - 1; // Flat.
569
 
570
  $cat_name = esc_attr( $category->name );
571
  $cat_name = apply_filters( 'list_cats', $cat_name, $category );
572
+ $link = '<div class="avhec-widget-line"><a href="' . get_category_link( $category->term_id ) . '" ';
573
  if ( $use_desc_for_title == 0 || empty( $category->description ) )
574
  $link .= 'title="' . sprintf( __( 'View all posts filed under %s' ), $cat_name ) . '"';
575
  else
578
  $link .= $cat_name . '</a>';
579
 
580
  if ( (! empty( $feed_image )) || (! empty( $feed )) ) {
581
+ $link .= '<div class="avhec-widget-rss"> ';
582
 
583
  if ( empty( $feed_image ) )
584
  $link .= '(';
607
  }
608
 
609
  if ( isset( $show_count ) && $show_count )
610
+ $link .= '<div class="avhec-widget-count"> (' . intval( $category->count ) . ')</div>';
611
 
612
  if ( isset( $show_date ) && $show_date ) {
613
  $link .= ' ' . gmdate( 'Y-m-d', $category->last_update_timestamp );
2.8/class/avh-ec.widgets.php CHANGED
@@ -28,7 +28,8 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
28
  $widget_ops = array ('description' => __( "An extended version of the default Categories widget.", 'avh-ec' ) );
29
  WP_Widget::__construct( 'extended-categories', __( 'AVH Extended Categories' ), $widget_ops );
30
 
31
- wp_enqueue_style( 'avhec-widget-css' );
 
32
  }
33
 
34
  function WP_Widget_AVH_ExtendedCategories_Normal ()
@@ -36,6 +37,15 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
36
  $this->__construct();
37
  }
38
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Display the widget
41
  *
@@ -44,6 +54,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
44
  */
45
  function widget ( $args, $instance )
46
  {
 
47
  extract( $args );
48
 
49
  $selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
@@ -157,15 +168,11 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
157
  }
158
  $instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
159
 
160
- // If only the selected categories are to be displayed, this implies a flat view. Can't be hierarchical
161
- if ( TRUE == $new_instance['selectedonly'] ) {
162
- $instance['hierarchical'] = FALSE;
163
- }
164
  return $instance;
165
  }
166
 
167
  /**
168
- * Display Widget Control Form
169
  *
170
  * @param unknown_type $instance
171
  */
@@ -332,7 +339,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
332
  */
333
  function avh_wp_category_checklist ( $post_id = 0, $descendants_and_self = 0, $selected_cats = FALSE, $popular_cats = FALSE, $number, $display = 1 )
334
  {
335
- $walker = new AVH_Walker_Category_Checklist( );
336
  $walker->number = $number;
337
  $walker->input_id = $this->get_field_id( 'post_category' );
338
  $walker->input_name = $this->get_field_name( 'post_category' );
@@ -401,10 +408,11 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
401
  function __construct ()
402
  {
403
  $this->core = & AVH_EC_Singleton::getInstance( 'AVH_EC_Core' );
404
- wp_enqueue_style( 'avhec-widget-css' );
405
 
406
  $widget_ops = array ('description' => __( "Shows the top categories.", 'avh-ec' ) );
407
  WP_Widget::__construct( FALSE, __( 'AVH Extended Categories: Top Categories' ), $widget_ops );
 
 
408
  }
409
 
410
  function WP_Widget_AVH_ExtendedCategories_Top ()
@@ -412,6 +420,14 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
412
  $this->__construct();
413
  }
414
 
 
 
 
 
 
 
 
 
415
  /** Echo the widget content.
416
  *
417
  * Subclasses should over-ride this function to generate their widget code.
@@ -637,10 +653,11 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
637
  function __construct ()
638
  {
639
  $this->core = & AVH_EC_Singleton::getInstance( 'AVH_EC_Core' );
640
- wp_enqueue_style( 'avhec-widget-css' );
641
 
642
  $widget_ops = array ('description' => __( "Shows grouped categories.", 'avh-ec' ) );
643
  WP_Widget::__construct( FALSE, __( 'AVH Extended Category: Category Group' ), $widget_ops );
 
 
644
  }
645
 
646
  function WP_Widget_AVH_ExtendedCategories_Category_Group ()
@@ -648,6 +665,14 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
648
  $this->__construct();
649
  }
650
 
 
 
 
 
 
 
 
 
651
  /**
652
  * Display the widget
653
  *
@@ -657,11 +682,13 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
657
  function widget ( $args, $instance )
658
  {
659
  global $post;
660
- $catgrp = new AVH_EC_Category_Group( );
 
661
  extract( $args );
662
 
663
  $c = $instance['count'] ? TRUE : FALSE;
664
  $e = $instance['hide_empty'] ? TRUE : FALSE;
 
665
  $use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
666
  $s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
667
  $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
@@ -703,8 +730,9 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
703
  $show_option_none = $options['general']['alternative_name_select_category'];
704
  }
705
 
706
- $cat_args = array ('include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => $e, 'hierarchical' => FALSE, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-' . $this->number );
707
  echo $before_widget;
 
708
  echo $this->core->comment;
709
  echo $before_title . $title . $after_title;
710
 
@@ -716,7 +744,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
716
  $this->core->avh_wp_dropdown_categories( $cat_args, TRUE );
717
  echo '<script type=\'text/javascript\'>' . "\n";
718
  echo '/* <![CDATA[ */' . "\n";
719
- echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-' . $this->number . '");' . "\n";
720
  echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
721
  echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
722
  echo ' location.href = "' . get_option( 'home' ) . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
@@ -726,6 +754,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
726
  echo '/* ]]> */' . "\n";
727
  echo '</script>' . "\n";
728
  }
 
729
  echo $after_widget;
730
  }
731
  }
@@ -748,6 +777,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
748
 
749
  $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
750
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
 
751
  $instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
752
  $instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
753
  $instance['sort_column'] = strip_tags( stripslashes( $new_instance['sort_column'] ) );
@@ -759,7 +789,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
759
  }
760
 
761
  /**
762
- * Display Widget Control Form
763
  *
764
  * @param unknown_type $instance
765
  */
@@ -771,6 +801,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
771
  // Prepare data for display
772
  $title = esc_attr( $instance['title'] );
773
  $count = ( bool ) $instance['count'];
 
774
  $hide_empty = ( bool ) $instance['hide_empty'];
775
  $use_desc_for_title = ( bool ) $instance['use_desc_for_title'];
776
  $sort_id = ($instance['sort_column'] == 'ID') ? ' SELECTED' : '';
28
  $widget_ops = array ('description' => __( "An extended version of the default Categories widget.", 'avh-ec' ) );
29
  WP_Widget::__construct( 'extended-categories', __( 'AVH Extended Categories' ), $widget_ops );
30
 
31
+ add_action( 'wp_print_styles', array (&$this, 'actionWpPrintStyles' ) );
32
+
33
  }
34
 
35
  function WP_Widget_AVH_ExtendedCategories_Normal ()
37
  $this->__construct();
38
  }
39
 
40
+ function actionWpPrintStyles ()
41
+ {
42
+
43
+ if ( ! (FALSE === is_active_widget( FALSE, FALSE, $this->id_base, TRUE )) ) {
44
+ wp_register_style( 'avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version );
45
+ wp_enqueue_style( 'avhec-widget' );
46
+ }
47
+ }
48
+
49
  /**
50
  * Display the widget
51
  *
54
  */
55
  function widget ( $args, $instance )
56
  {
57
+
58
  extract( $args );
59
 
60
  $selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
168
  }
169
  $instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
170
 
 
 
 
 
171
  return $instance;
172
  }
173
 
174
  /**
175
+ * Display Widget Control Form
176
  *
177
  * @param unknown_type $instance
178
  */
339
  */
340
  function avh_wp_category_checklist ( $post_id = 0, $descendants_and_self = 0, $selected_cats = FALSE, $popular_cats = FALSE, $number, $display = 1 )
341
  {
342
+ $walker = new AVH_Walker_Category_Checklist();
343
  $walker->number = $number;
344
  $walker->input_id = $this->get_field_id( 'post_category' );
345
  $walker->input_name = $this->get_field_name( 'post_category' );
408
  function __construct ()
409
  {
410
  $this->core = & AVH_EC_Singleton::getInstance( 'AVH_EC_Core' );
 
411
 
412
  $widget_ops = array ('description' => __( "Shows the top categories.", 'avh-ec' ) );
413
  WP_Widget::__construct( FALSE, __( 'AVH Extended Categories: Top Categories' ), $widget_ops );
414
+ add_action( 'wp_print_styles', array (&$this, 'actionWpPrintStyles' ) );
415
+
416
  }
417
 
418
  function WP_Widget_AVH_ExtendedCategories_Top ()
420
  $this->__construct();
421
  }
422
 
423
+ function actionWpPrintStyles ()
424
+ {
425
+ if ( ! (FALSE === is_active_widget( FALSE, FALSE, $this->id_base, TRUE )) ) {
426
+ wp_register_style( 'avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version );
427
+ wp_enqueue_style( 'avhec-widget' );
428
+ }
429
+ }
430
+
431
  /** Echo the widget content.
432
  *
433
  * Subclasses should over-ride this function to generate their widget code.
653
  function __construct ()
654
  {
655
  $this->core = & AVH_EC_Singleton::getInstance( 'AVH_EC_Core' );
 
656
 
657
  $widget_ops = array ('description' => __( "Shows grouped categories.", 'avh-ec' ) );
658
  WP_Widget::__construct( FALSE, __( 'AVH Extended Category: Category Group' ), $widget_ops );
659
+ add_action( 'wp_print_styles', array (&$this, 'actionWpPrintStyles' ) );
660
+
661
  }
662
 
663
  function WP_Widget_AVH_ExtendedCategories_Category_Group ()
665
  $this->__construct();
666
  }
667
 
668
+ function actionWpPrintStyles ()
669
+ {
670
+ if ( ! (FALSE === is_active_widget( FALSE, FALSE, $this->id_base, TRUE )) ) {
671
+ wp_register_style( 'avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version );
672
+ wp_enqueue_style( 'avhec-widget' );
673
+ }
674
+ }
675
+
676
  /**
677
  * Display the widget
678
  *
682
  function widget ( $args, $instance )
683
  {
684
  global $post;
685
+
686
+ $catgrp = new AVH_EC_Category_Group();
687
  extract( $args );
688
 
689
  $c = $instance['count'] ? TRUE : FALSE;
690
  $e = $instance['hide_empty'] ? TRUE : FALSE;
691
+ $h = $instance['hierarchical'] ? TRUE : FALSE;
692
  $use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
693
  $s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
694
  $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
730
  $show_option_none = $options['general']['alternative_name_select_category'];
731
  }
732
 
733
+ $cat_args = array ('include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => $e, 'hierarchical' => $h, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-group-' . $this->number );
734
  echo $before_widget;
735
+ echo '<div id="avhec-categorygroup-' . $row->slug . '">';
736
  echo $this->core->comment;
737
  echo $before_title . $title . $after_title;
738
 
744
  $this->core->avh_wp_dropdown_categories( $cat_args, TRUE );
745
  echo '<script type=\'text/javascript\'>' . "\n";
746
  echo '/* <![CDATA[ */' . "\n";
747
+ echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-group-' . $this->number . '");' . "\n";
748
  echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
749
  echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
750
  echo ' location.href = "' . get_option( 'home' ) . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
754
  echo '/* ]]> */' . "\n";
755
  echo '</script>' . "\n";
756
  }
757
+ echo '</div>';
758
  echo $after_widget;
759
  }
760
  }
777
 
778
  $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
779
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
780
+ $instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
781
  $instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
782
  $instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
783
  $instance['sort_column'] = strip_tags( stripslashes( $new_instance['sort_column'] ) );
789
  }
790
 
791
  /**
792
+ * Display Widget Control Form
793
  *
794
  * @param unknown_type $instance
795
  */
801
  // Prepare data for display
802
  $title = esc_attr( $instance['title'] );
803
  $count = ( bool ) $instance['count'];
804
+ $hierarchical = ( bool ) $instance['hierarchical'];
805
  $hide_empty = ( bool ) $instance['hide_empty'];
806
  $use_desc_for_title = ( bool ) $instance['use_desc_for_title'];
807
  $sort_id = ($instance['sort_column'] == 'ID') ? ' SELECTED' : '';
2.8/css/avh-ec.widget.css CHANGED
@@ -1,13 +1,13 @@
1
  /* AVH Extended Categories Widget CSS */
2
 
3
- #avhec-widget-line {
4
  display: inline-block;
5
  }
6
 
7
- #avhec-widget-count {
8
  display: inline;
9
  }
10
 
11
- #avhec-widget-rss {
12
  display: inline;
13
  }
1
  /* AVH Extended Categories Widget CSS */
2
 
3
+ .avhec-widget-line {
4
  display: inline-block;
5
  }
6
 
7
+ .avhec-widget-count {
8
  display: inline;
9
  }
10
 
11
+ .avhec-widget-rss {
12
  display: inline;
13
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 2.9.1
7
- Stable tag: 3.0.2
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
@@ -99,6 +99,13 @@ I have also setup a project in Launchpad for translating the plug-in. Just visit
99
  None
100
 
101
  == Changelog ==
 
 
 
 
 
 
 
102
 
103
  = Version 3.0.2 =
104
  * Bugfix: The plugin conflicts with the standard theme/plugin editor in WordPress
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
  Tested up to: 2.9.1
7
+ Stable tag: 3.1
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
99
  None
100
 
101
  == Changelog ==
102
+ = Version 3.1 =
103
+ * Wrap the group widget in a div with id = name of group. This enables CSS modification based on the group.
104
+ * Hierarchical now works with the option "Select Categories" as well.
105
+ * Bugfix: If the normal widget and group widget are displayed on the same page as dropdown, the selected option could be the wrong one.
106
+ * Bugfix: In a RTL-based theme the admin menu would flip back to the left, instead of staying right.
107
+ * Bugfix: Hierarchical works in the Category Group widget.
108
+ * Bugfix: Change div tags in widget from ID to class to comply to W3 validation.
109
 
110
  = Version 3.0.2 =
111
  * Bugfix: The plugin conflicts with the standard theme/plugin editor in WordPress
widget-pre2.8.php CHANGED
@@ -7,7 +7,7 @@ function widget_extended_categories_init() {
7
  }
8
 
9
  function widget_extended_categories($args, $number = 1) {
10
- $version = '3.0.2';
11
  // Check for version
12
  require (ABSPATH . WPINC . '/version.php');
13
  if ( version_compare($wp_version, '2.5.1', '<') ) {
7
  }
8
 
9
  function widget_extended_categories($args, $number = 1) {
10
+ $version = '3.1';
11
  // Check for version
12
  require (ABSPATH . WPINC . '/version.php');
13
  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.0.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.1
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9