function wp_loaded() { parent::wp_loaded(); breadcrumb_navxt::setup_options($this->opt); }
/** * An alternate version of array_merge_recursive, less flexible * still recursive, ~2x faster than the more flexible version * * @param array $arg1 first array * @param array $arg2 second array to merge into $arg1 * @return array */ static function array_merge_recursive($arg1, $arg2) { foreach ($arg2 as $key => $value) { if (array_key_exists($key, $arg1) && is_array($value)) { $arg1[$key] = mtekk_adminKit::array_merge_recursive($arg1[$key], $value); } else { $arg1[$key] = $value; } } return $arg1; }
public function allowed_html($tags) { $allowed_html = array('a' => array('href' => true, 'title' => true, 'class' => true, 'id' => true, 'media' => true, 'dir' => true, 'relList' => true, 'rel' => true, 'aria-hidden' => true, 'data-icon' => true, 'itemref' => true, 'itemid' => true, 'itemprop' => true, 'itemscope' => true, 'itemtype' => true, 'xmlns:v' => true, 'property' => true), 'img' => array('alt' => true, 'align' => true, 'height' => true, 'width' => true, 'src' => true, 'id' => true, 'class' => true, 'aria-hidden' => true, 'data-icon' => true, 'itemref' => true, 'itemid' => true, 'itemprop' => true, 'itemscope' => true, 'itemtype' => true, 'xmlns:v' => true, 'property' => true), 'span' => array('title' => true, 'class' => true, 'id' => true, 'dir' => true, 'align' => true, 'lang' => true, 'xml:lang' => true, 'aria-hidden' => true, 'data-icon' => true, 'itemref' => true, 'itemid' => true, 'itemprop' => true, 'itemscope' => true, 'itemtype' => true, 'xmlns:v' => true, 'property' => true), 'h1' => array('title' => true, 'class' => true, 'id' => true, 'dir' => true, 'align' => true, 'lang' => true, 'xml:lang' => true, 'aria-hidden' => true, 'data-icon' => true, 'itemref' => true, 'itemid' => true, 'itemprop' => true, 'itemscope' => true, 'itemtype' => true, 'xmlns:v' => true, 'property' => true), 'h2' => array('title' => true, 'class' => true, 'id' => true, 'dir' => true, 'align' => true, 'lang' => true, 'xml:lang' => true, 'aria-hidden' => true, 'data-icon' => true, 'itemref' => true, 'itemid' => true, 'itemprop' => true, 'itemscope' => true, 'itemtype' => true, 'xmlns:v' => true, 'property' => true)); return mtekk_adminKit::array_merge_recursive($tags, $allowed_html); }
/** * The administrative page for Breadcrumb NavXT */ function admin_page() { global $wp_taxonomies, $wp_post_types; $this->security(); //Let's call the parent version of the page, will handle our setting stuff parent::admin_page(); ?> <div class="wrap"><div id="icon-options-general" class="icon32"></div><h2><?php _e('Breadcrumb NavXT Settings', 'breadcrumb-navxt'); ?> </h2> <?php //We exit after the version check if there is an action the user needs to take before saving settings if (!$this->version_check(get_option($this->unique_prefix . '_version'))) { return; } ?> <form action="<?php echo $this->admin_url(); ?> " method="post" id="bcn_admin-options"> <?php settings_fields('bcn_options'); ?> <div id="hasadmintabs"> <fieldset id="general" class="bcn_options"> <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> <h3><?php _e('General', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Breadcrumb Separator', 'breadcrumb-navxt'), 'hseparator', 'regular-text', false, __('Placed in between each breadcrumb.', 'breadcrumb-navxt')); ?> <tr valign="top"> <th scope="row"> <?php _e('Title Length', 'breadcrumb-navxt'); ?> </th> <td> <label> <input name="bcn_options[blimit_title]" type="checkbox" id="blimit_title" value="true" <?php checked(true, $this->opt['blimit_title']); ?> /> <?php _e('Limit the length of the breadcrumb title.', 'breadcrumb-navxt'); ?> </label><br /> <ul> <li> <label for="amax_title_length"> <?php _e('Max Title Length: ', 'breadcrumb-navxt'); ?> <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" /> </label> </li> </ul> </td> </tr> <?php do_action($this->unique_prefix . '_settings_general'); ?> </table> <h3><?php _e('Current Item', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_check(__('Link Current Item', 'breadcrumb-navxt'), 'bcurrent_item_linked', __('Yes', 'breadcrumb-navxt')); $this->input_check(__('Paged Breadcrumb', 'breadcrumb-navxt'), 'bpaged_display', __('Include the paged breadcrumb in the breadcrumb trail.', 'breadcrumb-navxt'), false, __('Indicates that the user is on a page other than the first on paginated posts/pages.', 'breadcrumb-navxt')); $this->input_text(__('Paged Template', 'breadcrumb-navxt'), 'Hpaged_template', 'large-text', false, __('The template for paged breadcrumbs.', 'breadcrumb-navxt')); do_action($this->unique_prefix . '_settings_current_item'); ?> </table> <h3><?php _e('Home Breadcrumb', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_check(__('Home Breadcrumb', 'breadcrumb-navxt'), 'bhome_display', __('Place the home breadcrumb in the trail.', 'breadcrumb-navxt')); $this->input_text(__('Home Template', 'breadcrumb-navxt'), 'Hhome_template', 'large-text', false, __('The template for the home breadcrumb.', 'breadcrumb-navxt')); $this->input_text(__('Home Template (Unlinked)', 'breadcrumb-navxt'), 'Hhome_template_no_anchor', 'large-text', false, __('The template for the home breadcrumb, used when the breadcrumb is not linked.', 'breadcrumb-navxt')); do_action($this->unique_prefix . '_settings_home'); ?> </table> <h3><?php _e('Blog Breadcrumb', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_check(__('Blog Breadcrumb', 'breadcrumb-navxt'), 'bblog_display', __('Place the blog breadcrumb in the trail.', 'breadcrumb-navxt'), get_option('show_on_front') !== "page"); $this->input_text(__('Blog Template', 'breadcrumb-navxt'), 'Hblog_template', 'large-text', get_option('show_on_front') !== "page", __('The template for the blog breadcrumb, used only in static front page environments.', 'breadcrumb-navxt')); $this->input_text(__('Blog Template (Unlinked)', 'breadcrumb-navxt'), 'Hblog_template_no_anchor', 'large-text', get_option('show_on_front') !== "page", __('The template for the blog breadcrumb, used only in static front page environments and when the breadcrumb is not linked.', 'breadcrumb-navxt')); do_action($this->unique_prefix . '_settings_blog'); ?> </table> <h3><?php _e('Mainsite Breadcrumb', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $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()); $this->input_text(__('Main Site Home Template', 'breadcrumb-navxt'), 'Hmainsite_template', 'large-text', !is_multisite(), __('The template for the main site home breadcrumb, used only in multisite environments.', 'breadcrumb-navxt')); $this->input_text(__('Main Site Home Template (Unlinked)', 'breadcrumb-navxt'), 'Hmainsite_template_no_anchor', 'large-text', !is_multisite(), __('The template for the main site home breadcrumb, used only in multisite environments and when the breadcrumb is not linked.', 'breadcrumb-navxt')); do_action($this->unique_prefix . '_settings_mainsite'); ?> </table> <?php do_action($this->unique_prefix . '_after_settings_tab_general'); ?> </fieldset> <fieldset id="post" class="bcn_options"> <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> <h3><?php _e('Posts', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Post Template', 'breadcrumb-navxt'), 'Hpost_post_template', 'large-text', false, __('The template for post breadcrumbs.', 'breadcrumb-navxt')); $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')); $this->input_check(__('Post Hierarchy Display', 'breadcrumb-navxt'), 'bpost_post_taxonomy_display', __('Show the taxonomy leading to a post in the breadcrumb trail.', 'breadcrumb-navxt')); ?> <tr valign="top"> <th scope="row"> <?php _e('Post Hierarchy', 'breadcrumb-navxt'); ?> </th> <td> <?php $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories')); $this->input_radio('Spost_post_taxonomy_type', 'date', __('Dates')); $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags')); //We use the value 'page' but really, this will follow the parent post hierarchy $this->input_radio('Spost_post_taxonomy_type', 'page', __('Post Parent')); //Loop through all of the taxonomies in the array foreach ($wp_taxonomies as $taxonomy) { //Check for non-public taxonomies if (!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) { continue; } //We only want custom taxonomies if (($taxonomy->object_type == 'post' || is_array($taxonomy->object_type) && in_array('post', $taxonomy->object_type)) && !$taxonomy->_builtin) { $this->input_radio('Spost_post_taxonomy_type', $taxonomy->name, mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8')); } } ?> <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> </td> </tr> </table> <h3><?php _e('Pages', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Page Template', 'breadcrumb-navxt'), 'Hpost_page_template', 'large-text', false, __('The template for page breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Page Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_page_template_no_anchor', 'large-text', false, __('The template for page breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); $this->input_text(__('Attachment Template', 'breadcrumb-navxt'), 'Hpost_attachment_template', 'large-text', false, __('The template for attachment breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Attachment Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_attachment_template_no_anchor', 'large-text', false, __('The template for attachment breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); ?> </table> <?php //Loop through all of the post types in the array foreach ($wp_post_types as $post_type) { //Check for non-public CPTs if (!apply_filters('bcn_show_cpt_private', $post_type->public, $post_type->name)) { continue; } //We only want custom post types if (!$post_type->_builtin) { $singular_name_lc = mb_strtolower($post_type->labels->singular_name, 'UTF-8'); ?> <h3><?php echo $post_type->labels->singular_name; ?> </h3> <table class="form-table"> <?php $this->input_text(sprintf(__('%s Template', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template', 'large-text', false, sprintf(__('The template for %s breadcrumbs.', 'breadcrumb-navxt'), $singular_name_lc)); $this->input_text(sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template_no_anchor', 'large-text', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'), $singular_name_lc)); $optid = $this->get_valid_id('apost_' . $post_type->name . '_root'); ?> <tr valign="top"> <th scope="row"> <label for="<?php echo $optid; ?> "><?php printf(__('%s Root Page', 'breadcrumb-navxt'), $post_type->labels->singular_name); ?> </label> </th> <td> <?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'])); ?> </td> </tr> <?php $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); $this->input_check(sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_display', sprintf(__('Show the taxonomy leading to a %s in the breadcrumb trail.', 'breadcrumb-navxt'), $singular_name_lc)); ?> <tr valign="top"> <th scope="row"> <?php printf(__('%s Hierarchy', 'breadcrumb-navxt'), $post_type->labels->singular_name); ?> </th> <td> <?php //We use the value 'page' but really, this will follow the parent post hierarchy $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'page', __('Post Parent')); //Loop through all of the taxonomies in the array foreach ($wp_taxonomies as $taxonomy) { //Check for non-public taxonomies if (!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) { continue; } //We only want custom taxonomies if ($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type)) { $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', $taxonomy->name, $taxonomy->labels->singular_name); } } ?> <p class="description"> <?php if ($post_type->hierarchical) { _e('The hierarchy which the breadcrumb trail will show.', 'breadcrumb-navxt'); } else { _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> </td> </tr> </table> <?php } } do_action($this->unique_prefix . '_after_settings_tab_post'); ?> </fieldset> <fieldset id="tax" class="bcn_options alttab"> <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> <h3><?php _e('Categories', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Category Template', 'breadcrumb-navxt'), 'Hcategory_template', 'large-text', false, __('The template for category breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Category Template (Unlinked)', 'breadcrumb-navxt'), 'Hcategory_template_no_anchor', 'large-text', false, __('The template for category breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); ?> </table> <h3><?php _e('Tags', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Tag Template', 'breadcrumb-navxt'), 'Hpost_tag_template', 'large-text', false, __('The template for tag breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Tag Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_tag_template_no_anchor', 'large-text', false, __('The template for tag breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); ?> </table> <h3><?php _e('Post Formats', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Post Format Template', 'breadcrumb-navxt'), 'Hpost_format_template', 'large-text', false, __('The template for post format breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Post Format Template (Unlinked)', 'breadcrumb-navxt'), 'Hpost_format_template_no_anchor', 'large-text', false, __('The template for post_format breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); ?> </table> <?php //Loop through all of the taxonomies in the array foreach ($wp_taxonomies as $taxonomy) { //Check for non-public taxonomies if (!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name)) { continue; } //We only want custom taxonomies if (!$taxonomy->_builtin) { $label_lc = mb_strtolower($taxonomy->label, 'UTF-8'); ?> <h3><?php echo mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'); ?> </h3> <table class="form-table"> <?php $this->input_text(sprintf(__('%s Template', 'breadcrumb-navxt'), $taxonomy->labels->singular_name), 'H' . $taxonomy->name . '_template', 'large-text', false, sprintf(__('The template for %s breadcrumbs.', 'breadcrumb-navxt'), $label_lc)); $this->input_text(sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $taxonomy->labels->singular_name), 'H' . $taxonomy->name . '_template_no_anchor', 'large-text', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt'), $label_lc)); ?> </table> <?php } } do_action($this->unique_prefix . '_after_settings_tab_taxonomy'); ?> </fieldset> <fieldset id="miscellaneous" class="bcn_options"> <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> <h3><?php _e('Author Archives', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Author Template', 'breadcrumb-navxt'), 'Hauthor_template', 'large-text', false, __('The template for author breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Author Template (Unlinked)', 'breadcrumb-navxt'), 'Hauthor_template_no_anchor', 'large-text', false, __('The template for author breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); $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')); ?> </table> <h3><?php _e('Miscellaneous', 'breadcrumb-navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Date Template', 'breadcrumb-navxt'), 'Hdate_template', 'large-text', false, __('The template for date breadcrumbs.', 'breadcrumb-navxt')); $this->input_text(__('Date Template (Unlinked)', 'breadcrumb-navxt'), 'Hdate_template_no_anchor', 'large-text', false, __('The template for date breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb-navxt')); $this->input_text(__('Search Template', 'breadcrumb-navxt'), 'Hsearch_template', 'large-text', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages.', 'breadcrumb-navxt')); $this->input_text(__('Search Template (Unlinked)', 'breadcrumb-navxt'), 'Hsearch_template_no_anchor', 'large-text', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages and the breadcrumb is not linked.', 'breadcrumb-navxt')); $this->input_text(__('404 Title', 'breadcrumb-navxt'), 'S404_title', 'regular-text'); $this->input_text(__('404 Template', 'breadcrumb-navxt'), 'H404_template', 'large-text', false, __('The template for 404 breadcrumbs.', 'breadcrumb-navxt')); ?> </table> <?php do_action($this->unique_prefix . '_after_settings_tab_miscellaneous'); ?> </fieldset> </div> <p class="submit"><input type="submit" class="button-primary" name="bcn_admin_options" value="<?php esc_attr_e('Save Changes'); ?> " /></p> </form> <?php //Need to add a separate menu thing for this $this->import_form(); ?> </div> <?php }
/** * Updates the database settings from the webform */ function opts_update() { //Do some security related thigns as we are not using the normal WP settings API $this->security(); //Do a nonce check, prevent malicious link/form problems check_admin_referer($this->unique_prefix . '_options-options'); //Update local options from database $this->opt = mtekk_adminKit::parse_args(get_option($this->unique_prefix . '_options'), $this->opt); $this->opts_update_prebk($this->opt); //Update our backup options update_option($this->unique_prefix . '_options_bk', $this->opt); //Grab our incomming array (the data is dirty) $input = $_POST[$this->unique_prefix . '_options']; //Run the update loop $this->opts_update_loop($this->opt, $input); //Commit the option changes update_option($this->unique_prefix . '_options', $this->opt); //Check if known settings match attempted save if (count(array_diff_key($input, $this->opt)) == 0) { //Let the user know everything went ok $this->message['updated fade'][] = __('Settings successfully saved.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options save.', $this->identifier), __('Undo', $this->identifier)); } else { //Let the user know the following were not saved $this->message['updated fade'][] = __('Some settings were not saved.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options save.', $this->identifier), __('Undo', $this->identifier)); $temp = __('The following settings were not saved:', $this->identifier); foreach (array_diff_key($input, $this->opt) as $setting => $value) { $temp .= '<br />' . $setting; } $this->message['updated fade'][] = $temp . '<br />' . sprintf(__('Please include this message in your %sbug report%s.', $this->identifier), '<a title="' . sprintf(__('Go to the %s support post for your version.', $this->identifier), $this->short_name) . '" href="' . $this->support_url . $this->version . '/#respond">', '</a>'); } add_action('admin_notices', array($this, 'message')); }
/** * The administrative page for Breadcrumb NavXT */ function admin_page() { global $wp_taxonomies, $wp_post_types; $this->security(); //Let's call the parent version of the page, will handle our setting stuff parent::admin_page(); ?> <div class="wrap"><h2><?php _e('Breadcrumb NavXT Settings', 'breadcrumb_navxt'); ?> </h2> <?php //We exit after the version check if there is an action the user needs to take before saving settings if (!$this->version_check(get_option($this->unique_prefix . '_version'))) { return; } ?> <form action="options-general.php?page=breadcrumb_navxt" method="post" id="bcn_admin-options"> <?php settings_fields('bcn_options'); ?> <div id="hasadmintabs"> <fieldset id="general" class="bcn_options"> <h3><?php _e('General', 'breadcrumb_navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Breadcrumb Separator', 'breadcrumb_navxt'), 'hseparator', '32', false, __('Placed in between each breadcrumb.', 'breadcrumb_navxt')); $this->input_text(__('Breadcrumb Max Title Length', 'breadcrumb_navxt'), 'amax_title_length', '10'); ?> <tr valign="top"> <th scope="row"> <?php _e('Home Breadcrumb', 'breadcrumb_navxt'); ?> </th> <td> <label> <input name="bcn_options[bhome_display]" type="checkbox" id="bhome_display" value="true" <?php checked(true, $this->opt['bhome_display']); ?> /> <?php _e('Place the home breadcrumb in the trail.', 'breadcrumb_navxt'); ?> </label><br /> <ul> <li> <label for="Shome_title"> <?php _e('Home Title: ', 'breadcrumb_navxt'); ?> <input type="text" name="bcn_options[Shome_title]" id="Shome_title" value="<?php echo esc_html($this->opt['Shome_title'], ENT_COMPAT, 'UTF-8'); ?> " size="20" /> </label> </li> </ul> </td> </tr> <?php $this->input_text(__('Home Template', 'breadcrumb_navxt'), 'Hhome_template', '64', false, __('The template for the home breadcrumb.', 'breadcrumb_navxt')); $this->input_text(__('Home Template (Unlinked)', 'breadcrumb_navxt'), 'Hhome_template_no_anchor', '64', false, __('The template for the home breadcrumb, used when the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_check(__('Blog Breadcrumb', 'breadcrumb_navxt'), 'bblog_display', __('Place the blog breadcrumb in the trail.', 'breadcrumb_navxt'), get_option('show_on_front') !== "page"); $this->input_text(__('Blog Template', 'breadcrumb_navxt'), 'Hblog_template', '64', get_option('show_on_front') !== "page", __('The template for the blog breadcrumb, used only in static front page environments.', 'breadcrumb_navxt')); $this->input_text(__('Blog Template (Unlinked)', 'breadcrumb_navxt'), 'Hblog_template_no_anchor', '64', get_option('show_on_front') !== "page", __('The template for the blog breadcrumb, used only in static front page environments and when the breadcrumb is not linked.', 'breadcrumb_navxt')); ?> <tr valign="top"> <th scope="row"> <?php _e('Main Site Breadcrumb', 'breadcrumb_navxt'); ?> </th> <td> <label> <input name="bcn_options[bmainsite_display]" type="checkbox" id="bmainsite_display" <?php if (!is_multisite()) { echo 'disabled="disabled" class="disabled"'; } ?> value="true" <?php checked(true, $this->opt['bmainsite_display']); ?> /> <?php _e('Place the main site home breadcrumb in the trail in an multisite setup.', 'breadcrumb_navxt'); ?> </label><br /> <ul> <li> <label for="Smainsite_title"> <?php _e('Main Site Home Title: ', 'breadcrumb_navxt'); ?> <input type="text" name="bcn_options[Smainsite_title]" id="Smainsite_title" <?php if (!is_multisite()) { echo 'disabled="disabled" class="disabled"'; } ?> value="<?php echo htmlentities($this->opt['Smainsite_title'], ENT_COMPAT, 'UTF-8'); ?> " size="20" /> <?php if (!is_multisite()) { ?> <input type="hidden" name="bcn_options[Smainsite_title]" value="<?php echo htmlentities($this->opt['Smainsite_title'], ENT_COMPAT, 'UTF-8'); ?> " /><?php } ?> </label> </li> </ul> </td> </tr> <?php $this->input_text(__('Main Site Home Template', 'breadcrumb_navxt'), 'Hmainsite_template', '64', !is_multisite(), __('The template for the main site home breadcrumb, used only in multisite environments.', 'breadcrumb_navxt')); $this->input_text(__('Main Site Home Template (Unlinked)', 'breadcrumb_navxt'), 'Hmainsite_template_no_anchor', '64', !is_multisite(), __('The template for the main site home breadcrumb, used only in multisite environments and when the breadcrumb is not linked.', 'breadcrumb_navxt')); ?> </table> </fieldset> <fieldset id="current" class="bcn_options"> <h3><?php _e('Current Item', 'breadcrumb_navxt'); ?> </h3> <table class="form-table"> <?php $this->input_check(__('Link Current Item', 'breadcrumb_navxt'), 'bcurrent_item_linked', __('Yes')); //$this->input_text(__('Current Item Template', 'breadcrumb_navxt'), 'Hcurrent_item_template', '64', false, __('The template for current item breadcrumbs.', 'breadcrumb_navxt')); //$this->input_text(__('Current Item Template (Unlinked)', 'breadcrumb_navxt'), 'Hcurrent_item_template_no_anchor', '64', false, __('The template for current item breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_check(__('Paged Breadcrumb', 'breadcrumb_navxt'), 'bpaged_display', __('Include the paged breadcrumb in the breadcrumb trail.', 'breadcrumb_navxt'), false, __('Indicates that the user is on a page other than the first on paginated posts/pages.', 'breadcrumb_navxt')); $this->input_text(__('Paged Template', 'breadcrumb_navxt'), 'Hpaged_template', '64', false, __('The template for paged breadcrumbs.', 'breadcrumb_navxt')); ?> </table> </fieldset> <fieldset id="single" class="bcn_options"> <h3><?php _e('Posts & Pages', 'breadcrumb_navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Post Template', 'breadcrumb_navxt'), 'Hpost_post_template', '64', false, __('The template for post breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Post Template (Unlinked)', 'breadcrumb_navxt'), 'Hpost_post_template_no_anchor', '64', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_check(__('Post Taxonomy Display', 'breadcrumb_navxt'), 'bpost_post_taxonomy_display', __('Show the taxonomy leading to a post in the breadcrumb trail.', 'breadcrumb_navxt')); ?> <tr valign="top"> <th scope="row"> <?php _e('Post Taxonomy', 'breadcrumb_navxt'); ?> </th> <td> <?php $this->input_radio('Spost_post_taxonomy_type', 'category', __('Categories')); $this->input_radio('Spost_post_taxonomy_type', 'date', __('Dates')); $this->input_radio('Spost_post_taxonomy_type', 'post_tag', __('Tags')); $this->input_radio('Spost_post_taxonomy_type', 'page', __('Pages')); //Loop through all of the taxonomies in the array foreach ($wp_taxonomies as $taxonomy) { //We only want custom taxonomies if (($taxonomy->object_type == 'post' || is_array($taxonomy->object_type) && in_array('post', $taxonomy->object_type)) && !$taxonomy->_builtin) { $this->input_radio('Spost_post_taxonomy_type', $taxonomy->name, mb_convert_case(__($taxonomy->label), MB_CASE_TITLE, 'UTF-8')); } } ?> <span class="setting-description"><?php _e('The taxonomy which the breadcrumb trail will show.', 'breadcrumb_navxt'); ?> </span> </td> </tr> <?php $this->input_text(__('Page Template', 'breadcrumb_navxt'), 'Hpost_page_template', '64', false, __('The template for page breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Page Template (Unlinked)', 'breadcrumb_navxt'), 'Hpost_page_template_no_anchor', '64', false, __('The template for page breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_text(__('Attachment Template', 'breadcrumb_navxt'), 'Hpost_attachment_template', '64', false, __('The template for attachment breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Attachment Template (Unlinked)', 'breadcrumb_navxt'), 'Hpost_attachment_template_no_anchor', '64', false, __('The template for attachment breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); ?> </table> </fieldset> <?php //Loop through all of the post types in the array foreach ($wp_post_types as $post_type) { //We only want custom post types if (!$post_type->_builtin) { //If the post type does not have settings in the options array yet, we need to load some defaults if (!array_key_exists('Hpost_' . $post_type->name . '_template', $this->opt) || !$post_type->hierarchical && !array_key_exists('Spost_' . $post_type->name . '_taxonomy_type', $this->opt)) { //Add the necessary option array members $this->opt['Hpost_' . $post_type->name . '_template'] = __('<a title="Go to %title%." href="%link%">%htitle%</a>', 'breadcrumb_navxt'); $this->opt['Hpost_' . $post_type->name . '_template_no_anchor'] = __('%htitle%', 'breadcrumb_navxt'); $this->opt['bpost_' . $post_type->name . '_archive_display'] = $post_type->has_archive; //Do type dependent tasks if ($post_type->hierarchical) { //Set post_root for hierarchical types $this->opt['apost_' . $post_type->name . '_root'] = get_option('page_on_front'); } else { //Set post_root for flat types $this->opt['apost_' . $post_type->name . '_root'] = get_option('page_for_posts'); //Default to not displaying a taxonomy $this->opt['bpost_' . $post_type->name . '_taxonomy_display'] = false; //Loop through all of the possible taxonomies foreach ($wp_taxonomies as $taxonomy) { //Activate the first taxonomy valid for this post type and exit the loop if ($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type)) { $this->opt['bpost_' . $post_type->name . '_taxonomy_display'] = true; $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = $taxonomy->name; break; } } //If there are no valid taxonomies for this type, we default to not displaying taxonomies for this post type if (!isset($this->opt['Spost_' . $post_type->name . '_taxonomy_type'])) { $this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'date'; } } } ?> <fieldset id="post_<?php echo $post_type->name; ?> " class="bcn_options"> <h3><?php echo $post_type->labels->singular_name; ?> </h3> <table class="form-table"> <?php $this->input_text(sprintf(__('%s Template', 'breadcrumb_navxt'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template', '64', false, sprintf(__('The template for %s breadcrumbs.', 'breadcrumb_navxt'), strtolower(__($post_type->labels->singular_name)))); $this->input_text(sprintf(__('%s Template (Unlinked)', 'breadcrumb_navxt'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template_no_anchor', '64', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt'), strtolower(__($post_type->labels->singular_name)))); $optid = $this->get_valid_id('apost_' . $post_type->name . '_root'); ?> <tr valign="top"> <th scope="row"> <label for="<?php echo $optid; ?> "><?php printf(__('%s Root Page', 'breadcrumb_navxt'), $post_type->labels->singular_name); ?> </label> </th> <td> <?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'])); ?> </td> </tr> <?php $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'), strtolower(__($post_type->labels->singular_name))), !$post_type->has_archive); //If it is flat, we need a taxonomy selection if (!$post_type->hierarchical) { $this->input_check(sprintf(__('%s Taxonomy Display', 'breadcrumb_navxt'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_display', sprintf(__('Show the taxonomy leading to a %s in the breadcrumb trail.', 'breadcrumb_navxt'), strtolower(__($post_type->labels->singular_name)))); ?> <tr valign="top"> <th scope="row"> <?php printf(__('%s Taxonomy', 'breadcrumb_navxt'), $post_type->labels->singular_name); ?> </th> <td> <?php $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'date', __('Dates')); $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', 'page', __('Pages')); //Loop through all of the taxonomies in the array foreach ($wp_taxonomies as $taxonomy) { //We only want custom taxonomies if ($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type)) { $this->input_radio('Spost_' . $post_type->name . '_taxonomy_type', $taxonomy->name, $taxonomy->labels->singular_name); } } ?> <span class="setting-description"><?php _e('The taxonomy which the breadcrumb trail will show.', 'breadcrumb_navxt'); ?> </span> </td> </tr> <?php } ?> </table> </fieldset> <?php } } ?> <fieldset id="tax" class="bcn_options alttab"> <h3><?php _e('Categories & Tags', 'breadcrumb_navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Category Template', 'breadcrumb_navxt'), 'Hcategory_template', '64', false, __('The template for category breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Category Template (Unlinked)', 'breadcrumb_navxt'), 'Hcategory_template_no_anchor', '64', false, __('The template for category breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_text(__('Tag Template', 'breadcrumb_navxt'), 'Hpost_tag_template', '64', false, __('The template for tag breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Tag Template (Unlinked)', 'breadcrumb_navxt'), 'Hpost_tag_template_no_anchor', '64', false, __('The template for tag breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); ?> </table> </fieldset> <?php //Loop through all of the taxonomies in the array foreach ($wp_taxonomies as $taxonomy) { //We only want custom taxonomies if (!$taxonomy->_builtin) { //If the taxonomy does not have settings in the options array yet, we need to load some defaults if (!array_key_exists('H' . $taxonomy->name . '_template', $this->opt)) { //Add the necessary option array members $this->opt['H' . $taxonomy->name . '_template'] = __(sprintf('<a title="Go to the %%title%% %s archives." href="%%link%%">%%htitle%%</a>', $taxonomy->labels->singular_name), 'breadcrumb_navxt'); $this->opt['H' . $taxonomy->name . '_template_no_anchor'] = __(sprintf('%%htitle%%', $taxonomy->labels->singular_name), 'breadcrumb_navxt'); } ?> <fieldset id="<?php echo $taxonomy->name; ?> " class="bcn_options alttab"> <h3><?php echo mb_convert_case(__($taxonomy->label), MB_CASE_TITLE, 'UTF-8'); ?> </h3> <table class="form-table"> <?php $this->input_text(sprintf(__('%s Template', 'breadcrumb_navxt'), $taxonomy->labels->singular_name), 'H' . $taxonomy->name . '_template', '64', false, sprintf(__('The template for %s breadcrumbs.', 'breadcrumb_navxt'), strtolower(__($taxonomy->label)))); $this->input_text(sprintf(__('%s Template (Unlinked)', 'breadcrumb_navxt'), $taxonomy->labels->singular_name), 'H' . $taxonomy->name . '_template_no_anchor', '64', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt'), strtolower(__($taxonomy->label)))); ?> </table> </fieldset> <?php } } ?> <fieldset id="miscellaneous" class="bcn_options"> <h3><?php _e('Miscellaneous', 'breadcrumb_navxt'); ?> </h3> <table class="form-table"> <?php $this->input_text(__('Author Template', 'breadcrumb_navxt'), 'Hauthor_template', '64', false, __('The template for author breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Author Template (Unlinked)', 'breadcrumb_navxt'), 'Hauthor_template_no_anchor', '64', false, __('The template for author breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); $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')); $this->input_text(__('Date Template', 'breadcrumb_navxt'), 'Hdate_template', '64', false, __('The template for date breadcrumbs.', 'breadcrumb_navxt')); $this->input_text(__('Date Template (Unlinked)', 'breadcrumb_navxt'), 'Hdate_template_no_anchor', '64', false, __('The template for date breadcrumbs, used only when the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_text(__('Search Template', 'breadcrumb_navxt'), 'Hsearch_template', '64', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages.', 'breadcrumb_navxt')); $this->input_text(__('Search Template (Unlinked)', 'breadcrumb_navxt'), 'Hsearch_template_no_anchor', '64', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages and the breadcrumb is not linked.', 'breadcrumb_navxt')); $this->input_text(__('404 Title', 'breadcrumb_navxt'), 'S404_title', '32'); $this->input_text(__('404 Template', 'breadcrumb_navxt'), 'H404_template', '64', false, __('The template for 404 breadcrumbs.', 'breadcrumb_navxt')); ?> </table> </fieldset> </div> <p class="submit"><input type="submit" class="button-primary" name="bcn_admin_options" value="<?php esc_attr_e('Save Changes'); ?> " /></p> </form> <?php //Need to add a separate menu thing for this $this->import_form(); ?> </div> <?php }
function fetch_print() { //Sync our options $this->opt = mtekk_adminKit::parse_args(get_option('llynx_options'), $this->opt); $this->llynx_scrape->opt = $this->opt; //Grab the nonce and check //$nonce = intval($_POST['nonce']); //Clean up the URL $url = esc_url_raw($_POST['url']); //Clean the title $title = esc_attr($_POST['title']); //Clean the image $image = esc_url_raw($_POST['image']); //Clean the description $description = wp_kses($_POST['description'], wp_kses_allowed_html('post')); //Assemble the lynx print and echo echo $this->url_insert_handler($url, $title, $description, $image, false); die; }
function wp_loaded() { parent::wp_loaded(); }