bcn_network_admin

The administrative interface class.

Defined (1)

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

/class.bcn_network_admin.php  
  1. class bcn_network_admin extends mtekk_adminKit 
  2. const version = '5.6.0'; 
  3. protected $full_name = 'Breadcrumb NavXT Network Settings'; 
  4. protected $short_name = 'Breadcrumb NavXT'; 
  5. protected $access_level = 'manage_network_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. * @param bcn_breadcrumb_trail $breadcrumb_trail a breadcrumb trail object 
  14. * @param string $basename The basename of the plugin 
  15. */ 
  16. function __construct(bcn_breadcrumb_trail $breadcrumb_trail, $basename) 
  17. $this->breadcrumb_trail = $breadcrumb_trail; 
  18. $this->plugin_basename = $basename; 
  19. $this->full_name = __('Breadcrumb NavXT Network Settings', 'breadcrumb-navxt'); 
  20. //Grab defaults from the breadcrumb_trail object 
  21. $this->opt = $this->breadcrumb_trail->opt; 
  22. add_action('network_admin_menu', array($this, 'add_page')); 
  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. * Return the URL of the settings page for the plugin 
  41. */ 
  42. function admin_url() 
  43. return admin_url('network/settings.php?page=' . $this->identifier); 
  44. /** 
  45. * Adds the adminpage the menu and the nice little settings link 
  46. */ 
  47. function add_page() 
  48. //Add the submenu page to "settings" menu 
  49. $hookname = add_submenu_page('settings.php', $this->full_name, $this->short_name, $this->access_level, $this->identifier, array($this, 'net_admin_page')); 
  50. // check capability of user to manage options (access control) 
  51. if(current_user_can($this->access_level)) 
  52. //Register admin_head-$hookname callback 
  53. add_action('admin_head-' . $hookname, array($this, 'admin_head')); 
  54. //Register admin_print_styles-$hookname callback 
  55. add_action('admin_print_styles-' . $hookname, array($this, 'admin_styles')); 
  56. //Register admin_print_scripts-$hookname callback 
  57. add_action('admin_print_scripts-' . $hookname, array($this, 'admin_scripts')); 
  58. //Register Help Output 
  59. add_action('load-' . $hookname, array($this, 'help')); 
  60. /** 
  61. * Have to hook into get_option and replace with network wide alternate 
  62. *  
  63. * @param string $option The name of the option to retrieve 
  64. * @return mixed The value of the option 
  65. */ 
  66. function get_option($option) 
  67. return get_site_option($option); 
  68. /** 
  69. * Have to hook into update_option and replace with network wide alternate 
  70. *  
  71. * @param string $option The name of the option to update 
  72. * @param mixed $newvalue The new value to set the option to 
  73. *  
  74. */ 
  75. function update_option($option, $newvalue) 
  76. return update_site_option($option, $newvalue); 
  77. /** 
  78. * Have to hook into add_option and replace with network wide alternate 
  79. *  
  80. * @param string $option The name of the option to update 
  81. * @param mixed $value The new value to set the option to 
  82. * @param null $deprecated Deprecated parameter 
  83. * @param string $autoload Whether or not to autoload the option, it's a string because WP is special 
  84. *  
  85. */ 
  86. function add_option($option, $value = '', $deprecated = '', $autoload = 'yes') 
  87. return add_site_option($option, $value); 
  88. /** 
  89. * Have to hook into delete_option and replace with network wide alternate 
  90. *  
  91. * @param string $option The name of the option to delete 
  92. */ 
  93. function delete_option($option) 
  94. return delete_site_option($option); 
  95. /** 
  96. * Upgrades input options array, sets to $this->opt 
  97. *  
  98. * @param array $opts 
  99. * @param string $version the version of the passed in options 
  100. */ 
  101. function opts_upgrade($opts, $version) 
  102. global $wp_post_types, $wp_taxonomies; 
  103. //If our version is not the same as in the db, time to update 
  104. if(version_compare($version, $this::version, '<')) 
  105. //Upgrading to 3.8.1 
  106. if(version_compare($version, '3.8.1', '<')) 
  107. $opts['post_page_root'] = get_option('page_on_front'); 
  108. $opts['post_post_root'] = get_option('page_for_posts'); 
  109. //Upgrading to 4.0 
  110. if(version_compare($version, '4.0.0', '<')) 
  111. //Only migrate if we haven't migrated yet 
  112. if(isset($opts['current_item_linked'])) 
  113. //Loop through the old options, migrate some of them 
  114. foreach($opts as $option => $value) 
  115. //Handle all of our boolean options first, they're real easy, just add a 'b' 
  116. if(strpos($option, 'display') > 0 || $option == 'current_item_linked') 
  117. $this->breadcrumb_trail->opt['b' . $option] = $value; 
  118. //Handle migration of anchor templates to the templates 
  119. else if(strpos($option, 'anchor') > 0) 
  120. $parts = explode('_', $option); 
  121. //Do excess slash removal sanitation 
  122. $this->breadcrumb_trail->opt['H' . $parts[0] . '_template'] = $value . '%htitle%</a>'; 
  123. //Handle our abs integers 
  124. else if($option == 'max_title_length' || $option == 'post_post_root' || $option == 'post_page_root') 
  125. $this->breadcrumb_trail->opt['a' . $option] = $value; 
  126. //Now everything else, minus prefix and suffix 
  127. else if(strpos($option, 'prefix') === false && strpos($option, 'suffix') === false) 
  128. $this->breadcrumb_trail->opt['S' . $option] = $value; 
  129. //Add in the new settings for CPTs introduced in 4.0 
  130. foreach($wp_post_types as $post_type) 
  131. //We only want custom post types 
  132. if(!$post_type->_builtin) 
  133. //Add in the archive_display option 
  134. $this->breadcrumb_trail->opt['bpost_' . $post_type->name . '_archive_display'] = $post_type->has_archive; 
  135. $opts = $this->breadcrumb_trail->opt; 
  136. if(version_compare($version, '4.0.1', '<')) 
  137. if(isset($opts['Hcurrent_item_template_no_anchor'])) 
  138. unset($opts['Hcurrent_item_template_no_anchor']); 
  139. if(isset($opts['Hcurrent_item_template'])) 
  140. unset($opts['Hcurrent_item_template']); 
  141. //Upgrading to 4.3.0 
  142. if(version_compare($version, '4.3.0', '<')) 
  143. //Removed home_title 
  144. if(isset($opts['Shome_title'])) 
  145. unset($opts['Shome_title']); 
  146. //Removed mainsite_title 
  147. if(isset($opts['Smainsite_title'])) 
  148. unset($opts['Smainsite_title']); 
  149. //Upgrading to 5.1.0 
  150. if(version_compare($version, '5.1.0', '<')) 
  151. foreach($wp_taxonomies as $taxonomy) 
  152. //If we have the old options style for it, update 
  153. if($taxonomy->name !== 'post_format' && isset($opts['H' . $taxonomy->name . '_template'])) 
  154. //Migrate to the new setting name 
  155. $opts['Htax_' . $taxonomy->name . '_template'] = $opts['H' . $taxonomy->name . '_template']; 
  156. $opts['Htax_' . $taxonomy->name . '_template_no_anchor'] = $opts['H' . $taxonomy->name . '_template_no_anchor']; 
  157. //Clean up old settings 
  158. unset($opts['H' . $taxonomy->name . '_template']); 
  159. unset($opts['H' . $taxonomy->name . '_template_no_anchor']); 
  160. //Upgrading to 5.4.0 
  161. if(version_compare($version, '5.4.0', '<')) 
  162. //Migrate users to schema.org breadcrumbs for author and search if still on the defaults for posts 
  163. if($opts['Hpost_post_template'] === bcn_breadcrumb::get_default_template() && $opts['Hpost_post_template_no_anchor'] === bcn_breadcrumb::default_template_no_anchor) 
  164. if($opts['Hpaged_template'] === 'Page %htitle%') 
  165. $opts['Hpaged_template'] = $this->opt['Hpaged_template']; 
  166. 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>'') 
  167. $opts['Hsearch_template'] = $this->opt['Hsearch_template']; 
  168. if($opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'' || $opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'') 
  169. $opts['Hsearch_template_no_anchor'] = $this->opt['Hsearch_template_no_anchor']; 
  170. if($opts['Hauthor_template'] === 'Articles by: <a title="Go to the first page of posts by %title%." href="%link%" class="%type%">%htitle%</a>') 
  171. $opts['Hauthor_template'] = $this->opt['Hauthor_template']; 
  172. if($opts['Hauthor_template_no_anchor'] === 'Articles by: %htitle%') 
  173. $opts['Hauthor_template_no_anchor'] = $this->opt['Hauthor_template_no_anchor']; 
  174. //Upgrading to 5.5.0 
  175. if(version_compare($version, '5.5.0', '<')) 
  176. //Translate the old 'page' taxonomy type to BCN_POST_PARENT 
  177. if($this->opt['Spost_post_taxonomy_type'] === 'page') 
  178. $this->opt['Spost_post_taxonomy_type'] = 'BCN_POST_PARENT'; 
  179. if(!isset($this->opt['Spost_post_taxonomy_referer'])) 
  180. $this->opt['bpost_post_taxonomy_referer'] = false; 
  181. //Loop through all of the post types in the array 
  182. foreach($wp_post_types as $post_type) 
  183. //Check for non-public CPTs 
  184. if(!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name)) 
  185. continue; 
  186. //We only want custom post types 
  187. if(!$post_type->_builtin) 
  188. //Translate the old 'page' taxonomy type to BCN_POST_PARENT 
  189. if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'page') 
  190. $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_POST_PARENT'; 
  191. //Translate the old 'date' taxonomy type to BCN_DATE 
  192. if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'date') 
  193. $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE'; 
  194. if(!isset($this->opt['Spost_' . $post_type->name . '_taxonomy_referer'])) 
  195. $this->opt['bpost_' . $post_type->name . '_taxonomy_referer'] = false; 
  196. //S 
  197. //Set the max title length to 20 if we are not limiting the title and the length was 0 
  198. if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0) 
  199. $opts['amax_title_length'] = 20; 
  200. //Save the passed in opts to the object's option array 
  201. $this->opt = $opts; 
  202. //End with resetting up the options 
  203. breadcrumb_navxt::setup_options($this->opt); 
  204. function opts_update_prebk(&$opts) 
  205. //Add any new custom post types, or taxonomies 
  206. breadcrumb_navxt::setup_options($opts); 
  207. $opts = apply_filters('bcn_opts_update_prebk', $opts); 
  208. /** 
  209. * help action hook function 
  210. *  
  211. * @return string 
  212. *  
  213. */ 
  214. function help() 
  215. $screen = get_current_screen(); 
  216. //Exit early if the add_help_tab function doesn't exist 
  217. if(!method_exists($screen, 'add_help_tab')) 
  218. return; 
  219. //Add contextual help on current screen 
  220. if($screen->id == 'settings_page_' . $this->identifier) 
  221. $general_tab = '<p>' . __('Tips for the settings are located below select options.', 'breadcrumb-navxt') . 
  222. '</p><h5>' . __('Resources', 'breadcrumb-navxt') . '</h5><ul><li>' . 
  223. 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>' . 
  224. 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>' . 
  225. 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>' .  
  226. '<h5>' . __('Giving Back', 'breadcrumb-navxt') . '</h5><ul><li>' . 
  227. 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>' . 
  228. 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>'; 
  229.  
  230. $screen->add_help_tab( 
  231. array( 
  232. 'id' => $this->identifier . '-base',  
  233. 'title' => __('General', 'breadcrumb-navxt'),  
  234. 'content' => $general_tab 
  235. )); 
  236. $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') . 
  237. '</p><h5>' . __('Breadcrumb trail with separators', 'breadcrumb-navxt') . '</h5><pre><code><div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">' . " 
  238. <?php if(function_exists('bcn_display')) 
  239. bcn_display(); 
  240. }?> 
  241. </div></code></pre>" . 
  242. '<h5>' . __('Breadcrumb trail in list form', 'breadcrumb-navxt').'</h5><pre><code><ol class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">'." 
  243. <?php if(function_exists('bcn_display_list')) 
  244. bcn_display_list(); 
  245. }?> 
  246. </ol></code></pre>"; 
  247. $screen->add_help_tab( 
  248. array( 
  249. 'id' => $this->identifier . '-quick-start',  
  250. 'title' => __('Quick Start', 'breadcrumb-navxt'),  
  251. 'content' => $quickstart_tab 
  252. )); 
  253. $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>' . 
  254. '<pre><code>.breadcrumbs 
  255. font-size: 1.1em; 
  256. color: #fff; 
  257. margin: 30px 0 0 10px; 
  258. position: relative; 
  259. float: left; 
  260. }</code></pre>'; 
  261. $screen->add_help_tab( 
  262. array( 
  263. 'id' => $this->identifier . '-styling',  
  264. 'title' => __('Styling', 'breadcrumb-navxt'),  
  265. 'content' => $styling_tab 
  266. )); 
  267. $screen->add_help_tab( 
  268. array( 
  269. 'id' => $this->identifier . '-import-export-reset',  
  270. 'title' => __('Import/Export/Reset', 'breadcrumb-navxt'),  
  271. 'content' => $this->import_form() 
  272. )); 
  273. /** 
  274. * enqueue's the tab style sheet on the settings page 
  275. */ 
  276. function admin_styles() 
  277. wp_enqueue_style('mtekk_adminkit_tabs'); 
  278. /** 
  279. * enqueue's the tab js and translation js on the settings page 
  280. */ 
  281. function admin_scripts() 
  282. //Enqueue ui-tabs 
  283. wp_enqueue_script('jquery-ui-tabs'); 
  284. //Enqueue the admin tabs javascript 
  285. wp_enqueue_script('mtekk_adminkit_tabs'); 
  286. //Load the translations for the tabs 
  287. wp_localize_script('mtekk_adminkit_tabs', 'objectL10n', array( 
  288. 'mtad_uid' => 'bcn_admin',  
  289. 'mtad_import' => __('Import', 'breadcrumb-navxt'),  
  290. 'mtad_export' => __('Export', 'breadcrumb-navxt'),  
  291. 'mtad_reset' => __('Reset', 'breadcrumb-navxt'),  
  292. )); 
  293. //Enqueue the admin enable/disable groups javascript 
  294. wp_enqueue_script('mtekk_adminkit_engroups'); 
  295. /** 
  296. * A message function that checks for the BCN_SETTINGS_* define statement 
  297. */ 
  298. function multisite_settings_warn() 
  299. if(is_multisite()) 
  300. if(defined('BCN_SETTINGS_USE_LOCAL') && BCN_SETTINGS_USE_LOCAL) 
  301. $this->message['updated fade'][] = __('Warning: Individual site settings will override any settings set in this page.', 'breadcrumb-navxt'); 
  302. else if(defined('BCN_SETTINGS_USE_NETWORK') && BCN_SETTINGS_USE_NETWORK) 
  303.  
  304. else if(defined('BCN_SETTINGS_FAVOR_LOCAL') && BCN_SETTINGS_FAVOR_LOCAL) 
  305. $this->message['updated fade'][] = __('Warning: Individual site settings may override any settings set in this page.', 'breadcrumb-navxt'); 
  306. else if(defined('BCN_SETTINGS_FAVOR_NETWORK') && BCN_SETTINGS_FAVOR_NETWORK) 
  307. $this->message['updated fade'][] = __('Warning: Individual site settings may override any settings set in this page.', 'breadcrumb-navxt'); 
  308. //Fall through if no settings mode was set 
  309. else 
  310. $this->message['updated fade'][] = __('Warning: No BCN_SETTINGS_* define statement found, defaulting to BCN_SETTINGS_USE_LOCAL.', 'breadcrumb-navxt'); 
  311. $this->message['updated fade'][] = __('Warning: Individual site settings will override any settings set in this page.', 'breadcrumb-navxt'); 
  312. /** 
  313. * A message function that checks for deprecated settings that are set and warns the user 
  314. */ 
  315. function deprecated_settings_warn() 
  316. //We're deprecating the limit title length setting, let the user know the new method of accomplishing this 
  317. if(isset($this->opt['blimit_title']) && $this->opt['blimit_title']) 
  318. $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>'); 
  319. /** 
  320. * The administrative page for Breadcrumb NavXT 
  321. */ 
  322. function net_admin_page() 
  323. global $wp_taxonomies, $wp_post_types; 
  324. $this->security(); 
  325. //Do a check on deprecated settings 
  326. $this->deprecated_settings_warn(); 
  327. //Do a check for multisite settings mode 
  328. $this->multisite_settings_warn(); 
  329. do_action($this->unique_prefix . '_network_settings_pre_messages', $this->opt); 
  330. //Display our messages 
  331. $this->messages(); 
  332. ?> 
  333. <div class="wrap"><h2><?php echo $this->full_name; ?></h2> 
  334. <?php 
  335. //We exit after the version check if there is an action the user needs to take before saving settings 
  336. if(!$this->version_check(get_site_option($this->unique_prefix . '_version'))) 
  337. return; 
  338. ?> 
  339. <form action="<?php echo $this->admin_url(); ?>" method="post" id="bcn_admin-options"> 
  340. <?php settings_fields('bcn_options');?> 
  341. <div id="hasadmintabs"> 
  342. <fieldset id="general" class="bcn_options"> 
  343. <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> 
  344. <h3><?php _e('General', 'breadcrumb-navxt'); ?></h3> 
  345. <table class="form-table"> 
  346. <?php 
  347. $this->input_text(__('Breadcrumb Separator', 'breadcrumb-navxt'), 'hseparator', 'regular-text', false, __('Placed in between each breadcrumb.', 'breadcrumb-navxt')); 
  348. do_action($this->unique_prefix . '_network_settings_general', $this->opt); 
  349. ?> 
  350. </table> 
  351. <h3><?php _e('Current Item', 'breadcrumb-navxt'); ?></h3> 
  352. <table class="form-table"> 
  353. <?php 
  354. $this->input_check(__('Link Current Item', 'breadcrumb-navxt'), 'bcurrent_item_linked', __('Yes', 'breadcrumb-navxt')); 
  355. $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')); 
  356. $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')); 
  357. do_action($this->unique_prefix . '_network_settings_current_item', $this->opt); 
  358. ?> 
  359. </table> 
  360. <h3><?php _e('Home Breadcrumb', 'breadcrumb-navxt'); ?></h3> 
  361. <table class="form-table adminkit-engroup"> 
  362. <?php  
  363. $this->input_check(__('Home Breadcrumb', 'breadcrumb-navxt'), 'bhome_display', __('Place the home breadcrumb in the trail.', 'breadcrumb-navxt')); 
  364. $this->textbox(__('Home Template', 'breadcrumb-navxt'), 'Hhome_template', '6', false, __('The template for the home breadcrumb.', 'breadcrumb-navxt')); 
  365. $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')); 
  366. do_action($this->unique_prefix . '_network_settings_home', $this->opt); 
  367. ?> 
  368. </table> 
  369. <h3><?php _e('Blog Breadcrumb', 'breadcrumb-navxt'); ?></h3> 
  370. <table class="form-table adminkit-engroup"> 
  371. <?php 
  372. $this->input_check(__('Blog Breadcrumb', 'breadcrumb-navxt'), 'bblog_display', __('Place the blog breadcrumb in the trail.', 'breadcrumb-navxt')); 
  373. $this->textbox(__('Blog Template', 'breadcrumb-navxt'), 'Hblog_template', '6', false, __('The template for the blog breadcrumb, used only in static front page environments.', 'breadcrumb-navxt')); 
  374. $this->textbox(__('Blog Template (Unlinked)', 'breadcrumb-navxt'), 'Hblog_template_no_anchor', '4', false , __('The template for the blog breadcrumb, used only in static front page environments and when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  375. do_action($this->unique_prefix . '_network_settings_blog', $this->opt); 
  376. ?> 
  377. </table> 
  378. <h3><?php _e('Mainsite Breadcrumb', 'breadcrumb-navxt'); ?></h3> 
  379. <table class="form-table adminkit-engroup"> 
  380. <?php 
  381. $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')); 
  382. $this->textbox(__('Main Site Home Template', 'breadcrumb-navxt'), 'Hmainsite_template', '6', false, __('The template for the main site home breadcrumb, used only in multisite environments.', 'breadcrumb-navxt')); 
  383. $this->textbox(__('Main Site Home Template (Unlinked)', 'breadcrumb-navxt'), 'Hmainsite_template_no_anchor', '4', false, __('The template for the main site home breadcrumb, used only in multisite environments and when the breadcrumb is not linked.', 'breadcrumb-navxt')); 
  384. do_action($this->unique_prefix . '_network_settings_mainsite', $this->opt); 
  385. ?> 
  386. </table> 
  387. <?php do_action($this->unique_prefix . '_after_network_settings_tab_general', $this->opt); ?> 
  388. </fieldset> 
  389. <fieldset id="post" class="bcn_options"> 
  390. <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> 
  391. <h3><?php _e('Posts', 'breadcrumb-navxt'); ?></h3> 
  392. <table class="form-table adminkit-enset-top"> 
  393. <?php 
  394. $this->textbox(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', '6', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt')); 
  395. $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')); 
  396. $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'); 
  397. $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'); 
  398. ?> 
  399. <tr valign="top"> 
  400. <th scope="row"> 
  401. <?php _e('Post Hierarchy', 'breadcrumb-navxt'); ?> 
  402. </th> 
  403. <td> 
  404. <?php 
  405. $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories'), false, 'adminkit-enset'); 
  406. $this->input_radio('Spost_post_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  407. $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags'), false, 'adminkit-enset'); 
  408. //We use the value 'page' but really, this will follow the parent post hierarchy 
  409. $this->input_radio('Spost_post_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  410. //Loop through all of the taxonomies in the array 
  411. foreach($wp_taxonomies as $taxonomy) 
  412. //Check for non-public taxonomies 
  413. if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) 
  414. continue; 
  415. //We only want custom taxonomies 
  416. if(($taxonomy->object_type == 'post' || is_array($taxonomy->object_type) && in_array('post', $taxonomy->object_type)) && !$taxonomy->_builtin) 
  417. $this->input_radio('Spost_post_taxonomy_type', $taxonomy->name, mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'), false, 'adminkit-enset'); 
  418. ?> 
  419. <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> 
  420. </td> 
  421. </tr> 
  422. </table> 
  423. <h3><?php _e('Pages', 'breadcrumb-navxt'); ?></h3> 
  424. <table class="form-table"> 
  425. <?php 
  426. $this->textbox(__('Page Template', 'breadcrumb-navxt'), 'Hpost_page_template', '6', false, __('The template for page breadcrumbs.', 'breadcrumb-navxt')); 
  427. $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')); 
  428. ?> 
  429. </table> 
  430. <h3><?php _e('Attachments', 'breadcrumb-navxt'); ?></h3> 
  431. <table class="form-table"> 
  432. <?php 
  433. $this->textbox(__('Attachment Template', 'breadcrumb-navxt'), 'Hpost_attachment_template', '6', false, __('The template for attachment breadcrumbs.', 'breadcrumb-navxt')); 
  434. $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')); 
  435. ?> 
  436. </table> 
  437. <?php 
  438. //Loop through all of the post types in the array 
  439. foreach($wp_post_types as $post_type) 
  440. //Check for non-public CPTs 
  441. if(!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name)) 
  442. continue; 
  443. //We only want custom post types 
  444. if(!$post_type->_builtin) 
  445. $singular_name_lc = mb_strtolower($post_type->labels->singular_name, 'UTF-8'); 
  446. ?> 
  447. <h3><?php echo $post_type->labels->singular_name; ?></h3> 
  448. <table class="form-table adminkit-enset-top"> 
  449. <?php 
  450. $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)); 
  451. $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)); 
  452. $optid = $this->get_valid_id('apost_' . $post_type->name . '_root'); 
  453. ?> 
  454. <tr valign="top"> 
  455. <th scope="row"> 
  456. <label for="<?php echo $optid;?>"><?php printf(__('%s Root Page', 'breadcrumb-navxt'), $post_type->labels->singular_name);?></label> 
  457. </th> 
  458. <td> 
  459. <?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']));?> 
  460. </td> 
  461. </tr> 
  462. <?php 
  463. $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); 
  464. $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'); 
  465. $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'); 
  466. ?> 
  467. <tr valign="top"> 
  468. <th scope="row"> 
  469. <?php printf(__('%s Hierarchy', 'breadcrumb-navxt'), $post_type->labels->singular_name); ?> 
  470. </th> 
  471. <td> 
  472. <?php 
  473. //We use the value 'page' but really, this will follow the parent post hierarchy 
  474. $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_POST_PARENT', __('Post Parent', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  475. $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'BCN_DATE', __('Dates', 'breadcrumb-navxt'), false, 'adminkit-enset'); 
  476. //Loop through all of the taxonomies in the array 
  477. foreach($wp_taxonomies as $taxonomy) 
  478. //Check for non-public taxonomies 
  479. if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) 
  480. continue; 
  481. //We only want custom taxonomies 
  482. if($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type)) 
  483. $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', $taxonomy->name, $taxonomy->labels->singular_name, false, 'adminkit-enset'); 
  484. ?> 
  485. <p class="description"> 
  486. <?php 
  487. if($post_type->hierarchical) 
  488. _e('The hierarchy which the breadcrumb trail will show.', 'breadcrumb-navxt');  
  489. else 
  490. _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'); 
  491. ?> 
  492. </p> 
  493. </td> 
  494. </tr> 
  495. </table> 
  496. <?php 
  497. do_action($this->unique_prefix . '_after_network_settings_tab_post', $this->opt); 
  498. ?> 
  499. </fieldset> 
  500. <fieldset id="tax" class="bcn_options alttab"> 
  501. <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> 
  502. <h3><?php _e('Categories', 'breadcrumb-navxt'); ?></h3> 
  503. <table class="form-table"> 
  504. <?php 
  505. $this->textbox(__('Category Template', 'breadcrumb-navxt'), 'Htax_category_template', '6', false, __('The template for category breadcrumbs.', 'breadcrumb-navxt')); 
  506. $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')); 
  507. ?> 
  508. </table> 
  509. <h3><?php _e('Tags', 'breadcrumb-navxt'); ?></h3> 
  510. <table class="form-table"> 
  511. <?php 
  512. $this->textbox(__('Tag Template', 'breadcrumb-navxt'), 'Htax_post_tag_template', '6', false, __('The template for tag breadcrumbs.', 'breadcrumb-navxt')); 
  513. $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')); 
  514. ?> 
  515. </table> 
  516. <h3><?php _e('Post Formats', 'breadcrumb-navxt'); ?></h3> 
  517. <table class="form-table"> 
  518. <?php 
  519. $this->textbox(__('Post Format Template', 'breadcrumb-navxt'), 'Htax_post_format_template', '6', false, __('The template for post format breadcrumbs.', 'breadcrumb-navxt')); 
  520. $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')); 
  521. ?> 
  522. </table> 
  523. <?php 
  524. //Loop through all of the taxonomies in the array 
  525. foreach($wp_taxonomies as $taxonomy) 
  526. //Check for non-public taxonomies 
  527. if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) 
  528. continue; 
  529. //We only want custom taxonomies 
  530. if(!$taxonomy->_builtin) 
  531. $label_lc = mb_strtolower($taxonomy->label, 'UTF-8'); 
  532. ?> 
  533. <h3><?php echo mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'); ?></h3> 
  534. <table class="form-table"> 
  535. <?php 
  536. $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)); 
  537. $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)); 
  538. ?> 
  539. </table> 
  540. <?php 
  541. do_action($this->unique_prefix . '_after_network_settings_tab_taxonomy', $this->opt); ?> 
  542. </fieldset> 
  543. <fieldset id="miscellaneous" class="bcn_options"> 
  544. <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> 
  545. <h3><?php _e('Author Archives', 'breadcrumb-navxt'); ?></h3> 
  546. <table class="form-table"> 
  547. <?php 
  548. $this->textbox(__('Author Template', 'breadcrumb-navxt'), 'Hauthor_template', '6', false, __('The template for author breadcrumbs.', 'breadcrumb-navxt')); 
  549. $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')); 
  550. $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')); 
  551. ?> 
  552. </table> 
  553. <h3><?php _e('Miscellaneous', 'breadcrumb-navxt'); ?></h3> 
  554. <table class="form-table"> 
  555. <?php 
  556. $this->textbox(__('Date Template', 'breadcrumb-navxt'), 'Hdate_template', '6', false, __('The template for date breadcrumbs.', 'breadcrumb-navxt')); 
  557. $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')); 
  558. $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')); 
  559. $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')); 
  560. $this->input_text(__('404 Title', 'breadcrumb-navxt'), 'S404_title', 'regular-text'); 
  561. $this->textbox(__('404 Template', 'breadcrumb-navxt'), 'H404_template', '4', false, __('The template for 404 breadcrumbs.', 'breadcrumb-navxt')); 
  562. ?> 
  563. </table> 
  564. <h3><?php _e('Deprecated', 'breadcrumb-navxt'); ?></h3> 
  565. <table class="form-table"> 
  566. <tr valign="top"> 
  567. <th scope="row"> 
  568. <?php _e('Title Length', 'breadcrumb-navxt'); ?>  
  569. </th> 
  570. <td> 
  571. <label> 
  572. <input name="bcn_options[blimit_title]" type="checkbox" id="blimit_title" value="true" <?php checked(true, $this->opt['blimit_title']); ?> /> 
  573. <?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>');?> 
  574. </label><br /> 
  575. <ul> 
  576. <li> 
  577. <label for="amax_title_length"> 
  578. <?php _e('Max Title Length: ', 'breadcrumb-navxt');?> 
  579. <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" /> 
  580. </label> 
  581. </li> 
  582. </ul> 
  583. </td> 
  584. </tr> 
  585. </table> 
  586. <?php do_action($this->unique_prefix . '_after_network_settings_tab_miscellaneous', $this->opt); ?> 
  587. </fieldset> 
  588. <?php do_action($this->unique_prefix . '_after_network_settings_tabs', $this->opt); ?> 
  589. </div> 
  590. <p class="submit"><input type="submit" class="button-primary" name="bcn_admin_options" value="<?php esc_attr_e('Save Changes') ?>" /></p> 
  591. </form> 
  592. </div> 
  593. <?php