Breadcrumb NavXT - Version 7.0.1

Version Description

Release date: December, 27th 2021

  • Behavior change: Moved bcn_settings_init filter to before establishing default setting values. This filter is no longer capable of changing the default values of settings.
  • Behavior change: Moved setup of defaults to 9000 priority, intending to cover the majority of plugins that add CPTs.
  • Bug fix: Fixed compatibility issues with PHP5.6.
  • Bug fix: Fixed PHP error caused by some return value of page_ settings.
  • Bug fix: Fixed PHP error caused by non settings settings in array passed into adminKit::settings_to_opts.
  • Bug fix: Fixed issue with bcn_allowed_html not covering admin interface elements (mapped bcn_allowed_html to mtekk_adminkit_allowed_html).
Download this release

Release Info

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

Code changes from version 7.0.0 to 7.0.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: 7.0.0
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
@@ -27,13 +27,13 @@ Domain Path: /languages
27
  along with this program; if not, write to the Free Software
28
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
  */
30
- //Do a PHP version check, require 5.3 or newer
31
- if(version_compare(phpversion(), '5.3.0', '<'))
32
  {
33
  //Only purpose of this function is to echo out the PHP version error
34
  function bcn_phpold()
35
  {
36
- printf('<div class="notice notice-error"><p>' . esc_html__('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '</p></div>', phpversion(), '5.3.0');
37
  }
38
  //If we are in the admin, let's print a warning then return
39
  if(is_admin())
@@ -63,7 +63,7 @@ $breadcrumb_navxt = null;
63
  //TODO change to extends \mtekk\plugKit
64
  class breadcrumb_navxt
65
  {
66
- const version = '7.0.0';
67
  protected $name = 'Breadcrumb NavXT';
68
  protected $identifier = 'breadcrumb-navxt';
69
  protected $unique_prefix = 'bcn';
@@ -87,8 +87,8 @@ class breadcrumb_navxt
87
  //We need to add in the defaults for CPTs and custom taxonomies after all other plugins are loaded
88
  add_action('wp_loaded', array($this, 'wp_loaded'), 15);
89
  add_action('rest_api_init', array($this, 'rest_api_init'), 10);
90
- //Run a little later than everyone else to give other plugins a chance to hook into the filters and actions in this
91
- add_action('init', array($this, 'init'), 11);
92
  //Register the WordPress 2.8 Widget
93
  add_action('widgets_init', array($this, 'register_widget'));
94
  //Load our network admin if in the network dashboard (yes is_network_admin() doesn't exist)
@@ -109,7 +109,7 @@ class breadcrumb_navxt
109
  public function init()
110
  {
111
  add_filter('bcn_allowed_html', array($this, 'allowed_html'), 1, 1);
112
- add_filter('mtekk_adminkit_allowed_html', array($this, 'allowed_html'), 1, 1);
113
  //We want to run late for using our breadcrumbs
114
  add_filter('tha_breadcrumb_navigation', array($this, 'tha_compat'), 99);
115
  //Only include the REST API if enabled
@@ -118,7 +118,7 @@ class breadcrumb_navxt
118
  require_once(dirname(__FILE__) . '/class.bcn_rest_controller.php');
119
  $this->rest_controller = new bcn_rest_controller($this->breadcrumb_trail, $this->unique_prefix);
120
  }
121
- $this->setup_setting_defaults();
122
  if(!is_admin() || (!isset($_POST[$this->unique_prefix . '_admin_reset']) && !isset($_POST[$this->unique_prefix . '_admin_options'])))
123
  {
124
  $this->get_settings(); //This breaks the reset options script, so only do it if we're not trying to reset the settings
@@ -188,6 +188,11 @@ class breadcrumb_navxt
188
  }
189
  return $register_rest_endpoint;
190
  }
 
 
 
 
 
191
  public function allowed_html($tags)
192
  {
193
  $allowed_html = array(
@@ -325,83 +330,86 @@ class breadcrumb_navxt
325
  {
326
  $this->admin->uninstall();
327
  }
328
- public function setup_setting_defaults()
329
  {
330
- $this->settings['bmainsite_display'] = new setting\setting_bool(
 
 
 
331
  'mainsite_display',
332
  true,
333
  __('Main Site Breadcrumb', 'breadcrumb-navxt'));
334
- $this->settings['Hmainsite_template'] = new setting\setting_html(
335
  'mainsite_template',
336
  bcn_breadcrumb::get_default_template(),
337
  __('Main Site Home Template', 'breadcrumb-navxt'));
338
- $this->settings['Hmainsite_template_no_anchor'] = new setting\setting_html(
339
  'mainsite_template_no_anchor',
340
  bcn_breadcrumb::default_template_no_anchor,
341
  __('Main Site Home Template (Unlinked)', 'breadcrumb-navxt'));
342
- $this->settings['bhome_display'] = new setting\setting_bool(
343
  'home_display',
344
  true,
345
  __('Home Breadcrumb', 'breadcrumb-navxt'));
346
- $this->settings['Hhome_template'] = new setting\setting_html(
347
  'home_template',
348
  bcn_breadcrumb::get_default_template(),
349
  __('Home Template', 'breadcrumb-navxt'));
350
- $this->settings['Hhome_template_no_anchor'] = new setting\setting_html(
351
  'home_template_no_anchor',
352
  bcn_breadcrumb::default_template_no_anchor,
353
  __('Home Template (Unlinked)', 'breadcrumb-navxt'));
354
- $this->settings['bblog_display'] = new setting\setting_bool(
355
  'blog_display',
356
  true,
357
  __('Blog Breadcrumb', 'breadcrumb-navxt'));
358
- $this->settings['hseparator'] = new setting\setting_html(
359
  'separator',
360
  ' &gt; ',
361
  __('Breadcrumb Separator', 'breadcrumb-navxt'),
362
  true);
363
- $this->settings['hseparator_higher_dim'] = new setting\setting_html(
364
  'separator_higher_dim',
365
  ', ',
366
  __('Breadcrumb Separator (Higher Dimension)', 'breadcrumb-navxt'),
367
  true);
368
- $this->settings['bcurrent_item_linked'] = new setting\setting_bool(
369
  'current_item_linked',
370
  false,
371
  __('Link Current Item', 'breadcrumb-navxt'));
372
- $this->settings['Hpaged_template'] = new setting\setting_html(
373
  'paged_template',
374
  sprintf('<span class="%%type%%">%1$s</span>', esc_attr__('Page %htitle%', 'breadcrumb-navxt')),
375
  _x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'));
376
- $this->settings['bpaged_display'] = new setting\setting_bool(
377
  'paged_display',
378
  false,
379
  _x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'));
380
  //Post types
381
  foreach($GLOBALS['wp_post_types']as $post_type)
382
  {
383
- $this->settings['Hpost_' . $post_type->name . '_template'] = new setting\setting_html(
384
  'post_' . $post_type->name . '_template',
385
  bcn_breadcrumb::get_default_template(),
386
  sprintf(__('%s Template', 'breadcrumb-navxt'), $post_type->labels->singular_name));
387
- $this->settings['Hpost_' . $post_type->name . '_template_no_anchor'] = new setting\setting_html(
388
  'post_' . $post_type->name . '_template_no_anchor',
389
  bcn_breadcrumb::default_template_no_anchor,
390
  sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $post_type->labels->singular_name));
391
  //Root default depends on post type
392
  if($post_type->name === 'page')
393
  {
394
- $default_root = get_option('page_on_front');
395
  }
396
  else if($post_type->name === 'post')
397
  {
398
- $default_root = get_option('page_for_posts');
399
  }
400
  else
401
  {
402
  $default_root = 0;
403
  }
404
- $this->settings['apost_' . $post_type->name . '_root'] = new setting\setting_absint(
405
  'post_' . $post_type->name . '_root',
406
  $default_root,
407
  sprintf(__('%s Root Page', 'breadcrumb-navxt'), $post_type->labels->singular_name));
@@ -414,11 +422,11 @@ class breadcrumb_navxt
414
  {
415
  $default_archive_display = false;
416
  }
417
- $this->settings['bpost_' . $post_type->name . '_archive_display'] = new setting\setting_bool(
418
  'post_' . $post_type->name . '_archive_display',
419
  $default_archive_display,
420
  sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name));
421
- $this->settings['bpost_' . $post_type->name . '_taxonomy_referer'] = new setting\setting_bool(
422
  'post_' . $post_type->name . '_taxonomy_referer',
423
  false,
424
  sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name));
@@ -435,7 +443,7 @@ class breadcrumb_navxt
435
  {
436
  $default_parent_first = apply_filters('bcn_default_hierarchy_parent_first', false, $post_type->name);
437
  }
438
- $this->settings['bpost_' . $post_type->name . '_hierarchy_parent_first'] = new setting\setting_bool(
439
  'post_' . $post_type->name . '_hierarchy_parent_first',
440
  $default_parent_first,
441
  sprintf(__('%s Hierarchy Use Parent First', 'breadcrumb-navxt'), $post_type->labels->singular_name));
@@ -478,11 +486,11 @@ class breadcrumb_navxt
478
  $hierarchy_type_default = 'BCN_POST_PARENT';
479
  }
480
  }
481
- $this->settings['bpost_' . $post_type->name . '_hierarchy_display'] = new setting\setting_bool(
482
  'post_' . $post_type->name . '_hierarchy_display',
483
  $default_hierarchy_display,
484
  sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name));
485
- $this->settings['Epost_' . $post_type->name . '_hierarchy_type'] = new setting\setting_enum(
486
  'post_' . $post_type->name . '_hierarchy_type',
487
  $hierarchy_type_default,
488
  sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name),
@@ -493,59 +501,59 @@ class breadcrumb_navxt
493
  //Taxonomies
494
  foreach($GLOBALS['wp_taxonomies']as $taxonomy)
495
  {
496
- $this->settings['Htax_' . $taxonomy->name. '_template'] = new setting\setting_html(
497
  'tax_' . $taxonomy->name. '_template',
498
  __(sprintf('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %%title%% %s archives." href="%%link%%" class="%%type%%" bcn-aria-current><span property="name">%%htitle%%</span></a><meta property="position" content="%%position%%"></span>', $taxonomy->labels->singular_name), 'breadcrumb-navxt'),
499
  sprintf(__('%s Template', 'breadcrumb-navxt'), $taxonomy->labels->singular_name));
500
- $this->settings['Htax_' . $taxonomy->name. '_template_no_anchor'] = new setting\setting_html(
501
  'tax_' . $taxonomy->name. '_template_no_anchor',
502
  bcn_breadcrumb::default_template_no_anchor,
503
  sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $taxonomy->labels->singular_name));
504
  }
505
  //Miscellaneous
506
- $this->settings['H404_template'] = new setting\setting_html(
507
  '404_template',
508
  bcn_breadcrumb::get_default_template(),
509
  __('404 Template', 'breadcrumb-navxt'));
510
- $this->settings['S404_title'] = new setting\setting_string(
511
  '404_title',
512
  __('404', 'breadcrumb-navxt'),
513
  __('404 Title', 'breadcrumb-navxt'));
514
- $this->settings['Hsearch_template'] = new setting\setting_html(
515
  'search_template',
516
  sprintf('<span property="itemListElement" typeof="ListItem"><span property="name">%1$s</span><meta property="position" content="%%position%%"></span>',
517
  sprintf(esc_attr__('Search results for &#39;%1$s&#39;', 'breadcrumb-navxt'),
518
  sprintf('<a property="item" typeof="WebPage" title="%1$s" href="%%link%%" class="%%type%%" bcn-aria-current>%%htitle%%</a>', esc_attr__('Go to the first page of search results for %title%.', 'breadcrumb-navxt')))),
519
  __('Search Template', 'breadcrumb-navxt'));
520
- $this->settings['Hsearch_template_no_anchor'] = new setting\setting_html(
521
  'search_template_no_anchor',
522
  sprintf('<span class="%%type%%">%1$s</span>',
523
  sprintf(esc_attr__('Search results for &#39;%1$s&#39;', 'breadcrumb-navxt'), '%htitle%')),
524
  __('Search Template (Unlinked)', 'breadcrumb-navxt'));
525
- $this->settings['Hdate_template'] = new setting\setting_html(
526
  'date_template',
527
  sprintf('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="%1$s" href="%%link%%" class="%%type%%" bcn-aria-current><span property="name">%%htitle%%</span></a><meta property="position" content="%%position%%"></span>', esc_attr__('Go to the %title% archives.', 'breadcrumb-navxt')),
528
  __('Date Template', 'breadcrumb-navxt'));
529
- $this->settings['Hdate_template_no_anchor'] = new setting\setting_html(
530
  'date_template_no_anchor',
531
  bcn_breadcrumb::default_template_no_anchor,
532
  __('Date Template (Unlinked)', 'breadcrumb-navxt'));
533
- $this->settings['Hauthor_template'] = new setting\setting_html(
534
  'author_template',
535
  sprintf('<span property="itemListElement" typeof="ListItem"><span property="name">%1$s</span><meta property="position" content="%%position%%"></span>',
536
  sprintf(esc_attr__('Articles by: %1$s', 'breadcrumb-navxt'),
537
  sprintf('<a title="%1$s" href="%%link%%" class="%%type%%" bcn-aria-current>%%htitle%%</a>', esc_attr__('Go to the first page of posts by %title%.', 'breadcrumb-navxt')))),
538
  __('Author Template', 'breadcrumb-navxt'));
539
- $this->settings['Hauthor_template_no_anchor'] = new setting\setting_html(
540
  'author_template_no_anchor',
541
  sprintf('<span class="%%type%%">%1$s</span>',
542
  sprintf(esc_attr__('Articles by: %1$s', 'breadcrumb-navxt'), '%htitle%')),
543
  __('Author Template (Unlinked)', 'breadcrumb-navxt'));
544
- $this->settings['aauthor_root'] = new setting\setting_absint(
545
  'author_root',
546
  0,
547
  __('Author Root Page', 'breadcrumb-navxt'));
548
- $this->settings['Eauthor_name'] = new setting\setting_enum(
549
  'author_name',
550
  'display_name',
551
  __('Author Display Format', 'breadcrumb-navxt'),
@@ -555,20 +563,18 @@ class breadcrumb_navxt
555
  /**
556
  * Here are some deprecated settings
557
  */
558
- $this->settings['blimit_title'] = new setting\setting_bool(
559
  'limit_title',
560
  false,
561
  __('Limit Title Length', 'breadcrumb-navxt'),
562
  false,
563
  true);
564
- $this->settings['amax_title_length'] = new setting\setting_absint(
565
  'max_title_length',
566
  30,
567
  __('Maximum Title Length', 'breadcrumb-navxt'),
568
  false,
569
  true);
570
- //Hook for letting others modify our default settings
571
- $this->settings = apply_filters('bcn_settings_init', $this->settings);
572
  }
573
  /**
574
  * Sets up the extended options for any CPTs, taxonomies or extensions
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: 7.0.1
7
  Author: John Havlik
8
  Author URI: http://mtekk.us/
9
  License: GPL2
27
  along with this program; if not, write to the Free Software
28
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
  */
30
+ //Do a PHP version check, require 5.6 or newer
31
+ if(version_compare(phpversion(), '5.6.0', '<'))
32
  {
33
  //Only purpose of this function is to echo out the PHP version error
34
  function bcn_phpold()
35
  {
36
+ printf('<div class="notice notice-error"><p>' . esc_html__('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '</p></div>', phpversion(), '5.6.0');
37
  }
38
  //If we are in the admin, let's print a warning then return
39
  if(is_admin())
63
  //TODO change to extends \mtekk\plugKit
64
  class breadcrumb_navxt
65
  {
66
+ const version = '7.0.1';
67
  protected $name = 'Breadcrumb NavXT';
68
  protected $identifier = 'breadcrumb-navxt';
69
  protected $unique_prefix = 'bcn';
87
  //We need to add in the defaults for CPTs and custom taxonomies after all other plugins are loaded
88
  add_action('wp_loaded', array($this, 'wp_loaded'), 15);
89
  add_action('rest_api_init', array($this, 'rest_api_init'), 10);
90
+ //Run much later than everyone else to give other plugins a chance to hook into the filters and actions in this
91
+ add_action('init', array($this, 'init'), 9000);
92
  //Register the WordPress 2.8 Widget
93
  add_action('widgets_init', array($this, 'register_widget'));
94
  //Load our network admin if in the network dashboard (yes is_network_admin() doesn't exist)
109
  public function init()
110
  {
111
  add_filter('bcn_allowed_html', array($this, 'allowed_html'), 1, 1);
112
+ add_filter('mtekk_adminkit_allowed_html', array($this, 'adminkit_allowed_html'), 1, 1);
113
  //We want to run late for using our breadcrumbs
114
  add_filter('tha_breadcrumb_navigation', array($this, 'tha_compat'), 99);
115
  //Only include the REST API if enabled
118
  require_once(dirname(__FILE__) . '/class.bcn_rest_controller.php');
119
  $this->rest_controller = new bcn_rest_controller($this->breadcrumb_trail, $this->unique_prefix);
120
  }
121
+ breadcrumb_navxt::setup_setting_defaults($this->settings);
122
  if(!is_admin() || (!isset($_POST[$this->unique_prefix . '_admin_reset']) && !isset($_POST[$this->unique_prefix . '_admin_options'])))
123
  {
124
  $this->get_settings(); //This breaks the reset options script, so only do it if we're not trying to reset the settings
188
  }
189
  return $register_rest_endpoint;
190
  }
191
+ public function adminkit_allowed_html($tags)
192
+ {
193
+ //Hoop through normal allowed_html filters
194
+ return apply_filters('bcn_allowed_html', $tags);
195
+ }
196
  public function allowed_html($tags)
197
  {
198
  $allowed_html = array(
330
  {
331
  $this->admin->uninstall();
332
  }
333
+ static function setup_setting_defaults(array &$settings)
334
  {
335
+ //Hook for letting other plugins add in their default settings (has to go first to prevent other from overriding base settings)
336
+ $settings= apply_filters('bcn_settings_init', $settings);
337
+ //Now on to our settings
338
+ $settings['bmainsite_display'] = new setting\setting_bool(
339
  'mainsite_display',
340
  true,
341
  __('Main Site Breadcrumb', 'breadcrumb-navxt'));
342
+ $settings['Hmainsite_template'] = new setting\setting_html(
343
  'mainsite_template',
344
  bcn_breadcrumb::get_default_template(),
345
  __('Main Site Home Template', 'breadcrumb-navxt'));
346
+ $settings['Hmainsite_template_no_anchor'] = new setting\setting_html(
347
  'mainsite_template_no_anchor',
348
  bcn_breadcrumb::default_template_no_anchor,
349
  __('Main Site Home Template (Unlinked)', 'breadcrumb-navxt'));
350
+ $settings['bhome_display'] = new setting\setting_bool(
351
  'home_display',
352
  true,
353
  __('Home Breadcrumb', 'breadcrumb-navxt'));
354
+ $settings['Hhome_template'] = new setting\setting_html(
355
  'home_template',
356
  bcn_breadcrumb::get_default_template(),
357
  __('Home Template', 'breadcrumb-navxt'));
358
+ $settings['Hhome_template_no_anchor'] = new setting\setting_html(
359
  'home_template_no_anchor',
360
  bcn_breadcrumb::default_template_no_anchor,
361
  __('Home Template (Unlinked)', 'breadcrumb-navxt'));
362
+ $settings['bblog_display'] = new setting\setting_bool(
363
  'blog_display',
364
  true,
365
  __('Blog Breadcrumb', 'breadcrumb-navxt'));
366
+ $settings['hseparator'] = new setting\setting_html(
367
  'separator',
368
  ' &gt; ',
369
  __('Breadcrumb Separator', 'breadcrumb-navxt'),
370
  true);
371
+ $settings['hseparator_higher_dim'] = new setting\setting_html(
372
  'separator_higher_dim',
373
  ', ',
374
  __('Breadcrumb Separator (Higher Dimension)', 'breadcrumb-navxt'),
375
  true);
376
+ $settings['bcurrent_item_linked'] = new setting\setting_bool(
377
  'current_item_linked',
378
  false,
379
  __('Link Current Item', 'breadcrumb-navxt'));
380
+ $settings['Hpaged_template'] = new setting\setting_html(
381
  'paged_template',
382
  sprintf('<span class="%%type%%">%1$s</span>', esc_attr__('Page %htitle%', 'breadcrumb-navxt')),
383
  _x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'));
384
+ $settings['bpaged_display'] = new setting\setting_bool(
385
  'paged_display',
386
  false,
387
  _x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'));
388
  //Post types
389
  foreach($GLOBALS['wp_post_types']as $post_type)
390
  {
391
+ $settings['Hpost_' . $post_type->name . '_template'] = new setting\setting_html(
392
  'post_' . $post_type->name . '_template',
393
  bcn_breadcrumb::get_default_template(),
394
  sprintf(__('%s Template', 'breadcrumb-navxt'), $post_type->labels->singular_name));
395
+ $settings['Hpost_' . $post_type->name . '_template_no_anchor'] = new setting\setting_html(
396
  'post_' . $post_type->name . '_template_no_anchor',
397
  bcn_breadcrumb::default_template_no_anchor,
398
  sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $post_type->labels->singular_name));
399
  //Root default depends on post type
400
  if($post_type->name === 'page')
401
  {
402
+ $default_root = absint(get_option('page_on_front'));
403
  }
404
  else if($post_type->name === 'post')
405
  {
406
+ $default_root = absint(get_option('page_for_posts'));
407
  }
408
  else
409
  {
410
  $default_root = 0;
411
  }
412
+ $settings['apost_' . $post_type->name . '_root'] = new setting\setting_absint(
413
  'post_' . $post_type->name . '_root',
414
  $default_root,
415
  sprintf(__('%s Root Page', 'breadcrumb-navxt'), $post_type->labels->singular_name));
422
  {
423
  $default_archive_display = false;
424
  }
425
+ $settings['bpost_' . $post_type->name . '_archive_display'] = new setting\setting_bool(
426
  'post_' . $post_type->name . '_archive_display',
427
  $default_archive_display,
428
  sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name));
429
+ $settings['bpost_' . $post_type->name . '_taxonomy_referer'] = new setting\setting_bool(
430
  'post_' . $post_type->name . '_taxonomy_referer',
431
  false,
432
  sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name));
443
  {
444
  $default_parent_first = apply_filters('bcn_default_hierarchy_parent_first', false, $post_type->name);
445
  }
446
+ $settings['bpost_' . $post_type->name . '_hierarchy_parent_first'] = new setting\setting_bool(
447
  'post_' . $post_type->name . '_hierarchy_parent_first',
448
  $default_parent_first,
449
  sprintf(__('%s Hierarchy Use Parent First', 'breadcrumb-navxt'), $post_type->labels->singular_name));
486
  $hierarchy_type_default = 'BCN_POST_PARENT';
487
  }
488
  }
489
+ $settings['bpost_' . $post_type->name . '_hierarchy_display'] = new setting\setting_bool(
490
  'post_' . $post_type->name . '_hierarchy_display',
491
  $default_hierarchy_display,
492
  sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name));
493
+ $settings['Epost_' . $post_type->name . '_hierarchy_type'] = new setting\setting_enum(
494
  'post_' . $post_type->name . '_hierarchy_type',
495
  $hierarchy_type_default,
496
  sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name),
501
  //Taxonomies
502
  foreach($GLOBALS['wp_taxonomies']as $taxonomy)
503
  {
504
+ $settings['Htax_' . $taxonomy->name. '_template'] = new setting\setting_html(
505
  'tax_' . $taxonomy->name. '_template',
506
  __(sprintf('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %%title%% %s archives." href="%%link%%" class="%%type%%" bcn-aria-current><span property="name">%%htitle%%</span></a><meta property="position" content="%%position%%"></span>', $taxonomy->labels->singular_name), 'breadcrumb-navxt'),
507
  sprintf(__('%s Template', 'breadcrumb-navxt'), $taxonomy->labels->singular_name));
508
+ $settings['Htax_' . $taxonomy->name. '_template_no_anchor'] = new setting\setting_html(
509
  'tax_' . $taxonomy->name. '_template_no_anchor',
510
  bcn_breadcrumb::default_template_no_anchor,
511
  sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $taxonomy->labels->singular_name));
512
  }
513
  //Miscellaneous
514
+ $settings['H404_template'] = new setting\setting_html(
515
  '404_template',
516
  bcn_breadcrumb::get_default_template(),
517
  __('404 Template', 'breadcrumb-navxt'));
518
+ $settings['S404_title'] = new setting\setting_string(
519
  '404_title',
520
  __('404', 'breadcrumb-navxt'),
521
  __('404 Title', 'breadcrumb-navxt'));
522
+ $settings['Hsearch_template'] = new setting\setting_html(
523
  'search_template',
524
  sprintf('<span property="itemListElement" typeof="ListItem"><span property="name">%1$s</span><meta property="position" content="%%position%%"></span>',
525
  sprintf(esc_attr__('Search results for &#39;%1$s&#39;', 'breadcrumb-navxt'),
526
  sprintf('<a property="item" typeof="WebPage" title="%1$s" href="%%link%%" class="%%type%%" bcn-aria-current>%%htitle%%</a>', esc_attr__('Go to the first page of search results for %title%.', 'breadcrumb-navxt')))),
527
  __('Search Template', 'breadcrumb-navxt'));
528
+ $settings['Hsearch_template_no_anchor'] = new setting\setting_html(
529
  'search_template_no_anchor',
530
  sprintf('<span class="%%type%%">%1$s</span>',
531
  sprintf(esc_attr__('Search results for &#39;%1$s&#39;', 'breadcrumb-navxt'), '%htitle%')),
532
  __('Search Template (Unlinked)', 'breadcrumb-navxt'));
533
+ $settings['Hdate_template'] = new setting\setting_html(
534
  'date_template',
535
  sprintf('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="%1$s" href="%%link%%" class="%%type%%" bcn-aria-current><span property="name">%%htitle%%</span></a><meta property="position" content="%%position%%"></span>', esc_attr__('Go to the %title% archives.', 'breadcrumb-navxt')),
536
  __('Date Template', 'breadcrumb-navxt'));
537
+ $settings['Hdate_template_no_anchor'] = new setting\setting_html(
538
  'date_template_no_anchor',
539
  bcn_breadcrumb::default_template_no_anchor,
540
  __('Date Template (Unlinked)', 'breadcrumb-navxt'));
541
+ $settings['Hauthor_template'] = new setting\setting_html(
542
  'author_template',
543
  sprintf('<span property="itemListElement" typeof="ListItem"><span property="name">%1$s</span><meta property="position" content="%%position%%"></span>',
544
  sprintf(esc_attr__('Articles by: %1$s', 'breadcrumb-navxt'),
545
  sprintf('<a title="%1$s" href="%%link%%" class="%%type%%" bcn-aria-current>%%htitle%%</a>', esc_attr__('Go to the first page of posts by %title%.', 'breadcrumb-navxt')))),
546
  __('Author Template', 'breadcrumb-navxt'));
547
+ $settings['Hauthor_template_no_anchor'] = new setting\setting_html(
548
  'author_template_no_anchor',
549
  sprintf('<span class="%%type%%">%1$s</span>',
550
  sprintf(esc_attr__('Articles by: %1$s', 'breadcrumb-navxt'), '%htitle%')),
551
  __('Author Template (Unlinked)', 'breadcrumb-navxt'));
552
+ $settings['aauthor_root'] = new setting\setting_absint(
553
  'author_root',
554
  0,
555
  __('Author Root Page', 'breadcrumb-navxt'));
556
+ $settings['Eauthor_name'] = new setting\setting_enum(
557
  'author_name',
558
  'display_name',
559
  __('Author Display Format', 'breadcrumb-navxt'),
563
  /**
564
  * Here are some deprecated settings
565
  */
566
+ $settings['blimit_title'] = new setting\setting_bool(
567
  'limit_title',
568
  false,
569
  __('Limit Title Length', 'breadcrumb-navxt'),
570
  false,
571
  true);
572
+ $settings['amax_title_length'] = new setting\setting_absint(
573
  'max_title_length',
574
  30,
575
  __('Maximum Title Length', 'breadcrumb-navxt'),
576
  false,
577
  true);
 
 
578
  }
579
  /**
580
  * Sets up the extended options for any CPTs, taxonomies or extensions
class.bcn_admin.php CHANGED
@@ -17,13 +17,13 @@
17
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
  */
19
  require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
20
- //Do a PHP version check, require 5.3 or newer
21
- if(version_compare(phpversion(), '5.3.0', '<'))
22
  {
23
  //Only purpose of this function is to echo out the PHP version error
24
  function bcn_phpold()
25
  {
26
- printf('<div class="notice notice-error"><p>' . __('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '</p></div>', phpversion(), '5.3.0');
27
  }
28
  //If we are in the admin, let's print a warning then return
29
  if(is_admin())
@@ -44,7 +44,7 @@ use mtekk\adminKit\{adminKit, form, message, setting};
44
  */
45
  class bcn_admin extends adminKit
46
  {
47
- const version = '7.0.0';
48
  protected $full_name = 'Breadcrumb NavXT Settings';
49
  protected $short_name = 'Breadcrumb NavXT';
50
  protected $access_level = 'bcn_manage_options';
@@ -135,9 +135,8 @@ class bcn_admin extends adminKit
135
  require_once(dirname(__FILE__) . '/options_upgrade.php');
136
  bcn_options_upgrade_handler($opts, $version, $this->opt);
137
  }
138
- //Save the passed in opts to the object's option array
139
- //FIXME: Why do we do this?
140
- $this->opt = adminKit::parse_args($opts, $this->opt);
141
  }
142
  /**
143
  * help action hook function
17
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
  */
19
  require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
20
+ //Do a PHP version check, require 5.6.0 or newer
21
+ if(version_compare(phpversion(), '5.6.0', '<'))
22
  {
23
  //Only purpose of this function is to echo out the PHP version error
24
  function bcn_phpold()
25
  {
26
+ printf('<div class="notice notice-error"><p>' . __('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '</p></div>', phpversion(), '5.6.0');
27
  }
28
  //If we are in the admin, let's print a warning then return
29
  if(is_admin())
44
  */
45
  class bcn_admin extends adminKit
46
  {
47
+ const version = '7.0.1';
48
  protected $full_name = 'Breadcrumb NavXT Settings';
49
  protected $short_name = 'Breadcrumb NavXT';
50
  protected $access_level = 'bcn_manage_options';
135
  require_once(dirname(__FILE__) . '/options_upgrade.php');
136
  bcn_options_upgrade_handler($opts, $version, $this->opt);
137
  }
138
+ //Merge in the defaults
139
+ $this->opt = adminKit::parse_args($opts, adminKit::settings_to_opts($this->settings));
 
140
  }
141
  /**
142
  * help action hook function
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 = '7.0.0';
25
  //The main text that will be shown
26
  protected $title;
27
  //The breadcrumb's template, used durring assembly
21
  class bcn_breadcrumb
22
  {
23
  //Our member variables
24
+ const version = '7.0.1';
25
  //The main text that will be shown
26
  protected $title;
27
  //The breadcrumb's template, used durring assembly
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 = '7.0.0';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
21
  class bcn_breadcrumb_trail
22
  {
23
  //Our member variables
24
+ const version = '7.0.1';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
class.bcn_network_admin.php CHANGED
@@ -29,7 +29,7 @@ use mtekk\adminKit\{adminKit, form, message, setting};
29
  */
30
  class bcn_network_admin extends bcn_admin
31
  {
32
- const version = '7.0.0';
33
  protected $full_name = 'Breadcrumb NavXT Network Settings';
34
  protected $access_level = 'manage_network_options';
35
  /**
29
  */
30
  class bcn_network_admin extends bcn_admin
31
  {
32
+ const version = '7.0.1';
33
  protected $full_name = 'Breadcrumb NavXT Network Settings';
34
  protected $access_level = 'manage_network_options';
35
  /**
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 = '7.0.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 = '7.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
includes/adminKit/class-mtekk_adminkit.php CHANGED
@@ -430,7 +430,7 @@ abstract class adminKit
430
  return false;
431
  }
432
  }
433
- else if($setting->get_value() !== $setting->validate($setting->get_value()))
434
  {
435
  return false;
436
  }
@@ -462,7 +462,7 @@ abstract class adminKit
462
  $this->settings_update_loop($settings[$key], $input[$key]);
463
  }
464
  }
465
- else
466
  {
467
  $setting->maybe_update_from_form_input($input);
468
  }
@@ -533,7 +533,7 @@ abstract class adminKit
533
  {
534
  $opts[$key] = adminKit::settings_to_opts($setting);
535
  }
536
- else
537
  {
538
  $opts[$key] = $setting->get_value();
539
  }
@@ -549,7 +549,7 @@ abstract class adminKit
549
  {
550
  foreach($opts as $key => $value)
551
  {
552
- if(isset($this->settings[$key]) && $this->settings[$key] instanceof setting\setting)
553
  {
554
  $this->settings[$key]->set_value($this->settings[$key]->validate($value));
555
  }
@@ -579,18 +579,18 @@ abstract class adminKit
579
  }
580
  return -1;
581
  }
582
- if($a->get_name() === $b->get_name() && $a->get_value() === $b->get_value())
583
- {
584
- return 0;
585
- }
586
- else if($a->get_name() === $b->get_name() && $a->get_value() > $b->get_value())
587
- {
588
- return 1;
589
- }
590
- else
591
  {
592
- return -1;
 
 
 
 
 
 
 
593
  }
 
594
  }
595
  static function setting_cloner($setting)
596
  {
@@ -598,7 +598,10 @@ abstract class adminKit
598
  {
599
  return array_map('mtekk\adminKit\adminKit::setting_cloner', $setting);
600
  }
601
- return clone $setting;
 
 
 
602
  }
603
  /**
604
  * Updates the database settings from the webform
430
  return false;
431
  }
432
  }
433
+ else if($setting instanceof setting && $setting->get_value() !== $setting->validate($setting->get_value()))
434
  {
435
  return false;
436
  }
462
  $this->settings_update_loop($settings[$key], $input[$key]);
463
  }
464
  }
465
+ else if($setting instanceof setting)
466
  {
467
  $setting->maybe_update_from_form_input($input);
468
  }
533
  {
534
  $opts[$key] = adminKit::settings_to_opts($setting);
535
  }
536
+ else if($setting instanceof setting)
537
  {
538
  $opts[$key] = $setting->get_value();
539
  }
549
  {
550
  foreach($opts as $key => $value)
551
  {
552
+ if(isset($this->settings[$key]) && $this->settings[$key] instanceof setting)
553
  {
554
  $this->settings[$key]->set_value($this->settings[$key]->validate($value));
555
  }
579
  }
580
  return -1;
581
  }
582
+ if($a instanceof setting && $b instanceof setting)
 
 
 
 
 
 
 
 
583
  {
584
+ if($a->get_name() === $b->get_name() && $a->get_value() === $b->get_value())
585
+ {
586
+ return 0;
587
+ }
588
+ else if($a->get_name() === $b->get_name() && $a->get_value() > $b->get_value())
589
+ {
590
+ return 1;
591
+ }
592
  }
593
+ return -1;
594
  }
595
  static function setting_cloner($setting)
596
  {
598
  {
599
  return array_map('mtekk\adminKit\adminKit::setting_cloner', $setting);
600
  }
601
+ if($setting instanceof setting)
602
+ {
603
+ return clone $setting;
604
+ }
605
  }
606
  /**
607
  * Updates the database settings from the webform
includes/adminKit/setting/class-mtekk_adminkit_setting_absint.php CHANGED
@@ -30,7 +30,7 @@ class setting_absint extends setting_base
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
- public function __construct(string $name, int $value, string $title, bool $allow_empty = false, bool $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
+ public function __construct(string $name, int $value, string $title, $allow_empty = false, $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
includes/adminKit/setting/class-mtekk_adminkit_setting_bool.php CHANGED
@@ -30,7 +30,7 @@ class setting_bool extends setting_base
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
- public function __construct(string $name, bool $value, string $title, bool $allow_empty = false, bool $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
+ public function __construct(string $name, bool $value, string $title, $allow_empty = false, $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
includes/adminKit/setting/class-mtekk_adminkit_setting_enum.php CHANGED
@@ -31,7 +31,7 @@ class setting_enum extends setting_base
31
  *
32
  * @param string $title The display title of the setting
33
  */
34
- public function __construct(string $name, string $value, string $title, bool $allow_empty = false, bool $deprecated = false, array $allowed_vals = array())
35
  {
36
  $this->name = $name;
37
  $this->value = $value;
31
  *
32
  * @param string $title The display title of the setting
33
  */
34
+ public function __construct(string $name, string $value, string $title, $allow_empty = false, $deprecated = false, $allowed_vals = array())
35
  {
36
  $this->name = $name;
37
  $this->value = $value;
includes/adminKit/setting/class-mtekk_adminkit_setting_float.php CHANGED
@@ -30,7 +30,7 @@ class setting_float extends setting_base
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
- public function __construct(string $name, float $value, string $title, bool $allow_empty = false, bool $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
+ public function __construct(string $name, float $value, string $title, $allow_empty = false, $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
includes/adminKit/setting/class-mtekk_adminkit_setting_html.php CHANGED
@@ -30,7 +30,7 @@ class setting_html extends setting_base
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
- public function __construct(string $name, string $value, string $title, bool $allow_empty = false, bool $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
+ public function __construct(string $name, string $value, string $title, $allow_empty = false, $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
includes/adminKit/setting/class-mtekk_adminkit_setting_int.php CHANGED
@@ -30,7 +30,7 @@ class setting_int extends setting_base
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
- public function __construct(string $name, int $value, string $title, bool $allow_empty = false, bool $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
+ public function __construct(string $name, int $value, string $title, $allow_empty = false, $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
includes/adminKit/setting/class-mtekk_adminkit_setting_string.php CHANGED
@@ -30,7 +30,7 @@ class setting_string extends setting_base
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
- public function __construct(string $name, string $value, string $title, bool $allow_empty = false, bool $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
30
  *
31
  * @param string $title The display title of the setting
32
  */
33
+ public function __construct(string $name, string $value, string $title, $allow_empty = false, $deprecated = false)
34
  {
35
  $this->name = $name;
36
  $this->value = $value;
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.9
6
  Tested up to: 5.8
7
- Stable tag: 7.0.0
8
  Requires PHP: 7.0
9
  License: GPLv2 or later
10
  Adds breadcrumb navigation showing the visitor's path to their current location.
@@ -50,6 +50,16 @@ Please visit [Breadcrumb NavXT's Documentation](http://mtekk.us/code/breadcrumb-
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
 
 
 
 
53
  = 7.0.0 =
54
  Release date: December, 17th 2021
55
 
4
  Tags: breadcrumb, breadcrumbs, trail, navigation, menu, widget
5
  Requires at least: 4.9
6
  Tested up to: 5.8
7
+ Stable tag: 7.0.1
8
  Requires PHP: 7.0
9
  License: GPLv2 or later
10
  Adds breadcrumb navigation showing the visitor's path to their current location.
50
 
51
  == Changelog ==
52
 
53
+ = 7.0.1 =
54
+ Release date: December, 27th 2021
55
+
56
+ * Behavior change: Moved `bcn_settings_init` filter to before establishing default setting values. This filter is no longer capable of changing the default values of settings.
57
+ * Behavior change: Moved setup of defaults to 9000 priority, intending to cover the majority of plugins that add CPTs.
58
+ * Bug fix: Fixed compatibility issues with PHP5.6.
59
+ * Bug fix: Fixed PHP error caused by some return value of page_ settings.
60
+ * Bug fix: Fixed PHP error caused by non settings settings in array passed into `adminKit::settings_to_opts`.
61
+ * Bug fix: Fixed issue with `bcn_allowed_html` not covering admin interface elements (mapped `bcn_allowed_html` to `mtekk_adminkit_allowed_html`).
62
+
63
  = 7.0.0 =
64
  Release date: December, 17th 2021
65