AVH Extended Categories Widgets - Version 4.0.3

Version Description

Download this release

Release Info

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

Code changes from version 4.0.4 to 4.0.3

4.2/class/avh-ec.category-group.php CHANGED
@@ -233,12 +233,8 @@ class AVH_EC_Category_Group {
233
  'description' => __('This group will be shown on the front page.',
234
  'avh-ec')
235
  ));
236
- if ( ! is_wp_error($home_group_id)) {
237
- $this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
238
- $this->setWidgetTitleForGroup($home_group_id['term_id'], '');
239
- } else {
240
- trigger_error($home_group_id->get_error_message(), E_USER_NOTICE);
241
- }
242
  }
243
  if (false === $this->getTermIDBy('slug', 'all')) {
244
  $all_group_id = wp_insert_term('All',
233
  'description' => __('This group will be shown on the front page.',
234
  'avh-ec')
235
  ));
236
+ $this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
237
+ $this->setWidgetTitleForGroup($home_group_id['term_id'], '');
 
 
 
 
238
  }
239
  if (false === $this->getTermIDBy('slug', 'all')) {
240
  $all_group_id = wp_insert_term('All',
4.2/class/avh-ec.core.php CHANGED
@@ -444,158 +444,158 @@ class AVH_EC_Core {
444
  * @type string $separator Separator between links. Default '<br />'.
445
  * }
446
  * @return false|string HTML content only if 'echo' argument is 0.
447
- *
448
- * public function avh_wp_list_categories($args = '') {
449
- * $mywalker = new AVHEC_Walker_Category();
450
- * $defaults = array(
451
- * 'child_of' => 0,
452
- * 'current_category' => 0,
453
- * 'depth' => 0,
454
- * 'echo' => 1,
455
- * 'exclude' => '',
456
- * 'exclude_tree' => '',
457
- * 'feed' => '',
458
- * 'feed_image' => '',
459
- * 'feed_type' => '',
460
- * 'hide_empty' => 1,
461
- * 'hide_title_if_empty' => false,
462
- * 'hierarchical' => true,
463
- * 'order' => 'ASC',
464
- * 'orderby' => 'name',
465
- * 'separator' => '<br />',
466
- * 'show_count' => 0,
467
- * 'show_last_update' => 0,
468
- * 'show_option_all' => '',
469
- * 'show_option_none' => __('No categories'),
470
- * 'style' => 'list',
471
- * 'taxonomy' => 'category',
472
- * 'title_li' => __('Categories'),
473
- * 'use_desc_for_title' => 1,
474
- * 'walker' => $mywalker
475
- * );
476
- *
477
- * $r = wp_parse_args($args, $defaults);
478
- *
479
- * if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
480
- * $r['pad_counts'] = true;
481
- * }
482
- *
483
- * if (isset($r['show_date'])) {
484
- * $r['include_last_update_time'] = $r['show_date'];
485
- * }
486
- *
487
- * if (true == $r['hierarchical']) {
488
- * $exclude_tree = array();
489
- *
490
- * if ($r['exclude_tree']) {
491
- * $exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude_tree']));
492
- * }
493
- *
494
- * if ($r['exclude']) {
495
- * $exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude']));
496
- * }
497
- *
498
- * $r['exclude_tree'] = $exclude_tree;
499
- * $r['exclude'] = '';
500
- * }
501
- *
502
- * if ( ! isset($r['class'])) {
503
- * $r['class'] = ('category' == $r['taxonomy']) ? 'categories' : $r['taxonomy'];
504
- * }
505
- *
506
- * if ( ! taxonomy_exists($r['taxonomy'])) {
507
- * return false;
508
- * }
509
- *
510
- * $show_option_all = $r['show_option_all'];
511
- * $show_option_none = $r['show_option_none'];
512
- *
513
- * $categories = get_categories($r);
514
- *
515
- * $output = '';
516
- * if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {
517
- * $output = '<li class="' . esc_attr($r['class']) . '">' . $r['title_li'] . '<ul>';
518
- * }
519
- *
520
- * if (empty($categories)) {
521
- * if ( ! empty($show_option_none)) {
522
- * if ('list' == $r['style']) {
523
- * $output .= '<li class="cat-item-none">' . __("No categories") . '</li>';
524
- * } else {
525
- * $output .= $show_option_none;
526
- * }
527
- * }
528
- * } else {
529
- * if ( ! empty($show_option_all)) {
530
- *
531
- * $posts_page = '';
532
- * $taxonomy_object = get_taxonomy($r['taxonomy']);
533
- *
534
- * if ( ! in_array('post', $taxonomy_object->object_type) &&
535
- * ! in_array('page', $taxonomy_object->object_type)
536
- * ) {
537
- * foreach ($taxonomy_object->object_type as $object_type) {
538
- * $_object_type = get_post_type_object($object_type);
539
- *
540
- * // Grab the first one.
541
- * if ( ! empty($_object_type->has_archive)) {
542
- * $posts_page = get_post_type_archive_link($object_type);
543
- * break;
544
- * }
545
- * }
546
- * }
547
- * // Fallback for the 'All' link is the posts page.
548
- * if ( ! $posts_page) {
549
- * if ('page' == get_option('show_on_front') && get_option('page_for_posts')) {
550
- * $posts_page = get_permalink(get_option('page_for_posts'));
551
- * } else {
552
- * $posts_page = home_url('/');
553
- * }
554
- * }
555
- *
556
- * $posts_page = esc_url($posts_page);
557
- * if ('list' == $r['style']) {
558
- * $output .= '<li class="cat-item-all"><a href="' .
559
- * $posts_page .
560
- * '">' .
561
- * $show_option_all .
562
- * '</a></li>';
563
- * } else {
564
- * $output .= '<a href="' . $posts_page . '">' . $show_option_all . '</a>';
565
- * }
566
- * }
567
- * if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
568
- * $current_term_object = get_queried_object();
569
- * if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
570
- * $r['current_category'] = get_queried_object_id();
571
- * }
572
- * }
573
- *
574
- * if ($r['hierarchical']) {
575
- * $depth = $r['depth'];
576
- * } else {
577
- * $depth = - 1; // Flat.
578
- * }
579
- *
580
- * $output .= walk_category_tree($categories, $depth, $r);
581
- * }
582
- *
583
- * if ($r['title_li'] && 'list' == $r['style']) {
584
- * $output .= '</ul></li>';
585
- * }
586
- *
587
- * $html = apply_filters('wp_list_categories', $output, $args);
588
- *
589
- * if ($r['echo']) {
590
- * echo $html;
591
- * } else {
592
- * return $html;
593
- * }
594
- *
595
- * return;
596
- * }
597
- *
598
- * /**
599
  * Checks if running version is newer and do upgrades if necessary
600
  *
601
  * @since 1.2.3
444
  * @type string $separator Separator between links. Default '<br />'.
445
  * }
446
  * @return false|string HTML content only if 'echo' argument is 0.
447
+ */
448
+ public function avh_wp_list_categories($args = '') {
449
+ $mywalker = new AVHEC_Walker_Category();
450
+ $defaults = array(
451
+ 'child_of' => 0,
452
+ 'current_category' => 0,
453
+ 'depth' => 0,
454
+ 'echo' => 1,
455
+ 'exclude' => '',
456
+ 'exclude_tree' => '',
457
+ 'feed' => '',
458
+ 'feed_image' => '',
459
+ 'feed_type' => '',
460
+ 'hide_empty' => 1,
461
+ 'hide_title_if_empty' => false,
462
+ 'hierarchical' => true,
463
+ 'order' => 'ASC',
464
+ 'orderby' => 'name',
465
+ 'separator' => '<br />',
466
+ 'show_count' => 0,
467
+ 'show_last_update' => 0,
468
+ 'show_option_all' => '',
469
+ 'show_option_none' => __('No categories'),
470
+ 'style' => 'list',
471
+ 'taxonomy' => 'category',
472
+ 'title_li' => __('Categories'),
473
+ 'use_desc_for_title' => 1,
474
+ 'walker' => $mywalker
475
+ );
476
+
477
+ $r = wp_parse_args($args, $defaults);
478
+
479
+ if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
480
+ $r['pad_counts'] = true;
481
+ }
482
+
483
+ if (isset($r['show_date'])) {
484
+ $r['include_last_update_time'] = $r['show_date'];
485
+ }
486
+
487
+ if (true == $r['hierarchical']) {
488
+ $exclude_tree = array();
489
+
490
+ if ($r['exclude_tree']) {
491
+ $exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude_tree']));
492
+ }
493
+
494
+ if ($r['exclude']) {
495
+ $exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude']));
496
+ }
497
+
498
+ $r['exclude_tree'] = $exclude_tree;
499
+ $r['exclude'] = '';
500
+ }
501
+
502
+ if ( ! isset($r['class'])) {
503
+ $r['class'] = ('category' == $r['taxonomy']) ? 'categories' : $r['taxonomy'];
504
+ }
505
+
506
+ if ( ! taxonomy_exists($r['taxonomy'])) {
507
+ return false;
508
+ }
509
+
510
+ $show_option_all = $r['show_option_all'];
511
+ $show_option_none = $r['show_option_none'];
512
+
513
+ $categories = get_categories($r);
514
+
515
+ $output = '';
516
+ if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {
517
+ $output = '<li class="' . esc_attr($r['class']) . '">' . $r['title_li'] . '<ul>';
518
+ }
519
+
520
+ if (empty($categories)) {
521
+ if ( ! empty($show_option_none)) {
522
+ if ('list' == $r['style']) {
523
+ $output .= '<li class="cat-item-none">' . __("No categories") . '</li>';
524
+ } else {
525
+ $output .= $show_option_none;
526
+ }
527
+ }
528
+ } else {
529
+ if ( ! empty($show_option_all)) {
530
+
531
+ $posts_page = '';
532
+ $taxonomy_object = get_taxonomy($r['taxonomy']);
533
+
534
+ if ( ! in_array('post', $taxonomy_object->object_type) &&
535
+ ! in_array('page', $taxonomy_object->object_type)
536
+ ) {
537
+ foreach ($taxonomy_object->object_type as $object_type) {
538
+ $_object_type = get_post_type_object($object_type);
539
+
540
+ // Grab the first one.
541
+ if ( ! empty($_object_type->has_archive)) {
542
+ $posts_page = get_post_type_archive_link($object_type);
543
+ break;
544
+ }
545
+ }
546
+ }
547
+ // Fallback for the 'All' link is the posts page.
548
+ if ( ! $posts_page) {
549
+ if ('page' == get_option('show_on_front') && get_option('page_for_posts')) {
550
+ $posts_page = get_permalink(get_option('page_for_posts'));
551
+ } else {
552
+ $posts_page = home_url('/');
553
+ }
554
+ }
555
+
556
+ $posts_page = esc_url($posts_page);
557
+ if ('list' == $r['style']) {
558
+ $output .= '<li class="cat-item-all"><a href="' .
559
+ $posts_page .
560
+ '">' .
561
+ $show_option_all .
562
+ '</a></li>';
563
+ } else {
564
+ $output .= '<a href="' . $posts_page . '">' . $show_option_all . '</a>';
565
+ }
566
+ }
567
+ if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
568
+ $current_term_object = get_queried_object();
569
+ if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
570
+ $r['current_category'] = get_queried_object_id();
571
+ }
572
+ }
573
+
574
+ if ($r['hierarchical']) {
575
+ $depth = $r['depth'];
576
+ } else {
577
+ $depth = - 1; // Flat.
578
+ }
579
+
580
+ $output .= walk_category_tree($categories, $depth, $r);
581
+ }
582
+
583
+ if ($r['title_li'] && 'list' == $r['style']) {
584
+ $output .= '</ul></li>';
585
+ }
586
+
587
+ $html = apply_filters('wp_list_categories', $output, $args);
588
+
589
+ if ($r['echo']) {
590
+ echo $html;
591
+ } else {
592
+ return $html;
593
+ }
594
+
595
+ return;
596
+ }
597
+
598
+ /**
599
  * Checks if running version is newer and do upgrades if necessary
600
  *
601
  * @since 1.2.3
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: 4.4
7
- Stable tag: 4.0.4
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
@@ -139,9 +139,6 @@ Whether Widget 2 shows Movie or Music depends on the creation order of groups. I
139
  None
140
 
141
  == Changelog ==
142
- = Version 4.0.4 =
143
- * Uncaught error can occur at times.
144
-
145
  = Version 4.0.3 =
146
  * Security fix
147
  * Update methods for displaying the categories
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
  Tested up to: 4.4
7
+ Stable tag: 4.0.3
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
139
  None
140
 
141
  == Changelog ==
 
 
 
142
  = Version 4.0.3 =
143
  * Security fix
144
  * Update methods for displaying the categories
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: 4.0.4
7
  * Author: Peter van der Does
8
  * Author URI: http://blog.avirtualhome.com/
9
  * Copyright 2012-2016 Peter van der Does (email : peter@avirtualhome.com)
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: 4.0.3
7
  * Author: Peter van der Does
8
  * Author URI: http://blog.avirtualhome.com/
9
  * Copyright 2012-2016 Peter van der Does (email : peter@avirtualhome.com)