bcn_admin

The administrative interface class.

Defined (1)

The class is defined in the following location(s).

/class.bcn_admin.php  
  1. class bcn_admin extends mtekk_adminKit 
  2. const version = '5.6.0'; 
  3. protected $full_name = 'Breadcrumb NavXT Settings'; 
  4. protected $short_name = 'Breadcrumb NavXT'; 
  5. protected $access_level = 'manage_options'; 
  6. protected $identifier = 'breadcrumb-navxt'; 
  7. protected $unique_prefix = 'bcn'; 
  8. protected $plugin_basename = null; 
  9. protected $support_url = 'http://mtekk.us/archives/wordpress/plugins-wordpress/breadcrumb-navxt-'; 
  10. protected $breadcrumb_trail = null; 
  11. /** 
  12. * Administrative interface class default constructor 
  13. *  
  14. * @param bcn_breadcrumb_trail $breadcrumb_trail a breadcrumb trail object 
  15. * @param string $basename The basename of the plugin 
  16. */ 
  17. function __construct(bcn_breadcrumb_trail &$breadcrumb_trail, $basename) 
  18. $this->breadcrumb_trail =& $breadcrumb_trail; 
  19. $this->plugin_basename = $basename; 
  20. $this->full_name = __('Breadcrumb NavXT Settings', 'breadcrumb-navxt'); 
  21. //Grab defaults from the breadcrumb_trail object 
  22. $this->opt =& $this->breadcrumb_trail->opt; 
  23. //We're going to make sure we load the parent's constructor 
  24. parent::__construct(); 
  25. /** 
  26. * admin initialization callback function 
  27. *  
  28. * is bound to wordpress action 'admin_init' on instantiation 
  29. *  
  30. * @since 3.2.0 
  31. * @return void 
  32. */ 
  33. function init() 
  34. //We're going to make sure we run the parent's version of this function as well 
  35. parent::init(); 
  36. function wp_loaded() 
  37. parent::wp_loaded(); 
  38. breadcrumb_navxt::setup_options($this->opt); 
  39. /** 
  40. * Upgrades input options array, sets to $this->opt 
  41. *  
  42. * @param array $opts 
  43. * @param string $version the version of the passed in options 
  44. */ 
  45. function opts_upgrade($opts, $version) 
  46. global $wp_post_types, $wp_taxonomies; 
  47. //If our version is not the same as in the db, time to update 
  48. if(version_compare($version, $this::version, '<')) 
  49. //Upgrading to 3.8.1 
  50. if(version_compare($version, '3.8.1', '<')) 
  51. $opts['post_page_root'] = get_option('page_on_front'); 
  52. $opts['post_post_root'] = get_option('page_for_posts'); 
  53. //Upgrading to 4.0 
  54. if(version_compare($version, '4.0.0', '<')) 
  55. //Only migrate if we haven't migrated yet 
  56. if(isset($opts['current_item_linked'])) 
  57. //Loop through the old options, migrate some of them 
  58. foreach($opts as $option => $value) 
  59. //Handle all of our boolean options first, they're real easy, just add a 'b' 
  60. if(strpos($option, 'display') > 0 || $option == 'current_item_linked') 
  61. $this->breadcrumb_trail->opt['b' . $option] = $value; 
  62. //Handle migration of anchor templates to the templates 
  63. else if(strpos($option, 'anchor') > 0) 
  64. $parts = explode('_', $option); 
  65. //Do excess slash removal sanitation 
  66. $this->breadcrumb_trail->opt['H' . $parts[0] . '_template'] = $value . '%htitle%</a>'; 
  67. //Handle our abs integers 
  68. else if($option == 'max_title_length' || $option == 'post_post_root' || $option == 'post_page_root') 
  69. $this->breadcrumb_trail->opt['a' . $option] = $value; 
  70. //Now everything else, minus prefix and suffix 
  71. else if(strpos($option, 'prefix') === false && strpos($option, 'suffix') === false) 
  72. $this->breadcrumb_trail->opt['S' . $option] = $value; 
  73. //Add in the new settings for CPTs introduced in 4.0 
  74. foreach($wp_post_types as $post_type) 
  75. //We only want custom post types 
  76. if(!$post_type->_builtin) 
  77. //Add in the archive_display option 
  78. $this->breadcrumb_trail->opt['bpost_' . $post_type->name . '_archive_display'] = $post_type->has_archive; 
  79. $opts = $this->breadcrumb_trail->opt; 
  80. if(version_compare($version, '4.0.1', '<')) 
  81. if(isset($opts['Hcurrent_item_template_no_anchor'])) 
  82. unset($opts['Hcurrent_item_template_no_anchor']); 
  83. if(isset($opts['Hcurrent_item_template'])) 
  84. unset($opts['Hcurrent_item_template']); 
  85. //Upgrading to 4.3.0 
  86. if(version_compare($version, '4.3.0', '<')) 
  87. //Removed home_title 
  88. if(isset($opts['Shome_title'])) 
  89. unset($opts['Shome_title']); 
  90. //Removed mainsite_title 
  91. if(isset($opts['Smainsite_title'])) 
  92. unset($opts['Smainsite_title']); 
  93. //Upgrading to 5.1.0 
  94. if(version_compare($version, '5.1.0', '<')) 
  95. foreach($wp_taxonomies as $taxonomy) 
  96. //If we have the old options style for it, update 
  97. if($taxonomy->name !== 'post_format' && isset($opts['H' . $taxonomy->name . '_template'])) 
  98. //Migrate to the new setting name 
  99. $opts['Htax_' . $taxonomy->name . '_template'] = $opts['H' . $taxonomy->name . '_template']; 
  100. $opts['Htax_' . $taxonomy->name . '_template_no_anchor'] = $opts['H' . $taxonomy->name . '_template_no_anchor']; 
  101. //Clean up old settings 
  102. unset($opts['H' . $taxonomy->name . '_template']); 
  103. unset($opts['H' . $taxonomy->name . '_template_no_anchor']); 
  104. //Upgrading to 5.4.0 
  105. if(version_compare($version, '5.4.0', '<')) 
  106. //Migrate users to schema.org breadcrumbs for author and search if still on the defaults for posts 
  107. if($opts['Hpost_post_template'] === bcn_breadcrumb::get_default_template() && $opts['Hpost_post_template_no_anchor'] === bcn_breadcrumb::default_template_no_anchor) 
  108. if($opts['Hpaged_template'] === 'Page %htitle%') 
  109. $opts['Hpaged_template'] = $this->opt['Hpaged_template']; 
  110. if($opts['Hsearch_template'] === 'Search results for '<a title="Go to the first page of search results for %title%." href="%link%" class="%type%">%htitle%</a>'' || $opts['Hsearch_template'] === 'Search results for '<a title="Go to the first page of search results for %title%." href="%link%" class="%type%">%htitle%</a>'') 
  111. $opts['Hsearch_template'] = $this->opt['Hsearch_template']; 
  112. if($opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'' || $opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'') 
  113. $opts['Hsearch_template_no_anchor'] = $this->opt['Hsearch_template_no_anchor']; 
  114. if($opts['Hauthor_template'] === 'Articles by: <a title="Go to the first page of posts by %title%." href="%link%" class="%type%">%htitle%</a>') 
  115. $opts['Hauthor_template'] = $this->opt['Hauthor_template']; 
  116. if($opts['Hauthor_template_no_anchor'] === 'Articles by: %htitle%') 
  117. $opts['Hauthor_template_no_anchor'] = $this->opt['Hauthor_template_no_anchor']; 
  118. //Upgrading to 5.5.0 
  119. if(version_compare($version, '5.5.0', '<')) 
  120. //Translate the old 'page' taxonomy type to BCN_POST_PARENT 
  121. if($this->opt['Spost_post_taxonomy_type'] === 'page') 
  122. $this->opt['Spost_post_taxonomy_type'] = 'BCN_POST_PARENT'; 
  123. if(!isset($this->opt['Spost_post_taxonomy_referer'])) 
  124. $this->opt['bpost_post_taxonomy_referer'] = false; 
  125. //Loop through all of the post types in the array 
  126. foreach($wp_post_types as $post_type) 
  127. //Check for non-public CPTs 
  128. if(!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name)) 
  129. continue; 
  130. //We only want custom post types 
  131. if(!$post_type->_builtin) 
  132. //Translate the old 'page' taxonomy type to BCN_POST_PARENT 
  133. if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'page') 
  134. $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_POST_PARENT'; 
  135. //Translate the old 'date' taxonomy type to BCN_DATE 
  136. if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'date') 
  137. $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE'; 
  138. if(!isset($this->opt['Spost_' . $post_type->name . '_taxonomy_referer'])) 
  139. $this->opt['bpost_' . $post_type->name . '_taxonomy_referer'] = false; 
  140. //Set the max title length to 20 if we are not limiting the title and the length was 0 
  141. if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0) 
  142. $opts['amax_title_length'] = 20; 
  143. //Save the passed in opts to the object's option array 
  144. $this->opt = $opts; 
  145. //End with resetting up the options 
  146. breadcrumb_navxt::setup_options($this->opt); 
  147. function opts_update_prebk(&$opts) 
  148. //This may no longer be needed 
  149. breadcrumb_navxt::setup_options($opts); 
  150. $opts = apply_filters('bcn_opts_update_prebk', $opts); 
  151. /** 
  152. * help action hook function 
  153. *  
  154. * @return string 
  155. *  
  156. */ 
  157. function help() 
  158. $screen = get_current_screen(); 
  159. //Exit early if the add_help_tab function doesn't exist 
  160. if(!method_exists($screen, 'add_help_tab')) 
  161. return; 
  162. //Add contextual help on current screen 
  163. if($screen->id == 'settings_page_' . $this->identifier) 
  164. $general_tab = '<p>' . __('Tips for the settings are located below select options.', 'breadcrumb-navxt') . 
  165. '</p><h5>' . __('Resources', 'breadcrumb-navxt') . '</h5><ul><li>' . 
  166. sprintf(__("%sTutorials and How Tos%s: There are several guides, tutorials, and how tos available on the author's website.", 'breadcrumb-navxt'), '<a title="' . __('Go to the Breadcrumb NavXT tag archive.', 'breadcrumb-navxt') . '" href="https://mtekk.us/archives/tag/breadcrumb-navxt">', '</a>') . '</li><li>' . 
  167. sprintf(__('%sOnline Documentation%s: Check out the documentation for more indepth technical information.', 'breadcrumb-navxt'), '<a title="' . __('Go to the Breadcrumb NavXT online documentation', 'breadcrumb-navxt') . '" href="https://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/">', '</a>') . '</li><li>' . 
  168. sprintf(__('%sReport a Bug%s: If you think you have found a bug, please include your WordPress version and details on how to reproduce the bug.', 'breadcrumb-navxt'), '<a title="' . __('Go to the Breadcrumb NavXT support post for your version.', 'breadcrumb-navxt') . '" href="https://mtekk.us/archives/wordpress/plugins-wordpress/breadcrumb-navxt-' . $this::version . '/#respond">', '</a>') . '</li></ul>' .  
  169. '<h5>' . __('Giving Back', 'breadcrumb-navxt') . '</h5><ul><li>' . 
  170. sprintf(__('%sDonate%s: Love Breadcrumb NavXT and want to help development? Consider buying the author a beer.', 'breadcrumb-navxt'), '<a title="' . __('Go to PayPal to give a donation to Breadcrumb NavXT.', 'breadcrumb-navxt') . '" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FD5XEU783BR8U&lc=US&item_name=Breadcrumb%20NavXT%20Donation¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">', '</a>') . '</li><li>' . 
  171. sprintf(__('%sTranslate%s: Is your language not available? Visit the Breadcrumb NavXT translation project on WordPress.org to start translating.', 'breadcrumb-navxt'), '<a title="' . __('Go to the Breadcrumb NavXT translation project.', 'breadcrumb-navxt') . '" href="https://translate.wordpress.org/projects/wp-plugins/breadcrumb-navxt">', '</a>') . '</li></ul>'; 
  172.  
  173. $screen->add_help_tab( 
  174. array( 
  175. 'id' => $this->identifier . '-base',  
  176. 'title' => __('General', 'breadcrumb-navxt'),  
  177. 'content' => $general_tab 
  178. )); 
  179. $quickstart_tab = '<p>' . __('For the settings on this page to take effect, you must either use the included Breadcrumb NavXT widget, or place either of the code sections below into your theme.', 'breadcrumb-navxt') . 
  180. '</p><h5>' . __('Breadcrumb trail with separators', 'breadcrumb-navxt') . '</h5><pre><code><div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">' . " 
  181. <?php if(function_exists('bcn_display')) 
  182. bcn_display(); 
  183. }?> 
  184. </div></code></pre>" . 
  185. '<h5>' . __('Breadcrumb trail in list form', 'breadcrumb-navxt').'</h5><pre><code><ol class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">'." 
  186. <?php if(function_exists('bcn_display_list')) 
  187. bcn_display_list(); 
  188. }?> 
  189. </ol></code></pre>"; 
  190. $screen->add_help_tab( 
  191. array( 
  192. 'id' => $this->identifier . '-quick-start',  
  193. 'title' => __('Quick Start', 'breadcrumb-navxt'),  
  194. 'content' => $quickstart_tab 
  195. )); 
  196. $styling_tab = '<p>' . __('Using the code from the Quick Start section above, the following CSS can be used as base for styling your breadcrumb trail.', 'breadcrumb-navxt') . '</p>' . 
  197. '<pre><code>.breadcrumbs 
  198. font-size: 1.1em; 
  199. color: #fff; 
  200. margin: 30px 0 0 10px; 
  201. position: relative; 
  202. float: left; 
  203. }</code></pre>'; 
  204. $screen->add_help_tab( 
  205. array( 
  206. 'id' => $this->identifier . '-styling',  
  207. 'title' => __('Styling', 'breadcrumb-navxt'),  
  208. 'content' => $styling_tab 
  209. )); 
  210. $screen->add_help_tab( 
  211. array( 
  212. 'id' => $this->identifier . '-import-export-reset',  
  213. 'title' => __('Import/Export/Reset', 'breadcrumb-navxt'),  
  214. 'content' => $this->import_form() 
  215. )); 
  216. /** 
  217. * enqueue's the tab style sheet on the settings page 
  218. */ 
  219. function admin_styles() 
  220. wp_enqueue_style('mtekk_adminkit_tabs'); 
  221. /** 
  222. * enqueue's the tab js and translation js on the settings page 
  223. */ 
  224. function admin_scripts() 
  225. //Enqueue ui-tabs 
  226. wp_enqueue_script('jquery-ui-tabs'); 
  227. //Enqueue the admin tabs javascript 
  228. wp_enqueue_script('mtekk_adminkit_tabs'); 
  229. //Load the translations for the tabs 
  230. wp_localize_script('mtekk_adminkit_tabs', 'objectL10n', array( 
  231. 'mtad_uid' => 'bcn_admin',  
  232. 'mtad_import' => __('Import', 'breadcrumb-navxt'),  
  233. 'mtad_export' => __('Export', 'breadcrumb-navxt'),  
  234. 'mtad_reset' => __('Reset', 'breadcrumb-navxt'),  
  235. )); 
  236. //Enqueue the admin enable/disable groups javascript 
  237. wp_enqueue_script('mtekk_adminkit_engroups'); 
  238. /** 
  239. * A message function that checks for the BCN_SETTINGS_* define statement 
  240. */ 
  241. function multisite_settings_warn() 
  242. if(is_multisite()) 
  243. if(defined('BCN_SETTINGS_USE_LOCAL') && BCN_SETTINGS_USE_LOCAL) 
  244.  
  245. else if(defined('BCN_SETTINGS_USE_NETWORK') && BCN_SETTINGS_USE_NETWORK) 
  246. $this->message['updated fade'][] = __('Warning: Your network settings will override any settings set in this page.', 'breadcrumb-navxt'); 
  247. else if(defined('BCN_SETTINGS_FAVOR_LOCAL') && BCN_SETTINGS_FAVOR_LOCAL) 
  248. $this->message['updated fade'][] = __('Warning: Your network settings may override any settings set in this page.', 'breadcrumb-navxt'); 
  249. else if(defined('BCN_SETTINGS_FAVOR_NETWORK') && BCN_SETTINGS_FAVOR_NETWORK) 
  250. $this->message['updated fade'][] = __('Warning: Your network settings may override any settings set in this page.', 'breadcrumb-navxt'); 
  251. //Fall through if no settings mode was set 
  252. else 
  253. $this->message['updated fade'][] = __('Warning: No BCN_SETTINGS_* define statement found, defaulting to BCN_SETTINGS_USE_LOCAL.', 'breadcrumb-navxt'); 
  254. /** 
  255. * A message function that checks for deprecated settings that are set and warns the user 
  256. */ 
  257. function deprecated_settings_warn() 
  258. //We're deprecating the limit title length setting, let the user know the new method of accomplishing this 
  259. if(isset($this->opt['blimit_title']) && $this->opt['blimit_title']) 
  260. $this->message['updated fade'][] = sprintf(__('Warning: Your are using a deprecated setting "Title Length" (see Miscellaneous > Deprecated), please %1$suse CSS instead%2$s.', 'breadcrumb-navxt'), '<a title="' . __('Go to the guide on trimming breadcrumb title lengths with CSS', 'breadcrumb-navxt') . '" href="https://mtekk.us/archives/guides/trimming-breadcrumb-title-lengths-with-css/">', '</a>'); 
  261. /** 
  262. * The administrative page for Breadcrumb NavXT 
  263. */ 
  264. function admin_page() 
  265. global $wp_taxonomies, $wp_post_types; 
  266. $this->security(); 
  267. //Do a check on deprecated settings 
  268. $this->deprecated_settings_warn(); 
  269. //Do a check for multisite settings mode 
  270. $this->multisite_settings_warn(); 
  271. do_action($this->unique_prefix . '_settings_pre_messages', $this->opt); 
  272. //Display our messages 
  273. $this->messages(); 
  274. ?> 
  275. <div class="wrap"><h2><?php echo $this->full_name; ?></h2> 
  276. <?php 
  277. //We exit after the version check if there is an action the user needs to take before saving settings 
  278. if(!$this->version_check(get_option($this->unique_prefix . '_version'))) 
  279. return; 
  280. ?> 
  281. <form action="<?php echo $this->admin_url(); ?>" method="post" id="bcn_admin-options"> 
  282. <?php settings_fields('bcn_options');?> 
  283. <div id="hasadmintabs"> 
  284. <fieldset id="general" class="bcn_options"> 
  285. <h3 class="tab-title" title="<?php _e('A collection of settings most likely to be modified are located under this tab.', 'breadcrumb-navxt');?>"><?php _e('General', 'breadcrumb-navxt'); ?></h3> 
  286. <h3><?php _e('General', 'breadcrumb-navxt'); ?></h3> 
  287. <table class="form-table"> 
  288. <?php 
  289. $this->input_text(__('Breadcrumb Separator', 'breadcrumb-navxt'), 'hseparator', 'regular-text', false, __('Placed in between each breadcrumb.', 'breadcrumb-navxt')); 
  290. do_action($this->unique_prefix . '_settings_general', $this->opt); 
  291. ?> 
  292. </table> 
  293. <h3><?php _e('Current Item', 'breadcrumb-navxt'); ?></h3> 
  294. <table class="form-table"> 
  295. <?php 
  296. $this->input_check(__('Link Current Item', 'breadcrumb-navxt'), 'bcurrent_item_linked', __('Yes', 'breadcrumb-navxt')); 
  297. $this->input_check(_x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'), 'bpaged_display', __('Place the page number breadcrumb in the trail.', 'breadcrumb-navxt'), false, __('Indicates that the user is on a page other than the first of a paginated archive or post.', 'breadcrumb-navxt')); 
  298. $this->input_text(_x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt'), 'Hpaged_template', 'large-text', false, __('The template for paged breadcrumbs.', 'breadcrumb-navxt')); 
  299. do_action($this->unique_prefix . '_settings_current_item', $this->opt); 
  300. ?> 
  301. </table> 
  302. <h3><?php _e('Home Breadcrumb', 'breadcrumb-navxt'); ?></h3> 
  303. <table class="form-table adminkit-engroup"> 
  304. <?php  
  305. $this->input_check(__('Home Breadcrumb', 'breadcrumb-navxt'), 'bhome_display', __('Place the home breadcrumb in the trail.', 'breadcrumb-navxt')); 
  306. $this->textbox(__('Home Template', 'breadcrumb-navxt'), 'Hhome_template', '6', false, __('The template for the home breadcrumb.', 'breadcrumb-navxt')); 
  307. $this->textbox(__('Home Template (Unlinked)', 'breadcrumb-navxt'), 'Hhome_template_no_anchor', '4', false, __('The template for the home breadcrumb, used when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  308. do_action($this->unique_prefix . '_settings_home', $this->opt); 
  309. ?> 
  310. </table> 
  311. <h3><?php _e('Blog Breadcrumb', 'breadcrumb-navxt'); ?></h3> 
  312. <table class="form-table adminkit-engroup"> 
  313. <?php 
  314. $this->input_check(__('Blog Breadcrumb', 'breadcrumb-navxt'), 'bblog_display', __('Place the blog breadcrumb in the trail.', 'breadcrumb-navxt'), (get_option('show_on_front') !== 'page' || get_option('page_for_posts') < 1)); 
  315. $this->textbox(__('Blog Template', 'breadcrumb-navxt'), 'Hblog_template', '6', (get_option('show_on_front') !== 'page' || get_option('page_for_posts') < 1), __('The template for the blog breadcrumb, used only in static front page environments.', 'breadcrumb-navxt')); 
  316. $this->textbox(__('Blog Template (Unlinked)', 'breadcrumb-navxt'), 'Hblog_template_no_anchor', '4', (get_option('show_on_front') !== 'page' || get_option('page_for_posts') < 1), __('The template for the blog breadcrumb, used only in static front page environments and when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  317. do_action($this->unique_prefix . '_settings_blog', $this->opt); 
  318. ?> 
  319. </table> 
  320. <h3><?php _e('Mainsite Breadcrumb', 'breadcrumb-navxt'); ?></h3> 
  321. <table class="form-table adminkit-engroup"> 
  322. <?php 
  323. $this->input_check(__('Main Site Breadcrumb', 'breadcrumb-navxt'), 'bmainsite_display', __('Place the main site home breadcrumb in the trail in an multisite setup.', 'breadcrumb-navxt'), !is_multisite()); 
  324. $this->textbox(__('Main Site Home Template', 'breadcrumb-navxt'), 'Hmainsite_template', '6', !is_multisite(), __('The template for the main site home breadcrumb, used only in multisite environments.', 'breadcrumb-navxt')); 
  325. $this->textbox(__('Main Site Home Template (Unlinked)', 'breadcrumb-navxt'), 'Hmainsite_template_no_anchor', '4', !is_multisite(), __('The template for the main site home breadcrumb, used only in multisite environments and when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  326. do_action($this->unique_prefix . '_settings_mainsite', $this->opt); 
  327. ?> 
  328. </table> 
  329. <?php do_action($this->unique_prefix . '_after_settings_tab_general', $this->opt); ?> 
  330. </fieldset> 
  331. <fieldset id="post" class="bcn_options"> 
  332. <h3 class="tab-title" title="<?php _e('The settings for all post types (Posts, Pages, and Custom Post Types) are located under this tab.', 'breadcrumb-navxt');?>"><?php _e('Post Types', 'breadcrumb-navxt'); ?></h3> 
  333. <h3><?php _e('Posts', 'breadcrumb-navxt'); ?></h3> 
  334. <table class="form-table adminkit-enset-top"> 
  335. <?php 
  336. $this->textbox(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', '6', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt')); 
  337. $this->textbox(__('Post Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_post_template_no_anchor', '4', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  338. $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'); 
  339. $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'); 
  340. ?> 
  341. <tr valign="top"> 
  342. <th scope="row"> 
  343. <?php _e('Post Hierarchy', 'breadcrumb-navxt'); ?> 
  344. </th> 
  345. <td> 
  346. <?php 
  347. $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories'), false, 'adminkit-enset'); 
  348. $this->input_radio('Spost_post_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  349. $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags'), false, 'adminkit-enset'); 
  350. //We use the value 'page' but really, this will follow the parent post hierarchy 
  351. $this->input_radio('Spost_post_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  352. //Loop through all of the taxonomies in the array 
  353. foreach($wp_taxonomies as $taxonomy) 
  354. //Check for non-public taxonomies 
  355. if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) 
  356. continue; 
  357. //We only want custom taxonomies 
  358. if(($taxonomy->object_type == 'post' || is_array($taxonomy->object_type) && in_array('post', $taxonomy->object_type)) && !$taxonomy->_builtin) 
  359. $this->input_radio('Spost_post_taxonomy_type', $taxonomy->name, mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'), false, 'adminkit-enset'); 
  360. ?> 
  361. <p class="description"><?php _e('The hierarchy which the breadcrumb trail will show. Note that the "Post Parent" option may require an additional plugin to behave as expected since this is a non-hierarchical post type.', 'breadcrumb-navxt'); ?></p> 
  362. </td> 
  363. </tr> 
  364. </table> 
  365. <h3><?php _e('Pages', 'breadcrumb-navxt'); ?></h3> 
  366. <table class="form-table"> 
  367. <?php 
  368. $this->textbox(__('Page Template', 'breadcrumb-navxt'), 'Hpost_page_template', '6', false, __('The template for page breadcrumbs.', 'breadcrumb-navxt')); 
  369. $this->textbox(__('Page Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_page_template_no_anchor', '4', false, __('The template for page breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  370. ?> 
  371. </table> 
  372. <h3><?php _e('Attachments', 'breadcrumb-navxt'); ?></h3> 
  373. <table class="form-table"> 
  374. <?php 
  375. $this->textbox(__('Attachment Template', 'breadcrumb-navxt'), 'Hpost_attachment_template', '6', false, __('The template for attachment breadcrumbs.', 'breadcrumb-navxt')); 
  376. $this->textbox(__('Attachment Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_attachment_template_no_anchor', '4', false, __('The template for attachment breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  377. ?> 
  378. </table> 
  379. <?php 
  380. //Loop through all of the post types in the array 
  381. foreach($wp_post_types as $post_type) 
  382. //Check for non-public CPTs 
  383. if(!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name)) 
  384. continue; 
  385. //We only want custom post types 
  386. if(!$post_type->_builtin) 
  387. $singular_name_lc = mb_strtolower($post_type->labels->singular_name, 'UTF-8'); 
  388. ?> 
  389. <h3><?php echo $post_type->labels->singular_name; ?></h3> 
  390. <table class="form-table adminkit-enset-top"> 
  391. <?php 
  392. $this->textbox(sprintf(__('%s Template', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template', '6', false, sprintf(__('The template for %s breadcrumbs.', 'breadcrumb-navxt'), $singular_name_lc)); 
  393. $this->textbox(sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template_no_anchor', '4', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'), $singular_name_lc)); 
  394. $optid = $this->get_valid_id('apost_' . $post_type->name . '_root'); 
  395. ?> 
  396. <tr valign="top"> 
  397. <th scope="row"> 
  398. <label for="<?php echo $optid;?>"><?php printf(__('%s Root Page', 'breadcrumb-navxt'), $post_type->labels->singular_name);?></label> 
  399. </th> 
  400. <td> 
  401. <?php wp_dropdown_pages(array('name' => $this->unique_prefix . '_options[apost_' . $post_type->name . '_root]', 'id' => $optid, 'echo' => 1, 'show_option_none' => __( '— Select —' ), 'option_none_value' => '0', 'selected' => $this->opt['apost_' . $post_type->name . '_root']));?> 
  402. </td> 
  403. </tr> 
  404. <?php 
  405. $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); 
  406. $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'); 
  407. $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'); 
  408. ?> 
  409. <tr valign="top"> 
  410. <th scope="row"> 
  411. <?php printf(__('%s Hierarchy', 'breadcrumb-navxt'), $post_type->labels->singular_name); ?> 
  412. </th> 
  413. <td> 
  414. <?php 
  415. //We use the value 'page' but really, this will follow the parent post hierarchy 
  416. $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  417. $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  418. //Loop through all of the taxonomies in the array 
  419. foreach($wp_taxonomies as $taxonomy) 
  420. //Check for non-public taxonomies 
  421. if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) 
  422. continue; 
  423. //We only want custom taxonomies 
  424. if($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type)) 
  425. $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', $taxonomy->name, $taxonomy->labels->singular_name, false, 'adminkit-enset'); 
  426. ?> 
  427. <p class="description"> 
  428. <?php 
  429. if($post_type->hierarchical) 
  430. _e('The hierarchy which the breadcrumb trail will show.', 'breadcrumb-navxt');  
  431. else 
  432. _e('The hierarchy which the breadcrumb trail will show. Note that the "Post Parent" option may require an additional plugin to behave as expected since this is a non-hierarchical post type.', 'breadcrumb-navxt'); 
  433. ?> 
  434. </p> 
  435. </td> 
  436. </tr> 
  437. </table> 
  438. <?php 
  439. do_action($this->unique_prefix . '_after_settings_tab_post', $this->opt); 
  440. ?> 
  441. </fieldset> 
  442. <fieldset id="tax" class="bcn_options alttab"> 
  443. <h3 class="tab-title" title="<?php _e('The settings for all taxonomies (including Categories, Tags, and custom taxonomies) are located under this tab.', 'breadcrumb-navxt');?>"><?php _e('Taxonomies', 'breadcrumb-navxt'); ?></h3> 
  444. <h3><?php _e('Categories', 'breadcrumb-navxt'); ?></h3> 
  445. <table class="form-table"> 
  446. <?php 
  447. $this->textbox(__('Category Template', 'breadcrumb-navxt'), 'Htax_category_template', '6', false, __('The template for category breadcrumbs.', 'breadcrumb-navxt')); 
  448. $this->textbox(__('Category Template (Unlinked)', 'breadcrumb-navxt'), 'Htax_category_template_no_anchor', '4', false, __('The template for category breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  449. ?> 
  450. </table> 
  451. <h3><?php _e('Tags', 'breadcrumb-navxt'); ?></h3> 
  452. <table class="form-table"> 
  453. <?php 
  454. $this->textbox(__('Tag Template', 'breadcrumb-navxt'), 'Htax_post_tag_template', '6', false, __('The template for tag breadcrumbs.', 'breadcrumb-navxt')); 
  455. $this->textbox(__('Tag Template (Unlinked)', 'breadcrumb-navxt'), 'Htax_post_tag_template_no_anchor', '4', false, __('The template for tag breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  456. ?> 
  457. </table> 
  458. <h3><?php _e('Post Formats', 'breadcrumb-navxt'); ?></h3> 
  459. <table class="form-table"> 
  460. <?php 
  461. $this->textbox(__('Post Format Template', 'breadcrumb-navxt'), 'Htax_post_format_template', '6', false, __('The template for post format breadcrumbs.', 'breadcrumb-navxt')); 
  462. $this->textbox(__('Post Format Template (Unlinked)', 'breadcrumb-navxt'), 'Htax_post_format_template_no_anchor', '4', false, __('The template for post_format breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  463. ?> 
  464. </table> 
  465. <?php 
  466. //Loop through all of the taxonomies in the array 
  467. foreach($wp_taxonomies as $taxonomy) 
  468. //Check for non-public taxonomies 
  469. if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) 
  470. continue; 
  471. //We only want custom taxonomies 
  472. if(!$taxonomy->_builtin) 
  473. $label_lc = mb_strtolower($taxonomy->label, 'UTF-8'); 
  474. ?> 
  475. <h3><?php echo mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'); ?></h3> 
  476. <table class="form-table"> 
  477. <?php 
  478. $this->textbox(sprintf(__('%s Template', 'breadcrumb-navxt'), $taxonomy->labels->singular_name), 'Htax_' . $taxonomy->name . '_template', '6', false, sprintf(__('The template for %s breadcrumbs.', 'breadcrumb-navxt'), $label_lc)); 
  479. $this->textbox(sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $taxonomy->labels->singular_name), 'Htax_' . $taxonomy->name . '_template_no_anchor', '4', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'), $label_lc)); 
  480. ?> 
  481. </table> 
  482. <?php 
  483. do_action($this->unique_prefix . '_after_settings_tab_taxonomy', $this->opt); ?> 
  484. </fieldset> 
  485. <fieldset id="miscellaneous" class="bcn_options"> 
  486. <h3 class="tab-title" title="<?php _e('The settings for author and date archives, searches, and 404 pages are located under this tab.', 'breadcrumb-navxt');?>"><?php _e('Miscellaneous', 'breadcrumb-navxt'); ?></h3> 
  487. <h3><?php _e('Author Archives', 'breadcrumb-navxt'); ?></h3> 
  488. <table class="form-table"> 
  489. <?php 
  490. $this->textbox(__('Author Template', 'breadcrumb-navxt'), 'Hauthor_template', '6', false, __('The template for author breadcrumbs.', 'breadcrumb-navxt')); 
  491. $this->textbox(__('Author Template (Unlinked)', 'breadcrumb-navxt'), 'Hauthor_template_no_anchor', '4', false, __('The template for author breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  492. $this->input_select(__('Author Display Format', 'breadcrumb-navxt'), 'Sauthor_name', array("display_name", "nickname", "first_name", "last_name"), false, __('display_name uses the name specified in "Display name publicly as" under the user profile the others correspond to options in the user profile.', 'breadcrumb-navxt')); 
  493. ?> 
  494. </table> 
  495. <h3><?php _e('Miscellaneous', 'breadcrumb-navxt'); ?></h3> 
  496. <table class="form-table"> 
  497. <?php 
  498. $this->textbox(__('Date Template', 'breadcrumb-navxt'), 'Hdate_template', '6', false, __('The template for date breadcrumbs.', 'breadcrumb-navxt')); 
  499. $this->textbox(__('Date Template (Unlinked)', 'breadcrumb-navxt'), 'Hdate_template_no_anchor', '4', false, __('The template for date breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  500. $this->textbox(__('Search Template', 'breadcrumb-navxt'), 'Hsearch_template', '6', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages.', 'breadcrumb-navxt')); 
  501. $this->textbox(__('Search Template (Unlinked)', 'breadcrumb-navxt'), 'Hsearch_template_no_anchor', '4', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages and the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  502. $this->input_text(__('404 Title', 'breadcrumb-navxt'), 'S404_title', 'regular-text'); 
  503. $this->textbox(__('404 Template', 'breadcrumb-navxt'), 'H404_template', '4', false, __('The template for 404 breadcrumbs.', 'breadcrumb-navxt')); 
  504. ?> 
  505. </table> 
  506. <h3><?php _e('Deprecated', 'breadcrumb-navxt'); ?></h3> 
  507. <table class="form-table"> 
  508. <tr valign="top"> 
  509. <th scope="row"> 
  510. <?php _e('Title Length', 'breadcrumb-navxt'); ?>  
  511. </th> 
  512. <td> 
  513. <label> 
  514. <input name="bcn_options[blimit_title]" type="checkbox" id="blimit_title" value="true" <?php checked(true, $this->opt['blimit_title']); ?> /> 
  515. <?php printf(__('Limit the length of the breadcrumb title. (Deprecated, %suse CSS instead%s)', 'breadcrumb-navxt'), '<a title="' . __('Go to the guide on trimming breadcrumb title lengths with CSS', 'breadcrumb-navxt') . '" href="https://mtekk.us/archives/guides/trimming-breadcrumb-title-lengths-with-css/">', '</a>');?> 
  516. </label><br /> 
  517. <ul> 
  518. <li> 
  519. <label for="amax_title_length"> 
  520. <?php _e('Max Title Length: ', 'breadcrumb-navxt');?> 
  521. <input type="number" name="bcn_options[amax_title_length]" id="amax_title_length" min="1" step="1" value="<?php echo esc_html($this->opt['amax_title_length'], ENT_COMPAT, 'UTF-8'); ?>" class="small-text" /> 
  522. </label> 
  523. </li> 
  524. </ul> 
  525. </td> 
  526. </tr> 
  527. </table> 
  528. <?php do_action($this->unique_prefix . '_after_settings_tab_miscellaneous', $this->opt); ?> 
  529. </fieldset> 
  530. <?php do_action($this->unique_prefix . '_after_settings_tabs', $this->opt); ?> 
  531. </div> 
  532. <p class="submit"><input type="submit" class="button-primary" name="bcn_admin_options" value="<?php esc_attr_e('Save Changes') ?>" /></p> 
  533. </form> 
  534. </div> 
  535. <?php