Version Description
Download this release
Release Info
Developer | marsian |
Plugin | TemplatesNext ToolKit |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.2.0 to 3.2.1
- inc/el-widgets/widgets/hello-world.php +0 -179
- inc/shape-seperators.php +6 -0
- inc/tx-breadcrumb/class.bctx_admin.php +0 -783
- inc/tx-breadcrumb/class.bctx_breadcrumb.php +0 -272
- inc/tx-breadcrumb/class.bctx_breadcrumb_trail.php +0 -1279
- inc/tx-breadcrumb/class.bctx_network_admin.php +0 -193
- inc/tx-breadcrumb/class.bctx_rest_controller.php +0 -232
- inc/tx-breadcrumb/class.bctx_widget.php +0 -141
- inc/tx-breadcrumb/includes/block_direct_access.php +0 -27
- inc/tx-breadcrumb/includes/class.mtekk_adminkit.php +0 -1195
- inc/tx-breadcrumb/includes/class.mtekk_adminkit_message.php +0 -99
- inc/tx-breadcrumb/includes/class.mtekk_adminkit_uninstaller.php +0 -70
- inc/tx-breadcrumb/includes/mtekk_adminkit_engroups.js +0 -37
- inc/tx-breadcrumb/includes/mtekk_adminkit_engroups.min.js +0 -1
- inc/tx-breadcrumb/includes/mtekk_adminkit_messages.js +0 -11
- inc/tx-breadcrumb/includes/mtekk_adminkit_messages.min.js +0 -11
- inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.css +0 -8
- inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.js +0 -40
- inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.min.css +0 -1
- inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.min.js +0 -1
- inc/tx-breadcrumb/includes/multibyte_supplicant.php +0 -111
- inc/tx-breadcrumb/languages/tx-breadcrumb.pot +0 -988
- inc/tx-breadcrumb/readme.txt +0 -280
- inc/tx-breadcrumb/tx-breadcrumb.php +0 -571
- inc/tx-breadcrumb/uninstall.php +0 -124
- inc/woo-compare-wishlist/assets/css/tm-woocompare.css +1 -0
- inc/woo-compare-wishlist/includes/compare/compare.php +19 -3
- inc/woo-compare-wishlist/includes/compare/settings.php +1 -1
- inc/woo-compare-wishlist/includes/wishlist/wishlist.php +1 -2
- readme.txt +4 -3
- tx-toolkit.php +5 -1
inc/el-widgets/widgets/hello-world.php
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace TXElementorAddons\Widgets;
|
3 |
-
|
4 |
-
use Elementor\Widget_Base;
|
5 |
-
use Elementor\Controls_Manager;
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Elementor Hello World
|
11 |
-
*
|
12 |
-
* Elementor widget for hello world.
|
13 |
-
*
|
14 |
-
* @since 1.0.0
|
15 |
-
*/
|
16 |
-
class Hello_World extends Widget_Base {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Retrieve the widget name.
|
20 |
-
*
|
21 |
-
* @since 1.0.0
|
22 |
-
*
|
23 |
-
* @access public
|
24 |
-
*
|
25 |
-
* @return string Widget name.
|
26 |
-
*/
|
27 |
-
public function get_name() {
|
28 |
-
return 'hello-world';
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Retrieve the widget title.
|
33 |
-
*
|
34 |
-
* @since 1.0.0
|
35 |
-
*
|
36 |
-
* @access public
|
37 |
-
*
|
38 |
-
* @return string Widget title.
|
39 |
-
*/
|
40 |
-
public function get_title() {
|
41 |
-
return __( 'Hello World', 'tx' );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Retrieve the widget icon.
|
46 |
-
*
|
47 |
-
* @since 1.0.0
|
48 |
-
*
|
49 |
-
* @access public
|
50 |
-
*
|
51 |
-
* @return string Widget icon.
|
52 |
-
*/
|
53 |
-
public function get_icon() {
|
54 |
-
return 'eicon-posts-ticker';
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Retrieve the list of categories the widget belongs to.
|
59 |
-
*
|
60 |
-
* Used to determine where to display the widget in the editor.
|
61 |
-
*
|
62 |
-
* Note that currently Elementor supports only one category.
|
63 |
-
* When multiple categories passed, Elementor uses the first one.
|
64 |
-
*
|
65 |
-
* @since 1.0.0
|
66 |
-
*
|
67 |
-
* @access public
|
68 |
-
*
|
69 |
-
* @return array Widget categories.
|
70 |
-
*/
|
71 |
-
public function get_categories() {
|
72 |
-
return [ 'general' ];
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Retrieve the list of scripts the widget depended on.
|
77 |
-
*
|
78 |
-
* Used to set scripts dependencies required to run the widget.
|
79 |
-
*
|
80 |
-
* @since 1.0.0
|
81 |
-
*
|
82 |
-
* @access public
|
83 |
-
*
|
84 |
-
* @return array Widget scripts dependencies.
|
85 |
-
*/
|
86 |
-
public function get_script_depends() {
|
87 |
-
return [ 'elementor-hello-world' ];
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Register the widget controls.
|
92 |
-
*
|
93 |
-
* Adds different input fields to allow the user to change and customize the widget settings.
|
94 |
-
*
|
95 |
-
* @since 1.0.0
|
96 |
-
*
|
97 |
-
* @access protected
|
98 |
-
*/
|
99 |
-
protected function _register_controls() {
|
100 |
-
$this->start_controls_section(
|
101 |
-
'section_content',
|
102 |
-
[
|
103 |
-
'label' => __( 'Content', 'tx' ),
|
104 |
-
]
|
105 |
-
);
|
106 |
-
|
107 |
-
$this->add_control(
|
108 |
-
'title',
|
109 |
-
[
|
110 |
-
'label' => __( 'Title', 'tx' ),
|
111 |
-
'type' => Controls_Manager::TEXT,
|
112 |
-
]
|
113 |
-
);
|
114 |
-
|
115 |
-
$this->end_controls_section();
|
116 |
-
|
117 |
-
$this->start_controls_section(
|
118 |
-
'section_style',
|
119 |
-
[
|
120 |
-
'label' => __( 'Style', 'tx' ),
|
121 |
-
'tab' => Controls_Manager::TAB_STYLE,
|
122 |
-
]
|
123 |
-
);
|
124 |
-
|
125 |
-
$this->add_control(
|
126 |
-
'text_transform',
|
127 |
-
[
|
128 |
-
'label' => __( 'Text Transform', 'tx' ),
|
129 |
-
'type' => Controls_Manager::SELECT,
|
130 |
-
'default' => '',
|
131 |
-
'options' => [
|
132 |
-
'' => __( 'None', 'tx' ),
|
133 |
-
'uppercase' => __( 'UPPERCASE', 'tx' ),
|
134 |
-
'lowercase' => __( 'lowercase', 'tx' ),
|
135 |
-
'capitalize' => __( 'Capitalize', 'tx' ),
|
136 |
-
],
|
137 |
-
'selectors' => [
|
138 |
-
'{{WRAPPER}} .title' => 'text-transform: {{VALUE}};',
|
139 |
-
],
|
140 |
-
]
|
141 |
-
);
|
142 |
-
|
143 |
-
$this->end_controls_section();
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Render the widget output on the frontend.
|
148 |
-
*
|
149 |
-
* Written in PHP and used to generate the final HTML.
|
150 |
-
*
|
151 |
-
* @since 1.0.0
|
152 |
-
*
|
153 |
-
* @access protected
|
154 |
-
*/
|
155 |
-
protected function render() {
|
156 |
-
$settings = $this->get_settings_for_display();
|
157 |
-
|
158 |
-
echo '<div class="title">';
|
159 |
-
echo $settings['title'];
|
160 |
-
echo '</div>';
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Render the widget output in the editor.
|
165 |
-
*
|
166 |
-
* Written as a Backbone JavaScript template and used to generate the live preview.
|
167 |
-
*
|
168 |
-
* @since 1.0.0
|
169 |
-
*
|
170 |
-
* @access protected
|
171 |
-
*/
|
172 |
-
protected function _content_template() {
|
173 |
-
?>
|
174 |
-
<div class="title">
|
175 |
-
{{{ settings.title }}}
|
176 |
-
</div>
|
177 |
-
<?php
|
178 |
-
}
|
179 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/shape-seperators.php
CHANGED
@@ -1,4 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
/* Shape Deviders
|
4 |
================================================== */
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Shape Devider
|
4 |
+
*
|
5 |
+
* @package TemplatesNext ToolKit/inc
|
6 |
+
*/
|
7 |
+
|
8 |
|
9 |
/* Shape Deviders
|
10 |
================================================== */
|
inc/tx-breadcrumb/class.bctx_admin.php
DELETED
@@ -1,783 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
|
20 |
-
//Do a PHP version check, require 5.3 or newer
|
21 |
-
if(version_compare(phpversion(), '5.3.0', '<'))
|
22 |
-
{
|
23 |
-
//Only purpose of this function is to echo out the PHP version error
|
24 |
-
function bctx_phpold()
|
25 |
-
{
|
26 |
-
printf('<div class="notice notice-error"><p>' . __('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, TX Breadcrumb requires %2$s', 'tx-breadcrumb') . '</p></div>', phpversion(), '5.3.0');
|
27 |
-
}
|
28 |
-
//If we are in the admin, let's print a warning then return
|
29 |
-
if(is_admin())
|
30 |
-
{
|
31 |
-
add_action('admin_notices', 'bctx_phpold');
|
32 |
-
}
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
//Include admin base class
|
36 |
-
if(!class_exists('mtekk_adminKit'))
|
37 |
-
{
|
38 |
-
require_once(dirname(__FILE__) . '/includes/class.mtekk_adminkit.php');
|
39 |
-
}
|
40 |
-
/**
|
41 |
-
* The administrative interface class
|
42 |
-
*
|
43 |
-
*/
|
44 |
-
class bctx_admin extends mtekk_adminKit
|
45 |
-
{
|
46 |
-
const version = '6.1.0';
|
47 |
-
protected $full_name = 'TX Breadcrumb Settings';
|
48 |
-
protected $short_name = 'TX Breadcrumb';
|
49 |
-
protected $access_level = 'manage_options';
|
50 |
-
protected $identifier = 'tx-breadcrumb';
|
51 |
-
protected $unique_prefix = 'bctx';
|
52 |
-
protected $plugin_basename = null;
|
53 |
-
protected $support_url = 'https://wordpress.org/support/plugin/tx-breadcrumb/';
|
54 |
-
protected $breadcrumb_trail = null;
|
55 |
-
/**
|
56 |
-
* Administrative interface class default constructor
|
57 |
-
*
|
58 |
-
* @param bctx_breadcrumb_trail $breadcrumb_trail a breadcrumb trail object
|
59 |
-
* @param string $basename The basename of the plugin
|
60 |
-
*/
|
61 |
-
function __construct(bctx_breadcrumb_trail &$breadcrumb_trail, $basename)
|
62 |
-
{
|
63 |
-
$this->breadcrumb_trail =& $breadcrumb_trail;
|
64 |
-
$this->plugin_basename = $basename;
|
65 |
-
$this->full_name = esc_html__('TX Breadcrumb Settings', 'tx-breadcrumb');
|
66 |
-
//Grab defaults from the breadcrumb_trail object
|
67 |
-
$this->opt =& $this->breadcrumb_trail->opt;
|
68 |
-
//We're going to make sure we load the parent's constructor
|
69 |
-
parent::__construct();
|
70 |
-
}
|
71 |
-
/**
|
72 |
-
* admin initialization callback function
|
73 |
-
*
|
74 |
-
* is bound to wordpress action 'admin_init' on instantiation
|
75 |
-
*
|
76 |
-
* @since 3.2.0
|
77 |
-
* @return void
|
78 |
-
*/
|
79 |
-
function init()
|
80 |
-
{
|
81 |
-
//We're going to make sure we run the parent's version of this function as well
|
82 |
-
parent::init();
|
83 |
-
}
|
84 |
-
function wp_loaded()
|
85 |
-
{
|
86 |
-
parent::wp_loaded();
|
87 |
-
tx_breadcrumb::setup_options($this->opt);
|
88 |
-
}
|
89 |
-
/**
|
90 |
-
* Sets hard constants into the options array
|
91 |
-
*
|
92 |
-
* @param &$opts The options array to set hard constants into
|
93 |
-
*/
|
94 |
-
function opts_fix(&$opts)
|
95 |
-
{
|
96 |
-
$opts['bpost_page_hierarchy_display'] = true;
|
97 |
-
$opts['Spost_page_hierarchy_type'] = 'BCN_POST_PARENT';
|
98 |
-
$opts['apost_page_root'] = get_option('page_on_front');
|
99 |
-
}
|
100 |
-
/**
|
101 |
-
* Upgrades input options array, sets to $this->opt
|
102 |
-
*
|
103 |
-
* @param array $opts
|
104 |
-
* @param string $version the version of the passed in options
|
105 |
-
*/
|
106 |
-
function opts_upgrade($opts, $version)
|
107 |
-
{
|
108 |
-
global $wp_post_types, $wp_taxonomies;
|
109 |
-
//If our version is not the same as in the db, time to update
|
110 |
-
if(version_compare($version, $this::version, '<'))
|
111 |
-
{
|
112 |
-
//Upgrading to 3.8.1
|
113 |
-
if(version_compare($version, '3.8.1', '<'))
|
114 |
-
{
|
115 |
-
$opts['post_page_root'] = $this->get_option('page_on_front');
|
116 |
-
$opts['post_post_root'] = $this->get_option('page_for_posts');
|
117 |
-
}
|
118 |
-
//Upgrading to 4.0
|
119 |
-
if(version_compare($version, '4.0.0', '<'))
|
120 |
-
{
|
121 |
-
//Only migrate if we haven't migrated yet
|
122 |
-
if(isset($opts['current_item_linked']))
|
123 |
-
{
|
124 |
-
//Loop through the old options, migrate some of them
|
125 |
-
foreach($opts as $option => $value)
|
126 |
-
{
|
127 |
-
//Handle all of our boolean options first, they're real easy, just add a 'b'
|
128 |
-
if(strpos($option, 'display') > 0 || $option == 'current_item_linked')
|
129 |
-
{
|
130 |
-
$this->breadcrumb_trail->opt['b' . $option] = $value;
|
131 |
-
}
|
132 |
-
//Handle migration of anchor templates to the templates
|
133 |
-
else if(strpos($option, 'anchor') > 0)
|
134 |
-
{
|
135 |
-
$parts = explode('_', $option);
|
136 |
-
//Do excess slash removal sanitation
|
137 |
-
$this->breadcrumb_trail->opt['H' . $parts[0] . '_template'] = $value . '%htitle%</a>';
|
138 |
-
}
|
139 |
-
//Handle our abs integers
|
140 |
-
else if($option == 'max_title_length' || $option == 'post_post_root' || $option == 'post_page_root')
|
141 |
-
{
|
142 |
-
$this->breadcrumb_trail->opt['a' . $option] = $value;
|
143 |
-
}
|
144 |
-
//Now everything else, minus prefix and suffix
|
145 |
-
else if(strpos($option, 'prefix') === false && strpos($option, 'suffix') === false)
|
146 |
-
{
|
147 |
-
$this->breadcrumb_trail->opt['S' . $option] = $value;
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
//Add in the new settings for CPTs introduced in 4.0
|
152 |
-
foreach($wp_post_types as $post_type)
|
153 |
-
{
|
154 |
-
//We only want custom post types
|
155 |
-
if(!$post_type->_builtin)
|
156 |
-
{
|
157 |
-
//Add in the archive_display option
|
158 |
-
$this->breadcrumb_trail->opt['bpost_' . $post_type->name . '_archive_display'] = $post_type->has_archive;
|
159 |
-
}
|
160 |
-
}
|
161 |
-
$opts = $this->breadcrumb_trail->opt;
|
162 |
-
}
|
163 |
-
if(version_compare($version, '4.0.1', '<'))
|
164 |
-
{
|
165 |
-
if(isset($opts['Hcurrent_item_template_no_anchor']))
|
166 |
-
{
|
167 |
-
unset($opts['Hcurrent_item_template_no_anchor']);
|
168 |
-
}
|
169 |
-
if(isset($opts['Hcurrent_item_template']))
|
170 |
-
{
|
171 |
-
unset($opts['Hcurrent_item_template']);
|
172 |
-
}
|
173 |
-
}
|
174 |
-
//Upgrading to 4.3.0
|
175 |
-
if(version_compare($version, '4.3.0', '<'))
|
176 |
-
{
|
177 |
-
//Removed home_title
|
178 |
-
if(isset($opts['Shome_title']))
|
179 |
-
{
|
180 |
-
unset($opts['Shome_title']);
|
181 |
-
}
|
182 |
-
//Removed mainsite_title
|
183 |
-
if(isset($opts['Smainsite_title']))
|
184 |
-
{
|
185 |
-
unset($opts['Smainsite_title']);
|
186 |
-
}
|
187 |
-
}
|
188 |
-
//Upgrading to 5.1.0
|
189 |
-
if(version_compare($version, '5.1.0', '<'))
|
190 |
-
{
|
191 |
-
foreach($wp_taxonomies as $taxonomy)
|
192 |
-
{
|
193 |
-
//If we have the old options style for it, update
|
194 |
-
if($taxonomy->name !== 'post_format' && isset($opts['H' . $taxonomy->name . '_template']))
|
195 |
-
{
|
196 |
-
//Migrate to the new setting name
|
197 |
-
$opts['Htax_' . $taxonomy->name . '_template'] = $opts['H' . $taxonomy->name . '_template'];
|
198 |
-
$opts['Htax_' . $taxonomy->name . '_template_no_anchor'] = $opts['H' . $taxonomy->name . '_template_no_anchor'];
|
199 |
-
//Clean up old settings
|
200 |
-
unset($opts['H' . $taxonomy->name . '_template']);
|
201 |
-
unset($opts['H' . $taxonomy->name . '_template_no_anchor']);
|
202 |
-
}
|
203 |
-
}
|
204 |
-
}
|
205 |
-
//Upgrading to 5.4.0
|
206 |
-
if(version_compare($version, '5.4.0', '<'))
|
207 |
-
{
|
208 |
-
//Migrate users to schema.org breadcrumbs for author and search if still on the defaults for posts
|
209 |
-
if($opts['Hpost_post_template'] === bctx_breadcrumb::get_default_template() && $opts['Hpost_post_template_no_anchor'] === bctx_breadcrumb::default_template_no_anchor)
|
210 |
-
{
|
211 |
-
if($opts['Hpaged_template'] === 'Page %htitle%')
|
212 |
-
{
|
213 |
-
$opts['Hpaged_template'] = $this->opt['Hpaged_template'];
|
214 |
-
}
|
215 |
-
if($opts['Hsearch_template'] === 'Search results for '<a title="Go to the first page of search results for %title%." href="%link%" class="%type%">%htitle%</a>'' || $opts['Hsearch_template'] === 'Search results for '<a title="Go to the first page of search results for %title%." href="%link%" class="%type%">%htitle%</a>'')
|
216 |
-
{
|
217 |
-
$opts['Hsearch_template'] = $this->opt['Hsearch_template'];
|
218 |
-
}
|
219 |
-
if($opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'' || $opts['Hsearch_template_no_anchor'] === 'Search results for '%htitle%'')
|
220 |
-
{
|
221 |
-
$opts['Hsearch_template_no_anchor'] = $this->opt['Hsearch_template_no_anchor'];
|
222 |
-
}
|
223 |
-
if($opts['Hauthor_template'] === 'Articles by: <a title="Go to the first page of posts by %title%." href="%link%" class="%type%">%htitle%</a>')
|
224 |
-
{
|
225 |
-
$opts['Hauthor_template'] = $this->opt['Hauthor_template'];
|
226 |
-
}
|
227 |
-
if($opts['Hauthor_template_no_anchor'] === 'Articles by: %htitle%')
|
228 |
-
{
|
229 |
-
$opts['Hauthor_template_no_anchor'] = $this->opt['Hauthor_template_no_anchor'];
|
230 |
-
}
|
231 |
-
}
|
232 |
-
}
|
233 |
-
//Upgrading to 5.5.0
|
234 |
-
if(version_compare($version, '5.5.0', '<'))
|
235 |
-
{
|
236 |
-
//Translate the old 'page' taxonomy type to BCN_POST_PARENT
|
237 |
-
if($this->opt['Spost_post_taxonomy_type'] === 'page')
|
238 |
-
{
|
239 |
-
$this->opt['Spost_post_taxonomy_type'] = 'BCN_POST_PARENT';
|
240 |
-
}
|
241 |
-
if(!isset($this->opt['Spost_post_taxonomy_referer']))
|
242 |
-
{
|
243 |
-
$this->opt['bpost_post_taxonomy_referer'] = false;
|
244 |
-
}
|
245 |
-
//Loop through all of the post types in the array
|
246 |
-
foreach($wp_post_types as $post_type)
|
247 |
-
{
|
248 |
-
//Check for non-public CPTs
|
249 |
-
if(!apply_filters('bctx_show_cpt_private', $post_type->public, $post_type->name))
|
250 |
-
{
|
251 |
-
continue;
|
252 |
-
}
|
253 |
-
//We only want custom post types
|
254 |
-
if(!$post_type->_builtin)
|
255 |
-
{
|
256 |
-
//Translate the old 'page' taxonomy type to BCN_POST_PARENT
|
257 |
-
if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'page')
|
258 |
-
{
|
259 |
-
$this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_POST_PARENT';
|
260 |
-
}
|
261 |
-
//Translate the old 'date' taxonomy type to BCN_DATE
|
262 |
-
if($this->opt['Spost_' . $post_type->name . '_taxonomy_type'] === 'date')
|
263 |
-
{
|
264 |
-
$this->opt['Spost_' . $post_type->name . '_taxonomy_type'] = 'BCN_DATE';
|
265 |
-
}
|
266 |
-
if(!isset($this->opt['Spost_' . $post_type->name . '_taxonomy_referer']))
|
267 |
-
{
|
268 |
-
$this->opt['bpost_' . $post_type->name . '_taxonomy_referer'] = false;
|
269 |
-
}
|
270 |
-
}
|
271 |
-
}
|
272 |
-
}
|
273 |
-
//Upgrading to 6.0.0
|
274 |
-
if(version_compare($version, '6.0.0', '<'))
|
275 |
-
{
|
276 |
-
//Loop through all of the post types in the array
|
277 |
-
foreach($wp_post_types as $post_type)
|
278 |
-
{
|
279 |
-
if(isset($this->opt['Spost_' . $post_type->name . '_taxonomy_type']))
|
280 |
-
{
|
281 |
-
$this->opt['Spost_' . $post_type->name . '_hierarchy_type'] = $this->opt['Spost_' . $post_type->name . '_taxonomy_type'];
|
282 |
-
unset($this->opt['Spost_' . $post_type->name . '_taxonomy_type']);
|
283 |
-
}
|
284 |
-
if(isset($this->opt['Spost_' . $post_type->name . '_taxonomy_display']))
|
285 |
-
{
|
286 |
-
$this->opt['Spost_' . $post_type->name . '_hierarchy_display'] = $this->opt['Spost_' . $post_type->name . '_taxonomy_display'];
|
287 |
-
unset($this->opt['Spost_' . $post_type->name . '_taxonomy_display']);
|
288 |
-
}
|
289 |
-
}
|
290 |
-
}
|
291 |
-
//Set the max title length to 20 if we are not limiting the title and the length was 0
|
292 |
-
if(!$opts['blimit_title'] && $opts['amax_title_length'] == 0)
|
293 |
-
{
|
294 |
-
$opts['amax_title_length'] = 20;
|
295 |
-
}
|
296 |
-
}
|
297 |
-
//Save the passed in opts to the object's option array
|
298 |
-
$this->opt = $opts;
|
299 |
-
//End with resetting up the options
|
300 |
-
tx_breadcrumb::setup_options($this->opt);
|
301 |
-
}
|
302 |
-
function opts_update_prebk(&$opts)
|
303 |
-
{
|
304 |
-
//This may no longer be needed
|
305 |
-
tx_breadcrumb::setup_options($opts);
|
306 |
-
$opts = apply_filters('bctx_opts_update_prebk', $opts);
|
307 |
-
}
|
308 |
-
/**
|
309 |
-
* help action hook function
|
310 |
-
*
|
311 |
-
* @return string
|
312 |
-
*
|
313 |
-
*/
|
314 |
-
function help()
|
315 |
-
{
|
316 |
-
$screen = get_current_screen();
|
317 |
-
//Exit early if the add_help_tab function doesn't exist
|
318 |
-
if(!method_exists($screen, 'add_help_tab'))
|
319 |
-
{
|
320 |
-
return;
|
321 |
-
}
|
322 |
-
//Add contextual help on current screen
|
323 |
-
if($screen->id == 'settings_page_' . $this->identifier)
|
324 |
-
{
|
325 |
-
$general_tab = '<p>' . esc_html__('Tips for the settings are located below select options.', 'tx-breadcrumb') .
|
326 |
-
'</p><h5>' . esc_html__('Resources', 'tx-breadcrumb') . '</h5><ul><li>' .
|
327 |
-
sprintf(esc_html__("%sTutorials and How Tos%s: There are several guides, tutorials, and how tos available on the author's website.", 'tx-breadcrumb'),'<a title="' . esc_attr__('Go to the TX Breadcrumb tag archive.', 'tx-breadcrumb') . '" href="https://mtekk.us/archives/tag/tx-breadcrumb">', '</a>') . '</li><li>' .
|
328 |
-
sprintf(esc_html__('%sOnline Documentation%s: Check out the documentation for more indepth technical information.', 'tx-breadcrumb'), '<a title="' . esc_attr__('Go to the TX Breadcrumb online documentation', 'tx-breadcrumb') . '" href="https://mtekk.us/code/tx-breadcrumb/tx-breadcrumb-doc/">', '</a>') . '</li><li>' .
|
329 |
-
sprintf(esc_html__('%sReport a Bug%s: If you think you have found a bug, please include your WordPress version and details on how to reproduce the bug.', 'tx-breadcrumb'),'<a title="' . esc_attr__('Go to the TX Breadcrumb support post for your version.', 'tx-breadcrumb') . '" href="https://wordpress.org/support/plugin/tx-breadcrumb/">', '</a>') . '</li></ul>' .
|
330 |
-
'<h5>' . esc_html__('Giving Back', 'tx-breadcrumb') . '</h5><ul><li>' .
|
331 |
-
sprintf(esc_html__('%sDonate%s: Love TX Breadcrumb and want to help development? Consider buying the author a beer.', 'tx-breadcrumb'),'<a title="' . esc_attr__('Go to PayPal to give a donation to TX Breadcrumb.', 'tx-breadcrumb') . '" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FD5XEU783BR8U&lc=US&item_name=Breadcrumb%20NavXT%20Donation¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">', '</a>') . '</li><li>' .
|
332 |
-
sprintf(esc_html__('%sTranslate%s: Is your language not available? Visit the TX Breadcrumb translation project on WordPress.org to start translating.', 'tx-breadcrumb'),'<a title="' . esc_attr__('Go to the TX Breadcrumb translation project.', 'tx-breadcrumb') . '" href="https://translate.wordpress.org/projects/wp-plugins/tx-breadcrumb">', '</a>') . '</li></ul>';
|
333 |
-
|
334 |
-
$screen->add_help_tab(
|
335 |
-
array(
|
336 |
-
'id' => $this->identifier . '-base',
|
337 |
-
'title' => __('General', 'tx-breadcrumb'),
|
338 |
-
'content' => $general_tab
|
339 |
-
));
|
340 |
-
$quickstart_tab = '<p>' . esc_html__('For the settings on this page to take effect, you must either use the included TX Breadcrumb widget, or place either of the code sections below into your theme.', 'tx-breadcrumb') .
|
341 |
-
'</p><h5>' . esc_html__('Breadcrumb trail with separators', 'tx-breadcrumb') . '</h5><pre><code><div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">' . "
|
342 |
-
<?php if(function_exists('bctx_display'))
|
343 |
-
{
|
344 |
-
bctx_display();
|
345 |
-
}?>
|
346 |
-
</div></code></pre>" .
|
347 |
-
'<h5>' . esc_html__('Breadcrumb trail in list form', 'tx-breadcrumb').'</h5><pre><code><ol class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">'."
|
348 |
-
<?php if(function_exists('bctx_display_list'))
|
349 |
-
{
|
350 |
-
bctx_display_list();
|
351 |
-
}?>
|
352 |
-
</ol></code></pre>";
|
353 |
-
$screen->add_help_tab(
|
354 |
-
array(
|
355 |
-
'id' => $this->identifier . '-quick-start',
|
356 |
-
'title' => __('Quick Start', 'tx-breadcrumb'),
|
357 |
-
'content' => $quickstart_tab
|
358 |
-
));
|
359 |
-
$styling_tab = '<p>' . esc_html__('Using the code from the Quick Start section above, the following CSS can be used as base for styling your breadcrumb trail.', 'tx-breadcrumb') . '</p>' .
|
360 |
-
'<pre><code>.breadcrumbs
|
361 |
-
{
|
362 |
-
font-size: 1.1em;
|
363 |
-
color: #fff;
|
364 |
-
margin: 30px 0 0 10px;
|
365 |
-
position: relative;
|
366 |
-
float: left;
|
367 |
-
}</code></pre>';
|
368 |
-
$screen->add_help_tab(
|
369 |
-
array(
|
370 |
-
'id' => $this->identifier . '-styling',
|
371 |
-
'title' => __('Styling', 'tx-breadcrumb'),
|
372 |
-
'content' => $styling_tab
|
373 |
-
));
|
374 |
-
$screen->add_help_tab(
|
375 |
-
array(
|
376 |
-
'id' => $this->identifier . '-import-export-reset',
|
377 |
-
'title' => __('Import/Export/Reset', 'tx-breadcrumb'),
|
378 |
-
'content' => $this->import_form()
|
379 |
-
));
|
380 |
-
}
|
381 |
-
}
|
382 |
-
/**
|
383 |
-
* enqueue's the tab style sheet on the settings page
|
384 |
-
*/
|
385 |
-
function admin_styles()
|
386 |
-
{
|
387 |
-
wp_enqueue_style('mtekk_adminkit_tabs');
|
388 |
-
}
|
389 |
-
/**
|
390 |
-
* enqueue's the tab js and translation js on the settings page
|
391 |
-
*/
|
392 |
-
function admin_scripts()
|
393 |
-
{
|
394 |
-
//Enqueue ui-tabs
|
395 |
-
wp_enqueue_script('jquery-ui-tabs');
|
396 |
-
//Enqueue the admin tabs javascript
|
397 |
-
wp_enqueue_script('mtekk_adminkit_tabs');
|
398 |
-
//Load the translations for the tabs
|
399 |
-
wp_localize_script('mtekk_adminkit_tabs', 'objectL10n', array(
|
400 |
-
'mtad_uid' => 'bctx_admin',
|
401 |
-
'mtad_import' => __('Import', 'tx-breadcrumb'),
|
402 |
-
'mtad_export' => __('Export', 'tx-breadcrumb'),
|
403 |
-
'mtad_reset' => __('Reset', 'tx-breadcrumb'),
|
404 |
-
));
|
405 |
-
//Enqueue the admin enable/disable groups javascript
|
406 |
-
wp_enqueue_script('mtekk_adminkit_engroups');
|
407 |
-
}
|
408 |
-
/**
|
409 |
-
* A message function that checks for the BCN_SETTINGS_* define statement
|
410 |
-
*/
|
411 |
-
function multisite_settings_warn()
|
412 |
-
{
|
413 |
-
if(is_multisite())
|
414 |
-
{
|
415 |
-
if(defined('BCN_SETTINGS_USE_LOCAL') && BCN_SETTINGS_USE_LOCAL)
|
416 |
-
{
|
417 |
-
|
418 |
-
}
|
419 |
-
else if(defined('BCN_SETTINGS_USE_NETWORK') && BCN_SETTINGS_USE_NETWORK)
|
420 |
-
{
|
421 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Your network settings will override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_is_nsiteoveride');
|
422 |
-
}
|
423 |
-
else if(defined('BCN_SETTINGS_FAVOR_LOCAL') && BCN_SETTINGS_FAVOR_LOCAL)
|
424 |
-
{
|
425 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Your network settings may override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_is_isitemayoveride');
|
426 |
-
}
|
427 |
-
else if(defined('BCN_SETTINGS_FAVOR_NETWORK') && BCN_SETTINGS_FAVOR_NETWORK)
|
428 |
-
{
|
429 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Your network settings may override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_is_nsitemayoveride');
|
430 |
-
}
|
431 |
-
//Fall through if no settings mode was set
|
432 |
-
else
|
433 |
-
{
|
434 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: No BCN_SETTINGS_* define statement found, defaulting to BCN_SETTINGS_USE_LOCAL.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_is_nosetting');
|
435 |
-
}
|
436 |
-
}
|
437 |
-
}
|
438 |
-
/**
|
439 |
-
* A message function that checks for deprecated settings that are set and warns the user
|
440 |
-
*/
|
441 |
-
function deprecated_settings_warn()
|
442 |
-
{
|
443 |
-
//We're deprecating the limit title length setting, let the user know the new method of accomplishing this
|
444 |
-
if(isset($this->opt['blimit_title']) && $this->opt['blimit_title'])
|
445 |
-
{
|
446 |
-
$this->messages[] = new mtekk_adminKit_message(sprintf(esc_html__('Warning: Your are using a deprecated setting "Title Length" (see Miscellaneous > Deprecated), please %1$suse CSS instead%2$s.', 'tx-breadcrumb'), '<a title="' . __('Go to the guide on trimming breadcrumb title lengths with CSS', 'tx-breadcrumb') . '" href="https://mtekk.us/archives/guides/trimming-breadcrumb-title-lengths-with-css/">', '</a>'), 'warning');
|
447 |
-
}
|
448 |
-
}
|
449 |
-
/**
|
450 |
-
* Function checks the current site to see if the blog options should be disabled
|
451 |
-
*
|
452 |
-
* @return boool Whether or not the blog options should be disabled
|
453 |
-
*/
|
454 |
-
function maybe_disable_blog_options()
|
455 |
-
{
|
456 |
-
return (get_option('show_on_front') !== 'page' || get_option('page_for_posts') < 1);
|
457 |
-
}
|
458 |
-
/**
|
459 |
-
* Function checks the current site to see if the mainsite options should be disabled
|
460 |
-
*
|
461 |
-
* @return bool Whether or not the mainsite options should be disabled
|
462 |
-
*/
|
463 |
-
function maybe_disable_mainsite_options()
|
464 |
-
{
|
465 |
-
return !is_multisite();
|
466 |
-
}
|
467 |
-
/**
|
468 |
-
* The administrative page for TX Breadcrumb
|
469 |
-
*/
|
470 |
-
function admin_page()
|
471 |
-
{
|
472 |
-
global $wp_taxonomies, $wp_post_types;
|
473 |
-
$this->security();
|
474 |
-
//Do a check on deprecated settings
|
475 |
-
$this->deprecated_settings_warn();
|
476 |
-
//Do a check for multisite settings mode
|
477 |
-
$this->multisite_settings_warn();
|
478 |
-
do_action($this->unique_prefix . '_settings_pre_messages', $this->opt);
|
479 |
-
//Display our messages
|
480 |
-
$this->messages();
|
481 |
-
?>
|
482 |
-
<div class="wrap"><h2><?php echo $this->full_name; ?></h2>
|
483 |
-
<?php
|
484 |
-
//We exit after the version check if there is an action the user needs to take before saving settings
|
485 |
-
if(!$this->version_check($this->get_option($this->unique_prefix . '_version')))
|
486 |
-
{
|
487 |
-
return;
|
488 |
-
}
|
489 |
-
?>
|
490 |
-
<form action="<?php echo $this->admin_url(); ?>" method="post" id="bctx_admin-options">
|
491 |
-
<?php settings_fields('bctx_options');?>
|
492 |
-
<div id="hasadmintabs">
|
493 |
-
<fieldset id="general" class="bctx_options">
|
494 |
-
<h3 class="tab-title" title="<?php _e('A collection of settings most likely to be modified are located under this tab.', 'tx-breadcrumb');?>"><?php _e('General', 'tx-breadcrumb'); ?></h3>
|
495 |
-
<h3><?php _e('General', 'tx-breadcrumb'); ?></h3>
|
496 |
-
<table class="form-table">
|
497 |
-
<?php
|
498 |
-
$this->textbox(__('Breadcrumb Separator', 'tx-breadcrumb'), 'hseparator', '2', false, __('Placed in between each breadcrumb.', 'tx-breadcrumb'));
|
499 |
-
do_action($this->unique_prefix . '_settings_general', $this->opt);
|
500 |
-
?>
|
501 |
-
</table>
|
502 |
-
<h3><?php _e('Current Item', 'tx-breadcrumb'); ?></h3>
|
503 |
-
<table class="form-table adminkit-enset-top">
|
504 |
-
<?php
|
505 |
-
$this->input_check(__('Link Current Item', 'tx-breadcrumb'), 'bcurrent_item_linked', __('Yes', 'tx-breadcrumb'));
|
506 |
-
$this->input_check(_x('Paged Breadcrumb', 'Paged as in when on an archive or post that is split into multiple pages', 'tx-breadcrumb'), 'bpaged_display', __('Place the page number breadcrumb in the trail.', 'tx-breadcrumb'), false, __('Indicates that the user is on a page other than the first of a paginated archive or post.', 'tx-breadcrumb'), 'adminkit-enset-ctrl adminkit-enset');
|
507 |
-
$this->textbox(_x('Paged Template', 'Paged as in when on an archive or post that is split into multiple pages', 'tx-breadcrumb'), 'Hpaged_template', '4', false, __('The template for paged breadcrumbs.', 'tx-breadcrumb'), 'adminkit-enset');
|
508 |
-
do_action($this->unique_prefix . '_settings_current_item', $this->opt);
|
509 |
-
?>
|
510 |
-
</table>
|
511 |
-
<h3><?php _e('Home Breadcrumb', 'tx-breadcrumb'); ?></h3>
|
512 |
-
<table class="form-table adminkit-enset-top">
|
513 |
-
<?php
|
514 |
-
$this->input_check(__('Home Breadcrumb', 'tx-breadcrumb'), 'bhome_display', __('Place the home breadcrumb in the trail.', 'tx-breadcrumb'), false, '', 'adminkit-enset-ctrl adminkit-enset');
|
515 |
-
$this->textbox(__('Home Template', 'tx-breadcrumb'), 'Hhome_template', '6', false, __('The template for the home breadcrumb.', 'tx-breadcrumb'), 'adminkit-enset');
|
516 |
-
$this->textbox(__('Home Template (Unlinked)', 'tx-breadcrumb'), 'Hhome_template_no_anchor', '4', false, __('The template for the home breadcrumb, used when the breadcrumb is not linked.', 'tx-breadcrumb'), 'adminkit-enset');
|
517 |
-
do_action($this->unique_prefix . '_settings_home', $this->opt);
|
518 |
-
?>
|
519 |
-
</table>
|
520 |
-
<h3><?php _e('Blog Breadcrumb', 'tx-breadcrumb'); ?></h3>
|
521 |
-
<table class="form-table adminkit-enset-top">
|
522 |
-
<?php
|
523 |
-
$this->input_check(__('Blog Breadcrumb', 'tx-breadcrumb'), 'bblog_display', __('Place the blog breadcrumb in the trail.', 'tx-breadcrumb'), $this->maybe_disable_blog_options(), '', 'adminkit-enset-ctrl adminkit-enset');
|
524 |
-
do_action($this->unique_prefix . '_settings_blog', $this->opt);
|
525 |
-
?>
|
526 |
-
</table>
|
527 |
-
<h3><?php _e('Mainsite Breadcrumb', 'tx-breadcrumb'); ?></h3>
|
528 |
-
<table class="form-table adminkit-enset-top">
|
529 |
-
<?php
|
530 |
-
$this->input_check(__('Main Site Breadcrumb', 'tx-breadcrumb'), 'bmainsite_display', __('Place the main site home breadcrumb in the trail in an multisite setup.', 'tx-breadcrumb'), $this->maybe_disable_mainsite_options(), '', 'adminkit-enset-ctrl adminkit-enset');
|
531 |
-
$this->textbox(__('Main Site Home Template', 'tx-breadcrumb'), 'Hmainsite_template', '6', $this->maybe_disable_mainsite_options(), __('The template for the main site home breadcrumb, used only in multisite environments.', 'tx-breadcrumb'), 'adminkit-enset');
|
532 |
-
$this->textbox(__('Main Site Home Template (Unlinked)', 'tx-breadcrumb'), 'Hmainsite_template_no_anchor', '4', $this->maybe_disable_mainsite_options(), __('The template for the main site home breadcrumb, used only in multisite environments and when the breadcrumb is not linked.', 'tx-breadcrumb'), 'adminkit-enset');
|
533 |
-
do_action($this->unique_prefix . '_settings_mainsite', $this->opt);
|
534 |
-
?>
|
535 |
-
</table>
|
536 |
-
<?php do_action($this->unique_prefix . '_after_settings_tab_general', $this->opt); ?>
|
537 |
-
</fieldset>
|
538 |
-
<fieldset id="post" class="bctx_options">
|
539 |
-
<h3 class="tab-title" title="<?php _e('The settings for all post types (Posts, Pages, and Custom Post Types) are located under this tab.', 'tx-breadcrumb');?>"><?php _e('Post Types', 'tx-breadcrumb'); ?></h3>
|
540 |
-
<h3><?php _e('Posts', 'tx-breadcrumb'); ?></h3>
|
541 |
-
<table class="form-table adminkit-enset-top">
|
542 |
-
<?php
|
543 |
-
$this->textbox(__('Post Template', 'tx-breadcrumb'), 'Hpost_post_template', '6', false, __('The template for post breadcrumbs.', 'tx-breadcrumb'));
|
544 |
-
$this->textbox(__('Post Template (Unlinked)', 'tx-breadcrumb'), 'Hpost_post_template_no_anchor', '4', false, __('The template for post breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
545 |
-
$this->input_check(__('Post Hierarchy Display', 'tx-breadcrumb'), 'bpost_post_hierarchy_display', __('Show the hierarchy (specified below) leading to a post in the breadcrumb trail.', 'tx-breadcrumb'), false, '', 'adminkit-enset-ctrl adminkit-enset');
|
546 |
-
$this->input_check(__('Post Hierarchy Referer Influence', 'tx-breadcrumb'), 'bpost_post_taxonomy_referer', __('Allow the referring page to influence the taxonomy selected for the hierarchy.', 'tx-breadcrumb'), false, '', 'adminkit-enset');
|
547 |
-
?>
|
548 |
-
<tr valign="top">
|
549 |
-
<th scope="row">
|
550 |
-
<?php _e('Post Hierarchy', 'tx-breadcrumb'); ?>
|
551 |
-
</th>
|
552 |
-
<td>
|
553 |
-
<?php
|
554 |
-
$this->input_radio('Spost_post_hierarchy_type', 'category', __('Categories'), false, 'adminkit-enset');
|
555 |
-
$this->input_radio('Spost_post_hierarchy_type', 'BCN_DATE', __('Dates', 'tx-breadcrumb'), false, 'adminkit-enset');
|
556 |
-
$this->input_radio('Spost_post_hierarchy_type', 'post_tag', __('Tags'), false, 'adminkit-enset');
|
557 |
-
//We use the value 'page' but really, this will follow the parent post hierarchy
|
558 |
-
$this->input_radio('Spost_post_hierarchy_type', 'BCN_POST_PARENT', __('Post Parent', 'tx-breadcrumb'), false, 'adminkit-enset');
|
559 |
-
//Loop through all of the taxonomies in the array
|
560 |
-
foreach($wp_taxonomies as $taxonomy)
|
561 |
-
{
|
562 |
-
//Check for non-public taxonomies
|
563 |
-
if(!apply_filters('bctx_show_tax_private', $taxonomy->public, $taxonomy->name, 'post'))
|
564 |
-
{
|
565 |
-
continue;
|
566 |
-
}
|
567 |
-
//We only want custom taxonomies
|
568 |
-
if(($taxonomy->object_type == 'post' || is_array($taxonomy->object_type) && in_array('post', $taxonomy->object_type)) && !$taxonomy->_builtin)
|
569 |
-
{
|
570 |
-
$this->input_radio('Spost_post_hierarchy_type', $taxonomy->name, mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'), false, 'adminkit-enset');
|
571 |
-
}
|
572 |
-
}
|
573 |
-
?>
|
574 |
-
<p class="description"><?php esc_html_e('The hierarchy which the breadcrumb trail will show. Note that the "Post Parent" option may require an additional plugin to behave as expected since this is a non-hierarchical post type.', 'tx-breadcrumb'); ?></p>
|
575 |
-
</td>
|
576 |
-
</tr>
|
577 |
-
</table>
|
578 |
-
<h3><?php _e('Pages', 'tx-breadcrumb'); ?></h3>
|
579 |
-
<table class="form-table">
|
580 |
-
<?php
|
581 |
-
$this->textbox(__('Page Template', 'tx-breadcrumb'), 'Hpost_page_template', '6', false, __('The template for page breadcrumbs.', 'tx-breadcrumb'));
|
582 |
-
$this->textbox(__('Page Template (Unlinked)', 'tx-breadcrumb'), 'Hpost_page_template_no_anchor', '4', false, __('The template for page breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
583 |
-
$this->input_hidden('bpost_page_hierarchy_display');
|
584 |
-
$this->input_hidden('Spost_page_hierarchy_type');
|
585 |
-
?>
|
586 |
-
</table>
|
587 |
-
<h3><?php _e('Attachments', 'tx-breadcrumb'); ?></h3>
|
588 |
-
<table class="form-table">
|
589 |
-
<?php
|
590 |
-
$this->textbox(__('Attachment Template', 'tx-breadcrumb'), 'Hpost_attachment_template', '6', false, __('The template for attachment breadcrumbs.', 'tx-breadcrumb'));
|
591 |
-
$this->textbox(__('Attachment Template (Unlinked)', 'tx-breadcrumb'), 'Hpost_attachment_template_no_anchor', '4', false, __('The template for attachment breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
592 |
-
?>
|
593 |
-
</table>
|
594 |
-
<?php
|
595 |
-
//Loop through all of the post types in the array
|
596 |
-
foreach($wp_post_types as $post_type)
|
597 |
-
{
|
598 |
-
//Check for non-public CPTs
|
599 |
-
if(!apply_filters('bctx_show_cpt_private', $post_type->public, $post_type->name))
|
600 |
-
{
|
601 |
-
continue;
|
602 |
-
}
|
603 |
-
//We only want custom post types
|
604 |
-
if(!$post_type->_builtin)
|
605 |
-
{
|
606 |
-
$singular_name_lc = mb_strtolower($post_type->labels->singular_name, 'UTF-8');
|
607 |
-
?>
|
608 |
-
<h3><?php echo $post_type->labels->singular_name; ?></h3>
|
609 |
-
<table class="form-table adminkit-enset-top">
|
610 |
-
<?php
|
611 |
-
$this->textbox(sprintf(__('%s Template', 'tx-breadcrumb'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template', '6', false, sprintf(__('The template for %s breadcrumbs.', 'tx-breadcrumb'), $singular_name_lc));
|
612 |
-
$this->textbox(sprintf(__('%s Template (Unlinked)', 'tx-breadcrumb'), $post_type->labels->singular_name), 'Hpost_' . $post_type->name . '_template_no_anchor', '4', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'), $singular_name_lc));
|
613 |
-
$optid = mtekk_adminKit::get_valid_id('apost_' . $post_type->name . '_root');
|
614 |
-
?>
|
615 |
-
<tr valign="top">
|
616 |
-
<th scope="row">
|
617 |
-
<label for="<?php echo $optid;?>"><?php printf(esc_html__('%s Root Page', 'tx-breadcrumb'), $post_type->labels->singular_name);?></label>
|
618 |
-
</th>
|
619 |
-
<td>
|
620 |
-
<?php wp_dropdown_pages(array('name' => $this->unique_prefix . '_options[apost_' . $post_type->name . '_root]', 'id' => $optid, 'echo' => 1, 'show_option_none' => __( '— Select —' ), 'option_none_value' => '0', 'selected' => $this->opt['apost_' . $post_type->name . '_root']));?>
|
621 |
-
</td>
|
622 |
-
</tr>
|
623 |
-
<?php
|
624 |
-
$this->input_check(sprintf(__('%s Archive Display', 'tx-breadcrumb'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_archive_display', sprintf(__('Show the breadcrumb for the %s post type archives in the breadcrumb trail.', 'tx-breadcrumb'), $singular_name_lc), !$post_type->has_archive);
|
625 |
-
$this->input_check(sprintf(__('%s Hierarchy Display', 'tx-breadcrumb'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_hierarchy_display', sprintf(__('Show the hierarchy (specified below) leading to a %s in the breadcrumb trail.', 'tx-breadcrumb'), $singular_name_lc), false, '', 'adminkit-enset-ctrl adminkit-enset');
|
626 |
-
$this->input_check(sprintf(__('%s Hierarchy Referer Influence', 'tx-breadcrumb'), $post_type->labels->singular_name), 'bpost_' . $post_type->name . '_taxonomy_referer', __('Allow the referring page to influence the taxonomy selected for the hierarchy.', 'tx-breadcrumb'), false, '', 'adminkit-enset');
|
627 |
-
?>
|
628 |
-
<tr valign="top">
|
629 |
-
<th scope="row">
|
630 |
-
<?php printf(__('%s Hierarchy', 'tx-breadcrumb'), $post_type->labels->singular_name); ?>
|
631 |
-
</th>
|
632 |
-
<td>
|
633 |
-
<?php
|
634 |
-
//We use the value 'page' but really, this will follow the parent post hierarchy
|
635 |
-
$this->input_radio('Spost_' . $post_type->name . '_hierarchy_type', 'BCN_POST_PARENT', __('Post Parent', 'tx-breadcrumb'), false, 'adminkit-enset');
|
636 |
-
$this->input_radio('Spost_' . $post_type->name . '_hierarchy_type', 'BCN_DATE', __('Dates', 'tx-breadcrumb'), false, 'adminkit-enset');
|
637 |
-
//Loop through all of the taxonomies in the array
|
638 |
-
foreach($wp_taxonomies as $taxonomy)
|
639 |
-
{
|
640 |
-
//Check for non-public taxonomies
|
641 |
-
if(!apply_filters('bctx_show_tax_private', $taxonomy->public, $taxonomy->name, $post_type->name))
|
642 |
-
{
|
643 |
-
continue;
|
644 |
-
}
|
645 |
-
//We only want custom taxonomies
|
646 |
-
if($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type))
|
647 |
-
{
|
648 |
-
$this->input_radio('Spost_' . $post_type->name . '_hierarchy_type', $taxonomy->name, $taxonomy->labels->singular_name, false, 'adminkit-enset');
|
649 |
-
}
|
650 |
-
}
|
651 |
-
?>
|
652 |
-
<p class="description">
|
653 |
-
<?php
|
654 |
-
if($post_type->hierarchical)
|
655 |
-
{
|
656 |
-
esc_html_e('The hierarchy which the breadcrumb trail will show.', 'tx-breadcrumb');
|
657 |
-
}
|
658 |
-
else
|
659 |
-
{
|
660 |
-
esc_html_e('The hierarchy which the breadcrumb trail will show. Note that the "Post Parent" option may require an additional plugin to behave as expected since this is a non-hierarchical post type.', 'tx-breadcrumb');
|
661 |
-
}
|
662 |
-
?>
|
663 |
-
</p>
|
664 |
-
</td>
|
665 |
-
</tr>
|
666 |
-
</table>
|
667 |
-
<?php
|
668 |
-
}
|
669 |
-
}
|
670 |
-
do_action($this->unique_prefix . '_after_settings_tab_post', $this->opt);
|
671 |
-
?>
|
672 |
-
</fieldset>
|
673 |
-
<fieldset id="tax" class="bctx_options alttab">
|
674 |
-
<h3 class="tab-title" title="<?php _e('The settings for all taxonomies (including Categories, Tags, and custom taxonomies) are located under this tab.', 'tx-breadcrumb');?>"><?php _e('Taxonomies', 'tx-breadcrumb'); ?></h3>
|
675 |
-
<h3><?php _e('Categories', 'tx-breadcrumb'); ?></h3>
|
676 |
-
<table class="form-table">
|
677 |
-
<?php
|
678 |
-
$this->textbox(__('Category Template', 'tx-breadcrumb'), 'Htax_category_template', '6', false, __('The template for category breadcrumbs.', 'tx-breadcrumb'));
|
679 |
-
$this->textbox(__('Category Template (Unlinked)', 'tx-breadcrumb'), 'Htax_category_template_no_anchor', '4', false, __('The template for category breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
680 |
-
?>
|
681 |
-
</table>
|
682 |
-
<h3><?php _e('Tags', 'tx-breadcrumb'); ?></h3>
|
683 |
-
<table class="form-table">
|
684 |
-
<?php
|
685 |
-
$this->textbox(__('Tag Template', 'tx-breadcrumb'), 'Htax_post_tag_template', '6', false, __('The template for tag breadcrumbs.', 'tx-breadcrumb'));
|
686 |
-
$this->textbox(__('Tag Template (Unlinked)', 'tx-breadcrumb'), 'Htax_post_tag_template_no_anchor', '4', false, __('The template for tag breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
687 |
-
?>
|
688 |
-
</table>
|
689 |
-
<h3><?php _e('Post Formats', 'tx-breadcrumb'); ?></h3>
|
690 |
-
<table class="form-table">
|
691 |
-
<?php
|
692 |
-
$this->textbox(__('Post Format Template', 'tx-breadcrumb'), 'Htax_post_format_template', '6', false, __('The template for post format breadcrumbs.', 'tx-breadcrumb'));
|
693 |
-
$this->textbox(__('Post Format Template (Unlinked)', 'tx-breadcrumb'), 'Htax_post_format_template_no_anchor', '4', false, __('The template for post_format breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
694 |
-
?>
|
695 |
-
</table>
|
696 |
-
<?php
|
697 |
-
//Loop through all of the taxonomies in the array
|
698 |
-
foreach($wp_taxonomies as $taxonomy)
|
699 |
-
{
|
700 |
-
//Check for non-public taxonomies
|
701 |
-
if(!apply_filters('bctx_show_tax_private', $taxonomy->public, $taxonomy->name, null))
|
702 |
-
{
|
703 |
-
continue;
|
704 |
-
}
|
705 |
-
//We only want custom taxonomies
|
706 |
-
if(!$taxonomy->_builtin)
|
707 |
-
{
|
708 |
-
$label_lc = mb_strtolower($taxonomy->label, 'UTF-8');
|
709 |
-
?>
|
710 |
-
<h3><?php echo mb_convert_case($taxonomy->label, MB_CASE_TITLE, 'UTF-8'); ?></h3>
|
711 |
-
<table class="form-table">
|
712 |
-
<?php
|
713 |
-
$this->textbox(sprintf(__('%s Template', 'tx-breadcrumb'), $taxonomy->labels->singular_name), 'Htax_' . $taxonomy->name . '_template', '6', false, sprintf(__('The template for %s breadcrumbs.', 'tx-breadcrumb'), $label_lc));
|
714 |
-
$this->textbox(sprintf(__('%s Template (Unlinked)', 'tx-breadcrumb'), $taxonomy->labels->singular_name), 'Htax_' . $taxonomy->name . '_template_no_anchor', '4', false, sprintf(__('The template for %s breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'), $label_lc));
|
715 |
-
?>
|
716 |
-
</table>
|
717 |
-
<?php
|
718 |
-
}
|
719 |
-
}
|
720 |
-
do_action($this->unique_prefix . '_after_settings_tab_taxonomy', $this->opt); ?>
|
721 |
-
</fieldset>
|
722 |
-
<fieldset id="miscellaneous" class="bctx_options">
|
723 |
-
<h3 class="tab-title" title="<?php _e('The settings for author and date archives, searches, and 404 pages are located under this tab.', 'tx-breadcrumb');?>"><?php _e('Miscellaneous', 'tx-breadcrumb'); ?></h3>
|
724 |
-
<h3><?php _e('Author Archives', 'tx-breadcrumb'); ?></h3>
|
725 |
-
<table class="form-table">
|
726 |
-
<?php
|
727 |
-
$this->textbox(__('Author Template', 'tx-breadcrumb'), 'Hauthor_template', '6', false, __('The template for author breadcrumbs.', 'tx-breadcrumb'));
|
728 |
-
$this->textbox(__('Author Template (Unlinked)', 'tx-breadcrumb'), 'Hauthor_template_no_anchor', '4', false, __('The template for author breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
729 |
-
$this->input_select(__('Author Display Format', 'tx-breadcrumb'), 'Sauthor_name', array("display_name", "nickname", "first_name", "last_name"), false, __('display_name uses the name specified in "Display name publicly as" under the user profile the others correspond to options in the user profile.', 'tx-breadcrumb'));
|
730 |
-
$optid = mtekk_adminKit::get_valid_id('aauthor_root');
|
731 |
-
?>
|
732 |
-
<tr valign="top">
|
733 |
-
<th scope="row">
|
734 |
-
<label for="<?php echo $optid;?>"><?php esc_html_e('Author Root Page', 'tx-breadcrumb');?></label>
|
735 |
-
</th>
|
736 |
-
<td>
|
737 |
-
<?php wp_dropdown_pages(array('name' => $this->unique_prefix . '_options[aauthor_root]', 'id' => $optid, 'echo' => 1, 'show_option_none' => __( '— Select —' ), 'option_none_value' => '0', 'selected' => $this->opt['aauthor_root']));?>
|
738 |
-
</td>
|
739 |
-
</tr>
|
740 |
-
</table>
|
741 |
-
<h3><?php _e('Miscellaneous', 'tx-breadcrumb'); ?></h3>
|
742 |
-
<table class="form-table">
|
743 |
-
<?php
|
744 |
-
$this->textbox(__('Date Template', 'tx-breadcrumb'), 'Hdate_template', '6', false, __('The template for date breadcrumbs.', 'tx-breadcrumb'));
|
745 |
-
$this->textbox(__('Date Template (Unlinked)', 'tx-breadcrumb'), 'Hdate_template_no_anchor', '4', false, __('The template for date breadcrumbs, used only when the breadcrumb is not linked.', 'tx-breadcrumb'));
|
746 |
-
$this->textbox(__('Search Template', 'tx-breadcrumb'), 'Hsearch_template', '6', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages.', 'tx-breadcrumb'));
|
747 |
-
$this->textbox(__('Search Template (Unlinked)', 'tx-breadcrumb'), 'Hsearch_template_no_anchor', '4', false, __('The anchor template for search breadcrumbs, used only when the search results span several pages and the breadcrumb is not linked.', 'tx-breadcrumb'));
|
748 |
-
$this->input_text(__('404 Title', 'tx-breadcrumb'), 'S404_title', 'regular-text');
|
749 |
-
$this->textbox(__('404 Template', 'tx-breadcrumb'), 'H404_template', '4', false, __('The template for 404 breadcrumbs.', 'tx-breadcrumb'));
|
750 |
-
?>
|
751 |
-
</table>
|
752 |
-
<h3><?php _e('Deprecated', 'tx-breadcrumb'); ?></h3>
|
753 |
-
<table class="form-table">
|
754 |
-
<tr valign="top">
|
755 |
-
<th scope="row">
|
756 |
-
<?php esc_html_e('Title Length', 'tx-breadcrumb'); ?>
|
757 |
-
</th>
|
758 |
-
<td>
|
759 |
-
<label>
|
760 |
-
<input name="bctx_options[blimit_title]" type="checkbox" id="blimit_title" value="true" <?php checked(true, $this->opt['blimit_title']); ?> />
|
761 |
-
<?php printf(esc_html__('Limit the length of the breadcrumb title. (Deprecated, %suse CSS instead%s)', 'tx-breadcrumb'), '<a title="' . esc_attr__('Go to the guide on trimming breadcrumb title lengths with CSS', 'tx-breadcrumb') . '" href="https://mtekk.us/archives/guides/trimming-breadcrumb-title-lengths-with-css/">', '</a>');?>
|
762 |
-
</label><br />
|
763 |
-
<ul>
|
764 |
-
<li>
|
765 |
-
<label for="amax_title_length">
|
766 |
-
<?php esc_html_e('Max Title Length: ','tx-breadcrumb');?>
|
767 |
-
<input type="number" name="bctx_options[amax_title_length]" id="amax_title_length" min="1" step="1" value="<?php echo esc_html($this->opt['amax_title_length'], ENT_COMPAT, 'UTF-8'); ?>" class="small-text" />
|
768 |
-
</label>
|
769 |
-
</li>
|
770 |
-
</ul>
|
771 |
-
</td>
|
772 |
-
</tr>
|
773 |
-
</table>
|
774 |
-
<?php do_action($this->unique_prefix . '_after_settings_tab_miscellaneous', $this->opt); ?>
|
775 |
-
</fieldset>
|
776 |
-
<?php do_action($this->unique_prefix . '_after_settings_tabs', $this->opt); ?>
|
777 |
-
</div>
|
778 |
-
<p class="submit"><input type="submit" class="button-primary" name="bctx_admin_options" value="<?php esc_attr_e('Save Changes') ?>" /></p>
|
779 |
-
</form>
|
780 |
-
</div>
|
781 |
-
<?php
|
782 |
-
}
|
783 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/class.bctx_breadcrumb.php
DELETED
@@ -1,272 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2007-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
|
20 |
-
//The breadcrumb class
|
21 |
-
class bctx_breadcrumb
|
22 |
-
{
|
23 |
-
//Our member variables
|
24 |
-
const version = '6.1.0';
|
25 |
-
//The main text that will be shown
|
26 |
-
protected $title;
|
27 |
-
//The breadcrumb's template, used durring assembly
|
28 |
-
protected $template;
|
29 |
-
//The breadcrumb's no anchor template, used durring assembly when there won't be an anchor
|
30 |
-
protected $template_no_anchor;
|
31 |
-
//Boolean, is this element linked
|
32 |
-
protected $linked = false;
|
33 |
-
//The link the breadcrumb leads to, null if $linked == false
|
34 |
-
protected $url;
|
35 |
-
//The corresponding resource ID
|
36 |
-
protected $id = null;
|
37 |
-
private $_title = null;
|
38 |
-
//The type of this breadcrumb
|
39 |
-
protected $type;
|
40 |
-
protected $allowed_html = array();
|
41 |
-
const default_template_no_anchor = '<span property="itemListElement" typeof="ListItem"><span property="name">%htitle%</span><meta property="position" content="%position%"></span>';
|
42 |
-
/**
|
43 |
-
* The enhanced default constructor, ends up setting all parameters via the set_ functions
|
44 |
-
*
|
45 |
-
* @param string $title (optional) The title of the breadcrumb
|
46 |
-
* @param string $template (optional) The html template for the breadcrumb
|
47 |
-
* @param string $type (optional) The breadcrumb type
|
48 |
-
* @param string $url (optional) The url the breadcrumb links to
|
49 |
-
*/
|
50 |
-
public function __construct($title = '', $template = '', array $type = array(), $url = '', $id = null)
|
51 |
-
{
|
52 |
-
//Filter allowed_html array to allow others to add acceptable tags
|
53 |
-
$this->allowed_html = apply_filters('bctx_allowed_html', wp_kses_allowed_html('post'));
|
54 |
-
//The breadcrumb type
|
55 |
-
$this->type = $type;
|
56 |
-
//Set the resource id
|
57 |
-
$this->set_id($id);
|
58 |
-
//Set the title
|
59 |
-
$this->set_title($title);
|
60 |
-
//Set the default anchorless templates value
|
61 |
-
$this->template_no_anchor = bctx_breadcrumb::default_template_no_anchor;
|
62 |
-
//If we didn't get a good template, use a default template
|
63 |
-
if($template == null)
|
64 |
-
{
|
65 |
-
$this->set_template(bctx_breadcrumb::get_default_template());
|
66 |
-
}
|
67 |
-
//If something was passed in template wise, update the appropriate internal template
|
68 |
-
else
|
69 |
-
{
|
70 |
-
//Loose comparison, evaluates to true if URL is '' or null
|
71 |
-
if($url == null)
|
72 |
-
{
|
73 |
-
$this->template_no_anchor = wp_kses(apply_filters('bctx_breadcrumb_template_no_anchor', $template, $this->type, $this->id), $this->allowed_html);
|
74 |
-
$this->set_template(bctx_breadcrumb::get_default_template());
|
75 |
-
}
|
76 |
-
else
|
77 |
-
{
|
78 |
-
$this->set_template($template);
|
79 |
-
}
|
80 |
-
}
|
81 |
-
//Always null if unlinked
|
82 |
-
$this->set_url($url);
|
83 |
-
}
|
84 |
-
/**
|
85 |
-
* Function to return the translated default template
|
86 |
-
*
|
87 |
-
* @return string The default breadcrumb template
|
88 |
-
*/
|
89 |
-
static public function get_default_template()
|
90 |
-
{
|
91 |
-
return __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to %title%." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'tx-breadcrumb');
|
92 |
-
}
|
93 |
-
/**
|
94 |
-
* Function to set the protected title member
|
95 |
-
*
|
96 |
-
* @param string $title The title of the breadcrumb
|
97 |
-
*/
|
98 |
-
public function set_title($title)
|
99 |
-
{
|
100 |
-
//Set the title
|
101 |
-
$this->title = apply_filters('bctx_breadcrumb_title', $title, $this->type, $this->id);
|
102 |
-
$this->_title = $this->title;
|
103 |
-
}
|
104 |
-
/**
|
105 |
-
* Function to get the protected title member
|
106 |
-
*
|
107 |
-
* @return $this->title
|
108 |
-
*/
|
109 |
-
public function get_title()
|
110 |
-
{
|
111 |
-
//Return the title
|
112 |
-
return $this->title;
|
113 |
-
}
|
114 |
-
/**
|
115 |
-
* Function to set the internal URL variable
|
116 |
-
*
|
117 |
-
* @param string $url the url to link to
|
118 |
-
*/
|
119 |
-
public function set_url($url)
|
120 |
-
{
|
121 |
-
$url = trim($url);
|
122 |
-
$this->url = apply_filters('bctx_breadcrumb_url', $url, $this->type, $this->id);
|
123 |
-
//If the URL seemed nullish, we are not linked
|
124 |
-
if($this->url === '')
|
125 |
-
{
|
126 |
-
$this->linked = false;
|
127 |
-
}
|
128 |
-
else
|
129 |
-
{
|
130 |
-
$this->linked = true;
|
131 |
-
}
|
132 |
-
}
|
133 |
-
/**
|
134 |
-
* Function to set the internal breadcrumb template
|
135 |
-
*
|
136 |
-
* @param string $template the template to use durring assebly
|
137 |
-
*/
|
138 |
-
public function set_template($template)
|
139 |
-
{
|
140 |
-
//Assign the breadcrumb template
|
141 |
-
$this->template = wp_kses(apply_filters('bctx_breadcrumb_template', $template, $this->type, $this->id), $this->allowed_html);
|
142 |
-
}
|
143 |
-
/**
|
144 |
-
* Function to set the internal breadcrumb ID
|
145 |
-
*
|
146 |
-
* @param int $id the id of the resource this breadcrumb represents
|
147 |
-
*/
|
148 |
-
public function set_id($id)
|
149 |
-
{
|
150 |
-
$this->id = $id;
|
151 |
-
}
|
152 |
-
/**
|
153 |
-
* Function to get the internal breadcrumb ID
|
154 |
-
*
|
155 |
-
* @return int the id of the resource this breadcrumb represents
|
156 |
-
*/
|
157 |
-
public function get_id()
|
158 |
-
{
|
159 |
-
return $this->id;
|
160 |
-
}
|
161 |
-
/**
|
162 |
-
* Append a type entry to the type array
|
163 |
-
*
|
164 |
-
* @param string $type the type to append
|
165 |
-
*/
|
166 |
-
public function add_type($type)
|
167 |
-
{
|
168 |
-
$this->type[] = $type;
|
169 |
-
}
|
170 |
-
/**
|
171 |
-
* Return the type array
|
172 |
-
*
|
173 |
-
* @return array The type array
|
174 |
-
*/
|
175 |
-
public function get_types()
|
176 |
-
{
|
177 |
-
return $this->type;
|
178 |
-
}
|
179 |
-
/**
|
180 |
-
* This function will intelligently trim the title to the value passed in through $max_length. This function is deprecated, do not call.
|
181 |
-
*
|
182 |
-
* @param int $max_length of the title.
|
183 |
-
* @deprecated since 5.2.0
|
184 |
-
*/
|
185 |
-
public function title_trim($max_length)
|
186 |
-
{
|
187 |
-
_deprecated_function(__FUNCTION__, '5.2.0');
|
188 |
-
//To preserve HTML entities, must decode before splitting
|
189 |
-
$this->title = html_entity_decode($this->title, ENT_COMPAT, 'UTF-8');
|
190 |
-
$title_length = mb_strlen($this->title);
|
191 |
-
//Make sure that we are not making it longer with that ellipse
|
192 |
-
if($title_length > $max_length && ($title_length + 2) > $max_length)
|
193 |
-
{
|
194 |
-
//Trim the title
|
195 |
-
$this->title = mb_substr($this->title, 0, $max_length - 1);
|
196 |
-
//Make sure we can split, but we want to limmit to cutting at max an additional 25%
|
197 |
-
if(mb_strpos($this->title, ' ', .75 * $max_length) > 0)
|
198 |
-
{
|
199 |
-
//Don't split mid word
|
200 |
-
while(mb_substr($this->title,-1) != ' ')
|
201 |
-
{
|
202 |
-
$this->title = mb_substr($this->title, 0, -1);
|
203 |
-
}
|
204 |
-
}
|
205 |
-
//Remove the whitespace at the end and add the hellip
|
206 |
-
$this->title = rtrim($this->title) . html_entity_decode('…', ENT_COMPAT, 'UTF-8');
|
207 |
-
}
|
208 |
-
//Return to the encoded version of all HTML entities (keep standards complance)
|
209 |
-
$this->title = force_balance_tags(htmlentities($this->title, ENT_COMPAT, 'UTF-8'));
|
210 |
-
}
|
211 |
-
/**
|
212 |
-
* Assembles the parts of the breadcrumb into a html string
|
213 |
-
*
|
214 |
-
* @param bool $linked Allow the output to contain anchors?
|
215 |
-
* @param int $position The position of the breadcrumb in the trail (between 1 and n when there are n breadcrumbs in the trail)
|
216 |
-
*
|
217 |
-
* @return string The compiled breadcrumb string
|
218 |
-
*/
|
219 |
-
public function assemble($linked, $position)
|
220 |
-
{
|
221 |
-
//Build our replacements array
|
222 |
-
$replacements = array(
|
223 |
-
'%title%' => esc_attr(strip_tags($this->title)),
|
224 |
-
'%link%' => esc_url($this->url),
|
225 |
-
'%htitle%' => $this->title,
|
226 |
-
'%type%' => apply_filters('bctx_breadcrumb_types', $this->type, $this->id),
|
227 |
-
'%ftitle%' => esc_attr(strip_tags($this->_title)),
|
228 |
-
'%fhtitle%' => $this->_title,
|
229 |
-
'%position%' => $position
|
230 |
-
);
|
231 |
-
//The type may be an array, implode it if that is the case
|
232 |
-
if(is_array($replacements['%type%']))
|
233 |
-
{
|
234 |
-
array_walk($replacements['%type%'], 'sanitize_html_class');
|
235 |
-
$replacements['%type%'] = esc_attr(implode(' ', $replacements['%type%']));
|
236 |
-
}
|
237 |
-
else
|
238 |
-
{
|
239 |
-
_doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('bctx_breadcrumb::type must be an array', 'tx-breadcrumb'), '6.0.2');
|
240 |
-
}
|
241 |
-
$replacements = apply_filters('bctx_template_tags', $replacements, $this->type, $this->id);
|
242 |
-
//If we are linked we'll need to use the normal template
|
243 |
-
if($this->linked && $linked)
|
244 |
-
{
|
245 |
-
//Return the assembled breadcrumb string
|
246 |
-
return str_replace(array_keys($replacements), $replacements, $this->template);
|
247 |
-
}
|
248 |
-
//Otherwise we use the no anchor template
|
249 |
-
else
|
250 |
-
{
|
251 |
-
//Return the assembled breadcrumb string
|
252 |
-
return str_replace(array_keys($replacements), $replacements, $this->template_no_anchor);
|
253 |
-
}
|
254 |
-
}
|
255 |
-
/**
|
256 |
-
* Assembles the parts of the breadcrumb into a JSON-LD ready object-array
|
257 |
-
*
|
258 |
-
* @param int $position The position of the breadcrumb in the trail (between 1 and n when there are n breadcrumbs in the trail)
|
259 |
-
*
|
260 |
-
* @return array(object) The prepared array object ready to pass into json_encode
|
261 |
-
*/
|
262 |
-
public function assemble_json_ld($position)
|
263 |
-
{
|
264 |
-
return (object)array(
|
265 |
-
'@type' => 'ListItem',
|
266 |
-
'position' => $position,
|
267 |
-
'item' => (object)array(
|
268 |
-
'@id' => esc_url($this->url),
|
269 |
-
'name' => esc_attr($this->title))
|
270 |
-
);
|
271 |
-
}
|
272 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/class.bctx_breadcrumb_trail.php
DELETED
@@ -1,1279 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
|
20 |
-
//The trail class
|
21 |
-
class bctx_breadcrumb_trail
|
22 |
-
{
|
23 |
-
//Our member variables
|
24 |
-
const version = '6.1.0';
|
25 |
-
//An array of breadcrumbs
|
26 |
-
public $breadcrumbs = array();
|
27 |
-
public $trail = array();
|
28 |
-
//The options
|
29 |
-
public $opt;
|
30 |
-
//Default constructor
|
31 |
-
public function __construct()
|
32 |
-
{
|
33 |
-
//@see https://core.trac.wordpress.org/ticket/10527
|
34 |
-
if(!is_textdomain_loaded('tx-breadcrumb'))
|
35 |
-
{
|
36 |
-
load_plugin_textdomain('tx-breadcrumb', false, 'tx-breadcrumb/languages');
|
37 |
-
}
|
38 |
-
$this->trail = &$this->breadcrumbs;
|
39 |
-
//Initilize with default option values
|
40 |
-
$this->opt = array(
|
41 |
-
//Should the mainsite be shown
|
42 |
-
'bmainsite_display' => true,
|
43 |
-
//The breadcrumb template for the main site
|
44 |
-
'Hmainsite_template' => bctx_breadcrumb::get_default_template(),
|
45 |
-
//The breadcrumb template for the main site, used when an anchor is not needed
|
46 |
-
'Hmainsite_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
47 |
-
//Should the home page be shown
|
48 |
-
'bhome_display' => true,
|
49 |
-
//The breadcrumb template for the home page
|
50 |
-
'Hhome_template' => bctx_breadcrumb::get_default_template(),
|
51 |
-
//The breadcrumb template for the home page, used when an anchor is not needed
|
52 |
-
'Hhome_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
53 |
-
//Should the blog page be shown globally
|
54 |
-
'bblog_display' => true,
|
55 |
-
//Separator that is placed between each item in the breadcrumb trial, but not placed before
|
56 |
-
//the first and not after the last breadcrumb
|
57 |
-
'hseparator' => ' > ',
|
58 |
-
//Whether or not we should trim the breadcrumb titles
|
59 |
-
'blimit_title' => false,
|
60 |
-
//The maximum title length
|
61 |
-
'amax_title_length' => 20,
|
62 |
-
//Current item options
|
63 |
-
'bcurrent_item_linked' => false,
|
64 |
-
//Static page options
|
65 |
-
//Should the trail include the hierarchy of the page
|
66 |
-
'bpost_page_hierarchy_display' => true,
|
67 |
-
//What hierarchy should be shown leading to the page
|
68 |
-
'Spost_page_hierarchy_type' => 'BCN_POST_PARENT',
|
69 |
-
//The anchor template for page breadcrumbs
|
70 |
-
'Hpost_page_template' => bctx_breadcrumb::get_default_template(),
|
71 |
-
//The anchor template for page breadcrumbs, used when an anchor is not needed
|
72 |
-
'Hpost_page_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
73 |
-
//Just a link to the page on front property
|
74 |
-
'apost_page_root' => get_option('page_on_front'),
|
75 |
-
//Paged options
|
76 |
-
//The template for paged breadcrumb
|
77 |
-
'Hpaged_template' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Page %htitle%</span><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
78 |
-
//Should we try filling out paged information
|
79 |
-
'bpaged_display' => false,
|
80 |
-
//The post options previously singleblogpost
|
81 |
-
//The breadcrumb template for post breadcrumbs
|
82 |
-
'Hpost_post_template' => bctx_breadcrumb::get_default_template(),
|
83 |
-
//The breadcrumb template for post breadcrumbs, used when an anchor is not needed
|
84 |
-
'Hpost_post_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
85 |
-
//Just a link for the page for posts
|
86 |
-
'apost_post_root' => get_option('page_for_posts'),
|
87 |
-
//Should the trail include the hierarchy of the post
|
88 |
-
'bpost_post_hierarchy_display' => true,
|
89 |
-
//Should the trail reflect the referer taxonomy or not
|
90 |
-
'bpost_post_taxonomy_referer' => false,
|
91 |
-
//What hierarchy should be shown leading to the post, tag or category
|
92 |
-
'Spost_post_hierarchy_type' => 'category',
|
93 |
-
//Attachment settings
|
94 |
-
'bpost_attachment_hierarchy_display' => true,
|
95 |
-
//What hierarchy should be shown leading to the attachment
|
96 |
-
'Spost_attachment_hierarchy_type' => 'BCN_POST_PARENT',
|
97 |
-
//Give an invlaid page ID for the attachement root
|
98 |
-
'apost_attachment_root' => 0,
|
99 |
-
//The breadcrumb template for attachment breadcrumbs
|
100 |
-
'Hpost_attachment_template' => bctx_breadcrumb::get_default_template(),
|
101 |
-
//The breadcrumb template for attachment breadcrumbs, used when an anchor is not needed
|
102 |
-
'Hpost_attachment_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
103 |
-
//404 page settings
|
104 |
-
//The template for 404 breadcrumbs
|
105 |
-
'H404_template' => bctx_breadcrumb::default_template_no_anchor,
|
106 |
-
//The text to be shown in the breadcrumb for a 404 page
|
107 |
-
'S404_title' => __('404', 'tx-breadcrumb'),
|
108 |
-
//Search page options
|
109 |
-
//The breadcrumb template for search breadcrumbs
|
110 |
-
'Hsearch_template' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Search results for '<a property="item" typeof="WebPage" title="Go to the first page of search results for %title%." href="%link%" class="%type%">%htitle%</a>'</span><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
111 |
-
//The breadcrumb template for search breadcrumbs, used when an anchor is not necessary
|
112 |
-
'Hsearch_template_no_anchor' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Search results for '%htitle%'</span><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
113 |
-
//Tag related stuff
|
114 |
-
//The breadcrumb template for tag breadcrumbs
|
115 |
-
'Htax_post_tag_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% tag archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
116 |
-
//The breadcrumb template for tag breadcrumbs, used when an anchor is not necessary
|
117 |
-
'Htax_post_tag_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
118 |
-
//Post format related stuff
|
119 |
-
//The breadcrumb template for post format breadcrumbs, used when an anchor is not necessary
|
120 |
-
'Htax_post_format_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
121 |
-
//The breadcrumb template for post format breadcrumbs
|
122 |
-
'Htax_post_format_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
123 |
-
//Author page stuff
|
124 |
-
//The anchor template for author breadcrumbs
|
125 |
-
'Hauthor_template' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Articles by: <a title="Go to the first page of posts by %title%." href="%link%" class="%type%">%htitle%</a>', 'tx-breadcrumb'),
|
126 |
-
//The anchor template for author breadcrumbs, used when anchors are not needed
|
127 |
-
'Hauthor_template_no_anchor' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Articles by: %htitle%</span><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
128 |
-
//Which of the various WordPress display types should the author breadcrumb display
|
129 |
-
'Sauthor_name' => 'display_name',
|
130 |
-
//Give an invlaid page ID for the author root
|
131 |
-
'aauthor_root' => 0,
|
132 |
-
//Category stuff
|
133 |
-
//The breadcrumb template for category breadcrumbs
|
134 |
-
'Htax_category_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% category archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
135 |
-
//The breadcrumb template for category breadcrumbs, used when anchors are not needed
|
136 |
-
'Htax_category_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor,
|
137 |
-
//The breadcrumb template for date breadcrumbs
|
138 |
-
'Hdate_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'tx-breadcrumb'),
|
139 |
-
//The breadcrumb template for date breadcrumbs, used when anchors are not needed
|
140 |
-
'Hdate_template_no_anchor' => bctx_breadcrumb::default_template_no_anchor
|
141 |
-
);
|
142 |
-
}
|
143 |
-
/**
|
144 |
-
* This returns the internal version
|
145 |
-
*
|
146 |
-
* @deprecated 5.2.0 No longer needed, superceeded bctx_breadcrumb_trail::version
|
147 |
-
*
|
148 |
-
* @return string internal version of the Breadcrumb trail
|
149 |
-
*/
|
150 |
-
public function get_version()
|
151 |
-
{
|
152 |
-
_deprecated_function( __FUNCTION__, '5.2', 'bctx_breadcrumb_trail::version' );
|
153 |
-
return self::version;
|
154 |
-
}
|
155 |
-
/**
|
156 |
-
* Adds a breadcrumb to the breadcrumb trail
|
157 |
-
*
|
158 |
-
* @param bctx_breadcrumb $object Breadcrumb to add to the trail
|
159 |
-
*
|
160 |
-
* @return pointer to the just added Breadcrumb
|
161 |
-
*/
|
162 |
-
public function &add(bctx_breadcrumb $object)
|
163 |
-
{
|
164 |
-
$this->breadcrumbs[] = $object;
|
165 |
-
//Return the just added object
|
166 |
-
return $this->breadcrumbs[count($this->breadcrumbs) - 1];
|
167 |
-
}
|
168 |
-
/**
|
169 |
-
* A Breadcrumb Trail Filling Function
|
170 |
-
*
|
171 |
-
* This functions fills a breadcrumb for a search page
|
172 |
-
*
|
173 |
-
* @param string $search_query The search query that was performed
|
174 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
175 |
-
*/
|
176 |
-
protected function do_search($search_query, $is_paged = false)
|
177 |
-
{
|
178 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
179 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($search_query, $this->opt['Hsearch_template_no_anchor'], array('search', 'current-item')));
|
180 |
-
//If we're paged, or allowing the current item to be linked, let's link to the first page
|
181 |
-
if($this->opt['bcurrent_item_linked'] || ($is_paged && $this->opt['bpaged_display']))
|
182 |
-
{
|
183 |
-
//Since we are paged and are linking the root breadcrumb, time to change to the regular template
|
184 |
-
$breadcrumb->set_template($this->opt['Hsearch_template']);
|
185 |
-
//Figure out the anchor for the search
|
186 |
-
$breadcrumb->set_url(get_search_link($search_query));
|
187 |
-
}
|
188 |
-
}
|
189 |
-
/**
|
190 |
-
* A Breadcrumb Trail Filling Function
|
191 |
-
*
|
192 |
-
* This functions fills a breadcrumb for an author page
|
193 |
-
*
|
194 |
-
* @param string $author_data The author to generate the breadcrumb for
|
195 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
196 |
-
*/
|
197 |
-
protected function do_author($author_data, $is_paged = false)
|
198 |
-
{
|
199 |
-
//Setup array of valid author_name values
|
200 |
-
$valid_author_name = array('display_name', 'nickname', 'first_name', 'last_name');
|
201 |
-
//Make sure user picks only safe values
|
202 |
-
if(in_array($this->opt['Sauthor_name'], $valid_author_name))
|
203 |
-
{
|
204 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
205 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_author_meta($this->opt['Sauthor_name'], $author_data->ID), $this->opt['Hauthor_template_no_anchor'], array('author', 'current-item'), null, $author_data->ID));
|
206 |
-
//If we're paged, or allowing the current item to be linked, let's link to the first page
|
207 |
-
if($this->opt['bcurrent_item_linked'] || ($is_paged && $this->opt['bpaged_display']))
|
208 |
-
{
|
209 |
-
//Set the template to our one containing an anchor
|
210 |
-
$breadcrumb->set_template($this->opt['Hauthor_template']);
|
211 |
-
$breadcrumb->set_url(get_author_posts_url($author_data->ID));
|
212 |
-
}
|
213 |
-
}
|
214 |
-
}
|
215 |
-
/**
|
216 |
-
* Determines the taxonomy name represented by the specified query var
|
217 |
-
*
|
218 |
-
* @param string $query_var The query var to attempt to find the corresponding taxonomy
|
219 |
-
*
|
220 |
-
* @return string|bool Either the name of the taxonomy corresponding to the query_var or false if no taxonomy exists for the specified query_var
|
221 |
-
*/
|
222 |
-
protected function query_var_to_taxonomy($query_var)
|
223 |
-
{
|
224 |
-
global $wp_taxonomies;
|
225 |
-
foreach($wp_taxonomies as $taxonomy)
|
226 |
-
{
|
227 |
-
if($taxonomy->query_var === $query_var)
|
228 |
-
{
|
229 |
-
return $taxonomy->name;
|
230 |
-
}
|
231 |
-
}
|
232 |
-
return false;
|
233 |
-
}
|
234 |
-
/**
|
235 |
-
* Determines the referer taxonomy
|
236 |
-
*
|
237 |
-
* @return string|bool Either the name of the taxonomy to use or false if a referer taxonomy wasn't found
|
238 |
-
*/
|
239 |
-
protected function determine_taxonomy()
|
240 |
-
{
|
241 |
-
global $wp;
|
242 |
-
//Backup the server request variable
|
243 |
-
$bk_req = $_SERVER['REQUEST_URI'];
|
244 |
-
//Now set the request URL to the referrer URL
|
245 |
-
//Could just chain the [1] selection, but that's not PHP5.3 compatible
|
246 |
-
$url_split = explode(home_url(), esc_url(wp_get_referer()));
|
247 |
-
if(isset($url_split[1]))
|
248 |
-
{
|
249 |
-
$_SERVER['REQUEST_URI'] = $url_split[1];
|
250 |
-
}
|
251 |
-
else
|
252 |
-
{
|
253 |
-
return false;
|
254 |
-
}
|
255 |
-
//Create our own new instance of WP, and have it parse our faux request
|
256 |
-
$bctx_wp = new WP();
|
257 |
-
//Copy over the current global wp object's query_vars since CPTs and taxonomies are added directly to the global $wp
|
258 |
-
$bctx_wp->public_query_vars = $wp->public_query_vars;
|
259 |
-
$bctx_wp->parse_request();
|
260 |
-
$_SERVER['REQUEST_URI'] = $bk_req;
|
261 |
-
if(is_array($bctx_wp->query_vars))
|
262 |
-
{
|
263 |
-
foreach($bctx_wp->query_vars as $query_var => $value)
|
264 |
-
{
|
265 |
-
if($taxonomy = $this->query_var_to_taxonomy($query_var))
|
266 |
-
{
|
267 |
-
return $taxonomy;
|
268 |
-
}
|
269 |
-
}
|
270 |
-
}
|
271 |
-
return false;
|
272 |
-
}
|
273 |
-
/**
|
274 |
-
* This function selects the term that should be used for a post's hierarchy
|
275 |
-
*
|
276 |
-
* @param int $id The ID of the post to find the term for
|
277 |
-
* @param string $type The post type of the post to figure out the taxonomy for
|
278 |
-
* @param string $taxonomy The taxonomy to use
|
279 |
-
*
|
280 |
-
* @return WP_Term|bool The term object to use for the post hierarchy or false if no suitable term was found
|
281 |
-
*/
|
282 |
-
protected function pick_post_term($id, $type, $taxonomy)
|
283 |
-
{
|
284 |
-
//Fill a temporary object with the terms
|
285 |
-
$bctx_object = get_the_terms($id, $taxonomy);
|
286 |
-
$potential_parent = 0;
|
287 |
-
//Make sure we have an non-empty array
|
288 |
-
if(is_array($bctx_object))
|
289 |
-
{
|
290 |
-
//Now try to find the deepest term of those that we know of
|
291 |
-
$bctx_use_term = key($bctx_object);
|
292 |
-
foreach($bctx_object as $key => $object)
|
293 |
-
{
|
294 |
-
//Can't use the next($bctx_object) trick since order is unknown
|
295 |
-
if($object->parent > 0 && ($potential_parent === 0 || $object->parent === $potential_parent))
|
296 |
-
{
|
297 |
-
$bctx_use_term = $key;
|
298 |
-
$potential_parent = $object->term_id;
|
299 |
-
}
|
300 |
-
}
|
301 |
-
return $bctx_object[$bctx_use_term];
|
302 |
-
}
|
303 |
-
return false;
|
304 |
-
}
|
305 |
-
/**
|
306 |
-
* A Breadcrumb Trail Filling Function
|
307 |
-
*
|
308 |
-
* This function fills breadcrumbs for any post taxonomy
|
309 |
-
*
|
310 |
-
* @param int $id The id of the post to figure out the taxonomy for
|
311 |
-
* @param string $type The post type of the post to figure out the taxonomy for
|
312 |
-
* @param int $parent (optional) The id of the parent of the current post, used if hiearchal posts will be the "taxonomy" for the current post
|
313 |
-
*/
|
314 |
-
protected function post_hierarchy($id, $type, $parent = null)
|
315 |
-
{
|
316 |
-
//Check to see if breadcrumbs for the hierarchy of the post needs to be generated
|
317 |
-
if($this->opt['bpost_' . $type . '_hierarchy_display'])
|
318 |
-
{
|
319 |
-
//Check if we have a date 'taxonomy' request
|
320 |
-
if($this->opt['Spost_' . $type . '_hierarchy_type'] === 'BCN_DATE')
|
321 |
-
{
|
322 |
-
$post = get_post($id);
|
323 |
-
$this->do_day($post, $type, false, false);
|
324 |
-
$this->do_month($post, $type, false, false);
|
325 |
-
$this->do_year($post, $type, false, false);
|
326 |
-
}
|
327 |
-
//Handle the use of hierarchical posts as the 'taxonomy'
|
328 |
-
else if($this->opt['Spost_' . $type . '_hierarchy_type'] === 'BCN_POST_PARENT')
|
329 |
-
{
|
330 |
-
if($parent == null)
|
331 |
-
{
|
332 |
-
//We have to grab the post to find its parent, can't use $post for this one
|
333 |
-
$parent = get_post($id);
|
334 |
-
//TODO should we check that we have a WP_Post object here?
|
335 |
-
$parent = $parent->post_parent;
|
336 |
-
}
|
337 |
-
//Grab the frontpage, we'll need it shortly
|
338 |
-
$frontpage = get_option('page_on_front');
|
339 |
-
//If there is a parent page let's find it
|
340 |
-
if($parent > 0 && $id != $parent && $frontpage != $parent)
|
341 |
-
{
|
342 |
-
$parent = $this->post_parents($parent, $frontpage);
|
343 |
-
}
|
344 |
-
}
|
345 |
-
else
|
346 |
-
{
|
347 |
-
$taxonomy = $this->opt['Spost_' . $type . '_hierarchy_type'];
|
348 |
-
//Possibly let the referer influence the taxonomy used
|
349 |
-
if($this->opt['bpost_' . $type . '_taxonomy_referer'] && $referrer_taxonomy = $this->determine_taxonomy())
|
350 |
-
{
|
351 |
-
//See if there were any terms, if so, we can use the referrer influenced taxonomy
|
352 |
-
$terms = get_the_terms($id, $referrer_taxonomy);
|
353 |
-
if(is_array($terms))
|
354 |
-
{
|
355 |
-
$taxonomy = $referrer_taxonomy;
|
356 |
-
}
|
357 |
-
}
|
358 |
-
//Handle all hierarchical taxonomies, including categories
|
359 |
-
if(is_taxonomy_hierarchical($taxonomy))
|
360 |
-
{
|
361 |
-
//Filter the results of post_pick_term
|
362 |
-
$term = apply_filters('bctx_pick_post_term', $this->pick_post_term($id, $type, $taxonomy), $id, $type, $taxonomy);
|
363 |
-
//Only do something if we found a term
|
364 |
-
if($term instanceof WP_Term)
|
365 |
-
{
|
366 |
-
//Fill out the term hiearchy
|
367 |
-
$parent = $this->term_parents($term->term_id, $taxonomy);
|
368 |
-
}
|
369 |
-
}
|
370 |
-
//Handle the rest of the taxonomies, including tags
|
371 |
-
else
|
372 |
-
{
|
373 |
-
$this->post_terms($id, $taxonomy);
|
374 |
-
}
|
375 |
-
}
|
376 |
-
}
|
377 |
-
//If we never got a good parent for the type_archive, make it now
|
378 |
-
if(!($parent instanceof WP_Post))
|
379 |
-
{
|
380 |
-
$parent = get_post($id);
|
381 |
-
}
|
382 |
-
//Finish off with trying to find the type archive
|
383 |
-
$this->type_archive($parent, $type);
|
384 |
-
}
|
385 |
-
/**
|
386 |
-
* A Breadcrumb Trail Filling Function
|
387 |
-
*
|
388 |
-
* This functions fills a breadcrumb for the terms of a post
|
389 |
-
*
|
390 |
-
* @param int $id The id of the post to find the terms for
|
391 |
-
* @param string $taxonomy The name of the taxonomy that the term belongs to
|
392 |
-
*
|
393 |
-
* TODO Need to implement this cleaner
|
394 |
-
*/
|
395 |
-
protected function post_terms($id, $taxonomy)
|
396 |
-
{
|
397 |
-
//Apply a filter to the terms for the post referred to by ID
|
398 |
-
$bctx_terms = apply_filters('bctx_post_terms', get_the_terms($id, $taxonomy), $taxonomy, $id);
|
399 |
-
//Only process if we have terms
|
400 |
-
if(is_array($bctx_terms))
|
401 |
-
{
|
402 |
-
$title = '';
|
403 |
-
$is_first = true;
|
404 |
-
//Loop through all of the term results
|
405 |
-
foreach($bctx_terms as $term)
|
406 |
-
{
|
407 |
-
//Everything but the first term needs a comma separator
|
408 |
-
if($is_first == false)
|
409 |
-
{
|
410 |
-
$title .= ', ';
|
411 |
-
}
|
412 |
-
//This is a bit hackish, but it compiles the term anchor and appends it to the current breadcrumb title
|
413 |
-
$title .= str_replace(
|
414 |
-
array('%title%', '%link%', '%htitle%', '%type%'),
|
415 |
-
array($term->name, $this->maybe_add_post_type_arg(get_term_link($term), null, $term->taxonomy), $term->name, $term->taxonomy),
|
416 |
-
$this->opt['Htax_' . $term->taxonomy . '_template']);
|
417 |
-
$is_first = false;
|
418 |
-
}
|
419 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
|
420 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($title, '%htitle%', array('taxonomy', $taxonomy)));
|
421 |
-
}
|
422 |
-
}
|
423 |
-
/**
|
424 |
-
* A Breadcrumb Trail Filling Function
|
425 |
-
*
|
426 |
-
* This recursive functions fills the trail with breadcrumbs for parent terms
|
427 |
-
*
|
428 |
-
* @param int $id The id of the term
|
429 |
-
* @param string $taxonomy The name of the taxonomy that the term belongs to
|
430 |
-
*
|
431 |
-
* @return WP_Term|WP_Error The term we stopped at
|
432 |
-
*/
|
433 |
-
protected function term_parents($id, $taxonomy)
|
434 |
-
{
|
435 |
-
//Get the current category object, filter applied within this call
|
436 |
-
$term = get_term($id, $taxonomy);
|
437 |
-
if($term instanceof WP_Term)
|
438 |
-
{
|
439 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
|
440 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($term->name, $this->opt['Htax_' . $taxonomy . '_template'], array('taxonomy', $taxonomy), $this->maybe_add_post_type_arg(get_term_link($term), null, $taxonomy), $id));
|
441 |
-
//Make sure the id is valid, and that we won't end up spinning in a loop
|
442 |
-
if($term->parent && $term->parent != $id)
|
443 |
-
{
|
444 |
-
//Figure out the rest of the term hiearchy via recursion
|
445 |
-
$ret_term = $this->term_parents($term->parent, $taxonomy);
|
446 |
-
//May end up with WP_Error, don't update the term if that's the case
|
447 |
-
if($ret_term instanceof WP_Term)
|
448 |
-
{
|
449 |
-
$term = $ret_term;
|
450 |
-
}
|
451 |
-
}
|
452 |
-
}
|
453 |
-
return $term;
|
454 |
-
}
|
455 |
-
/**
|
456 |
-
* A Breadcrumb Trail Filling Function
|
457 |
-
*
|
458 |
-
* This recursive functions fills the trail with breadcrumbs for parent posts/pages
|
459 |
-
*
|
460 |
-
* @param int $id The id of the parent page
|
461 |
-
* @param int $frontpage The id of the front page
|
462 |
-
*
|
463 |
-
* @return WP_Post The parent we stopped at
|
464 |
-
*/
|
465 |
-
protected function post_parents($id, $frontpage)
|
466 |
-
{
|
467 |
-
//Use WordPress API, though a bit heavier than the old method, this will ensure compatibility with other plug-ins
|
468 |
-
$parent = get_post($id);
|
469 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
|
470 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_title($id), $this->opt['Hpost_' . $parent->post_type . '_template'], array('post', 'post-' . $parent->post_type), get_permalink($id), $id));
|
471 |
-
//Make sure the id is valid, and that we won't end up spinning in a loop
|
472 |
-
if($parent->post_parent > 0 && $id != $parent->post_parent && $frontpage != $parent->post_parent)
|
473 |
-
{
|
474 |
-
//If valid, recursively call this function
|
475 |
-
$parent = $this->post_parents($parent->post_parent, $frontpage);
|
476 |
-
}
|
477 |
-
return $parent;
|
478 |
-
}
|
479 |
-
/**
|
480 |
-
* A Breadcrumb Trail Filling Function
|
481 |
-
*
|
482 |
-
* This functions fills a breadcrumb for posts
|
483 |
-
*
|
484 |
-
* @param WP_Post $post Instance of WP_Post object to create a breadcrumb for
|
485 |
-
* @param bool $force_link Whether or not to force this breadcrumb to be linked
|
486 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
487 |
-
* @param bool $is_current_item Whether or not the breadcrumb being generated is the current item
|
488 |
-
*/
|
489 |
-
protected function do_post($post, $force_link = false, $is_paged = false, $is_current_item = true)
|
490 |
-
{
|
491 |
-
//If we did not get a WP_Post object, warn developer and return early
|
492 |
-
if(!($post instanceof WP_Post))
|
493 |
-
{
|
494 |
-
_doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('$post global is not of type WP_Post', 'tx-breadcrumb'), '5.1.1');
|
495 |
-
return;
|
496 |
-
}
|
497 |
-
//Place the breadcrumb in the trail, uses the bctx_breadcrumb constructor to set the title, template, and type
|
498 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_title($post), $this->opt['Hpost_' . $post->post_type . '_template_no_anchor'], array('post', 'post-' . $post->post_type), null, $post->ID));
|
499 |
-
if($is_current_item)
|
500 |
-
{
|
501 |
-
$breadcrumb->add_type('current-item');
|
502 |
-
}
|
503 |
-
//Under a couple of circumstances we will want to link this breadcrumb
|
504 |
-
if($force_link || ($is_current_item && $this->opt['bcurrent_item_linked']) || ($is_paged && $this->opt['bpaged_display']))
|
505 |
-
{
|
506 |
-
//Change the template over to the normal, linked one
|
507 |
-
$breadcrumb->set_template($this->opt['Hpost_' . $post->post_type . '_template']);
|
508 |
-
//Add the link
|
509 |
-
$breadcrumb->set_url(get_permalink($post));
|
510 |
-
}
|
511 |
-
//If we have an attachment, run through the post again
|
512 |
-
if($post->post_type === 'attachment')
|
513 |
-
{
|
514 |
-
//Done with the current item, now on to the parents
|
515 |
-
$frontpage = get_option('page_on_front');
|
516 |
-
//Make sure the id is valid, and that we won't end up spinning in a loop
|
517 |
-
if($post->post_parent > 0 && $post->ID != $post->post_parent && $frontpage != $post->post_parent)
|
518 |
-
{
|
519 |
-
//Get the parent's information
|
520 |
-
$parent = get_post($post->post_parent);
|
521 |
-
//Take care of the parent's breadcrumb
|
522 |
-
$this->do_post($parent, true, false, false);
|
523 |
-
}
|
524 |
-
}
|
525 |
-
//Otherwise we need the follow the hiearchy tree
|
526 |
-
else
|
527 |
-
{
|
528 |
-
//Handle the post's hiearchy
|
529 |
-
$this->post_hierarchy($post->ID, $post->post_type, $post->post_parent);
|
530 |
-
}
|
531 |
-
}
|
532 |
-
/**
|
533 |
-
* A Breadcrumb Trail Filling Function
|
534 |
-
*
|
535 |
-
* @deprecated 6.0.0 No longer needed, superceeded by do_post
|
536 |
-
*
|
537 |
-
* This functions fills a breadcrumb for an attachment page.
|
538 |
-
*/
|
539 |
-
protected function do_attachment()
|
540 |
-
{
|
541 |
-
_deprecated_function( __FUNCTION__, '6.0', 'bctx_breadcrumb_trail::do_post');
|
542 |
-
$this->do_post(get_post());
|
543 |
-
}
|
544 |
-
/**
|
545 |
-
* A Breadcrumb Trail Filling Function
|
546 |
-
*
|
547 |
-
* This function fills a breadcrumb for any taxonomy archive, was previously two separate functions
|
548 |
-
*
|
549 |
-
* @param WP_Term $term The term object to generate the breadcrumb for
|
550 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
551 |
-
*/
|
552 |
-
protected function do_archive_by_term($term, $is_paged = false)
|
553 |
-
{
|
554 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, get a pointer to it in return
|
555 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($term->name, $this->opt['Htax_' . $term->taxonomy . '_template_no_anchor'], array('archive', 'taxonomy', $term->taxonomy, 'current-item'), null, $term->term_id));
|
556 |
-
//If we're paged, let's link to the first page
|
557 |
-
if($this->opt['bcurrent_item_linked'] || ($is_paged && $this->opt['bpaged_display']))
|
558 |
-
{
|
559 |
-
$breadcrumb->set_template($this->opt['Htax_' . $term->taxonomy . '_template']);
|
560 |
-
//Figure out the anchor for current category
|
561 |
-
$breadcrumb->set_url($this->maybe_add_post_type_arg(get_term_link($term), null, $term->taxonomy));
|
562 |
-
}
|
563 |
-
//Get parents of current term
|
564 |
-
if($term->parent)
|
565 |
-
{
|
566 |
-
$this->term_parents($term->parent, $term->taxonomy);
|
567 |
-
}
|
568 |
-
}
|
569 |
-
/**
|
570 |
-
* A Breadcrumb Trail Filling Function
|
571 |
-
*
|
572 |
-
* This functions fills a breadcrumb for day date archives
|
573 |
-
*
|
574 |
-
* @param WP_Post $post Instance of WP_Post object to create a breadcrumb for
|
575 |
-
* @param string $type The name of the CPT to generate the archive breadcrumb for
|
576 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
577 |
-
* @param bool $is_current_item Whether or not the breadcrumb being generated is the current item
|
578 |
-
*/
|
579 |
-
protected function do_day($post, $type, $is_paged = false, $is_current_item = true)
|
580 |
-
{
|
581 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
582 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_time(_x('d', 'day archive breadcrumb date format', 'tx-breadcrumb'), $post), $this->opt['Hdate_template_no_anchor'], array('archive', 'date-day')));
|
583 |
-
//If this is a day archive, add current-item type
|
584 |
-
if($is_current_item)
|
585 |
-
{
|
586 |
-
$breadcrumb->add_type('current-item');
|
587 |
-
}
|
588 |
-
//If we're paged, let's link to the first page
|
589 |
-
if(!$is_current_item || ($is_current_item && $this->opt['bcurrent_item_linked']) || ($is_paged && $this->opt['bpaged_display']))
|
590 |
-
{
|
591 |
-
//We're linking, so set the linked template
|
592 |
-
$breadcrumb->set_template($this->opt['Hdate_template']);
|
593 |
-
$url = get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d'));
|
594 |
-
//Deal with the anchor
|
595 |
-
$breadcrumb->set_url($this->maybe_add_post_type_arg($url, $type));
|
596 |
-
}
|
597 |
-
}
|
598 |
-
/**
|
599 |
-
* A Breadcrumb Trail Filling Function
|
600 |
-
*
|
601 |
-
* This functions fills a breadcrumb for month date archives
|
602 |
-
*
|
603 |
-
* @param WP_Post $post Instance of WP_Post object to create a breadcrumb for
|
604 |
-
* @param string $type The name of the CPT to generate the archive breadcrumb for
|
605 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
606 |
-
* @param bool $is_current_item Whether or not the breadcrumb being generated is the current item
|
607 |
-
*/
|
608 |
-
protected function do_month($post, $type, $is_paged = false, $is_current_item = true)
|
609 |
-
{
|
610 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
611 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_time(_x('F', 'month archive breadcrumb date format', 'tx-breadcrumb'), $post), $this->opt['Hdate_template_no_anchor'], array('archive', 'date-month')));
|
612 |
-
//If this is a month archive, add current-item type
|
613 |
-
if($is_current_item)
|
614 |
-
{
|
615 |
-
$breadcrumb->add_type('current-item');
|
616 |
-
}
|
617 |
-
//If we're paged, or not in the archive by month let's link to the first archive by month page
|
618 |
-
if(!$is_current_item || ($is_current_item && $this->opt['bcurrent_item_linked']) || ($is_paged && $this->opt['bpaged_display']))
|
619 |
-
{
|
620 |
-
//We're linking, so set the linked template
|
621 |
-
$breadcrumb->set_template($this->opt['Hdate_template']);
|
622 |
-
$url = get_month_link(get_the_time('Y'), get_the_time('m'));
|
623 |
-
//Deal with the anchor
|
624 |
-
$breadcrumb->set_url($this->maybe_add_post_type_arg($url, $type));
|
625 |
-
}
|
626 |
-
}
|
627 |
-
/**
|
628 |
-
* A Breadcrumb Trail Filling Function
|
629 |
-
*
|
630 |
-
* This functions fills a breadcrumb for year date archives
|
631 |
-
*
|
632 |
-
* @param WP_Post $post Instance of WP_Post object to create a breadcrumb for
|
633 |
-
* @param string $type The name of the CPT to generate the archive breadcrumb for
|
634 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
635 |
-
* @param bool $is_current_item Whether or not the breadcrumb being generated is the current item
|
636 |
-
*/
|
637 |
-
protected function do_year($post, $type, $is_paged = false, $is_current_item = true)
|
638 |
-
{
|
639 |
-
//Place the year breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
640 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_time(_x('Y', 'year archive breadcrumb date format', 'tx-breadcrumb'), $post), $this->opt['Hdate_template_no_anchor'], array('archive', 'date-year')));
|
641 |
-
//If this is a year archive, add current-item type
|
642 |
-
if($is_current_item)
|
643 |
-
{
|
644 |
-
$breadcrumb->add_type('current-item');
|
645 |
-
}
|
646 |
-
//If we're paged, or not in the archive by year let's link to the first archive by year page
|
647 |
-
if(!$is_current_item || ($is_current_item && $this->opt['bcurrent_item_linked']) || ($is_paged && $this->opt['bpaged_display']))
|
648 |
-
{
|
649 |
-
//We're linking, so set the linked template
|
650 |
-
$breadcrumb->set_template($this->opt['Hdate_template']);
|
651 |
-
$url = get_year_link(get_the_time('Y'));
|
652 |
-
//Deal with the anchor
|
653 |
-
$breadcrumb->set_url($this->maybe_add_post_type_arg($url, $type));
|
654 |
-
}
|
655 |
-
}
|
656 |
-
/**
|
657 |
-
* A Breadcrumb Trail Filling Function
|
658 |
-
*
|
659 |
-
* This functions fills a breadcrumb for a date archive.
|
660 |
-
*
|
661 |
-
* @param string $type The type to restrict the date archives to
|
662 |
-
*
|
663 |
-
* @deprecated 6.0.0 No longer needed, superceeded by do_day, do_month, and/or do_year
|
664 |
-
*/
|
665 |
-
protected function do_archive_by_date($type)
|
666 |
-
{
|
667 |
-
_deprecated_function( __FUNCTION__, '6.0', 'bctx_breadcrumb_trail::do_day, bctx_breadcrumb_trail::do_month, and/or bctx_breadcrumb_trail::do_year');
|
668 |
-
//First deal with the day breadcrumb
|
669 |
-
if(is_day() || is_single())
|
670 |
-
{
|
671 |
-
$this->do_day(get_post(), $type, is_paged(), is_day());
|
672 |
-
}
|
673 |
-
//Now deal with the month breadcrumb
|
674 |
-
if(is_month() || is_day() || is_single())
|
675 |
-
{
|
676 |
-
$this->do_month(get_post(), $type, is_paged(), is_month());
|
677 |
-
}
|
678 |
-
$this->do_year(get_post(), $type, is_paged(), is_year());
|
679 |
-
}
|
680 |
-
/**
|
681 |
-
* A Breadcrumb Trail Filling Function
|
682 |
-
*
|
683 |
-
* This functions fills a breadcrumb for a post type archive (WP 3.1 feature)
|
684 |
-
*
|
685 |
-
* @param string type_str The name of the CPT to generate the archive breadcrumb for
|
686 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
687 |
-
*/
|
688 |
-
protected function do_archive_by_post_type($type_str, $is_paged = false)
|
689 |
-
{
|
690 |
-
//Manually grabbing the post type object insted of post_type_archive_title('', false) to remove get_query_var() dependancy
|
691 |
-
$post_type_obj = get_post_type_object($type_str);
|
692 |
-
$title = apply_filters('post_type_archive_title', $post_type_obj->labels->name, $type_str);
|
693 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
694 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($title, $this->opt['Hpost_' . $type_str . '_template_no_anchor'], array('archive', 'post-' . $type_str . '-archive', 'current-item')));
|
695 |
-
if($this->opt['bcurrent_item_linked'] || ($is_paged && $this->opt['bpaged_display']))
|
696 |
-
{
|
697 |
-
|
698 |
-
$breadcrumb->set_template($this->opt['Hpost_' . $type_str . '_template']);
|
699 |
-
//Deal with the anchor
|
700 |
-
$breadcrumb->set_url(get_post_type_archive_link($type_str));
|
701 |
-
}
|
702 |
-
}
|
703 |
-
/**
|
704 |
-
* A Breadcrumb Trail Filling Function
|
705 |
-
*
|
706 |
-
* This functions fills a breadcrumb for the front page
|
707 |
-
*
|
708 |
-
* @param bool $force_link Whether or not to force this breadcrumb to be linked
|
709 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
710 |
-
* @param bool $is_current_item Whether or not the breadcrumb being generated is the current item
|
711 |
-
*/
|
712 |
-
protected function do_home($force_link = false, $is_paged = false, $is_current_item = true)
|
713 |
-
{
|
714 |
-
global $current_site;
|
715 |
-
//Exit early if we're not displaying the home breadcrumb
|
716 |
-
if(!$this->opt['bhome_display'])
|
717 |
-
{
|
718 |
-
return;
|
719 |
-
}
|
720 |
-
//Get the site name
|
721 |
-
$site_name = get_option('blogname');
|
722 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
723 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($site_name, $this->opt['Hhome_template_no_anchor'], array('home')));
|
724 |
-
if($is_current_item)
|
725 |
-
{
|
726 |
-
$breadcrumb->add_type('current-item');
|
727 |
-
}
|
728 |
-
//Under a couple of circumstances we will want to link this breadcrumb
|
729 |
-
if($force_link || ($is_current_item && $this->opt['bcurrent_item_linked']) || ($is_paged && $this->opt['bpaged_display']))
|
730 |
-
{
|
731 |
-
$breadcrumb->set_template($this->opt['Hhome_template']);
|
732 |
-
//Figure out the anchor for home page
|
733 |
-
$breadcrumb->set_url(get_home_url());
|
734 |
-
}
|
735 |
-
//If we have a multi site and are not on the main site we may need to add a breadcrumb for the main site
|
736 |
-
if($this->opt['bmainsite_display'] && !is_main_site())
|
737 |
-
{
|
738 |
-
//Get the site name
|
739 |
-
$site_name = get_site_option('site_name');
|
740 |
-
//Place the main site breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
741 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($site_name, $this->opt['Hmainsite_template'], array('main-home'), get_home_url($current_site->blog_id)));
|
742 |
-
}
|
743 |
-
}
|
744 |
-
/**
|
745 |
-
* A modified version of WordPress' function of the same name
|
746 |
-
*
|
747 |
-
* @param object $object the post or taxonomy object used to attempt to find the title
|
748 |
-
*
|
749 |
-
* @return string the title
|
750 |
-
*/
|
751 |
-
protected function post_type_archive_title($object)
|
752 |
-
{
|
753 |
-
if(isset($object->labels->name))
|
754 |
-
{
|
755 |
-
//Core filter use here is ok for time being
|
756 |
-
//TODO: Recheck validitiy prior to each release
|
757 |
-
return apply_filters('post_type_archive_title', $object->labels->name, $object->name);
|
758 |
-
}
|
759 |
-
}
|
760 |
-
/**
|
761 |
-
* Determines if a post type is a built in type or not
|
762 |
-
*
|
763 |
-
* @param string $post_type the name of the post type
|
764 |
-
*
|
765 |
-
* @return bool
|
766 |
-
*/
|
767 |
-
protected function is_builtin($post_type)
|
768 |
-
{
|
769 |
-
$type = get_post_type_object($post_type);
|
770 |
-
//If we get a null, that means either then type wasn't found, or we had 'any' as a type, treat as builtin
|
771 |
-
if($type === null)
|
772 |
-
{
|
773 |
-
return true;
|
774 |
-
}
|
775 |
-
else
|
776 |
-
{
|
777 |
-
return $type->_builtin;
|
778 |
-
}
|
779 |
-
}
|
780 |
-
/**
|
781 |
-
* Determines if the current location is a for a root page or not
|
782 |
-
*
|
783 |
-
* @param string $post_type the name of the post type
|
784 |
-
* @return bool
|
785 |
-
*
|
786 |
-
* TODO: Remove dependancies to current state (state should be passed in)
|
787 |
-
*/
|
788 |
-
protected function treat_as_root_page($post_type)
|
789 |
-
{
|
790 |
-
return (is_home() || (is_post_type_archive() && !$this->opt['bpost_' . $post_type . '_archive_display']));
|
791 |
-
}
|
792 |
-
/**
|
793 |
-
* Determines if a post type has archives enabled or not
|
794 |
-
*
|
795 |
-
* @param string $post_type the name of the post type
|
796 |
-
*
|
797 |
-
* @return bool
|
798 |
-
*/
|
799 |
-
protected function has_archive($post_type)
|
800 |
-
{
|
801 |
-
$type = get_post_type_object($post_type); //TODO need a check on this for WP_Error?
|
802 |
-
return $type->has_archive;
|
803 |
-
}
|
804 |
-
/**
|
805 |
-
* Retrieves the query var for 'post_type', sets default to post, and escapes
|
806 |
-
*
|
807 |
-
* @param string $default[optional] The default value to return if nothing was found/set or if post_type was an array
|
808 |
-
*
|
809 |
-
* @return string The post type string found in the post_type query var
|
810 |
-
*/
|
811 |
-
protected function get_type_string_query_var($default = 'post')
|
812 |
-
{
|
813 |
-
$type_str = get_query_var('post_type', $default);
|
814 |
-
if($type_str === '' || is_array($type_str))
|
815 |
-
{
|
816 |
-
//If we didn't get a type, or it was an array, try the the first post
|
817 |
-
$post = get_post();
|
818 |
-
if($post instanceof WP_Post)
|
819 |
-
{
|
820 |
-
$type_str = $post->post_type;
|
821 |
-
}
|
822 |
-
else
|
823 |
-
{
|
824 |
-
$type_str = $default;
|
825 |
-
}
|
826 |
-
}
|
827 |
-
return esc_attr($type_str);
|
828 |
-
}
|
829 |
-
/**
|
830 |
-
* Retrieves the query var for 'post_type', and returns whether or not it is an array
|
831 |
-
*
|
832 |
-
* @return bool Whether or not the post_type query var is an array
|
833 |
-
*/
|
834 |
-
protected function is_type_query_var_array()
|
835 |
-
{
|
836 |
-
return is_array(get_query_var('post_type'));
|
837 |
-
}
|
838 |
-
/**
|
839 |
-
* Adds the post type argument to the URL iff the passed in type is not post
|
840 |
-
*
|
841 |
-
* @param string $url The URL to possibly add the post_type argument to
|
842 |
-
* @param string $type[optional] The type to possibly add to the URL
|
843 |
-
* @param string $taxonomy[optional] If we're dealing with a taxonomy term, the taxonomy of that term
|
844 |
-
*
|
845 |
-
* @return string The possibly modified URL
|
846 |
-
*/
|
847 |
-
protected function maybe_add_post_type_arg($url, $type = null, $taxonomy = null)
|
848 |
-
{
|
849 |
-
global $wp_taxonomies;
|
850 |
-
//Rather than default to post, we should try to find the type
|
851 |
-
if($type == null)
|
852 |
-
{
|
853 |
-
$type = $this->get_type_string_query_var();
|
854 |
-
}
|
855 |
-
//Add a query arg if we are not on the default post type for the archive in question and the post type is not post
|
856 |
-
$add_query_arg = (!($taxonomy && $type === $wp_taxonomies[$taxonomy]->object_type[0]) && $type !== 'post');
|
857 |
-
//Filter the add_query_arg logic, only add the query arg if necessary
|
858 |
-
if(apply_filters('bctx_add_post_type_arg', $add_query_arg, $type, $taxonomy))
|
859 |
-
{
|
860 |
-
$url = add_query_arg(array('post_type' => $type), $url);
|
861 |
-
}
|
862 |
-
return $url;
|
863 |
-
}
|
864 |
-
/**
|
865 |
-
* A Breadcrumb Trail Filling Function
|
866 |
-
*
|
867 |
-
* Deals with the post type archive and taxonomy archives
|
868 |
-
*
|
869 |
-
* @param WP_Post|WP_Taxonomy $type The post or taxonomy to generate the archive breadcrumb for
|
870 |
-
* @param string $type_str The type string for the archive
|
871 |
-
*
|
872 |
-
* TODO: Remove dependancies to current state (state should be passed in)
|
873 |
-
*/
|
874 |
-
protected function type_archive($type, $type_str = false)
|
875 |
-
{
|
876 |
-
global $wp_taxonomies;
|
877 |
-
if(!isset($type->taxonomy) && $type_str === false) //TODO could probably check the class type here
|
878 |
-
{
|
879 |
-
$type_str = $this->get_type_string_query_var();
|
880 |
-
}
|
881 |
-
//If this is a custom post type with a post type archive, add it
|
882 |
-
if($type_str && !$this->is_builtin($type_str) && $this->opt['bpost_' . $type_str . '_archive_display'] && $this->has_archive($type_str))
|
883 |
-
{
|
884 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
885 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($this->post_type_archive_title(get_post_type_object($type_str)), $this->opt['Hpost_' . $type_str . '_template'], array('post', 'post-' . $type_str . '-archive'), get_post_type_archive_link($type_str)));
|
886 |
-
}
|
887 |
-
//Otherwise, if this is a custom taxonomy with an archive, add it
|
888 |
-
else if(isset($type->taxonomy) && isset($wp_taxonomies[$type->taxonomy]->object_type[0])
|
889 |
-
&& !$this->is_builtin($this->get_type_string_query_var($wp_taxonomies[$type->taxonomy]->object_type[0]))
|
890 |
-
&& $this->opt['bpost_' . $this->get_type_string_query_var($wp_taxonomies[$type->taxonomy]->object_type[0]) . '_archive_display']
|
891 |
-
&& $this->has_archive($this->get_type_string_query_var($wp_taxonomies[$type->taxonomy]->object_type[0]))
|
892 |
-
&& !$this->is_type_query_var_array())
|
893 |
-
{
|
894 |
-
//We end up using the post type in several places, give it a variable
|
895 |
-
$post_type = apply_filters('bctx_type_archive_post_type', $this->get_type_string_query_var($wp_taxonomies[$type->taxonomy]->object_type[0]));
|
896 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
|
897 |
-
$breadcrumb = $this->add(new bctx_breadcrumb($this->post_type_archive_title(get_post_type_object($post_type)), $this->opt['Hpost_' . $post_type . '_template'], array('post', 'post-' . $post_type . '-archive'), get_post_type_archive_link($post_type)));
|
898 |
-
}
|
899 |
-
}
|
900 |
-
/**
|
901 |
-
* A Breadcrumb Trail Filling Function
|
902 |
-
*
|
903 |
-
* Handles only the root page stuff for post types, including the "page for posts"
|
904 |
-
*
|
905 |
-
* @param string $type_str The type string variable
|
906 |
-
* @param int $root_id The ID for the post type root
|
907 |
-
* @param bool $is_paged Whether or not the current resource is on a page other than page 1
|
908 |
-
* @param bool $is_current_item Whether or not the breadcrumb being generated is the current item
|
909 |
-
*/
|
910 |
-
protected function do_root($type_str, $root_id, $is_paged = false, $is_current_item = true)
|
911 |
-
{
|
912 |
-
//Nothing to do for the page post type, exit early
|
913 |
-
if($type_str === 'page')
|
914 |
-
{
|
915 |
-
return;
|
916 |
-
}
|
917 |
-
$frontpage_id = get_option('page_on_front');
|
918 |
-
//Retrieve the post for the root_id as we will need it eventually
|
919 |
-
$bctx_post = get_post($root_id);
|
920 |
-
//We'll have to check if this ID is valid, e.g. user has specified a posts page
|
921 |
-
if($bctx_post instanceof WP_Post && $root_id > 0 && $root_id != $frontpage_id)
|
922 |
-
{
|
923 |
-
//Place the breadcrumb in the trail, uses the constructor to set the title, template, and type, we get a pointer to it in return
|
924 |
-
$breadcrumb = $this->add(new bctx_breadcrumb(get_the_title($root_id), $this->opt['Hpost_' . $type_str . '_template_no_anchor'], array($type_str . '-root', 'post', 'post-' . $type_str), null, $root_id));
|
925 |
-
//If we are at home, or any root page archive then we need to add the current item type
|
926 |
-
if($is_current_item)
|
927 |
-
{
|
928 |
-
$breadcrumb->add_type('current-item');
|
929 |
-
}
|
930 |
-
//If we're not on the current item we need to setup the anchor
|
931 |
-
if(!$is_current_item || ($is_current_item && $this->opt['bcurrent_item_linked']) || ($is_paged && $this->opt['bpaged_display']))
|
932 |
-
{
|
933 |
-
$breadcrumb->set_template($this->opt['Hpost_' . $type_str . '_template']);
|
934 |
-
//Figure out the anchor for home page
|
935 |
-
$breadcrumb->set_url(get_permalink($root_id));
|
936 |
-
}
|
937 |
-
//Done with the "root", now on to the parents
|
938 |
-
//If there is a parent post let's find it
|
939 |
-
if($bctx_post->post_parent > 0 && $bctx_post->ID != $bctx_post->post_parent && $frontpage_id != $bctx_post->post_parent)
|
940 |
-
{
|
941 |
-
$this->post_parents($bctx_post->post_parent, $frontpage_id);
|
942 |
-
}
|
943 |
-
}
|
944 |
-
}
|
945 |
-
/**
|
946 |
-
* A Breadcrumb Trail Filling Function
|
947 |
-
*
|
948 |
-
* This functions fills a breadcrumb for 404 pages.
|
949 |
-
*/
|
950 |
-
protected function do_404()
|
951 |
-
{
|
952 |
-
//Place the breadcrumb in the trail, uses the bctx_breadcrumb constructor to set the title, prefix, and suffix
|
953 |
-
$this->breadcrumbs[] = new bctx_breadcrumb($this->opt['S404_title'], $this->opt['H404_template'], array('404', 'current-item'));
|
954 |
-
}
|
955 |
-
/**
|
956 |
-
* A Breadcrumb Trail Filling Function
|
957 |
-
*
|
958 |
-
* This functions fills a breadcrumb for paged pages
|
959 |
-
*
|
960 |
-
* @param int $page_number The page number to create a breadcrumb for
|
961 |
-
*/
|
962 |
-
protected function do_paged($page_number)
|
963 |
-
{
|
964 |
-
//Place the breadcrumb in the trail, uses the bctx_breadcrumb constructor to set the title, prefix, and suffix
|
965 |
-
$this->breadcrumbs[] = new bctx_breadcrumb((string) $page_number, $this->opt['Hpaged_template'], array('paged'));
|
966 |
-
}
|
967 |
-
/**
|
968 |
-
* Breadcrumb Trail Filling Function
|
969 |
-
*
|
970 |
-
* This functions fills the breadcrumb trail.
|
971 |
-
*/
|
972 |
-
public function fill()
|
973 |
-
{
|
974 |
-
global $wpdb, $wp_query, $wp;
|
975 |
-
//Check to see if the trail is already populated
|
976 |
-
if(count($this->breadcrumbs) > 0)
|
977 |
-
{
|
978 |
-
//Exit early since we have breadcrumbs in the trail
|
979 |
-
return null;
|
980 |
-
}
|
981 |
-
if($this->opt['bblog_display'])
|
982 |
-
{
|
983 |
-
$this->opt['apost_post_root'] = get_option('page_for_posts');
|
984 |
-
}
|
985 |
-
else
|
986 |
-
{
|
987 |
-
$this->opt['apost_post_root'] = false;
|
988 |
-
}
|
989 |
-
//Do any actions if necessary, we past through the current object instance to keep life simple
|
990 |
-
do_action('bctx_before_fill', $this);
|
991 |
-
$type = $wp_query->get_queried_object();
|
992 |
-
//Do specific opperations for the various page types
|
993 |
-
//Check if this isn't the first of a multi paged item
|
994 |
-
if($this->opt['bpaged_display'] && (is_paged() || is_singular() && get_query_var('page') > 1))
|
995 |
-
{
|
996 |
-
//Need to switch between paged and page for archives and singular (posts)
|
997 |
-
if(get_query_var('paged') > 0)
|
998 |
-
{
|
999 |
-
//Can use simple type hinting here to int since we already checked for greater than 0
|
1000 |
-
$page_number = (int) abs(get_query_var('paged'));
|
1001 |
-
}
|
1002 |
-
else
|
1003 |
-
{
|
1004 |
-
$page_number = (int) abs(get_query_var('page'));
|
1005 |
-
}
|
1006 |
-
$this->do_paged($page_number);
|
1007 |
-
}
|
1008 |
-
//For the front page, as it may also validate as a page, do it first
|
1009 |
-
if(is_front_page())
|
1010 |
-
{
|
1011 |
-
//Must have two seperate branches so that we don't evaluate it as a page
|
1012 |
-
if($this->opt['bhome_display'])
|
1013 |
-
{
|
1014 |
-
$this->do_home(false, is_paged());
|
1015 |
-
}
|
1016 |
-
}
|
1017 |
-
//For posts
|
1018 |
-
else if(is_singular())
|
1019 |
-
{
|
1020 |
-
$this->do_post(get_post(), false, (get_query_var('page') > 1));
|
1021 |
-
//If this is an attachment then we need to change the queried object to the parent post
|
1022 |
-
if(is_attachment())
|
1023 |
-
{
|
1024 |
-
//Could use the $post global, but we can't really trust it
|
1025 |
-
$post = get_post();
|
1026 |
-
$type = get_post($post->post_parent); //TODO check for WP_Error?
|
1027 |
-
}
|
1028 |
-
$this->do_root($type->post_type, $this->opt['apost_' . $type->post_type . '_root'], is_paged(), false);
|
1029 |
-
}
|
1030 |
-
//For searches
|
1031 |
-
else if(is_search())
|
1032 |
-
{
|
1033 |
-
$this->do_search(get_search_query(), is_paged());
|
1034 |
-
}
|
1035 |
-
//For author pages
|
1036 |
-
else if(is_author())
|
1037 |
-
{
|
1038 |
-
$this->do_author($type, is_paged());
|
1039 |
-
$this->do_root('post', $this->opt['aauthor_root'], is_paged(), false);
|
1040 |
-
}
|
1041 |
-
//For archives
|
1042 |
-
else if(is_archive())
|
1043 |
-
{
|
1044 |
-
//We need the type for later, so save it
|
1045 |
-
$type_str = get_query_var('post_type');
|
1046 |
-
//May be an array, if so, rewind the iterator and grab first item
|
1047 |
-
if(is_array($type_str))
|
1048 |
-
{
|
1049 |
-
$type_str = reset($type_str);
|
1050 |
-
}
|
1051 |
-
//For date based archives
|
1052 |
-
if(is_date())
|
1053 |
-
{
|
1054 |
-
//First deal with the day breadcrumb
|
1055 |
-
if(is_day())
|
1056 |
-
{
|
1057 |
-
$this->do_day(get_post(), $this->get_type_string_query_var(), is_paged(), true);
|
1058 |
-
}
|
1059 |
-
//Now deal with the month breadcrumb
|
1060 |
-
if(is_month() || is_day())
|
1061 |
-
{
|
1062 |
-
$this->do_month(get_post(), $this->get_type_string_query_var(), is_paged(), is_month());
|
1063 |
-
}
|
1064 |
-
$this->do_year(get_post(), $this->get_type_string_query_var(), is_paged(), is_year());
|
1065 |
-
$type_str = $this->get_type_string_query_var();
|
1066 |
-
$this->type_archive($type, $type_str);
|
1067 |
-
}
|
1068 |
-
//If we have a post type archive, and it does not have a root page generate the archive
|
1069 |
-
else if(is_post_type_archive() && !isset($type->taxonomy)
|
1070 |
-
&& (!is_numeric($this->opt['apost_' . $type_str . '_root']) || $this->opt['bpost_' . $type_str . '_archive_display']))
|
1071 |
-
{
|
1072 |
-
$this->do_archive_by_post_type($this->get_type_string_query_var(), is_paged());
|
1073 |
-
}
|
1074 |
-
//For taxonomy based archives
|
1075 |
-
else if(is_category() || is_tag() || is_tax())
|
1076 |
-
{
|
1077 |
-
$this->do_archive_by_term($type, is_paged());
|
1078 |
-
$this->type_archive($type);
|
1079 |
-
$type_str = $this->get_type_string_query_var($GLOBALS['wp_taxonomies'][$type->taxonomy]->object_type[0]);
|
1080 |
-
}
|
1081 |
-
else
|
1082 |
-
{
|
1083 |
-
$this->type_archive($type);
|
1084 |
-
}
|
1085 |
-
$this->do_root($type_str, $this->opt['apost_' . $type_str . '_root'], is_paged(), $this->treat_as_root_page($type_str));
|
1086 |
-
}
|
1087 |
-
//For 404 pages
|
1088 |
-
else if(is_404())
|
1089 |
-
{
|
1090 |
-
$this->do_404();
|
1091 |
-
}
|
1092 |
-
else
|
1093 |
-
{
|
1094 |
-
//If it looks, walks, and quacks like a taxonomy, treat is as one
|
1095 |
-
if(isset($type->taxonomy))
|
1096 |
-
{
|
1097 |
-
$this->do_archive_by_term($type, is_paged());
|
1098 |
-
$this->type_archive($type);
|
1099 |
-
$type_str = $this->get_type_string_query_var($wp_taxonomies[$type->taxonomy]->object_type[0]);
|
1100 |
-
}
|
1101 |
-
//Otherwise, it's likely the blog page
|
1102 |
-
else if($this->opt['bblog_display'] || is_home())
|
1103 |
-
{
|
1104 |
-
$type_str = 'post';
|
1105 |
-
}
|
1106 |
-
if(isset($this->opt['apost_' . $type_str . '_root']))
|
1107 |
-
{
|
1108 |
-
$this->do_root($type_str, $this->opt['apost_' . $type_str . '_root'], is_paged(), $this->treat_as_root_page($type_str));
|
1109 |
-
}
|
1110 |
-
}
|
1111 |
-
//We always do the home link last, unless on the frontpage
|
1112 |
-
if(!is_front_page())
|
1113 |
-
{
|
1114 |
-
$this->do_home(true, false, false);
|
1115 |
-
}
|
1116 |
-
//Do any actions if necessary, we past through the current object instance to keep life simple
|
1117 |
-
do_action('bctx_after_fill', $this);
|
1118 |
-
}
|
1119 |
-
public function fill_REST($item)
|
1120 |
-
{
|
1121 |
-
if($item instanceof WP_Error || $item === null)
|
1122 |
-
{
|
1123 |
-
return;
|
1124 |
-
}
|
1125 |
-
//Handle Posts
|
1126 |
-
if($item instanceof WP_Post)
|
1127 |
-
{
|
1128 |
-
$this->do_post($item, false, true);
|
1129 |
-
$this->do_root($item->post_type, $this->opt['apost_' . $item->post_type . '_root'], false, false);
|
1130 |
-
}
|
1131 |
-
//Handle Terms
|
1132 |
-
else if($item instanceof WP_Term)
|
1133 |
-
{
|
1134 |
-
$this->do_archive_by_term($item, true);
|
1135 |
-
$this->type_archive($item);
|
1136 |
-
$type_str = $this->get_type_string_query_var($GLOBALS['wp_taxonomies'][$item->taxonomy]->object_type[0]);
|
1137 |
-
$this->do_root($type_str, $this->opt['apost_' . $type_str . '_root'], is_paged(), $this->treat_as_root_page($type_str));
|
1138 |
-
}
|
1139 |
-
//Handle Author Archives
|
1140 |
-
else if($item instanceof WP_User)
|
1141 |
-
{
|
1142 |
-
$this->do_author($item, true);
|
1143 |
-
$this->do_root('post', $this->opt['aauthor_root'], false, false);
|
1144 |
-
}
|
1145 |
-
$this->do_home(true, false, false);
|
1146 |
-
}
|
1147 |
-
/**
|
1148 |
-
* This function will either set the order of the trail to reverse key
|
1149 |
-
* order, or make sure it is forward key ordered.
|
1150 |
-
*
|
1151 |
-
* @param bool $reverse[optional] Whether to reverse the trail or not.
|
1152 |
-
*/
|
1153 |
-
protected function order($reverse = false)
|
1154 |
-
{
|
1155 |
-
if($reverse)
|
1156 |
-
{
|
1157 |
-
//Since there may be multiple calls our trail may be in a non-standard order
|
1158 |
-
ksort($this->breadcrumbs);
|
1159 |
-
}
|
1160 |
-
else
|
1161 |
-
{
|
1162 |
-
//For normal opperation we must reverse the array by key
|
1163 |
-
krsort($this->breadcrumbs);
|
1164 |
-
}
|
1165 |
-
}
|
1166 |
-
/**
|
1167 |
-
* This functions outputs or returns the breadcrumb trail in string form.
|
1168 |
-
*
|
1169 |
-
* @param bool $linked[optional] Whether to allow hyperlinks in the trail or not.
|
1170 |
-
* @param bool $reverse[optional] Whether to reverse the output or not.
|
1171 |
-
* @param string $template The template to use for the string output.
|
1172 |
-
*
|
1173 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
1174 |
-
* @return string String-Data of breadcrumb trail.
|
1175 |
-
*/
|
1176 |
-
public function display($linked = true, $reverse = false, $template = '%1$s%2$s')
|
1177 |
-
{
|
1178 |
-
//Set trail order based on reverse flag
|
1179 |
-
$this->order($reverse);
|
1180 |
-
//The main compiling loop
|
1181 |
-
$trail_str = $this->display_loop($linked, $reverse, $template);
|
1182 |
-
return $trail_str;
|
1183 |
-
}
|
1184 |
-
/**
|
1185 |
-
* This functions outputs or returns the breadcrumb trail in list form.
|
1186 |
-
*
|
1187 |
-
* @deprecated 6.0.0 No longer needed, superceeded by $template parameter in display
|
1188 |
-
*
|
1189 |
-
* @param bool $linked[optional] Whether to allow hyperlinks in the trail or not.
|
1190 |
-
* @param bool $reverse[optional] Whether to reverse the output or not.
|
1191 |
-
*
|
1192 |
-
* @return void Void if option to print out breadcrumb trail was chosen.
|
1193 |
-
* @return string String version of the breadcrumb trail.
|
1194 |
-
*/
|
1195 |
-
public function display_list($linked = true, $reverse = false)
|
1196 |
-
{
|
1197 |
-
_deprecated_function( __FUNCTION__, '6.0', 'bctx_breadcrumb_trail::display');
|
1198 |
-
return $this->display($return, $linked, $reverse, "<li%3\$s>%1\$s</li>\n");
|
1199 |
-
}
|
1200 |
-
/**
|
1201 |
-
* This function assembles the breadcrumbs in the breadcrumb trail in accordance with the passed in template
|
1202 |
-
*
|
1203 |
-
* @param bool $linked Whether to allow hyperlinks in the trail or not.
|
1204 |
-
* @param bool $reverse Whether to reverse the output or not.
|
1205 |
-
* @param string $template The template to use for the string output.
|
1206 |
-
*
|
1207 |
-
* @return string String-Data of breadcrumb trail.
|
1208 |
-
*/
|
1209 |
-
protected function display_loop($linked, $reverse, $template)
|
1210 |
-
{
|
1211 |
-
$position = 1;
|
1212 |
-
$last_position = count($this->breadcrumbs);
|
1213 |
-
//Initilize the string which will hold the assembled trail
|
1214 |
-
$trail_str = '';
|
1215 |
-
foreach($this->breadcrumbs as $key => $breadcrumb)
|
1216 |
-
{
|
1217 |
-
$types = $breadcrumb->get_types();
|
1218 |
-
array_walk($types, 'sanitize_html_class');
|
1219 |
-
$class = sprintf(' class="%s"', esc_attr(implode(' ', $types)));
|
1220 |
-
//Deal with the separator
|
1221 |
-
if($position < $last_position)
|
1222 |
-
{
|
1223 |
-
$separator = $this->opt['hseparator'];
|
1224 |
-
}
|
1225 |
-
else
|
1226 |
-
{
|
1227 |
-
$separator = '';
|
1228 |
-
}
|
1229 |
-
//Filter li_attributes adding attributes to the li element
|
1230 |
-
$attribs = apply_filters_deprecated('bctx_li_attributes', array($class, $breadcrumb->get_types(), $breadcrumb->get_id()), '6.0.0', 'bctx_display_attributes');
|
1231 |
-
$attribs = apply_filters('bctx_display_attributes', $class, $breadcrumb->get_types(), $breadcrumb->get_id());
|
1232 |
-
//Trim titles, if requested
|
1233 |
-
if($this->opt['blimit_title'] && $this->opt['amax_title_length'] > 0)
|
1234 |
-
{
|
1235 |
-
//Trim the breadcrumb's title
|
1236 |
-
$breadcrumb->title_trim($this->opt['amax_title_length']);
|
1237 |
-
}
|
1238 |
-
//Assemble the breadrumb and wrap with li's
|
1239 |
-
$trail_str .= sprintf($template, $breadcrumb->assemble($linked, $position), $separator, $attribs);
|
1240 |
-
$position++;
|
1241 |
-
}
|
1242 |
-
return $trail_str;
|
1243 |
-
}
|
1244 |
-
/**
|
1245 |
-
* This functions outputs or returns the breadcrumb trail in Schema.org BreadcrumbList compliant JSON-LD
|
1246 |
-
*
|
1247 |
-
* @param bool $reverse[optional] Whether to reverse the output or not.
|
1248 |
-
*
|
1249 |
-
* @return void Void if option to print out breadcrumb trail was chosen.
|
1250 |
-
* @return object basic object version of the breadcrumb trail ready for json_encode.
|
1251 |
-
*/
|
1252 |
-
public function display_json_ld($reverse = false)
|
1253 |
-
{
|
1254 |
-
//Set trail order based on reverse flag
|
1255 |
-
$this->order($reverse);
|
1256 |
-
$trail_str = (object)array(
|
1257 |
-
'@context' => 'http://schema.org',
|
1258 |
-
'@type' => 'BreadcrumbList',
|
1259 |
-
'itemListElement' => $this->json_ld_loop());
|
1260 |
-
return $trail_str;
|
1261 |
-
}
|
1262 |
-
/**
|
1263 |
-
* This function assembles all of the breadcrumbs into an object ready for json_encode
|
1264 |
-
*
|
1265 |
-
* @return array The array of breadcrumbs prepared for JSON-LD
|
1266 |
-
*/
|
1267 |
-
protected function json_ld_loop()
|
1268 |
-
{
|
1269 |
-
$postion = 1;
|
1270 |
-
$breadcrumbs = array();
|
1271 |
-
//Loop around our breadcrumbs, call the JSON-LD assembler
|
1272 |
-
foreach($this->breadcrumbs as $breadcrumb)
|
1273 |
-
{
|
1274 |
-
$breadcrumbs[] = $breadcrumb->assemble_json_ld($postion);
|
1275 |
-
$postion++;
|
1276 |
-
}
|
1277 |
-
return $breadcrumbs;
|
1278 |
-
}
|
1279 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/class.bctx_network_admin.php
DELETED
@@ -1,193 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
|
20 |
-
//Include admin base class
|
21 |
-
if(!class_exists('bctx_admin'))
|
22 |
-
{
|
23 |
-
require_once(dirname(__FILE__) . '/class.bctx_admin.php');
|
24 |
-
}
|
25 |
-
/**
|
26 |
-
* The administrative interface class
|
27 |
-
*
|
28 |
-
*/
|
29 |
-
class bctx_network_admin extends bctx_admin
|
30 |
-
{
|
31 |
-
const version = '6.1.0';
|
32 |
-
protected $full_name = 'TX Breadcrumb Network Settings';
|
33 |
-
protected $access_level = 'manage_network_options';
|
34 |
-
/**
|
35 |
-
* Administrative interface class default constructor
|
36 |
-
* @param bctx_breadcrumb_trail $breadcrumb_trail a breadcrumb trail object
|
37 |
-
* @param string $basename The basename of the plugin
|
38 |
-
*/
|
39 |
-
function __construct(bctx_breadcrumb_trail &$breadcrumb_trail, $basename)
|
40 |
-
{
|
41 |
-
//We're going to make sure we load the parent's constructor
|
42 |
-
parent::__construct($breadcrumb_trail, $basename);
|
43 |
-
//Change to the proper name
|
44 |
-
$this->full_name = __('TX Breadcrumb Network Settings', 'tx-breadcrumb');
|
45 |
-
//Remove the hook added by the parent as we don't want this classes settings page everywhere
|
46 |
-
remove_action('admin_menu', array($this, 'add_page'));
|
47 |
-
//Replace with the network_admin hook
|
48 |
-
add_action('network_admin_menu', array($this, 'add_page'));
|
49 |
-
}
|
50 |
-
/**
|
51 |
-
* admin initialization callback function
|
52 |
-
*
|
53 |
-
* is bound to wordpress action 'admin_init' on instantiation
|
54 |
-
*
|
55 |
-
* @since 3.2.0
|
56 |
-
* @return void
|
57 |
-
*/
|
58 |
-
function init()
|
59 |
-
{
|
60 |
-
//We're going to make sure we run the parent's version of this function as well
|
61 |
-
parent::init();
|
62 |
-
}
|
63 |
-
function wp_loaded()
|
64 |
-
{
|
65 |
-
parent::wp_loaded();
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Return the URL of the settings page for the plugin
|
69 |
-
*/
|
70 |
-
function admin_url()
|
71 |
-
{
|
72 |
-
return admin_url('network/settings.php?page=' . $this->identifier);
|
73 |
-
}
|
74 |
-
/**
|
75 |
-
* Adds the adminpage the menu and the nice little settings link
|
76 |
-
*/
|
77 |
-
function add_page()
|
78 |
-
{
|
79 |
-
//Add the submenu page to "settings" menu
|
80 |
-
$hookname = add_submenu_page('settings.php', $this->full_name, $this->short_name, $this->access_level, $this->identifier, array($this, 'admin_page'));
|
81 |
-
// check capability of user to manage options (access control)
|
82 |
-
if(current_user_can($this->access_level))
|
83 |
-
{
|
84 |
-
//Register admin_head-$hookname callback
|
85 |
-
add_action('admin_head-' . $hookname, array($this, 'admin_head'));
|
86 |
-
//Register admin_print_styles-$hookname callback
|
87 |
-
add_action('admin_print_styles-' . $hookname, array($this, 'admin_styles'));
|
88 |
-
//Register admin_print_scripts-$hookname callback
|
89 |
-
add_action('admin_print_scripts-' . $hookname, array($this, 'admin_scripts'));
|
90 |
-
//Register Help Output
|
91 |
-
add_action('load-' . $hookname, array($this, 'help'));
|
92 |
-
}
|
93 |
-
}
|
94 |
-
/**
|
95 |
-
* Have to hook into get_option and replace with network wide alternate
|
96 |
-
*
|
97 |
-
* @param string $option The name of the option to retrieve
|
98 |
-
* @return mixed The value of the option
|
99 |
-
*/
|
100 |
-
function get_option($option)
|
101 |
-
{
|
102 |
-
return get_site_option($option);
|
103 |
-
}
|
104 |
-
/**
|
105 |
-
* Have to hook into update_option and replace with network wide alternate
|
106 |
-
*
|
107 |
-
* @param string $option The name of the option to update
|
108 |
-
* @param mixed $newvalue The new value to set the option to
|
109 |
-
*
|
110 |
-
*/
|
111 |
-
function update_option($option, $newvalue)
|
112 |
-
{
|
113 |
-
return update_site_option($option, $newvalue);
|
114 |
-
}
|
115 |
-
/**
|
116 |
-
* Have to hook into add_option and replace with network wide alternate
|
117 |
-
*
|
118 |
-
* @param string $option The name of the option to update
|
119 |
-
* @param mixed $value The new value to set the option to
|
120 |
-
* @param null $deprecated Deprecated parameter
|
121 |
-
* @param string $autoload Whether or not to autoload the option, it's a string because WP is special
|
122 |
-
*
|
123 |
-
*/
|
124 |
-
function add_option($option, $value = '', $deprecated = '', $autoload = 'yes')
|
125 |
-
{
|
126 |
-
return add_site_option($option, $value);
|
127 |
-
}
|
128 |
-
/**
|
129 |
-
* Have to hook into delete_option and replace with network wide alternate
|
130 |
-
*
|
131 |
-
* @param string $option The name of the option to delete
|
132 |
-
*/
|
133 |
-
function delete_option($option)
|
134 |
-
{
|
135 |
-
return delete_site_option($option);
|
136 |
-
}
|
137 |
-
/**
|
138 |
-
* A message function that checks for the BCN_SETTINGS_* define statement
|
139 |
-
*/
|
140 |
-
function multisite_settings_warn()
|
141 |
-
{
|
142 |
-
if(is_multisite())
|
143 |
-
{
|
144 |
-
if(defined('BCN_SETTINGS_USE_LOCAL') && BCN_SETTINGS_USE_LOCAL)
|
145 |
-
{
|
146 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Individual site settings will override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_ns_isiteoveride');
|
147 |
-
}
|
148 |
-
else if(defined('BCN_SETTINGS_USE_NETWORK') && BCN_SETTINGS_USE_NETWORK)
|
149 |
-
{
|
150 |
-
|
151 |
-
}
|
152 |
-
else if(defined('BCN_SETTINGS_FAVOR_LOCAL') && BCN_SETTINGS_FAVOR_LOCAL)
|
153 |
-
{
|
154 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Individual site settings may override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_ns_isitemayoveride');
|
155 |
-
}
|
156 |
-
else if(defined('BCN_SETTINGS_FAVOR_NETWORK') && BCN_SETTINGS_FAVOR_NETWORK)
|
157 |
-
{
|
158 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Individual site settings may override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_ns_nsmayoveride');
|
159 |
-
}
|
160 |
-
//Fall through if no settings mode was set
|
161 |
-
else
|
162 |
-
{
|
163 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: No BCN_SETTINGS_* define statement found, defaulting to BCN_SETTINGS_USE_LOCAL.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_ns_nosetting');
|
164 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Warning: Individual site settings will override any settings set in this page.', 'tx-breadcrumb'), 'warning', true, $this->unique_prefix . '_msg_ns_isiteoveride');
|
165 |
-
}
|
166 |
-
}
|
167 |
-
}
|
168 |
-
/**
|
169 |
-
* A message function that checks for deprecated settings that are set and warns the user
|
170 |
-
*/
|
171 |
-
function deprecated_settings_warn()
|
172 |
-
{
|
173 |
-
parent::deprecated_settings_warn();
|
174 |
-
}
|
175 |
-
/**
|
176 |
-
* Function checks the current site to see if the blog options should be disabled
|
177 |
-
*
|
178 |
-
* @return boool Whether or not the blog options should be disabled
|
179 |
-
*/
|
180 |
-
function maybe_disable_blog_options()
|
181 |
-
{
|
182 |
-
return false;
|
183 |
-
}
|
184 |
-
/**
|
185 |
-
* Function checks the current site to see if the mainsite options should be disabled
|
186 |
-
*
|
187 |
-
* @return bool Whether or not the mainsite options should be disabled
|
188 |
-
*/
|
189 |
-
function maybe_disable_mainsite_options()
|
190 |
-
{
|
191 |
-
return false;
|
192 |
-
}
|
193 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/class.bctx_rest_controller.php
DELETED
@@ -1,232 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
|
20 |
-
//Do a PHP version check, require 5.3 or newer
|
21 |
-
if(version_compare(phpversion(), '5.3.0', '<'))
|
22 |
-
{
|
23 |
-
//Only purpose of this function is to echo out the PHP version error
|
24 |
-
function bctx_phpold()
|
25 |
-
{
|
26 |
-
printf('<div class="notice notice-error"><p>' . __('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, TX Breadcrumb requires %2$s', 'tx-breadcrumb') . '</p></div>', phpversion(), '5.3.0');
|
27 |
-
}
|
28 |
-
//If we are in the admin, let's print a warning then return
|
29 |
-
if(is_admin())
|
30 |
-
{
|
31 |
-
add_action('admin_notices', 'bctx_phpold');
|
32 |
-
}
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
class bctx_rest_controller
|
36 |
-
{
|
37 |
-
const version = '1';
|
38 |
-
protected $unique_prefix = 'bctx';
|
39 |
-
protected $breadcrumb_trail = null;
|
40 |
-
protected $methods = array('GET', 'OPTIONS');
|
41 |
-
/**
|
42 |
-
* Default constructor
|
43 |
-
*
|
44 |
-
* @param bctx_breadcrumb_trail $breadcrumb_trail An instance of a bctx_breadcrumb_trail object to use for everything
|
45 |
-
* @param string $unique_prefix The unique prefix to use for the API endpoint
|
46 |
-
*/
|
47 |
-
public function __construct(bctx_breadcrumb_trail $breadcrumb_trail, $unique_prefix)
|
48 |
-
{
|
49 |
-
$this->breadcrumb_trail = $breadcrumb_trail;
|
50 |
-
$this->unique_prefix = $unique_prefix;
|
51 |
-
add_action('rest_api_init', array($this, 'register_routes'));
|
52 |
-
}
|
53 |
-
public function register_routes()
|
54 |
-
{
|
55 |
-
register_rest_route( $this->unique_prefix . '/v' . $this::version, '/post/(?P<id>[\d]+)', array(
|
56 |
-
'args' => array(
|
57 |
-
'id' => array(
|
58 |
-
'description' => __('The ID of the post (any type) to retrieve the breadcrumb trail for.', 'tx-breadcrumb'),
|
59 |
-
'type' => 'integer',
|
60 |
-
'required' => true,
|
61 |
-
'validate_callback' => array($this, 'validate_id')
|
62 |
-
)
|
63 |
-
),
|
64 |
-
'methods' => $this->methods,
|
65 |
-
'callback' => array($this, 'display_rest_post'),
|
66 |
-
'permission_callback' => array($this, 'display_rest_post_permissions_check')
|
67 |
-
)
|
68 |
-
);
|
69 |
-
register_rest_route( $this->unique_prefix . '/v' . $this::version, '/term/(?P<taxonomy>[\w-]+)/(?P<id>[\d]+)', array(
|
70 |
-
'args' => array(
|
71 |
-
'id' => array(
|
72 |
-
'description' => __('The ID of the term to retrieve the breadcrumb trail for.', 'tx-breadcrumb'),
|
73 |
-
'type' => 'integer',
|
74 |
-
'required' => true,
|
75 |
-
'validate_callback' => array($this, 'validate_id')
|
76 |
-
),
|
77 |
-
'taxonomy' => array(
|
78 |
-
'description' => __('The taxonomy of the term to retrieve the breadcrumb trail for.', 'tx-breadcrumb'),
|
79 |
-
'type' => 'string',
|
80 |
-
'required' => true,
|
81 |
-
'validate_callback' => array($this, 'validate_taxonomy')
|
82 |
-
)
|
83 |
-
),
|
84 |
-
'methods' => $this->methods,
|
85 |
-
'callback' => array($this, 'display_rest_term')
|
86 |
-
)
|
87 |
-
);
|
88 |
-
register_rest_route( $this->unique_prefix . '/v' . $this::version, '/author/(?P<id>\d+)', array(
|
89 |
-
'args' => array(
|
90 |
-
'id' => array(
|
91 |
-
'description' => __('The ID of the author to retrieve the breadcrumb trail for.', 'tx-breadcrumb'),
|
92 |
-
'type' => 'integer',
|
93 |
-
'required' => true,
|
94 |
-
'validate_callback' => array($this, 'validate_id')
|
95 |
-
)
|
96 |
-
),
|
97 |
-
'methods' => $this->methods,
|
98 |
-
'callback' => array($this, 'display_rest_author')
|
99 |
-
)
|
100 |
-
);
|
101 |
-
}
|
102 |
-
/**
|
103 |
-
* Checks to see if the request ID looks like it could be an ID (numeric and greater than 0)
|
104 |
-
*
|
105 |
-
* @param mixed $param The parameter to validate
|
106 |
-
* @param WP_REST_Request $request REST API request data
|
107 |
-
* @param string $key The paramter key
|
108 |
-
* @return bool Whether or not the ID is valid (or atleast looks valid)
|
109 |
-
*/
|
110 |
-
public function validate_id($param, $request, $key)
|
111 |
-
{
|
112 |
-
return is_numeric($param) && absint($param) > 0;
|
113 |
-
}
|
114 |
-
/**
|
115 |
-
* Checks to see if the request taxonomy is a valid taxonomy
|
116 |
-
*
|
117 |
-
* @param mixed $param The parameter to validate
|
118 |
-
* @param WP_REST_Request $request REST API request data
|
119 |
-
* @param string $key The paramter key
|
120 |
-
* @return bool Whether or not the ID is valid (or atleast looks valid)
|
121 |
-
*/
|
122 |
-
public function validate_taxonomy($param, $request, $key)
|
123 |
-
{
|
124 |
-
return taxonomy_exists(esc_attr($param));
|
125 |
-
}
|
126 |
-
/**
|
127 |
-
* Check permissions for the post
|
128 |
-
*
|
129 |
-
* @param WP_REST_Request $request The request to check the permissions on
|
130 |
-
* @return bool | WP_Error Whether or not the user can view the requested post
|
131 |
-
*/
|
132 |
-
public function display_rest_post_permissions_check(WP_REST_Request $request)
|
133 |
-
{
|
134 |
-
$post = get_post(absint($request->get_param('id')));
|
135 |
-
if($post === null)
|
136 |
-
{
|
137 |
-
return true;
|
138 |
-
}
|
139 |
-
return $this->check_post_read_permission($post);
|
140 |
-
}
|
141 |
-
/**
|
142 |
-
* Check to ensure the current user can read the post (and subsequently view its breadcrumb trail)
|
143 |
-
*
|
144 |
-
* @param WP_Post $post The post to check if the current user can view the breadcrumb trail for
|
145 |
-
* @return bool Whether or not the post should be readable
|
146 |
-
*/
|
147 |
-
public function check_post_read_permission($post)
|
148 |
-
{
|
149 |
-
if(!($post instanceof WP_Post))
|
150 |
-
{
|
151 |
-
return false;
|
152 |
-
}
|
153 |
-
$post_type = get_post_type_object($post->post_type);
|
154 |
-
if(empty($post_type) || empty($post_type->show_in_rest))
|
155 |
-
{
|
156 |
-
return false;
|
157 |
-
}
|
158 |
-
if($post->post_status === 'publish' || current_user_can($post_type->cap->read_post, $post->ID))
|
159 |
-
{
|
160 |
-
return true;
|
161 |
-
}
|
162 |
-
$post_status_obj = get_post_status_object($post->post_status);
|
163 |
-
if($post_status_obj && $post_status_obj->public)
|
164 |
-
{
|
165 |
-
return true;
|
166 |
-
}
|
167 |
-
if($post->post_status === 'inherit' && $post->post_parent > 0)
|
168 |
-
{
|
169 |
-
$parent = get_post($post->post_parent);
|
170 |
-
if($parent)
|
171 |
-
{
|
172 |
-
return $this->check_post_read_permission($parent);
|
173 |
-
}
|
174 |
-
}
|
175 |
-
if($post->post_status === 'inherit')
|
176 |
-
{
|
177 |
-
return true;
|
178 |
-
}
|
179 |
-
return false;
|
180 |
-
}
|
181 |
-
/**
|
182 |
-
* Breadcrumb trail handler for REST requests for post breadcrumb trails
|
183 |
-
*
|
184 |
-
* @param WP_REST_Request $request REST API request data
|
185 |
-
* @return STD_Object Basic object data of the Schema.org Breadcrumb List compatible breadcrumb trail
|
186 |
-
*/
|
187 |
-
public function display_rest_post(WP_REST_Request $request)
|
188 |
-
{
|
189 |
-
$post = get_post(absint($request->get_param('id')));
|
190 |
-
if($post instanceof WP_Post)
|
191 |
-
{
|
192 |
-
$this->breadcrumb_trail->breadcrumbs = array();
|
193 |
-
//Generate the breadcrumb trail
|
194 |
-
$this->breadcrumb_trail->fill_REST($post);
|
195 |
-
return $this->breadcrumb_trail->display_json_ld(false);
|
196 |
-
}
|
197 |
-
}
|
198 |
-
/**
|
199 |
-
* Breadcrumb trail handler for REST requests for term breadcrumb trails
|
200 |
-
*
|
201 |
-
* @param WP_REST_Request $request REST API request data
|
202 |
-
* @return STD_Object Basic object data of the Schema.org Breadcrumb List compatible breadcrumb trail
|
203 |
-
*/
|
204 |
-
public function display_rest_term(WP_REST_Request $request)
|
205 |
-
{
|
206 |
-
$term = get_term(absint($request->get_param('id')), esc_attr($request->get_param('taxonomy')));
|
207 |
-
if($term instanceof WP_Term)
|
208 |
-
{
|
209 |
-
$this->breadcrumb_trail->breadcrumbs = array();
|
210 |
-
//Generate the breadcrumb trail
|
211 |
-
$this->breadcrumb_trail->fill_REST($term);
|
212 |
-
return $this->breadcrumb_trail->display_json_ld(false);
|
213 |
-
}
|
214 |
-
}
|
215 |
-
/**
|
216 |
-
* Breadcrumb trail handler for REST requests for term breadcrumb trails
|
217 |
-
*
|
218 |
-
* @param WP_REST_Request $request REST API request data
|
219 |
-
* @return STD_Object Basic object data of the Schema.org Breadcrumb List compatible breadcrumb trail
|
220 |
-
*/
|
221 |
-
public function display_rest_author(WP_REST_Request $request)
|
222 |
-
{
|
223 |
-
$user = get_user_by('ID', absint($request->get_param('id')), esc_attr($request->get_param('taxonomy')));
|
224 |
-
if($user instanceof WP_User)
|
225 |
-
{
|
226 |
-
$this->breadcrumb_trail->breadcrumbs = array();
|
227 |
-
//Generate the breadcrumb trail
|
228 |
-
$this->breadcrumb_trail->fill_REST($user);
|
229 |
-
return $this->breadcrumb_trail->display_json_ld(false);
|
230 |
-
}
|
231 |
-
}
|
232 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/class.bctx_widget.php
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/includes/block_direct_access.php');
|
20 |
-
class bctx_widget extends WP_Widget
|
21 |
-
{
|
22 |
-
const version = '6.1.0';
|
23 |
-
protected $allowed_html = array();
|
24 |
-
protected $defaults = array('title' => '', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false, 'force' => false);
|
25 |
-
//Default constructor
|
26 |
-
function __construct()
|
27 |
-
{
|
28 |
-
//Filter allowed_html array to allow others to add acceptable tags
|
29 |
-
$this->allowed_html = apply_filters('bctx_allowed_html', wp_kses_allowed_html('post'));
|
30 |
-
//@see https://core.trac.wordpress.org/ticket/10527
|
31 |
-
if(!is_textdomain_loaded('tx-breadcrumb'))
|
32 |
-
{
|
33 |
-
load_plugin_textdomain('tx-breadcrumb', false, 'tx-breadcrumb/languages');
|
34 |
-
}
|
35 |
-
$ops = array('classname' => 'widget_tx_breadcrumb', 'description' => __('Adds a breadcrumb trail to your sidebar', 'tx-breadcrumb'));
|
36 |
-
parent::__construct('bctx_widget', 'TX Breadcrumb', $ops);
|
37 |
-
}
|
38 |
-
function widget($args, $instance)
|
39 |
-
{
|
40 |
-
//Make sure we grab defaults in the case of out of date instance settings being sent
|
41 |
-
$instance = wp_parse_args((array) $instance, $this->defaults);
|
42 |
-
$instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
43 |
-
$instance['pretext'] = apply_filters('widget_text', $instance['pretext'], $instance);
|
44 |
-
$instance['pretext'] = apply_filters('bctx_widget_pretext', $instance['pretext'], $instance);
|
45 |
-
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
46 |
-
//A bit of a hack but we need the DB settings to know if we should exit early
|
47 |
-
$opt = get_option('bctx_options');
|
48 |
-
//If we are on the front page and don't display on the front, return early
|
49 |
-
if($instance['front'] && is_front_page() && !(is_paged() && $opt['bpaged_display']))
|
50 |
-
{
|
51 |
-
return;
|
52 |
-
}
|
53 |
-
//Manditory before widget junk
|
54 |
-
echo $args['before_widget'];
|
55 |
-
if(!empty($title))
|
56 |
-
{
|
57 |
-
echo $args['before_title'] . $title . $args['after_title'];
|
58 |
-
}
|
59 |
-
//We'll want to switch between the two breadcrumb output types
|
60 |
-
if($instance['type'] === 'list')
|
61 |
-
{
|
62 |
-
//Display the list output breadcrumb
|
63 |
-
echo wp_kses($instance['pretext'], $this->allowed_html) . '<ol class="breadcrumb_trail breadcrumbs">';
|
64 |
-
bctx_display_list(false, $instance['linked'], $instance['reverse'], $instance['force']);
|
65 |
-
echo '</ol>';
|
66 |
-
}
|
67 |
-
else if($instance['type'] === 'microdata' || $instance['type'] === 'breadcrumblist_rdfa')
|
68 |
-
{
|
69 |
-
echo '<div class="breadcrumbs" vocab="https://schema.org/" typeof="BreadcrumbList">' . wp_kses($instance['pretext'], $this->allowed_html);
|
70 |
-
//Display the regular output breadcrumb
|
71 |
-
bctx_display(false, $instance['linked'], $instance['reverse'], $instance['force']);
|
72 |
-
echo '</div>';
|
73 |
-
}
|
74 |
-
else if($instance['type'] === 'breadcrumblist_microdata')
|
75 |
-
{
|
76 |
-
echo '<div class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">' . wp_kses($instance['pretext'], $this->allowed_html);
|
77 |
-
//Display the regular output breadcrumb
|
78 |
-
bctx_display(false, $instance['linked'], $instance['reverse'], $instance['force']);
|
79 |
-
echo '</div>';
|
80 |
-
}
|
81 |
-
else if($instance['type'] === 'plain')
|
82 |
-
{
|
83 |
-
//Display the pretext
|
84 |
-
echo wp_kses($instance['pretext'], $this->allowed_html);
|
85 |
-
//Display the regular output breadcrumb
|
86 |
-
bctx_display(false, $instance['linked'], $instance['reverse'], $instance['force']);
|
87 |
-
}
|
88 |
-
else
|
89 |
-
{
|
90 |
-
//If we recieved a type that is not of the built in displays, it must be relegated to an extension plugin
|
91 |
-
do_action('bctx_widget_display_trail', $instance);
|
92 |
-
}
|
93 |
-
//Manditory after widget junk
|
94 |
-
echo $args['after_widget'];
|
95 |
-
}
|
96 |
-
function update($new_instance, $old_instance)
|
97 |
-
{
|
98 |
-
//Filter out anything that could be invalid
|
99 |
-
$old_instance['title'] = strip_tags($new_instance['title']);
|
100 |
-
$old_instance['pretext'] = wp_kses($new_instance['pretext'], $this->allowed_html);
|
101 |
-
$old_instance['type'] = strip_tags($new_instance['type']);
|
102 |
-
$old_instance['linked'] = isset($new_instance['linked']);
|
103 |
-
$old_instance['reverse'] = isset($new_instance['reverse']);
|
104 |
-
$old_instance['front'] = isset($new_instance['front']);
|
105 |
-
$old_instance['force'] = isset($new_instance['force']);
|
106 |
-
return $old_instance;
|
107 |
-
}
|
108 |
-
function form($instance)
|
109 |
-
{
|
110 |
-
$instance = wp_parse_args((array) $instance, $this->defaults);?>
|
111 |
-
<p>
|
112 |
-
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"> <?php _e('Title:', 'tx-breadcrumb'); ?></label>
|
113 |
-
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>" id="<?php echo esc_attr($this->get_field_id('title')); ?>" value="<?php echo esc_attr($instance['title']);?>" />
|
114 |
-
</p>
|
115 |
-
<p>
|
116 |
-
<label for="<?php echo esc_attr($this->get_field_id('pretext')); ?>"> <?php _e('Text to show before the trail:', 'tx-breadcrumb'); ?></label>
|
117 |
-
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name('pretext')); ?>" id="<?php echo esc_attr($this->get_field_id('pretext')); ?>" value="<?php echo esc_attr($instance['pretext']);?>" />
|
118 |
-
</p>
|
119 |
-
<p>
|
120 |
-
<label for="<?php echo esc_attr($this->get_field_id('type')); ?>"> <?php _e('Output trail as:', 'tx-breadcrumb'); ?></label>
|
121 |
-
<select name="<?php echo esc_attr($this->get_field_name('type')); ?>" id="<?php echo esc_attr($this->get_field_id('type')); ?>">
|
122 |
-
<option value="list" <?php selected('list', $instance['type']);?>><?php _e('List', 'tx-breadcrumb'); ?></option>
|
123 |
-
<option value="microdata" <?php selected('microdata', $instance['type']);?>><?php _e('Schema.org BreadcrumbList (RDFa)', 'tx-breadcrumb'); ?></option>
|
124 |
-
<option value="breadcrumblist_microdata" <?php selected('breadcrumblist_microdata', $instance['type']);?>><?php _e('Schema.org BreadcrumbList (microdata)', 'tx-breadcrumb'); ?></option>
|
125 |
-
<option value="plain" <?php selected('plain', $instance['type']);?>><?php _e('Plain', 'tx-breadcrumb'); ?></option>
|
126 |
-
<?php do_action('bctx_widget_display_types', $instance);?>
|
127 |
-
</select>
|
128 |
-
</p>
|
129 |
-
<p>
|
130 |
-
<input class="checkbox" type="checkbox" name="<?php echo esc_attr($this->get_field_name('linked')); ?>" id="<?php echo esc_attr($this->get_field_id('linked')); ?>" value="true" <?php checked(true, $instance['linked']);?> />
|
131 |
-
<label for="<?php echo esc_attr($this->get_field_id('linked')); ?>"> <?php _e('Link the breadcrumbs', 'tx-breadcrumb'); ?></label><br />
|
132 |
-
<input class="checkbox" type="checkbox" name="<?php echo esc_attr($this->get_field_name('reverse')); ?>" id="<?php echo esc_attr($this->get_field_id('reverse')); ?>" value="true" <?php checked(true, $instance['reverse']);?> />
|
133 |
-
<label for="<?php echo esc_attr($this->get_field_id('reverse')); ?>"> <?php _e('Reverse the order of the trail', 'tx-breadcrumb'); ?></label><br />
|
134 |
-
<input class="checkbox" type="checkbox" name="<?php echo esc_attr($this->get_field_name('front')); ?>" id="<?php echo esc_attr($this->get_field_id('front')); ?>" value="true" <?php checked(true, $instance['front']);?> />
|
135 |
-
<label for="<?php echo esc_attr($this->get_field_id('front')); ?>"> <?php _e('Hide the trail on the front page', 'tx-breadcrumb'); ?></label><br />
|
136 |
-
<input class="checkbox" type="checkbox" name="<?php echo esc_attr($this->get_field_name('force')); ?>" id="<?php echo esc_attr($this->get_field_id('force')); ?>" value="true" <?php checked(true, $instance['force']);?> />
|
137 |
-
<label for="<?php echo esc_attr($this->get_field_id('force')); ?>"> <?php _e('Ignore breadcrumb cache', 'tx-breadcrumb'); ?></label><br />
|
138 |
-
</p>
|
139 |
-
<?php
|
140 |
-
}
|
141 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/block_direct_access.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
//If this file is included directly (e.g. WordPress isn't running), return 404
|
20 |
-
if(!defined('ABSPATH'))
|
21 |
-
{
|
22 |
-
//First catches the Apache users
|
23 |
-
header("HTTP/1.0 404 Not Found");
|
24 |
-
//This should catch FastCGI users
|
25 |
-
header("Status: 404 Not Found");
|
26 |
-
die();
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/class.mtekk_adminkit.php
DELETED
@@ -1,1195 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/block_direct_access.php');
|
20 |
-
//Include admin base class
|
21 |
-
if(!class_exists('mtekk_adminKit_message'))
|
22 |
-
{
|
23 |
-
require_once(dirname(__FILE__) . '/class.mtekk_adminkit_message.php');
|
24 |
-
}
|
25 |
-
abstract class mtekk_adminKit
|
26 |
-
{
|
27 |
-
const version = '2.0.1';
|
28 |
-
protected $full_name;
|
29 |
-
protected $short_name;
|
30 |
-
protected $plugin_basename;
|
31 |
-
protected $access_level = 'manage_options';
|
32 |
-
protected $identifier;
|
33 |
-
protected $unique_prefix;
|
34 |
-
protected $opt = array();
|
35 |
-
protected $messages;
|
36 |
-
protected $message;
|
37 |
-
protected $support_url;
|
38 |
-
protected $allowed_html;
|
39 |
-
function __construct()
|
40 |
-
{
|
41 |
-
$this->message = array();
|
42 |
-
$this->messages = array();
|
43 |
-
//Admin Init Hook
|
44 |
-
add_action('admin_init', array($this, 'init'));
|
45 |
-
//WordPress Admin interface hook
|
46 |
-
add_action('admin_menu', array($this, 'add_page'));
|
47 |
-
//Installation Script hook
|
48 |
-
add_action('activate_' . $this->plugin_basename, array($this, 'install'));
|
49 |
-
//Initilizes l10n domain
|
50 |
-
$this->local();
|
51 |
-
add_action('wp_loaded', array($this, 'wp_loaded'));
|
52 |
-
//Register Help Output
|
53 |
-
//add_action('add_screen_help_and_options', array($this, 'help'));
|
54 |
-
}
|
55 |
-
function wp_loaded()
|
56 |
-
{
|
57 |
-
//Filter our allowed html tags
|
58 |
-
$this->allowed_html = apply_filters($this->unique_prefix . '_allowed_html', wp_kses_allowed_html('post'));
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Returns the internal mtekk_admin_class version
|
62 |
-
*/
|
63 |
-
function get_admin_class_version()
|
64 |
-
{
|
65 |
-
return mtekk_adminKit::version;
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Return the URL of the settings page for the plugin
|
69 |
-
*/
|
70 |
-
function admin_url()
|
71 |
-
{
|
72 |
-
return admin_url('options-general.php?page=' . $this->identifier);
|
73 |
-
}
|
74 |
-
/**
|
75 |
-
* A wrapper for nonced_anchor returns a nonced anchor for admin pages
|
76 |
-
*
|
77 |
-
* @param string $mode The nonce "mode", a unique string at the end of the standardized nonce identifier
|
78 |
-
* @param string $title (optional) The text to use in the title portion of the anchor
|
79 |
-
* @param string $text (optional) The text that will be surrounded by the anchor tags
|
80 |
-
* @return string the assembled anchor
|
81 |
-
*/
|
82 |
-
function admin_anchor($mode, $title = '', $text = '')
|
83 |
-
{
|
84 |
-
return $this->nonced_anchor($this->admin_url(), 'admin_' . $mode, 'true', $title, $text);
|
85 |
-
}
|
86 |
-
/**
|
87 |
-
* Returns a properly formed nonced anchor to the specified URI
|
88 |
-
*
|
89 |
-
* @param string $uri The URI that the anchor should be for
|
90 |
-
* @param string $mode The nonce "mode", a unique string at the end of the standardized nonce identifier
|
91 |
-
* @param mixed $value (optional) The value to place in the query string
|
92 |
-
* @param string $title (optional) The text to use in the title portion of the anchor
|
93 |
-
* @param string $text (optional) The text that will be surrounded by the anchor tags
|
94 |
-
* @param string $anchor_extras (optional) This text is placed within the opening anchor tag, good for adding id, classe, rel field
|
95 |
-
* @return string the assembled anchor
|
96 |
-
*/
|
97 |
-
function nonced_anchor($uri, $mode, $value = 'true', $title = '', $text = '', $anchor_extras = '')
|
98 |
-
{
|
99 |
-
//Assemble our url, nonce and all
|
100 |
-
$url = wp_nonce_url(add_query_arg($this->unique_prefix . '_' . $mode, $value, $uri), $this->unique_prefix . '_' . $mode);
|
101 |
-
//Return a valid anchor
|
102 |
-
return ' <a title="' . esc_attr($title) . '" href="' . $url . '" '. $anchor_extras . '>' . esc_html($text) . '</a>';
|
103 |
-
}
|
104 |
-
/**
|
105 |
-
* Abstracts the check_admin_referer so that all the end user has to supply is the mode
|
106 |
-
*
|
107 |
-
* @param string $mode The specific nonce "mode" (see nonced_anchor) that is being checked
|
108 |
-
*/
|
109 |
-
function check_nonce($mode)
|
110 |
-
{
|
111 |
-
check_admin_referer($this->unique_prefix . '_' . $mode);
|
112 |
-
}
|
113 |
-
/**
|
114 |
-
* Makes sure the current user can manage options to proceed
|
115 |
-
*/
|
116 |
-
function security()
|
117 |
-
{
|
118 |
-
//If the user can not manage options we will die on them
|
119 |
-
if(!current_user_can($this->access_level))
|
120 |
-
{
|
121 |
-
wp_die(__('Insufficient privileges to proceed.', $this->identifier));
|
122 |
-
}
|
123 |
-
}
|
124 |
-
function init()
|
125 |
-
{
|
126 |
-
//Admin Options reset hook
|
127 |
-
if(isset($_POST[$this->unique_prefix . '_admin_reset']))
|
128 |
-
{
|
129 |
-
//Run the reset function on init if reset form has been submitted
|
130 |
-
$this->opts_reset();
|
131 |
-
}
|
132 |
-
//Admin Options export hook
|
133 |
-
else if(isset($_POST[$this->unique_prefix . '_admin_export']))
|
134 |
-
{
|
135 |
-
//Run the export function on init if export form has been submitted
|
136 |
-
$this->opts_export();
|
137 |
-
}
|
138 |
-
//Admin Options import hook
|
139 |
-
else if(isset($_FILES[$this->unique_prefix . '_admin_import_file']) && !empty($_FILES[$this->unique_prefix . '_admin_import_file']['name']))
|
140 |
-
{
|
141 |
-
//Run the import function on init if import form has been submitted
|
142 |
-
$this->opts_import();
|
143 |
-
}
|
144 |
-
//Admin Options rollback hook
|
145 |
-
else if(isset($_GET[$this->unique_prefix . '_admin_undo']))
|
146 |
-
{
|
147 |
-
//Run the rollback function on init if undo button has been pressed
|
148 |
-
$this->opts_undo();
|
149 |
-
}
|
150 |
-
//Admin Options upgrade hook
|
151 |
-
else if(isset($_GET[$this->unique_prefix . '_admin_upgrade']))
|
152 |
-
{
|
153 |
-
//Run the upgrade function on init if upgrade button has been pressed
|
154 |
-
$this->opts_upgrade_wrapper();
|
155 |
-
}
|
156 |
-
//Admin Options fix hook
|
157 |
-
else if(isset($_GET[$this->unique_prefix . '_admin_fix']))
|
158 |
-
{
|
159 |
-
//Run the options fix function on init if fix button has been pressed
|
160 |
-
$this->opts_upgrade_wrapper();
|
161 |
-
}
|
162 |
-
//Admin Options update hook
|
163 |
-
else if(isset($_POST[$this->unique_prefix . '_admin_options']))
|
164 |
-
{
|
165 |
-
//Temporarily add update function on init if form has been submitted
|
166 |
-
$this->opts_update();
|
167 |
-
}
|
168 |
-
//Add in the nice "settings" link to the plugins page
|
169 |
-
add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
|
170 |
-
if(defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
171 |
-
{
|
172 |
-
$suffix = '';
|
173 |
-
}
|
174 |
-
else
|
175 |
-
{
|
176 |
-
$suffix = '.min';
|
177 |
-
}
|
178 |
-
//Register JS for more permanently dismissing messages
|
179 |
-
wp_register_script('mtekk_adminkit_messages', plugins_url('/mtekk_adminkit_messages' . $suffix . '.js', dirname(__FILE__) . '/mtekk_adminkit_messages' . $suffix . '.js'), array('jquery'), self::version, true);
|
180 |
-
//Register JS for enable/disable settings groups
|
181 |
-
wp_register_script('mtekk_adminkit_engroups', plugins_url('/mtekk_adminkit_engroups' . $suffix . '.js', dirname(__FILE__) . '/mtekk_adminkit_engroups' . $suffix . '.js'), array('jquery'), self::version, true);
|
182 |
-
//Register JS for tabs
|
183 |
-
wp_register_script('mtekk_adminkit_tabs', plugins_url('/mtekk_adminkit_tabs' . $suffix . '.js', dirname(__FILE__) . '/mtekk_adminkit_tabs' . $suffix . '.js'), array('jquery-ui-tabs'), self::version, true);
|
184 |
-
//Register CSS for tabs
|
185 |
-
wp_register_style('mtekk_adminkit_tabs', plugins_url('/mtekk_adminkit_tabs' . $suffix . '.css', dirname(__FILE__) . '/mtekk_adminkit_tabs' . $suffix . '.css'));
|
186 |
-
//Register options
|
187 |
-
register_setting($this->unique_prefix . '_options', $this->unique_prefix . '_options', '');
|
188 |
-
//Synchronize up our settings with the database as we're done modifying them now
|
189 |
-
$this->opt = $this::parse_args($this->get_option($this->unique_prefix . '_options'), $this->opt);
|
190 |
-
//Run the opts fix filter
|
191 |
-
$this->opts_fix($this->opt);
|
192 |
-
add_action('wp_ajax_mtekk_admin_message_dismiss', array($this, 'dismiss_message'));
|
193 |
-
}
|
194 |
-
/**
|
195 |
-
* Adds the adminpage the menu and the nice little settings link
|
196 |
-
* TODO: make this more generic for easier extension
|
197 |
-
*/
|
198 |
-
function add_page()
|
199 |
-
{
|
200 |
-
//Add the submenu page to "settings" menu
|
201 |
-
$hookname = add_submenu_page('options-general.php', $this->full_name, $this->short_name, $this->access_level, $this->identifier, array($this, 'admin_page'));
|
202 |
-
// check capability of user to manage options (access control)
|
203 |
-
if(current_user_can($this->access_level))
|
204 |
-
{
|
205 |
-
//Register admin_head-$hookname callback
|
206 |
-
add_action('admin_head-' . $hookname, array($this, 'admin_head'));
|
207 |
-
//Register admin_print_styles-$hookname callback
|
208 |
-
add_action('admin_print_styles-' . $hookname, array($this, 'admin_styles'));
|
209 |
-
//Register admin_print_scripts-$hookname callback
|
210 |
-
add_action('admin_print_scripts-' . $hookname, array($this, 'admin_scripts'));
|
211 |
-
//Register Help Output
|
212 |
-
add_action('load-' . $hookname, array($this, 'help'));
|
213 |
-
}
|
214 |
-
}
|
215 |
-
/**
|
216 |
-
* Initilizes localization textdomain for translations (if applicable)
|
217 |
-
*
|
218 |
-
* Will conditionally load the textdomain for translations. This is here for
|
219 |
-
* plugins that span multiple files and have localization in more than one file
|
220 |
-
*
|
221 |
-
* @return void
|
222 |
-
*/
|
223 |
-
function local()
|
224 |
-
{
|
225 |
-
global $l10n;
|
226 |
-
// the global and the check might become obsolete in
|
227 |
-
// further wordpress versions
|
228 |
-
// @see https://core.trac.wordpress.org/ticket/10527
|
229 |
-
if(!isset($l10n[$this->identifier]))
|
230 |
-
{
|
231 |
-
load_plugin_textdomain($this->identifier, false, $this->identifier . '/languages');
|
232 |
-
}
|
233 |
-
}
|
234 |
-
/**
|
235 |
-
* Places in a link to the settings page in the plugins listing entry
|
236 |
-
*
|
237 |
-
* @param array $links An array of links that are output in the listing
|
238 |
-
* @param string $file The file that is currently in processing
|
239 |
-
* @return array Array of links that are output in the listing.
|
240 |
-
*/
|
241 |
-
function filter_plugin_actions($links, $file)
|
242 |
-
{
|
243 |
-
//Make sure we are adding only for the current plugin
|
244 |
-
if($file == $this->plugin_basename)
|
245 |
-
{
|
246 |
-
//Add our link to the end of the array to better integrate into the WP 2.8 plugins page
|
247 |
-
$links[] = '<a href="' . $this->admin_url() . '">' . esc_html__('Settings') . '</a>';
|
248 |
-
}
|
249 |
-
return $links;
|
250 |
-
}
|
251 |
-
/**
|
252 |
-
* Checks to see if the plugin has been fully installed
|
253 |
-
*
|
254 |
-
* @return bool whether or not the plugin has been installed
|
255 |
-
*/
|
256 |
-
function is_installed()
|
257 |
-
{
|
258 |
-
|
259 |
-
}
|
260 |
-
/**
|
261 |
-
* This sets up and upgrades the database settings, runs on every activation
|
262 |
-
*/
|
263 |
-
function install()
|
264 |
-
{
|
265 |
-
//Call our little security function
|
266 |
-
$this->security();
|
267 |
-
//Try retrieving the options from the database
|
268 |
-
$opts = $this->get_option($this->unique_prefix . '_options');
|
269 |
-
//If there are no settings, copy over the default settings
|
270 |
-
if(!is_array($opts))
|
271 |
-
{
|
272 |
-
//Grab defaults from the object
|
273 |
-
$opts = $this->opt;
|
274 |
-
//Add the options
|
275 |
-
$this->add_option($this->unique_prefix . '_options', $opts);
|
276 |
-
$this->add_option($this->unique_prefix . '_options_bk', $opts, '', 'no');
|
277 |
-
//Add the version, no need to autoload the db version
|
278 |
-
$this->add_option($this->unique_prefix . '_version', $this::version, '', 'no');
|
279 |
-
}
|
280 |
-
else
|
281 |
-
{
|
282 |
-
//Retrieve the database version
|
283 |
-
$db_version = $this->get_option($this->unique_prefix . '_version');
|
284 |
-
if($this::version !== $db_version)
|
285 |
-
{
|
286 |
-
//Run the settings update script
|
287 |
-
$this->opts_upgrade($opts, $db_version);
|
288 |
-
//Always have to update the version
|
289 |
-
$this->update_option($this->unique_prefix . '_version', $this::version);
|
290 |
-
//Store the options
|
291 |
-
$this->update_option($this->unique_prefix . '_options', $this->opt);
|
292 |
-
}
|
293 |
-
}
|
294 |
-
}
|
295 |
-
/**
|
296 |
-
* This removes database settings upon deletion of the plugin from WordPress
|
297 |
-
*/
|
298 |
-
function uninstall()
|
299 |
-
{
|
300 |
-
//Remove the option array setting
|
301 |
-
$this->delete_option($this->unique_prefix . '_options');
|
302 |
-
//Remove the option backup array setting
|
303 |
-
$this->delete_option($this->unique_prefix . '_options_bk');
|
304 |
-
//Remove the version setting
|
305 |
-
$this->delete_option($this->unique_prefix . '_version');
|
306 |
-
}
|
307 |
-
/**
|
308 |
-
* Compares the supplided version with the internal version, places an upgrade warning if there is a missmatch
|
309 |
-
* TODO: change this to being auto called in admin_init action
|
310 |
-
*/
|
311 |
-
function version_check($version)
|
312 |
-
{
|
313 |
-
//If we didn't get a version, setup
|
314 |
-
if($version === false)
|
315 |
-
{
|
316 |
-
//Add the version, no need to autoload the db version
|
317 |
-
$this->add_option($this->unique_prefix . '_version', $this::version, '', 'no');
|
318 |
-
}
|
319 |
-
//Do a quick version check
|
320 |
-
if($version && version_compare($version, $this::version, '<') && is_array($this->opt))
|
321 |
-
{
|
322 |
-
//Throw an error since the DB version is out of date
|
323 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Your settings are for an older version of this plugin and need to be migrated.', $this->identifier)
|
324 |
-
. $this->admin_anchor('upgrade', __('Migrate the settings now.', $this->identifier), __('Migrate now.', $this->identifier)), 'warning');
|
325 |
-
//Output any messages that there may be
|
326 |
-
$this->messages();
|
327 |
-
return false;
|
328 |
-
}
|
329 |
-
//Do a quick version check
|
330 |
-
else if($version && version_compare($version, $this::version, '>') && is_array($this->opt))
|
331 |
-
{
|
332 |
-
//Let the user know that their settings are for a newer version
|
333 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Your settings are for a newer version of this plugin.', $this->identifier)
|
334 |
-
. $this->admin_anchor('upgrade', __('Migrate the settings now.', $this->identifier), __('Attempt back migration now.', $this->identifier)), 'warning');
|
335 |
-
//Output any messages that there may be
|
336 |
-
$this->messages();
|
337 |
-
return true;
|
338 |
-
}
|
339 |
-
else if(!is_array($this->opt))
|
340 |
-
{
|
341 |
-
//Throw an error since it appears the options were never registered
|
342 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Your plugin install is incomplete.', $this->identifier)
|
343 |
-
. $this->admin_anchor('upgrade', __('Load default settings now.', $this->identifier), __('Complete now.', $this->identifier)), 'error');
|
344 |
-
//Output any messages that there may be
|
345 |
-
$this->messages();
|
346 |
-
return false;
|
347 |
-
}
|
348 |
-
else if(!$this->opts_validate($this->opt))
|
349 |
-
{
|
350 |
-
//Throw an error since it appears the options contain invalid data
|
351 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('One or more of your plugin settings are invalid.', $this->identifier)
|
352 |
-
. $this->admin_anchor('fix', __('Attempt to fix settings now.', $this->identifier), __('Fix now.', $this->identifier)), 'error');
|
353 |
-
//Output any messages that there may be
|
354 |
-
$this->messages();
|
355 |
-
return false;
|
356 |
-
}
|
357 |
-
return true;
|
358 |
-
}
|
359 |
-
/**
|
360 |
-
* A prototype function. End user should override if they need this feature.
|
361 |
-
*/
|
362 |
-
function opts_validate(&$opts)
|
363 |
-
{
|
364 |
-
return true;
|
365 |
-
}
|
366 |
-
/**
|
367 |
-
* A prototype function. End user should override if they need this feature.
|
368 |
-
*
|
369 |
-
* @param array $opts
|
370 |
-
*/
|
371 |
-
function opts_fix(&$opts)
|
372 |
-
{
|
373 |
-
}
|
374 |
-
/**
|
375 |
-
* Synchronizes the backup options entry with the current options entry
|
376 |
-
*/
|
377 |
-
function opts_backup()
|
378 |
-
{
|
379 |
-
//Set the backup options in the DB to the current options
|
380 |
-
$this->update_option($this->unique_prefix . '_options_bk', $this->get_option($this->unique_prefix . '_options'));
|
381 |
-
}
|
382 |
-
/**
|
383 |
-
* Runs recursivly through the opts array, sanitizing and merging in updates from the $input array
|
384 |
-
*
|
385 |
-
* @param array $opts good, clean array
|
386 |
-
* @param array $input unsanitzed input array, not trusted at all
|
387 |
-
* @todo This function should probably get a filter thrown within it to be more extensible
|
388 |
-
*/
|
389 |
-
protected function opts_update_loop(&$opts, $input)
|
390 |
-
{
|
391 |
-
//Loop through all of the existing options (avoids random setting injection)
|
392 |
-
foreach($opts as $option => $value)
|
393 |
-
{
|
394 |
-
//If we have an array, dive into another recursive loop
|
395 |
-
if(isset($input[$option]) && is_array($value))
|
396 |
-
{
|
397 |
-
$this->opts_update_loop($opts[$option], $input[$option]);
|
398 |
-
}
|
399 |
-
//We must check for unset settings, but booleans are ok to be unset
|
400 |
-
else if(isset($input[$option]) || $option[0] == 'b')
|
401 |
-
{
|
402 |
-
switch($option[0])
|
403 |
-
{
|
404 |
-
//Handle the boolean options
|
405 |
-
case 'b':
|
406 |
-
$opts[$option] = isset($input[$option]);
|
407 |
-
break;
|
408 |
-
//Handle the integer options
|
409 |
-
case 'i':
|
410 |
-
$opts[$option] = (int) $input[$option];
|
411 |
-
break;
|
412 |
-
//Handle the absolute integer options
|
413 |
-
case 'a':
|
414 |
-
$opts[$option] = (int) abs($input[$option]);
|
415 |
-
break;
|
416 |
-
//Handle the floating point options
|
417 |
-
case 'f':
|
418 |
-
$opts[$option] = (float) $input[$option];
|
419 |
-
break;
|
420 |
-
//Handle the HTML options
|
421 |
-
case 'h':
|
422 |
-
$opts[$option] = wp_kses(stripslashes($input[$option]), $this->allowed_html);
|
423 |
-
break;
|
424 |
-
//Handle the HTML options that must not be null
|
425 |
-
case 'H':
|
426 |
-
if(isset($input[$option]))
|
427 |
-
{
|
428 |
-
$opts[$option] = wp_kses(stripslashes($input[$option]), $this->allowed_html);
|
429 |
-
}
|
430 |
-
break;
|
431 |
-
//Handle the text options that must not be null
|
432 |
-
case 'S':
|
433 |
-
if(isset($input[$option]))
|
434 |
-
{
|
435 |
-
$opts[$option] = esc_html($input[$option]);
|
436 |
-
}
|
437 |
-
break;
|
438 |
-
//Deal with strings that can be null
|
439 |
-
case 's':
|
440 |
-
$opts[$option] = esc_html($input[$option]);
|
441 |
-
break;
|
442 |
-
//Deal with enumerated types
|
443 |
-
case 'E':
|
444 |
-
$opts[$option] = $this->opts_sanitize_enum($input[$option], $option);
|
445 |
-
break;
|
446 |
-
//By default we have nothing to do, allows for internal settings
|
447 |
-
default:
|
448 |
-
break;
|
449 |
-
}
|
450 |
-
}
|
451 |
-
}
|
452 |
-
}
|
453 |
-
/**
|
454 |
-
* Simple sanitization function for enumerated types, end users should overload this
|
455 |
-
* with something more usefull
|
456 |
-
*
|
457 |
-
* @param string $value The input value from the form
|
458 |
-
* @param string $option The option name
|
459 |
-
* @return string The sanitized enumerated string
|
460 |
-
*/
|
461 |
-
private function opts_sanitize_enum($value, $option)
|
462 |
-
{
|
463 |
-
return esc_html($value);
|
464 |
-
}
|
465 |
-
/**
|
466 |
-
* A better version of parse_args, will recrusivly follow arrays
|
467 |
-
*
|
468 |
-
* @param mixed $args The arguments to be parsed
|
469 |
-
* @param mixed $defaults (optional) The default values to validate against
|
470 |
-
* @return mixed
|
471 |
-
*/
|
472 |
-
static function parse_args($args, $defaults = '')
|
473 |
-
{
|
474 |
-
if(is_object($args))
|
475 |
-
{
|
476 |
-
$r = get_object_vars($args);
|
477 |
-
}
|
478 |
-
else if(is_array($args))
|
479 |
-
{
|
480 |
-
$r =& $args;
|
481 |
-
}
|
482 |
-
else
|
483 |
-
{
|
484 |
-
wp_parse_str($args, $r);
|
485 |
-
}
|
486 |
-
if(is_array($defaults))
|
487 |
-
{
|
488 |
-
return mtekk_adminKit::array_merge_recursive($defaults, $r);
|
489 |
-
}
|
490 |
-
return $r;
|
491 |
-
}
|
492 |
-
/**
|
493 |
-
* An alternate version of array_merge_recursive, less flexible
|
494 |
-
* still recursive, ~2x faster than the more flexible version
|
495 |
-
*
|
496 |
-
* @param array $arg1 first array
|
497 |
-
* @param array $arg2 second array to merge into $arg1
|
498 |
-
* @return array
|
499 |
-
*/
|
500 |
-
static function array_merge_recursive($arg1, $arg2)
|
501 |
-
{
|
502 |
-
foreach($arg2 as $key => $value)
|
503 |
-
{
|
504 |
-
if(array_key_exists($key, $arg1) && is_array($value))
|
505 |
-
{
|
506 |
-
$arg1[$key] = mtekk_adminKit::array_merge_recursive($arg1[$key], $value);
|
507 |
-
}
|
508 |
-
else
|
509 |
-
{
|
510 |
-
$arg1[$key] = $value;
|
511 |
-
}
|
512 |
-
}
|
513 |
-
return $arg1;
|
514 |
-
}
|
515 |
-
/**
|
516 |
-
* An action that fires just before the options backup, use to add in dynamically detected options
|
517 |
-
*
|
518 |
-
* @param array $opts the options array, passed in by reference
|
519 |
-
* @return null
|
520 |
-
*/
|
521 |
-
function opts_update_prebk(&$opts)
|
522 |
-
{
|
523 |
-
//Just a prototype function
|
524 |
-
}
|
525 |
-
/**
|
526 |
-
* Updates the database settings from the webform
|
527 |
-
*/
|
528 |
-
function opts_update()
|
529 |
-
{
|
530 |
-
//Do some security related thigns as we are not using the normal WP settings API
|
531 |
-
$this->security();
|
532 |
-
//Do a nonce check, prevent malicious link/form problems
|
533 |
-
check_admin_referer($this->unique_prefix . '_options-options');
|
534 |
-
//Update local options from database
|
535 |
-
$this->opt = $this::parse_args($this->get_option($this->unique_prefix . '_options'), $this->opt);
|
536 |
-
$this->opts_update_prebk($this->opt);
|
537 |
-
//Update our backup options
|
538 |
-
$this->update_option($this->unique_prefix . '_options_bk', $this->opt);
|
539 |
-
$opt_prev = $this->opt;
|
540 |
-
//Grab our incomming array (the data is dirty)
|
541 |
-
$input = $_POST[$this->unique_prefix . '_options'];
|
542 |
-
//Run the update loop
|
543 |
-
$this->opts_update_loop($this->opt, $input);
|
544 |
-
//Commit the option changes
|
545 |
-
$updated = $this->update_option($this->unique_prefix . '_options', $this->opt);
|
546 |
-
//Check if known settings match attempted save
|
547 |
-
if($updated && count(array_diff_key($input, $this->opt)) == 0)
|
548 |
-
{
|
549 |
-
//Let the user know everything went ok
|
550 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings successfully saved.', $this->identifier)
|
551 |
-
. $this->admin_anchor('undo', __('Undo the options save.', $this->identifier), __('Undo', $this->identifier)), 'success');
|
552 |
-
}
|
553 |
-
else if(!$updated && count(array_diff_key($opt_prev, $this->opt)) == 0)
|
554 |
-
{
|
555 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings did not change, nothing to save.', $this->identifier), 'info');
|
556 |
-
}
|
557 |
-
else if(!$updated)
|
558 |
-
{
|
559 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings were not saved.', $this->identifier), 'error');
|
560 |
-
}
|
561 |
-
else
|
562 |
-
{
|
563 |
-
//Let the user know the following were not saved
|
564 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Some settings were not saved.', $this->identifier)
|
565 |
-
. $this->admin_anchor('undo', __('Undo the options save.', $this->identifier), __('Undo', $this->identifier)), 'warning');
|
566 |
-
$temp = esc_html__('The following settings were not saved:', $this->identifier);
|
567 |
-
foreach(array_diff_key($input, $this->opt) as $setting => $value)
|
568 |
-
{
|
569 |
-
$temp .= '<br />' . $setting;
|
570 |
-
}
|
571 |
-
$this->messages[] = new mtekk_adminKit_message($temp . '<br />' . sprintf(esc_html__('Please include this message in your %sbug report%s.', $this->identifier), '<a title="' . sprintf(esc_attr__('Go to the %s support forum.', $this->identifier), $this->short_name) . '" href="' . $this->support_url . '">', '</a>'), 'info');
|
572 |
-
}
|
573 |
-
add_action('admin_notices', array($this, 'messages'));
|
574 |
-
}
|
575 |
-
/**
|
576 |
-
* Exports a XML options document
|
577 |
-
*/
|
578 |
-
function opts_export()
|
579 |
-
{
|
580 |
-
//Do a nonce check, prevent malicious link/form problems
|
581 |
-
check_admin_referer($this->unique_prefix . '_admin_import_export');
|
582 |
-
//Update our internal settings
|
583 |
-
$this->opt = $this->get_option($this->unique_prefix . '_options');
|
584 |
-
//Create a DOM document
|
585 |
-
$dom = new DOMDocument('1.0', 'UTF-8');
|
586 |
-
//Adds in newlines and tabs to the output
|
587 |
-
$dom->formatOutput = true;
|
588 |
-
//We're not using a DTD therefore we need to specify it as a standalone document
|
589 |
-
$dom->xmlStandalone = true;
|
590 |
-
//Add an element called options
|
591 |
-
$node = $dom->createElement('options');
|
592 |
-
$parnode = $dom->appendChild($node);
|
593 |
-
//Add a child element named plugin
|
594 |
-
$node = $dom->createElement('plugin');
|
595 |
-
$plugnode = $parnode->appendChild($node);
|
596 |
-
//Add some attributes that identify the plugin and version for the options export
|
597 |
-
$plugnode->setAttribute('name', $this->short_name);
|
598 |
-
$plugnode->setAttribute('version', $this::version);
|
599 |
-
//Change our headder to text/xml for direct save
|
600 |
-
header('Cache-Control: public');
|
601 |
-
//The next two will cause good browsers to download instead of displaying the file
|
602 |
-
header('Content-Description: File Transfer');
|
603 |
-
header('Content-disposition: attachemnt; filename=' . $this->unique_prefix . '_settings.xml');
|
604 |
-
header('Content-Type: text/xml');
|
605 |
-
//Loop through the options array
|
606 |
-
foreach($this->opt as $key=>$option)
|
607 |
-
{
|
608 |
-
//Add a option tag under the options tag, store the option value
|
609 |
-
$node = $dom->createElement('option', htmlentities($option, ENT_COMPAT, 'UTF-8'));
|
610 |
-
$newnode = $plugnode->appendChild($node);
|
611 |
-
//Change the tag's name to that of the stored option
|
612 |
-
$newnode->setAttribute('name', $key);
|
613 |
-
}
|
614 |
-
//Prepair the XML for output
|
615 |
-
$output = $dom->saveXML();
|
616 |
-
//Let the browser know how long the file is
|
617 |
-
header('Content-Length: ' . strlen($output)); // binary length
|
618 |
-
//Output the file
|
619 |
-
echo $output;
|
620 |
-
//Prevent WordPress from continuing on
|
621 |
-
die();
|
622 |
-
}
|
623 |
-
/**
|
624 |
-
* Imports a XML options document
|
625 |
-
*/
|
626 |
-
function opts_import()
|
627 |
-
{
|
628 |
-
//Our quick and dirty error supressor
|
629 |
-
function error($errno, $errstr, $eerfile, $errline)
|
630 |
-
{
|
631 |
-
return true;
|
632 |
-
}
|
633 |
-
//Do a nonce check, prevent malicious link/form problems
|
634 |
-
check_admin_referer($this->unique_prefix . '_admin_import_export');
|
635 |
-
//Set the backup options in the DB to the current options
|
636 |
-
$this->opts_backup();
|
637 |
-
//Create a DOM document
|
638 |
-
$dom = new DOMDocument('1.0', 'UTF-8');
|
639 |
-
//We want to catch errors ourselves
|
640 |
-
set_error_handler('error');
|
641 |
-
//Load the user uploaded file, handle failure gracefully
|
642 |
-
if($dom->load($_FILES[$this->unique_prefix . '_admin_import_file']['tmp_name']))
|
643 |
-
{
|
644 |
-
$opts_temp = array();
|
645 |
-
$version = '';
|
646 |
-
//Have to use an xpath query otherwise we run into problems
|
647 |
-
$xpath = new DOMXPath($dom);
|
648 |
-
$option_sets = $xpath->query('plugin');
|
649 |
-
//Loop through all of the xpath query results
|
650 |
-
foreach($option_sets as $options)
|
651 |
-
{
|
652 |
-
//We only want to import options for only this plugin
|
653 |
-
if($options->getAttribute('name') === $this->short_name)
|
654 |
-
{
|
655 |
-
//Grab the file version
|
656 |
-
$version = $options->getAttribute('version');
|
657 |
-
//Loop around all of the options
|
658 |
-
foreach($options->getelementsByTagName('option') as $child)
|
659 |
-
{
|
660 |
-
//Place the option into the option array, DOMDocument decodes html entities for us
|
661 |
-
$opts_temp[$child->getAttribute('name')] = $child->nodeValue;
|
662 |
-
}
|
663 |
-
}
|
664 |
-
}
|
665 |
-
//Make sure we safely import and upgrade settings if needed
|
666 |
-
$this->opts_upgrade($opts_temp, $version);
|
667 |
-
//Commit the loaded options to the database
|
668 |
-
$this->update_option($this->unique_prefix . '_options', $this->opt);
|
669 |
-
//Everything was successful, let the user know
|
670 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings successfully imported from the uploaded file.', $this->identifier)
|
671 |
-
. $this->admin_anchor('undo', __('Undo the options import.', $this->identifier), __('Undo', $this->identifier)), 'success');
|
672 |
-
}
|
673 |
-
else
|
674 |
-
{
|
675 |
-
//Throw an error since we could not load the file for various reasons
|
676 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Importing settings from file failed.', $this->identifier), 'error');
|
677 |
-
}
|
678 |
-
//Reset to the default error handler after we're done
|
679 |
-
restore_error_handler();
|
680 |
-
//Output any messages that there may be
|
681 |
-
add_action('admin_notices', array($this, 'messages'));
|
682 |
-
}
|
683 |
-
/**
|
684 |
-
* Resets the database settings array to the default set in opt
|
685 |
-
*/
|
686 |
-
function opts_reset()
|
687 |
-
{
|
688 |
-
//Do a nonce check, prevent malicious link/form problems
|
689 |
-
check_admin_referer($this->unique_prefix . '_admin_import_export');
|
690 |
-
//Set the backup options in the DB to the current options
|
691 |
-
$this->opts_backup();
|
692 |
-
//Load in the hard coded default option values
|
693 |
-
$this->update_option($this->unique_prefix . '_options', $this->opt);
|
694 |
-
//Reset successful, let the user know
|
695 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings successfully reset to the default values.', $this->identifier)
|
696 |
-
. $this->admin_anchor('undo', __('Undo the options reset.', $this->identifier), __('Undo', $this->identifier)), 'success');
|
697 |
-
add_action('admin_notices', array($this, 'messages'));
|
698 |
-
}
|
699 |
-
/**
|
700 |
-
* Undos the last settings save/reset/import
|
701 |
-
*/
|
702 |
-
function opts_undo()
|
703 |
-
{
|
704 |
-
//Do a nonce check, prevent malicious link/form problems
|
705 |
-
check_admin_referer($this->unique_prefix . '_admin_undo');
|
706 |
-
//Set the options array to the current options
|
707 |
-
$opt = $this->get_option($this->unique_prefix . '_options');
|
708 |
-
//Set the options in the DB to the backup options
|
709 |
-
$this->update_option($this->unique_prefix . '_options', $this->get_option($this->unique_prefix . '_options_bk'));
|
710 |
-
//Set the backup options to the undone options
|
711 |
-
$this->update_option($this->unique_prefix . '_options_bk', $opt);
|
712 |
-
//Send the success/undo message
|
713 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings successfully undid the last operation.', $this->identifier)
|
714 |
-
. $this->admin_anchor('undo', __('Undo the last undo operation.', $this->identifier), __('Undo', $this->identifier)), 'success');
|
715 |
-
add_action('admin_notices', array($this, 'messages'));
|
716 |
-
}
|
717 |
-
/**
|
718 |
-
* Upgrades input options array, sets to $this->opt, designed to be overwritten
|
719 |
-
*
|
720 |
-
* @param array $opts
|
721 |
-
* @param string $version the version of the passed in options
|
722 |
-
*/
|
723 |
-
function opts_upgrade($opts, $version)
|
724 |
-
{
|
725 |
-
//We don't support using newer versioned option files in older releases
|
726 |
-
if(version_compare($this::version, $version, '>='))
|
727 |
-
{
|
728 |
-
$this->opt = $opts;
|
729 |
-
}
|
730 |
-
}
|
731 |
-
/**
|
732 |
-
* Forces a database settings upgrade
|
733 |
-
*/
|
734 |
-
function opts_upgrade_wrapper()
|
735 |
-
{
|
736 |
-
//Do a nonce check, prevent malicious link/form problems
|
737 |
-
check_admin_referer($this->unique_prefix . '_admin_upgrade');
|
738 |
-
//Grab the database options
|
739 |
-
$opts = $this->get_option($this->unique_prefix . '_options');
|
740 |
-
if(is_array($opts))
|
741 |
-
{
|
742 |
-
//Feed the just read options into the upgrade function
|
743 |
-
$this->opts_upgrade($opts, $this->get_option($this->unique_prefix . '_version'));
|
744 |
-
//Always have to update the version
|
745 |
-
$this->update_option($this->unique_prefix . '_version', $this::version);
|
746 |
-
//Store the options
|
747 |
-
$this->update_option($this->unique_prefix . '_options', $this->opt);
|
748 |
-
//Send the success message
|
749 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Settings successfully migrated.', $this->identifier), 'success');
|
750 |
-
}
|
751 |
-
else
|
752 |
-
{
|
753 |
-
//Run the install script
|
754 |
-
$this->install();
|
755 |
-
//Send the success message
|
756 |
-
$this->messages[] = new mtekk_adminKit_message(esc_html__('Default settings successfully installed.', $this->identifier), 'success');
|
757 |
-
}
|
758 |
-
add_action('admin_notices', array($this, 'messages'));
|
759 |
-
}
|
760 |
-
/**
|
761 |
-
* help action hook function, meant to be overridden
|
762 |
-
*
|
763 |
-
* @return string
|
764 |
-
*
|
765 |
-
*/
|
766 |
-
function help()
|
767 |
-
{
|
768 |
-
$screen = get_current_screen();
|
769 |
-
//Add contextual help on current screen
|
770 |
-
if($screen->id == 'settings_page_' . $this->identifier)
|
771 |
-
{
|
772 |
-
|
773 |
-
}
|
774 |
-
}
|
775 |
-
function dismiss_message()
|
776 |
-
{
|
777 |
-
//Grab the submitted UID
|
778 |
-
$uid = esc_attr($_POST['uid']);
|
779 |
-
//Create a dummy message, with the discovered UID
|
780 |
-
$message = new mtekk_adminKit_message('', '', true, $uid);
|
781 |
-
//Dismiss the message
|
782 |
-
$message->dismiss();
|
783 |
-
wp_die();
|
784 |
-
}
|
785 |
-
/**
|
786 |
-
* Prints to screen all of the messages stored in the message member variable
|
787 |
-
*/
|
788 |
-
function messages()
|
789 |
-
{
|
790 |
-
foreach($this->messages as $message)
|
791 |
-
{
|
792 |
-
$message->render();
|
793 |
-
}
|
794 |
-
//Old deprecated messages
|
795 |
-
if(count($this->message))
|
796 |
-
{
|
797 |
-
_deprecated_function( __FUNCTION__, '2.0.0', __('adminKit::message is deprecated, use new adminkit_messages instead.', $this->identifier) );
|
798 |
-
//Loop through our message classes
|
799 |
-
foreach($this->message as $key => $class)
|
800 |
-
{
|
801 |
-
//Loop through the messages in the current class
|
802 |
-
foreach($class as $message)
|
803 |
-
{
|
804 |
-
printf('<div class="%s"><p>%s</p></div>', esc_attr($key), $message);
|
805 |
-
}
|
806 |
-
}
|
807 |
-
$this->message = array();
|
808 |
-
}
|
809 |
-
$this->messages = array();
|
810 |
-
}
|
811 |
-
/**
|
812 |
-
* Function prototype to prevent errors
|
813 |
-
*/
|
814 |
-
function admin_styles()
|
815 |
-
{
|
816 |
-
|
817 |
-
}
|
818 |
-
/**
|
819 |
-
* Function prototype to prevent errors
|
820 |
-
*/
|
821 |
-
function admin_scripts()
|
822 |
-
{
|
823 |
-
|
824 |
-
}
|
825 |
-
/**
|
826 |
-
* Function prototype to prevent errors
|
827 |
-
*/
|
828 |
-
function admin_head()
|
829 |
-
{
|
830 |
-
|
831 |
-
}
|
832 |
-
/**
|
833 |
-
* Function prototype to prevent errors
|
834 |
-
*/
|
835 |
-
function admin_page()
|
836 |
-
{
|
837 |
-
|
838 |
-
}
|
839 |
-
/**
|
840 |
-
* Function prototype to prevent errors
|
841 |
-
*/
|
842 |
-
protected function _get_help_text()
|
843 |
-
{
|
844 |
-
|
845 |
-
}
|
846 |
-
/**
|
847 |
-
* Returns a valid xHTML element ID
|
848 |
-
*
|
849 |
-
* @param object $option
|
850 |
-
*/
|
851 |
-
static public function get_valid_id($option)
|
852 |
-
{
|
853 |
-
if(is_numeric($option[0]))
|
854 |
-
{
|
855 |
-
return 'p' . $option;
|
856 |
-
}
|
857 |
-
else
|
858 |
-
{
|
859 |
-
return $option;
|
860 |
-
}
|
861 |
-
}
|
862 |
-
function import_form()
|
863 |
-
{
|
864 |
-
$form = '<div id="mtekk_admin_import_export_relocate">';
|
865 |
-
$form .= sprintf('<form action="options-general.php?page=%s" method="post" enctype="multipart/form-data" id="%s_admin_upload">', esc_attr($this->identifier), esc_attr($this->unique_prefix));
|
866 |
-
$form .= wp_nonce_field($this->unique_prefix . '_admin_import_export', '_wpnonce', true, false);
|
867 |
-
$form .= sprintf('<fieldset id="import_export" class="%s_options">', esc_attr($this->unique_prefix));
|
868 |
-
$form .= '<p>' . esc_html__('Import settings from a XML file, export the current settings to a XML file, or reset to the default settings.', $this->identifier) . '</p>';
|
869 |
-
$form .= '<table class="form-table"><tr valign="top"><th scope="row">';
|
870 |
-
$form .= sprintf('<label for="%s_admin_import_file">', esc_attr($this->unique_prefix));
|
871 |
-
$form .= esc_html__('Settings File', $this->identifier);
|
872 |
-
$form .= '</label></th><td>';
|
873 |
-
$form .= sprintf('<input type="file" name="%1$s_admin_import_file" id="%1$s_admin_import_file" size="32" /><p class="description">', esc_attr($this->unique_prefix));
|
874 |
-
$form .= esc_html__('Select a XML settings file to upload and import settings from.', 'tx_breadcrumb');
|
875 |
-
$form .= '</p></td></tr></table><p class="submit">';
|
876 |
-
$form .= sprintf('<input type="submit" class="button" name="%1$s_admin_import" value="%2$s"/>', $this->unique_prefix, esc_attr__('Import', $this->identifier));
|
877 |
-
$form .= sprintf('<input type="submit" class="button" name="%1$s_admin_export" value="%2$s"/>', $this->unique_prefix, esc_attr__('Export', $this->identifier));
|
878 |
-
$form .= sprintf('<input type="submit" class="button" name="%1$s_admin_reset" value="%2$s"/>', $this->unique_prefix, esc_attr__('Reset', $this->identifier));
|
879 |
-
$form .= '</p></fieldset></form></div>';
|
880 |
-
return $form;
|
881 |
-
}
|
882 |
-
/**
|
883 |
-
* This will output a well formed hidden option
|
884 |
-
*
|
885 |
-
* @param string $option
|
886 |
-
*/
|
887 |
-
function input_hidden($option)
|
888 |
-
{
|
889 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
890 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
891 |
-
printf('<input type="hidden" name="%1$s" id="%2$s" value="%3$s" />', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option]));
|
892 |
-
}
|
893 |
-
/**
|
894 |
-
* This will output a well formed option label
|
895 |
-
*
|
896 |
-
* @param string $opt_id
|
897 |
-
* @param string $label
|
898 |
-
*/
|
899 |
-
function label($opt_id, $label)
|
900 |
-
{
|
901 |
-
printf('<label for="%1$s">%2$s</label>', esc_attr($opt_id), $label);
|
902 |
-
}
|
903 |
-
/**
|
904 |
-
* This will output a well formed table row for a text input
|
905 |
-
*
|
906 |
-
* @param string $label
|
907 |
-
* @param string $option
|
908 |
-
* @param string $class (optional)
|
909 |
-
* @param bool $disable (optional)
|
910 |
-
* @param string $description (optional)
|
911 |
-
*/
|
912 |
-
function input_text($label, $option, $class = 'regular-text', $disable = false, $description = '')
|
913 |
-
{
|
914 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
915 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
916 |
-
if($disable)
|
917 |
-
{
|
918 |
-
$this->input_hidden($option);
|
919 |
-
$class .= ' disabled';
|
920 |
-
}?>
|
921 |
-
<tr valign="top">
|
922 |
-
<th scope="row">
|
923 |
-
<?php $this->label($opt_id, $label);?>
|
924 |
-
</th>
|
925 |
-
<td>
|
926 |
-
<?php printf('<input type="text" name="%1$s" id="%2$s" value="%3$s" class="%4$s" %5$s/><br />', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option]), esc_attr($class), disabled($disable, true, false));?>
|
927 |
-
<?php if($description !== ''){?><p class="description"><?php echo $description;?></p><?php }?>
|
928 |
-
</td>
|
929 |
-
</tr>
|
930 |
-
<?php
|
931 |
-
}
|
932 |
-
/**
|
933 |
-
* This will output a well formed table row for a HTML5 number input
|
934 |
-
*
|
935 |
-
* @param string $label
|
936 |
-
* @param string $option
|
937 |
-
* @param string $class (optional)
|
938 |
-
* @param bool $disable (optional)
|
939 |
-
* @param string $description (optional)
|
940 |
-
* @param int|string $min (optional)
|
941 |
-
* @param int|string $max (optional)
|
942 |
-
* @param int|string $step (optional)
|
943 |
-
*/
|
944 |
-
function input_number($label, $option, $class = 'small-text', $disable = false, $description = '', $min = '', $max = '', $step = '')
|
945 |
-
{
|
946 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
947 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
948 |
-
$extras = '';
|
949 |
-
if($min !== '')
|
950 |
-
{
|
951 |
-
$extras .= 'min="' . esc_attr($min) . '" ';
|
952 |
-
}
|
953 |
-
if($max !== '')
|
954 |
-
{
|
955 |
-
$extras .= 'max="' . esc_attr($max) . '" ';
|
956 |
-
}
|
957 |
-
if($step !== '')
|
958 |
-
{
|
959 |
-
$extras .= 'step="' . esc_attr($step) . '" ';
|
960 |
-
}
|
961 |
-
if($disable)
|
962 |
-
{
|
963 |
-
$this->input_hidden($option);
|
964 |
-
$class .= ' disabled';
|
965 |
-
}?>
|
966 |
-
<tr valign="top">
|
967 |
-
<th scope="row">
|
968 |
-
<?php $this->label($opt_id, $label);?>
|
969 |
-
</th>
|
970 |
-
<td>
|
971 |
-
<?php printf('<input type="number" name="%1$s" id="%2$s" value="%3$s" class="%4$s" %6$s%5$s/><br />', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option]), esc_attr($class), disabled($disable, true, false), $extras);?>
|
972 |
-
<?php if($description !== ''){?><p class="description"><?php echo $description;?></p><?php }?>
|
973 |
-
</td>
|
974 |
-
</tr>
|
975 |
-
<?php
|
976 |
-
}
|
977 |
-
/**
|
978 |
-
* This will output a well formed textbox
|
979 |
-
*
|
980 |
-
* @param string $label
|
981 |
-
* @param string $option
|
982 |
-
* @param string $rows (optional)
|
983 |
-
* @param bool $disable (optional)
|
984 |
-
* @param string $description (optional)
|
985 |
-
*/
|
986 |
-
function textbox($label, $option, $height = '3', $disable = false, $description = '', $class = '')
|
987 |
-
{
|
988 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
989 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
990 |
-
$class .= ' large-text';
|
991 |
-
if($disable)
|
992 |
-
{
|
993 |
-
$this->input_hidden($option);
|
994 |
-
$class .= ' disabled';
|
995 |
-
}?>
|
996 |
-
<tr valign="top">
|
997 |
-
<th scope="row">
|
998 |
-
<?php $this->label($opt_id, $label);?>
|
999 |
-
</th>
|
1000 |
-
<td>
|
1001 |
-
<?php printf('<textarea rows="%6$s" name="%1$s" id="%2$s" class="%4$s" %5$s/>%3$s</textarea><br />', esc_attr($opt_name), esc_attr($opt_id), esc_textarea($this->opt[$option]), esc_attr($class), disabled($disable, true, false), esc_attr($height));?>
|
1002 |
-
<?php if($description !== ''){?><p class="description"><?php echo $description;?></p><?php }?>
|
1003 |
-
</td>
|
1004 |
-
</tr>
|
1005 |
-
<?php
|
1006 |
-
}
|
1007 |
-
/**
|
1008 |
-
* This will output a well formed tiny mce ready textbox
|
1009 |
-
*
|
1010 |
-
* @param string $label
|
1011 |
-
* @param string $option
|
1012 |
-
* @param string $rows (optional)
|
1013 |
-
* @param bool $disable (optional)
|
1014 |
-
* @param string $description (optional)
|
1015 |
-
*/
|
1016 |
-
function tinymce($label, $option, $height = '3', $disable = false, $description = '')
|
1017 |
-
{
|
1018 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
1019 |
-
$class = 'mtekk_mce';
|
1020 |
-
if($disable)
|
1021 |
-
{
|
1022 |
-
$this->input_hidden($option);
|
1023 |
-
$class .= ' disabled';
|
1024 |
-
}?>
|
1025 |
-
<tr valign="top">
|
1026 |
-
<th scope="row">
|
1027 |
-
<?php $this->label($opt_id, $label);?>
|
1028 |
-
</th>
|
1029 |
-
<td>
|
1030 |
-
<?php printf('<textarea rows="%6$s" name="%1$s" id="%2$s" class="%4$s" %5$s/>%3$s</textarea><br />', esc_attr($opt_name), esc_attr($opt_id), esc_textarea($this->opt[$option]), esc_attr($class), disabled($disable, true, false), esc_attr($height));?>
|
1031 |
-
<?php if($description !== ''){?><p class="description"><?php echo $description;?></p><?php }?>
|
1032 |
-
</td>
|
1033 |
-
</tr>
|
1034 |
-
<?php
|
1035 |
-
}
|
1036 |
-
/**
|
1037 |
-
* This will output a well formed table row for a checkbox input
|
1038 |
-
*
|
1039 |
-
* @param string $label
|
1040 |
-
* @param string $option
|
1041 |
-
* @param string $instruction
|
1042 |
-
* @param bool $disable (optional)
|
1043 |
-
* @param string $description (optional)
|
1044 |
-
* @param string $class (optional)
|
1045 |
-
*/
|
1046 |
-
function input_check($label, $option, $instruction, $disable = false, $description = '', $class = '')
|
1047 |
-
{
|
1048 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
1049 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
1050 |
-
if($disable)
|
1051 |
-
{
|
1052 |
-
$this->input_hidden($option);
|
1053 |
-
$class .= ' disabled';
|
1054 |
-
}?>
|
1055 |
-
<tr valign="top">
|
1056 |
-
<th scope="row">
|
1057 |
-
<?php $this->label($opt_id, $label);?>
|
1058 |
-
</th>
|
1059 |
-
<td>
|
1060 |
-
<label>
|
1061 |
-
<?php printf('<input type="checkbox" name="%1$s" id="%2$s" value="%3$s" class="%4$s" %5$s %6$s/>', esc_attr($opt_name), esc_attr($opt_id), esc_attr($this->opt[$option]), esc_attr($class), disabled($disable, true, false), checked($this->opt[$option], true, false));?>
|
1062 |
-
<?php echo $instruction; ?>
|
1063 |
-
</label><br />
|
1064 |
-
<?php if($description !== ''){?><p class="description"><?php echo $description;?></p><?php }?>
|
1065 |
-
</td>
|
1066 |
-
</tr>
|
1067 |
-
<?php
|
1068 |
-
}
|
1069 |
-
/**
|
1070 |
-
* This will output a singular radio type form input field
|
1071 |
-
*
|
1072 |
-
* @param string $option
|
1073 |
-
* @param string $value
|
1074 |
-
* @param string $instruction
|
1075 |
-
* @param object $disable (optional)
|
1076 |
-
* @param string $class (optional)
|
1077 |
-
*/
|
1078 |
-
function input_radio($option, $value, $instruction, $disable = false, $class = '')
|
1079 |
-
{
|
1080 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
1081 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
1082 |
-
$class .= ' togx';
|
1083 |
-
if($disable)
|
1084 |
-
{
|
1085 |
-
$this->input_hidden($option);
|
1086 |
-
$class .= ' disabled';
|
1087 |
-
}?>
|
1088 |
-
<label>
|
1089 |
-
<?php printf('<input type="radio" name="%1$s" id="%2$s" value="%3$s" class="%4$s" %5$s %6$s/>', esc_attr($opt_name), esc_attr($opt_id), esc_attr($value), esc_attr($class), disabled($disable, true, false), checked($value, $this->opt[$option], false));?>
|
1090 |
-
<?php echo $instruction; ?>
|
1091 |
-
</label><br/>
|
1092 |
-
<?php
|
1093 |
-
}
|
1094 |
-
/**
|
1095 |
-
* This will output a well formed table row for a select input
|
1096 |
-
*
|
1097 |
-
* @param string $label
|
1098 |
-
* @param string $option
|
1099 |
-
* @param array $values
|
1100 |
-
* @param bool $disable (optional)
|
1101 |
-
* @param string $description (optional)
|
1102 |
-
* @param array $titles (optional) The array of titiles for the options, if they should be different from the values
|
1103 |
-
* @param string $class (optional) Extra class to apply to the elements
|
1104 |
-
*/
|
1105 |
-
function input_select($label, $option, $values, $disable = false, $description = '', $titles = false, $class = '')
|
1106 |
-
{
|
1107 |
-
//If we don't have titles passed in, we'll use option names as values
|
1108 |
-
if(!$titles)
|
1109 |
-
{
|
1110 |
-
$titles = $values;
|
1111 |
-
}
|
1112 |
-
$opt_id = mtekk_adminKit::get_valid_id($option);
|
1113 |
-
$opt_name = $this->unique_prefix . '_options[' . $option . ']';
|
1114 |
-
if($disable)
|
1115 |
-
{
|
1116 |
-
$this->input_hidden($option);
|
1117 |
-
$class .= ' disabled';
|
1118 |
-
}?>
|
1119 |
-
<tr valign="top">
|
1120 |
-
<th scope="row">
|
1121 |
-
<?php $this->label($opt_id, $label);?>
|
1122 |
-
</th>
|
1123 |
-
<td>
|
1124 |
-
<?php printf('<select name="%1$s" id="%2$s" class="%4$s" %5$s>%3$s</select><br />', esc_attr($opt_name), esc_attr($opt_id), $this->select_options($option, $titles, $values), esc_attr($class), disabled($disable, true, false));?>
|
1125 |
-
<?php if($description !== ''){?><p class="description"><?php echo $description;?></p><?php }?>
|
1126 |
-
</td>
|
1127 |
-
</tr>
|
1128 |
-
<?php
|
1129 |
-
}
|
1130 |
-
/**
|
1131 |
-
* Displays wordpress options as <seclect>
|
1132 |
-
*
|
1133 |
-
* @param string $optionname name of wordpress options store
|
1134 |
-
* @param array $options array of names of options that can be selected
|
1135 |
-
* @param array $values array of the values of the options that can be selected
|
1136 |
-
* @param array $exclude(optional) array of names in $options array to be excluded
|
1137 |
-
*
|
1138 |
-
* @return string The assembled HTML for the select options
|
1139 |
-
*/
|
1140 |
-
function select_options($optionname, $options, $values, $exclude = array())
|
1141 |
-
{
|
1142 |
-
$options_html = '';
|
1143 |
-
$value = $this->opt[$optionname];
|
1144 |
-
//Now do the rest
|
1145 |
-
foreach($options as $key => $option)
|
1146 |
-
{
|
1147 |
-
if(!in_array($option, $exclude))
|
1148 |
-
{
|
1149 |
-
$options_html .= sprintf('<option value="%1$s" %2$s>%3$s</option>', esc_attr($values[$key]), selected($value, $values[$key], false), $option);
|
1150 |
-
}
|
1151 |
-
}
|
1152 |
-
return $options_html;
|
1153 |
-
}
|
1154 |
-
/**
|
1155 |
-
* A local pass through for get_option so that we can hook in and pick the correct method if needed
|
1156 |
-
*
|
1157 |
-
* @param string $option The name of the option to retrieve
|
1158 |
-
* @return mixed The value of the option
|
1159 |
-
*/
|
1160 |
-
function get_option($option)
|
1161 |
-
{
|
1162 |
-
return get_option($option);
|
1163 |
-
}
|
1164 |
-
/**
|
1165 |
-
* A local pass through for update_option so that we can hook in and pick the correct method if needed
|
1166 |
-
*
|
1167 |
-
* @param string $option The name of the option to update
|
1168 |
-
* @param mixed $newvalue The new value to set the option to
|
1169 |
-
*/
|
1170 |
-
function update_option($option, $newvalue)
|
1171 |
-
{
|
1172 |
-
return update_option($option, $newvalue);
|
1173 |
-
}
|
1174 |
-
/**
|
1175 |
-
* A local pass through for add_option so that we can hook in and pick the correct method if needed
|
1176 |
-
*
|
1177 |
-
* @param string $option The name of the option to update
|
1178 |
-
* @param mixed $value The new value to set the option to
|
1179 |
-
* @param null $deprecated Deprecated parameter
|
1180 |
-
* @param string $autoload Whether or not to autoload the option, it's a string because WP is special
|
1181 |
-
*/
|
1182 |
-
function add_option($option, $value = '', $deprecated = '', $autoload = 'yes')
|
1183 |
-
{
|
1184 |
-
return add_option($option, $value, null, $autoload);
|
1185 |
-
}
|
1186 |
-
/**
|
1187 |
-
* A local pass through for delete_option so that we can hook in and pick the correct method if needed
|
1188 |
-
*
|
1189 |
-
* @param string $option The name of the option to delete
|
1190 |
-
*/
|
1191 |
-
function delete_option($option)
|
1192 |
-
{
|
1193 |
-
return delete_option($option);
|
1194 |
-
}
|
1195 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/class.mtekk_adminkit_message.php
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/block_direct_access.php');
|
20 |
-
class mtekk_adminKit_message
|
21 |
-
{
|
22 |
-
const version = '1.0.0';
|
23 |
-
protected $type = '';
|
24 |
-
protected $contents = '';
|
25 |
-
protected $dismissed = false;
|
26 |
-
protected $dismissible = false;
|
27 |
-
protected $uid;
|
28 |
-
/**
|
29 |
-
* Default constructor function
|
30 |
-
*
|
31 |
-
* @param string $contents The string to display in the message
|
32 |
-
* @param string $type The message type, 'error', 'warning', 'success', or 'info'
|
33 |
-
* @param bool $dismissible Whether or not the message is dismissable
|
34 |
-
* @param string $uid The message unique ID, only necessary if the message is dismissable
|
35 |
-
*/
|
36 |
-
public function __construct($contents, $type = 'info', $dismissible = false, $uid = '')
|
37 |
-
{
|
38 |
-
$uid = sanitize_html_class($uid);
|
39 |
-
//If the message is dismissable, the UID better not be null/empty
|
40 |
-
if($dismissible === true && $uid === '')
|
41 |
-
{
|
42 |
-
//Let the user know they're doing it wrong
|
43 |
-
_doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('$uid must not be null if message is dismissible', 'mtekk_adminKit'), '1.0.0');
|
44 |
-
//Treat the message as non-dismissible
|
45 |
-
$dismissible = false;
|
46 |
-
}
|
47 |
-
$this->contents = $contents;
|
48 |
-
$this->type = $type;
|
49 |
-
$this->dismissible = $dismissible;
|
50 |
-
$this->uid = $uid;
|
51 |
-
if($this->dismissible)
|
52 |
-
{
|
53 |
-
$this->dismissed = $this->was_dismissed();
|
54 |
-
}
|
55 |
-
}
|
56 |
-
/**
|
57 |
-
* Attempts to retrieve the dismissal transient for this message
|
58 |
-
*
|
59 |
-
* @return bool Whether or not the message has been dismissed
|
60 |
-
*/
|
61 |
-
public function was_dismissed()
|
62 |
-
{
|
63 |
-
$this->dismissed = get_transient($this->uid);
|
64 |
-
return $this->dismissed;
|
65 |
-
}
|
66 |
-
/**
|
67 |
-
* Dismisses the message, preventing it from being rendered
|
68 |
-
*/
|
69 |
-
public function dismiss()
|
70 |
-
{
|
71 |
-
if($this->dismissible && isset($_POST['uid']) && esc_attr($_POST['uid']) === $this->uid)
|
72 |
-
{
|
73 |
-
check_ajax_referer($this->uid . '_dismiss', 'nonce');
|
74 |
-
$this->dismissed = true;
|
75 |
-
//If the message was dismissed, update the transient for 30 days
|
76 |
-
$result = set_transient($this->uid, $this->dismissed, 2592000);
|
77 |
-
}
|
78 |
-
}
|
79 |
-
/**
|
80 |
-
* Function that prints out the message if not already dismissed
|
81 |
-
*/
|
82 |
-
public function render()
|
83 |
-
{
|
84 |
-
if($this->dismissible)
|
85 |
-
{
|
86 |
-
//Don't render dismissed messages
|
87 |
-
if($this->was_dismissed())
|
88 |
-
{
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
wp_enqueue_script('mtekk_adminkit_messages');
|
92 |
-
printf('<div class="notice notice-%1$s is-dismissible"><p>%2$s</p><meta property="uid" content="%3$s"><meta property="nonce" content="%4$s"></div>', esc_attr($this->type), $this->contents, esc_attr($this->uid), wp_create_nonce($this->uid . '_dismiss'));
|
93 |
-
}
|
94 |
-
else
|
95 |
-
{
|
96 |
-
printf('<div class="notice notice-%1$s"><p>%2$s</p></div>', esc_attr($this->type), $this->contents);
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/class.mtekk_adminkit_uninstaller.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2015-2018 John Havlik (email : john.havlik@mtekk.us)
|
4 |
-
|
5 |
-
This program is free software; you can redistribute it and/or modify
|
6 |
-
it under the terms of the GNU General Public License as published by
|
7 |
-
the Free Software Foundation; either version 2 of the License, or
|
8 |
-
(at your option) any later version.
|
9 |
-
|
10 |
-
This program is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
-
|
15 |
-
You should have received a copy of the GNU General Public License
|
16 |
-
along with this program; if not, write to the Free Software
|
17 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18 |
-
*/
|
19 |
-
require_once(dirname(__FILE__) . '/block_direct_access.php');
|
20 |
-
/**
|
21 |
-
* TX Breadcrumb abstract plugin uninstaller class
|
22 |
-
*
|
23 |
-
* @author Tom Klingenberg
|
24 |
-
*/
|
25 |
-
abstract class mtekk_adminKit_uninstaller
|
26 |
-
{
|
27 |
-
protected $unique_prefix = '';
|
28 |
-
protected $plugin_basename = null;
|
29 |
-
protected $_uninstall_result = false;
|
30 |
-
/**
|
31 |
-
* get plugin path
|
32 |
-
*
|
33 |
-
* @return string full path to plugin file
|
34 |
-
*/
|
35 |
-
protected function _get_plugin_path()
|
36 |
-
{
|
37 |
-
return sprintf('%s/%s', dirname(dirname(__FILE__)), $this->plugin_basename);
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* constructor
|
42 |
-
*
|
43 |
-
* @param array $options class options
|
44 |
-
* plugin =>
|
45 |
-
*/
|
46 |
-
public function __construct()
|
47 |
-
{
|
48 |
-
$this->_uninstall_result = $this->uninstall();
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Result Getter
|
53 |
-
*
|
54 |
-
* @return bool wether or not uninstall did run successfull.
|
55 |
-
*/
|
56 |
-
public function get_result()
|
57 |
-
{
|
58 |
-
return $this->_uninstall_result;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function is_installed()
|
62 |
-
{
|
63 |
-
return ((get_option($this->unique_prefix . '_options') !== false)
|
64 |
-
&& (get_option($this->unique_prefix . '_options_bk') !== false)
|
65 |
-
&& (get_option($this->unique_prefix . '_version') !== false)
|
66 |
-
&& (get_site_option($this->unique_prefix . '_options') !== false)
|
67 |
-
&& (get_site_option($this->unique_prefix . '_options_bk') !== false)
|
68 |
-
&& (get_site_option($this->unique_prefix . '_version') !== false));
|
69 |
-
}
|
70 |
-
} /// class bctx_uninstaller_abstract
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_engroups.js
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
jQuery(function()
|
2 |
-
{
|
3 |
-
jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_group);
|
4 |
-
jQuery("input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_set);
|
5 |
-
});
|
6 |
-
function mtekk_admin_enable_group(){
|
7 |
-
var setting = this;
|
8 |
-
jQuery(this).parents(".adminkit-engroup").find("input, textarea").each(function(){
|
9 |
-
if(this != setting){
|
10 |
-
if(jQuery(setting).prop("checked")){
|
11 |
-
jQuery(this).prop("disabled", false);
|
12 |
-
jQuery(this).removeClass("disabled");
|
13 |
-
}
|
14 |
-
else{
|
15 |
-
jQuery(this).prop("disabled", true);
|
16 |
-
jQuery(this).addClass("disabled");
|
17 |
-
}
|
18 |
-
}
|
19 |
-
});
|
20 |
-
}
|
21 |
-
function mtekk_admin_enable_set(){
|
22 |
-
var setting = this;
|
23 |
-
jQuery(this).parents(".adminkit-enset-top").find("input.adminkit-enset, textarea.adminkit-enset").each(function(){
|
24 |
-
if(this != setting){
|
25 |
-
if(jQuery(setting).prop("checked")){
|
26 |
-
jQuery(this).prop("disabled", false);
|
27 |
-
jQuery(this).removeClass("disabled");
|
28 |
-
}
|
29 |
-
else{
|
30 |
-
jQuery(this).prop("disabled", true);
|
31 |
-
jQuery(this).addClass("disabled");
|
32 |
-
}
|
33 |
-
}
|
34 |
-
});
|
35 |
-
}
|
36 |
-
jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_group);
|
37 |
-
jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_engroups.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function(){jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_set)});function mtekk_admin_enable_group(){var a=this;jQuery(this).parents(".adminkit-engroup").find("input, textarea").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}function mtekk_admin_enable_set(){var a=this;jQuery(this).parents(".adminkit-enset-top").find("input.adminkit-enset, textarea.adminkit-enset").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_messages.js
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
jQuery(function()
|
2 |
-
{
|
3 |
-
jQuery("div.notice button.notice-dismiss").click(function (event){
|
4 |
-
data = {
|
5 |
-
'action': 'mtekk_admin_message_dismiss',
|
6 |
-
'uid': jQuery(this).parent().children("meta[property='uid']").attr("content"),
|
7 |
-
'nonce': jQuery(this).parent().children("meta[property='nonce']").attr("content")
|
8 |
-
};
|
9 |
-
jQuery.post(ajaxurl, data);
|
10 |
-
});
|
11 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_messages.min.js
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
jQuery(function()
|
2 |
-
{
|
3 |
-
jQuery("div.notice button.notice-dismiss").click(function (event){
|
4 |
-
data = {
|
5 |
-
'action': 'mtekk_admin_message_dismiss',
|
6 |
-
'uid': jQuery(this).parent().children("meta[property='uid']").attr("content"),
|
7 |
-
'nonce': jQuery(this).parent().children("meta[property='nonce']").attr("content")
|
8 |
-
};
|
9 |
-
jQuery.post(ajaxurl, data);
|
10 |
-
});
|
11 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
#hasadmintabs ul.ui-tabs-nav{float: left; width: 100%; border-bottom:1px solid #ccc; font-size:12px; height:27px; list-style-image:none; list-style-position:outside; list-style-type:none; margin:14px 0 0; overflow:visible;padding:0 0 0 6px;}
|
2 |
-
#hasadmintabs ul.ui-tabs-nav li{display:block; float:left; line-height:200%; list-style-image:none; list-style-position:outside; list-style-type:none; margin:0; padding:0; position:relative; text-align:center; white-space:nowrap; width:auto;}
|
3 |
-
#hasadmintabs ul.ui-tabs-nav li a{border-bottom:1px solid #ccc; display:block; color:#464646; float:left; line-height:25px; padding:1px 13px 0; position:relative; text-decoration:none;margin:0 4px 0 0;}
|
4 |
-
#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a{background:none;border:1px solid #ccc; border-bottom-color:#f1f1f1; height: 25px; color:#464646; font-weight:normal; padding:1px 13px 0;color:#000;}
|
5 |
-
#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a:hover, #hasadmintabs ul.ui-tabs-nav a:hover{outline-color:-moz-use-text-color; outline-style:none; outline-width:medium;}
|
6 |
-
#hasadmintabs ul.ui-tabs-nav li a:focus, #hasadmintabs ul.ui-tabs-nav li a:active{outline: none;}
|
7 |
-
#hasadmintabs ul.ui-tabs-nav span{font-size: 12px; font-weight: bolder;}
|
8 |
-
#screen-options-wrap p.submit {margin:0; padding:0;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.js
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
jQuery(function()
|
2 |
-
{
|
3 |
-
mtekk_admin_tabulator_init();
|
4 |
-
});
|
5 |
-
/**
|
6 |
-
* Tabulator Bootup
|
7 |
-
*/
|
8 |
-
function mtekk_admin_tabulator_init(){
|
9 |
-
if(!jQuery("#hasadmintabs").length) return;
|
10 |
-
/* init markup for tabs */
|
11 |
-
jQuery('#hasadmintabs').prepend('<ul class="nav-tab-wrapper"><\/ul>');
|
12 |
-
jQuery('#hasadmintabs > fieldset').each(function(i){
|
13 |
-
id = jQuery(this).attr('id');
|
14 |
-
cssc = jQuery(this).attr('class');
|
15 |
-
title = jQuery(this).find('h3.tab-title').attr('title');
|
16 |
-
caption = jQuery(this).find('h3.tab-title').text();
|
17 |
-
jQuery('#hasadmintabs > ul').append('<li><a href="#'+id+'" class="nav-tab '+cssc+'" title="'+title+'"><span>'+caption+"<\/span><\/a><\/li>");
|
18 |
-
jQuery(this).find('h3.tab-title').hide();
|
19 |
-
});
|
20 |
-
var form = jQuery('#'+objectL10n.mtad_uid+'-options');
|
21 |
-
/* init the tabs plugin */
|
22 |
-
var tabs = jQuery("#hasadmintabs").tabs({
|
23 |
-
beforeActivate: function(event, ui){
|
24 |
-
form.find('input').each(function(){
|
25 |
-
if(!this.checkValidity()){
|
26 |
-
form.find(':submit').click();
|
27 |
-
event.preventDefault();
|
28 |
-
}
|
29 |
-
});
|
30 |
-
/* Update form action for reload on tab traversal*/
|
31 |
-
var action = form.attr("action").split('#', 1) + '#' + ui.newPanel[0].id;
|
32 |
-
form.get(0).setAttribute("action", action);
|
33 |
-
},
|
34 |
-
create: function(event, ui){
|
35 |
-
/* Update form action for reload of current tab on page load */
|
36 |
-
var action = form.attr("action").split('#', 1) + '#' + ui.panel[0].id;
|
37 |
-
form.get(0).setAttribute("action", action);
|
38 |
-
}
|
39 |
-
});
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.min.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
#hasadmintabs ul.ui-tabs-nav{float:left;width:100%;border-bottom:1px solid #ccc;font-size:12px;height:27px;list-style-image:none;list-style-position:outside;list-style-type:none;margin:14px 0 0;overflow:visible;padding:0 0 0 6px}#hasadmintabs ul.ui-tabs-nav li{display:block;float:left;line-height:200%;list-style-image:none;list-style-position:outside;list-style-type:none;margin:0;padding:0;position:relative;text-align:center;white-space:nowrap;width:auto}#hasadmintabs ul.ui-tabs-nav li a{border-bottom:1px solid #ccc;display:block;color:#464646;float:left;line-height:25px;padding:1px 13px 0;position:relative;text-decoration:none;margin:0 4px 0 0}#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a{background:0;border:1px solid #ccc;border-bottom-color:#f1f1f1;height:25px;color:#464646;font-weight:normal;padding:1px 13px 0;color:#000}#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a:hover,#hasadmintabs ul.ui-tabs-nav a:hover{outline-color:-moz-use-text-color;outline-style:none;outline-width:medium}#hasadmintabs ul.ui-tabs-nav li a:focus,#hasadmintabs ul.ui-tabs-nav li a:active{outline:0}#hasadmintabs ul.ui-tabs-nav span{font-size:12px;font-weight:bolder}#screen-options-wrap p.submit{margin:0;padding:0}
|
|
inc/tx-breadcrumb/includes/mtekk_adminkit_tabs.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(function(){mtekk_admin_tabulator_init()});function mtekk_admin_tabulator_init(){if(!jQuery("#hasadmintabs").length){return}jQuery("#hasadmintabs").prepend('<ul class="nav-tab-wrapper"></ul>');jQuery("#hasadmintabs > fieldset").each(function(c){id=jQuery(this).attr("id");cssc=jQuery(this).attr("class");title=jQuery(this).find("h3.tab-title").attr("title");caption=jQuery(this).find("h3.tab-title").text();jQuery("#hasadmintabs > ul").append('<li><a href="#'+id+'" class="nav-tab '+cssc+'" title="'+title+'"><span>'+caption+"</span></a></li>");jQuery(this).find("h3.tab-title").hide()});var b=jQuery("#"+objectL10n.mtad_uid+"-options");var a=jQuery("#hasadmintabs").tabs({beforeActivate:function(c,e){b.find("input").each(function(){if(!this.checkValidity()){b.find(":submit").click();c.preventDefault()}});var d=b.attr("action").split("#",1)+"#"+e.newPanel[0].id;b.get(0).setAttribute("action",d)},create:function(c,e){var d=b.attr("action").split("#",1)+"#"+e.panel[0].id;b.get(0).setAttribute("action",d)}})};
|
|
inc/tx-breadcrumb/includes/multibyte_supplicant.php
DELETED
@@ -1,111 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
A small library that adds in fallbacks for some of the PHP multibyte string
|
4 |
-
functions. Mainly inteneded to be used with TX Breadcrumb
|
5 |
-
|
6 |
-
Copyright 2009-2018 John Havlik (email : john.havlik@mtekk.us)
|
7 |
-
|
8 |
-
This program is free software; you can redistribute it and/or modify
|
9 |
-
it under the terms of the GNU General Public License as published by
|
10 |
-
the Free Software Foundation; either version 2 of the License, or
|
11 |
-
(at your option) any later version.
|
12 |
-
|
13 |
-
This program is distributed in the hope that it will be useful,
|
14 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
-
GNU General Public License for more details.
|
17 |
-
|
18 |
-
You should have received a copy of the GNU General Public License
|
19 |
-
along with this program; if not, write to the Free Software
|
20 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21 |
-
*/
|
22 |
-
require_once(dirname(__FILE__) . '/block_direct_access.php');
|
23 |
-
if(!function_exists('mb_strlen'))
|
24 |
-
{
|
25 |
-
/**
|
26 |
-
* Fallback for mb_strlen for users without multibyte support
|
27 |
-
*
|
28 |
-
* @param string $string the string to determine the lenght of
|
29 |
-
* @return int the number of characters in the string
|
30 |
-
*/
|
31 |
-
function mb_strlen($string)
|
32 |
-
{
|
33 |
-
return strlen($string);
|
34 |
-
}
|
35 |
-
}
|
36 |
-
if(!function_exists('mb_strpos'))
|
37 |
-
{
|
38 |
-
/**
|
39 |
-
* Fallback for mb_strpos for users without multibyte support
|
40 |
-
*
|
41 |
-
* @param string $haystack the string to search within
|
42 |
-
* @param string $needle the string to search for
|
43 |
-
* @return mixed position of the first instances of needle, or false if needle not found
|
44 |
-
*/
|
45 |
-
function mb_strpos($haystack, $needle, $offset = 0)
|
46 |
-
{
|
47 |
-
return strpos($haystack, $needle, $offset);
|
48 |
-
}
|
49 |
-
}
|
50 |
-
if(!function_exists('mb_substr'))
|
51 |
-
{
|
52 |
-
/**
|
53 |
-
* Fallback for mb_substr for users without multibyte support
|
54 |
-
*
|
55 |
-
* @param string $string the input string
|
56 |
-
* @param int $start the start
|
57 |
-
* @param int length the length of the substring
|
58 |
-
* @return string the substring of specified length
|
59 |
-
*/
|
60 |
-
function mb_substr($string, $start, $length = 'a')
|
61 |
-
{
|
62 |
-
//This happens to be the easiest way to preserve the behavior of substr
|
63 |
-
if($length = 'a')
|
64 |
-
{
|
65 |
-
return substr($string, $start);
|
66 |
-
}
|
67 |
-
else
|
68 |
-
{
|
69 |
-
return substr($string, $start, $length);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
if(!function_exists('mb_strtolower'))
|
74 |
-
{
|
75 |
-
/**
|
76 |
-
* Fallback for mb_strtolower for users without multibyte support
|
77 |
-
*
|
78 |
-
* @param string $str the string to change to lowercase
|
79 |
-
* @param string $encoding the encoding of the string
|
80 |
-
* @return string the lowercase string
|
81 |
-
*/
|
82 |
-
function mb_strtolower($str, $encoding = 'UTF-8')
|
83 |
-
{
|
84 |
-
return strtolower($str);
|
85 |
-
}
|
86 |
-
}
|
87 |
-
//We need this constant to be defined, otherwise things will break
|
88 |
-
if(!defined('MB_CASE_TITLE'))
|
89 |
-
{
|
90 |
-
define('MB_CASE_TITLE', '1');
|
91 |
-
}
|
92 |
-
if(!function_exists('mb_convert_case'))
|
93 |
-
{
|
94 |
-
/**
|
95 |
-
* A very hacky fallback for mb_convert_case for users without multibyte support
|
96 |
-
*
|
97 |
-
* @param string $str the string to change the case on
|
98 |
-
* @param int $mode the mode of case convert to use
|
99 |
-
* @param string $encoding the encoding of the string
|
100 |
-
* @return string the case converted string
|
101 |
-
*/
|
102 |
-
function mb_convert_case($str, $mode = MB_CASE_TITLE, $encoding = 'UTF-8')
|
103 |
-
{
|
104 |
-
//Only implementing MB_CASE_TITLE
|
105 |
-
if($mode = MB_CASE_TITLE)
|
106 |
-
{
|
107 |
-
return ucwords($str);
|
108 |
-
}
|
109 |
-
return $str;
|
110 |
-
}
|
111 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/languages/tx-breadcrumb.pot
DELETED
@@ -1,988 +0,0 @@
|
|
1 |
-
# Copyright (C) 2016 Breadcrumb NavXT
|
2 |
-
# This file is distributed under the same license as the Breadcrumb NavXT package.
|
3 |
-
msgid ""
|
4 |
-
msgstr ""
|
5 |
-
"Project-Id-Version: Breadcrumb NavXT 5.5.1\n"
|
6 |
-
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/breadcrumb-navxt\n"
|
7 |
-
"POT-Creation-Date: 2016-08-13 19:01:09+00:00\n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
12 |
-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
-
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
-
|
15 |
-
#: breadcrumb-navxt.php:35 class.bcn_admin.php:25
|
16 |
-
#: class.bcn_network_admin.php:25
|
17 |
-
msgid ""
|
18 |
-
"Your PHP version is too old, please upgrade to a newer version. Your version "
|
19 |
-
"is %1$s, Breadcrumb NavXT requires %2$s"
|
20 |
-
msgstr ""
|
21 |
-
|
22 |
-
#: class.bcn_admin.php:64
|
23 |
-
msgid "Breadcrumb NavXT Settings"
|
24 |
-
msgstr ""
|
25 |
-
|
26 |
-
#: class.bcn_admin.php:295 class.bcn_network_admin.php:366
|
27 |
-
msgid "Tips for the settings are located below select options."
|
28 |
-
msgstr ""
|
29 |
-
|
30 |
-
#: class.bcn_admin.php:296 class.bcn_network_admin.php:367
|
31 |
-
msgid "Resources"
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
#: class.bcn_admin.php:297 class.bcn_network_admin.php:368
|
35 |
-
msgid ""
|
36 |
-
"%sTutorials and How Tos%s: There are several guides, tutorials, and how tos "
|
37 |
-
"available on the author's website."
|
38 |
-
msgstr ""
|
39 |
-
|
40 |
-
#: class.bcn_admin.php:297 class.bcn_network_admin.php:368
|
41 |
-
msgid "Go to the Breadcrumb NavXT tag archive."
|
42 |
-
msgstr ""
|
43 |
-
|
44 |
-
#: class.bcn_admin.php:298 class.bcn_network_admin.php:369
|
45 |
-
msgid ""
|
46 |
-
"%sOnline Documentation%s: Check out the documentation for more indepth "
|
47 |
-
"technical information."
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: class.bcn_admin.php:298 class.bcn_network_admin.php:369
|
51 |
-
msgid "Go to the Breadcrumb NavXT online documentation"
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: class.bcn_admin.php:299 class.bcn_network_admin.php:370
|
55 |
-
msgid ""
|
56 |
-
"%sReport a Bug%s: If you think you have found a bug, please include your "
|
57 |
-
"WordPress version and details on how to reproduce the bug."
|
58 |
-
msgstr ""
|
59 |
-
|
60 |
-
#: class.bcn_admin.php:299 class.bcn_network_admin.php:370
|
61 |
-
msgid "Go to the Breadcrumb NavXT support post for your version."
|
62 |
-
msgstr ""
|
63 |
-
|
64 |
-
#: class.bcn_admin.php:300 class.bcn_network_admin.php:371
|
65 |
-
msgid "Giving Back"
|
66 |
-
msgstr ""
|
67 |
-
|
68 |
-
#: class.bcn_admin.php:301 class.bcn_network_admin.php:372
|
69 |
-
msgid ""
|
70 |
-
"%sDonate%s: Love Breadcrumb NavXT and want to help development? Consider "
|
71 |
-
"buying the author a beer."
|
72 |
-
msgstr ""
|
73 |
-
|
74 |
-
#: class.bcn_admin.php:301 class.bcn_network_admin.php:372
|
75 |
-
msgid "Go to PayPal to give a donation to Breadcrumb NavXT."
|
76 |
-
msgstr ""
|
77 |
-
|
78 |
-
#: class.bcn_admin.php:302 class.bcn_network_admin.php:373
|
79 |
-
msgid ""
|
80 |
-
"%sTranslate%s: Is your language not available? Visit the Breadcrumb NavXT "
|
81 |
-
"translation project on WordPress.org to start translating."
|
82 |
-
msgstr ""
|
83 |
-
|
84 |
-
#: class.bcn_admin.php:302 class.bcn_network_admin.php:373
|
85 |
-
msgid "Go to the Breadcrumb NavXT translation project."
|
86 |
-
msgstr ""
|
87 |
-
|
88 |
-
#: class.bcn_admin.php:307 class.bcn_admin.php:446 class.bcn_admin.php:447
|
89 |
-
#: class.bcn_network_admin.php:378 class.bcn_network_admin.php:518
|
90 |
-
#: class.bcn_network_admin.php:519
|
91 |
-
msgid "General"
|
92 |
-
msgstr ""
|
93 |
-
|
94 |
-
#: class.bcn_admin.php:310 class.bcn_network_admin.php:381
|
95 |
-
msgid ""
|
96 |
-
"For the settings on this page to take effect, you must either use the "
|
97 |
-
"included Breadcrumb NavXT widget, or place either of the code sections below "
|
98 |
-
"into your theme."
|
99 |
-
msgstr ""
|
100 |
-
|
101 |
-
#: class.bcn_admin.php:311 class.bcn_network_admin.php:382
|
102 |
-
msgid "Breadcrumb trail with separators"
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
#: class.bcn_admin.php:317 class.bcn_network_admin.php:388
|
106 |
-
msgid "Breadcrumb trail in list form"
|
107 |
-
msgstr ""
|
108 |
-
|
109 |
-
#: class.bcn_admin.php:326 class.bcn_network_admin.php:397
|
110 |
-
msgid "Quick Start"
|
111 |
-
msgstr ""
|
112 |
-
|
113 |
-
#: class.bcn_admin.php:329 class.bcn_network_admin.php:400
|
114 |
-
msgid ""
|
115 |
-
"Using the code from the Quick Start section above, the following CSS can be "
|
116 |
-
"used as base for styling your breadcrumb trail."
|
117 |
-
msgstr ""
|
118 |
-
|
119 |
-
#: class.bcn_admin.php:341 class.bcn_network_admin.php:412
|
120 |
-
msgid "Styling"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: class.bcn_admin.php:347 class.bcn_network_admin.php:418
|
124 |
-
msgid "Import/Export/Reset"
|
125 |
-
msgstr ""
|
126 |
-
|
127 |
-
#: class.bcn_admin.php:371 class.bcn_network_admin.php:442
|
128 |
-
#: includes/class.mtekk_adminkit.php:841
|
129 |
-
msgid "Import"
|
130 |
-
msgstr ""
|
131 |
-
|
132 |
-
#: class.bcn_admin.php:372 class.bcn_network_admin.php:443
|
133 |
-
#: includes/class.mtekk_adminkit.php:842
|
134 |
-
msgid "Export"
|
135 |
-
msgstr ""
|
136 |
-
|
137 |
-
#: class.bcn_admin.php:373 class.bcn_network_admin.php:444
|
138 |
-
#: includes/class.mtekk_adminkit.php:843
|
139 |
-
msgid "Reset"
|
140 |
-
msgstr ""
|
141 |
-
|
142 |
-
#: class.bcn_admin.php:391
|
143 |
-
msgid ""
|
144 |
-
"Warning: Your network settings will override any settings set in this page."
|
145 |
-
msgstr ""
|
146 |
-
|
147 |
-
#: class.bcn_admin.php:395 class.bcn_admin.php:399
|
148 |
-
msgid ""
|
149 |
-
"Warning: Your network settings may override any settings set in this page."
|
150 |
-
msgstr ""
|
151 |
-
|
152 |
-
#: class.bcn_admin.php:404 class.bcn_network_admin.php:475
|
153 |
-
msgid ""
|
154 |
-
"Warning: No BCN_SETTINGS_* define statement found, defaulting to "
|
155 |
-
"BCN_SETTINGS_USE_LOCAL."
|
156 |
-
msgstr ""
|
157 |
-
|
158 |
-
#: class.bcn_admin.php:416 class.bcn_network_admin.php:488
|
159 |
-
msgid ""
|
160 |
-
"Warning: Your are using a deprecated setting \"Title Length\" (see "
|
161 |
-
"Miscellaneous > Deprecated), please %1$suse CSS instead%2$s."
|
162 |
-
msgstr ""
|
163 |
-
|
164 |
-
#: class.bcn_admin.php:416 class.bcn_admin.php:704
|
165 |
-
#: class.bcn_network_admin.php:488 class.bcn_network_admin.php:776
|
166 |
-
msgid "Go to the guide on trimming breadcrumb title lengths with CSS"
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: class.bcn_admin.php:446 class.bcn_network_admin.php:518
|
170 |
-
msgid ""
|
171 |
-
"A collection of settings most likely to be modified are located under this "
|
172 |
-
"tab."
|
173 |
-
msgstr ""
|
174 |
-
|
175 |
-
#: class.bcn_admin.php:450 class.bcn_network_admin.php:522
|
176 |
-
msgid "Breadcrumb Separator"
|
177 |
-
msgstr ""
|
178 |
-
|
179 |
-
#: class.bcn_admin.php:450 class.bcn_network_admin.php:522
|
180 |
-
msgid "Placed in between each breadcrumb."
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: class.bcn_admin.php:454 class.bcn_network_admin.php:526
|
184 |
-
msgid "Current Item"
|
185 |
-
msgstr ""
|
186 |
-
|
187 |
-
#: class.bcn_admin.php:457 class.bcn_network_admin.php:529
|
188 |
-
msgid "Link Current Item"
|
189 |
-
msgstr ""
|
190 |
-
|
191 |
-
#: class.bcn_admin.php:457 class.bcn_network_admin.php:529
|
192 |
-
msgid "Yes"
|
193 |
-
msgstr ""
|
194 |
-
|
195 |
-
#: class.bcn_admin.php:458 class.bcn_network_admin.php:530
|
196 |
-
msgctxt ""
|
197 |
-
"Paged as in when on an archive or post that is split into multiple pages"
|
198 |
-
msgid "Paged Breadcrumb"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
-
#: class.bcn_admin.php:458 class.bcn_network_admin.php:530
|
202 |
-
msgid "Place the page number breadcrumb in the trail."
|
203 |
-
msgstr ""
|
204 |
-
|
205 |
-
#: class.bcn_admin.php:458 class.bcn_network_admin.php:530
|
206 |
-
msgid ""
|
207 |
-
"Indicates that the user is on a page other than the first of a paginated "
|
208 |
-
"archive or post."
|
209 |
-
msgstr ""
|
210 |
-
|
211 |
-
#: class.bcn_admin.php:459 class.bcn_network_admin.php:531
|
212 |
-
msgctxt ""
|
213 |
-
"Paged as in when on an archive or post that is split into multiple pages"
|
214 |
-
msgid "Paged Template"
|
215 |
-
msgstr ""
|
216 |
-
|
217 |
-
#: class.bcn_admin.php:459 class.bcn_network_admin.php:531
|
218 |
-
msgid "The template for paged breadcrumbs."
|
219 |
-
msgstr ""
|
220 |
-
|
221 |
-
#: class.bcn_admin.php:463 class.bcn_admin.php:466
|
222 |
-
#: class.bcn_network_admin.php:535 class.bcn_network_admin.php:538
|
223 |
-
msgid "Home Breadcrumb"
|
224 |
-
msgstr ""
|
225 |
-
|
226 |
-
#: class.bcn_admin.php:466 class.bcn_network_admin.php:538
|
227 |
-
msgid "Place the home breadcrumb in the trail."
|
228 |
-
msgstr ""
|
229 |
-
|
230 |
-
#: class.bcn_admin.php:467 class.bcn_network_admin.php:539
|
231 |
-
msgid "Home Template"
|
232 |
-
msgstr ""
|
233 |
-
|
234 |
-
#: class.bcn_admin.php:467 class.bcn_network_admin.php:539
|
235 |
-
msgid "The template for the home breadcrumb."
|
236 |
-
msgstr ""
|
237 |
-
|
238 |
-
#: class.bcn_admin.php:468 class.bcn_network_admin.php:540
|
239 |
-
msgid "Home Template (Unlinked)"
|
240 |
-
msgstr ""
|
241 |
-
|
242 |
-
#: class.bcn_admin.php:468 class.bcn_network_admin.php:540
|
243 |
-
msgid ""
|
244 |
-
"The template for the home breadcrumb, used when the breadcrumb is not linked."
|
245 |
-
msgstr ""
|
246 |
-
|
247 |
-
#: class.bcn_admin.php:472 class.bcn_admin.php:475
|
248 |
-
#: class.bcn_network_admin.php:544 class.bcn_network_admin.php:547
|
249 |
-
msgid "Blog Breadcrumb"
|
250 |
-
msgstr ""
|
251 |
-
|
252 |
-
#: class.bcn_admin.php:475 class.bcn_network_admin.php:547
|
253 |
-
msgid "Place the blog breadcrumb in the trail."
|
254 |
-
msgstr ""
|
255 |
-
|
256 |
-
#: class.bcn_admin.php:476 class.bcn_network_admin.php:548
|
257 |
-
msgid "Blog Template"
|
258 |
-
msgstr ""
|
259 |
-
|
260 |
-
#: class.bcn_admin.php:476 class.bcn_network_admin.php:548
|
261 |
-
msgid ""
|
262 |
-
"The template for the blog breadcrumb, used only in static front page "
|
263 |
-
"environments."
|
264 |
-
msgstr ""
|
265 |
-
|
266 |
-
#: class.bcn_admin.php:477 class.bcn_network_admin.php:549
|
267 |
-
msgid "Blog Template (Unlinked)"
|
268 |
-
msgstr ""
|
269 |
-
|
270 |
-
#: class.bcn_admin.php:477 class.bcn_network_admin.php:549
|
271 |
-
msgid ""
|
272 |
-
"The template for the blog breadcrumb, used only in static front page "
|
273 |
-
"environments and when the breadcrumb is not linked."
|
274 |
-
msgstr ""
|
275 |
-
|
276 |
-
#: class.bcn_admin.php:481 class.bcn_network_admin.php:553
|
277 |
-
msgid "Mainsite Breadcrumb"
|
278 |
-
msgstr ""
|
279 |
-
|
280 |
-
#: class.bcn_admin.php:484 class.bcn_network_admin.php:556
|
281 |
-
msgid "Main Site Breadcrumb"
|
282 |
-
msgstr ""
|
283 |
-
|
284 |
-
#: class.bcn_admin.php:484 class.bcn_network_admin.php:556
|
285 |
-
msgid "Place the main site home breadcrumb in the trail in an multisite setup."
|
286 |
-
msgstr ""
|
287 |
-
|
288 |
-
#: class.bcn_admin.php:485 class.bcn_network_admin.php:557
|
289 |
-
msgid "Main Site Home Template"
|
290 |
-
msgstr ""
|
291 |
-
|
292 |
-
#: class.bcn_admin.php:485 class.bcn_network_admin.php:557
|
293 |
-
msgid ""
|
294 |
-
"The template for the main site home breadcrumb, used only in multisite "
|
295 |
-
"environments."
|
296 |
-
msgstr ""
|
297 |
-
|
298 |
-
#: class.bcn_admin.php:486 class.bcn_network_admin.php:558
|
299 |
-
msgid "Main Site Home Template (Unlinked)"
|
300 |
-
msgstr ""
|
301 |
-
|
302 |
-
#: class.bcn_admin.php:486 class.bcn_network_admin.php:558
|
303 |
-
msgid ""
|
304 |
-
"The template for the main site home breadcrumb, used only in multisite "
|
305 |
-
"environments and when the breadcrumb is not linked."
|
306 |
-
msgstr ""
|
307 |
-
|
308 |
-
#: class.bcn_admin.php:493 class.bcn_network_admin.php:565
|
309 |
-
msgid ""
|
310 |
-
"The settings for all post types (Posts, Pages, and Custom Post Types) are "
|
311 |
-
"located under this tab."
|
312 |
-
msgstr ""
|
313 |
-
|
314 |
-
#: class.bcn_admin.php:493 class.bcn_network_admin.php:565
|
315 |
-
msgid "Post Types"
|
316 |
-
msgstr ""
|
317 |
-
|
318 |
-
#: class.bcn_admin.php:494 class.bcn_network_admin.php:566
|
319 |
-
msgid "Posts"
|
320 |
-
msgstr ""
|
321 |
-
|
322 |
-
#: class.bcn_admin.php:497 class.bcn_network_admin.php:569
|
323 |
-
msgid "Post Template"
|
324 |
-
msgstr ""
|
325 |
-
|
326 |
-
#: class.bcn_admin.php:497 class.bcn_network_admin.php:569
|
327 |
-
msgid "The template for post breadcrumbs."
|
328 |
-
msgstr ""
|
329 |
-
|
330 |
-
#: class.bcn_admin.php:498 class.bcn_network_admin.php:570
|
331 |
-
msgid "Post Template (Unlinked)"
|
332 |
-
msgstr ""
|
333 |
-
|
334 |
-
#: class.bcn_admin.php:498 class.bcn_network_admin.php:570
|
335 |
-
msgid ""
|
336 |
-
"The template for post breadcrumbs, used only when the breadcrumb is not "
|
337 |
-
"linked."
|
338 |
-
msgstr ""
|
339 |
-
|
340 |
-
#: class.bcn_admin.php:499 class.bcn_network_admin.php:571
|
341 |
-
msgid "Post Hierarchy Display"
|
342 |
-
msgstr ""
|
343 |
-
|
344 |
-
#: class.bcn_admin.php:499 class.bcn_network_admin.php:571
|
345 |
-
msgid ""
|
346 |
-
"Show the hierarchy (specified below) leading to a post in the breadcrumb "
|
347 |
-
"trail."
|
348 |
-
msgstr ""
|
349 |
-
|
350 |
-
#: class.bcn_admin.php:500 class.bcn_network_admin.php:572
|
351 |
-
msgid "Post Hierarchy Referer Influence"
|
352 |
-
msgstr ""
|
353 |
-
|
354 |
-
#: class.bcn_admin.php:500 class.bcn_admin.php:578
|
355 |
-
#: class.bcn_network_admin.php:572 class.bcn_network_admin.php:650
|
356 |
-
msgid ""
|
357 |
-
"Allow the refereing page to influence the taxonomy selected for the "
|
358 |
-
"hierarchy."
|
359 |
-
msgstr ""
|
360 |
-
|
361 |
-
#: class.bcn_admin.php:504 class.bcn_network_admin.php:576
|
362 |
-
msgid "Post Hierarchy"
|
363 |
-
msgstr ""
|
364 |
-
|
365 |
-
#: class.bcn_admin.php:508 class.bcn_admin.php:627
|
366 |
-
#: class.bcn_network_admin.php:580 class.bcn_network_admin.php:699
|
367 |
-
msgid "Categories"
|
368 |
-
msgstr ""
|
369 |
-
|
370 |
-
#: class.bcn_admin.php:509 class.bcn_admin.php:588
|
371 |
-
#: class.bcn_network_admin.php:581 class.bcn_network_admin.php:660
|
372 |
-
msgid "Dates"
|
373 |
-
msgstr ""
|
374 |
-
|
375 |
-
#: class.bcn_admin.php:510 class.bcn_admin.php:634
|
376 |
-
#: class.bcn_network_admin.php:582 class.bcn_network_admin.php:706
|
377 |
-
msgid "Tags"
|
378 |
-
msgstr ""
|
379 |
-
|
380 |
-
#: class.bcn_admin.php:512 class.bcn_admin.php:587
|
381 |
-
#: class.bcn_network_admin.php:584 class.bcn_network_admin.php:659
|
382 |
-
msgid "Post Parent"
|
383 |
-
msgstr ""
|
384 |
-
|
385 |
-
#: class.bcn_admin.php:528 class.bcn_admin.php:612
|
386 |
-
#: class.bcn_network_admin.php:600 class.bcn_network_admin.php:684
|
387 |
-
msgid ""
|
388 |
-
"The hierarchy which the breadcrumb trail will show. Note that the \"Post "
|
389 |
-
"Parent\" option may require an additional plugin to behave as expected since "
|
390 |
-
"this is a non-hierarchical post type."
|
391 |
-
msgstr ""
|
392 |
-
|
393 |
-
#: class.bcn_admin.php:532 class.bcn_network_admin.php:604
|
394 |
-
msgid "Pages"
|
395 |
-
msgstr ""
|
396 |
-
|
397 |
-
#: class.bcn_admin.php:535 class.bcn_network_admin.php:607
|
398 |
-
msgid "Page Template"
|
399 |
-
msgstr ""
|
400 |
-
|
401 |
-
#: class.bcn_admin.php:535 class.bcn_network_admin.php:607
|
402 |
-
msgid "The template for page breadcrumbs."
|
403 |
-
msgstr ""
|
404 |
-
|
405 |
-
#: class.bcn_admin.php:536 class.bcn_network_admin.php:608
|
406 |
-
msgid "Page Template (Unlinked)"
|
407 |
-
msgstr ""
|
408 |
-
|
409 |
-
#: class.bcn_admin.php:536 class.bcn_network_admin.php:608
|
410 |
-
msgid ""
|
411 |
-
"The template for page breadcrumbs, used only when the breadcrumb is not "
|
412 |
-
"linked."
|
413 |
-
msgstr ""
|
414 |
-
|
415 |
-
#: class.bcn_admin.php:539 class.bcn_network_admin.php:611
|
416 |
-
msgid "Attachments"
|
417 |
-
msgstr ""
|
418 |
-
|
419 |
-
#: class.bcn_admin.php:542 class.bcn_network_admin.php:614
|
420 |
-
msgid "Attachment Template"
|
421 |
-
msgstr ""
|
422 |
-
|
423 |
-
#: class.bcn_admin.php:542 class.bcn_network_admin.php:614
|
424 |
-
msgid "The template for attachment breadcrumbs."
|
425 |
-
msgstr ""
|
426 |
-
|
427 |
-
#: class.bcn_admin.php:543 class.bcn_network_admin.php:615
|
428 |
-
msgid "Attachment Template (Unlinked)"
|
429 |
-
msgstr ""
|
430 |
-
|
431 |
-
#: class.bcn_admin.php:543 class.bcn_network_admin.php:615
|
432 |
-
msgid ""
|
433 |
-
"The template for attachment breadcrumbs, used only when the breadcrumb is "
|
434 |
-
"not linked."
|
435 |
-
msgstr ""
|
436 |
-
|
437 |
-
#: class.bcn_admin.php:563 class.bcn_admin.php:665
|
438 |
-
#: class.bcn_network_admin.php:635 class.bcn_network_admin.php:737
|
439 |
-
msgid "%s Template"
|
440 |
-
msgstr ""
|
441 |
-
|
442 |
-
#: class.bcn_admin.php:563 class.bcn_admin.php:665
|
443 |
-
#: class.bcn_network_admin.php:635 class.bcn_network_admin.php:737
|
444 |
-
msgid "The template for %s breadcrumbs."
|
445 |
-
msgstr ""
|
446 |
-
|
447 |
-
#: class.bcn_admin.php:564 class.bcn_admin.php:666
|
448 |
-
#: class.bcn_network_admin.php:636 class.bcn_network_admin.php:738
|
449 |
-
msgid "%s Template (Unlinked)"
|
450 |
-
msgstr ""
|
451 |
-
|
452 |
-
#: class.bcn_admin.php:564 class.bcn_admin.php:666
|
453 |
-
#: class.bcn_network_admin.php:636 class.bcn_network_admin.php:738
|
454 |
-
msgid ""
|
455 |
-
"The template for %s breadcrumbs, used only when the breadcrumb is not linked."
|
456 |
-
msgstr ""
|
457 |
-
|
458 |
-
#: class.bcn_admin.php:569 class.bcn_network_admin.php:641
|
459 |
-
msgid "%s Root Page"
|
460 |
-
msgstr ""
|
461 |
-
|
462 |
-
#: class.bcn_admin.php:572 class.bcn_network_admin.php:644
|
463 |
-
msgid "— Select —"
|
464 |
-
msgstr ""
|
465 |
-
|
466 |
-
#: class.bcn_admin.php:576 class.bcn_network_admin.php:648
|
467 |
-
msgid "%s Archive Display"
|
468 |
-
msgstr ""
|
469 |
-
|
470 |
-
#: class.bcn_admin.php:576 class.bcn_network_admin.php:648
|
471 |
-
msgid ""
|
472 |
-
"Show the breadcrumb for the %s post type archives in the breadcrumb trail."
|
473 |
-
msgstr ""
|
474 |
-
|
475 |
-
#: class.bcn_admin.php:577 class.bcn_network_admin.php:649
|
476 |
-
msgid "%s Hierarchy Display"
|
477 |
-
msgstr ""
|
478 |
-
|
479 |
-
#: class.bcn_admin.php:577 class.bcn_network_admin.php:649
|
480 |
-
msgid ""
|
481 |
-
"Show the hierarchy (specified below) leading to a %s in the breadcrumb trail."
|
482 |
-
msgstr ""
|
483 |
-
|
484 |
-
#: class.bcn_admin.php:578 class.bcn_network_admin.php:650
|
485 |
-
msgid "%s Hierarchy Referer Influence"
|
486 |
-
msgstr ""
|
487 |
-
|
488 |
-
#: class.bcn_admin.php:582 class.bcn_network_admin.php:654
|
489 |
-
msgid "%s Hierarchy"
|
490 |
-
msgstr ""
|
491 |
-
|
492 |
-
#: class.bcn_admin.php:608 class.bcn_network_admin.php:680
|
493 |
-
msgid "The hierarchy which the breadcrumb trail will show."
|
494 |
-
msgstr ""
|
495 |
-
|
496 |
-
#: class.bcn_admin.php:626 class.bcn_network_admin.php:698
|
497 |
-
msgid ""
|
498 |
-
"The settings for all taxonomies (including Categories, Tags, and custom "
|
499 |
-
"taxonomies) are located under this tab."
|
500 |
-
msgstr ""
|
501 |
-
|
502 |
-
#: class.bcn_admin.php:626 class.bcn_network_admin.php:698
|
503 |
-
msgid "Taxonomies"
|
504 |
-
msgstr ""
|
505 |
-
|
506 |
-
#: class.bcn_admin.php:630 class.bcn_network_admin.php:702
|
507 |
-
msgid "Category Template"
|
508 |
-
msgstr ""
|
509 |
-
|
510 |
-
#: class.bcn_admin.php:630 class.bcn_network_admin.php:702
|
511 |
-
msgid "The template for category breadcrumbs."
|
512 |
-
msgstr ""
|
513 |
-
|
514 |
-
#: class.bcn_admin.php:631 class.bcn_network_admin.php:703
|
515 |
-
msgid "Category Template (Unlinked)"
|
516 |
-
msgstr ""
|
517 |
-
|
518 |
-
#: class.bcn_admin.php:631 class.bcn_network_admin.php:703
|
519 |
-
msgid ""
|
520 |
-
"The template for category breadcrumbs, used only when the breadcrumb is not "
|
521 |
-
"linked."
|
522 |
-
msgstr ""
|
523 |
-
|
524 |
-
#: class.bcn_admin.php:637 class.bcn_network_admin.php:709
|
525 |
-
msgid "Tag Template"
|
526 |
-
msgstr ""
|
527 |
-
|
528 |
-
#: class.bcn_admin.php:637 class.bcn_network_admin.php:709
|
529 |
-
msgid "The template for tag breadcrumbs."
|
530 |
-
msgstr ""
|
531 |
-
|
532 |
-
#: class.bcn_admin.php:638 class.bcn_network_admin.php:710
|
533 |
-
msgid "Tag Template (Unlinked)"
|
534 |
-
msgstr ""
|
535 |
-
|
536 |
-
#: class.bcn_admin.php:638 class.bcn_network_admin.php:710
|
537 |
-
msgid ""
|
538 |
-
"The template for tag breadcrumbs, used only when the breadcrumb is not "
|
539 |
-
"linked."
|
540 |
-
msgstr ""
|
541 |
-
|
542 |
-
#: class.bcn_admin.php:641 class.bcn_network_admin.php:713
|
543 |
-
msgid "Post Formats"
|
544 |
-
msgstr ""
|
545 |
-
|
546 |
-
#: class.bcn_admin.php:644 class.bcn_network_admin.php:716
|
547 |
-
msgid "Post Format Template"
|
548 |
-
msgstr ""
|
549 |
-
|
550 |
-
#: class.bcn_admin.php:644 class.bcn_network_admin.php:716
|
551 |
-
msgid "The template for post format breadcrumbs."
|
552 |
-
msgstr ""
|
553 |
-
|
554 |
-
#: class.bcn_admin.php:645 class.bcn_network_admin.php:717
|
555 |
-
msgid "Post Format Template (Unlinked)"
|
556 |
-
msgstr ""
|
557 |
-
|
558 |
-
#: class.bcn_admin.php:645 class.bcn_network_admin.php:717
|
559 |
-
msgid ""
|
560 |
-
"The template for post_format breadcrumbs, used only when the breadcrumb is "
|
561 |
-
"not linked."
|
562 |
-
msgstr ""
|
563 |
-
|
564 |
-
#: class.bcn_admin.php:675 class.bcn_network_admin.php:747
|
565 |
-
msgid ""
|
566 |
-
"The settings for author and date archives, searches, and 404 pages are "
|
567 |
-
"located under this tab."
|
568 |
-
msgstr ""
|
569 |
-
|
570 |
-
#: class.bcn_admin.php:675 class.bcn_admin.php:684
|
571 |
-
#: class.bcn_network_admin.php:747 class.bcn_network_admin.php:756
|
572 |
-
msgid "Miscellaneous"
|
573 |
-
msgstr ""
|
574 |
-
|
575 |
-
#: class.bcn_admin.php:676 class.bcn_network_admin.php:748
|
576 |
-
msgid "Author Archives"
|
577 |
-
msgstr ""
|
578 |
-
|
579 |
-
#: class.bcn_admin.php:679 class.bcn_network_admin.php:751
|
580 |
-
msgid "Author Template"
|
581 |
-
msgstr ""
|
582 |
-
|
583 |
-
#: class.bcn_admin.php:679 class.bcn_network_admin.php:751
|
584 |
-
msgid "The template for author breadcrumbs."
|
585 |
-
msgstr ""
|
586 |
-
|
587 |
-
#: class.bcn_admin.php:680 class.bcn_network_admin.php:752
|
588 |
-
msgid "Author Template (Unlinked)"
|
589 |
-
msgstr ""
|
590 |
-
|
591 |
-
#: class.bcn_admin.php:680 class.bcn_network_admin.php:752
|
592 |
-
msgid ""
|
593 |
-
"The template for author breadcrumbs, used only when the breadcrumb is not "
|
594 |
-
"linked."
|
595 |
-
msgstr ""
|
596 |
-
|
597 |
-
#: class.bcn_admin.php:681 class.bcn_network_admin.php:753
|
598 |
-
msgid "Author Display Format"
|
599 |
-
msgstr ""
|
600 |
-
|
601 |
-
#: class.bcn_admin.php:681 class.bcn_network_admin.php:753
|
602 |
-
msgid ""
|
603 |
-
"display_name uses the name specified in \"Display name publicly as\" under "
|
604 |
-
"the user profile the others correspond to options in the user profile."
|
605 |
-
msgstr ""
|
606 |
-
|
607 |
-
#: class.bcn_admin.php:687 class.bcn_network_admin.php:759
|
608 |
-
msgid "Date Template"
|
609 |
-
msgstr ""
|
610 |
-
|
611 |
-
#: class.bcn_admin.php:687 class.bcn_network_admin.php:759
|
612 |
-
msgid "The template for date breadcrumbs."
|
613 |
-
msgstr ""
|
614 |
-
|
615 |
-
#: class.bcn_admin.php:688 class.bcn_network_admin.php:760
|
616 |
-
msgid "Date Template (Unlinked)"
|
617 |
-
msgstr ""
|
618 |
-
|
619 |
-
#: class.bcn_admin.php:688 class.bcn_network_admin.php:760
|
620 |
-
msgid ""
|
621 |
-
"The template for date breadcrumbs, used only when the breadcrumb is not "
|
622 |
-
"linked."
|
623 |
-
msgstr ""
|
624 |
-
|
625 |
-
#: class.bcn_admin.php:689 class.bcn_network_admin.php:761
|
626 |
-
msgid "Search Template"
|
627 |
-
msgstr ""
|
628 |
-
|
629 |
-
#: class.bcn_admin.php:689 class.bcn_network_admin.php:761
|
630 |
-
msgid ""
|
631 |
-
"The anchor template for search breadcrumbs, used only when the search "
|
632 |
-
"results span several pages."
|
633 |
-
msgstr ""
|
634 |
-
|
635 |
-
#: class.bcn_admin.php:690 class.bcn_network_admin.php:762
|
636 |
-
msgid "Search Template (Unlinked)"
|
637 |
-
msgstr ""
|
638 |
-
|
639 |
-
#: class.bcn_admin.php:690 class.bcn_network_admin.php:762
|
640 |
-
msgid ""
|
641 |
-
"The anchor template for search breadcrumbs, used only when the search "
|
642 |
-
"results span several pages and the breadcrumb is not linked."
|
643 |
-
msgstr ""
|
644 |
-
|
645 |
-
#: class.bcn_admin.php:691 class.bcn_network_admin.php:763
|
646 |
-
msgid "404 Title"
|
647 |
-
msgstr ""
|
648 |
-
|
649 |
-
#: class.bcn_admin.php:692 class.bcn_network_admin.php:764
|
650 |
-
msgid "404 Template"
|
651 |
-
msgstr ""
|
652 |
-
|
653 |
-
#: class.bcn_admin.php:692 class.bcn_network_admin.php:764
|
654 |
-
msgid "The template for 404 breadcrumbs."
|
655 |
-
msgstr ""
|
656 |
-
|
657 |
-
#: class.bcn_admin.php:695 class.bcn_network_admin.php:767
|
658 |
-
msgid "Deprecated"
|
659 |
-
msgstr ""
|
660 |
-
|
661 |
-
#: class.bcn_admin.php:699 class.bcn_network_admin.php:771
|
662 |
-
msgid "Title Length"
|
663 |
-
msgstr ""
|
664 |
-
|
665 |
-
#: class.bcn_admin.php:704 class.bcn_network_admin.php:776
|
666 |
-
msgid ""
|
667 |
-
"Limit the length of the breadcrumb title. (Deprecated, %suse CSS instead%s)"
|
668 |
-
msgstr ""
|
669 |
-
|
670 |
-
#: class.bcn_admin.php:709 class.bcn_network_admin.php:781
|
671 |
-
msgid "Max Title Length: "
|
672 |
-
msgstr ""
|
673 |
-
|
674 |
-
#: class.bcn_admin.php:721 class.bcn_network_admin.php:793
|
675 |
-
msgid "Save Changes"
|
676 |
-
msgstr ""
|
677 |
-
|
678 |
-
#: class.bcn_breadcrumb.php:91
|
679 |
-
msgid ""
|
680 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><a property=\"item\" "
|
681 |
-
"typeof=\"WebPage\" title=\"Go to %title%.\" href=\"%link%\" class=\"%type%"
|
682 |
-
"\"><span property=\"name\">%htitle%</span></a><meta property=\"position\" "
|
683 |
-
"content=\"%position%\"></span>"
|
684 |
-
msgstr ""
|
685 |
-
|
686 |
-
#: class.bcn_breadcrumb_trail.php:77
|
687 |
-
msgid ""
|
688 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><span property=\"name"
|
689 |
-
"\">Page %htitle%</span><meta property=\"position\" content=\"%position%\"></"
|
690 |
-
"span>"
|
691 |
-
msgstr ""
|
692 |
-
|
693 |
-
#: class.bcn_breadcrumb_trail.php:102
|
694 |
-
msgid "404"
|
695 |
-
msgstr ""
|
696 |
-
|
697 |
-
#: class.bcn_breadcrumb_trail.php:105
|
698 |
-
msgid ""
|
699 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><span property=\"name"
|
700 |
-
"\">Search results for '<a property=\"item\" typeof=\"WebPage\" title="
|
701 |
-
"\"Go to the first page of search results for %title%.\" href=\"%link%\" "
|
702 |
-
"class=\"%type%\">%htitle%</a>'</span><meta property=\"position\" content="
|
703 |
-
"\"%position%\"></span>"
|
704 |
-
msgstr ""
|
705 |
-
|
706 |
-
#: class.bcn_breadcrumb_trail.php:107
|
707 |
-
msgid ""
|
708 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><span property=\"name"
|
709 |
-
"\">Search results for '%htitle%'</span><meta property=\"position\" "
|
710 |
-
"content=\"%position%\"></span>"
|
711 |
-
msgstr ""
|
712 |
-
|
713 |
-
#: class.bcn_breadcrumb_trail.php:110
|
714 |
-
msgid ""
|
715 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><a property=\"item\" "
|
716 |
-
"typeof=\"WebPage\" title=\"Go to the %title% tag archives.\" href=\"%link%\" "
|
717 |
-
"class=\"%type%\"><span property=\"name\">%htitle%</span></a><meta property="
|
718 |
-
"\"position\" content=\"%position%\"></span>"
|
719 |
-
msgstr ""
|
720 |
-
|
721 |
-
#: class.bcn_breadcrumb_trail.php:115 class.bcn_breadcrumb_trail.php:131
|
722 |
-
msgid ""
|
723 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><a property=\"item\" "
|
724 |
-
"typeof=\"WebPage\" title=\"Go to the %title% archives.\" href=\"%link%\" "
|
725 |
-
"class=\"%type%\"><span property=\"name\">%htitle%</span></a><meta property="
|
726 |
-
"\"position\" content=\"%position%\"></span>"
|
727 |
-
msgstr ""
|
728 |
-
|
729 |
-
#: class.bcn_breadcrumb_trail.php:120
|
730 |
-
msgid ""
|
731 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><span property=\"name"
|
732 |
-
"\">Articles by: <a title=\"Go to the first page of posts by %title%.\" href="
|
733 |
-
"\"%link%\" class=\"%type%\">%htitle%</a>"
|
734 |
-
msgstr ""
|
735 |
-
|
736 |
-
#: class.bcn_breadcrumb_trail.php:122
|
737 |
-
msgid ""
|
738 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><span property=\"name"
|
739 |
-
"\">Articles by: %htitle%</span><meta property=\"position\" content="
|
740 |
-
"\"%position%\"></span>"
|
741 |
-
msgstr ""
|
742 |
-
|
743 |
-
#: class.bcn_breadcrumb_trail.php:127
|
744 |
-
msgid ""
|
745 |
-
"<span property=\"itemListElement\" typeof=\"ListItem\"><a property=\"item\" "
|
746 |
-
"typeof=\"WebPage\" title=\"Go to the %title% category archives.\" href="
|
747 |
-
"\"%link%\" class=\"%type%\"><span property=\"name\">%htitle%</span></a><meta "
|
748 |
-
"property=\"position\" content=\"%position%\"></span>"
|
749 |
-
msgstr ""
|
750 |
-
|
751 |
-
#: class.bcn_breadcrumb_trail.php:465
|
752 |
-
msgid "$post global is not of type WP_Post"
|
753 |
-
msgstr ""
|
754 |
-
|
755 |
-
#: class.bcn_breadcrumb_trail.php:563
|
756 |
-
msgctxt "day archive breadcrumb date format"
|
757 |
-
msgid "d"
|
758 |
-
msgstr ""
|
759 |
-
|
760 |
-
#: class.bcn_breadcrumb_trail.php:583
|
761 |
-
msgctxt "month archive breadcrumb date format"
|
762 |
-
msgid "F"
|
763 |
-
msgstr ""
|
764 |
-
|
765 |
-
#: class.bcn_breadcrumb_trail.php:600
|
766 |
-
msgctxt "year archive breadcrumb date format"
|
767 |
-
msgid "Y"
|
768 |
-
msgstr ""
|
769 |
-
|
770 |
-
#: class.bcn_network_admin.php:63
|
771 |
-
msgid "Breadcrumb NavXT Network Settings"
|
772 |
-
msgstr ""
|
773 |
-
|
774 |
-
#: class.bcn_network_admin.php:458 class.bcn_network_admin.php:476
|
775 |
-
msgid ""
|
776 |
-
"Warning: Individual site settings will override any settings set in this "
|
777 |
-
"page."
|
778 |
-
msgstr ""
|
779 |
-
|
780 |
-
#: class.bcn_network_admin.php:466 class.bcn_network_admin.php:470
|
781 |
-
msgid ""
|
782 |
-
"Warning: Individual site settings may override any settings set in this page."
|
783 |
-
msgstr ""
|
784 |
-
|
785 |
-
#: class.bcn_widget.php:32
|
786 |
-
msgid "Adds a breadcrumb trail to your sidebar"
|
787 |
-
msgstr ""
|
788 |
-
|
789 |
-
#: class.bcn_widget.php:99
|
790 |
-
msgid "Title:"
|
791 |
-
msgstr ""
|
792 |
-
|
793 |
-
#: class.bcn_widget.php:103
|
794 |
-
msgid "Text to show before the trail:"
|
795 |
-
msgstr ""
|
796 |
-
|
797 |
-
#: class.bcn_widget.php:107
|
798 |
-
msgid "Output trail as:"
|
799 |
-
msgstr ""
|
800 |
-
|
801 |
-
#: class.bcn_widget.php:109
|
802 |
-
msgid "List"
|
803 |
-
msgstr ""
|
804 |
-
|
805 |
-
#: class.bcn_widget.php:110
|
806 |
-
msgid "Google (RDFa) Breadcrumbs"
|
807 |
-
msgstr ""
|
808 |
-
|
809 |
-
#: class.bcn_widget.php:111
|
810 |
-
msgid "Plain"
|
811 |
-
msgstr ""
|
812 |
-
|
813 |
-
#: class.bcn_widget.php:117
|
814 |
-
msgid "Link the breadcrumbs"
|
815 |
-
msgstr ""
|
816 |
-
|
817 |
-
#: class.bcn_widget.php:119
|
818 |
-
msgid "Reverse the order of the trail"
|
819 |
-
msgstr ""
|
820 |
-
|
821 |
-
#: class.bcn_widget.php:121
|
822 |
-
msgid "Hide the trail on the front page"
|
823 |
-
msgstr ""
|
824 |
-
|
825 |
-
#: includes/class.mtekk_adminkit.php:113
|
826 |
-
msgid "Insufficient privileges to proceed."
|
827 |
-
msgstr ""
|
828 |
-
|
829 |
-
#: includes/class.mtekk_adminkit.php:236
|
830 |
-
msgid "Settings"
|
831 |
-
msgstr ""
|
832 |
-
|
833 |
-
#: includes/class.mtekk_adminkit.php:312
|
834 |
-
msgid ""
|
835 |
-
"Your settings are for an older version of this plugin and need to be "
|
836 |
-
"migrated."
|
837 |
-
msgstr ""
|
838 |
-
|
839 |
-
#: includes/class.mtekk_adminkit.php:312 includes/class.mtekk_adminkit.php:321
|
840 |
-
msgid "Migrate the settings now."
|
841 |
-
msgstr ""
|
842 |
-
|
843 |
-
#: includes/class.mtekk_adminkit.php:312
|
844 |
-
msgid "Migrate now."
|
845 |
-
msgstr ""
|
846 |
-
|
847 |
-
#: includes/class.mtekk_adminkit.php:321
|
848 |
-
msgid "Your settings are for a newer version of this plugin."
|
849 |
-
msgstr ""
|
850 |
-
|
851 |
-
#: includes/class.mtekk_adminkit.php:321
|
852 |
-
msgid "Attempt back migration now."
|
853 |
-
msgstr ""
|
854 |
-
|
855 |
-
#: includes/class.mtekk_adminkit.php:329
|
856 |
-
msgid "Your plugin install is incomplete."
|
857 |
-
msgstr ""
|
858 |
-
|
859 |
-
#: includes/class.mtekk_adminkit.php:329
|
860 |
-
msgid "Load default settings now."
|
861 |
-
msgstr ""
|
862 |
-
|
863 |
-
#: includes/class.mtekk_adminkit.php:329
|
864 |
-
msgid "Complete now."
|
865 |
-
msgstr ""
|
866 |
-
|
867 |
-
#: includes/class.mtekk_adminkit.php:337
|
868 |
-
msgid "One or more of your plugin settings are invalid."
|
869 |
-
msgstr ""
|
870 |
-
|
871 |
-
#: includes/class.mtekk_adminkit.php:337
|
872 |
-
msgid "Attempt to fix settings now."
|
873 |
-
msgstr ""
|
874 |
-
|
875 |
-
#: includes/class.mtekk_adminkit.php:337
|
876 |
-
msgid "Fix now."
|
877 |
-
msgstr ""
|
878 |
-
|
879 |
-
#: includes/class.mtekk_adminkit.php:536
|
880 |
-
msgid "Settings successfully saved."
|
881 |
-
msgstr ""
|
882 |
-
|
883 |
-
#: includes/class.mtekk_adminkit.php:536 includes/class.mtekk_adminkit.php:549
|
884 |
-
msgid "Undo the options save."
|
885 |
-
msgstr ""
|
886 |
-
|
887 |
-
#: includes/class.mtekk_adminkit.php:536 includes/class.mtekk_adminkit.php:549
|
888 |
-
#: includes/class.mtekk_adminkit.php:654 includes/class.mtekk_adminkit.php:678
|
889 |
-
#: includes/class.mtekk_adminkit.php:695
|
890 |
-
msgid "Undo"
|
891 |
-
msgstr ""
|
892 |
-
|
893 |
-
#: includes/class.mtekk_adminkit.php:540
|
894 |
-
msgid "Settings did not change, nothing to save."
|
895 |
-
msgstr ""
|
896 |
-
|
897 |
-
#: includes/class.mtekk_adminkit.php:544
|
898 |
-
msgid "Settings were not saved."
|
899 |
-
msgstr ""
|
900 |
-
|
901 |
-
#: includes/class.mtekk_adminkit.php:549
|
902 |
-
msgid "Some settings were not saved."
|
903 |
-
msgstr ""
|
904 |
-
|
905 |
-
#: includes/class.mtekk_adminkit.php:550
|
906 |
-
msgid "The following settings were not saved:"
|
907 |
-
msgstr ""
|
908 |
-
|
909 |
-
#: includes/class.mtekk_adminkit.php:555
|
910 |
-
msgid "Please include this message in your %sbug report%s."
|
911 |
-
msgstr ""
|
912 |
-
|
913 |
-
#: includes/class.mtekk_adminkit.php:555
|
914 |
-
msgid "Go to the %s support post for your version."
|
915 |
-
msgstr ""
|
916 |
-
|
917 |
-
#: includes/class.mtekk_adminkit.php:654
|
918 |
-
msgid "Settings successfully imported from the uploaded file."
|
919 |
-
msgstr ""
|
920 |
-
|
921 |
-
#: includes/class.mtekk_adminkit.php:654
|
922 |
-
msgid "Undo the options import."
|
923 |
-
msgstr ""
|
924 |
-
|
925 |
-
#: includes/class.mtekk_adminkit.php:659
|
926 |
-
msgid "Importing settings from file failed."
|
927 |
-
msgstr ""
|
928 |
-
|
929 |
-
#: includes/class.mtekk_adminkit.php:678
|
930 |
-
msgid "Settings successfully reset to the default values."
|
931 |
-
msgstr ""
|
932 |
-
|
933 |
-
#: includes/class.mtekk_adminkit.php:678
|
934 |
-
msgid "Undo the options reset."
|
935 |
-
msgstr ""
|
936 |
-
|
937 |
-
#: includes/class.mtekk_adminkit.php:695
|
938 |
-
msgid "Settings successfully undid the last operation."
|
939 |
-
msgstr ""
|
940 |
-
|
941 |
-
#: includes/class.mtekk_adminkit.php:695
|
942 |
-
msgid "Undo the last undo operation."
|
943 |
-
msgstr ""
|
944 |
-
|
945 |
-
#: includes/class.mtekk_adminkit.php:730
|
946 |
-
msgid "Settings successfully migrated."
|
947 |
-
msgstr ""
|
948 |
-
|
949 |
-
#: includes/class.mtekk_adminkit.php:737
|
950 |
-
msgid "Default settings successfully installed."
|
951 |
-
msgstr ""
|
952 |
-
|
953 |
-
#: includes/class.mtekk_adminkit.php:833
|
954 |
-
msgid ""
|
955 |
-
"Import settings from a XML file, export the current settings to a XML file, "
|
956 |
-
"or reset to the default settings."
|
957 |
-
msgstr ""
|
958 |
-
|
959 |
-
#: includes/class.mtekk_adminkit.php:836
|
960 |
-
msgid "Settings File"
|
961 |
-
msgstr ""
|
962 |
-
|
963 |
-
#: includes/class.mtekk_adminkit.php:839
|
964 |
-
msgid "Select a XML settings file to upload and import settings from."
|
965 |
-
msgstr ""
|
966 |
-
|
967 |
-
#. Plugin Name of the plugin/theme
|
968 |
-
msgid "Breadcrumb NavXT"
|
969 |
-
msgstr ""
|
970 |
-
|
971 |
-
#. Plugin URI of the plugin/theme
|
972 |
-
msgid "http://mtekk.us/code/breadcrumb-navxt/"
|
973 |
-
msgstr ""
|
974 |
-
|
975 |
-
#. Description of the plugin/theme
|
976 |
-
msgid ""
|
977 |
-
"Adds a breadcrumb navigation showing the visitor's path to their current "
|
978 |
-
"location. For details on how to use this plugin visit <a href=\"http://mtekk."
|
979 |
-
"us/code/breadcrumb-navxt/\">Breadcrumb NavXT</a>."
|
980 |
-
msgstr ""
|
981 |
-
|
982 |
-
#. Author of the plugin/theme
|
983 |
-
msgid "John Havlik"
|
984 |
-
msgstr ""
|
985 |
-
|
986 |
-
#. Author URI of the plugin/theme
|
987 |
-
msgid "http://mtekk.us/"
|
988 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/readme.txt
DELETED
@@ -1,280 +0,0 @@
|
|
1 |
-
=== TX Breadcrumb ===
|
2 |
-
Contributors: mtekk, hakre
|
3 |
-
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=FD5XEU783BR8U&lc=US&item_name=Breadcrumb%20NavXT%20Donation¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
4 |
-
Tags: breadcrumb, breadcrumbs, trail, navigation, menu, widget
|
5 |
-
Requires at least: 4.7
|
6 |
-
Tested up to: 4.9
|
7 |
-
Stable tag: 6.1.0
|
8 |
-
Requires PHP: 5.3
|
9 |
-
License: GPLv2 or later
|
10 |
-
Adds breadcrumb navigation showing the visitor's path to their current location.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
TX Breadcrumb, the successor to the popular WordPress plugin Breadcrumb Navigation XT, was written from the ground up to be better than its ancestor. This plugin generates locational breadcrumb trails for your WordPress powered blog or website. These breadcrumb trails are highly customizable to suit the needs of just about any website running WordPress. The Administrative interface makes setting options easy, while a direct class access is available for theme developers and more adventurous users.
|
15 |
-
|
16 |
-
= PHP Requirements =
|
17 |
-
TX Breadcrumb 5.2 and newer require PHP5.3
|
18 |
-
TX Breadcrumb 5.1.1 and older require PHP5.2
|
19 |
-
|
20 |
-
= Features (non-exhaustive) =
|
21 |
-
* RDFa format Schema.org BreadcrumbList compatible breadcrumb generation.
|
22 |
-
* Extensive breadcrumb customization control via a settings page with appropriate default values for most use cases.
|
23 |
-
* Network admin settings page for managing breadcrumb settings for all subsites with [configurable global priority](http://mtekk.us/archives/guides/controlling-tx-breadcrumb-settings-from-the-network-settings-page/ "Go to the article on configuring the network settings priority.").
|
24 |
-
* Built in WordPress Widget.
|
25 |
-
* Extensible via OOP and provided [actions](http://mtekk.us/code/tx-breadcrumb/tx-breadcrumb-doc/2/#action_reference "Go to the TX Breadcrumb Documentation's action reference.") and [filters](http://mtekk.us/code/tx-breadcrumb/tx-breadcrumb-doc/2/#filter_reference "Go to the TX Breadcrumb Documentation's filter reference.").
|
26 |
-
* WPML compatible (enhanced compatibility with WPML extensions plugin).
|
27 |
-
* Polylang compatible (enhanced compatibility with Polylang extensions plugin).
|
28 |
-
* bbPress compatible (enhanced compatibility with bbPress extensions plugin).
|
29 |
-
* BuddyPress compatible (enhanced compatibility with BuddyPress extensions plugin).
|
30 |
-
|
31 |
-
= Translations =
|
32 |
-
|
33 |
-
TX Breadcrumb now supports WordPress.org language packs. Want to translate TX Breadcrumb? Visit [TX Breadcrumb's WordPress.org translation project](https://translate.wordpress.org/projects/wp-plugins/tx-breadcrumb/).
|
34 |
-
|
35 |
-
== Installation ==
|
36 |
-
TX Breadcrumb can be installed from within WordPress’ administration panel. After installing and activating the plugin, to get breadcrumb trails to display either use the included widget, or call the breadcrumb trail in your theme (or child theme). See the [Calling the Breadcrumb Trail](http://mtekk.us/archives/guides/calling-the-breadcrumb-trail "Read more on calling the breadcrumb trail") article for more information on calling the breadcrumb trail.
|
37 |
-
|
38 |
-
To customize the breadcrumb trail you may edit the default values for the options in the administrative interface. This is located in your administration panel under Settings > TX Breadcrumb.
|
39 |
-
|
40 |
-
Please visit [TX Breadcrumb's Documentation](http://mtekk.us/code/tx-breadcrumb/tx-breadcrumb-doc/ "Go to TX Breadcrumb's Documentation.") page for more information.
|
41 |
-
|
42 |
-
== Screenshots ==
|
43 |
-
1. This screenshot shows 5 different examples of breadcrumbs generated by TX Breadcrumb
|
44 |
-
2. A screenshot of the General tab of the settings page
|
45 |
-
3. A screenshot of the Post Types tab of the settings page
|
46 |
-
4. A screenshot of the Taxonomies tab of the settings page
|
47 |
-
5. A screenshot of the Miscellaneous tab of the settings page
|
48 |
-
6. A screenshot of the Settings Import/Export/Reset form under the Help menu
|
49 |
-
|
50 |
-
== Changelog ==
|
51 |
-
|
52 |
-
= 6.1.0 =
|
53 |
-
Release date: June, 1st 2018
|
54 |
-
|
55 |
-
*Behavior change: Links to generate support requests migrated to the WordPress.org forums.
|
56 |
-
*New feature: Added support for Schema.org BreadcrumbList (microdata format) in the included widget.
|
57 |
-
*New feature: Added new Root Page support for author archives.
|
58 |
-
*New feature: Added REST API endpoint for posts, terms, and author archives.
|
59 |
-
*Bug fix: Corrected label for the Schema.org BreadcrumbList (RDFa format) option in the included widget.
|
60 |
-
*Bug fix: Fixed issue where a PHP warning would be thrown due to `get_term()` returning something other than an instance of `WP_Term`.
|
61 |
-
|
62 |
-
= 6.0.4 =
|
63 |
-
Release date: January, 26th 2018
|
64 |
-
|
65 |
-
* Behavior change: Added auto migration of post type hierarchy settings to `bctx_display*()` functions.
|
66 |
-
* Bug fix: Fixed issue where a PHP notice would be generated on the page for posts when the blog breadcrumb display option is set to false.
|
67 |
-
* Bug fix: Fixed issue where a PHP notice would be generated on archive pages where attachments were included in the `wp_query` results.
|
68 |
-
|
69 |
-
= 6.0.3 =
|
70 |
-
Release date: January, 1st 2018
|
71 |
-
|
72 |
-
* Bug fix: Fixed issue where an improper breadcrumb would be generated in the trail for pages under some circumstances.
|
73 |
-
* Bug fix: Fixed issue where the post and page roots were not updating to track user changes in Settings > Reading.
|
74 |
-
|
75 |
-
= 6.0.2 =
|
76 |
-
Release date: December, 30th 2017
|
77 |
-
|
78 |
-
* Behavior change: Added warning alerting that `bctx_breadcrumb::type` must be an array.
|
79 |
-
* Bug fix: Changed Breadcrumb Separator and Paged Template from an input field to a textbox to reduce confusion caused by HTML entities.
|
80 |
-
* Bug fix: Fixed issue where the parents of a page may not show up in the breadcrumb trail.
|
81 |
-
* Bug fix: Fixed issue where the `$reverse` parameter for `bctx_display` and `bctx_display_list` did not work properly.
|
82 |
-
* Bug fix: Fixed issue where the `bctx_display_list` function did not include the `li` elements.
|
83 |
-
|
84 |
-
= 6.0.1 =
|
85 |
-
Release date: December, 28th 2017
|
86 |
-
|
87 |
-
* Behavior change: Removed unused Blog Template and Blog Template (Unlinked) from settings page.
|
88 |
-
* Bug fix: Fixed issue where changes to the hierarchy type for any post type would not save.
|
89 |
-
* Bug fix: Fixed issue where the blog display setting was ignored.
|
90 |
-
|
91 |
-
= 6.0.0 =
|
92 |
-
Release date: December, 26th 2017
|
93 |
-
|
94 |
-
* Behavior change: `bctx_breadcrumb_trail::display_list()` deprecated in favor of using the `$template` parameter in `bctx_breadcrumb_trail::display()`.
|
95 |
-
* Behavior change: `bctx_breadcrumb_trail::do_attachment()` deprecated in favor of calling `bctx_breadcrumb_trail::do_post()`.
|
96 |
-
* Behavior change: `bctx_breadcrumb_trail::do_front_page()` deprecated in favor of calling `bctx_breadcrumb_trail::do_home()`.
|
97 |
-
* Behavior change: `bctx_li_attributes` filter was deprecated in favor of `bctx_display_attributes`.
|
98 |
-
* Behavior change: `bctx_breadcrumb_trail::do_archive_by_date()` deprecated in favor of calling bctx_breadcrumb_trail::do_day()`, `bctx_breadcrumb_trail::do_month()`, and/or `bctx_breadcrumb_trail::do_year()`.
|
99 |
-
* Behavior change: `bctx_breadcrumb_trail::find_type()` deprecated and removed from bctx_breadcrumb_trail.
|
100 |
-
* Behavior change: Breadcrumb for 404 error pages changed to be a child of the front page.
|
101 |
-
* New feature: Added support for various HTML tags in the widget's pretext field.
|
102 |
-
* New feature: Added `bctx_default_hierarchy_display` filter.
|
103 |
-
* New feature: Added `bctx_default_hierarchy_type` filter.
|
104 |
-
* New feature: Added `$posttype_name` as the third parameter to `bctx_show_tax_private`.
|
105 |
-
* Bug fix: Fixed UI/UX issue in the settings screen where enabling/disabling settings groups for the Home, Blog, and Mainsite breadcrumb settings did not work.
|
106 |
-
* Bug fix: Fixed UI/UX issue in the settings screen where not including the paged breadcrumb still allowed the paged breadcrumb template to be edited.
|
107 |
-
* Bug fix: Removed use of `create_function` in registering the widget as it was deprecated in PHP 7.2.
|
108 |
-
|
109 |
-
= 5.7.1 =
|
110 |
-
Release date: June 30th, 2017
|
111 |
-
|
112 |
-
* Bug fix: Fixed erroneous use of `$linked` that caused a PHP warning in `bctx_display_json_ld()`.
|
113 |
-
* Bug fix: Fixed issue where removing a breadcrumb from the trail could cause one or more breadcrumb separators to inappropriately disappear.
|
114 |
-
|
115 |
-
= 5.7.0 =
|
116 |
-
Release date: April 21st, 2017
|
117 |
-
|
118 |
-
* New feature: Added `bctx_display_json_ld(`) function for producing Schema.org BreadcrumbList compliant JSON-LD markup.
|
119 |
-
* Bug fix: Fixed issue where the uninstaller caused PHP Errors when ran from WP CLI.
|
120 |
-
* Bug fix: Fixed issue where `bctx_breadcrumb_trail::find_type()` caused a PHP Warnings in certain circumstances.
|
121 |
-
* Bug fix: Fixed typo in the administrative interface.
|
122 |
-
|
123 |
-
= 5.6.0 =
|
124 |
-
Release date: December 23rd, 2016
|
125 |
-
|
126 |
-
* New feature: Added fourth parameter, `$force`, to `bctx_display()`, and `bctx_display_list()` allowing the internal caching mechanism to be bypassed.
|
127 |
-
* New feature: Moved to multiple line text boxes rather than regular single line text inputs for the breadcrumb templates in the settings page to enhance visibility.
|
128 |
-
* Bug fix: Fixed issue where general searches had the blog breadcrumb in the breadcrumb trail.
|
129 |
-
* Bug fix: Fixed issue where the blog breadcrumb options were erroneously made available when a Posts Page was not set.
|
130 |
-
|
131 |
-
= 5.5.2 =
|
132 |
-
Release date: September 30th, 2016
|
133 |
-
|
134 |
-
* Bug fix: Fixed issue where the “blog breadcrumb” setting does not affect the inclusion of the blog breadcrumb in the breadcrumb trail.
|
135 |
-
|
136 |
-
= 5.5.1 =
|
137 |
-
Release date: August 13th, 2016
|
138 |
-
|
139 |
-
* Bug fix: Fixed issue in `bctx_breadcrumb_trail::find_type()` that identified pages as posts, causing the erroneous inclusion of the post root in the breadcrumb trail for pages.
|
140 |
-
|
141 |
-
= 5.5.0 =
|
142 |
-
Release date: August 12th, 2016
|
143 |
-
|
144 |
-
* Behavior change: Internal mechanics to handle post parents as the hierarchy for a post (of any post type) has changed to use 'BCN_POST_PARENT' rather than 'page' for the taxonomy_type.
|
145 |
-
* Behavior change: Internal mechanics to handle dates as the hierarchy for a post (of any post type) has changed to use 'BCN_DATE' rather than 'date' for the taxonomy_type.
|
146 |
-
* Behavior change: Taxonomy term hierarchy selection logic in `bctx_breadcrumb_trail::pick_post_term()` has changed to picking the deepest known child of the first hierarchy found in the list of terms returned by `get_the_terms()` rather than the first term with a child.
|
147 |
-
* New feature: Added support for referer influenced taxonomy selection for a post's (any post type) breadcrumb trail.
|
148 |
-
* New feature: Added `translate` and `lang` as valid attributes for tags within breadcrumb templates.
|
149 |
-
* New feature: Added `srcset` and `sizes` as valid attributes for `img` tags within breadcrumb templates.
|
150 |
-
* New feature: Added `itemprop` as a valid attribute for the `meta` tags within breadcrumb templates.
|
151 |
-
* Bug fix: Fixed various issues caused by other plugins/themes modifying the `$post` global.
|
152 |
-
* Bug fix: Fixed issue where WPML Extensions would cause a CPT without a set root page to use the Post post type's root page.
|
153 |
-
|
154 |
-
= 5.4.0 =
|
155 |
-
Release date: March 15th, 2016
|
156 |
-
|
157 |
-
* Behavior change: Migrated to new adminKit version, some functions previously in the admin classes are now handled upstream.
|
158 |
-
* New feature: Added `bctx_post_terms` filter to `bctx_breadcrumb_trail::post_terms()` to control the terms included in a non-hierarchical term breadcrumb for a post.
|
159 |
-
* New feature: Added `bctx_add_post_type_arg` filter to `bctx_breadcrumb_trail::maybe_add_post_type_arg()` to control when the post_type argument is added to URLs for archives.
|
160 |
-
* New feature: Added `bctx_pick_post_term` filter to `bctx_breadcrumb_trail::post_hierarchy()` to allow overriding TX Breadcrumb’s default term selection behavior.
|
161 |
-
* Bug fix: Fixed issue with untranslatable title on the settings page.
|
162 |
-
* Bug fix: Cleanup of several trivial differences between `bctx_admin` and `bctx_network_admin`.
|
163 |
-
* Bug fix: Fixed improper display of “Your settings are out of date. Migrate now.” message on fresh installs.
|
164 |
-
* Bug fix: Clarified verbiage in regards to the paged breadcrumb.
|
165 |
-
* Bug fix: Added translation wrappers for date format strings in `bctx_breadcrumb_trail::do_archive_by_date()`.
|
166 |
-
* Bug fix: Fixed issue where `bctx_breadcrumb_trail::is_builtin()` would cause PHP warnings when the passed in post type was not an actual post type.
|
167 |
-
* Bug fix: Fixed issue that would cause a PHP error if `WP_Widget` is unavailable.
|
168 |
-
|
169 |
-
= 5.3.1 =
|
170 |
-
Release date: December 14th, 2015
|
171 |
-
|
172 |
-
* Bug fix: Fixed alignment issue of the main content of the settings page on WordPress 4.4.
|
173 |
-
* Bug fix: Fixed error caused by options upgrading not re-establishing new settings.
|
174 |
-
* Bug fix: Fixed PHP error caused by `bctx_breadcrumb_trail::get_type_string_query_var()` returning an array when the post_type query variable is an array.
|
175 |
-
|
176 |
-
= 5.3.0 =
|
177 |
-
Release date: November 12th, 2015
|
178 |
-
|
179 |
-
* Behavior change: TX Breadcrumb will no longer default to setting the root page for CPTs.
|
180 |
-
* Behavior change: TX Breadcrumb will no longer inject a breadcrumb for a CPT archive page if a root page is set for that CPT.
|
181 |
-
* Behavior change: TX Breadcrumb now defaults to `BCN_SETTINGS_USE_LOCAL` rather than `BCN_SETTINGS_USE_NETWORK` if all of the `BCN_SETTINGS_*` globals are not defined.
|
182 |
-
* Behavior change: The included widget now supports RDFA style, Schema.org BreadcrumbList format rather than the deprecated Google Breadcrumbs format.
|
183 |
-
* Behavior change: Default settings for breadcrumb templates now conform to RDFA style, Schema.org BreadcrumbList format rather than the deprecated Google Breadcrumbs format.
|
184 |
-
* New feature: Added `bctx_widget_display_trail` action to enhance the included widget’s extensibility.
|
185 |
-
* New feature: Added `bctx_widget_display_types` action to enhance the included widget’s extensibility.
|
186 |
-
* New feature: The plugin uninstaller has been re-factored, includes support for uninstalling in PHP5.2.
|
187 |
-
* New feature: Unit tests added for all non-deprecated features in bctx_breadcrumb.
|
188 |
-
* New feature: Unit tests added for the uninstaller.
|
189 |
-
* New feature: Date based hierarchies are now available for CPTs.
|
190 |
-
* New feature: Date archives restricted by CPT are now supported.
|
191 |
-
* New feature: Taxonomy archives restricted by CPT are now supported.
|
192 |
-
* Bug fix: Fixed issue where the multibyte supplicant functions were not always being included due to WordPress shipping with its own subset of theses functions.
|
193 |
-
* Bug fix: Fixed issue where on an archive for a post type the archive breadcrumb would appear twice.
|
194 |
-
|
195 |
-
= 5.2.2 =
|
196 |
-
Release date: June 1st, 2015
|
197 |
-
|
198 |
-
* Bug fix: Fixed issue where the current item would use a built in default template rather than the breadcrumb template in the settings.
|
199 |
-
* Bug fix: Updated currently distributed translations set and list to match the current set of translations that achieve the 90% completeness threshold for inclusion.
|
200 |
-
* Bug fix: Fixed issue where a PHP warning would be displayed when BCN_SETTINGS_USE_NETWORK is defined.
|
201 |
-
|
202 |
-
= 5.2.1 =
|
203 |
-
Release date: May 25th, 2015
|
204 |
-
|
205 |
-
* Bug fix: Added additional checks for empty URLs and templates within `bctx_breadcrumb` to prevent various bugs when empty URLs and/or templates are passed in.
|
206 |
-
* Bug fix: Move away from building URLs for search breadcrumbs and instead using `get_search_link()` to fix support for pretty permalinks.
|
207 |
-
* Bug fix: Fixed issue where media items (attachments) that have not been attached to a post yet would cause an incorrect breadcrumb trail to be generated.
|
208 |
-
* Bug fix: Fixed issue where attachments of the front page would cause PHP Warnings.
|
209 |
-
* Bug fix: Fixed issue where attachments of the front page would have duplicate breadcrumbs for the home page.
|
210 |
-
* Bug fix: Fixed issue where attachments of pages would have an extraneous breadcrumb relating to the page for posts.
|
211 |
-
* Bug fix: Fixed issue with the text domain/domain path in the plugin header.
|
212 |
-
|
213 |
-
= 5.2.0 =
|
214 |
-
Release date: January 9th, 2015
|
215 |
-
|
216 |
-
* Deprecated: The Max Breadcrumb Length setting has been deprecated in favor of [using CSS styling to perform the length limiting](http://mtekk.us/archives/guides/trimming-breadcrumb-title-lengths-with-css/ "Go to the article presenting how to shorten the breadcrumb title length using CSS").
|
217 |
-
* Behavior change: The archive page for a post type is now generated for the top ancestor post rather than for the current page when "post parent" is used as the post's hierarchy.
|
218 |
-
* Behavior change: Now requires PHP5.3 or newer.
|
219 |
-
* New feature: Added `bctx_type_archive_post_type` filter.
|
220 |
-
* New feature: Settings depending on another setting to be enabled are disabled when the dependency setting is disabled.
|
221 |
-
* New feature: More descriptive messages on settings saving (notify user on success, failure, and no changes to save).
|
222 |
-
* Bug fix: Fixed awkward wording in the settings page for post hierarchy settings.
|
223 |
-
* Bug fix: Fixed missed default templates for post formats when all taxonomy settings had the tax_ prefix added in 5.1.
|
224 |
-
* Bug fix: Fixed bulk of compatibility issues with bbPress.
|
225 |
-
|
226 |
-
= 5.1.1 =
|
227 |
-
Release date: July 29th, 2014
|
228 |
-
|
229 |
-
* Bug fix: Fixed issue where attachments and their parents have the same link when 'link current item' is enabled.
|
230 |
-
* Bug fix: Pass the same parameters into the widget title and (pre) text filters as the default WordPress widgets.
|
231 |
-
* Bug fix: Fixed issue where PHP warnings would be thrown on author pages for authors that do not have any posts.
|
232 |
-
* Bug fix: Reduced severity of `$post` global not being of type `WP_Post`, will silently exit on non-WP_DEBUG enabled sites.
|
233 |
-
|
234 |
-
= 5.1.0 =
|
235 |
-
Release date: June 9th, 2014
|
236 |
-
|
237 |
-
* Behavior change: `bctx_breadcrumb_trail::do_post()` now expects to be passed in a valid WP_Post object.
|
238 |
-
* Behavior change: `tx_breadcrumb::version` changed to a constant to allow uninstantiated access of the plugin version.
|
239 |
-
* New feature: Support Google's RDFa Breadcrumbs microformat by default.
|
240 |
-
* New feature: Added `bctx_opts_update_prebk` filter.
|
241 |
-
* Bug fix: Validate HTML5 options on tab traversal.
|
242 |
-
* Bug fix: Fixed issue where the settings importer parsed the version string incorrectly.
|
243 |
-
* Bug fix: Added 'typeof' to list of valid HTML tag attributes.
|
244 |
-
* Bug fix: Prefixed all taxonomies with 'tax_' to prevent name collisions.
|
245 |
-
* Bug fix: Added ID to Post and Taxonomy Term Elements in `bctx_breadcrumb_trail::do_root()` as is done everywhere else.
|
246 |
-
* Bug fix: Fixed issue with `bctx_breadcrumb_trail::do_author()` returning the incorrect user under some circumstances.
|
247 |
-
* Bug fix: Fixed issue where saving twice on a tab in the settings page would cause the next page load to open the general tab rather than the current tab.
|
248 |
-
* Bug fix: Added bctx_breadcrumb_template filter back into `bctx_breadcrumb::set_template()`, was a regression in 5.0 from 4.4.
|
249 |
-
* Bug fix: Fixed issue where the included widget did not check against default settings, causing PHP Warnings to show up on the frontend under some circumstances.
|
250 |
-
* Bug fix: Fixed issue where we didn't handle `WP_POST::has_archive` correctly when it was a string, causing issues with CPTs generated by some plugins.
|
251 |
-
* Bug fix: Fixed issue where the default taxonomy selected for a CPT could be a non-public taxonomy.
|
252 |
-
* Bug fix: Attachments get their own title within the settings page now.
|
253 |
-
* Bug fix: Filter the title and pre text in the widget.
|
254 |
-
|
255 |
-
= 5.0.1 =
|
256 |
-
Release date: December 31st, 2013
|
257 |
-
|
258 |
-
* Behavior Change: Notify multisite users when settings may be overridden by the network settings and vice versa.
|
259 |
-
* Bug fix: Updated tab style to match WordPress 3.8 look and feel.
|
260 |
-
* Bug fix: Fixed issue where `bctx_breadcrumb_trail::display_list()` would produce multiple instances of the class attribute.
|
261 |
-
* Bug fix: Fixed several issues with the uninstaller.
|
262 |
-
|
263 |
-
= 5.0.0 =
|
264 |
-
Release date: November 20th, 2013
|
265 |
-
|
266 |
-
* Behavior Change: Moved `bctx_breadcrumb_trail::trail` to `bctx_breadcrumb_trail::breadcrumbs`
|
267 |
-
* Behavior Change: When WordPress is in multisite/network mode, the settings set in the network settings page take priority over subsite settings.
|
268 |
-
* New feature: Added `bctx_breadcrumb_trail_object` filter.
|
269 |
-
* New feature: Added `bctx_li_attributes` filter.
|
270 |
-
* New feature: Added `bctx_breadcrumb_types` filter.
|
271 |
-
* New feature: Added Network Admin Settings page.
|
272 |
-
* New feature: Added `xmlns:v` and `property` to the valid tag attributes.
|
273 |
-
* Bug fix: The current_item breadcrumb for search results should result in a valid HTTPS link when appropriate.
|
274 |
-
|
275 |
-
== Upgrade Notice ==
|
276 |
-
= 6.0.0 =
|
277 |
-
This version requires PHP5.3 or newer. This version introduces three new filters and deprecates a filter.
|
278 |
-
|
279 |
-
= 5.6.0 =
|
280 |
-
This version requires PHP5.3 or newer. This version introduces a new 4th optional parameter to `bctx_display()` and `bctx_display_list()` that bypasses the internal caching mechanism.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/tx-breadcrumb.php
DELETED
@@ -1,571 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: TX Breadcrumb
|
4 |
-
Plugin URI: http://mtekk.us/code/tx-breadcrumb/
|
5 |
-
Description: Adds a breadcrumb navigation showing the visitor's path to their current location. For details on how to use this plugin visit <a href="http://mtekk.us/code/tx-breadcrumb/">TX Breadcrumb</a>.
|
6 |
-
Version: 6.1.0
|
7 |
-
Author: John Havlik
|
8 |
-
Author URI: http://mtekk.us/
|
9 |
-
License: GPL2
|
10 |
-
Text Domain: tx-breadcrumb
|
11 |
-
Domain Path: /languages
|
12 |
-
*/
|
13 |
-
/*
|
14 |
-
Copyright 2007-2018 John Havlik (email : john.havlik@mtekk.us)
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or modify
|
17 |
-
it under the terms of the GNU General Public License as published by
|
18 |
-
the Free Software Foundation; either version 2 of the License, or
|
19 |
-
(at your option) any later version.
|
20 |
-
|
21 |
-
This program is distributed in the hope that it will be useful,
|
22 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
-
GNU General Public License for more details.
|
25 |
-
|
26 |
-
You should have received a copy of the GNU General Public License
|
27 |
-
along with this program; if not, write to the Free Software
|
28 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
29 |
-
*/
|
30 |
-
//Do a PHP version check, require 5.3 or newer
|
31 |
-
if(version_compare(phpversion(), '5.3.0', '<'))
|
32 |
-
{
|
33 |
-
//Only purpose of this function is to echo out the PHP version error
|
34 |
-
function bctx_phpold()
|
35 |
-
{
|
36 |
-
printf('<div class="notice notice-error"><p>' . esc_html__('Your PHP version is too old, please upgrade to a newer version. Your version is %1$s, TX Breadcrumb requires %2$s', 'tx-breadcrumb') . '</p></div>', phpversion(), '5.3.0');
|
37 |
-
}
|
38 |
-
//If we are in the admin, let's print a warning then return
|
39 |
-
if(is_admin())
|
40 |
-
{
|
41 |
-
add_action('admin_notices', 'bctx_phpold');
|
42 |
-
}
|
43 |
-
return;
|
44 |
-
}
|
45 |
-
require_once(dirname(__FILE__) . '/includes/multibyte_supplicant.php');
|
46 |
-
//Include admin base class
|
47 |
-
if(!class_exists('mtekk_adminKit'))
|
48 |
-
{
|
49 |
-
require_once(dirname(__FILE__) . '/includes/class.mtekk_adminkit.php');
|
50 |
-
}
|
51 |
-
//Include the breadcrumb class
|
52 |
-
require_once(dirname(__FILE__) . '/class.bctx_breadcrumb.php');
|
53 |
-
//Include the breadcrumb trail class
|
54 |
-
require_once(dirname(__FILE__) . '/class.bctx_breadcrumb_trail.php');
|
55 |
-
if(class_exists('WP_Widget'))
|
56 |
-
{
|
57 |
-
//Include the WP 2.8+ widget class
|
58 |
-
require_once(dirname(__FILE__) . '/class.bctx_widget.php');
|
59 |
-
}
|
60 |
-
$tx_breadcrumb = null;
|
61 |
-
//TODO change to extends mtekk_plugKit
|
62 |
-
class tx_breadcrumb
|
63 |
-
{
|
64 |
-
const version = '6.1.0';
|
65 |
-
protected $name = 'TX Breadcrumb';
|
66 |
-
protected $identifier = 'tx-breadcrumb';
|
67 |
-
protected $unique_prefix = 'bctx';
|
68 |
-
protected $plugin_basename = null;
|
69 |
-
protected $opt = null;
|
70 |
-
protected $breadcrumb_trail = null;
|
71 |
-
protected $admin = null;
|
72 |
-
protected $rest_controller = null;
|
73 |
-
/**
|
74 |
-
* Constructor for a new tx_breadcrumb object
|
75 |
-
*
|
76 |
-
* @param bctx_breadcrumb_trail $breadcrumb_trail An instance of a bctx_breadcrumb_trail object to use for everything
|
77 |
-
*/
|
78 |
-
public function __construct(bctx_breadcrumb_trail $breadcrumb_trail)
|
79 |
-
{
|
80 |
-
//We get our breadcrumb trail object from our constructor
|
81 |
-
$this->breadcrumb_trail = $breadcrumb_trail;
|
82 |
-
//Grab defaults from the breadcrumb_trail object
|
83 |
-
$this->opt = $this->breadcrumb_trail->opt;
|
84 |
-
//We set the plugin basename here
|
85 |
-
$this->plugin_basename = plugin_basename(__FILE__);
|
86 |
-
//We need to add in the defaults for CPTs and custom taxonomies after all other plugins are loaded
|
87 |
-
add_action('wp_loaded', array($this, 'wp_loaded'), 15);
|
88 |
-
add_action('init', array($this, 'init'));
|
89 |
-
//Register the WordPress 2.8 Widget
|
90 |
-
add_action('widgets_init', array($this, 'register_widget'));
|
91 |
-
//Load our network admin if in the network dashboard (yes is_network_admin() doesn't exist)
|
92 |
-
if(defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN)
|
93 |
-
{
|
94 |
-
require_once(dirname(__FILE__) . '/class.bctx_network_admin.php');
|
95 |
-
//Instantiate our new admin object
|
96 |
-
$this->admin = new bctx_network_admin($this->breadcrumb_trail, $this->plugin_basename);
|
97 |
-
}
|
98 |
-
//Load our main admin if in the dashboard, but only if we're not in the network dashboard (prevents goofy bugs)
|
99 |
-
else if(is_admin() || defined('WP_UNINSTALL_PLUGIN'))
|
100 |
-
{
|
101 |
-
require_once(dirname(__FILE__) . '/class.bctx_admin.php');
|
102 |
-
//Instantiate our new admin object
|
103 |
-
$this->admin = new bctx_admin($this->breadcrumb_trail, $this->plugin_basename);
|
104 |
-
}
|
105 |
-
}
|
106 |
-
public function init()
|
107 |
-
{
|
108 |
-
tx_breadcrumb::setup_options($this->opt);
|
109 |
-
$this->get_settings();
|
110 |
-
add_filter('bctx_allowed_html', array($this, 'allowed_html'), 1, 1);
|
111 |
-
//We want to run late for using our breadcrumbs
|
112 |
-
add_filter('tha_breadcrumb_navigation', array($this, 'tha_compat'), 99);
|
113 |
-
//Only include the REST API if enabled
|
114 |
-
if(!defined('BCN_DISABLE_REST_API') || !BCN_DISABLE_REST_API)
|
115 |
-
{
|
116 |
-
require_once(dirname(__FILE__) . '/class.bctx_rest_controller.php');
|
117 |
-
$this->rest_controller = new bctx_rest_controller($this->breadcrumb_trail, $this->unique_prefix);
|
118 |
-
}
|
119 |
-
}
|
120 |
-
public function register_widget()
|
121 |
-
{
|
122 |
-
return register_widget($this->unique_prefix . '_widget');
|
123 |
-
}
|
124 |
-
public function allowed_html($tags)
|
125 |
-
{
|
126 |
-
$allowed_html = array(
|
127 |
-
'a' => array(
|
128 |
-
'href' => true,
|
129 |
-
'title' => true,
|
130 |
-
'class' => true,
|
131 |
-
'id' => true,
|
132 |
-
'media' => true,
|
133 |
-
'dir' => true,
|
134 |
-
'relList' => true,
|
135 |
-
'rel' => true,
|
136 |
-
'aria-hidden' => true,
|
137 |
-
'data-icon' => true,
|
138 |
-
'itemref' => true,
|
139 |
-
'itemid' => true,
|
140 |
-
'itemprop' => true,
|
141 |
-
'itemscope' => true,
|
142 |
-
'itemtype' => true,
|
143 |
-
'xmlns:v' => true,
|
144 |
-
'typeof' => true,
|
145 |
-
'property' => true,
|
146 |
-
'vocab' => true,
|
147 |
-
'translate' => true,
|
148 |
-
'lang' => true
|
149 |
-
),
|
150 |
-
'img' => array(
|
151 |
-
'alt' => true,
|
152 |
-
'align' => true,
|
153 |
-
'height' => true,
|
154 |
-
'width' => true,
|
155 |
-
'src' => true,
|
156 |
-
'srcset' => true,
|
157 |
-
'sizes' => true,
|
158 |
-
'id' => true,
|
159 |
-
'class' => true,
|
160 |
-
'aria-hidden' => true,
|
161 |
-
'data-icon' => true,
|
162 |
-
'itemref' => true,
|
163 |
-
'itemid' => true,
|
164 |
-
'itemprop' => true,
|
165 |
-
'itemscope' => true,
|
166 |
-
'itemtype' => true,
|
167 |
-
'xmlns:v' => true,
|
168 |
-
'typeof' => true,
|
169 |
-
'property' => true,
|
170 |
-
'vocab' => true,
|
171 |
-
'lang' => true
|
172 |
-
),
|
173 |
-
'span' => array(
|
174 |
-
'title' => true,
|
175 |
-
'class' => true,
|
176 |
-
'id' => true,
|
177 |
-
'dir' => true,
|
178 |
-
'align' => true,
|
179 |
-
'lang' => true,
|
180 |
-
'xml:lang' => true,
|
181 |
-
'aria-hidden' => true,
|
182 |
-
'data-icon' => true,
|
183 |
-
'itemref' => true,
|
184 |
-
'itemid' => true,
|
185 |
-
'itemprop' => true,
|
186 |
-
'itemscope' => true,
|
187 |
-
'itemtype' => true,
|
188 |
-
'xmlns:v' => true,
|
189 |
-
'typeof' => true,
|
190 |
-
'property' => true,
|
191 |
-
'vocab' => true,
|
192 |
-
'translate' => true,
|
193 |
-
'lang' => true
|
194 |
-
),
|
195 |
-
'h1' => array(
|
196 |
-
'title' => true,
|
197 |
-
'class' => true,
|
198 |
-
'id' => true,
|
199 |
-
'dir' => true,
|
200 |
-
'align' => true,
|
201 |
-
'lang' => true,
|
202 |
-
'xml:lang' => true,
|
203 |
-
'aria-hidden' => true,
|
204 |
-
'data-icon' => true,
|
205 |
-
'itemref' => true,
|
206 |
-
'itemid' => true,
|
207 |
-
'itemprop' => true,
|
208 |
-
'itemscope' => true,
|
209 |
-
'itemtype' => true,
|
210 |
-
'xmlns:v' => true,
|
211 |
-
'typeof' => true,
|
212 |
-
'property' => true,
|
213 |
-
'vocab' => true,
|
214 |
-
'translate' => true,
|
215 |
-
'lang' => true
|
216 |
-
),
|
217 |
-
'h2' => array(
|
218 |
-
'title' => true,
|
219 |
-
'class' => true,
|
220 |
-
'id' => true,
|
221 |
-
'dir' => true,
|
222 |
-
'align' => true,
|
223 |
-
'lang' => true,
|
224 |
-
'xml:lang' => true,
|
225 |
-
'aria-hidden' => true,
|
226 |
-
'data-icon' => true,
|
227 |
-
'itemref' => true,
|
228 |
-
'itemid' => true,
|
229 |
-
'itemprop' => true,
|
230 |
-
'itemscope' => true,
|
231 |
-
'itemtype' => true,
|
232 |
-
'xmlns:v' => true,
|
233 |
-
'typeof' => true,
|
234 |
-
'property' => true,
|
235 |
-
'vocab' => true,
|
236 |
-
'translate' => true,
|
237 |
-
'lang' => true
|
238 |
-
),
|
239 |
-
'meta' => array(
|
240 |
-
'content' => true,
|
241 |
-
'property' => true,
|
242 |
-
'vocab' => true,
|
243 |
-
'itemprop' => true
|
244 |
-
)
|
245 |
-
);
|
246 |
-
return mtekk_adminKit::array_merge_recursive($tags, $allowed_html);
|
247 |
-
}
|
248 |
-
public function get_version()
|
249 |
-
{
|
250 |
-
return self::version;
|
251 |
-
}
|
252 |
-
public function wp_loaded()
|
253 |
-
{
|
254 |
-
|
255 |
-
}
|
256 |
-
public function uninstall()
|
257 |
-
{
|
258 |
-
$this->admin->uninstall();
|
259 |
-
}
|
260 |
-
/**
|
261 |
-
* Sets up the extended options for any CPTs, taxonomies or extensions
|
262 |
-
*
|
263 |
-
* @param array $opt The options array, passed by reference
|
264 |
-
*/
|
265 |
-
static public function setup_options(&$opt)
|
266 |
-
{
|
267 |
-
//Add custom post types
|
268 |
-
tx_breadcrumb::find_posttypes($opt);
|
269 |
-
//Add custom taxonomy types
|
270 |
-
tx_breadcrumb::find_taxonomies($opt);
|
271 |
-
//Let others hook into our settings
|
272 |
-
$opt = apply_filters('bctx_settings_init', $opt);
|
273 |
-
}
|
274 |
-
/**
|
275 |
-
* Places settings into $opts array, if missing, for the registered post types
|
276 |
-
*
|
277 |
-
* @param array $opts
|
278 |
-
*/
|
279 |
-
static function find_posttypes(&$opts)
|
280 |
-
{
|
281 |
-
global $wp_post_types, $wp_taxonomies;
|
282 |
-
//Loop through all of the post types in the array
|
283 |
-
foreach($wp_post_types as $post_type)
|
284 |
-
{
|
285 |
-
//We only want custom post types
|
286 |
-
if(!$post_type->_builtin)
|
287 |
-
{
|
288 |
-
if(!isset($opts['bpost_' . $post_type->name . '_taxonomy_referer']))
|
289 |
-
{
|
290 |
-
//Default to not letting the refering page influence the referer
|
291 |
-
$opts['bpost_' . $post_type->name . '_taxonomy_referer'] = false;
|
292 |
-
}
|
293 |
-
//If the post type does not have settings in the options array yet, we need to load some defaults
|
294 |
-
if(!isset($opts['Hpost_' . $post_type->name . '_template']) || !$post_type->hierarchical && !isset($opts['Spost_' . $post_type->name . '_hierarchy_type']))
|
295 |
-
{
|
296 |
-
//Add the necessary option array members
|
297 |
-
$opts['Hpost_' . $post_type->name . '_template'] = bctx_breadcrumb::get_default_template();
|
298 |
-
$opts['Hpost_' . $post_type->name . '_template_no_anchor'] = bctx_breadcrumb::default_template_no_anchor;
|
299 |
-
if($post_type->has_archive == true || is_string($post_type->has_archive))
|
300 |
-
{
|
301 |
-
$opts['bpost_' . $post_type->name . '_archive_display'] = true;
|
302 |
-
}
|
303 |
-
else
|
304 |
-
{
|
305 |
-
$opts['bpost_' . $post_type->name . '_archive_display'] = false;
|
306 |
-
}
|
307 |
-
//Default to not showing a post_root
|
308 |
-
$opts['apost_' . $post_type->name . '_root'] = 0;
|
309 |
-
//Default to not displaying a taxonomy
|
310 |
-
$opts['bpost_' . $post_type->name . '_hierarchy_display'] = false;
|
311 |
-
//Loop through all of the possible taxonomies
|
312 |
-
foreach($wp_taxonomies as $taxonomy)
|
313 |
-
{
|
314 |
-
//Check for non-public taxonomies
|
315 |
-
if(!apply_filters('bctx_show_tax_private', $taxonomy->public, $taxonomy->name, $post_type->name))
|
316 |
-
{
|
317 |
-
continue;
|
318 |
-
}
|
319 |
-
//Activate the first taxonomy valid for this post type and exit the loop
|
320 |
-
if($taxonomy->object_type == $post_type->name || in_array($post_type->name, $taxonomy->object_type))
|
321 |
-
{
|
322 |
-
$opts['bpost_' . $post_type->name . '_hierarchy_display'] = true;
|
323 |
-
$opts['Spost_' . $post_type->name . '_hierarchy_type'] = $taxonomy->name;
|
324 |
-
break;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
//If there are no valid taxonomies for this type, setup our defaults
|
328 |
-
if(!isset($opts['Spost_' . $post_type->name . '_hierarchy_type']))
|
329 |
-
{
|
330 |
-
$opts['Spost_' . $post_type->name . '_hierarchy_type'] = 'BCN_DATE';
|
331 |
-
}
|
332 |
-
//Run through some filters, allowing extensions to directly influence the default hierarchy selection/display
|
333 |
-
$opts['Spost_' . $post_type->name . '_hierarchy_type'] = apply_filters('bctx_default_hierarchy_type', $opts['Spost_' . $post_type->name . '_hierarchy_type'], $post_type->name);
|
334 |
-
$opts['bpost_' . $post_type->name . '_hierarchy_display'] = apply_filters('bctx_default_hierarchy_display', $opts['bpost_' . $post_type->name . '_hierarchy_display'], $post_type->name, $opts['Spost_' . $post_type->name . '_hierarchy_type']);
|
335 |
-
}
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
/**
|
340 |
-
* Places settings into $opts array, if missing, for the registered taxonomies
|
341 |
-
*
|
342 |
-
* @param $opts
|
343 |
-
*/
|
344 |
-
static function find_taxonomies(&$opts)
|
345 |
-
{
|
346 |
-
global $wp_taxonomies;
|
347 |
-
//We'll add our custom taxonomy stuff at this time
|
348 |
-
foreach($wp_taxonomies as $taxonomy)
|
349 |
-
{
|
350 |
-
//We only want custom taxonomies
|
351 |
-
if(!$taxonomy->_builtin)
|
352 |
-
{
|
353 |
-
//If the taxonomy does not have settings in the options array yet, we need to load some defaults
|
354 |
-
if(!isset($opts['Htax_' . $taxonomy->name . '_template']))
|
355 |
-
{
|
356 |
-
//Add the necessary option array members
|
357 |
-
$opts['Htax_' . $taxonomy->name . '_template'] = __(sprintf('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %%title%% %s archives." href="%%link%%" class="%%type%%"><span property="name">%%htitle%%</span></a><meta property="position" content="%%position%%"></span>', $taxonomy->labels->singular_name), 'tx-breadcrumb');
|
358 |
-
$opts['Htax_' . $taxonomy->name . '_template_no_anchor'] = __(sprintf('<span property="itemListElement" typeof="ListItem"><span property="name">%%htitle%%</span><meta property="position" content="%%position%%"></span>', $taxonomy->labels->singular_name), 'tx-breadcrumb');
|
359 |
-
}
|
360 |
-
}
|
361 |
-
}
|
362 |
-
}
|
363 |
-
/**
|
364 |
-
* Hooks into the theme hook alliance tha_breadcrumb_navigation filter and replaces the trail
|
365 |
-
* with one generated by TX Breadcrumb
|
366 |
-
*
|
367 |
-
* @param string $bradcrumb_trail The string breadcrumb trail that we will replace
|
368 |
-
* @return string The TX Breadcrumb assembled breadcrumb trail
|
369 |
-
*/
|
370 |
-
public function tha_compat($breadcrumb_trail)
|
371 |
-
{
|
372 |
-
//Return our breadcrumb trail
|
373 |
-
return $this->display(true);
|
374 |
-
}
|
375 |
-
/**
|
376 |
-
* Function updates the breadcrumb_trail options array from the database in a semi intellegent manner
|
377 |
-
*
|
378 |
-
* @since 5.0.0
|
379 |
-
*/
|
380 |
-
private function get_settings()
|
381 |
-
{
|
382 |
-
//Grab the current settings for the current local site from the db
|
383 |
-
$this->breadcrumb_trail->opt = wp_parse_args(get_option('bctx_options'), $this->opt);
|
384 |
-
//If we're in multisite mode, look at the three BCN_SETTINGS globals
|
385 |
-
if(is_multisite())
|
386 |
-
{
|
387 |
-
if(defined('BCN_SETTINGS_USE_NETWORK') && BCN_SETTINGS_USE_NETWORK)
|
388 |
-
{
|
389 |
-
//Grab the current network wide settings
|
390 |
-
$this->breadcrumb_trail->opt = wp_parse_args(get_site_option('bctx_options'), $this->opt);
|
391 |
-
}
|
392 |
-
else if(defined('BCN_SETTINGS_FAVOR_LOCAL') && BCN_SETTINGS_FAVOR_LOCAL)
|
393 |
-
{
|
394 |
-
//Grab the current settings for the current local site from the db
|
395 |
-
$this->breadcrumb_trail->opt = wp_parse_args(get_option('bctx_options'), $this->breadcrumb_trail->opt);
|
396 |
-
}
|
397 |
-
else if(defined('BCN_SETTINGS_FAVOR_NETWORK') && BCN_SETTINGS_FAVOR_NETWORK)
|
398 |
-
{
|
399 |
-
//Grab the current settings from the db
|
400 |
-
$this->breadcrumb_trail->opt = wp_parse_args(get_site_option('bctx_options'), get_option('bctx_options'));
|
401 |
-
}
|
402 |
-
}
|
403 |
-
//Currently only support using post_parent for the page hierarchy
|
404 |
-
$this->breadcrumb_trail->opt['bpost_page_hierarchy_display'] = true;
|
405 |
-
$this->breadcrumb_trail->opt['Spost_page_hierarchy_type'] = 'BCN_POST_PARENT';
|
406 |
-
$this->breadcrumb_trail->opt['apost_page_root'] = get_option('page_on_front');
|
407 |
-
//This one isn't needed as it is performed in bctx_breadcrumb_trail::fill(), it's here for completeness only
|
408 |
-
$this->breadcrumb_trail->opt['apost_post_root'] = get_option('page_for_posts');
|
409 |
-
|
410 |
-
//Loop through all of the post types in the array, migrate automatically if necessary
|
411 |
-
foreach($GLOBALS['wp_post_types'] as $post_type)
|
412 |
-
{
|
413 |
-
if(isset($this->opt['Spost_' . $post_type->name . '_taxonomy_type']))
|
414 |
-
{
|
415 |
-
$this->opt['Spost_' . $post_type->name . '_hierarchy_type'] = $this->opt['Spost_' . $post_type->name . '_taxonomy_type'];
|
416 |
-
unset($this->opt['Spost_' . $post_type->name . '_taxonomy_type']);
|
417 |
-
}
|
418 |
-
if(isset($this->opt['Spost_' . $post_type->name . '_taxonomy_display']))
|
419 |
-
{
|
420 |
-
$this->opt['Spost_' . $post_type->name . '_hierarchy_display'] = $this->opt['Spost_' . $post_type->name . '_taxonomy_display'];
|
421 |
-
unset($this->opt['Spost_' . $post_type->name . '_taxonomy_display']);
|
422 |
-
}
|
423 |
-
}
|
424 |
-
}
|
425 |
-
/**
|
426 |
-
* Outputs the breadcrumb trail
|
427 |
-
*
|
428 |
-
* @param bool $return Whether to return or echo the trail.
|
429 |
-
* @param bool $linked Whether to allow hyperlinks in the trail or not.
|
430 |
-
* @param bool $reverse Whether to reverse the output or not.
|
431 |
-
* @param bool $force Whether or not to force the fill function to run.
|
432 |
-
* @param string $template The template to use for the string output.
|
433 |
-
*
|
434 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
435 |
-
* @return string String-Data of breadcrumb trail.
|
436 |
-
*/
|
437 |
-
public function display($return = false, $linked = true, $reverse = false, $force = false, $template = '%1$s%2$s')
|
438 |
-
{
|
439 |
-
//If we're being forced to fill the trail, clear it before calling fill
|
440 |
-
if($force)
|
441 |
-
{
|
442 |
-
$this->breadcrumb_trail->breadcrumbs = array();
|
443 |
-
}
|
444 |
-
//Generate the breadcrumb trail
|
445 |
-
$this->breadcrumb_trail->fill();
|
446 |
-
$trail_string = $this->breadcrumb_trail->display($linked, $reverse, $template);
|
447 |
-
if($return)
|
448 |
-
{
|
449 |
-
return $trail_string;
|
450 |
-
}
|
451 |
-
else
|
452 |
-
{
|
453 |
-
//Helps track issues, please don't remove it
|
454 |
-
$credits = "<!-- TX Breadcrumb " . $this::version . " -->\n";
|
455 |
-
echo $credits . $trail_string;
|
456 |
-
}
|
457 |
-
}
|
458 |
-
/**
|
459 |
-
* Outputs the breadcrumb trail with each element encapsulated with li tags
|
460 |
-
*
|
461 |
-
* @deprecated 6.0.0 No longer needed, superceeded by $template parameter in display
|
462 |
-
*
|
463 |
-
* @param bool $return Whether to return or echo the trail.
|
464 |
-
* @param bool $linked Whether to allow hyperlinks in the trail or not.
|
465 |
-
* @param bool $reverse Whether to reverse the output or not.
|
466 |
-
* @param bool $force Whether or not to force the fill function to run.
|
467 |
-
*
|
468 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
469 |
-
* @return string String-Data of breadcrumb trail.
|
470 |
-
*/
|
471 |
-
public function display_list($return = false, $linked = true, $reverse = false, $force = false)
|
472 |
-
{
|
473 |
-
_deprecated_function( __FUNCTION__, '6.0', 'tx_breadcrumb::display');
|
474 |
-
return $this->display($return, $linked, $reverse, $force, "<li%3\$s>%1\$s</li>\n");
|
475 |
-
}
|
476 |
-
/**
|
477 |
-
* Outputs the breadcrumb trail in Schema.org BreadcrumbList compatible JSON-LD
|
478 |
-
*
|
479 |
-
* @param bool $return Whether to return or echo the trail.
|
480 |
-
* @param bool $reverse Whether to reverse the output or not.
|
481 |
-
* @param bool $force Whether or not to force the fill function to run.
|
482 |
-
*
|
483 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
484 |
-
* @return string String-Data of breadcrumb trail.
|
485 |
-
*/
|
486 |
-
public function display_json_ld($return = false, $reverse = false, $force = false)
|
487 |
-
{
|
488 |
-
//If we're being forced to fill the trail, clear it before calling fill
|
489 |
-
if($force)
|
490 |
-
{
|
491 |
-
$this->breadcrumb_trail->breadcrumbs = array();
|
492 |
-
}
|
493 |
-
//Generate the breadcrumb trail
|
494 |
-
$this->breadcrumb_trail->fill();
|
495 |
-
$trail_string = json_encode($this->breadcrumb_trail->display_json_ld($reverse), JSON_UNESCAPED_SLASHES);
|
496 |
-
if($return)
|
497 |
-
{
|
498 |
-
return $trail_string;
|
499 |
-
}
|
500 |
-
else
|
501 |
-
{
|
502 |
-
echo $trail_string;
|
503 |
-
}
|
504 |
-
}
|
505 |
-
}
|
506 |
-
//Have to bootstrap our startup so that other plugins can replace the bctx_breadcrumb_trail object if they need to
|
507 |
-
add_action('plugins_loaded', 'bctx_init', 15);
|
508 |
-
function bctx_init()
|
509 |
-
{
|
510 |
-
global $tx_breadcrumb;
|
511 |
-
//Create an instance of bctx_breadcrumb_trail
|
512 |
-
$bctx_breadcrumb_trail = new bctx_breadcrumb_trail();
|
513 |
-
//Let's make an instance of our object that takes care of everything
|
514 |
-
$tx_breadcrumb = new tx_breadcrumb(apply_filters('bctx_breadcrumb_trail_object', $bctx_breadcrumb_trail));
|
515 |
-
}
|
516 |
-
/**
|
517 |
-
* Outputs the breadcrumb trail
|
518 |
-
*
|
519 |
-
* @param bool $return Whether to return or echo the trail. (optional)
|
520 |
-
* @param bool $linked Whether to allow hyperlinks in the trail or not. (optional)
|
521 |
-
* @param bool $reverse Whether to reverse the output or not. (optional)
|
522 |
-
* @param bool $force Whether or not to force the fill function to run. (optional)
|
523 |
-
*
|
524 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
525 |
-
* @return string String-Data of breadcrumb trail.
|
526 |
-
*/
|
527 |
-
function bctx_display($return = false, $linked = true, $reverse = false, $force = false)
|
528 |
-
{
|
529 |
-
global $tx_breadcrumb;
|
530 |
-
if($tx_breadcrumb !== null)
|
531 |
-
{
|
532 |
-
return $tx_breadcrumb->display($return, $linked, $reverse, $force);
|
533 |
-
}
|
534 |
-
}
|
535 |
-
/**
|
536 |
-
* Outputs the breadcrumb trail with each element encapsulated with li tags
|
537 |
-
*
|
538 |
-
* @param bool $return Whether to return or echo the trail. (optional)
|
539 |
-
* @param bool $linked Whether to allow hyperlinks in the trail or not. (optional)
|
540 |
-
* @param bool $reverse Whether to reverse the output or not. (optional)
|
541 |
-
* @param bool $force Whether or not to force the fill function to run. (optional)
|
542 |
-
*
|
543 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
544 |
-
* @return string String-Data of breadcrumb trail.
|
545 |
-
*/
|
546 |
-
function bctx_display_list($return = false, $linked = true, $reverse = false, $force = false)
|
547 |
-
{
|
548 |
-
global $tx_breadcrumb;
|
549 |
-
if($tx_breadcrumb !== null)
|
550 |
-
{
|
551 |
-
return $tx_breadcrumb->display($return, $linked, $reverse, $force, "<li%3\$s>%1\$s</li>\n");
|
552 |
-
}
|
553 |
-
}
|
554 |
-
/**
|
555 |
-
* Outputs the breadcrumb trail in Schema.org BreadcrumbList compatible JSON-LD
|
556 |
-
*
|
557 |
-
* @param bool $return Whether to return or echo the trail. (optional)
|
558 |
-
* @param bool $reverse Whether to reverse the output or not. (optional)
|
559 |
-
* @param bool $force Whether or not to force the fill function to run. (optional)
|
560 |
-
*
|
561 |
-
* @return void Void if Option to print out breadcrumb trail was chosen.
|
562 |
-
* @return string String-Data of breadcrumb trail.
|
563 |
-
*/
|
564 |
-
function bctx_display_json_ld($return = false, $reverse = false, $force = false)
|
565 |
-
{
|
566 |
-
global $tx_breadcrumb;
|
567 |
-
if($tx_breadcrumb !== null)
|
568 |
-
{
|
569 |
-
return $tx_breadcrumb->display_json_ld($return, $reverse, $force);
|
570 |
-
}
|
571 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/tx-breadcrumb/uninstall.php
DELETED
@@ -1,124 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* TX Breadcrumb - uninstall script
|
4 |
-
*
|
5 |
-
* uninstall script based on WordPress Uninstall Plugin API
|
6 |
-
*
|
7 |
-
*
|
8 |
-
* Because bctx_admin->uninstall() does not work with WPMU,
|
9 |
-
* an uninstaller class has been written, that encapsulates
|
10 |
-
* the uninstall logic and calls bctx_admin->uninstall()
|
11 |
-
* when applicable.
|
12 |
-
*
|
13 |
-
* @see http://codex.wordpress.org/Migrating_Plugins_and_Themes_to_2.7#Uninstall_Plugin_API
|
14 |
-
* @see http://trac.mu.wordpress.org/ticket/967
|
15 |
-
*
|
16 |
-
* this uninstall.php file was executed multiple times because
|
17 |
-
* tx breadcrumb (until 3.3) constsisted of two plugins:
|
18 |
-
*
|
19 |
-
* 1.) tx_breadcrumb_class.php / Core
|
20 |
-
* 2.) tx_breadcrumb_admin.php / Adminstration Interface
|
21 |
-
*
|
22 |
-
* @author Tom Klingenberg
|
23 |
-
*/
|
24 |
-
/*
|
25 |
-
Copyright 2010-2018 John Havlik (email : john.havlik@mtekk.us)
|
26 |
-
|
27 |
-
This program is free software; you can redistribute it and/or modify
|
28 |
-
it under the terms of the GNU General Public License as published by
|
29 |
-
the Free Software Foundation; either version 2 of the License, or
|
30 |
-
(at your option) any later version.
|
31 |
-
|
32 |
-
This program is distributed in the hope that it will be useful,
|
33 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
34 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
35 |
-
GNU General Public License for more details.
|
36 |
-
|
37 |
-
You should have received a copy of the GNU General Public License
|
38 |
-
along with this program; if not, write to the Free Software
|
39 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
40 |
-
*/
|
41 |
-
//Ensure the uninstall.php file was only called by WordPress and not directly
|
42 |
-
if(!defined('WP_UNINSTALL_PLUGIN'))
|
43 |
-
{
|
44 |
-
//First catches the Apache users
|
45 |
-
header("HTTP/1.0 404 Not Found");
|
46 |
-
//This should catch FastCGI users
|
47 |
-
header("Status: 404 Not Found");
|
48 |
-
die();
|
49 |
-
}
|
50 |
-
require_once(dirname(__FILE__) . '/includes/class.mtekk_adminkit_uninstaller.php');
|
51 |
-
|
52 |
-
/**
|
53 |
-
* TX Breadcrumb uninstaller class
|
54 |
-
*
|
55 |
-
* @author Tom Klingenberg
|
56 |
-
*/
|
57 |
-
class bctx_uninstaller extends mtekk_adminKit_uninstaller
|
58 |
-
{
|
59 |
-
protected $unique_prefix = 'bctx';
|
60 |
-
protected $plugin_basename = null;
|
61 |
-
|
62 |
-
public function __construct()
|
63 |
-
{
|
64 |
-
$this->plugin_basename = plugin_basename('/tx-breadcrumb.php');
|
65 |
-
parent::__construct();
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Options uninstallation function for legacy
|
69 |
-
*/
|
70 |
-
private function uninstall_legacy()
|
71 |
-
{
|
72 |
-
delete_option($this->unique_prefix . '_options');
|
73 |
-
delete_option($this->unique_prefix . '_options_bk');
|
74 |
-
delete_option($this->unique_prefix . '_version');
|
75 |
-
delete_site_option($this->unique_prefix . '_options');
|
76 |
-
delete_site_option($this->unique_prefix . '_options_bk');
|
77 |
-
delete_site_option($this->unique_prefix . '_version');
|
78 |
-
}
|
79 |
-
/**
|
80 |
-
* uninstall tx breadcrumb admin plugin
|
81 |
-
*
|
82 |
-
* @return bool
|
83 |
-
*/
|
84 |
-
private function uninstall_options()
|
85 |
-
{
|
86 |
-
if(version_compare(phpversion(), '5.3.0', '<'))
|
87 |
-
{
|
88 |
-
return $this->uninstall_legacy();
|
89 |
-
}
|
90 |
-
//Grab our global tx_breadcrumb object
|
91 |
-
global $tx_breadcrumb;
|
92 |
-
//Load dependencies if applicable
|
93 |
-
if(!class_exists('tx_breadcrumb'))
|
94 |
-
{
|
95 |
-
require_once($this->_get_plugin_path());
|
96 |
-
}
|
97 |
-
//Initalize $tx_breadcrumb so we can use it
|
98 |
-
$bctx_breadcrumb_trail = new bctx_breadcrumb_trail();
|
99 |
-
//Let's make an instance of our object takes care of everything
|
100 |
-
$tx_breadcrumb = new tx_breadcrumb($bctx_breadcrumb_trail);
|
101 |
-
//Uninstall
|
102 |
-
return $tx_breadcrumb->uninstall();
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* uninstall method
|
107 |
-
*
|
108 |
-
* @return bool wether or not uninstall did run successfull.
|
109 |
-
*/
|
110 |
-
public function uninstall()
|
111 |
-
{
|
112 |
-
//Only bother to do things if we have something in the database
|
113 |
-
if($this->is_installed())
|
114 |
-
{
|
115 |
-
return $this->uninstall_options();
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
} /// class bctx_uninstaller
|
120 |
-
|
121 |
-
/*
|
122 |
-
* main
|
123 |
-
*/
|
124 |
-
new bctx_uninstaller();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/woo-compare-wishlist/assets/css/tm-woocompare.css
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
width:100%;
|
28 |
min-width:100%;
|
29 |
table-layout:fixed;
|
|
|
30 |
}
|
31 |
.tm-woocompare-table.tablesaw {
|
32 |
min-width:0;
|
27 |
width:100%;
|
28 |
min-width:100%;
|
29 |
table-layout:fixed;
|
30 |
+
border: 1px solid #999;
|
31 |
}
|
32 |
.tm-woocompare-table.tablesaw {
|
33 |
min-width:0;
|
inc/woo-compare-wishlist/includes/compare/compare.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
if ( is_admin() ) {
|
4 |
require_once TX_WC_COMPARE_WISHLIST_PATH . 'includes/compare/settings.php';
|
5 |
}
|
6 |
-
if ( 'yes' !== get_option( 'tx_woocompare_enable' ) ) {
|
7 |
|
|
|
8 |
return;
|
9 |
}
|
10 |
require_once 'buttons.php';
|
@@ -16,9 +16,26 @@ if ( ! is_admin() ) {
|
|
16 |
require_once 'widget.php';
|
17 |
|
18 |
if ( ! session_id() ) {
|
19 |
-
|
20 |
session_start();
|
21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
// register action hooks
|
24 |
add_action( 'wp_enqueue_scripts', 'tx_woocompare_setup_plugin' );
|
@@ -200,7 +217,6 @@ function tx_woocompare_process_remove_button_action() {
|
|
200 |
function tx_woocompare_process_empty_button_action() {
|
201 |
|
202 |
tx_woocompare_set_list( array() );
|
203 |
-
|
204 |
tx_woocompare_process_ajax();
|
205 |
}
|
206 |
|
3 |
if ( is_admin() ) {
|
4 |
require_once TX_WC_COMPARE_WISHLIST_PATH . 'includes/compare/settings.php';
|
5 |
}
|
|
|
6 |
|
7 |
+
if ( 'yes' !== get_option( 'tx_woocompare_enable' ) ) {
|
8 |
return;
|
9 |
}
|
10 |
require_once 'buttons.php';
|
16 |
require_once 'widget.php';
|
17 |
|
18 |
if ( ! session_id() ) {
|
|
|
19 |
session_start();
|
20 |
}
|
21 |
+
/*
|
22 |
+
if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
|
23 |
+
if ( ! session_id() ) {
|
24 |
+
//session_start();
|
25 |
+
|
26 |
+
session_start(array(
|
27 |
+
'cache_limiter' => 'private_no_expire',
|
28 |
+
'read_and_close' => false,
|
29 |
+
));
|
30 |
+
session_write_close();
|
31 |
+
}
|
32 |
+
} else {
|
33 |
+
if ( ! session_id() ) {
|
34 |
+
session_start();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
*/
|
38 |
+
|
39 |
|
40 |
// register action hooks
|
41 |
add_action( 'wp_enqueue_scripts', 'tx_woocompare_setup_plugin' );
|
217 |
function tx_woocompare_process_empty_button_action() {
|
218 |
|
219 |
tx_woocompare_set_list( array() );
|
|
|
220 |
tx_woocompare_process_ajax();
|
221 |
}
|
222 |
|
inc/woo-compare-wishlist/includes/compare/settings.php
CHANGED
@@ -37,7 +37,7 @@ function tx_woocompare_get_settings() {
|
|
37 |
'id' => 'tx_woocompare_enable',
|
38 |
'title' => __( 'Enable compare', 'tx-tk' ),
|
39 |
'desc' => __( 'Enable compare functionality.', 'tx-tk' ),
|
40 |
-
'default' => '
|
41 |
),
|
42 |
array(
|
43 |
'type' => 'single_select_page',
|
37 |
'id' => 'tx_woocompare_enable',
|
38 |
'title' => __( 'Enable compare', 'tx-tk' ),
|
39 |
'desc' => __( 'Enable compare functionality.', 'tx-tk' ),
|
40 |
+
'default' => 'no',
|
41 |
),
|
42 |
array(
|
43 |
'type' => 'single_select_page',
|
inc/woo-compare-wishlist/includes/wishlist/wishlist.php
CHANGED
@@ -5,7 +5,6 @@ if ( is_admin() ) {
|
|
5 |
}
|
6 |
|
7 |
if ( 'yes' !== get_option( 'tx_woowishlist_enable' ) ) {
|
8 |
-
|
9 |
return;
|
10 |
}
|
11 |
require_once 'buttons.php';
|
@@ -102,8 +101,8 @@ function tx_woowishlist_set_list( $list ) {
|
|
102 |
$nonce = wp_create_nonce( implode( $list ) );
|
103 |
$value = implode( ':', array_merge( $list, array( $nonce ) ) );
|
104 |
if ( ! session_id() ) {
|
105 |
-
|
106 |
session_start();
|
|
|
107 |
}
|
108 |
$_SESSION['tm-woowishlist'] = $value;
|
109 |
}
|
5 |
}
|
6 |
|
7 |
if ( 'yes' !== get_option( 'tx_woowishlist_enable' ) ) {
|
|
|
8 |
return;
|
9 |
}
|
10 |
require_once 'buttons.php';
|
101 |
$nonce = wp_create_nonce( implode( $list ) );
|
102 |
$value = implode( ':', array_merge( $list, array( $nonce ) ) );
|
103 |
if ( ! session_id() ) {
|
|
|
104 |
session_start();
|
105 |
+
//session_write_close();
|
106 |
}
|
107 |
$_SESSION['tm-woowishlist'] = $value;
|
108 |
}
|
readme.txt
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
=== TemplatesNext ToolKit ===
|
2 |
Contributors: marsian
|
3 |
Tags: shortcode, shortcodes, columns, column, section, sections, portfolio, testimonial, border, borders, button, buttons, masonry, posts, post_type, font awesome, icons, fontawesome
|
4 |
-
Requires at least:
|
5 |
-
Tested up to: 5.
|
6 |
-
|
|
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
1 |
=== TemplatesNext ToolKit ===
|
2 |
Contributors: marsian
|
3 |
Tags: shortcode, shortcodes, columns, column, section, sections, portfolio, testimonial, border, borders, button, buttons, masonry, posts, post_type, font awesome, icons, fontawesome
|
4 |
+
Requires at least: 4.0
|
5 |
+
Tested up to: 5.5
|
6 |
+
Requires PHP: 5.6
|
7 |
+
Stable tag: 3.2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
tx-toolkit.php
CHANGED
@@ -2,11 +2,15 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: TemplatesNext ToolKit
|
|
|
5 |
Description: Custom Portfolio and Shortcode functionality for TemplatesNext Wordpress Themes
|
6 |
-
Version: 3.2.
|
7 |
Author: TemplatesNext
|
|
|
8 |
Author URI: http://templatesnext.org/
|
9 |
License: GPLv2 or later
|
|
|
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly.
|
2 |
|
3 |
/*
|
4 |
Plugin Name: TemplatesNext ToolKit
|
5 |
+
Plugin URI: https://www.templatesnext.org/icreate/templatesnext-toolkit/
|
6 |
Description: Custom Portfolio and Shortcode functionality for TemplatesNext Wordpress Themes
|
7 |
+
Version: 3.2.1
|
8 |
Author: TemplatesNext
|
9 |
+
Text Domain: tx
|
10 |
Author URI: http://templatesnext.org/
|
11 |
License: GPLv2 or later
|
12 |
+
Requires at least: 4.0
|
13 |
+
Requires PHP: 5.6
|
14 |
*/
|
15 |
|
16 |
// Exit if accessed directly.
|