Breadcrumb NavXT - Version 6.5.0

Version Description

Release date: June, 12th 2020

  • Behavior change: Moved to using the taxonomy of the term rather than passed in taxonomy in various functions. As a consequence, this allows bcn_pick_post_term to override the taxonomy selection.
  • Behavior change: Default template for unlinked breadcrumbs now includes breadcrumbList markup.
  • New feature: Added new filter bcn_breadcrumb_linked.
  • New feature: Introduced new WordPress capability: bnc_manage_options.
  • Bug fix: Fixed XML settings exporter so that it no longer creates malformed files that cannot be imported when settings contain special HTML entities.
Download this release

Release Info

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

Code changes from version 6.4.0 to 6.5.0

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.4.0
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.4.0';
65
  protected $name = 'Breadcrumb NavXT';
66
  protected $identifier = 'breadcrumb-navxt';
67
  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: 6.5.0
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.5.0';
65
  protected $name = 'Breadcrumb NavXT';
66
  protected $identifier = 'breadcrumb-navxt';
67
  protected $unique_prefix = 'bcn';
class.bcn_admin.php CHANGED
@@ -43,10 +43,10 @@ if(!class_exists('mtekk_adminKit'))
43
  */
44
  class bcn_admin extends mtekk_adminKit
45
  {
46
- const version = '6.4.0';
47
  protected $full_name = 'Breadcrumb NavXT Settings';
48
  protected $short_name = 'Breadcrumb NavXT';
49
- protected $access_level = 'manage_options';
50
  protected $identifier = 'breadcrumb-navxt';
51
  protected $unique_prefix = 'bcn';
52
  protected $plugin_basename = null;
43
  */
44
  class bcn_admin extends mtekk_adminKit
45
  {
46
+ const version = '6.5.0';
47
  protected $full_name = 'Breadcrumb NavXT Settings';
48
  protected $short_name = 'Breadcrumb NavXT';
49
+ protected $access_level = 'bcn_manage_options';
50
  protected $identifier = 'breadcrumb-navxt';
51
  protected $unique_prefix = 'bcn';
52
  protected $plugin_basename = null;
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.4.0';
25
  //The main text that will be shown
26
  protected $title;
27
  //The breadcrumb's template, used durring assembly
@@ -38,7 +38,7 @@ class bcn_breadcrumb
38
  //The type of this breadcrumb
39
  protected $type;
40
  protected $allowed_html = array();
41
- const default_template_no_anchor = '<span class="%type%">%htitle%</span>';
42
  /**
43
  * The enhanced default constructor, ends up setting all parameters via the set_ functions
44
  *
@@ -129,7 +129,7 @@ class bcn_breadcrumb
129
  */
130
  public function set_linked($linked)
131
  {
132
- $this->linked = $linked;
133
  }
134
  /**
135
  * Function to set the internal breadcrumb template
@@ -280,4 +280,4 @@ class bcn_breadcrumb
280
  'name' => esc_attr($this->title))
281
  ), $this->type, $this->id);
282
  }
283
- }
21
  class bcn_breadcrumb
22
  {
23
  //Our member variables
24
+ const version = '6.5.0';
25
  //The main text that will be shown
26
  protected $title;
27
  //The breadcrumb's template, used durring assembly
38
  //The type of this breadcrumb
39
  protected $type;
40
  protected $allowed_html = array();
41
+ const default_template_no_anchor = '<span property="itemListElement" typeof="ListItem"><span property="name" class="%type%">%htitle%</span><meta property="url" content="%link%"><meta property="position" content="%position%"></span>';
42
  /**
43
  * The enhanced default constructor, ends up setting all parameters via the set_ functions
44
  *
129
  */
130
  public function set_linked($linked)
131
  {
132
+ $this->linked = apply_filters('bcn_breadcrumb_linked', $linked, $this->type, $this->id);
133
  }
134
  /**
135
  * Function to set the internal breadcrumb template
280
  'name' => esc_attr($this->title))
281
  ), $this->type, $this->id);
282
  }
283
+ }
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.4.0';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
@@ -375,7 +375,8 @@ class bcn_breadcrumb_trail
375
  if($term instanceof WP_Term)
376
  {
377
  //Fill out the term hiearchy
378
- $parent = $this->term_parents($term->term_id, $taxonomy);
 
379
  }
380
  }
381
  //Handle the rest of the taxonomies, including tags
@@ -413,7 +414,8 @@ class bcn_breadcrumb_trail
413
  //For single terms, treat as if they are hierarchical
414
  if(count($bcn_terms) === 1 && $bcn_terms[0] instanceof WP_Term)
415
  {
416
- return $this->term_parents($bcn_terms[0]->term_id, $taxonomy);
 
417
  }
418
  $title = '';
419
  $is_first = true;
@@ -454,15 +456,16 @@ class bcn_breadcrumb_trail
454
  {
455
  //Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
456
  $breadcrumb = $this->add(new bcn_breadcrumb(
457
- $term->name, $this->opt['Htax_' . $taxonomy . '_template'],
458
- array('taxonomy', $taxonomy),
459
- $this->maybe_add_post_type_arg(get_term_link($term), null, $taxonomy),
460
- $id,
461
  true));
462
  //Make sure the id is valid, and that we won't end up spinning in a loop
463
  if($term->parent && $term->parent != $id)
464
  {
465
  //Figure out the rest of the term hiearchy via recursion
 
466
  $ret_term = $this->term_parents($term->parent, $taxonomy);
467
  //May end up with WP_Error, don't update the term if that's the case
468
  if($ret_term instanceof WP_Term)
@@ -592,6 +595,7 @@ class bcn_breadcrumb_trail
592
  //Get parents of current term
593
  if($term->parent)
594
  {
 
595
  $this->term_parents($term->parent, $term->taxonomy);
596
  }
597
  }
21
  class bcn_breadcrumb_trail
22
  {
23
  //Our member variables
24
+ const version = '6.5.0';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
375
  if($term instanceof WP_Term)
376
  {
377
  //Fill out the term hiearchy
378
+ //FIXME: Change to just passing in term instance (work for 7.0)
379
+ $parent = $this->term_parents($term->term_id, $term->taxonomy);
380
  }
381
  }
382
  //Handle the rest of the taxonomies, including tags
414
  //For single terms, treat as if they are hierarchical
415
  if(count($bcn_terms) === 1 && $bcn_terms[0] instanceof WP_Term)
416
  {
417
+ //FIXME: Change to just passing in term instance (work for 7.0)
418
+ return $this->term_parents($bcn_terms[0]->term_id, $bcn_terms[0]->taxonomy);
419
  }
420
  $title = '';
421
  $is_first = true;
456
  {
457
  //Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
458
  $breadcrumb = $this->add(new bcn_breadcrumb(
459
+ $term->name, $this->opt['Htax_' . $term->taxonomy . '_template'],
460
+ array('taxonomy', $term->taxonomy),
461
+ $this->maybe_add_post_type_arg(get_term_link($term), null, $term->taxonomy),
462
+ $term->term_id,
463
  true));
464
  //Make sure the id is valid, and that we won't end up spinning in a loop
465
  if($term->parent && $term->parent != $id)
466
  {
467
  //Figure out the rest of the term hiearchy via recursion
468
+ //FIXME: Change to just passing in term instance (work for 7.0)
469
  $ret_term = $this->term_parents($term->parent, $taxonomy);
470
  //May end up with WP_Error, don't update the term if that's the case
471
  if($ret_term instanceof WP_Term)
595
  //Get parents of current term
596
  if($term->parent)
597
  {
598
+ //FIXME: Change to just passing in term instance (work for 7.0)
599
  $this->term_parents($term->parent, $term->taxonomy);
600
  }
601
  }
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.4.0';
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.5.0';
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.4.0';
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.5.0';
23
  protected $allowed_html = array();
24
  protected $defaults = array('title' => '', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false, 'force' => false);
25
  //Default constructor
includes/class.mtekk_adminkit.php CHANGED
@@ -24,7 +24,7 @@ if(!class_exists('mtekk_adminKit_message'))
24
  }
25
  abstract class mtekk_adminKit
26
  {
27
- const version = '2.0.2';
28
  protected $full_name;
29
  protected $short_name;
30
  protected $plugin_basename;
@@ -64,6 +64,17 @@ abstract class mtekk_adminKit
64
  {
65
  return mtekk_adminKit::version;
66
  }
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Return the URL of the settings page for the plugin
69
  */
@@ -123,6 +134,7 @@ abstract class mtekk_adminKit
123
  }
124
  function init()
125
  {
 
126
  //Admin Options reset hook
127
  if(isset($_POST[$this->unique_prefix . '_admin_reset']))
128
  {
@@ -605,8 +617,12 @@ abstract class mtekk_adminKit
605
  //Loop through the options array
606
  foreach($this->opt as $key=>$option)
607
  {
 
 
 
 
608
  //Add a option tag under the options tag, store the option value
609
- $node = $dom->createElement('option', htmlentities($option, ENT_COMPAT, 'UTF-8'));
610
  $newnode = $plugnode->appendChild($node);
611
  //Change the tag's name to that of the stored option
612
  $newnode->setAttribute('name', $key);
@@ -639,7 +655,7 @@ abstract class mtekk_adminKit
639
  //We want to catch errors ourselves
640
  set_error_handler('error');
641
  //Load the user uploaded file, handle failure gracefully
642
- if($dom->load($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']))
643
  {
644
  $opts_temp = array();
645
  $version = '';
24
  }
25
  abstract class mtekk_adminKit
26
  {
27
+ const version = '2.1.0';
28
  protected $full_name;
29
  protected $short_name;
30
  protected $plugin_basename;
64
  {
65
  return mtekk_adminKit::version;
66
  }
67
+ /**
68
+ * Checks if the administrator has the access capability, and adds it if they don't
69
+ */
70
+ function add_cap()
71
+ {
72
+ $role = get_role('administrator');
73
+ if(!$role->has_cap($this->access_level))
74
+ {
75
+ $role->add_cap($this->access_level);
76
+ }
77
+ }
78
  /**
79
  * Return the URL of the settings page for the plugin
80
  */
134
  }
135
  function init()
136
  {
137
+ $this->add_cap();
138
  //Admin Options reset hook
139
  if(isset($_POST[$this->unique_prefix . '_admin_reset']))
140
  {
617
  //Loop through the options array
618
  foreach($this->opt as $key=>$option)
619
  {
620
+ if(is_array($option))
621
+ {
622
+ continue;
623
+ }
624
  //Add a option tag under the options tag, store the option value
625
+ $node = $dom->createElement('option', htmlentities($option, ENT_COMPAT | ENT_XML1, 'UTF-8'));
626
  $newnode = $plugnode->appendChild($node);
627
  //Change the tag's name to that of the stored option
628
  $newnode->setAttribute('name', $key);
655
  //We want to catch errors ourselves
656
  set_error_handler('error');
657
  //Load the user uploaded file, handle failure gracefully
658
+ if(is_uploaded_file($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']) && $dom->load($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']))
659
  {
660
  $opts_temp = array();
661
  $version = '';
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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: 4.8
6
- Tested up to: 5.4.0
7
- Stable tag: 6.4.0
8
  Requires PHP: 5.5
9
  License: GPLv2 or later
10
  Adds breadcrumb navigation showing the visitor's path to their current location.
@@ -49,6 +49,15 @@ Please visit [Breadcrumb NavXT's Documentation](http://mtekk.us/code/breadcrumb-
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
 
 
 
 
52
  = 6.4.0 =
53
  Release date: December, 31st 2019
54
 
@@ -83,7 +92,7 @@ Release date: September, 24th 2018
83
  * Behavior change: Default unlinked breadcrumb templates no longer contain Schema.org BreadcrumbList markup.
84
  * Behavior change: Breadcrumb NavXT REST API endpoints are no longer enabled by default.
85
  * New feature: Added `bcn_register_rest_endpoint` filter.
86
- * New feature: Added `bcn_breadcrumb_assemble_json_ld_array` filter.
87
  * New feature: Added support for following the post parent hierarchy first then falling back to a secondary hierarchy.
88
  * Bug fix: Fixed issue where on loading the settings page immediately after migrating settings causes PHP warnings on CPT and custom taxonomy settings.
89
  * Bug fix: Fixed issue that caused the settings reset option under the help drop down to not work.
2
  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: 4.9
6
+ Tested up to: 5.4.2
7
+ Stable tag: 6.5.0
8
  Requires PHP: 5.5
9
  License: GPLv2 or later
10
  Adds breadcrumb navigation showing the visitor's path to their current location.
49
 
50
  == Changelog ==
51
 
52
+ = 6.5.0 =
53
+ Release date: June, 12th 2020
54
+
55
+ * Behavior change: Moved to using the taxonomy of the term rather than passed in taxonomy in various functions. As a consequence, this allows `bcn_pick_post_term` to override the taxonomy selection.
56
+ * Behavior change: Default template for unlinked breadcrumbs now includes breadcrumbList markup.
57
+ * New feature: Added new filter `bcn_breadcrumb_linked`.
58
+ * New feature: Introduced new WordPress capability: `bnc_manage_options`.
59
+ * Bug fix: Fixed XML settings exporter so that it no longer creates malformed files that cannot be imported when settings contain special HTML entities.
60
+
61
  = 6.4.0 =
62
  Release date: December, 31st 2019
63
 
92
  * Behavior change: Default unlinked breadcrumb templates no longer contain Schema.org BreadcrumbList markup.
93
  * Behavior change: Breadcrumb NavXT REST API endpoints are no longer enabled by default.
94
  * New feature: Added `bcn_register_rest_endpoint` filter.
95
+ * New feature: Added `bcn_breadcrumb_assembled_json_ld_array` filter.
96
  * New feature: Added support for following the post parent hierarchy first then falling back to a secondary hierarchy.
97
  * Bug fix: Fixed issue where on loading the settings page immediately after migrating settings causes PHP warnings on CPT and custom taxonomy settings.
98
  * Bug fix: Fixed issue that caused the settings reset option under the help drop down to not work.