Breadcrumb NavXT - Version 5.5.0

Version Description

Release date: August 12th, 2016

  • Behavior change: Internal mechanics to handle post parents as the hierarchy for a post (of any post type) has changed to use 'BCN_POST_PARENT' rather than 'page' for the taxonomy_type.
  • Behavior change: Internal mechanics to handle dates as the hierarchy for a post (of any post type) has changed to use 'BCN_DATE' rather than 'date' for the taxonomy_type.
  • Behavior change: Taxonomy term hierarchy selection logic in bcn_breadcrumb_trail::pick_post_term() has changed to picking the deepest known child of the first hierarchy found in the list of terms returned by get_the_terms() rather than the first term with a child.
  • New feature: Added support for referer influenced taxonomy selection for a post's (any post type) breadcrumb trail.
  • New feature: Added translate and lang as valid attributes for tags within breadcrumb templates.
  • New feature: Added srcset and sizes as valid attributes for img tags within breadcrumb templates.
  • New feature: Added itemprop as a valid attribute for the meta tags within breadcrumb templates.
  • Bug fix: Fixed various issues caused by other plugins/themes modifying the $post global.
  • Bug fix: Fixed issue where WPML Extensions would cause a CPT without a set root page to use the Post post type's root page.
Download this release

Release Info

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

Code changes from version 5.4.0 to 5.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: 5.4.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.4.0';
64
  protected $name = 'Breadcrumb NavXT';
65
  protected $identifier = 'breadcrumb-navxt';
66
  protected $unique_prefix = 'bcn';
@@ -129,7 +129,9 @@ class breadcrumb_navxt
129
  'xmlns:v' => true,
130
  'typeof' => true,
131
  'property' => true,
132
- 'vocab' => true
 
 
133
  ),
134
  'img' => array(
135
  'alt' => true,
@@ -137,6 +139,8 @@ class breadcrumb_navxt
137
  'height' => true,
138
  'width' => true,
139
  'src' => true,
 
 
140
  'id' => true,
141
  'class' => true,
142
  'aria-hidden' => true,
@@ -149,7 +153,8 @@ class breadcrumb_navxt
149
  'xmlns:v' => true,
150
  'typeof' => true,
151
  'property' => true,
152
- 'vocab' => true
 
153
  ),
154
  'span' => array(
155
  'title' => true,
@@ -169,7 +174,9 @@ class breadcrumb_navxt
169
  'xmlns:v' => true,
170
  'typeof' => true,
171
  'property' => true,
172
- 'vocab' => true
 
 
173
  ),
174
  'h1' => array(
175
  'title' => true,
@@ -189,7 +196,9 @@ class breadcrumb_navxt
189
  'xmlns:v' => true,
190
  'typeof' => true,
191
  'property' => true,
192
- 'vocab' => true
 
 
193
  ),
194
  'h2' => array(
195
  'title' => true,
@@ -209,12 +218,15 @@ class breadcrumb_navxt
209
  'xmlns:v' => true,
210
  'typeof' => true,
211
  'property' => true,
212
- 'vocab' => true
 
 
213
  ),
214
  'meta' => array(
215
  'content' => true,
216
  'property' => true,
217
- 'vocab' => true
 
218
  )
219
  );
220
  return mtekk_adminKit::array_merge_recursive($tags, $allowed_html);
@@ -259,6 +271,11 @@ class breadcrumb_navxt
259
  //We only want custom post types
260
  if(!$post_type->_builtin)
261
  {
 
 
 
 
 
262
  //If the post type does not have settings in the options array yet, we need to load some defaults
263
  if(!isset($opts['Hpost_' . $post_type->name . '_template']) || !$post_type->hierarchical && !isset($opts['Spost_' . $post_type->name . '_taxonomy_type']))
264
  {
@@ -296,7 +313,7 @@ class breadcrumb_navxt
296
  //If there are no valid taxonomies for this type, we default to not displaying taxonomies for this post type
297
  if(!isset($opts['Spost_' . $post_type->name . '_taxonomy_type']))
298
  {
299
- $opts['Spost_' . $post_type->name . '_taxonomy_type'] = 'date';
300
  }
301
  }
302
  }
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.5.0
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.5.0';
64
  protected $name = 'Breadcrumb NavXT';
65
  protected $identifier = 'breadcrumb-navxt';
66
  protected $unique_prefix = 'bcn';
129
  'xmlns:v' => true,
130
  'typeof' => true,
131
  'property' => true,
132
+ 'vocab' => true,
133
+ 'translate' => true,
134
+ 'lang' => true
135
  ),
136
  'img' => array(
137
  'alt' => true,
139
  'height' => true,
140
  'width' => true,
141
  'src' => true,
142
+ 'srcset' => true,
143
+ 'sizes' => true,
144
  'id' => true,
145
  'class' => true,
146
  'aria-hidden' => true,
153
  'xmlns:v' => true,
154
  'typeof' => true,
155
  'property' => true,
156
+ 'vocab' => true,
157
+ 'lang' => true
158
  ),
159
  'span' => array(
160
  'title' => true,
174
  'xmlns:v' => true,
175
  'typeof' => true,
176
  'property' => true,
177
+ 'vocab' => true,
178
+ 'translate' => true,
179
+ 'lang' => true
180
  ),
181
  'h1' => array(
182
  'title' => true,
196
  'xmlns:v' => true,
197
  'typeof' => true,
198
  'property' => true,
199
+ 'vocab' => true,
200
+ 'translate' => true,
201
+ 'lang' => true
202
  ),
203
  'h2' => array(
204
  'title' => true,
218
  'xmlns:v' => true,
219
  'typeof' => true,
220
  'property' => true,
221
+ 'vocab' => true,
222
+ 'translate' => true,
223
+ 'lang' => true
224
  ),
225
  'meta' => array(
226
  'content' => true,
227
  'property' => true,
228
+ 'vocab' => true,
229
+ 'itemprop' => true
230
  )
231
  );
232
  return mtekk_adminKit::array_merge_recursive($tags, $allowed_html);
271
  //We only want custom post types
272
  if(!$post_type->_builtin)
273
  {
274
+ if(!isset($opts['bpost_' . $post_type->name . '_taxonomy_referer']))
275
+ {
276
+ //Default to not letting the refering page influence the referer
277
+ $opts['bpost_' . $post_type->name . '_taxonomy_referer'] = false;
278
+ }
279
  //If the post type does not have settings in the options array yet, we need to load some defaults
280
  if(!isset($opts['Hpost_' . $post_type->name . '_template']) || !$post_type->hierarchical && !isset($opts['Spost_' . $post_type->name . '_taxonomy_type']))
281
  {
313
  //If there are no valid taxonomies for this type, we default to not displaying taxonomies for this post type
314
  if(!isset($opts['Spost_' . $post_type->name . '_taxonomy_type']))
315
  {
316
+ $opts['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE';
317
  }
318
  }
319
  }
class.bcn_admin.php CHANGED
@@ -42,7 +42,7 @@ if(!class_exists('mtekk_adminKit'))
42
  */
43
  class bcn_admin extends mtekk_adminKit
44
  {
45
- const version = '5.4.0';
46
  protected $full_name = 'Breadcrumb NavXT Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_options';
@@ -93,7 +93,7 @@ class bcn_admin extends mtekk_adminKit
93
  */
94
  function opts_upgrade($opts, $version)
95
  {
96
- global $wp_post_types;
97
  //If our version is not the same as in the db, time to update
98
  if(version_compare($version, $this::version, '<'))
99
  {
@@ -176,7 +176,6 @@ class bcn_admin extends mtekk_adminKit
176
  //Upgrading to 5.1.0
177
  if(version_compare($version, '5.1.0', '<'))
178
  {
179
- global $wp_taxonomies;
180
  foreach($wp_taxonomies as $taxonomy)
181
  {
182
  //If we have the old options style for it, update
@@ -219,6 +218,46 @@ class bcn_admin extends mtekk_adminKit
219
  }
220
  }
221
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  //Set the max title length to 20 if we are not limiting the title and the length was 0
223
  if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0)
224
  {
@@ -458,6 +497,7 @@ class bcn_admin extends mtekk_adminKit
458
  $this->input_text(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', 'large-text', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt'));
459
  $this->input_text(__('Post Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_post_template_no_anchor', 'large-text', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'));
460
  $this->input_check(__('Post Hierarchy Display', 'breadcrumb-navxt'), 'bpost_post_taxonomy_display', __('Show the hierarchy (specified below) leading to a post in the breadcrumb trail.', 'breadcrumb-navxt'), false, '', 'adminkit-enset-ctrl adminkit-enset');
 
461
  ?>
462
  <tr valign="top">
463
  <th scope="row">
@@ -466,10 +506,10 @@ class bcn_admin extends mtekk_adminKit
466
  <td>
467
  <?php
468
  $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories'), false, 'adminkit-enset');
469
- $this->input_radio('Spost_post_taxonomy_type', 'date', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
470
  $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags'), false, 'adminkit-enset');
471
  //We use the value 'page' but really, this will follow the parent post hierarchy
472
- $this->input_radio('Spost_post_taxonomy_type', 'page', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
473
  //Loop through all of the taxonomies in the array
474
  foreach($wp_taxonomies as $taxonomy)
475
  {
@@ -535,6 +575,7 @@ class bcn_admin extends mtekk_adminKit
535
  <?php
536
  $this->input_check(sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_archive_display', sprintf(__('Show the breadcrumb for the %s post type archives in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), !$post_type->has_archive);
537
  $this->input_check(sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_display', sprintf(__('Show the hierarchy (specified below) leading to a %s in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), false, '', 'adminkit-enset-ctrl adminkit-enset');
 
538
  ?>
539
  <tr valign="top">
540
  <th scope="row">
@@ -543,8 +584,8 @@ class bcn_admin extends mtekk_adminKit
543
  <td>
544
  <?php
545
  //We use the value 'page' but really, this will follow the parent post hierarchy
546
- $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'page', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
547
- $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'date', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
548
  //Loop through all of the taxonomies in the array
549
  foreach($wp_taxonomies as $taxonomy)
550
  {
42
  */
43
  class bcn_admin extends mtekk_adminKit
44
  {
45
+ const version = '5.5.0';
46
  protected $full_name = 'Breadcrumb NavXT Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_options';
93
  */
94
  function opts_upgrade($opts, $version)
95
  {
96
+ global $wp_post_types, $wp_taxonomies;
97
  //If our version is not the same as in the db, time to update
98
  if(version_compare($version, $this::version, '<'))
99
  {
176
  //Upgrading to 5.1.0
177
  if(version_compare($version, '5.1.0', '<'))
178
  {
 
179
  foreach($wp_taxonomies as $taxonomy)
180
  {
181
  //If we have the old options style for it, update
218
  }
219
  }
220
  }
221
+ //Upgrading to 5.5.0
222
+ if(version_compare($version, '5.5.0', '<'))
223
+ {
224
+ //Translate the old 'page' taxonomy type to BCN_POST_PARENT
225
+ if($this->opt['Spost_post_taxonomy_type'] === 'page')
226
+ {
227
+ $this->opt['Spost_post_taxonomy_type'] = 'BCN_POST_PARENT';
228
+ }
229
+ if(!isset($this->opt['Spost_post_taxonomy_referer']))
230
+ {
231
+ $this->opt['bpost_post_taxonomy_referer'] = false;
232
+ }
233
+ //Loop through all of the post types in the array
234
+ foreach($wp_post_types as $post_type)
235
+ {
236
+ //Check for non-public CPTs
237
+ if(!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name))
238
+ {
239
+ continue;
240
+ }
241
+ //We only want custom post types
242
+ if(!$post_type->_builtin)
243
+ {
244
+ //Translate the old 'page' taxonomy type to BCN_POST_PARENT
245
+ if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'page')
246
+ {
247
+ $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_POST_PARENT';
248
+ }
249
+ //Translate the old 'date' taxonomy type to BCN_DATE
250
+ if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'date')
251
+ {
252
+ $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE';
253
+ }
254
+ if(!isset($this->opt['Spost_' . $post_type->name . '_taxonomy_referer']))
255
+ {
256
+ $this->opt['bpost_' . $post_type->name . '_taxonomy_referer'] = false;
257
+ }
258
+ }
259
+ }
260
+ }
261
  //Set the max title length to 20 if we are not limiting the title and the length was 0
262
  if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0)
263
  {
497
  $this->input_text(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', 'large-text', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt'));
498
  $this->input_text(__('Post Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_post_template_no_anchor', 'large-text', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'));
499
  $this->input_check(__('Post Hierarchy Display', 'breadcrumb-navxt'), 'bpost_post_taxonomy_display', __('Show the hierarchy (specified below) leading to a post in the breadcrumb trail.', 'breadcrumb-navxt'), false, '', 'adminkit-enset-ctrl adminkit-enset');
500
+ $this->input_check(__('Post Hierarchy Referer Influence', 'breadcrumb-navxt'), 'bpost_post_taxonomy_referer', __('Allow the refereing page to influence the taxonomy selected for the hierarchy.', 'breadcrumb-navxt'), false, '', 'adminkit-enset');
501
  ?>
502
  <tr valign="top">
503
  <th scope="row">
506
  <td>
507
  <?php
508
  $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories'), false, 'adminkit-enset');
509
+ $this->input_radio('Spost_post_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
510
  $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags'), false, 'adminkit-enset');
511
  //We use the value 'page' but really, this will follow the parent post hierarchy
512
+ $this->input_radio('Spost_post_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
513
  //Loop through all of the taxonomies in the array
514
  foreach($wp_taxonomies as $taxonomy)
515
  {
575
  <?php
576
  $this->input_check(sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_archive_display', sprintf(__('Show the breadcrumb for the %s post type archives in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), !$post_type->has_archive);
577
  $this->input_check(sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_display', sprintf(__('Show the hierarchy (specified below) leading to a %s in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), false, '', 'adminkit-enset-ctrl adminkit-enset');
578
+ $this->input_check(sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_referer', __('Allow the refereing page to influence the taxonomy selected for the hierarchy.', 'breadcrumb-navxt'), false, '', 'adminkit-enset');
579
  ?>
580
  <tr valign="top">
581
  <th scope="row">
584
  <td>
585
  <?php
586
  //We use the value 'page' but really, this will follow the parent post hierarchy
587
+ $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
588
+ $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
589
  //Loop through all of the taxonomies in the array
590
  foreach($wp_taxonomies as $taxonomy)
591
  {
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 = '5.3.80';
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 = '5.5.0';
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 = '5.4.0';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
@@ -86,6 +86,8 @@ class bcn_breadcrumb_trail
86
  'apost_post_root' => get_option('page_for_posts'),
87
  //Should the trail include the taxonomy of the post
88
  'bpost_post_taxonomy_display' => true,
 
 
89
  //What taxonomy should be shown leading to the post, tag or category
90
  'Spost_post_taxonomy_type' => 'category',
91
  //Attachment settings
@@ -144,8 +146,8 @@ class bcn_breadcrumb_trail
144
  /**
145
  * Adds a breadcrumb to the breadcrumb trail
146
  *
147
- * @return pointer to the just added Breadcrumb
148
  * @param bcn_breadcrumb $object Breadcrumb to add to the trail
 
149
  */
150
  public function &add(bcn_breadcrumb $object)
151
  {
@@ -180,7 +182,7 @@ class bcn_breadcrumb_trail
180
  {
181
  if(get_query_var('author_name'))
182
  {
183
- $authordata = get_user_by('slug', get_query_var('author_name'));
184
  }
185
  else
186
  {
@@ -202,32 +204,88 @@ class bcn_breadcrumb_trail
202
  }
203
  }
204
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * This function selects the term that should be used for a post's hierarchy
207
  *
208
  * @param int $id The ID of the post to find the term for
209
  * @param string $type The post type of the post to figure out the taxonomy for
 
210
  * @return WP_Term|bool The term object to use for the post hierarchy or false if no suitable term was found
211
- *
212
- * TODO: Add logic for contextual taxonomy selection
213
  */
214
- protected function pick_post_term($id, $type)
215
  {
216
  //Fill a temporary object with the terms
217
- $bcn_object = get_the_terms($id, $this->opt['Spost_' . $type . '_taxonomy_type']);
 
218
  //Make sure we have an non-empty array
219
- if(is_array($bcn_object) && $bcn_object)
220
  {
221
- //Now find which one has a parent, pick the first one that does
222
  $bcn_use_term = key($bcn_object);
223
  foreach($bcn_object as $key => $object)
224
  {
225
- //We want the first term hiearchy
226
- if($object->parent > 0)
227
  {
228
  $bcn_use_term = $key;
229
- //We found our first term hiearchy, can exit loop now
230
- break;
231
  }
232
  }
233
  return $bcn_object[$bcn_use_term];
@@ -241,31 +299,21 @@ class bcn_breadcrumb_trail
241
  * @param int $id The id of the post to figure out the taxonomy for
242
  * @param string $type The post type of the post to figure out the taxonomy for
243
  * @param int $parent (optional) The id of the parent of the current post, used if hiearchal posts will be the "taxonomy" for the current post
244
- *
245
  */
246
  protected function post_hierarchy($id, $type, $parent = NULL)
247
  {
248
  //Check to see if breadcrumbs for the taxonomy of the post needs to be generated
249
  if($this->opt['bpost_' . $type . '_taxonomy_display'])
250
  {
 
251
  //Check if we have a date 'taxonomy' request
252
- if($this->opt['Spost_' . $type . '_taxonomy_type'] == 'date')
253
  {
254
  $this->do_archive_by_date($type);
255
  }
256
- //Handle all hierarchical taxonomies, including categories
257
- else if(is_taxonomy_hierarchical($this->opt['Spost_' . $type . '_taxonomy_type']))
258
- {
259
- //Filter the results of post_pick_term
260
- $term = apply_filters('bcn_pick_post_term', $this->pick_post_term($id, $type), $id, $type);
261
- if($term !== false)
262
- {
263
- //Fill out the term hiearchy
264
- $parent = $this->term_parents($term->term_id, $this->opt['Spost_' . $type . '_taxonomy_type']);
265
- }
266
- }
267
  //Handle the use of hierarchical posts as the 'taxonomy'
268
- else if(is_post_type_hierarchical($this->opt['Spost_' . $type . '_taxonomy_type']))
269
  {
270
  if($parent == NULL)
271
  {
@@ -281,10 +329,36 @@ class bcn_breadcrumb_trail
281
  $parent = $this->post_parents($parent, $bcn_frontpage);
282
  }
283
  }
284
- //Handle the rest of the taxonomies, including tags
285
  else
286
  {
287
- $this->post_terms($id, $this->opt['Spost_' . $type . '_taxonomy_type']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  }
289
  }
290
  //If we never got a good parent for the type_archive, make it now
@@ -386,7 +460,7 @@ class bcn_breadcrumb_trail
386
  protected function do_post($post)
387
  {
388
  //If we did not get a WP_Post object, warn developer and return early
389
- if(!is_object($post) || get_class($post) !== 'WP_Post')
390
  {
391
  _doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('$post global is not of type WP_Post', 'breadcrumb-navxt'), '5.1.1');
392
  return;
@@ -426,7 +500,7 @@ class bcn_breadcrumb_trail
426
  */
427
  protected function do_attachment()
428
  {
429
- global $post;
430
  //Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
431
  $breadcrumb = $this->add(new bcn_breadcrumb(get_the_title(), $this->opt['Hpost_attachment_template_no_anchor'], array('post', 'post-attachment', 'current-item'), NULL, $post->ID));
432
  if($this->opt['bcurrent_item_linked'])
@@ -564,7 +638,7 @@ class bcn_breadcrumb_trail
564
  */
565
  protected function do_front_page()
566
  {
567
- global $post, $current_site;
568
  //Get the site name
569
  $site_name = get_option('blogname');
570
  //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
@@ -592,7 +666,7 @@ class bcn_breadcrumb_trail
592
  */
593
  protected function do_home()
594
  {
595
- global $post, $current_site;
596
  //On everything else we need to link, but no current item (pre/suf)fixes
597
  if($this->opt['bhome_display'])
598
  {
@@ -803,21 +877,22 @@ class bcn_breadcrumb_trail
803
  else
804
  {
805
  $type_str = 'post';
 
806
  }
807
  }
808
  /**
809
  * A Breadcrumb Trail Filling Function
810
  *
811
  * Handles only the root page stuff for post types, including the "page for posts"
812
- *
813
- * TODO: this still needs to be cleaned up
814
  */
815
  protected function do_root()
816
  {
817
- global $post, $wp_query, $current_site;
818
  //If this is an attachment then we need to change the queried object to the parent post
819
  if(is_attachment())
820
  {
 
 
821
  $type = get_post($post->post_parent);
822
  //If the parent of the attachment is a page, exit early (works around bug where is_single() returns true for an attachment to a page)
823
  if($type->post_type == 'page')
@@ -834,15 +909,9 @@ class bcn_breadcrumb_trail
834
  $type_str = '';
835
  //Find our type string and root_id
836
  $this->find_type($type, $type_str, $root_id);
837
- //We only need the "blog" portion on members of the blog, and only if we're in a static frontpage environment
838
- //TODO: this is_home() may need to be $this->treat_as_root_page($type_str)
839
- if($root_id > 1 || $this->opt['bblog_display'] && get_option('show_on_front') == 'page' && (is_home() || is_single() || is_tax() || is_category() || is_tag() || is_date()))
840
  {
841
- //If we entered here with a posts page, we need to set the id
842
- if($root_id < 0)
843
- {
844
- $root_id = get_option('page_for_posts');
845
- }
846
  $frontpage_id = get_option('page_on_front');
847
  //We'll have to check if this ID is valid, e.g. user has specified a posts page
848
  if($root_id && $root_id != $frontpage_id)
@@ -911,7 +980,7 @@ class bcn_breadcrumb_trail
911
  */
912
  public function fill()
913
  {
914
- global $wpdb, $wp_query;
915
  //Check to see if the trail is already populated
916
  if(count($this->breadcrumbs) > 0)
917
  {
@@ -946,7 +1015,7 @@ class bcn_breadcrumb_trail
946
  //For all other post types
947
  else
948
  {
949
- $this->do_post($GLOBALS['post']);
950
  }
951
  }
952
  //For searches
21
  class bcn_breadcrumb_trail
22
  {
23
  //Our member variables
24
+ const version = '5.5.0';
25
  //An array of breadcrumbs
26
  public $breadcrumbs = array();
27
  public $trail = array();
86
  'apost_post_root' => get_option('page_for_posts'),
87
  //Should the trail include the taxonomy of the post
88
  'bpost_post_taxonomy_display' => true,
89
+ //Should the trail reflect the referer taxonomy or not
90
+ 'bpost_post_taxonomy_referer' => false,
91
  //What taxonomy should be shown leading to the post, tag or category
92
  'Spost_post_taxonomy_type' => 'category',
93
  //Attachment settings
146
  /**
147
  * Adds a breadcrumb to the breadcrumb trail
148
  *
 
149
  * @param bcn_breadcrumb $object Breadcrumb to add to the trail
150
+ * @return pointer to the just added Breadcrumb
151
  */
152
  public function &add(bcn_breadcrumb $object)
153
  {
182
  {
183
  if(get_query_var('author_name'))
184
  {
185
+ $authordata = get_user_by('slug', get_query_var('author_name'));
186
  }
187
  else
188
  {
204
  }
205
  }
206
  }
207
+ /**
208
+ * Determines the taxonomy name represented by the specified query var
209
+ *
210
+ * @param string $query_var The query var to attempt to find the corresponding taxonomy
211
+ * @return string|bool Either the name of the taxonomy corresponding to the query_var or false if no taxonomy exists for the specified query_var
212
+ */
213
+ protected function query_var_to_taxonomy($query_var)
214
+ {
215
+ global $wp_taxonomies;
216
+ foreach($wp_taxonomies as $taxonomy)
217
+ {
218
+ if($taxonomy->query_var === $query_var)
219
+ {
220
+ return $taxonomy->name;
221
+ }
222
+ }
223
+ return false;
224
+ }
225
+ /**
226
+ * Determines the referer taxonomy
227
+ *
228
+ * @return string|bool Either the name of the taxonomy to use or false if a referer taxonomy wasn't found
229
+ */
230
+ protected function determine_taxonomy()
231
+ {
232
+ global $wp;
233
+ //Backup the server request variable
234
+ $bk_req = $_SERVER['REQUEST_URI'];
235
+ //Now set the request URL to the referrer URL
236
+ //Could just chain the [1] selection, but that's not PHP5.3 compatible
237
+ $url_split = explode(home_url(), wp_get_referer());
238
+ if(isset($url_split[1]))
239
+ {
240
+ $_SERVER['REQUEST_URI'] = $url_split[1];
241
+ }
242
+ else
243
+ {
244
+ return false;
245
+ }
246
+ //Create our own new instance of WP, and have it parse our faux request
247
+ $bcn_wp = new WP();
248
+ //Copy over the current global wp object's query_vars since CPTs and taxonomies are added directly to the global $wp
249
+ $bcn_wp->public_query_vars = $wp->public_query_vars;
250
+ $bcn_wp->parse_request();
251
+ $_SERVER['REQUEST_URI'] = $bk_req;
252
+ if(is_array($bcn_wp->query_vars))
253
+ {
254
+ foreach($bcn_wp->query_vars as $query_var => $value)
255
+ {
256
+ if($taxonomy = $this->query_var_to_taxonomy($query_var))
257
+ {
258
+ return $taxonomy;
259
+ }
260
+ }
261
+ }
262
+ return false;
263
+ }
264
  /**
265
  * This function selects the term that should be used for a post's hierarchy
266
  *
267
  * @param int $id The ID of the post to find the term for
268
  * @param string $type The post type of the post to figure out the taxonomy for
269
+ * @param string $taxonomy The taxonomy to use
270
  * @return WP_Term|bool The term object to use for the post hierarchy or false if no suitable term was found
 
 
271
  */
272
+ protected function pick_post_term($id, $type, $taxonomy)
273
  {
274
  //Fill a temporary object with the terms
275
+ $bcn_object = get_the_terms($id, $taxonomy);
276
+ $potential_parent = 0;
277
  //Make sure we have an non-empty array
278
+ if(is_array($bcn_object))
279
  {
280
+ //Now try to find the deepest term of those that we know of
281
  $bcn_use_term = key($bcn_object);
282
  foreach($bcn_object as $key => $object)
283
  {
284
+ //Can't use the next($bcn_object) trick since order is unknown
285
+ if($object->parent > 0 && ($potential_parent === 0 || $object->parent === $potential_parent))
286
  {
287
  $bcn_use_term = $key;
288
+ $potential_parent = $object->term_id;
 
289
  }
290
  }
291
  return $bcn_object[$bcn_use_term];
299
  * @param int $id The id of the post to figure out the taxonomy for
300
  * @param string $type The post type of the post to figure out the taxonomy for
301
  * @param int $parent (optional) The id of the parent of the current post, used if hiearchal posts will be the "taxonomy" for the current post
 
302
  */
303
  protected function post_hierarchy($id, $type, $parent = NULL)
304
  {
305
  //Check to see if breadcrumbs for the taxonomy of the post needs to be generated
306
  if($this->opt['bpost_' . $type . '_taxonomy_display'])
307
  {
308
+ //TODO: Remove deprecated type selection
309
  //Check if we have a date 'taxonomy' request
310
+ if($this->opt['Spost_' . $type . '_taxonomy_type'] === 'BCN_DATE' || $this->opt['Spost_' . $type . '_taxonomy_type'] === 'date')
311
  {
312
  $this->do_archive_by_date($type);
313
  }
314
+ //TODO: Remove deprecated type selection
 
 
 
 
 
 
 
 
 
 
315
  //Handle the use of hierarchical posts as the 'taxonomy'
316
+ else if($this->opt['Spost_' . $type . '_taxonomy_type'] === 'BCN_POST_PARENT' || $this->opt['Spost_' . $type . '_taxonomy_type'] === 'page')
317
  {
318
  if($parent == NULL)
319
  {
329
  $parent = $this->post_parents($parent, $bcn_frontpage);
330
  }
331
  }
 
332
  else
333
  {
334
+ $taxonomy = $this->opt['Spost_' . $type . '_taxonomy_type'];
335
+ //Possibly let the referer influence the taxonomy used
336
+ if($this->opt['bpost_' . $type . '_taxonomy_referer'] && $referrer_taxonomy = $this->determine_taxonomy())
337
+ {
338
+ //See if there were any terms, if so, we can use the referrer influenced taxonomy
339
+ $terms = get_the_terms($id, $referrer_taxonomy);
340
+ if(is_array($terms))
341
+ {
342
+ $taxonomy = $referrer_taxonomy;
343
+ }
344
+ }
345
+ //Handle all hierarchical taxonomies, including categories
346
+ if(is_taxonomy_hierarchical($taxonomy))
347
+ {
348
+ //Filter the results of post_pick_term
349
+ $term = apply_filters('bcn_pick_post_term', $this->pick_post_term($id, $type, $taxonomy), $id, $type, $taxonomy);
350
+ //Only do something if we found a term
351
+ if($term instanceof WP_Term)
352
+ {
353
+ //Fill out the term hiearchy
354
+ $parent = $this->term_parents($term->term_id, $taxonomy);
355
+ }
356
+ }
357
+ //Handle the rest of the taxonomies, including tags
358
+ else
359
+ {
360
+ $this->post_terms($id, $taxonomy);
361
+ }
362
  }
363
  }
364
  //If we never got a good parent for the type_archive, make it now
460
  protected function do_post($post)
461
  {
462
  //If we did not get a WP_Post object, warn developer and return early
463
+ if(!($post instanceof WP_Post))
464
  {
465
  _doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('$post global is not of type WP_Post', 'breadcrumb-navxt'), '5.1.1');
466
  return;
500
  */
501
  protected function do_attachment()
502
  {
503
+ $post = get_post();
504
  //Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
505
  $breadcrumb = $this->add(new bcn_breadcrumb(get_the_title(), $this->opt['Hpost_attachment_template_no_anchor'], array('post', 'post-attachment', 'current-item'), NULL, $post->ID));
506
  if($this->opt['bcurrent_item_linked'])
638
  */
639
  protected function do_front_page()
640
  {
641
+ global $current_site;
642
  //Get the site name
643
  $site_name = get_option('blogname');
644
  //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
666
  */
667
  protected function do_home()
668
  {
669
+ global $current_site;
670
  //On everything else we need to link, but no current item (pre/suf)fixes
671
  if($this->opt['bhome_display'])
672
  {
877
  else
878
  {
879
  $type_str = 'post';
880
+ $root_id = get_option('page_for_posts');
881
  }
882
  }
883
  /**
884
  * A Breadcrumb Trail Filling Function
885
  *
886
  * Handles only the root page stuff for post types, including the "page for posts"
 
 
887
  */
888
  protected function do_root()
889
  {
890
+ global $wp_query;
891
  //If this is an attachment then we need to change the queried object to the parent post
892
  if(is_attachment())
893
  {
894
+ //Could use the $post global, but we can't really trust it
895
+ $post = get_post();
896
  $type = get_post($post->post_parent);
897
  //If the parent of the attachment is a page, exit early (works around bug where is_single() returns true for an attachment to a page)
898
  if($type->post_type == 'page')
909
  $type_str = '';
910
  //Find our type string and root_id
911
  $this->find_type($type, $type_str, $root_id);
912
+ //Continue only if we have a valid root_id
913
+ if($root_id > 1)
 
914
  {
 
 
 
 
 
915
  $frontpage_id = get_option('page_on_front');
916
  //We'll have to check if this ID is valid, e.g. user has specified a posts page
917
  if($root_id && $root_id != $frontpage_id)
980
  */
981
  public function fill()
982
  {
983
+ global $wpdb, $wp_query, $wp;
984
  //Check to see if the trail is already populated
985
  if(count($this->breadcrumbs) > 0)
986
  {
1015
  //For all other post types
1016
  else
1017
  {
1018
+ $this->do_post(get_post());
1019
  }
1020
  }
1021
  //For searches
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
- const version = '5.4.0';
46
  protected $full_name = 'Breadcrumb NavXT Network Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_network_options';
@@ -163,7 +163,7 @@ class bcn_network_admin extends mtekk_adminKit
163
  */
164
  function opts_upgrade($opts, $version)
165
  {
166
- global $wp_post_types;
167
  //If our version is not the same as in the db, time to update
168
  if(version_compare($version, $this::version, '<'))
169
  {
@@ -246,7 +246,6 @@ class bcn_network_admin extends mtekk_adminKit
246
  //Upgrading to 5.1.0
247
  if(version_compare($version, '5.1.0', '<'))
248
  {
249
- global $wp_taxonomies;
250
  foreach($wp_taxonomies as $taxonomy)
251
  {
252
  //If we have the old options style for it, update
@@ -289,6 +288,47 @@ class bcn_network_admin extends mtekk_adminKit
289
  }
290
  }
291
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  //Set the max title length to 20 if we are not limiting the title and the length was 0
293
  if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0)
294
  {
@@ -529,6 +569,7 @@ class bcn_network_admin extends mtekk_adminKit
529
  $this->input_text(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', 'large-text', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt'));
530
  $this->input_text(__('Post Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_post_template_no_anchor', 'large-text', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'));
531
  $this->input_check(__('Post Hierarchy Display', 'breadcrumb-navxt'), 'bpost_post_taxonomy_display', __('Show the hierarchy (specified below) leading to a post in the breadcrumb trail.', 'breadcrumb-navxt'), false, '', 'adminkit-enset-ctrl adminkit-enset');
 
532
  ?>
533
  <tr valign="top">
534
  <th scope="row">
@@ -537,10 +578,10 @@ class bcn_network_admin extends mtekk_adminKit
537
  <td>
538
  <?php
539
  $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories'), false, 'adminkit-enset');
540
- $this->input_radio('Spost_post_taxonomy_type', 'date', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
541
  $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags'), false, 'adminkit-enset');
542
  //We use the value 'page' but really, this will follow the parent post hierarchy
543
- $this->input_radio('Spost_post_taxonomy_type', 'page', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
544
  //Loop through all of the taxonomies in the array
545
  foreach($wp_taxonomies as $taxonomy)
546
  {
@@ -606,6 +647,7 @@ class bcn_network_admin extends mtekk_adminKit
606
  <?php
607
  $this->input_check(sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_archive_display', sprintf(__('Show the breadcrumb for the %s post type archives in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), !$post_type->has_archive);
608
  $this->input_check(sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_display', sprintf(__('Show the hierarchy (specified below) leading to a %s in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), false, '', 'adminkit-enset-ctrl adminkit-enset');
 
609
  ?>
610
  <tr valign="top">
611
  <th scope="row">
@@ -614,8 +656,8 @@ class bcn_network_admin extends mtekk_adminKit
614
  <td>
615
  <?php
616
  //We use the value 'page' but really, this will follow the parent post hierarchy
617
- $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'page', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
618
- $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'date', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
619
  //Loop through all of the taxonomies in the array
620
  foreach($wp_taxonomies as $taxonomy)
621
  {
42
  */
43
  class bcn_network_admin extends mtekk_adminKit
44
  {
45
+ const version = '5.5.0';
46
  protected $full_name = 'Breadcrumb NavXT Network Settings';
47
  protected $short_name = 'Breadcrumb NavXT';
48
  protected $access_level = 'manage_network_options';
163
  */
164
  function opts_upgrade($opts, $version)
165
  {
166
+ global $wp_post_types, $wp_taxonomies;
167
  //If our version is not the same as in the db, time to update
168
  if(version_compare($version, $this::version, '<'))
169
  {
246
  //Upgrading to 5.1.0
247
  if(version_compare($version, '5.1.0', '<'))
248
  {
 
249
  foreach($wp_taxonomies as $taxonomy)
250
  {
251
  //If we have the old options style for it, update
288
  }
289
  }
290
  }
291
+ //Upgrading to 5.5.0
292
+ if(version_compare($version, '5.5.0', '<'))
293
+ {
294
+ //Translate the old 'page' taxonomy type to BCN_POST_PARENT
295
+ if($this->opt['Spost_post_taxonomy_type'] === 'page')
296
+ {
297
+ $this->opt['Spost_post_taxonomy_type'] = 'BCN_POST_PARENT';
298
+ }
299
+ if(!isset($this->opt['Spost_post_taxonomy_referer']))
300
+ {
301
+ $this->opt['bpost_post_taxonomy_referer'] = false;
302
+ }
303
+ //Loop through all of the post types in the array
304
+ foreach($wp_post_types as $post_type)
305
+ {
306
+ //Check for non-public CPTs
307
+ if(!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name))
308
+ {
309
+ continue;
310
+ }
311
+ //We only want custom post types
312
+ if(!$post_type->_builtin)
313
+ {
314
+ //Translate the old 'page' taxonomy type to BCN_POST_PARENT
315
+ if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'page')
316
+ {
317
+ $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_POST_PARENT';
318
+ }
319
+ //Translate the old 'date' taxonomy type to BCN_DATE
320
+ if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'date')
321
+ {
322
+ $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE';
323
+ }
324
+ if(!isset($this->opt['Spost_' . $post_type->name . '_taxonomy_referer']))
325
+ {
326
+ $this->opt['bpost_' . $post_type->name . '_taxonomy_referer'] = false;
327
+ }
328
+ }
329
+ }
330
+ }
331
+ //S
332
  //Set the max title length to 20 if we are not limiting the title and the length was 0
333
  if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0)
334
  {
569
  $this->input_text(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', 'large-text', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt'));
570
  $this->input_text(__('Post Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_post_template_no_anchor', 'large-text', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'));
571
  $this->input_check(__('Post Hierarchy Display', 'breadcrumb-navxt'), 'bpost_post_taxonomy_display', __('Show the hierarchy (specified below) leading to a post in the breadcrumb trail.', 'breadcrumb-navxt'), false, '', 'adminkit-enset-ctrl adminkit-enset');
572
+ $this->input_check(__('Post Hierarchy Referer Influence', 'breadcrumb-navxt'), 'bpost_post_taxonomy_referer', __('Allow the refereing page to influence the taxonomy selected for the hierarchy.', 'breadcrumb-navxt'), false, '', 'adminkit-enset');
573
  ?>
574
  <tr valign="top">
575
  <th scope="row">
578
  <td>
579
  <?php
580
  $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories'), false, 'adminkit-enset');
581
+ $this->input_radio('Spost_post_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
582
  $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags'), false, 'adminkit-enset');
583
  //We use the value 'page' but really, this will follow the parent post hierarchy
584
+ $this->input_radio('Spost_post_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
585
  //Loop through all of the taxonomies in the array
586
  foreach($wp_taxonomies as $taxonomy)
587
  {
647
  <?php
648
  $this->input_check(sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_archive_display', sprintf(__('Show the breadcrumb for the %s post type archives in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), !$post_type->has_archive);
649
  $this->input_check(sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_display', sprintf(__('Show the hierarchy (specified below) leading to a %s in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc), false, '', 'adminkit-enset-ctrl adminkit-enset');
650
+ $this->input_check(sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_referer', __('Allow the refereing page to influence the taxonomy selected for the hierarchy.', 'breadcrumb-navxt'), false, '', 'adminkit-enset');
651
  ?>
652
  <tr valign="top">
653
  <th scope="row">
656
  <td>
657
  <?php
658
  //We use the value 'page' but really, this will follow the parent post hierarchy
659
+ $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset');
660
+ $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset');
661
  //Loop through all of the taxonomies in the array
662
  foreach($wp_taxonomies as $taxonomy)
663
  {
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 = '5.4.0';
23
  protected $defaults = array('title' => '', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false);
24
  //Default constructor
25
  function __construct()
19
  require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
20
  class bcn_widget extends WP_Widget
21
  {
22
+ const version = '5.5.0';
23
  protected $defaults = array('title' => '', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false);
24
  //Default constructor
25
  function __construct()
includes/mtekk_adminkit_engroups.js CHANGED
@@ -1,7 +1,7 @@
1
  jQuery(function()
2
  {
3
- jQuery(".adminkit-engroup input:checkbox").each(mtekk_admin_enable_group);
4
- jQuery("input:checkbox.adminkit-enset").each(mtekk_admin_enable_set);
5
  });
6
  function mtekk_admin_enable_group(){
7
  var setting = this;
@@ -33,5 +33,5 @@ function mtekk_admin_enable_set(){
33
  }
34
  });
35
  }
36
- jQuery(".adminkit-engroup input:checkbox").change(mtekk_admin_enable_group);
37
  jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);
1
  jQuery(function()
2
  {
3
+ jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_group);
4
+ jQuery("input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_set);
5
  });
6
  function mtekk_admin_enable_group(){
7
  var setting = this;
33
  }
34
  });
35
  }
36
+ jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_group);
37
  jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);
includes/mtekk_adminkit_engroups.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(){jQuery(".adminkit-engroup input:checkbox").each(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset").each(mtekk_admin_enable_set)});function mtekk_admin_enable_group(){var a=this;jQuery(this).parents(".adminkit-engroup").find("input").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}function mtekk_admin_enable_set(){var a=this;jQuery(this).parents(".adminkit-enset-top").find("input.adminkit-enset").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}jQuery(".adminkit-engroup input:checkbox").change(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);
1
+ jQuery(function(){jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_set)});function mtekk_admin_enable_group(){var a=this;jQuery(this).parents(".adminkit-engroup").find("input").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}function mtekk_admin_enable_set(){var a=this;jQuery(this).parents(".adminkit-enset-top").find("input.adminkit-enset").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);
phpunit.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <phpunit
2
+ bootstrap="tests/bootstrap.php"
3
+ backupGlobals="false"
4
+ colors="true"
5
+ convertErrorsToExceptions="true"
6
+ convertNoticesToExceptions="true"
7
+ convertWarningsToExceptions="true"
8
+ >
9
+ <testsuites>
10
+ <testsuite>
11
+ <directory prefix="test-" suffix=".php">./tests/</directory>
12
+ </testsuite>
13
+ </testsuites>
14
+ <groups>
15
+ <exclude>
16
+ <group>uninstall</group>
17
+ </exclude>
18
+ </groups>
19
+ </phpunit>
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.3
6
- Tested up to: 4.5
7
- Stable tag: 5.4.0
8
  License: GPLv2 or later
9
  Adds breadcrumb navigation showing the visitor's path to their current location.
10
 
@@ -23,7 +23,9 @@ Breadcrumb NavXT 5.1.1 and older require PHP5.2
23
  * Built in WordPress Widget.
24
  * Extensible via OOP and provided [actions](http://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/2/#action_reference "Go to the Breadcrumb NavXT Documentation's action reference.") and [filters](http://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/2/#filter_reference "Go to the Breadcrumb NavXT Documentation's filter reference.").
25
  * WPML compatible (enhanced compatibility with WPML extensions plugin).
26
- * bbPress compatible (enhanced compatibility with bbPress extension plugin).
 
 
27
 
28
  = Translations =
29
 
@@ -51,6 +53,19 @@ Please visit [Breadcrumb NavXT's Documentation](http://mtekk.us/code/breadcrumb-
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  = 5.4.0 =
55
  Release date: March 15th, 2016
56
 
@@ -172,91 +187,11 @@ Release date: November 20th, 2013
172
  * New feature: Added `xmlns:v` and `property` to the valid tag attributes.
173
  * Bug fix: The current_item breadcrumb for search results should result in a valid HTTPS link when appropriate.
174
 
175
- = 4.4.0 =
176
- Release date: June 21st, 2013
177
-
178
- * New feature: Added `bcn_breadcrumb_url` filter.
179
- * New feature: Add resource ID to the `bcn_breadcrumb_title` filter.
180
- * New feature: Added `bcn_breadcrumb_template` filter.
181
- * New feature: Added `bcn_allowed_html` filter.
182
- * New feature: Added `bcn_template_tags` filter.
183
- * Bug fix: Fixed issue where invalid characters could end up in URLs due to other plugins.
184
- * Bug fix: Revise the allowed HTML for breadcrumbs in the trail.
185
-
186
- = 4.3.0 =
187
- Release date: February 13th, 2013
188
-
189
- * Behaviour change: Home and Mainsite titles were removed.
190
- * Behaviour change: All HTML capable strings are now passed through wp_kses.
191
- * New feature: Added bcn_breadcrumb_url filter.
192
- * New feature: %title% and %htitle% now are replaced with the the "Site Title" for the home breadcrumb and the "Network Name" for mainsite breadcrumbs.
193
- * New feature: Support for the proposed Theme Hook Alliance tha_breadcrumb_navigation filter.
194
- * New feature: Added %ftitle% and %fhtitle% tags that are not affected by bcn_breadcrumb::trim().
195
- * Bug fix: Minor tweaks to the tabs in the admin page to better support the new version of jQuery UI tabs (in WordPress 3.5+).
196
- * Bug fix: Fixed issue where initial settings were not being translated due to the text domain not loading.
197
- * Bug fix: Added verbiage to clarify what the "Post Parent" selection for "Post Hierarchy" does.
198
-
199
- = 4.2.0, 2012-9-28 =
200
- Release date: September 28th, 2012
201
-
202
- * Behaviour change: Date archives are only available for the 'post' post type.
203
- * New feature: All Custom Post Types can now either use a post parent, or taxonomy based hierarchy.
204
- * New feature: Post Format archives are now supported.
205
- * New feature: Reorganized settings page with more responsive elements.
206
- * Bug fix: Widget will now display properly when told to include the paged breadcrumb on the main posts archive.
207
- * Bug fix: Using flat taxonomies as the post hierarchy no longer causes extraneous breadcrumb templates to be applied.
208
- * Bug fix: Mainsite link now works on posts and pages in multisite environments.
209
- * Bug fix: `bcn_breadcrumb::title_trim()` no longer cuts HTML encoded characters.
210
- * Bug fix: `bcn_breadcrumb::title_trim()` no longer trims the title when the title length is equal to the max length.
211
-
212
- = 4.1.0 =
213
- Release date: June 6th, 2012
214
-
215
- * Behavior change: Made the behavior of posts using flat taxonomies match the behavior of using a hierarchical taxonomy when the post is not assigned a taxonomy term.
216
- * New feature: Custom Post Types that are hierarchical can now fall back to a taxonomy if they don't have a parent.
217
- * New feature: Pretext option for the included Widget, allows 'You are here:' type messages in the widget.
218
- * Bug fix: Textdomain was changed to the correct one in the widget.
219
- * Bug fix: Textdomain was changed from 'breadcrumb_navxt' to 'breadcrumb-navxt' for improved compatibility with the new GlotPress translation flow.
220
- * Bug fix: Fixed cause of PHP warnings on empty term archive pages.
221
- * Bug fix: Fixed cause of PHP warnings on term archives restricted to a specified post type.
222
- * Bug fix: Fixed cause of PHP warnings and improper behavior on author archives if showing the page number in the breadcrumb trail.
223
-
224
- = 4.0.2, 2012-2-17 =
225
- Release date: February 17th, 2012
226
-
227
- * New feature: Estonian translation added props to Martin Orn.
228
- * New feature: Azerbaijani translation added props to Zaur Bayramov.
229
- * Bug fix: Replaced deprecated RDFa and Microformat breadcrumbs with Schema.org breadcrumbs support in the included sidebar widget.
230
- * Bug fix: Mainsite breadcrumbs are linked once again.
231
- * Bug fix: Safe default settings for CPTs and taxonomies should work now.
232
- * Bug fix: Updated translations should work, previously the old ones loaded.
233
-
234
- = 4.0.1 =
235
- Release date: January 3rd, 2012
236
-
237
- * New feature: Norwegian translations added props to Jan Rosvoldsve.
238
- * Bug fix: Fixed line 591 and line 646 errors in multisite installs.
239
- * Bug fix: Attachments will now obey the root page setting for their parent, regardless of the parent's post type.
240
-
241
- = 4.0.0 =
242
- Release date: December 14th, 2011
243
-
244
- * Behavior change: Prefix, suffix, and anchor settings have been replaced with templates for all breadcrumb types.
245
- * Behavior change: `bcn_display_nested` function was removed from the main plugin. Will appear in a supplementary plugin.
246
- * Behavior change: Import/Export/Reset tab moved under the admin bar Help menu.
247
- * Behavior change: Paged breadcrumbs are enabled in the default settings, among other subtle changes.
248
- * New feature: More useful Help menu, utilizing the new WordPress 3.3 Help menu.
249
- * New feature: True URLs are now generated for current items when link current item is enabled.
250
- * New feature: The display of the custom post type archive breadcrumb for custom post types may now be disabled.
251
- * New feature: Added in fallback functions for PHP's multibyte character string functions for environments that do not have multibyte character support.
252
- * Bug fix: Custom post type archives now respect the root page setting.
253
- * Bug fix: Custom post types without WordPress post archives enabled will no longer cause a double root page breadcrumb to be generated.
254
- * Bug fix: Tabs on the settings page are now rounded for all "modern" browsers, including Firefox, Chrome, and IE9.
255
- * Bug fix: Tabs on the settings page are now remembered between setting saves (including multiple saves from within the same tab).
256
- * Bug fix: Fixed another cause of the "The following settings were not saved" error message.
257
-
258
  == Upgrade Notice ==
259
 
 
 
 
260
  = 5.4.0 =
261
  This version requires PHP5.3 or newer. This version introduces three new filters: `bcn_post_terms`, `bcn_add_post_type_arg`, and `bcn_pick_post_term`.
262
 
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.4
6
+ Tested up to: 4.6
7
+ Stable tag: 5.5.0
8
  License: GPLv2 or later
9
  Adds breadcrumb navigation showing the visitor's path to their current location.
10
 
23
  * Built in WordPress Widget.
24
  * Extensible via OOP and provided [actions](http://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/2/#action_reference "Go to the Breadcrumb NavXT Documentation's action reference.") and [filters](http://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/2/#filter_reference "Go to the Breadcrumb NavXT Documentation's filter reference.").
25
  * WPML compatible (enhanced compatibility with WPML extensions plugin).
26
+ * Polylang compatible (enhanced compatibility with Polylang extensions plugin).
27
+ * bbPress compatible (enhanced compatibility with bbPress extensions plugin).
28
+ * BuddyPress compatible (enhanced compatibility with BuddyPress extensions plugin).
29
 
30
  = Translations =
31
 
53
 
54
  == Changelog ==
55
 
56
+ = 5.5.0 =
57
+ Release date: August 12th, 2016
58
+
59
+ * Behavior change: Internal mechanics to handle post parents as the hierarchy for a post (of any post type) has changed to use 'BCN_POST_PARENT' rather than 'page' for the taxonomy_type.
60
+ * Behavior change: Internal mechanics to handle dates as the hierarchy for a post (of any post type) has changed to use 'BCN_DATE' rather than 'date' for the taxonomy_type.
61
+ * Behavior change: Taxonomy term hierarchy selection logic in `bcn_breadcrumb_trail::pick_post_term()` has changed to picking the deepest known child of the first hierarchy found in the list of terms returned by `get_the_terms()` rather than the first term with a child.
62
+ * New feature: Added support for referer influenced taxonomy selection for a post's (any post type) breadcrumb trail.
63
+ * New feature: Added `translate` and `lang` as valid attributes for tags within breadcrumb templates.
64
+ * New feature: Added `srcset` and `sizes` as valid attributes for `img` tags within breadcrumb templates.
65
+ * New feature: Added `itemprop` as a valid attribute for the `meta` tags within breadcrumb templates.
66
+ * Bug fix: Fixed various issues caused by other plugins/themes modifying the `$post` global.
67
+ * Bug fix: Fixed issue where WPML Extensions would cause a CPT without a set root page to use the Post post type's root page.
68
+
69
  = 5.4.0 =
70
  Release date: March 15th, 2016
71
 
187
  * New feature: Added `xmlns:v` and `property` to the valid tag attributes.
188
  * Bug fix: The current_item breadcrumb for search results should result in a valid HTTPS link when appropriate.
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  == Upgrade Notice ==
191
 
192
+ = 5.5.0 =
193
+ This version requires PHP5.3 or newer. This version introduces contextually aware taxonomy selection for post hierarchies.
194
+
195
  = 5.4.0 =
196
  This version requires PHP5.3 or newer. This version introduces three new filters: `bcn_post_terms`, `bcn_add_post_type_arg`, and `bcn_pick_post_term`.
197