Breadcrumb NavXT - Version 6.0.2

Version Description

Release date: December, 30th 2017

  • Behavior change: Added warning alerting that bcn_breadcrumb::type must be an array.
  • Bug fix: Changed Breadcrumb Separator and Paged Template from an input field to a textbox to reduce confusion caused by HTML entities.
  • Bug fix: Fixed issue where the parents of a page may not show up in the breadcrumb trail.
  • Bug fix: Fixed issue where the $reverse parameter for bcn_display and bcn_display_list did not work properly.
  • Bug fix: Fixed issue where the bcn_display_list function did not include the li elements.
Download this release

Release Info

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

Code changes from version 6.0.1 to 6.0.2

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: 6.0.1
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
@@ -61,7 +61,7 @@ $breadcrumb_navxt = null;
61
  //TODO change to extends mtekk_plugKit
62
  class breadcrumb_navxt
63
  {
64
- const version = '6.0.1';
65
  protected $name = 'Breadcrumb NavXT';
66
  protected $identifier = 'breadcrumb-navxt';
67
  protected $unique_prefix = 'bcn';
@@ -391,6 +391,9 @@ class breadcrumb_navxt
391
  $this->breadcrumb_trail->opt = wp_parse_args(get_site_option('bcn_options'), get_option('bcn_options'));
392
  }
393
  }
 
 
 
394
  }
395
  /**
396
  * Outputs the breadcrumb trail
@@ -414,7 +417,7 @@ class breadcrumb_navxt
414
  }
415
  //Generate the breadcrumb trail
416
  $this->breadcrumb_trail->fill();
417
- return $this->breadcrumb_trail->display($return, $linked, $reverse);
418
  }
419
  /**
420
  * Outputs the breadcrumb trail with each element encapsulated with li tags
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: 6.0.2
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
61
  //TODO change to extends mtekk_plugKit
62
  class breadcrumb_navxt
63
  {
64
+ const version = '6.0.2';
65
  protected $name = 'Breadcrumb NavXT';
66
  protected $identifier = 'breadcrumb-navxt';
67
  protected $unique_prefix = 'bcn';
391
  $this->breadcrumb_trail->opt = wp_parse_args(get_site_option('bcn_options'), get_option('bcn_options'));
392
  }
393
  }
394
+ //Currently only support using post_parent for the page hierarchy
395
+ $this->breadcrumb_trail->opt['bpost_page_hierarchy_display'] = true;
396
+ $this->breadcrumb_trail->opt['Spost_page_hierarchy_type'] = 'BCN_POST_PARENT';
397
  }
398
  /**
399
  * Outputs the breadcrumb trail
417
  }
418
  //Generate the breadcrumb trail
419
  $this->breadcrumb_trail->fill();
420
+ return $this->breadcrumb_trail->display($return, $linked, $reverse, $template);
421
  }
422
  /**
423
  * Outputs the breadcrumb trail with each element encapsulated with li tags
class.bcn_admin.php CHANGED
@@ -43,7 +43,7 @@ if(!class_exists('mtekk_adminKit'))
43
  */
44
  class bcn_admin extends mtekk_adminKit
45
  {
46
- const version = '6.0.1';
47
  protected $full_name = 'Breadcrumb NavXT Settings';
48
  protected $short_name = 'Breadcrumb NavXT';
49
  protected $access_level = 'manage_options';
@@ -86,6 +86,16 @@ class bcn_admin extends mtekk_adminKit
86
  parent::wp_loaded();
87
  breadcrumb_navxt::setup_options($this->opt);
88
  }
 
 
 
 
 
 
 
 
 
 
89
  /**
90
  * Upgrades input options array, sets to $this->opt
91
  *
@@ -484,7 +494,7 @@ class bcn_admin extends mtekk_adminKit
484
  <h3><?php _e('General', 'breadcrumb-navxt'); ?></h3>
485
  <table class="form-table">
486
  <?php
487
- $this->input_text(__('Breadcrumb Separator', 'breadcrumb-navxt'), 'hseparator', 'regular-text', false, __('Placed in between each breadcrumb.', 'breadcrumb-navxt'));
488
  do_action($this->unique_prefix . '_settings_general', $this->opt);
489
  ?>
490
  </table>
@@ -493,7 +503,7 @@ class bcn_admin extends mtekk_adminKit
493
  <?php
494
  $this->input_check(__('Link Current Item', 'breadcrumb-navxt'), 'bcurrent_item_linked', __('Yes', 'breadcrumb-navxt'));
495
  $this->input_check(_x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'), 'bpaged_display', __('Place the page number breadcrumb in the trail.', 'breadcrumb-navxt'), false, __('Indicates that the user is on a page other than the first of a paginated archive or post.', 'breadcrumb-navxt'), 'adminkit-enset-ctrl adminkit-enset');
496
- $this->input_text(_x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'), 'Hpaged_template', 'large-text adminkit-enset', false, __('The template for paged breadcrumbs.', 'breadcrumb-navxt'));
497
  do_action($this->unique_prefix . '_settings_current_item', $this->opt);
498
  ?>
499
  </table>
43
  */
44
  class bcn_admin extends mtekk_adminKit
45
  {
46
+ const version = '6.0.2';
47
  protected $full_name = 'Breadcrumb NavXT Settings';
48
  protected $short_name = 'Breadcrumb NavXT';
49
  protected $access_level = 'manage_options';
86
  parent::wp_loaded();
87
  breadcrumb_navxt::setup_options($this->opt);
88
  }
89
+ /**
90
+ * Sets hard constants into the options array
91
+ *
92
+ * @param &$opts The options array to set hard constants into
93
+ */
94
+ function opts_fix(&$opts)
95
+ {
96
+ $opts['bpost_page_hierarchy_display'] = true;
97
+ $opts['Spost_page_hierarchy_type'] = 'BCN_POST_PARENT';
98
+ }
99
  /**
100
  * Upgrades input options array, sets to $this->opt
101
  *
494
  <h3><?php _e('General', 'breadcrumb-navxt'); ?></h3>
495
  <table class="form-table">
496
  <?php
497
+ $this->textbox(__('Breadcrumb Separator', 'breadcrumb-navxt'), 'hseparator', '2', false, __('Placed in between each breadcrumb.', 'breadcrumb-navxt'));
498
  do_action($this->unique_prefix . '_settings_general', $this->opt);
499
  ?>
500
  </table>
503
  <?php
504
  $this->input_check(__('Link Current Item', 'breadcrumb-navxt'), 'bcurrent_item_linked', __('Yes', 'breadcrumb-navxt'));
505
  $this->input_check(_x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'), 'bpaged_display', __('Place the page number breadcrumb in the trail.', 'breadcrumb-navxt'), false, __('Indicates that the user is on a page other than the first of a paginated archive or post.', 'breadcrumb-navxt'), 'adminkit-enset-ctrl adminkit-enset');
506
+ $this->textbox(_x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'), 'Hpaged_template', '4', false, __('The template for paged breadcrumbs.', 'breadcrumb-navxt'), 'adminkit-enset');
507
  do_action($this->unique_prefix . '_settings_current_item', $this->opt);
508
  ?>
509
  </table>
class.bcn_breadcrumb.php CHANGED
@@ -21,7 +21,7 @@ require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
21
  class bcn_breadcrumb
22
  {
23
  //Our member variables
24
- const version = '6.0.1';
25
  //The main text that will be shown
26
  protected $title;
27
  //The breadcrumb's template, used durring assembly
@@ -231,7 +231,12 @@ class bcn_breadcrumb
231
  //The type may be an array, implode it if that is the case
232
  if(is_array($replacements['%type%']))
233
  {
234
- $replacements['%type%'] = implode(' ', $replacements['%type%']);
 
 
 
 
 
235
  }
236
  $replacements = apply_filters('bcn_template_tags', $replacements, $this->type, $this->id);
237
  //If we are linked we'll need to use the normal template
21
  class bcn_breadcrumb
22
  {
23
  //Our member variables
24
+ const version = '6.0.2';
25
  //The main text that will be shown
26
  protected $title;
27
  //The breadcrumb's template, used durring assembly
231
  //The type may be an array, implode it if that is the case
232
  if(is_array($replacements['%type%']))
233
  {
234
+ array_walk($replacements['%type%'], 'sanitize_html_class');
235
+ $replacements['%type%'] = esc_attr(implode(' ', $replacements['%type%']));
236
+ }
237
+ else
238
+ {
239
+ _doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('bcn_breadcrumb::type must be an array', 'breadcrumb-navxt'), '6.0.2');
240
  }
241
  $replacements = apply_filters('bcn_template_tags', $replacements, $this->type, $this->id);
242
  //If we are linked we'll need to use the normal template
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
- const version = '6.0.1';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
@@ -330,7 +330,7 @@ class bcn_breadcrumb_trail
330
  //Grab the frontpage, we'll need it shortly
331
  $frontpage = get_option('page_on_front');
332
  //If there is a parent page let's find it
333
- if($parent && $id != $parent && $frontpage != $parent)
334
  {
335
  $parent = $this->post_parents($parent, $frontpage);
336
  }
@@ -454,7 +454,7 @@ class bcn_breadcrumb_trail
454
  //Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
455
  $breadcrumb = $this->add(new bcn_breadcrumb(get_the_title($id), $this->opt['Hpost_' . $parent->post_type . '_template'], array('post', 'post-' . $parent->post_type), get_permalink($id), $id));
456
  //Make sure the id is valid, and that we won't end up spinning in a loop
457
- if($parent->post_parent >= 0 && $parent->post_parent != false && $id != $parent->post_parent && $frontpage != $parent->post_parent)
458
  {
459
  //If valid, recursively call this function
460
  $parent = $this->post_parents($parent->post_parent, $frontpage);
@@ -499,7 +499,7 @@ class bcn_breadcrumb_trail
499
  //Done with the current item, now on to the parents
500
  $frontpage = get_option('page_on_front');
501
  //Make sure the id is valid, and that we won't end up spinning in a loop
502
- if($post->post_parent >= 0 && $post->post_parent != false && $post->ID != $post->post_parent && $frontpage != $post->post_parent)
503
  {
504
  //Get the parent's information
505
  $parent = get_post($post->post_parent);
@@ -919,7 +919,7 @@ class bcn_breadcrumb_trail
919
  //Get the blog page
920
  $bcn_post = get_post($root_id);
921
  //If there is a parent post let's find it
922
- if($bcn_post->post_parent && $bcn_post->ID != $bcn_post->post_parent && $frontpage_id != $bcn_post->post_parent)
923
  {
924
  $this->post_parents($bcn_post->post_parent, $frontpage_id);
925
  }
@@ -1173,42 +1173,22 @@ class bcn_breadcrumb_trail
1173
  protected function display_loop($linked, $reverse, $template)
1174
  {
1175
  $position = 1;
 
1176
  //Initilize the string which will hold the assembled trail
1177
  $trail_str = '';
1178
  foreach($this->breadcrumbs as $key => $breadcrumb)
1179
  {
1180
- $class = '';
1181
- //On the first run we need to add in a class for the home breadcrumb
1182
- if($trail_str === '')
 
 
1183
  {
1184
- $class .= ' class="home';
1185
- if($key === 0)
1186
- {
1187
- $class .= ' current_item';
1188
- }
1189
- $class .= '"';
1190
- }
1191
- //If we are on the current item there are some things that must be done
1192
- else if($key === 0)
1193
- {
1194
- //Add in a class for current_item
1195
- $class .= ' class="current_item"';
1196
- }
1197
- $separator = '';
1198
- //Deal with determining if a separator is applicable
1199
- if($reverse)
1200
- {
1201
- if($position > 1)
1202
- {
1203
- $separator = $this->opt['hseparator'];
1204
- }
1205
  }
1206
  else
1207
- {
1208
- if($key > 0)
1209
- {
1210
- $separator = $this->opt['hseparator'];
1211
- }
1212
  }
1213
  //Filter li_attributes adding attributes to the li element
1214
  $attribs = apply_filters_deprecated('bcn_li_attributes', array($class, $breadcrumb->get_types(), $breadcrumb->get_id()), '6.0.0', 'bcn_display_attributes');
21
  class bcn_breadcrumb_trail
22
  {
23
  //Our member variables
24
+ const version = '6.0.2';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
330
  //Grab the frontpage, we'll need it shortly
331
  $frontpage = get_option('page_on_front');
332
  //If there is a parent page let's find it
333
+ if($parent > 0 && $id != $parent && $frontpage != $parent)
334
  {
335
  $parent = $this->post_parents($parent, $frontpage);
336
  }
454
  //Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
455
  $breadcrumb = $this->add(new bcn_breadcrumb(get_the_title($id), $this->opt['Hpost_' . $parent->post_type . '_template'], array('post', 'post-' . $parent->post_type), get_permalink($id), $id));
456
  //Make sure the id is valid, and that we won't end up spinning in a loop
457
+ if($parent->post_parent > 0 && $id != $parent->post_parent && $frontpage != $parent->post_parent)
458
  {
459
  //If valid, recursively call this function
460
  $parent = $this->post_parents($parent->post_parent, $frontpage);
499
  //Done with the current item, now on to the parents
500
  $frontpage = get_option('page_on_front');
501
  //Make sure the id is valid, and that we won't end up spinning in a loop
502
+ if($post->post_parent > 0 && $post->ID != $post->post_parent && $frontpage != $post->post_parent)
503
  {
504
  //Get the parent's information
505
  $parent = get_post($post->post_parent);
919
  //Get the blog page
920
  $bcn_post = get_post($root_id);
921
  //If there is a parent post let's find it
922
+ if($bcn_post->post_parent > 0 && $bcn_post->ID != $bcn_post->post_parent && $frontpage_id != $bcn_post->post_parent)
923
  {
924
  $this->post_parents($bcn_post->post_parent, $frontpage_id);
925
  }
1173
  protected function display_loop($linked, $reverse, $template)
1174
  {
1175
  $position = 1;
1176
+ $last_position = count($this->breadcrumbs);
1177
  //Initilize the string which will hold the assembled trail
1178
  $trail_str = '';
1179
  foreach($this->breadcrumbs as $key => $breadcrumb)
1180
  {
1181
+ $types = $breadcrumb->get_types();
1182
+ array_walk($types, 'sanitize_html_class');
1183
+ $class = sprintf(' class="%s"', esc_attr(implode(' ', $types)));
1184
+ //Deal with the separator
1185
+ if($position < $last_position)
1186
  {
1187
+ $separator = $this->opt['hseparator'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1188
  }
1189
  else
1190
+ {
1191
+ $separator = '';
 
 
 
1192
  }
1193
  //Filter li_attributes adding attributes to the li element
1194
  $attribs = apply_filters_deprecated('bcn_li_attributes', array($class, $breadcrumb->get_types(), $breadcrumb->get_id()), '6.0.0', 'bcn_display_attributes');
class.bcn_network_admin.php CHANGED
@@ -28,7 +28,7 @@ if(!class_exists('bcn_admin'))
28
  */
29
  class bcn_network_admin extends bcn_admin
30
  {
31
- const version = '6.0.1';
32
  protected $full_name = 'Breadcrumb NavXT Network Settings';
33
  protected $access_level = 'manage_network_options';
34
  /**
28
  */
29
  class bcn_network_admin extends bcn_admin
30
  {
31
+ const version = '6.0.2';
32
  protected $full_name = 'Breadcrumb NavXT Network Settings';
33
  protected $access_level = 'manage_network_options';
34
  /**
class.bcn_widget.php CHANGED
@@ -19,7 +19,7 @@
19
  require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
20
  class bcn_widget extends WP_Widget
21
  {
22
- const version = '6.0.1';
23
  protected $allowed_html = array();
24
  protected $defaults = array('title' => '', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false, 'force' => false);
25
  //Default constructor
19
  require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
20
  class bcn_widget extends WP_Widget
21
  {
22
+ const version = '6.0.2';
23
  protected $allowed_html = array();
24
  protected $defaults = array('title' => '', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false, 'force' => false);
25
  //Default constructor
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FD5XE
4
  Tags: breadcrumb, breadcrumbs, trail, navigation, menu, widget
5
  Requires at least: 4.7
6
  Tested up to: 4.9
7
- Stable tag: 6.0.1
8
  Requires PHP: 5.3
9
  License: GPLv2 or later
10
  Adds breadcrumb navigation showing the visitor's path to their current location.
@@ -52,6 +52,15 @@ Please visit [Breadcrumb NavXT's Documentation](http://mtekk.us/code/breadcrumb-
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
 
 
 
 
55
  = 6.0.1 =
56
  Release date: December, 28th 2017
57
 
4
  Tags: breadcrumb, breadcrumbs, trail, navigation, menu, widget
5
  Requires at least: 4.7
6
  Tested up to: 4.9
7
+ Stable tag: 6.0.2
8
  Requires PHP: 5.3
9
  License: GPLv2 or later
10
  Adds breadcrumb navigation showing the visitor's path to their current location.
52
 
53
  == Changelog ==
54
 
55
+ = 6.0.2 =
56
+ Release date: December, 30th 2017
57
+
58
+ * Behavior change: Added warning alerting that `bcn_breadcrumb::type` must be an array.
59
+ * Bug fix: Changed Breadcrumb Separator and Paged Template from an input field to a textbox to reduce confusion caused by HTML entities.
60
+ * Bug fix: Fixed issue where the parents of a page may not show up in the breadcrumb trail.
61
+ * Bug fix: Fixed issue where the `$reverse` parameter for `bcn_display` and `bcn_display_list` did not work properly.
62
+ * Bug fix: Fixed issue where the `bcn_display_list` function did not include the `li` elements.
63
+
64
  = 6.0.1 =
65
  Release date: December, 28th 2017
66