Breadcrumb NavXT - Version 5.1.1

Version Description

  • Bug fix: Fixed issue where attachments and their parents have the same link when 'link current item' is enabled.
  • Bug fix: Pass the same parameters into the widget title and (pre) text filters as the default WordPress widgets.
  • Bug fix: Fixed issue where PHP warnings would be thrown on author pages for authors that do not have any posts.
  • Bug fix: Reduced severity of $post global not being of type WP_Post, will silently exit on non-WP_DEBUG enabled sites.
Download this release

Release Info

Developer mtekk
Plugin Icon 128x128 Breadcrumb NavXT
Version 5.1.1
Comparing to
See all releases

Code changes from version 5.1.0 to 5.1.1

breadcrumb-navxt.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Breadcrumb NavXT
4
  Plugin URI: http://mtekk.us/code/breadcrumb-navxt/
5
  Description: Adds a breadcrumb navigation showing the visitor&#39;s path to their current location. For details on how to use this plugin visit <a href="http://mtekk.us/code/breadcrumb-navxt/">Breadcrumb NavXT</a>.
6
- Version: 5.1.0
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
@@ -60,7 +60,7 @@ $breadcrumb_navxt = NULL;
60
  //TODO change to extends mtekk_plugKit
61
  class breadcrumb_navxt
62
  {
63
- const version = '5.1.0';
64
  protected $name = 'Breadcrumb NavXT';
65
  protected $identifier = 'breadcrumb-navxt';
66
  protected $unique_prefix = 'bcn';
3
  Plugin Name: Breadcrumb NavXT
4
  Plugin URI: http://mtekk.us/code/breadcrumb-navxt/
5
  Description: Adds a breadcrumb navigation showing the visitor&#39;s path to their current location. For details on how to use this plugin visit <a href="http://mtekk.us/code/breadcrumb-navxt/">Breadcrumb NavXT</a>.
6
+ Version: 5.1.1
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
60
  //TODO change to extends mtekk_plugKit
61
  class breadcrumb_navxt
62
  {
63
+ const version = '5.1.1';
64
  protected $name = 'Breadcrumb NavXT';
65
  protected $identifier = 'breadcrumb-navxt';
66
  protected $unique_prefix = 'bcn';
breadcrumb_navxt_admin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Breadcrumb NavXT 5.0 Migration Compatibility Layer DO NOT ACTIVATE
4
  Plugin URI: http://mtekk.us/code/breadcrumb-navxt/
5
  Description: This exists to ease the transition to the new 5.0 plugin layout. Will produce the 'Breadcrumb NavXT was just updated from a pre-5.0 version, please go to your plugins page and activate "Breadcrumb NavXT". Also, deactivate "Breadcrumb NavXT 5.0 Migration Compatibility Layer" to make this message disappear.' message. Do not activate or rely on this, it will not be included in Breadcrumb NavXT 5.2.
6
- Version: 5.1.0
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
3
  Plugin Name: Breadcrumb NavXT 5.0 Migration Compatibility Layer DO NOT ACTIVATE
4
  Plugin URI: http://mtekk.us/code/breadcrumb-navxt/
5
  Description: This exists to ease the transition to the new 5.0 plugin layout. Will produce the 'Breadcrumb NavXT was just updated from a pre-5.0 version, please go to your plugins page and activate "Breadcrumb NavXT". Also, deactivate "Breadcrumb NavXT 5.0 Migration Compatibility Layer" to make this message disappear.' message. Do not activate or rely on this, it will not be included in Breadcrumb NavXT 5.2.
6
+ Version: 5.1.1
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
class.bcn_admin.php CHANGED
@@ -42,7 +42,7 @@ if(!class_exists('mtekk_adminKit'))
42
  */
43
  class bcn_admin extends mtekk_adminKit
44
  {
45
- protected $version = '5.1.0';
46
  protected $full_name = 'Breadcrumb NavXT Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_options';
42
  */
43
  class bcn_admin extends mtekk_adminKit
44
  {
45
+ protected $version = '5.1.1';
46
  protected $full_name = 'Breadcrumb NavXT Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_options';
class.bcn_breadcrumb_trail.php CHANGED
@@ -21,7 +21,7 @@ require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
21
  class bcn_breadcrumb_trail
22
  {
23
  //Our member variables
24
- private $version = '5.1.0';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
@@ -182,17 +182,21 @@ class bcn_breadcrumb_trail
182
  */
183
  protected function do_author()
184
  {
185
- global $authordata;
 
 
 
 
 
 
 
186
  //Setup array of valid author_name values
187
  $valid_author_name = array('display_name', 'nickname', 'first_name', 'last_name');
188
- //This translation allows us to easily select the display type later on
189
- $author_name = $this->opt['Sauthor_name'];
190
  //Make sure user picks only safe values
191
- if(in_array($author_name, $valid_author_name))
192
  {
193
- //TODO Evaluate the need for this filter call
194
  //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
195
- $breadcrumb = $this->add(new bcn_breadcrumb(apply_filters('the_author', $authordata->$author_name), $this->opt['Hauthor_template_no_anchor'], array('author', 'current-item'), NULL, $authordata->ID));
196
  //If we're paged, or allowing the current item to be linked, let's link to the first page
197
  if($this->opt['bcurrent_item_linked'] || (is_paged() && $this->opt['bpaged_display']))
198
  {
@@ -355,18 +359,24 @@ class bcn_breadcrumb_trail
355
  *
356
  * @param $post WP_Post Instance of WP_Post object to create a breadcrumb for
357
  */
358
- protected function do_post(WP_Post $post)
359
  {
360
  global $page;
 
 
 
 
 
 
361
  //Place the breadcrumb in the trail, uses the bcn_breadcrumb constructor to set the title, template, and type
362
  $breadcrumb = $this->add(new bcn_breadcrumb(get_the_title($post), $this->opt['Hpost_' . $post->post_type . '_template_no_anchor'], array('post', 'post-' . $post->post_type, 'current-item'), NULL, $post->ID));
363
  //If the current item is to be linked, or this is a paged post, add in links
364
- if($this->opt['bcurrent_item_linked'] || ($page > 1 && $this->opt['bpaged_display']))
365
  {
366
  //Change the template over to the normal, linked one
367
  $breadcrumb->set_template($this->opt['Hpost_' . $post->post_type . '_template']);
368
  //Add the link
369
- $breadcrumb->set_url(get_permalink());
370
  }
371
  //If we have page, force it to go through the parent tree
372
  if($post->post_type === 'page')
@@ -505,12 +515,12 @@ class bcn_breadcrumb_trail
505
  protected function do_archive_by_post_type()
506
  {
507
  //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
508
- $breadcrumb = $this->add(new bcn_breadcrumb(post_type_archive_title('', false), $this->opt['Hpost_' . get_post_type() . '_template_no_anchor'], array('archive', 'post-' . get_post_type() . '-archive', 'current-item')));
509
  if($this->opt['bcurrent_item_linked'] || is_paged() && $this->opt['bpaged_display'])
510
  {
511
- $breadcrumb->set_template($this->opt['Hpost_' . get_post_type() . '_template']);
512
  //Deal with the anchor
513
- $breadcrumb->set_url(get_post_type_archive_link(get_post_type()));
514
  }
515
  }
516
  /**
@@ -769,7 +779,7 @@ class bcn_breadcrumb_trail
769
  */
770
  public function fill()
771
  {
772
- global $wpdb, $post, $wp_query, $paged, $page;
773
  //Check to see if the trail is already populated
774
  if(count($this->breadcrumbs) > 0)
775
  {
21
  class bcn_breadcrumb_trail
22
  {
23
  //Our member variables
24
+ private $version = '5.1.1';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
182
  */
183
  protected function do_author()
184
  {
185
+ if(get_query_var('author_name'))
186
+ {
187
+ $authordata = get_user_by('slug', get_query_var('author_name'));
188
+ }
189
+ else
190
+ {
191
+ $authordata = get_userdata(get_query_var('author'));
192
+ }
193
  //Setup array of valid author_name values
194
  $valid_author_name = array('display_name', 'nickname', 'first_name', 'last_name');
 
 
195
  //Make sure user picks only safe values
196
+ if(in_array($this->opt['Sauthor_name'], $valid_author_name))
197
  {
 
198
  //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
199
+ $breadcrumb = $this->add(new bcn_breadcrumb(get_the_author_meta($this->opt['Sauthor_name'], $authordata->ID), $this->opt['Hauthor_template_no_anchor'], array('author', 'current-item'), NULL, $authordata->ID));
200
  //If we're paged, or allowing the current item to be linked, let's link to the first page
201
  if($this->opt['bcurrent_item_linked'] || (is_paged() && $this->opt['bpaged_display']))
202
  {
359
  *
360
  * @param $post WP_Post Instance of WP_Post object to create a breadcrumb for
361
  */
362
+ protected function do_post($post)
363
  {
364
  global $page;
365
+ //If we did not get a WP_Post object, warn developer and return early
366
+ if(!is_object($post) || get_class($post) !== 'WP_Post')
367
+ {
368
+ _doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('$post global is not of type WP_Post', 'breadcrumb-navxt'), '5.1.1');
369
+ return;
370
+ }
371
  //Place the breadcrumb in the trail, uses the bcn_breadcrumb constructor to set the title, template, and type
372
  $breadcrumb = $this->add(new bcn_breadcrumb(get_the_title($post), $this->opt['Hpost_' . $post->post_type . '_template_no_anchor'], array('post', 'post-' . $post->post_type, 'current-item'), NULL, $post->ID));
373
  //If the current item is to be linked, or this is a paged post, add in links
374
+ if(is_attachment() || $this->opt['bcurrent_item_linked'] || ($page > 1 && $this->opt['bpaged_display']))
375
  {
376
  //Change the template over to the normal, linked one
377
  $breadcrumb->set_template($this->opt['Hpost_' . $post->post_type . '_template']);
378
  //Add the link
379
+ $breadcrumb->set_url(get_permalink($post));
380
  }
381
  //If we have page, force it to go through the parent tree
382
  if($post->post_type === 'page')
515
  protected function do_archive_by_post_type()
516
  {
517
  //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
518
+ $breadcrumb = $this->add(new bcn_breadcrumb(post_type_archive_title('', false), $this->opt['Hpost_' . get_query_var('post_type') . '_template_no_anchor'], array('archive', 'post-' . get_query_var('post_type') . '-archive', 'current-item')));
519
  if($this->opt['bcurrent_item_linked'] || is_paged() && $this->opt['bpaged_display'])
520
  {
521
+ $breadcrumb->set_template($this->opt['Hpost_' . get_query_var('post_type') . '_template']);
522
  //Deal with the anchor
523
+ $breadcrumb->set_url(get_post_type_archive_link(get_query_var('post_type')));
524
  }
525
  }
526
  /**
779
  */
780
  public function fill()
781
  {
782
+ global $wpdb, $wp_query, $paged, $page;
783
  //Check to see if the trail is already populated
784
  if(count($this->breadcrumbs) > 0)
785
  {
class.bcn_network_admin.php CHANGED
@@ -42,7 +42,7 @@ if(!class_exists('mtekk_adminKit'))
42
  */
43
  class bcn_network_admin extends mtekk_adminKit
44
  {
45
- protected $version = '5.1.0';
46
  protected $full_name = 'Breadcrumb NavXT Network Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_network_options';
42
  */
43
  class bcn_network_admin extends mtekk_adminKit
44
  {
45
+ protected $version = '5.1.1';
46
  protected $full_name = 'Breadcrumb NavXT Network Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_network_options';
class.bcn_widget.php CHANGED
@@ -35,8 +35,8 @@ class bcn_widget extends WP_Widget
35
  {
36
  //Make sure we grab defaults in the case of out of date instance settings being sent
37
  $instance = wp_parse_args((array) $instance, $this->defaults);
38
- $instance['title'] = apply_filters('widget_title', $instance['title']);
39
- $instance['pretext'] = apply_filters('widget_text', $instance['pretext']);
40
  //A bit of a hack but we need the DB settings to know if we should exit early
41
  $opt = get_option('bcn_options');
42
  //If we are on the front page and don't display on the front, return early
35
  {
36
  //Make sure we grab defaults in the case of out of date instance settings being sent
37
  $instance = wp_parse_args((array) $instance, $this->defaults);
38
+ $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
39
+ $instance['pretext'] = apply_filters('widget_text', $instance['pretext'], $instance);
40
  //A bit of a hack but we need the DB settings to know if we should exit early
41
  $opt = get_option('bcn_options');
42
  //If we are on the front page and don't display on the front, return early
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mtekk, hakre
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FD5XEU783BR8U&lc=US&item_name=Breadcrumb%20NavXT%20Donation&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: breadcrumb, breadcrumbs, trail, navigation, menu, widget
5
  Requires at least: 3.7
6
- Tested up to: 3.9.1
7
- Stable tag: 5.1.0
8
  License: GPLv2 or later
9
  Adds breadcrumb navigation showing the visitor's path to their current location.
10
 
@@ -49,7 +49,20 @@ Save the file (upload if applicable). Now you should have a breadcrumb trail on
49
 
50
  Please visit [Breadcrumb NavXT's Documentation](http://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/ "Go to Breadcrumb NavXT's Documentation.") page for more information.
51
 
 
 
 
 
 
 
 
 
52
  == Changelog ==
 
 
 
 
 
53
  = 5.1.0 =
54
  * Behavior change: `bcn_breadcrumb_trail::do_post()` now expects to be passed in a valid WP_Post object.
55
  * Behavior change: `breadcrumb_navxt::version` changed to a constant to allow uninstantiated access of the plugin version.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FD5XEU783BR8U&lc=US&item_name=Breadcrumb%20NavXT%20Donation&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: breadcrumb, breadcrumbs, trail, navigation, menu, widget
5
  Requires at least: 3.7
6
+ Tested up to: 4.1
7
+ Stable tag: 5.1.1
8
  License: GPLv2 or later
9
  Adds breadcrumb navigation showing the visitor's path to their current location.
10
 
49
 
50
  Please visit [Breadcrumb NavXT's Documentation](http://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/ "Go to Breadcrumb NavXT's Documentation.") page for more information.
51
 
52
+ == Screenshots ==
53
+ 1. This screenshot shows 5 different examples of breadcrumbs generated by Breadcrumb NavXT
54
+ 2. A screenshot of the General tab of the settings page
55
+ 3. A screenshot of the Post Types tab of the settings page
56
+ 4. A screenshot of the Taxonomies tab of the settings page
57
+ 5. A screenshot of the Miscellaneous tab of the settings page
58
+ 6. A screenshot of the Settings Import/Export/Reset form under the Help menu
59
+
60
  == Changelog ==
61
+ = 5.1.1 =
62
+ * Bug fix: Fixed issue where attachments and their parents have the same link when 'link current item' is enabled.
63
+ * Bug fix: Pass the same parameters into the widget title and (pre) text filters as the default WordPress widgets.
64
+ * Bug fix: Fixed issue where PHP warnings would be thrown on author pages for authors that do not have any posts.
65
+ * Bug fix: Reduced severity of `$post` global not being of type `WP_Post`, will silently exit on non-WP_DEBUG enabled sites.
66
  = 5.1.0 =
67
  * Behavior change: `bcn_breadcrumb_trail::do_post()` now expects to be passed in a valid WP_Post object.
68
  * Behavior change: `breadcrumb_navxt::version` changed to a constant to allow uninstantiated access of the plugin version.