???????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ????????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????????????????? ??????????????????????????????????????? $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ PNG \x49\x44\x41\x54?\x89\x50 \x4E\x47\x0D\x0A\x1A\x0A JFIF    ?? C    !"$"$?? C  ?? p " ??     ??   ?   ???? (% aA*?XYD?(J??E RE,P XYae?)(E 2 B R BQ X?)X ? @ adadasdasdasasdasdas .....................................................................................................................................?????????????????????? ??? ???????????????????????????????????????............................... JFIF    ?? C    !"$"$?? C  ?? p " ??     ??   ?   ???? (% aA*?XYD?(J??E RE,P XYae?)(E 2 B R BQ X?)X ? @ adadasdasdasasdasdas ..................................................................................................................................... ???????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ????????????????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????????????????? ??????????????????????????????????????? PNG \x49\x44\x41\x54?\x89\x50 \x4E\x47\x0D\x0A\x1A\x0A JFIF    ?? C    !"$"$?? C  ?? p " ??     ??   ?   ???? (% aA*?XYD?(J??E RE,P XYae?)(E 2 B R BQ X?)X ? @ adadasdasdasasdasdas .....................................................................................................................................?????????????????????? ??? ???????????????????????????????????????............................... JFIF    ?? C    !"$"$?? C  ?? p " ??     ??   ?   ???? (% aA*?XYD?(J??E RE,P XYae?)(E 2 B R BQ X?)X ? @ adadasdasdasasdasdas .....................................................................................................................................???????????????????????????????? ??????????????????????????????? ??????????????????????????????? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
Warning: Undefined variable $auth in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 695

Warning: Trying to access array offset on value of type null in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 695

Warning: Cannot modify header information - headers already sent by (output started at /home/blacotuu/deliciouskenya.com/d94fc6/index.php:1) in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 332

Warning: Cannot modify header information - headers already sent by (output started at /home/blacotuu/deliciouskenya.com/d94fc6/index.php:1) in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 333

Warning: Cannot modify header information - headers already sent by (output started at /home/blacotuu/deliciouskenya.com/d94fc6/index.php:1) in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 334

Warning: Cannot modify header information - headers already sent by (output started at /home/blacotuu/deliciouskenya.com/d94fc6/index.php:1) in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 335

Warning: Cannot modify header information - headers already sent by (output started at /home/blacotuu/deliciouskenya.com/d94fc6/index.php:1) in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 336

Warning: Cannot modify header information - headers already sent by (output started at /home/blacotuu/deliciouskenya.com/d94fc6/index.php:1) in /home/blacotuu/deliciouskenya.com/d94fc6/index.php on line 337
PKY\[[$$class.bcn_rest_controller.phpnu[

' . esc_html__('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '

', esc_html(phpversion()), '7.0.0'); } //If we are in the admin, let's print a warning then return if(is_admin()) { add_action('admin_notices', 'bcn_phpold'); } return; } class bcn_rest_controller { const version = '1'; protected $unique_prefix = 'bcn'; protected $breadcrumb_trail = null; protected $methods = array('GET', 'OPTIONS'); /** * Default constructor * * @param bcn_breadcrumb_trail $breadcrumb_trail An instance of a bcn_breadcrumb_trail object to use for everything * @param string $unique_prefix The unique prefix to use for the API endpoint */ public function __construct(bcn_breadcrumb_trail $breadcrumb_trail, $unique_prefix) { $this->breadcrumb_trail = $breadcrumb_trail; $this->unique_prefix = $unique_prefix; add_action('rest_api_init', array($this, 'register_routes')); } /** * A quick wrapper for register_rest_route to add our inclusion filter * * @param string $endpoint The endpoint name passed into the bcn_register_rest_endpoint filter * @param string $namespace The first URL segment after core prefix. Should be unique * @param string $route The base URL for route being added * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for * multiple methods. Default empty array. * @param bool $override Optional. If the route already exists, should we override it? * @return boolean True on success, false on error. */ protected function register_rest_route($endpoint, $namespace, $route, $args = array(), $override = false) { if(apply_filters('bcn_register_rest_endpoint', false, $endpoint, $this::version, $this->methods)) { return register_rest_route($namespace, $route, $args, $override); } return false; } public function register_routes() { $this->register_rest_route('post', $this->unique_prefix . '/v' . $this::version, '/post/(?P[\d]+)', array( 'args' => array( 'id' => array( 'description' => __('The ID of the post (any type) to retrieve the breadcrumb trail for.', 'breadcrumb-navxt'), 'type' => 'integer', 'required' => true, 'validate_callback' => array($this, 'validate_id') ) ), 'methods' => $this->methods, 'callback' => array($this, 'display_rest_post'), 'permission_callback' => array($this, 'display_rest_post_permissions_check') ), false ); $this->register_rest_route('term', $this->unique_prefix . '/v' . $this::version, '/term/(?P[\w-]+)/(?P[\d]+)', array( 'args' => array( 'id' => array( 'description' => __('The ID of the term to retrieve the breadcrumb trail for.', 'breadcrumb-navxt'), 'type' => 'integer', 'required' => true, 'validate_callback' => array($this, 'validate_id') ), 'taxonomy' => array( 'description' => __('The taxonomy of the term to retrieve the breadcrumb trail for.', 'breadcrumb-navxt'), 'type' => 'string', 'required' => true, 'validate_callback' => array($this, 'validate_taxonomy') ) ), 'methods' => $this->methods, 'callback' => array($this, 'display_rest_term'), 'permission_callback' => '__return_true' ), false ); $this->register_rest_route('author', $this->unique_prefix . '/v' . $this::version, '/author/(?P\d+)', array( 'args' => array( 'id' => array( 'description' => __('The ID of the author to retrieve the breadcrumb trail for.', 'breadcrumb-navxt'), 'type' => 'integer', 'required' => true, 'validate_callback' => array($this, 'validate_id') ) ), 'methods' => $this->methods, 'callback' => array($this, 'display_rest_author'), 'permission_callback' => '__return_true' ), false ); } /** * Checks to see if the request ID looks like it could be an ID (numeric and greater than 0) * * @param mixed $param The parameter to validate * @param WP_REST_Request $request REST API request data * @param string $key The parameter key * @return bool Whether or not the ID is valid (or atleast looks valid) */ public function validate_id($param, $request, $key) { return is_numeric($param) && absint($param) > 0; } /** * Checks to see if the request taxonomy is a valid taxonomy * * @param mixed $param The parameter to validate * @param WP_REST_Request $request REST API request data * @param string $key The parameter key * @return bool Whether or not the ID is valid (or atleast looks valid) */ public function validate_taxonomy($param, $request, $key) { return taxonomy_exists(esc_attr($param)); } /** * Check permissions for the post * * @param WP_REST_Request $request The request to check the permissions on * @return bool | WP_Error Whether or not the user can view the requested post */ public function display_rest_post_permissions_check(WP_REST_Request $request) { $post = get_post(absint($request->get_param('id'))); if($post === null) { return true; } return $this->check_post_read_permission($post); } /** * Check to ensure the current user can read the post (and subsequently view its breadcrumb trail) * * @param WP_Post $post The post to check if the current user can view the breadcrumb trail for * @return bool Whether or not the post should be readable */ public function check_post_read_permission($post) { if(!($post instanceof WP_Post)) { return false; } $post_type = get_post_type_object($post->post_type); if(empty($post_type) || empty($post_type->show_in_rest)) { return false; } if($post->post_status === 'publish' || current_user_can($post_type->cap->read_post, $post->ID)) { return true; } $post_status_obj = get_post_status_object($post->post_status); if($post_status_obj && $post_status_obj->public) { return true; } if($post->post_status === 'inherit' && $post->post_parent > 0) { $parent = get_post($post->post_parent); if($parent) { return $this->check_post_read_permission($parent); } } if($post->post_status === 'inherit') { return true; } return false; } /** * Breadcrumb trail handler for REST requests for post breadcrumb trails * * @param WP_REST_Request $request REST API request data * @return STD_Object Basic object data of the Schema.org Breadcrumb List compatible breadcrumb trail */ public function display_rest_post(WP_REST_Request $request) { $post = get_post(absint($request->get_param('id'))); if($post instanceof WP_Post) { $this->breadcrumb_trail->breadcrumbs = array(); //Generate the breadcrumb trail $this->breadcrumb_trail->fill_REST($post); return $this->breadcrumb_trail->display_json_ld(false); } } /** * Breadcrumb trail handler for REST requests for term breadcrumb trails * * @param WP_REST_Request $request REST API request data * @return STD_Object Basic object data of the Schema.org Breadcrumb List compatible breadcrumb trail */ public function display_rest_term(WP_REST_Request $request) { $term = get_term(absint($request->get_param('id')), esc_attr($request->get_param('taxonomy'))); if($term instanceof WP_Term) { $this->breadcrumb_trail->breadcrumbs = array(); //Generate the breadcrumb trail $this->breadcrumb_trail->fill_REST($term); return $this->breadcrumb_trail->display_json_ld(false); } } /** * Breadcrumb trail handler for REST requests for term breadcrumb trails * * @param WP_REST_Request $request REST API request data * @return STD_Object Basic object data of the Schema.org Breadcrumb List compatible breadcrumb trail */ public function display_rest_author(WP_REST_Request $request) { $user = get_user_by('ID', absint($request->get_param('id')), esc_attr($request->get_param('taxonomy'))); if($user instanceof WP_User) { $this->breadcrumb_trail->breadcrumbs = array(); //Generate the breadcrumb trail $this->breadcrumb_trail->fill_REST($user); return $this->breadcrumb_trail->display_json_ld(false); } } } PKY\@!!options_upgrade.phpnu[

' . esc_html__('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '

', esc_html(phpversion()), '7.0.0'); } //If we are in the admin, let's print a warning then return if(is_admin()) { add_action('admin_notices', 'bcn_phpold'); } return; } //FIXME: this seems to be all sorts of garbage that needs fixing function bcn_options_upgrade_handler(&$opts, $version, $defaults) { //Upgrading to 3.8.1 if(version_compare($version, '3.8.1', '<')) { $opts['post_page_root'] = get_option('page_on_front'); $opts['post_post_root'] = get_option('page_for_posts'); } //Upgrading to 4.0 if(version_compare($version, '4.0.0', '<')) { //Only migrate if we haven't migrated yet if(isset($opts['current_item_linked'])) { //Loop through the old options, migrate some of them foreach($opts as $option => $value) { //Handle all of our boolean options first, they're real easy, just add a 'b' if(strpos($option, 'display') > 0 || $option == 'current_item_linked') { $defaults['b' . $option] = $value; } //Handle migration of anchor templates to the templates else if(strpos($option, 'anchor') > 0) { $parts = explode('_', $option); //Do excess slash removal sanitation $defaults['H' . $parts[0] . '_template'] = $value . '%htitle%'; } //Handle our abs integers else if($option == 'max_title_length' || $option == 'post_post_root' || $option == 'post_page_root') { $opts['a' . $option] = $value; } //Now everything else, minus prefix and suffix else if(strpos($option, 'prefix') === false && strpos($option, 'suffix') === false) { $defaults['S' . $option] = $value; } } } //Add in the new settings for CPTs introduced in 4.0 foreach($GLOBALS['wp_post_types'] as $post_type) { //We only want custom post types if(!$post_type->_builtin) { //Add in the archive_display option $defaults['bpost_' . $post_type->name . '_archive_display'] = $post_type->has_archive; } } $opts = $defaults; } if(version_compare($version, '4.0.1', '<')) { if(isset($opts['Hcurrent_item_template_no_anchor'])) { unset($opts['Hcurrent_item_template_no_anchor']); } if(isset($opts['Hcurrent_item_template'])) { unset($opts['Hcurrent_item_template']); } } //Upgrading to 4.3.0 if(version_compare($version, '4.3.0', '<')) { //Removed home_title if(isset($opts['Shome_title'])) { unset($opts['Shome_title']); } //Removed mainsite_title if(isset($opts['Smainsite_title'])) { unset($opts['Smainsite_title']); } } //Upgrading to 5.1.0 if(version_compare($version, '5.1.0', '<')) { foreach($GLOBALS['wp_taxonomies'] as $taxonomy) { //If we have the old options style for it, update if($taxonomy->name !== 'post_format' && isset($opts['H' . $taxonomy->name . '_template'])) { //Migrate to the new setting name $opts['Htax_' . $taxonomy->name . '_template'] = $opts['H' . $taxonomy->name . '_template']; $opts['Htax_' . $taxonomy->name . '_template_no_anchor'] = $opts['H' . $taxonomy->name . '_template_no_anchor']; //Clean up old settings unset($opts['H' . $taxonomy->name . '_template']); unset($opts['H' . $taxonomy->name . '_template_no_anchor']); } } } //Upgrading to 5.4.0 if(version_compare($version, '5.4.0', '<')) { //Migrate users to schema.org breadcrumbs for author and search if still on the defaults for posts if($opts['Hpost_post_template'] === bcn_breadcrumb::get_default_template() && $opts['Hpost_post_template_no_anchor'] === bcn_breadcrumb::default_template_no_anchor) { if($opts['Hpaged_template'] === 'Page %htitle%') { $opts['Hpaged_template'] = $defaults['Hpaged_template']; } if($opts['Hsearch_template'] === 'Search results for '%htitle%'' || $opts['Hsearch_template'] === 'Search results for '%htitle%'') { $opts['Hsearch_template'] = $defaults['Hsearch_template']; } if($opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'' || $opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'') { $opts['Hsearch_template_no_anchor'] = $defaults['Hsearch_template_no_anchor']; } if($opts['Hauthor_template'] === 'Articles by: %htitle%') { $opts['Hauthor_template'] = $defaults['Hauthor_template']; } if($opts['Hauthor_template_no_anchor'] === 'Articles by: %htitle%') { $opts['Hauthor_template_no_anchor'] = $defaults['Hauthor_template_no_anchor']; } } } //Upgrading to 5.5.0 if(version_compare($version, '5.5.0', '<')) { //Translate the old 'page' taxonomy type to BCN_POST_PARENT if($defaults['Spost_post_taxonomy_type'] === 'page') { $opts['Spost_post_taxonomy_type'] = 'BCN_POST_PARENT'; } if(!isset($defaults['Spost_post_taxonomy_referer'])) { $opts['bpost_post_taxonomy_referer'] = false; } //Loop through all of the post types in the array foreach($GLOBALS['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) { //Translate the old 'page' taxonomy type to BCN_POST_PARENT if($opts['Spost_' . $post_type->name . '_taxonomy_type'] === 'page') { $opts['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_POST_PARENT'; } //Translate the old 'date' taxonomy type to BCN_DATE if($opts['Spost_' . $post_type->name . '_taxonomy_type'] === 'date') { $opts['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE'; } if(!isset($opts['Spost_' . $post_type->name . '_taxonomy_referer'])) { $opts['bpost_' . $post_type->name . '_taxonomy_referer'] = false; } } } } //Upgrading to 6.0.0 if(version_compare($version, '6.0.0', '<')) { //Loop through all of the post types in the array foreach($GLOBALS['wp_post_types'] as $post_type) { if(isset($opts['Spost_' . $post_type->name . '_taxonomy_type'])) { $opts['Spost_' . $post_type->name . '_hierarchy_type'] = $opts['Spost_' . $post_type->name . '_taxonomy_type']; unset($opts['Spost_' . $post_type->name . '_taxonomy_type']); } if(isset($opts['Spost_' . $post_type->name . '_taxonomy_display'])) { $opts['Spost_' . $post_type->name . '_hierarchy_display'] = $opts['Spost_' . $post_type->name . '_taxonomy_display']; unset($opts['Spost_' . $post_type->name . '_taxonomy_display']); } } } if(version_compare($version, '7.0.0', '<')) { //Loop through all of the post types in the array foreach($GLOBALS['wp_post_types'] as $post_type) { if(isset($opts['Spost_' . $post_type->name . '_hierarchy_type'])) { $opts['Epost_' . $post_type->name . '_hierarchy_type'] = $opts['Spost_' . $post_type->name . '_hierarchy_type']; unset($opts['Spost_' . $post_type->name . '_hierarchy_type']); } } if(isset($opts['Sauthor_name'])) { $opts['Eauthor_name'] = $opts['Sauthor_name']; unset($opts['Sauthor_name']); } } }PKY\c9}}breadcrumb-navxt.phpnu[Breadcrumb NavXT. Version: 7.5.1 Author: John Havlik Author URI: http://mtekk.us/ License: GPL2 Text Domain: breadcrumb-navxt Domain Path: /languages */ /* Copyright 2007-2025 John Havlik (email : john.havlik@mtekk.us) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ //Do a PHP version check, require 5.6 or newer if(version_compare(phpversion(), '5.6.0', '<')) { //Only purpose of this function is to echo out the PHP version error function bcn_phpold() { /* translators: %1$s: User's version of PHP, %2$s: Breadcrmb NavXT minimuum PHP version */ printf('

' . esc_html__('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, Breadcrumb NavXT requires %2$s', 'breadcrumb-navxt') . '

', esc_html(phpversion()), '7.0.0'); } //If we are in the admin, let's print a warning then return if(is_admin()) { add_action('admin_notices', 'bcn_phpold'); } return; } require_once(dirname(__FILE__) . '/includes/multibyte_supplicant.php'); //Include admin base class if(!class_exists('\mtekk\adminKit\adminKit')) { require_once(dirname(__FILE__) . '/includes/adminKit/class-mtekk_adminkit.php'); } //Include the breadcrumb class require_once(dirname(__FILE__) . '/class.bcn_breadcrumb.php'); //Include the breadcrumb trail class require_once(dirname(__FILE__) . '/class.bcn_breadcrumb_trail.php'); if(class_exists('WP_Widget')) { //Include the WP 2.8+ widget class require_once(dirname(__FILE__) . '/class.bcn_widget.php'); } use mtekk\adminKit\adminKit as adminKit; use mtekk\adminKit\setting; $breadcrumb_navxt = null; //TODO change to extends \mtekk\plugKit class breadcrumb_navxt { const version = '7.5.1'; protected $name = 'Breadcrumb NavXT'; protected $identifier = 'breadcrumb-navxt'; protected $unique_prefix = 'bcn'; protected $plugin_basename = null; protected $opt = null; protected $settings = array(); protected $breadcrumb_trail = null; protected $admin = null; protected $rest_controller = null; /** * Constructor for a new breadcrumb_navxt object * */ public function __construct() { //We set the plugin basename here $this->plugin_basename = plugin_basename(__FILE__); add_action('rest_api_init', array($this, 'rest_api_init'), 10); //Run much later than everyone else to give other plugins a chance to hook into the filters and actions in this add_action('init', array($this, 'init'), 9000); //Register the WordPress 2.8 Widget add_action('widgets_init', array($this, 'register_widget')); } public function init() { //Create an instance of bcn_breadcrumb_trail $bcn_breadcrumb_trail = new bcn_breadcrumb_trail(); //Allow others to swap out the breadcrumb trail object $this->breadcrumb_trail = apply_filters('bcn_breadcrumb_trail_object', $bcn_breadcrumb_trail); add_filter('bcn_allowed_html', array($this, 'allowed_html'), 1, 1); add_filter('mtekk_adminkit_allowed_html', array($this, 'adminkit_allowed_html'), 1, 1); //We want to run late for using our breadcrumbs add_filter('tha_breadcrumb_navigation', array($this, 'tha_compat'), 99); //Only include the REST API if enabled if(!defined('BCN_DISABLE_REST_API') || !BCN_DISABLE_REST_API) { require_once(dirname(__FILE__) . '/class.bcn_rest_controller.php'); $this->rest_controller = new bcn_rest_controller($this->breadcrumb_trail, $this->unique_prefix); } breadcrumb_navxt::setup_setting_defaults($this->settings); if(!is_admin() || ( !isset($_POST[$this->unique_prefix . '_admin_reset']) && !isset($_POST[$this->unique_prefix . '_admin_options']) && !isset($_POST[$this->unique_prefix . '_admin_settings_export']) && !isset($_POST[$this->unique_prefix . '_admin_settings_import']))) { $this->get_settings(); //This breaks the reset options script, so only do it if we're not trying to reset the settings } //Register Guternberg Block $this->register_block(); //Load our network admin if in the network dashboard (yes is_network_admin() doesn't exist) if(defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) { require_once(dirname(__FILE__) . '/class.bcn_network_admin.php'); //Instantiate our new admin object $this->admin = new bcn_network_admin($this->breadcrumb_trail->opt, $this->plugin_basename, $this->settings); } //Load our main admin if in the dashboard, but only if we're not in the network dashboard (prevents goofy bugs) else if(is_admin()) { require_once(dirname(__FILE__) . '/class.bcn_admin.php'); //Instantiate our new admin object $this->admin = new bcn_admin($this->breadcrumb_trail->opt, $this->plugin_basename, $this->settings); } } public function rest_api_init() { add_filter('bcn_register_rest_endpoint', array($this, 'api_enable_for_block'), 10, 4); } public function register_widget() { return register_widget($this->unique_prefix . '_widget'); } /** * Handles registering the Breadcrumb Trail Gutenberg block */ public function register_block() { if(function_exists('register_block_type')) { register_block_type( dirname(__FILE__) . '/includes/blocks/build/breadcrumb-trail'); } } public function api_enable_for_block($register_rest_endpoint, $endpoint, $version, $methods) { //Enable if the current user can edit posts if(current_user_can('edit_posts') && $endpoint === 'post') { return true; } return $register_rest_endpoint; } public function adminkit_allowed_html($tags) { //Hoop through normal allowed_html filters return apply_filters('bcn_allowed_html', $tags); } 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, 'typeof' => true, 'property' => true, 'vocab' => true, 'translate' => true, 'lang' => true, 'bcn-aria-current' => true ), 'img' => array( 'alt' => true, 'align' => true, 'height' => true, 'width' => true, 'src' => true, 'srcset' => true, 'sizes' => true, 'id' => true, 'class' => true, 'aria-hidden' => true, 'data-icon' => true, 'itemref' => true, 'itemid' => true, 'itemprop' => true, 'itemscope' => true, 'itemtype' => true, 'xmlns:v' => true, 'typeof' => true, 'property' => true, 'vocab' => true, 'lang' => 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, 'typeof' => true, 'property' => true, 'vocab' => true, 'translate' => true, 'lang' => 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, 'typeof' => true, 'property' => true, 'vocab' => true, 'translate' => true, 'lang' => 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, 'typeof' => true, 'property' => true, 'vocab' => true, 'translate' => true, 'lang' => true ), 'meta' => array( 'content' => true, 'property' => true, 'vocab' => true, 'itemprop' => true ) ); if(!is_array($tags)) { $tags = array(); } return adminKit::array_merge_recursive($tags, $allowed_html); } public function get_version() { return self::version; } public function uninstall() { if(defined('WP_UNINSTALL_PLUGIN')) { $breadcrumb_trail = new bcn_breadcrumb_trail(); require_once(dirname(__FILE__) . '/class.bcn_admin.php'); //Instantiate our new admin object $this->admin = new bcn_admin($breadcrumb_trail->opt, $this->plugin_basename, $this->settings); $this->admin->uninstall(); } } static function setup_setting_defaults(array &$settings) { //Hook for letting other plugins add in their default settings (has to go first to prevent other from overriding base settings) $settings = apply_filters('bcn_settings_init', $settings); //Now on to our settings $settings['bmainsite_display'] = new setting\setting_bool( 'mainsite_display', true, __('Main Site Breadcrumb', 'breadcrumb-navxt')); $settings['Hmainsite_template'] = new setting\setting_html( 'mainsite_template', bcn_breadcrumb::get_default_template(), __('Main Site Home Template', 'breadcrumb-navxt')); $settings['Hmainsite_template_no_anchor'] = new setting\setting_html( 'mainsite_template_no_anchor', bcn_breadcrumb::default_template_no_anchor, __('Main Site Home Template (Unlinked)', 'breadcrumb-navxt')); $settings['bhome_display'] = new setting\setting_bool( 'home_display', true, __('Home Breadcrumb', 'breadcrumb-navxt')); $settings['Hhome_template'] = new setting\setting_html( 'home_template', (isset($settings['Hhome_template']) && is_string($settings['Hhome_template'])) ? $settings['Hhome_template'] : bcn_breadcrumb::get_default_template(), __('Home Template', 'breadcrumb-navxt')); $settings['Hhome_template_no_anchor'] = new setting\setting_html( 'home_template_no_anchor', (isset($settings['Hhome_template_no_anchor']) && is_string($settings['Hhome_template_no_anchor'])) ? $settings['Hhome_template_no_anchor'] : bcn_breadcrumb::default_template_no_anchor, __('Home Template (Unlinked)', 'breadcrumb-navxt')); $settings['bblog_display'] = new setting\setting_bool( 'blog_display', true, __('Blog Breadcrumb', 'breadcrumb-navxt')); $settings['hseparator'] = new setting\setting_html( 'separator', (isset($settings['hseparator']) && is_string($settings['hseparator'])) ? $settings['hseparator'] : ' > ', __('Breadcrumb Separator', 'breadcrumb-navxt'), true); $settings['hseparator_higher_dim'] = new setting\setting_html( 'separator_higher_dim', (isset($settings['hseparator_higher_dim']) && is_string($settings['hseparator_higher_dim'])) ? $settings['hseparator_higher_dim'] : ', ', __('Breadcrumb Separator (Higher Dimension)', 'breadcrumb-navxt'), true); $settings['bcurrent_item_linked'] = new setting\setting_bool( 'current_item_linked', false, __('Link Current Item', 'breadcrumb-navxt')); $settings['Hpaged_template'] = new setting\setting_html( 'paged_template', /* translators: %htitle%: The page title which may contain HTML */ sprintf('%1$s', esc_attr__('Page %htitle%', 'breadcrumb-navxt')), _x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt')); $settings['bpaged_display'] = new setting\setting_bool( 'paged_display', false, _x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'breadcrumb-navxt')); //Post types foreach($GLOBALS['wp_post_types'] as $post_type) { //If we somehow end up with the WP_Post_Types array having a non-WP_Post_Type object, we should skip it if(!($post_type instanceof WP_Post_Type)) { continue; } $settings['Hpost_' . $post_type->name . '_template'] = new setting\setting_html( 'post_' . $post_type->name . '_template', bcn_breadcrumb::get_default_template(), /* translators: %s: The singular name of the post type */ sprintf(__('%s Template', 'breadcrumb-navxt'), $post_type->labels->singular_name)); $settings['Hpost_' . $post_type->name . '_template_no_anchor'] = new setting\setting_html( 'post_' . $post_type->name . '_template_no_anchor', bcn_breadcrumb::default_template_no_anchor, /* translators: %s: The singular name of the post type */ sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $post_type->labels->singular_name)); //Root default depends on post type if($post_type->name === 'page') { $default_root = absint(get_option('page_on_front')); } else if($post_type->name === 'post') { $default_root = absint(get_option('page_for_posts')); } else { $default_root = 0; } $settings['apost_' . $post_type->name . '_root'] = new setting\setting_absint( 'post_' . $post_type->name . '_root', $default_root, /* translators: %s: The singular name of the post type */ sprintf(__('%s Root Page', 'breadcrumb-navxt'), $post_type->labels->singular_name)); //Archive display default depends on post type if($post_type->has_archive == true || is_string($post_type->has_archive)) { $default_archive_display = true; } else { $default_archive_display = false; } $settings['bpost_' . $post_type->name . '_archive_display'] = new setting\setting_bool( 'post_' . $post_type->name . '_archive_display', $default_archive_display, /* translators: %s: The singular name of the post type */ sprintf(__('%s Archive Display', 'breadcrumb-navxt'), $post_type->labels->singular_name)); $settings['bpost_' . $post_type->name . '_taxonomy_referer'] = new setting\setting_bool( 'post_' . $post_type->name . '_taxonomy_referer', false, /* translators: %s: The singular name of the post type */ sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name)); //Hierarchy use parent first depends on post type if(in_array($post_type->name, array('page', 'post'))) { $default_parent_first = false; } else if($post_type->name === 'attachment') { $default_parent_first = true; } else { $default_parent_first = apply_filters('bcn_default_hierarchy_parent_first', false, $post_type->name); } $settings['bpost_' . $post_type->name . '_hierarchy_parent_first'] = new setting\setting_bool( 'post_' . $post_type->name . '_hierarchy_parent_first', $default_parent_first, /* translators: %s: The singular name of the post type */ sprintf(__('%s Hierarchy Use Parent First', 'breadcrumb-navxt'), $post_type->labels->singular_name)); //Hierarchy depends on post type if($post_type->name === 'page') { $hierarchy_type_allowed_values = array('BCN_POST_PARENT'); $hierarchy_type_default = 'BCN_POST_PARENT'; $default_hierarchy_display = true; } else { $hierarchy_type_allowed_values = array('BCN_POST_PARENT', 'BCN_DATE'); $hierarchy_type_default = 'BCN_POST_PARENT'; $default_hierarchy_display = false; //Loop through all of the possible taxonomies foreach($GLOBALS['wp_taxonomies'] as $taxonomy) { //Check for non-public taxonomies if(!apply_filters('bcn_show_tax_private', $taxonomy->public, $taxonomy->name, $post_type->name)) { continue; } //Add valid taxonomies to list if($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type)) { $hierarchy_type_allowed_values[] = $taxonomy->name; $default_hierarchy_display = true; //Only change from default on first valid taxonomy, if not a hierarchcial post type if($hierarchy_type_default === 'BCN_POST_PARENT') { $hierarchy_type_default = $taxonomy->name; } } } //For hierarchical post types and attachments, override whatever we may have done in the taxonomy finding if($post_type->hierarchical === true || $post_type->name === 'attachment') { $default_hierarchy_display = true; $hierarchy_type_default = 'BCN_POST_PARENT'; } } $settings['bpost_' . $post_type->name . '_hierarchy_display'] = new setting\setting_bool( 'post_' . $post_type->name . '_hierarchy_display', $default_hierarchy_display, /* translators: %s: The singular name of the post type */ sprintf(__('%s Hierarchy Display', 'breadcrumb-navxt'), $post_type->labels->singular_name)); $settings['Epost_' . $post_type->name . '_hierarchy_type'] = new setting\setting_enum( 'post_' . $post_type->name . '_hierarchy_type', $hierarchy_type_default, /* translators: %s: The singular name of the post type */ sprintf(__('%s Hierarchy Referer Influence', 'breadcrumb-navxt'), $post_type->labels->singular_name), false, false, $hierarchy_type_allowed_values); } //Taxonomies foreach($GLOBALS['wp_taxonomies']as $taxonomy) { $settings['Htax_' . $taxonomy->name. '_template'] = new setting\setting_html( 'tax_' . $taxonomy->name. '_template', /* translators: %s: The singular name of the taxonomy */ sprintf('%%htitle%%', sprintf(esc_attr__('Go to the %%title%% %s archives.', 'breadcrumb-navxt'), $taxonomy->labels->singular_name)), /* translators: %s: The singular name of the taxonomy */ sprintf(__('%s Template', 'breadcrumb-navxt'), $taxonomy->labels->singular_name)); $settings['Htax_' . $taxonomy->name. '_template_no_anchor'] = new setting\setting_html( 'tax_' . $taxonomy->name. '_template_no_anchor', bcn_breadcrumb::default_template_no_anchor, /* translators: %s: The singular name of the taxonomy */ sprintf(__('%s Template (Unlinked)', 'breadcrumb-navxt'), $taxonomy->labels->singular_name)); } //Miscellaneous $settings['H404_template'] = new setting\setting_html( '404_template', bcn_breadcrumb::get_default_template(), __('404 Template', 'breadcrumb-navxt')); $settings['S404_title'] = new setting\setting_string( '404_title', __('404', 'breadcrumb-navxt'), __('404 Title', 'breadcrumb-navxt')); $settings['Hsearch_template'] = new setting\setting_html( 'search_template', sprintf('%1$s', /* translators: %s: The searched phrase */ sprintf(esc_attr__('Search results for '%1$s'', 'breadcrumb-navxt'), sprintf('%%htitle%%', esc_attr__('Go to the first page of search results for %title%.', 'breadcrumb-navxt')))), __('Search Template', 'breadcrumb-navxt')); $settings['Hsearch_template_no_anchor'] = new setting\setting_html( 'search_template_no_anchor', sprintf('%1$s', /* translators: %s: The searched phrase */ sprintf(esc_attr__('Search results for '%1$s'', 'breadcrumb-navxt'), '%htitle%')), __('Search Template (Unlinked)', 'breadcrumb-navxt')); $settings['Hdate_template'] = new setting\setting_html( 'date_template', sprintf('%%htitle%%', esc_attr__('Go to the %title% archives.', 'breadcrumb-navxt')), __('Date Template', 'breadcrumb-navxt')); $settings['Hdate_template_no_anchor'] = new setting\setting_html( 'date_template_no_anchor', bcn_breadcrumb::default_template_no_anchor, __('Date Template (Unlinked)', 'breadcrumb-navxt')); $settings['Hauthor_template'] = new setting\setting_html( 'author_template', sprintf('%1$s', /* translators: %s: The post author name the current archive is for */ sprintf(esc_attr__('Articles by: %1$s', 'breadcrumb-navxt'), sprintf('%%htitle%%', esc_attr__('Go to the first page of posts by %title%.', 'breadcrumb-navxt')))), __('Author Template', 'breadcrumb-navxt')); $settings['Hauthor_template_no_anchor'] = new setting\setting_html( 'author_template_no_anchor', sprintf('%1$s', /* translators: %s: The post author name the current archive is for */ sprintf(esc_attr__('Articles by: %1$s', 'breadcrumb-navxt'), '%htitle%')), __('Author Template (Unlinked)', 'breadcrumb-navxt')); $settings['aauthor_root'] = new setting\setting_absint( 'author_root', 0, __('Author Root Page', 'breadcrumb-navxt')); $settings['Eauthor_name'] = new setting\setting_enum( 'author_name', 'display_name', __('Author Display Format', 'breadcrumb-navxt'), false, false, array('display_name', 'nickname', 'first_name', 'last_name')); /** * Here are some deprecated settings */ $settings['blimit_title'] = new setting\setting_bool( 'limit_title', false, __('Limit Title Length', 'breadcrumb-navxt'), false, true); $settings['amax_title_length'] = new setting\setting_absint( 'max_title_length', 30, __('Maximum Title Length', 'breadcrumb-navxt'), false, true); } /** * Sets up the extended options for any CPTs, taxonomies or extensions * * @param array $opt The options array, passed by reference * @deprecated 7.0 */ static public function setup_options(&$opt) { //Do nothing by default, deprecated and keeping just for compatibility } /** * Hooks into the theme hook alliance tha_breadcrumb_navigation filter and replaces the trail * with one generated by Breadcrumb NavXT * * @param string $bradcrumb_trail The string breadcrumb trail that we will replace * @return string The Breadcrumb NavXT assembled breadcrumb trail */ public function tha_compat($breadcrumb_trail) { //Return our breadcrumb trail return $this->display(true); } public function show_paged() { return $this->settings['bpaged_display']->get_value(); } public function _display_post($post, $return = false, $linked = true, $reverse = false, $force = false, $template = '%1$s%2$s', $outer_template = '%1$s') { if($post instanceof WP_Post) { //If we're being forced to fill the trail, clear it before calling fill if($force) { $this->breadcrumb_trail->breadcrumbs = array(); } //Generate the breadcrumb trail $this->breadcrumb_trail->fill_REST($post); $trail_string_safe = $this->breadcrumb_trail->display($linked, $reverse, $template); if($return) { return $trail_string_safe; } else { echo $trail_string_safe; } } } /** * Function updates the breadcrumb_trail options array from the database in a semi intelligent manner * * @since 5.0.0 */ private function get_settings() { //Convert our settings to opts $opts = adminKit::settings_to_opts($this->settings); //Run setup_options for compatibility reasons breadcrumb_navxt::setup_options($opts); //TODO: Unit tests needed to ensure the expected behavior exists //Grab the current settings for the current local site from the db $this->breadcrumb_trail->opt = wp_parse_args(get_option('bcn_options'), $opts); //If we're in multisite mode, look at the three BCN_SETTINGS globals if(is_multisite()) { $multisite_opts = wp_parse_args(get_site_option('bcn_options'), $opts); if(defined('BCN_SETTINGS_USE_NETWORK') && BCN_SETTINGS_USE_NETWORK) { //Grab the current network wide settings $this->breadcrumb_trail->opt = $multisite_opts; } else if(defined('BCN_SETTINGS_FAVOR_LOCAL') && BCN_SETTINGS_FAVOR_LOCAL) { //Grab the current local site settings and merge into network site settings + defaults $this->breadcrumb_trail->opt = wp_parse_args(get_option('bcn_options'), $multisite_opts); } else if(defined('BCN_SETTINGS_FAVOR_NETWORK') && BCN_SETTINGS_FAVOR_NETWORK) { //Grab the current network site settings and merge into local site settings + defaults $this->breadcrumb_trail->opt = wp_parse_args(get_site_option('bcn_options'), $this->breadcrumb_trail->opt); } } //Currently only support using post_parent for the page hierarchy $this->breadcrumb_trail->opt['bpost_page_hierarchy_display'] = true; $this->breadcrumb_trail->opt['bpost_page_hierarchy_parent_first'] = true; $this->breadcrumb_trail->opt['Epost_page_hierarchy_type'] = 'BCN_POST_PARENT'; $this->breadcrumb_trail->opt['apost_page_root'] = get_option('page_on_front'); //This one isn't needed as it is performed in bcn_breadcrumb_trail::fill(), it's here for completeness only $this->breadcrumb_trail->opt['apost_post_root'] = get_option('page_for_posts'); //Now load opts into settings adminKit::load_opts_into_settings($this->breadcrumb_trail->opt, $this->settings); } /** * Outputs the breadcrumb trail * * @param bool $return Whether to return or echo the trail. * @param bool $linked Whether to allow hyperlinks in the trail or not. * @param bool $reverse Whether to reverse the output or not. * @param bool $force Whether or not to force the fill function to run. * @param string $template The template to use for the string output. * @param string $outer_template The template to place an entire dimension of the trail into for all dimensions higher than 1. * * @return void Void if Option to print out breadcrumb trail was chosen. * @return string String-Data of breadcrumb trail. */ public function display($return = false, $linked = true, $reverse = false, $force = false, $template = '%1$s%2$s', $outer_template = '%1$s') { //If we're being forced to fill the trail, clear it before calling fill if($force) { $this->breadcrumb_trail->breadcrumbs = array(); } //Generate the breadcrumb trail $this->breadcrumb_trail->fill($force); $trail_string_safe = $this->breadcrumb_trail->display($linked, $reverse, $template, $outer_template); if($return) { return $trail_string_safe; } else { echo $trail_string_safe; } } /** * Outputs the breadcrumb trail with each element encapsulated with li tags * * @deprecated 6.0.0 No longer needed, superseded by $template parameter in display * * @param bool $return Whether to return or echo the trail. * @param bool $linked Whether to allow hyperlinks in the trail or not. * @param bool $reverse Whether to reverse the output or not. * @param bool $force Whether or not to force the fill function to run. * * @return void Void if Option to print out breadcrumb trail was chosen. * @return string String-Data of breadcrumb trail. */ public function display_list($return = false, $linked = true, $reverse = false, $force = false) { _deprecated_function( __FUNCTION__, '6.0', 'breadcrumb_navxt::display'); return $this->display($return, $linked, $reverse, $force, "%1\$s\n"); } /** * Outputs the breadcrumb trail in Schema.org BreadcrumbList compatible JSON-LD * * @param bool $return Whether to return or echo the trail. * @param bool $reverse Whether to reverse the output or not. * @param bool $force Whether or not to force the fill function to run. * * @return void Void if Option to print out breadcrumb trail was chosen. * @return string String-Data of breadcrumb trail. */ public function display_json_ld($return = false, $reverse = false, $force = false) { //If we're being forced to fill the trail, clear it before calling fill if($force) { $this->breadcrumb_trail->breadcrumbs = array(); } //Generate the breadcrumb trail $this->breadcrumb_trail->fill($force); $trail_string_safe = wp_json_encode($this->breadcrumb_trail->display_json_ld($reverse), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); if($return) { return $trail_string_safe; } else { echo $trail_string_safe; } } } //Have to bootstrap our startup so that other plugins can replace the bcn_breadcrumb_trail object if they need to add_action('plugins_loaded', 'bcn_init', 15); function bcn_init() { global $breadcrumb_navxt; $breadcrumb_navxt = new breadcrumb_navxt(); } /** * Outputs the breadcrumb trail * * @param bool $return Whether to return or echo the trail. (optional) * @param bool $linked Whether to allow hyperlinks in the trail or not. (optional) * @param bool $reverse Whether to reverse the output or not. (optional) * @param bool $force Whether or not to force the fill function to run. (optional) * * @return void Void if Option to print out breadcrumb trail was chosen. * @return string String-Data of breadcrumb trail. */ function bcn_display($return = false, $linked = true, $reverse = false, $force = false) { global $breadcrumb_navxt; if($breadcrumb_navxt !== null) { return $breadcrumb_navxt->display($return, $linked, $reverse, $force); } } /** * Outputs the breadcrumb trail with each element encapsulated with li tags * * @param bool $return Whether to return or echo the trail. (optional) * @param bool $linked Whether to allow hyperlinks in the trail or not. (optional) * @param bool $reverse Whether to reverse the output or not. (optional) * @param bool $force Whether or not to force the fill function to run. (optional) * * @return void Void if Option to print out breadcrumb trail was chosen. * @return string String-Data of breadcrumb trail. */ function bcn_display_list($return = false, $linked = true, $reverse = false, $force = false) { global $breadcrumb_navxt; if($breadcrumb_navxt !== null) { return $breadcrumb_navxt->display($return, $linked, $reverse, $force, "%1\$s\n", "
    %1\$s
\n"); } } /** * Outputs the breadcrumb trail in Schema.org BreadcrumbList compatible JSON-LD * * @param bool $return Whether to return or echo the trail. (optional) * @param bool $reverse Whether to reverse the output or not. (optional) * @param bool $force Whether or not to force the fill function to run. (optional) * * @return void Void if Option to print out breadcrumb trail was chosen. * @return string String-Data of breadcrumb trail. */ function bcn_display_json_ld($return = false, $reverse = false, $force = false) { global $breadcrumb_navxt; if($breadcrumb_navxt !== null) { return $breadcrumb_navxt->display_json_ld($return, $reverse, $force); } } PKY\8Jg< < 1includes/blocks/build/breadcrumb-trail/render.phpnu[. * @param WP_Block $block The instance of the WP_Block class that represents the block being rendered. * * @package breadcrumb-navxt */ if($attributes['hideonHome'] === true && is_front_page() && !(is_paged() && $GLOBALS['breadcrumb_navxt']->show_paged())) { return; } //Handle in-editor previews, function check to prevent requiring WP6.5 if(function_exists('wp_is_serving_rest_request') && wp_is_serving_rest_request() && current_user_can('read_post', absint($block->context['postId']))) { $preview_post = get_post(absint($block->context['postId'])); if($attributes['format'] === 'list') { $template = "%1\$s\n"; $outer_template = "
    %1\$s
\n"; } else { $template = '%1$s%2$s'; $outer_template = '%1$s'; } $trail_string_safe = $GLOBALS['breadcrumb_navxt']->_display_post($preview_post, true, $attributes['link'], $attributes['reverseOrder'], $attributes['ignoreCache'], $template, $outer_template); } else if($attributes['format'] === 'list') { $trail_string_safe = bcn_display_list(true, $attributes['link'], $attributes['reverseOrder'], $attributes['ignoreCache']); } else { $trail_string_safe = bcn_display(true, $attributes['link'], $attributes['reverseOrder'], $attributes['ignoreCache']); } if($attributes['format'] === 'list') { ?>
    'breadcrumbs') ) );?>>
'breadcrumbs', 'vocab' => 'https://schema.org/', 'typeof' => 'BreadcrumbList' ) ) );?>>
'breadcrumbs', 'itemtype' => 'https://schema.org/BreadcrumbList' ) ) );?>>
'breadcrumbs' ) ) );?>>
array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n', 'wp-server-side-render'), 'version' => '473a884c363b3a3587aa'); PKY\d``1includes/blocks/build/breadcrumb-trail/block.jsonnu[{ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "bcn/breadcrumb-trail", "title": "Breadcrumb Trail", "category": "theme", "description": "Displays a breadcrumb trail", "keywords": [ "breadcrumbs", "navigation", "breadcrumb trail" ], "version": "2.0.0", "textdomain": "breadcrumb-navxt", "attributes": { "pretext": { "type": "string", "default": "" }, "format": { "type": "string", "enum": [ "list", "breadcrumblist_rdfa", "breadcrumblist_rdfa_wai_aria", "breadcrumblist_microdata", "plain" ], "default": "breadcrumblist_rdfa" }, "link": { "type": "boolean", "default": true }, "reverseOrder": { "type": "boolean", "default": false }, "hideonHome": { "type": "boolean", "default": false }, "ignoreCache": { "type": "boolean", "default": true }, "className": { "type": "string", "default": "" }, "textColor": { "type": "string", "default": "" }, "backgroundColor": { "type": "string", "default": "" }, "align": { "type": "string", "default": "" }, "typography": { "type": "string", "default": "" }, "fontSize": { "type": "string", "default": "" }, "style": { "type": "object", "default": {} } }, "usesContext": [ "postId" ], "selectors": { "root": ".wp-block-bcn-breadcrumb-trail" }, "supports": { "align": true, "color": { "text": true, "link": true, "background": true, "gradients": true, "enableContrastChecker": true }, "background": { "backgroundImage": true }, "typography": { "fontSize": true, "fontWeight": true, "fontStyle": true, "textAlign": true, "lineHeight": true }, "html": false }, "example": { "attributes": { "pretext": "You are here:" } }, "editorScript": "file:./index.js", "render": "file:./render.php" }PKY\|/  /includes/blocks/build/breadcrumb-trail/index.jsnu[(()=>{"use strict";var e={n:r=>{var a=r&&r.__esModule?()=>r.default:()=>r;return e.d(a,{a}),a},d:(r,a)=>{for(var t in a)e.o(a,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:a[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};const r=window.wp.blocks,a=window.React,t=(window.wp.data,window.wp.i18n),n=window.wp.components,l=window.wp.serverSideRender;var o=e.n(l);const c=window.wp.blockEditor,b=JSON.parse('{"u2":"bcn/breadcrumb-trail"}'),d=(0,a.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},(0,a.createElement)("path",{d:"M0.6 7.2C0.4 7.2 0.4 7.2 0.4 7.4V16.9C0.4 17.1 0.4 17.1 0.6 17.1H10.9C11.1 17.1 11.1 17.1 11.3 16.9L16 12.1 11.3 7.4C11.1 7.2 11.1 7.2 10.9 7.2ZM15 7.2 19.9 12.1 15 17.1H18.7C18.9 17.1 18.9 17.1 19.1 16.9L23.8 12.1 19.1 7.4C18.9 7.2 18.9 7.2 18.7 7.2Z"}));(0,r.registerBlockType)(b.u2,{icon:d,edit:function({attributes:e,setAttributes:r}){const l=e=>a=>r({[e]:a});return(0,a.createElement)("div",{...(0,c.useBlockProps)()},(0,a.createElement)(c.InspectorControls,null,(0,a.createElement)(n.PanelBody,{title:(0,t.__)("Breadcrumb Trail Settings","breadcrumb-navxt")},(0,a.createElement)("p",{className:"description"},(0,t.__)("Adjust the breadcrumb trail.","breadcrumb-navxt")),(0,a.createElement)(n.TextControl,{label:(0,t.__)("Text to show before the trail","breadcrumb-navxt"),value:e.pretext,onChange:l("pretext")}),(0,a.createElement)(n.SelectControl,{label:(0,t.__)("Output trail format","breadcrumb-navxt"),value:e.format,options:[{value:"list",label:(0,t.__)("Ordered list elements","breadcrumb-navxt")},{value:"breadcrumblist_rdfa",label:(0,t.__)("Schema.org BreadcrumbList (RDFa)","breadcrumb-navxt")},{value:"breadcrumblist_rdfa_wai_aria",label:(0,t.__)("Schema.org BreadcrumbList (RDFa) with WAI-ARIA","breadcrumb-navxt")},{value:"breadcrumblist_microdata",label:(0,t.__)("Schema.org BreadcrumbList (microdata)","breadcrumb-navxt")},{value:"plain",label:(0,t.__)("Plane (no Schema.org BreadcrumbList)","breadcrumb-navxt")}],onChange:l("format")}),(0,a.createElement)(n.ToggleControl,{label:(0,t.__)("Link the breadcrumbs","breadcrumb-navxt"),checked:!!e.link,onChange:l("link")}),(0,a.createElement)(n.ToggleControl,{label:(0,t.__)("Reverse the order of the trail","breadcrumb-navxt"),checked:!!e.reverseOrder,onChange:l("reverseOrder")}),(0,a.createElement)(n.ToggleControl,{label:(0,t.__)("Hide the breadcrumb trail on the front page","breadcrumb-navxt"),checked:!!e.hideonHome,onChange:l("hideonHome")}),(0,a.createElement)(n.ToggleControl,{label:(0,t.__)("Ignore the breadcrumb cache","breadcrumb-navxt"),checked:!!e.ignoreCache,onChange:l("ignoreCache")}))),(0,a.createElement)(n.Disabled,null,(0,a.createElement)(o(),{block:"bcn/breadcrumb-trail",attributes:{...e},urlQueryArgs:""})))}})})();PKY\*includes/adminKit/class-mtekk_adminkit.phpnu[message = array(); $this->messages = array(); //Admin Init Hook add_action('admin_init', array($this, 'init')); //WordPress Admin interface hook add_action('admin_menu', array($this, 'add_page')); //Installation Script hook add_action('activate_' . $this->plugin_basename, array($this, 'install')); add_action('wp_loaded', array($this, 'wp_loaded')); $this->form = new form($this->unique_prefix); //Register Help Output //add_action('add_screen_help_and_options', array($this, 'help')); } public function wp_loaded() { //Filter our allowed html tags $this->allowed_html = apply_filters($this->unique_prefix . '_allowed_html', wp_kses_allowed_html('post')); } /** * Returns the internal mtekk_admin_class version */ public function get_admin_class_version() { return adminKit::version; } /** * Checks if the administrator has the access capability, and adds it if they don't */ public function add_cap() { $role = get_role('administrator'); if($role instanceof \WP_Role && !$role->has_cap($this->access_level)) { $role->add_cap($this->access_level); } } /** * Return the URL of the settings page for the plugin */ public function admin_url() { return admin_url('options-general.php?page=' . $this->identifier); } /** * A wrapper for nonced_anchor returns a nonced anchor for admin pages * * @param string $mode The nonce "mode", a unique string at the end of the standardized nonce identifier * @param string $title (optional) The text to use in the title portion of the anchor * @param string $text (optional) The text that will be surrounded by the anchor tags * @return string the assembled anchor */ public function admin_anchor($mode, $title = '', $text = '') { return $this->nonced_anchor($this->admin_url(), 'admin_' . $mode, 'true', $title, $text); } /** * Returns a properly formed nonced anchor to the specified URI * * @param string $uri The URI that the anchor should be for * @param string $mode The nonce "mode", a unique string at the end of the standardized nonce identifier * @param mixed $value (optional) The value to place in the query string * @param string $title (optional) The text to use in the title portion of the anchor * @param string $text (optional) The text that will be surrounded by the anchor tags * @param string $anchor_extras (optional) This text is placed within the opening anchor tag, good for adding id, classes, rel field * @return string the assembled anchor */ public function nonced_anchor($uri, $mode, $value = 'true', $title = '', $text = '', $anchor_extras = '') { //Assemble our url, nonce and all $url = wp_nonce_url(add_query_arg($this->unique_prefix . '_' . $mode, $value, $uri), $this->unique_prefix . '_' . $mode); //Return a valid anchor return ' ' . esc_html($text) . ''; } /** * Abstracts the check_admin_referer so that all the end user has to supply is the mode * * @param string $mode The specific nonce "mode" (see nonced_anchor) that is being checked */ public function check_nonce($mode) { return check_admin_referer($this->unique_prefix . '_' . $mode); } /** * Makes sure the current user can manage options to proceed */ protected function security() { //If the user can not manage options we will die on them if(!current_user_can($this->access_level)) { wp_die(esc_html__('Insufficient privileges to proceed.', $this->identifier)); } } public function init() { $this->add_cap(); //Admin Options reset hook if(isset($_POST[$this->unique_prefix . '_admin_reset'])) { //Run the reset function on init if reset form has been submitted $this->opts_reset(); } //Admin Settings export hook else if(isset($_POST[$this->unique_prefix . '_admin_settings_export'])) { //Run the export function on init if export form has been submitted $this->settings_export(); } //Admin Settings import hook else if(isset($_POST[$this->unique_prefix . '_admin_settings_import']) && isset($_FILES[$this->unique_prefix . '_admin_import_file']) && !empty($_FILES[$this->unique_prefix . '_admin_import_file']['name'])) { //Run the import function on init if import form has been submitted $this->settings_import(); } //Admin Options rollback hook else if(isset($_GET[$this->unique_prefix . '_admin_undo'])) { //Run the rollback function on init if undo button has been pressed $this->opts_undo(); } //Admin Options upgrade hook else if(isset($_GET[$this->unique_prefix . '_admin_upgrade'])) { //Run the upgrade function on init if upgrade button has been pressed $this->opts_upgrade_wrapper(); } //Admin Options fix hook else if(isset($_GET[$this->unique_prefix . '_admin_fix'])) { //Run the options fix function on init if fix button has been pressed $this->opts_upgrade_wrapper(); } //Admin Options update hook else if(isset($_POST[$this->unique_prefix . '_admin_options'])) { //Temporarily add update function on init if form has been submitted $this->opts_update(); } //Add in the nice "settings" link to the plugins page add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); if(defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { $suffix = ''; } else { $suffix = '.min'; } //Register JS for more permanently dismissing messages wp_register_script('mtekk_adminkit_messages', plugins_url('/mtekk_adminkit_messages' . $suffix . '.js', dirname(__FILE__) . '/assets/mtekk_adminkit_messages' . $suffix . '.js'), array('jquery'), self::version, true); //Register JS for enable/disable settings groups wp_register_script('mtekk_adminkit_engroups', plugins_url('/mtekk_adminkit_engroups' . $suffix . '.js', dirname(__FILE__) . '/assets/mtekk_adminkit_engroups' . $suffix . '.js'), array('jquery'), self::version, true); //Register JS for tabs wp_register_script('mtekk_adminkit_tabs', plugins_url('/mtekk_adminkit_tabs' . $suffix . '.js', dirname(__FILE__) . '/assets/mtekk_adminkit_tabs' . $suffix . '.js'), array('jquery-ui-tabs'), self::version, true); //Register CSS for tabs wp_register_style('mtekk_adminkit_tabs', plugins_url('/mtekk_adminkit_tabs' . $suffix . '.css', dirname(__FILE__) . '/assets/mtekk_adminkit_tabs' . $suffix . '.css'), array(), self::version); //Register options register_setting($this->unique_prefix . '_options', $this->unique_prefix . '_options', ''); //Synchronize up our settings with the database as we're done modifying them now $this->opt = $this::parse_args($this->get_option($this->unique_prefix . '_options'), $this->opt); add_action('wp_ajax_mtekk_admin_message_dismiss', array($this, 'dismiss_message')); } /** * Adds the adminpage the menu and the nice little settings link * TODO: make this more generic for easier extension */ public function add_page() { //Add the submenu page to "settings" menu $hookname = add_submenu_page('options-general.php', $this->full_name, $this->short_name, $this->access_level, $this->identifier, array($this, 'admin_page')); // check capability of user to manage options (access control) if(current_user_can($this->access_level)) { //Register admin_head-$hookname callback add_action('admin_head-' . $hookname, array($this, 'admin_head')); //Register admin_print_styles-$hookname callback add_action('admin_print_styles-' . $hookname, array($this, 'admin_styles')); //Register admin_print_scripts-$hookname callback add_action('admin_print_scripts-' . $hookname, array($this, 'admin_scripts')); //Register Help Output add_action('load-' . $hookname, array($this, 'help')); } } /** * Places in a link to the settings page in the plugins listing entry * * @param array $links An array of links that are output in the listing * @param string $file The file that is currently in processing * @return array Array of links that are output in the listing. */ public function filter_plugin_actions($links, $file) { //Make sure we are adding only for the current plugin if($file == $this->plugin_basename) { //Add our link to the end of the array to better integrate into the WP 2.8 plugins page $links[] = '' . esc_html__('Settings', $this->identifier) . ''; } return $links; } /** * Checks to see if the plugin has been fully installed * * @return bool whether or not the plugin has been installed */ public function is_installed() { $opts = $this->get_option($this->unique_prefix . '_options'); return is_array($opts); } /** * This sets up and upgrades the database settings, runs on every activation * * FIXME: seems there is a lot of very similar code in opts_upgrade_wrapper */ public function install() { //Call our little security function $this->security(); //Try retrieving the options from the database $opts = $this->get_option($this->unique_prefix . '_options'); //If there are no settings, copy over the default settings if(!is_array($opts)) { //Add the options, we only store differences from defaults now, so start with blank array $this->add_option($this->unique_prefix . '_options', array()); $this->add_option($this->unique_prefix . '_options_bk', array(), '', false); //Add the version, no need to autoload the db version $this->update_option($this->unique_prefix . '_version', $this::version, false); } else { //Retrieve the database version $db_version = $this->get_option($this->unique_prefix . '_version'); if($this::version !== $db_version) { //Run the settings update script $this->opts_upgrade($opts, $db_version); //Always have to update the version $this->update_option($this->unique_prefix . '_version', $this::version, false); //Store the options $this->update_option($this->unique_prefix . '_options', $this->opt, true); } } } /** * This removes database settings upon deletion of the plugin from WordPress */ public function uninstall() { //Remove the option array setting $this->delete_option($this->unique_prefix . '_options'); //Remove the option backup array setting $this->delete_option($this->unique_prefix . '_options_bk'); //Remove the version setting $this->delete_option($this->unique_prefix . '_version'); } /** * Compares the supplied version with the internal version, places an upgrade warning if there is a mismatch * TODO: change this to being auto called in admin_init action */ public function version_check($version) { //If we didn't get a version, setup if($version === false) { //Add the version, no need to autoload the db version $this->add_option($this->unique_prefix . '_version', $this::version, '', 'no'); } //Do a quick version check if($version && version_compare($version, $this::version, '<') && is_array($this->opt)) { //Throw an error since the DB version is out of date $this->messages[] = new message(esc_html__('Your settings are for an older version of this plugin and need to be migrated.', $this->identifier) . $this->admin_anchor('upgrade', __('Migrate the settings now.', $this->identifier), __('Migrate now.', $this->identifier)), 'warning'); //Output any messages that there may be $this->messages(); return false; } //Do a quick version check else if($version && version_compare($version, $this::version, '>') && is_array($this->opt)) { //Let the user know that their settings are for a newer version $this->messages[] = new message(esc_html__('Your settings are for a newer version of this plugin.', $this->identifier) . $this->admin_anchor('upgrade', __('Migrate the settings now.', $this->identifier), __('Attempt back migration now.', $this->identifier)), 'warning'); //Output any messages that there may be $this->messages(); return true; } else if(!is_array($this->settings)) { //Throw an error since it appears the options were never registered $this->messages[] = new message(esc_html__('Your plugin install is incomplete.', $this->identifier) . $this->admin_anchor('upgrade', __('Load default settings now.', $this->identifier), __('Complete now.', $this->identifier)), 'error'); //Output any messages that there may be $this->messages(); return false; } else if(!$this->settings_validate($this->settings)) { //Throw an error since it appears the options contain invalid data $this->messages[] = new message(esc_html__('One or more of your plugin settings are invalid.', $this->identifier) . $this->admin_anchor('fix', __('Attempt to fix settings now.', $this->identifier), __('Fix now.', $this->identifier)), 'error'); //Output any messages that there may be $this->messages(); return false; } return true; } /** * Run through all of the settings, check if the value matches the validated value * * @param array $settings The settings array * @return boolean */ public function settings_validate(array &$settings) { foreach($settings as $setting) { if(is_array($setting)) { if(!$this->settings_validate($setting)) { return false; } } else if($setting instanceof setting && $setting->get_value() !== $setting->validate($setting->get_value())) //FIXME: not sure I like this { return false; } } return true; //FIXME: Shouldn't the default to be false? } /** * Synchronizes the backup options entry with the current options entry */ protected function opts_backup() { //Set the backup options in the DB to the current options $this->update_option($this->unique_prefix . '_options_bk', $this->get_option($this->unique_prefix . '_options'), false); } /** * The new, simpler settings update loop, handles the new settings array and replaces the old opts_update_loop * * @param array $settings * @param array $input * @param bool $bool_ignore_missing */ protected function settings_update_loop(&$settings, $input, $bool_ignore_missing = false) { foreach($settings as $key => $setting) { if(is_array($setting)) { if(isset($input[$key])) { $this->settings_update_loop($settings[$key], $input[$key]); } } else if($setting instanceof setting) { $setting->maybe_update_from_form_input($input, $bool_ignore_missing); } } } /** * A better version of parse_args, will recrusivly follow arrays * * @param mixed $args The arguments to be parsed * @param mixed $defaults (optional) The default values to validate against * @return mixed */ static public function parse_args($args, $defaults = '') { if(is_object($args)) { $r = get_object_vars($args); } else if(is_array($args)) { $r =& $args; } else { wp_parse_str($args, $r); } if(is_array($defaults)) { return adminKit::array_merge_recursive($defaults, $r); } return $r; } /** * 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 public function array_merge_recursive($arg1, $arg2) { foreach($arg2 as $key => $value) { if(array_key_exists($key, $arg1) && is_array($value)) { $arg1[$key] = adminKit::array_merge_recursive($arg1[$key], $value); } else { $arg1[$key] = $value; } } return $arg1; } /** * Extracts settings values to form opts array, for old options compatibility * * @param array $settings The settings array * @return array */ static public function settings_to_opts($settings) { $opts = array(); foreach ($settings as $key => $setting) { if(is_array($setting)) { $opts[$key] = adminKit::settings_to_opts($setting); } else if($setting instanceof setting) { $opts[$key] = $setting->get_value(); } } return $opts; } /** * Loop through the settings and applying opts values if found * * @param array $opts The opts array */ static public function load_opts_into_settings($opts, array &$settings) { if(!is_array($opts)) { return false; } foreach($opts as $key => $value) { if(isset($settings[$key]) && $settings[$key] instanceof setting) { $settings[$key]->set_value($settings[$key]->validate($value)); } else if(isset($settings[$key]) && is_array($settings[$key]) && is_array($value)) { foreach($value as $subkey => $subvalue) { if(isset($settings[$key][$subkey]) && $settings[$key][$subkey]instanceof setting) { $settings[$key][$subkey]->set_value($settings[$key][$subkey]->validate($subvalue)); } } } } } /** * Compares two settings by name and value to see if they are equal * * @param \mtekk\adminKit\setting\setting $a * @param \mtekk\adminKit\setting\setting $b * @return number */ public function setting_equal_check($a, $b) { if(is_array($a) || is_array($b)) { foreach($a as $key=>$value) { if($value instanceof setting && isset($b[$key]) && $b[$key] instanceof setting) { return $this->setting_equal_check($value, $b[$key]); } else { return -1; } } return -1; } if($a instanceof setting && $b instanceof setting) { if($a->get_name() === $b->get_name() && $a->get_value() === $b->get_value()) { return 0; } else if($a->get_name() === $b->get_name() && $a->get_value() > $b->get_value()) { return 1; } } return -1; } static public function setting_cloner($setting) { if(is_array($setting)) { return array_map('mtekk\adminKit\adminKit::setting_cloner', $setting); } if($setting instanceof setting) { return clone $setting; } } /** * Generates array of the new non-default settings based off of form $input * * @param array $input The form input array of setting values * @param bool $bool_ignore_missing Tell maybe_update_from_form_input to not treat missing bool setting entries as setting to false * @return array The diff array of adminkit settings */ private function get_settings_diff($input, $bool_ignore_missing = false) { //Backup default settings //Must clone the defaults since PHP normally shallow copies $default_settings = array_map('mtekk\adminKit\adminKit::setting_cloner', $this->settings); //Run the update loop $this->settings_update_loop($this->settings, $input, $bool_ignore_missing); //Calculate diff $new_settings = apply_filters($this->unique_prefix . '_opts_update_to_save', array_udiff_assoc($this->settings, $default_settings, array($this, 'setting_equal_check'))); //Return the new settings return $new_settings; } /** * Updates the database settings from the webform * * The general flow of data is: * 1) Establish default values * 2) Merge in updates from webform * 3) Compute difference between defaults and results of #3 * 4) Save to database the difference generated in #4 */ protected function opts_update() { //Do some security related things 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 = adminKit::parse_args($this->get_option($this->unique_prefix . '_options'), $this->opt); $this->opt = apply_filters($this->unique_prefix . '_opts_update_prebk', $this->opt); //Update our backup options $this->update_option($this->unique_prefix . '_options_bk', $this->opt, false); $opt_prev = $this->opt; //While this should never happen, if the settings are missing, exit early if(!isset($_POST[$this->unique_prefix . '_options'])) { return; } //Grab our incoming array (the data is dirty) $input = $_POST[$this->unique_prefix . '_options']; //Run through the loop and get the diff from defaults $new_settings = $this->get_settings_diff($input); //FIXME: Eventually we'll save the object array, but not today //Convert to opts array for saving $this->opt = adminKit::settings_to_opts($new_settings); //Commit the option changes $updated = $this->update_option($this->unique_prefix . '_options', $this->opt, true); //Check if known settings match attempted save if($updated && count(array_diff_key($input, $this->settings)) == 0) { //Let the user know everything went ok $this->messages[] = new message(esc_html__('Settings successfully saved.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options save.', $this->identifier), __('Undo', $this->identifier)), 'success'); } else if(!$updated && count(array_diff_key($opt_prev, $this->settings)) == 0) { $this->messages[] = new message(esc_html__('Settings did not change, nothing to save.', $this->identifier), 'info'); } else if(!$updated) { $this->messages[] = new message(esc_html__('Settings were not saved.', $this->identifier), 'error'); } else { //Let the user know the following were not saved $this->messages[] = new message(esc_html__('Some settings were not saved.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options save.', $this->identifier), __('Undo', $this->identifier)), 'warning'); $temp = esc_html__('The following settings were not saved:', $this->identifier); foreach(array_diff_key($input, $this->settings) as $setting => $value) { $temp .= '
' . $setting; } /* translators: %1$s: HTML opening tag for link to the support forums, %2$s: HTML closing tag for link to support forums */ $this->messages[] = new message($temp . '
' . sprintf(esc_html__('Please include this message in your %1$sbug report%2$s.', $this->identifier), '', ''), 'info'); } add_action('admin_notices', array($this, 'messages')); } /** * Retrieves the settings from database and exports as JSON */ public function settings_export() { //Check if the user has permissions to do this $this->security(); //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_import_export')) { //Must clone the defaults since PHP normally shallow copies $default_settings = array_map('mtekk\adminKit\adminKit::setting_cloner', $this->settings); //Get the database options, and load //FIXME: This changes once we save settings to the db instead of opts adminKit::load_opts_into_settings($this->get_option($this->unique_prefix . '_options'), $this->settings); //Get the unique settings $export_settings = apply_filters($this->unique_prefix . '_settings_to_export', array_udiff_assoc($this->settings, $default_settings, array($this, 'setting_equal_check'))); //Change our header to application/json for direct save header('Cache-Control: public'); //The next two will cause good browsers to download instead of displaying the file header('Content-Description: File Transfer'); header('Content-disposition: attachment; filename=' . $this->unique_prefix . '_settings.json'); header('Content-Type: application/json'); //JSON encode our settings array $output_escaped= wp_json_encode( (object)array( 'plugin' => $this->short_name, 'version' => $this::version, 'settings' => $export_settings) , JSON_UNESCAPED_SLASHES, 32); //Let the browser know how long the file is header('Content-Length: ' . strlen($output_escaped)); // binary length //Output the file echo $output_escaped; //Prevent WordPress from continuing on die(); } } /** * Imports JSON settings into database * */ public function settings_import() { //Check if the user has permissions to do this $this->security(); //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_import_export')) { //Set the backup options in the DB to the current options $this->opts_backup(); //Load the user uploaded file, handle failure gracefully if(isset($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']) && is_uploaded_file($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name'])) { //Grab the json settings from the temp file, treat as associative array so we can just throw the settings subfield at the update loop $settings_upload = json_decode(file_get_contents($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']), true); //Only continue if we have a JSON object that is for this plugin (the the WP rest_is_object() function is handy here as the REST API passes JSON) if(rest_is_object($settings_upload) && isset($settings_upload['plugin']) && $settings_upload['plugin'] === $this->short_name) { //Act as if the JSON file was just a bunch of POST entries for a settings save //Run through the loop and get the diff from defaults //this isn't obvious but calls adminkit::settings_update_loop() which calls setting::maybe_update_from_form_input which performs sanitization on a per setting basis $new_settings = $this->get_settings_diff($settings_upload['settings'], true); //FIXME: Eventually we'll save the object array, but not today //Convert to opts array for saving $this->opt = adminKit::settings_to_opts($new_settings); //Run opts through update script //Make sure we safely import and upgrade settings if needed $this->opts_upgrade($this->opt, $settings_upload['version']); //Commit the option changes $updated = $this->update_option($this->unique_prefix . '_options', $this->opt, true); //Check if known settings match attempted save if($updated && count(array_diff_key($settings_upload['settings'], $this->settings)) == 0) { //Let the user know everything went ok $this->messages[] = new message(esc_html__('Settings successfully imported from the uploaded file.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options import.', $this->identifier), __('Undo', $this->identifier)), 'success'); } else { $this->messages[] = new message(esc_html__('No settings were imported. Settings from uploaded file matched existing settings.', $this->identifier), 'info'); } //Output any messages that there may be add_action('admin_notices', array($this, 'messages')); //And return as we're successful return; } //If it wasn't JSON, try XML else { return $this->opts_import(); } } //Throw an error since we could not load the file for various reasons $this->messages[] = new message(esc_html__('Importing settings from file failed.', $this->identifier), 'error'); } } /** * Exports a XML options document * @deprecated 7.5.0 */ public function opts_export() { _deprecated_function( __FUNCTION__, '7.5.0', '\mtekk\adminKit::settings_export'); //Check if the user has permissions to do this $this->security(); //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_import_export')) { //Update our internal settings $this->opt = $this->get_option($this->unique_prefix . '_options'); //Create a DOM document $dom = new \DOMDocument('1.0', 'UTF-8'); //Adds in newlines and tabs to the output $dom->formatOutput = true; //We're not using a DTD therefore we need to specify it as a standalone document $dom->xmlStandalone = true; //Add an element called options $node = $dom->createElement('options'); $parnode = $dom->appendChild($node); //Add a child element named plugin $node = $dom->createElement('plugin'); $plugnode = $parnode->appendChild($node); //Add some attributes that identify the plugin and version for the options export $plugnode->setAttribute('name', $this->short_name); $plugnode->setAttribute('version', $this::version); //Change our header to text/xml for direct save header('Cache-Control: public'); //The next two will cause good browsers to download instead of displaying the file header('Content-Description: File Transfer'); header('Content-disposition: attachment; filename=' . $this->unique_prefix . '_settings.xml'); header('Content-Type: text/xml'); //Loop through the options array foreach($this->opt as $key=>$option) { if(is_array($option)) { continue; } //Add a option tag under the options tag, store the option value $node = $dom->createElement('option', htmlentities($option, ENT_COMPAT | ENT_XML1, 'UTF-8')); $newnode = $plugnode->appendChild($node); //Change the tag's name to that of the stored option $newnode->setAttribute('name', $key); } //Prepare the XML for output $output_escaped = $dom->saveXML(); //Let the browser know how long the file is header('Content-Length: ' . strlen($output_escaped)); // binary length //Output the file echo $output_escaped; //Prevent WordPress from continuing on die(); } } /** * Imports a XML options document * * FIXME: Where is the input sanitization/validation? */ public function opts_import() { //Check if the user has permissions to do this $this->security(); //Our quick and dirty error suppressor $error_handler = function($errno, $errstr, $eerfile, $errline, $errcontext) { return true; }; //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_import_export')) { //Set the backup options in the DB to the current options $this->opts_backup(); //Create a DOM document $dom = new \DOMDocument('1.0', 'UTF-8'); //We want to catch errors ourselves set_error_handler($error_handler); //Load the user uploaded file, handle failure gracefully if(isset($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']) && is_uploaded_file($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']) && $dom->load($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name'])) { $opts_temp = array(); $version = ''; //Have to use an xpath query otherwise we run into problems $xpath = new \DOMXPath($dom); $option_sets = $xpath->query('plugin'); //Loop through all of the xpath query results foreach($option_sets as $options) { //We only want to import options for only this plugin if($options->getAttribute('name') === $this->short_name) { //Grab the file version $version = $options->getAttribute('version'); //Loop around all of the options foreach($options->getelementsByTagName('option') as $child) { //Place the option into the option array, DOMDocument decodes html entities for us $opts_temp[$child->getAttribute('name')] = $child->nodeValue; } } } //Act as if the JSON file was just a bunch of POST entries for a settings save //Run through the loop and get the diff from defaults //this isn't obvious but calls adminkit::settings_update_loop() which calls setting::maybe_update_from_form_input which performs sanitization on a per setting basis $new_settings = $this->get_settings_diff($opts_temp, true); //FIXME: Eventually we'll save the object array, but not today //Convert to opts array for saving $this->opt = adminKit::settings_to_opts($new_settings); //Run opts through update script //Make sure we safely import and upgrade settings if needed $this->opts_upgrade($this->opt, $settings_upload['version']); //Commit the loaded options to the database $this->update_option($this->unique_prefix . '_options', $this->opt, true); //Everything was successful, let the user know $this->messages[] = new message(esc_html__('Settings successfully imported from the uploaded file.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options import.', $this->identifier), __('Undo', $this->identifier)), 'success'); } else { //Throw an error since we could not load the file for various reasons $this->messages[] = new message(esc_html__('Importing settings from file failed.', $this->identifier), 'error'); } //Reset to the default error handler after we're done restore_error_handler(); //Output any messages that there may be add_action('admin_notices', array($this, 'messages')); } } /** * Resets the database settings array to the default set in opt */ public function opts_reset() { //Check if the user has permissions to do this $this->security(); //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_import_export')) { //Set the backup options in the DB to the current options $this->opts_backup(); //Load in the hard coded default option values $this->update_option($this->unique_prefix . '_options', array(), true); //Reset successful, let the user know $this->messages[] = new message(esc_html__('Settings successfully reset to the default values.', $this->identifier) . $this->admin_anchor('undo', __('Undo the options reset.', $this->identifier), __('Undo', $this->identifier)), 'success'); add_action('admin_notices', array($this, 'messages')); } } /** * Undos the last settings save/reset/import */ public function opts_undo() { //Check if the user has permissions to do this $this->security(); //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_undo')) { //Set the options array to the current options $opt = $this->get_option($this->unique_prefix . '_options'); //Set the options in the DB to the backup options $this->update_option($this->unique_prefix . '_options', $this->get_option($this->unique_prefix . '_options_bk'), true); //Set the backup options to the undone options $this->update_option($this->unique_prefix . '_options_bk', $opt, false); //Send the success/undo message $this->messages[] = new message(esc_html__('Settings successfully undid the last operation.', $this->identifier) . $this->admin_anchor('undo', __('Undo the last undo operation.', $this->identifier), __('Undo', $this->identifier)), 'success'); add_action('admin_notices', array($this, 'messages')); } } /** * Upgrades input options array, sets to $this->opt, designed to be overwritten * * @param array $opts * @param string $version the version of the passed in options */ public function opts_upgrade($opts, $version) { //We don't support using newer versioned option files in older releases if(version_compare($this::version, $version, '>=')) { $this->opt = $opts; } } /** * Forces a database settings upgrade * * FIXME: seems there is a lot of very similar code in install */ public function opts_upgrade_wrapper() { //Check if the user has permissions to do this $this->security(); //Do a nonce check, prevent malicious link/form problems if(check_admin_referer($this->unique_prefix . '_admin_upgrade')) { //Grab the database options $opts = $this->get_option($this->unique_prefix . '_options'); if(is_array($opts)) { //Feed the just read options into the upgrade function $this->opts_upgrade($opts, $this->get_option($this->unique_prefix . '_version')); //Always have to update the version $this->update_option($this->unique_prefix . '_version', $this::version, false); //Store the options $this->update_option($this->unique_prefix . '_options', $this->opt, true); //Send the success message $this->messages[] = new message(esc_html__('Settings successfully migrated.', $this->identifier), 'success'); } else { //Run the install script $this->install(); //Send the success message $this->messages[] = new message(esc_html__('Default settings successfully installed.', $this->identifier), 'success'); } add_action('admin_notices', array($this, 'messages')); } } /** * help action hook function * * @return string * */ public function help() { $screen = get_current_screen(); //Exit early if the add_help_tab function doesn't exist if(!method_exists($screen, 'add_help_tab')) { return; } //Add contextual help on current screen if($screen->id == 'settings_page_' . $this->identifier) { $this->help_contents($screen); } } public function help_contents(\WP_Screen &$screen) { } //FIXME: There just has to be a better way... public function dismiss_message() { $this->security(); //Grab the submitted UID $uid = sanitize_html_class(wp_unslash($_POST['uid'])); //Create a dummy message, with the discovered UID $message = new message('', '', true, $uid); //Dismiss the message $message->dismiss(); wp_die(); } /** * Prints to screen all of the messages stored in the message member variable */ public function messages() { foreach($this->messages as $message) { $message->render(); } //Old deprecated messages if(is_array($this->message) && count($this->message)) { _deprecated_function( __FUNCTION__, '2.0.0', esc_html__('adminKit::message is deprecated, use new adminkit_messages instead.', $this->identifier) ); //Loop through our message classes foreach($this->message as $key => $class) { //Loop through the messages in the current class foreach($class as $message) { printf('

%s

', esc_attr($key), wp_kses($message, wp_kses_allowed_html('post'))); } } $this->message = array(); } $this->messages = array(); } /** * Function prototype to prevent errors */ public function admin_styles() { } /** * Function prototype to prevent errors */ public function admin_scripts() { } /** * Function prototype to prevent errors */ public function admin_head() { } /** * Function prototype to prevent errors */ public function admin_page() { } /** * Function prototype to prevent errors */ protected function _get_help_text() { } /** * Returns a valid xHTML element ID * * @param object $option * * @deprecated 7.0.0 */ static public function get_valid_id($option) { _deprecated_function( __FUNCTION__, '7.0', '\mtekk\adminKit\form::get_valid_id'); if(is_numeric($option[0])) { return 'p' . $option; } else { return $option; } } public function import_form() { $form = '
'; $form .= sprintf('
', esc_attr($this->admin_url()), esc_attr($this->unique_prefix)); $form .= wp_nonce_field($this->unique_prefix . '_admin_import_export', '_wpnonce', true, false); $form .= sprintf('
', esc_attr($this->unique_prefix)); $form .= '' . esc_html__( 'Import settings', $this->identifier ) . ''; $form .= '

' . esc_html__('Import settings from a JSON or XML file, export the current settings to a JSON file, or reset to the default settings.', $this->identifier) . '

'; $form .= '
'; $form .= sprintf(''; $form .= sprintf('

', esc_attr($this->unique_prefix)); $form .= esc_html__('Select a JSON or XML settings file to upload and import settings from.', $this->identifier); $form .= '

'; $form .= sprintf('', esc_attr($this->unique_prefix), esc_attr__('Import', $this->identifier)); $form .= sprintf('', esc_attr($this->unique_prefix), esc_attr__('Export', $this->identifier)); $form .= sprintf('', esc_attr($this->unique_prefix), esc_attr__('Reset', $this->identifier)); $form .= '

'; return $form; } /** * This will output a well formed hidden option * * @param string $option * * @deprecated 7.0.0 */ public function input_hidden($option) { _deprecated_function( __FUNCTION__, '7.0', '\mtekk\adminKit\form::input_hidden'); $opt_id = adminKit::get_valid_id($option); $opt_name = $this->unique_prefix . '_options[' . $option . ']'; printf('', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option])); } /** * This will output a well formed option label * * @param string $opt_id * @param string $label * * @deprecated 7.0.0 */ public function label($opt_id, $label) { _deprecated_function( __FUNCTION__, '7.0', '\mtekk\adminKit\form::label'); printf('', esc_attr($opt_id), esc_html($label)); } /** * This will output a well formed table row for a text input * * @param string $label * @param string $option * @param string $class (optional) * @param bool $disable (optional) * @param string $description (optional) * * @deprecated 7.0.0 */ public function input_text($label, $option, $class = 'regular-text', $disable = false, $description = '') { _deprecated_function( __FUNCTION__, '7.0', '\mtekk\adminKit\form::input_text'); $opt_id = adminKit::get_valid_id($option); $opt_name = $this->unique_prefix . '_options[' . $option . ']'; if($disable) { $this->input_hidden($option); $class .= ' disabled'; }?> label($opt_id, $label);?>
', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option]), esc_attr($class), disabled($disable, true, false));?>

unique_prefix . '_options[' . $option . ']'; $extras_escaped = ''; if($min !== '') { $extras_escaped .= 'min="' . esc_attr($min) . '" '; } if($max !== '') { $extras_escaped .= 'max="' . esc_attr($max) . '" '; } if($step !== '') { $extras_escaped .= 'step="' . esc_attr($step) . '" '; } if($disable) { $this->input_hidden($option); $class .= ' disabled'; }?> label($opt_id, $label);?>
', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option]), esc_attr($class), disabled($disable, true, false), $extras_escaped);?>

unique_prefix . '_options[' . $option . ']'; $class .= ' large-text'; if($disable) { $this->input_hidden($option); $class .= ' disabled'; }?> label($opt_id, $label);?> %3$s
', esc_attr($opt_name), esc_attr($opt_id), esc_textarea($this->opt[$option]), esc_attr($class), disabled($disable, true, false), esc_attr($height));?>

input_hidden($option); $class .= ' disabled'; }?> label($opt_id, $label);?> %3$s
', esc_attr($opt_name), esc_attr($opt_id), esc_textarea($this->opt[$option]), esc_attr($class), disabled($disable, true, false), esc_attr($height));?>

unique_prefix . '_options[' . $option . ']'; if($disable) { $this->input_hidden($option); $class .= ' disabled'; }?>

unique_prefix . '_options[' . $option . ']'; $class .= ' togx'; if($disable) { $this->input_hidden($option); $class .= ' disabled'; }?>
unique_prefix . '_options[' . $option . ']'; if($disable) { $this->input_hidden($option); $class .= ' disabled'; }?> label($opt_id, $label);?> %3$s
', esc_attr($opt_name), esc_attr($opt_id), $this->select_options($option, $titles, $values), esc_attr($class), disabled($disable, true, false));?>

* * @param string $optionname name of wordpress options store * @param array $options array of names of options that can be selected * @param array $values array of the values of the options that can be selected * @param array $exclude(optional) array of names in $options array to be excluded * * @return string The assembled HTML for the select options * * @deprecated 7.0.0 */ public function select_options($optionname, $options, $values, $exclude = array()) { _deprecated_function( __FUNCTION__, '7.0', '\mtekk\adminKit\form::select_options'); $options_html = ''; $value = $this->opt[$optionname]; //Now do the rest foreach($options as $key => $option) { if(!in_array($option, $exclude)) { $options_html .= sprintf('', esc_attr($values[$key]), selected($value, $values[$key], false), esc_html($option)); } } return $options_html; } /** * A local pass through for get_option so that we can hook in and pick the correct method if needed * * @param string $option The name of the option to retrieve * @return mixed The value of the option */ public function get_option($option) { return get_option($option); } /** * A local pass through for update_option so that we can hook in and pick the correct method if needed * * @param string $option The name of the option to update * @param mixed $newvalue The new value to set the option to */ public function update_option($option, $newvalue, $autoload = null) { return update_option($option, $newvalue, $autoload); } /** * A local pass through for add_option so that we can hook in and pick the correct method if needed * * @param string $option The name of the option to update * @param mixed $value The new value to set the option to * @param null $deprecated Deprecated parameter * @param string $autoload Whether or not to autoload the option, it's a string because WP is special */ public function add_option($option, $value = '', $deprecated = '', $autoload = 'yes') { return add_option($option, $value, '', $autoload); } /** * A local pass through for delete_option so that we can hook in and pick the correct method if needed * * @param string $option The name of the option to delete */ public function delete_option($option) { return delete_option($option); } /** * Initializes localization textdomain for translations (if applicable) * * Will conditionally load the textdomain for translations. This is here for * plugins that span multiple files and have localization in more than one file * * @return void * * @deprecated 7.5.1 */ public function local() { //Nothing to see here now that it's deprecated } }PKY\:Eincludes/adminKit/setting/php7/class-mtekk_adminkit_setting_float.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { return (float) $new_value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'f' . $this->get_name(); } }PKY\PYWCincludes/adminKit/setting/php7/class-mtekk_adminkit_setting_int.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { return (int) $new_value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'i' . $this->get_name(); } }PKY\ЮODincludes/adminKit/setting/php7/class-mtekk_adminkit_setting_base.phpnu[deprecated; } public function set_deprecated($deprecated) { $this->deprecated = $deprecated; } public function get_value() { return $this->value; } public function set_value($new_value) { $this->value = $new_value; } public function get_title() { return $this->title; } public function get_name() { return $this->name; } public function get_allow_empty() { return $this->allow_empty; } public function set_allow_empty($allow_empty) { $this->allow_empty = $allow_empty; } public function jsonSerialize() { return $this->value; } /** * Basic updateFromFormInput method * * {@inheritDoc} * @see mtekk\adminKit\setting::maybe_update_from_form_input() */ public function maybe_update_from_form_input($input, $bool_ignore_missing = false) { if(isset($input[$this->get_opt_name()])) { $this->set_value($this->validate($input[$this->get_opt_name()])); } } }PKY\Wu5% Dincludes/adminKit/setting/php7/class-mtekk_adminkit_setting_bool.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { return (bool) $new_value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'b' . $this->get_name(); } /** * * {@inheritDoc} * @see mtekk_adminKit_setting::updateFromFormInput() */ public function maybe_update_from_form_input($input, $bool_ignore_missing = false) { //If the setting was in the input array, check if it is true or false if(isset($input[$this->get_opt_name()])) { if($input[$this->get_opt_name()] === true || $input[$this->get_opt_name()] === '1') { $newval = true; } //Treat anything that wasn't true as trying to set false else { $newval = false; } } //Normally checkbox inputs will be missing the setting if uncecked (treat as false) else { //If the value wasn't set, but we are to ignore missing inputs if($bool_ignore_missing) { return; } $newval = false; } $this->set_value($this->validate($newval)); } } PKY\"Wv?includes/adminKit/setting/class-mtekk_adminkit_setting_html.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { if(!$this->allow_empty && $new_value === '') { return $this->value; } return wp_kses(stripslashes($new_value), apply_filters('mtekk_adminkit_allowed_html', wp_kses_allowed_html('post'))); } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { if($this->allow_empty) { $type = 'h'; } else { $type = 'H'; } return $type . $this->get_name(); } }PKY\NqgHH>includes/adminKit/setting/interface-mtekk_adminkit_setting.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->deprecated = $deprecated; $this->allow_empty = $allow_empty; $this->allowed_vals= $allowed_vals; } /** * Validates the new value against the allowed values for this setting * * {@inheritDoc} * @see mtekk_adminKit_setting::validate() */ public function validate($new_value) { if(in_array($new_value, $this->allowed_vals)) { return $new_value; } else { return $this->value; } } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'E' . $this->get_name(); } /** * Setter for the allowed values array * * @param array $allowed_vals Array of allowed values */ public function set_allowed_vals(array $allowed_vals) { $this->allowed_vals = $allowed_vals; } /** * Getter of the allowed values array * * @return array Allowed values used in validation of the setting */ public function get_allowed_vals() { return $this->allowed_vals; } }PKY\ޯBB@includes/adminKit/setting/class-mtekk_adminkit_setting_float.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { return (float) $new_value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting_base::jsonSerialize() */ public function jsonSerialize(): float { return $this->value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'f' . $this->get_name(); } }PKY\::>includes/adminKit/setting/class-mtekk_adminkit_setting_int.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { return (int) $new_value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting_base::jsonSerialize() */ public function jsonSerialize(): int { return $this->value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'i' . $this->get_name(); } }PKY\1eeAincludes/adminKit/setting/class-mtekk_adminkit_setting_string.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { if(!$this->allow_empty && $new_value === '') { return $this->value; } return sanitize_text_field($new_value); } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { if($this->allow_empty) { $type = 's'; } else { $type = 'S'; } return $type . $this->get_name(); } }PKY\/l>?includes/adminKit/setting/class-mtekk_adminkit_setting_base.phpnu[deprecated; } public function set_deprecated($deprecated) { $this->deprecated = $deprecated; } public function get_value() { return $this->value; } public function set_value($new_value) { $this->value = $new_value; } public function get_title() { return $this->title; } public function get_name() { return $this->name; } public function get_allow_empty() { return $this->allow_empty; } public function set_allow_empty($allow_empty) { $this->allow_empty = $allow_empty; } public function jsonSerialize(): mixed { return $this->value; } /** * Basic updateFromFormInput method * * {@inheritDoc} * @see mtekk\adminKit\setting::maybe_update_from_form_input() */ public function maybe_update_from_form_input($input, $bool_ignore_missing = false) { if(isset($input[$this->get_opt_name()])) { $this->set_value($this->validate($input[$this->get_opt_name()])); } } }PKY\hB??Aincludes/adminKit/setting/class-mtekk_adminkit_setting_absint.phpnu[get_name(); } }PKY\l ?includes/adminKit/setting/class-mtekk_adminkit_setting_bool.phpnu[name = $name; $this->value = $value; $this->title = $title; $this->allow_empty = $allow_empty; $this->deprecated = $deprecated; } /** * */ public function validate($new_value) { return (bool) $new_value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting_base::jsonSerialize() */ public function jsonSerialize(): bool { return $this->value; } /** * * {@inheritDoc} * @see \mtekk\adminKit\setting\setting::get_opt_name() */ public function get_opt_name() { return 'b' . $this->get_name(); } /** * * {@inheritDoc} * @see mtekk_adminKit_setting::updateFromFormInput() */ public function maybe_update_from_form_input($input, $bool_ignore_missing = false) { //If the setting was in the input array, check if it is true or false if(isset($input[$this->get_opt_name()])) { $newval = $input[$this->get_opt_name()] === true || $input[$this->get_opt_name()] === '1'; } //Normally checkbox inputs will be missing the setting if uncecked (treat as false) else { //If the value wasn't set, but we are to ignore missing inputs if($bool_ignore_missing) { return; } $newval = false; } $this->set_value($this->validate($newval)); } } PKY\\YY/includes/adminKit/assets/mtekk_adminkit_tabs.jsnu[jQuery(function() { mtekk_admin_tabulator_init(); }); /** * Tabulator Bootup */ function mtekk_admin_tabulator_init(){ if(!jQuery("#hasadmintabs").length) return; /* init markup for tabs */ jQuery('#hasadmintabs').prepend('