Version Description
Download this release
Release Info
Developer | TemplateMonster 2002 |
Plugin | ![]() |
Version | 1.1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.0.1
- admin/assets/css/admin.css +1 -1
- admin/assets/js/admin.js +81 -81
- admin/assets/scss/admin.scss +36 -36
- admin/includes/class-tm-testimonials-admin.php +261 -261
- admin/includes/class-tm-testimonials-ajax.php +109 -109
- admin/includes/index.php +9 -9
- admin/index.php +9 -9
- admin/views/shortcode-settings.php +27 -27
- cherry-framework/cherry-core.php +469 -496
- cherry-framework/config.json +196 -174
- cherry-framework/languages/cherry-framework.pot +119 -69
- cherry-framework/modules/cherry-breadcrumbs/cherry-breadcrumbs.php +1597 -0
- cherry-framework/modules/cherry-customizer/assets/fonts/google.json +15622 -0
- cherry-framework/modules/cherry-customizer/assets/fonts/standard.json +209 -0
- cherry-framework/modules/cherry-customizer/cherry-customizer.php +1173 -0
- cherry-framework/modules/cherry-customizer/inc/class-cherry-wp-customize-iconpicker.php +105 -0
- cherry-framework/modules/cherry-db-updater/cherry-db-updater.php +379 -0
- cherry-framework/modules/cherry-dynamic-css/assets/cherry-css-collector.js +24 -0
- cherry-framework/modules/cherry-dynamic-css/assets/min/cherry-css-collector.min.js +1 -0
- cherry-framework/modules/cherry-dynamic-css/cherry-dynamic-css.php +543 -0
- cherry-framework/modules/cherry-dynamic-css/inc/class-cherry-dynamic-css-collector.php +281 -0
- cherry-framework/modules/cherry-dynamic-css/inc/class-cherry-dynamic-css-utilities.php +858 -0
- cherry-framework/modules/cherry-google-fonts-loader/cherry-google-fonts-loader.php +365 -0
- cherry-framework/modules/cherry-handler/assets/css/cherry-handler-styles.min.css +1 -1
- cherry-framework/modules/cherry-handler/assets/js/cherry-handler.js +309 -287
- cherry-framework/modules/cherry-handler/assets/js/min/cherry-handler.min.js +1 -1
- cherry-framework/modules/cherry-handler/assets/scss/cherry-handler-styles.scss +65 -65
- cherry-framework/modules/cherry-handler/cherry-handler.php +246 -233
- cherry-framework/modules/cherry-interface-builder/cherry-interface-builder.php +495 -471
- cherry-framework/modules/cherry-interface-builder/inc/assets/_use-in-js.scss +17 -17
- cherry-framework/modules/cherry-interface-builder/inc/assets/cherry-interface-builder.js +193 -189
- cherry-framework/modules/cherry-interface-builder/inc/assets/cherry-interface-builder.scss +503 -463
- cherry-framework/modules/cherry-interface-builder/inc/assets/min/cherry-interface-builder.min.css +1 -1
- cherry-framework/modules/cherry-interface-builder/inc/assets/min/cherry-interface-builder.min.js +1 -1
- cherry-framework/modules/cherry-interface-builder/inc/views/component-accordion.php +30 -30
- cherry-framework/modules/cherry-interface-builder/inc/views/component-repeater.php +30 -30
- cherry-framework/modules/cherry-interface-builder/inc/views/component-tab-horizontal.php +35 -35
- cherry-framework/modules/cherry-interface-builder/inc/views/component-tab-vertical.php +35 -35
- cherry-framework/modules/cherry-interface-builder/inc/views/component-toggle.php +30 -30
- cherry-framework/modules/cherry-interface-builder/inc/views/control.php +34 -34
- cherry-framework/modules/cherry-interface-builder/inc/views/form.php +24 -24
- cherry-framework/modules/cherry-interface-builder/inc/views/html.php +24 -24
- cherry-framework/modules/cherry-interface-builder/inc/views/section.php +36 -36
- cherry-framework/modules/cherry-interface-builder/inc/views/settings-children-title.php +18 -18
- cherry-framework/modules/cherry-interface-builder/inc/views/settings.php +32 -32
- cherry-framework/modules/cherry-interface-builder/inc/views/tab-children-title.php +20 -20
- cherry-framework/modules/cherry-interface-builder/inc/views/toggle-children-title.php +22 -22
- cherry-framework/modules/cherry-js-core/assets/js/cherry-js-core.js +100 -100
- cherry-framework/modules/cherry-js-core/assets/js/min/cherry-js-core.min.js +1 -1
- cherry-framework/modules/cherry-js-core/cherry-js-core.php +200 -184
- cherry-framework/modules/cherry-post-formats-api/assets/js/cherry-post-formats.js +68 -0
- cherry-framework/modules/cherry-post-formats-api/assets/js/min/cherry-post-formats.min.js +1 -0
- cherry-framework/modules/cherry-post-formats-api/cherry-post-formats-api.php +1121 -0
- cherry-framework/modules/cherry-post-formats-api/inc/class-cherry-facebook-embed.php +81 -0
- cherry-framework/modules/cherry-post-meta/cherry-post-meta.php +545 -547
- cherry-framework/modules/cherry-template-manager/cherry-template-manager.php +112 -0
- cherry-framework/modules/cherry-template-manager/inc/cherry-template-loader.php +193 -0
- cherry-framework/modules/cherry-template-manager/inc/cherry-template-parser.php +196 -0
- cherry-framework/modules/cherry-term-meta/cherry-term-meta.php +301 -0
- cherry-framework/modules/cherry-toolkit/cherry-toolkit.php +217 -219
- cherry-framework/modules/cherry-ui-elements/assets/sass/_lock.scss +110 -0
- cherry-framework/modules/cherry-ui-elements/cherry-ui-elements.php +170 -154
- cherry-framework/modules/cherry-ui-elements/i-ui.php +45 -45
- cherry-framework/modules/cherry-ui-elements/inc/class-cherry-lock-element.php +128 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/min/ui-button.min.css +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-button.scss +66 -52
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-kit/_mixins.scss +42 -182
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-kit/_variables.scss +46 -25
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/ui-button.php +86 -87
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/view/button-view.php +37 -31
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.css +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.js +58 -58
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.scss +65 -58
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-kit/_mixins.scss +184 -182
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-kit/_variables.scss +22 -22
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/ui-checkbox.php +154 -131
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.css +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.js +26 -26
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.scss +98 -53
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-kit/_mixins.scss +184 -182
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-kit/_variables.scss +22 -22
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/ui-colorpicker.php +114 -98
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/jquery-iconpicker.js +0 -445
admin/assets/css/admin.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.cherry-testi-option-form__buttons{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;padding:15px 30px}.cherry-testi-option-form__buttons button{position:relative;margin-left:15px}.cherry-testi-option-form__buttons svg{position:absolute;right:10px;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:inline;width:16px;height:16px;opacity:0;visibility:hidden;-webkit-transition:opacity .2s linear .1s, visibility .1s linear .2s;transition:opacity .2s linear .1s, visibility .1s linear .2s}.cherry-testi-option-form__buttons button[disabled] svg{opacity:1;visibility:visible}.cherry-testi-option-form__buttons circle{stroke:#fff}.cherry-testi-shortcode-title{color:initial}
|
1 |
+
.cherry-testi-option-form__buttons{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;padding:15px 30px}.cherry-testi-option-form__buttons button{position:relative;margin-left:15px}.cherry-testi-option-form__buttons svg{position:absolute;right:10px;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:inline;width:16px;height:16px;opacity:0;visibility:hidden;-webkit-transition:opacity .2s linear .1s, visibility .1s linear .2s;transition:opacity .2s linear .1s, visibility .1s linear .2s}.cherry-testi-option-form__buttons button[disabled] svg{opacity:1;visibility:visible}.cherry-testi-option-form__buttons circle{stroke:#fff}.cherry-testi-shortcode-title{color:initial}
|
admin/assets/js/admin.js
CHANGED
@@ -1,81 +1,81 @@
|
|
1 |
-
( function( $, CherryJsCore ) {
|
2 |
-
'use strict';
|
3 |
-
|
4 |
-
CherryJsCore.utilites.namespace( 'cherryTestiAdminScripts' );
|
5 |
-
|
6 |
-
CherryJsCore.cherryTestiAdminScripts = {
|
7 |
-
saveHandlerId: 'cherry_testi_save_setting',
|
8 |
-
resetHandlerId: 'cherry_testi_reset_setting',
|
9 |
-
saveButtonId: '#cherry-testi-option-form__save',
|
10 |
-
resetButtonId: '#cherry-testi-option-form__reset',
|
11 |
-
formId: '#cherry-testi-option-form',
|
12 |
-
saveOptionsInstance: null,
|
13 |
-
resetOptionsInstance: null,
|
14 |
-
|
15 |
-
init: function() {
|
16 |
-
this.saveOptionsInstance = new CherryJsCore.CherryAjaxHandler(
|
17 |
-
{
|
18 |
-
handlerId: this.saveHandlerId,
|
19 |
-
successCallback: this.saveSuccessCallback.bind( this )
|
20 |
-
}
|
21 |
-
);
|
22 |
-
|
23 |
-
this.resetOptionsInstance = new CherryJsCore.CherryAjaxHandler(
|
24 |
-
{
|
25 |
-
handlerId: this.resetHandlerId,
|
26 |
-
successCallback: this.resetSuccessCallback.bind( this )
|
27 |
-
}
|
28 |
-
);
|
29 |
-
|
30 |
-
this.addEvents();
|
31 |
-
},
|
32 |
-
|
33 |
-
addEvents: function() {
|
34 |
-
$( 'body' )
|
35 |
-
.on( 'click', this.saveButtonId, this.saveOptionsHandler.bind( this ) )
|
36 |
-
.on( 'click', this.resetButtonId, this.resetOptionsHandler.bind( this ) );
|
37 |
-
},
|
38 |
-
|
39 |
-
saveOptionsHandler: function( event ) {
|
40 |
-
this.disableButton( event.target );
|
41 |
-
this.saveOptionsInstance.sendFormData( this.formId );
|
42 |
-
},
|
43 |
-
|
44 |
-
resetOptionsHandler: function( event ) {
|
45 |
-
this.disableButton( event.target );
|
46 |
-
this.resetOptionsInstance.send();
|
47 |
-
},
|
48 |
-
|
49 |
-
resetSuccessCallback: function() {
|
50 |
-
this.enableButton( this.resetButtonId );
|
51 |
-
},
|
52 |
-
|
53 |
-
saveSuccessCallback: function() {
|
54 |
-
this.enableButton( this.saveButtonId );
|
55 |
-
},
|
56 |
-
|
57 |
-
disableButton: function( button ) {
|
58 |
-
$( button )
|
59 |
-
.attr( 'disabled', 'disabled' );
|
60 |
-
},
|
61 |
-
|
62 |
-
enableButton: function( button ) {
|
63 |
-
var timer = null;
|
64 |
-
|
65 |
-
$( button )
|
66 |
-
.removeAttr( 'disabled' )
|
67 |
-
.addClass( 'success' );
|
68 |
-
|
69 |
-
timer = setTimeout(
|
70 |
-
function() {
|
71 |
-
$( button ).removeClass( 'success' );
|
72 |
-
clearTimeout( timer );
|
73 |
-
},
|
74 |
-
1000
|
75 |
-
);
|
76 |
-
}
|
77 |
-
};
|
78 |
-
|
79 |
-
CherryJsCore.cherryTestiAdminScripts.init();
|
80 |
-
|
81 |
-
}( jQuery, window.CherryJsCore ) );
|
1 |
+
( function( $, CherryJsCore ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
CherryJsCore.utilites.namespace( 'cherryTestiAdminScripts' );
|
5 |
+
|
6 |
+
CherryJsCore.cherryTestiAdminScripts = {
|
7 |
+
saveHandlerId: 'cherry_testi_save_setting',
|
8 |
+
resetHandlerId: 'cherry_testi_reset_setting',
|
9 |
+
saveButtonId: '#cherry-testi-option-form__save',
|
10 |
+
resetButtonId: '#cherry-testi-option-form__reset',
|
11 |
+
formId: '#cherry-testi-option-form',
|
12 |
+
saveOptionsInstance: null,
|
13 |
+
resetOptionsInstance: null,
|
14 |
+
|
15 |
+
init: function() {
|
16 |
+
this.saveOptionsInstance = new CherryJsCore.CherryAjaxHandler(
|
17 |
+
{
|
18 |
+
handlerId: this.saveHandlerId,
|
19 |
+
successCallback: this.saveSuccessCallback.bind( this )
|
20 |
+
}
|
21 |
+
);
|
22 |
+
|
23 |
+
this.resetOptionsInstance = new CherryJsCore.CherryAjaxHandler(
|
24 |
+
{
|
25 |
+
handlerId: this.resetHandlerId,
|
26 |
+
successCallback: this.resetSuccessCallback.bind( this )
|
27 |
+
}
|
28 |
+
);
|
29 |
+
|
30 |
+
this.addEvents();
|
31 |
+
},
|
32 |
+
|
33 |
+
addEvents: function() {
|
34 |
+
$( 'body' )
|
35 |
+
.on( 'click', this.saveButtonId, this.saveOptionsHandler.bind( this ) )
|
36 |
+
.on( 'click', this.resetButtonId, this.resetOptionsHandler.bind( this ) );
|
37 |
+
},
|
38 |
+
|
39 |
+
saveOptionsHandler: function( event ) {
|
40 |
+
this.disableButton( event.target );
|
41 |
+
this.saveOptionsInstance.sendFormData( this.formId );
|
42 |
+
},
|
43 |
+
|
44 |
+
resetOptionsHandler: function( event ) {
|
45 |
+
this.disableButton( event.target );
|
46 |
+
this.resetOptionsInstance.send();
|
47 |
+
},
|
48 |
+
|
49 |
+
resetSuccessCallback: function() {
|
50 |
+
this.enableButton( this.resetButtonId );
|
51 |
+
},
|
52 |
+
|
53 |
+
saveSuccessCallback: function() {
|
54 |
+
this.enableButton( this.saveButtonId );
|
55 |
+
},
|
56 |
+
|
57 |
+
disableButton: function( button ) {
|
58 |
+
$( button )
|
59 |
+
.attr( 'disabled', 'disabled' );
|
60 |
+
},
|
61 |
+
|
62 |
+
enableButton: function( button ) {
|
63 |
+
var timer = null;
|
64 |
+
|
65 |
+
$( button )
|
66 |
+
.removeAttr( 'disabled' )
|
67 |
+
.addClass( 'success' );
|
68 |
+
|
69 |
+
timer = setTimeout(
|
70 |
+
function() {
|
71 |
+
$( button ).removeClass( 'success' );
|
72 |
+
clearTimeout( timer );
|
73 |
+
},
|
74 |
+
1000
|
75 |
+
);
|
76 |
+
}
|
77 |
+
};
|
78 |
+
|
79 |
+
CherryJsCore.cherryTestiAdminScripts.init();
|
80 |
+
|
81 |
+
}( jQuery, window.CherryJsCore ) );
|
admin/assets/scss/admin.scss
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
.cherry-testi-option-form__buttons {
|
2 |
-
display: flex;
|
3 |
-
justify-content: flex-end;
|
4 |
-
padding: 15px 30px;
|
5 |
-
}
|
6 |
-
|
7 |
-
.cherry-testi-option-form__buttons button {
|
8 |
-
position: relative;
|
9 |
-
margin-left: 15px;
|
10 |
-
}
|
11 |
-
|
12 |
-
.cherry-testi-option-form__buttons svg {
|
13 |
-
position: absolute;
|
14 |
-
right: 10px;
|
15 |
-
top: 50%;
|
16 |
-
transform: translateY(-50%);
|
17 |
-
display: inline;
|
18 |
-
width: 16px;
|
19 |
-
height: 16px;
|
20 |
-
opacity: 0;
|
21 |
-
visibility: hidden;
|
22 |
-
transition: opacity .2s linear .1s,
|
23 |
-
visibility .1s linear .2s;
|
24 |
-
}
|
25 |
-
|
26 |
-
.cherry-testi-option-form__buttons button[disabled] svg {
|
27 |
-
opacity: 1;
|
28 |
-
visibility: visible;
|
29 |
-
}
|
30 |
-
|
31 |
-
.cherry-testi-option-form__buttons circle {
|
32 |
-
stroke: #fff;
|
33 |
-
}
|
34 |
-
|
35 |
-
.cherry-testi-shortcode-title {
|
36 |
-
color: initial;
|
37 |
}
|
1 |
+
.cherry-testi-option-form__buttons {
|
2 |
+
display: flex;
|
3 |
+
justify-content: flex-end;
|
4 |
+
padding: 15px 30px;
|
5 |
+
}
|
6 |
+
|
7 |
+
.cherry-testi-option-form__buttons button {
|
8 |
+
position: relative;
|
9 |
+
margin-left: 15px;
|
10 |
+
}
|
11 |
+
|
12 |
+
.cherry-testi-option-form__buttons svg {
|
13 |
+
position: absolute;
|
14 |
+
right: 10px;
|
15 |
+
top: 50%;
|
16 |
+
transform: translateY(-50%);
|
17 |
+
display: inline;
|
18 |
+
width: 16px;
|
19 |
+
height: 16px;
|
20 |
+
opacity: 0;
|
21 |
+
visibility: hidden;
|
22 |
+
transition: opacity .2s linear .1s,
|
23 |
+
visibility .1s linear .2s;
|
24 |
+
}
|
25 |
+
|
26 |
+
.cherry-testi-option-form__buttons button[disabled] svg {
|
27 |
+
opacity: 1;
|
28 |
+
visibility: visible;
|
29 |
+
}
|
30 |
+
|
31 |
+
.cherry-testi-option-form__buttons circle {
|
32 |
+
stroke: #fff;
|
33 |
+
}
|
34 |
+
|
35 |
+
.cherry-testi-shortcode-title {
|
36 |
+
color: initial;
|
37 |
}
|
admin/includes/class-tm-testimonials-admin.php
CHANGED
@@ -1,261 +1,261 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Sets up the admin functionality for the plugin.
|
4 |
-
*
|
5 |
-
* @package Cherry_Testi
|
6 |
-
* @subpackage Admin
|
7 |
-
* @author Template Monster
|
8 |
-
* @license GPL-3.0+
|
9 |
-
* @copyright 2002-2016, Template Monster
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class for Testimonials admin functionality.
|
14 |
-
*
|
15 |
-
* @since 1.0.0
|
16 |
-
*/
|
17 |
-
class TM_Testimonials_Admin {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Holds the instances of this class.
|
21 |
-
*
|
22 |
-
* @since 1.0.0
|
23 |
-
* @var object
|
24 |
-
*/
|
25 |
-
private static $instance = null;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Sets up needed actions/filters for the admin to initialize.
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
* @return void
|
32 |
-
*/
|
33 |
-
public function __construct() {
|
34 |
-
$this->plugin = tm_testimonials_plugin();
|
35 |
-
$this->post_type = $this->plugin->get_post_type_name();
|
36 |
-
|
37 |
-
// Load post meta boxes on the post editing screen.
|
38 |
-
add_action( 'load-post.php', array( $this, 'metabox' ) );
|
39 |
-
add_action( 'load-post-new.php', array( $this, 'metabox' ) );
|
40 |
-
|
41 |
-
// Only run our customization on the 'edit.php' page in the admin.
|
42 |
-
add_action( 'load-edit.php', array( $this, 'manage_columns' ) );
|
43 |
-
|
44 |
-
// Modify the quick links in admin table list.
|
45 |
-
add_filter( 'post_row_actions', array( $this, 'modify_row_actions' ), 10, 2 );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Init `cherry-post-meta` module on the `Add New Testimonial` and `Edit Testimonial` screens.
|
50 |
-
*
|
51 |
-
* @since 1.0.0
|
52 |
-
*/
|
53 |
-
public function metabox() {
|
54 |
-
$screen = get_current_screen();
|
55 |
-
|
56 |
-
if ( empty( $screen->post_type ) || $this->post_type !== $screen->post_type ) {
|
57 |
-
return;
|
58 |
-
}
|
59 |
-
|
60 |
-
// Print custom styles.
|
61 |
-
add_action( 'admin_head', array( $this, 'print_styles' ) );
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Filter the array of metabox's fields.
|
65 |
-
*
|
66 |
-
* @since 1.0.0
|
67 |
-
*/
|
68 |
-
$metabox_args = apply_filters( 'tm_testimonials_metabox_args', array(
|
69 |
-
'id' => 'tm-testi-options',
|
70 |
-
'title' => esc_html__( 'Testimonial Options', 'cherry-testi' ),
|
71 |
-
'page' => $this->post_type,
|
72 |
-
'context' => 'side',
|
73 |
-
'priority' => 'core',
|
74 |
-
'callback_args' => false,
|
75 |
-
'single' => array( 'key' => TM_TESTI_POSTMETA ),
|
76 |
-
'fields' => array(
|
77 |
-
'email' => array(
|
78 |
-
'id' => TM_TESTI_POSTMETA . 'email',
|
79 |
-
'name' => TM_TESTI_POSTMETA . '[email]',
|
80 |
-
'type' => 'text',
|
81 |
-
'label' => esc_html__( 'Email:', 'cherry-testi' ),
|
82 |
-
'placeholder' => esc_html__( 'email@demolink.org', 'cherry-testi' ),
|
83 |
-
'value' => '',
|
84 |
-
'master' => 'tm-testi-ui-container',
|
85 |
-
),
|
86 |
-
'url' => array(
|
87 |
-
'id' => TM_TESTI_POSTMETA . 'url',
|
88 |
-
'name' => TM_TESTI_POSTMETA . '[url]',
|
89 |
-
'type' => 'text',
|
90 |
-
'label' => esc_html__( 'URL:', 'cherry-testi' ),
|
91 |
-
'placeholder' => esc_html__( 'http://demolink.org', 'cherry-testi' ),
|
92 |
-
'value' => '',
|
93 |
-
'master' => 'tm-testi-ui-container',
|
94 |
-
),
|
95 |
-
'position' => array(
|
96 |
-
'id' => TM_TESTI_POSTMETA . 'position',
|
97 |
-
'name' => TM_TESTI_POSTMETA . '[position]',
|
98 |
-
'type' => 'text',
|
99 |
-
'label' => esc_html__( 'Position:', 'cherry-testi' ),
|
100 |
-
'placeholder' => esc_html__( 'CEO/Founder', 'cherry-testi' ),
|
101 |
-
'value' => '',
|
102 |
-
'master' => 'tm-testi-ui-container',
|
103 |
-
),
|
104 |
-
'company' => array(
|
105 |
-
'id' => TM_TESTI_POSTMETA . 'company',
|
106 |
-
'name' => TM_TESTI_POSTMETA . '[company]',
|
107 |
-
'type' => 'text',
|
108 |
-
'label' => esc_html__( 'Company Name:', 'cherry-testi' ),
|
109 |
-
'placeholder' => esc_html__( 'Demo & Co', 'cherry-testi' ),
|
110 |
-
'value' => '',
|
111 |
-
'master' => 'tm-testi-ui-container',
|
112 |
-
),
|
113 |
-
),
|
114 |
-
) );
|
115 |
-
|
116 |
-
$this->plugin->get_core()->init_module( 'cherry-post-meta', $metabox_args );
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Adds a custom filter on 'request' when viewing the `Testimonials` screen in the admin.
|
121 |
-
*
|
122 |
-
* @since 1.0.0
|
123 |
-
*/
|
124 |
-
public function manage_columns() {
|
125 |
-
$screen = get_current_screen();
|
126 |
-
|
127 |
-
if ( empty( $screen->post_type ) || $this->post_type !== $screen->post_type ) {
|
128 |
-
return;
|
129 |
-
}
|
130 |
-
|
131 |
-
// Modify the columns on the `Testimonials` screen.
|
132 |
-
add_filter( "manage_edit-{$this->post_type}_columns", array( $this, 'columns' ) );
|
133 |
-
add_action( "manage_{$this->post_type}_posts_custom_column", array( $this, 'custom_column' ), 10, 2 );
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Filters the columns on the `Testimonials` screen.
|
138 |
-
*
|
139 |
-
* @since 1.0.0
|
140 |
-
* @param array $post_columns An array of column name => label.
|
141 |
-
* @return array
|
142 |
-
*/
|
143 |
-
public function columns( $post_columns ) {
|
144 |
-
|
145 |
-
unset(
|
146 |
-
$post_columns['author'],
|
147 |
-
$post_columns[ 'taxonomy-' . $this->post_type . '_category' ],
|
148 |
-
$post_columns['date']
|
149 |
-
);
|
150 |
-
|
151 |
-
// Add custom columns and overwrite the 'date' column.
|
152 |
-
$post_columns['thumbnail'] = esc_html__( 'Avatar', 'cherry-testi' );
|
153 |
-
$post_columns['author_name'] = esc_html__( 'Author Name', 'cherry-testi' );
|
154 |
-
$post_columns['position'] = esc_html__( 'Position', 'cherry-testi' );
|
155 |
-
$post_columns['company_name'] = esc_html__( 'Company Name', 'cherry-testi' );
|
156 |
-
$post_columns[ 'taxonomy-' . $this->post_type . '_category' ] = esc_html__( 'Category', 'cherry-testi' );
|
157 |
-
$post_columns['shortcode'] = esc_html__( 'Shortcode', 'cherry-testi' );
|
158 |
-
|
159 |
-
// Return the columns.
|
160 |
-
return $post_columns;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Add output for custom columns on the "menu items" screen.
|
165 |
-
*
|
166 |
-
* @since 1.0.0
|
167 |
-
* @param string $column The name of the column to display.
|
168 |
-
* @param int $post_id The ID of the current post.
|
169 |
-
*/
|
170 |
-
public function custom_column( $column, $post_id ) {
|
171 |
-
static $prefix = '';
|
172 |
-
|
173 |
-
if ( '' === $prefix ) {
|
174 |
-
$shortcode = TM_Testimonials_Shortcode::get_instance();
|
175 |
-
$prefix = $shortcode->get_prefix();
|
176 |
-
}
|
177 |
-
|
178 |
-
require_once( TM_TESTI_DIR . 'public/includes/class-tm-testimonials-template-callbacks.php' );
|
179 |
-
|
180 |
-
$callbacks = new TM_Testimonials_Template_Callbacks( array( 'size' => 50 ) );
|
181 |
-
|
182 |
-
switch ( $column ) {
|
183 |
-
case 'author_name':
|
184 |
-
$name = $callbacks->get_name();
|
185 |
-
echo empty( $name ) ? '—' : $name;
|
186 |
-
break;
|
187 |
-
|
188 |
-
case 'thumbnail':
|
189 |
-
$avatar = $callbacks->get_avatar();
|
190 |
-
echo empty( $avatar ) ? '—' : $avatar;
|
191 |
-
break;
|
192 |
-
|
193 |
-
case 'position':
|
194 |
-
$position = $callbacks->get_position();
|
195 |
-
echo empty( $position ) ? '—' : $position;
|
196 |
-
break;
|
197 |
-
|
198 |
-
case 'company_name':
|
199 |
-
$company_name = $callbacks->get_company();
|
200 |
-
echo empty( $company_name ) ? '—' : $company_name;
|
201 |
-
break;
|
202 |
-
|
203 |
-
case 'shortcode':
|
204 |
-
echo '<input style="width:100%" type="text" onfocus="this.select();" readonly="readonly" value="[' . $prefix . 'testimonials ids="' . $post_id . '"]">';
|
205 |
-
break;
|
206 |
-
|
207 |
-
default :
|
208 |
-
break;
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Modify the quick links.
|
214 |
-
*
|
215 |
-
* @since 1.0.1
|
216 |
-
* @param array $actions An array of row action links.
|
217 |
-
* @param WP_Post $post The post object.
|
218 |
-
* @return array
|
219 |
-
*/
|
220 |
-
public function modify_row_actions( $actions, $post ) {
|
221 |
-
|
222 |
-
if ( $post->post_type == $this->post_type && isset( $actions['inline hide-if-no-js'] ) ) {
|
223 |
-
|
224 |
-
// Remove `Quick Edit`.
|
225 |
-
unset( $actions['inline hide-if-no-js'] );
|
226 |
-
}
|
227 |
-
|
228 |
-
return $actions;
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Print styles.
|
233 |
-
*
|
234 |
-
* @since 1.0.0
|
235 |
-
*/
|
236 |
-
public function print_styles() {
|
237 |
-
?>
|
238 |
-
<style type="text/css">
|
239 |
-
.tm-testi-ui-container { padding-right: 0; padding-left: 0; }
|
240 |
-
.tm-testi-ui-container .cherry-control__content { flex: auto; }
|
241 |
-
</style>
|
242 |
-
<?php }
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Returns the instance.
|
246 |
-
*
|
247 |
-
* @since 1.0.0
|
248 |
-
* @return object
|
249 |
-
*/
|
250 |
-
public static function get_instance() {
|
251 |
-
|
252 |
-
// If the single instance hasn't been set, set it now.
|
253 |
-
if ( null == self::$instance ) {
|
254 |
-
self::$instance = new self;
|
255 |
-
}
|
256 |
-
|
257 |
-
return self::$instance;
|
258 |
-
}
|
259 |
-
}
|
260 |
-
|
261 |
-
TM_Testimonials_Admin::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sets up the admin functionality for the plugin.
|
4 |
+
*
|
5 |
+
* @package Cherry_Testi
|
6 |
+
* @subpackage Admin
|
7 |
+
* @author Template Monster
|
8 |
+
* @license GPL-3.0+
|
9 |
+
* @copyright 2002-2016, Template Monster
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class for Testimonials admin functionality.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*/
|
17 |
+
class TM_Testimonials_Admin {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Holds the instances of this class.
|
21 |
+
*
|
22 |
+
* @since 1.0.0
|
23 |
+
* @var object
|
24 |
+
*/
|
25 |
+
private static $instance = null;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Sets up needed actions/filters for the admin to initialize.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function __construct() {
|
34 |
+
$this->plugin = tm_testimonials_plugin();
|
35 |
+
$this->post_type = $this->plugin->get_post_type_name();
|
36 |
+
|
37 |
+
// Load post meta boxes on the post editing screen.
|
38 |
+
add_action( 'load-post.php', array( $this, 'metabox' ) );
|
39 |
+
add_action( 'load-post-new.php', array( $this, 'metabox' ) );
|
40 |
+
|
41 |
+
// Only run our customization on the 'edit.php' page in the admin.
|
42 |
+
add_action( 'load-edit.php', array( $this, 'manage_columns' ) );
|
43 |
+
|
44 |
+
// Modify the quick links in admin table list.
|
45 |
+
add_filter( 'post_row_actions', array( $this, 'modify_row_actions' ), 10, 2 );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Init `cherry-post-meta` module on the `Add New Testimonial` and `Edit Testimonial` screens.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*/
|
53 |
+
public function metabox() {
|
54 |
+
$screen = get_current_screen();
|
55 |
+
|
56 |
+
if ( empty( $screen->post_type ) || $this->post_type !== $screen->post_type ) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
// Print custom styles.
|
61 |
+
add_action( 'admin_head', array( $this, 'print_styles' ) );
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Filter the array of metabox's fields.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*/
|
68 |
+
$metabox_args = apply_filters( 'tm_testimonials_metabox_args', array(
|
69 |
+
'id' => 'tm-testi-options',
|
70 |
+
'title' => esc_html__( 'Testimonial Options', 'cherry-testi' ),
|
71 |
+
'page' => $this->post_type,
|
72 |
+
'context' => 'side',
|
73 |
+
'priority' => 'core',
|
74 |
+
'callback_args' => false,
|
75 |
+
'single' => array( 'key' => TM_TESTI_POSTMETA ),
|
76 |
+
'fields' => array(
|
77 |
+
'email' => array(
|
78 |
+
'id' => TM_TESTI_POSTMETA . 'email',
|
79 |
+
'name' => TM_TESTI_POSTMETA . '[email]',
|
80 |
+
'type' => 'text',
|
81 |
+
'label' => esc_html__( 'Email:', 'cherry-testi' ),
|
82 |
+
'placeholder' => esc_html__( 'email@demolink.org', 'cherry-testi' ),
|
83 |
+
'value' => '',
|
84 |
+
'master' => 'tm-testi-ui-container',
|
85 |
+
),
|
86 |
+
'url' => array(
|
87 |
+
'id' => TM_TESTI_POSTMETA . 'url',
|
88 |
+
'name' => TM_TESTI_POSTMETA . '[url]',
|
89 |
+
'type' => 'text',
|
90 |
+
'label' => esc_html__( 'URL:', 'cherry-testi' ),
|
91 |
+
'placeholder' => esc_html__( 'http://demolink.org', 'cherry-testi' ),
|
92 |
+
'value' => '',
|
93 |
+
'master' => 'tm-testi-ui-container',
|
94 |
+
),
|
95 |
+
'position' => array(
|
96 |
+
'id' => TM_TESTI_POSTMETA . 'position',
|
97 |
+
'name' => TM_TESTI_POSTMETA . '[position]',
|
98 |
+
'type' => 'text',
|
99 |
+
'label' => esc_html__( 'Position:', 'cherry-testi' ),
|
100 |
+
'placeholder' => esc_html__( 'CEO/Founder', 'cherry-testi' ),
|
101 |
+
'value' => '',
|
102 |
+
'master' => 'tm-testi-ui-container',
|
103 |
+
),
|
104 |
+
'company' => array(
|
105 |
+
'id' => TM_TESTI_POSTMETA . 'company',
|
106 |
+
'name' => TM_TESTI_POSTMETA . '[company]',
|
107 |
+
'type' => 'text',
|
108 |
+
'label' => esc_html__( 'Company Name:', 'cherry-testi' ),
|
109 |
+
'placeholder' => esc_html__( 'Demo & Co', 'cherry-testi' ),
|
110 |
+
'value' => '',
|
111 |
+
'master' => 'tm-testi-ui-container',
|
112 |
+
),
|
113 |
+
),
|
114 |
+
) );
|
115 |
+
|
116 |
+
$this->plugin->get_core()->init_module( 'cherry-post-meta', $metabox_args );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Adds a custom filter on 'request' when viewing the `Testimonials` screen in the admin.
|
121 |
+
*
|
122 |
+
* @since 1.0.0
|
123 |
+
*/
|
124 |
+
public function manage_columns() {
|
125 |
+
$screen = get_current_screen();
|
126 |
+
|
127 |
+
if ( empty( $screen->post_type ) || $this->post_type !== $screen->post_type ) {
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
|
131 |
+
// Modify the columns on the `Testimonials` screen.
|
132 |
+
add_filter( "manage_edit-{$this->post_type}_columns", array( $this, 'columns' ) );
|
133 |
+
add_action( "manage_{$this->post_type}_posts_custom_column", array( $this, 'custom_column' ), 10, 2 );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Filters the columns on the `Testimonials` screen.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
* @param array $post_columns An array of column name => label.
|
141 |
+
* @return array
|
142 |
+
*/
|
143 |
+
public function columns( $post_columns ) {
|
144 |
+
|
145 |
+
unset(
|
146 |
+
$post_columns['author'],
|
147 |
+
$post_columns[ 'taxonomy-' . $this->post_type . '_category' ],
|
148 |
+
$post_columns['date']
|
149 |
+
);
|
150 |
+
|
151 |
+
// Add custom columns and overwrite the 'date' column.
|
152 |
+
$post_columns['thumbnail'] = esc_html__( 'Avatar', 'cherry-testi' );
|
153 |
+
$post_columns['author_name'] = esc_html__( 'Author Name', 'cherry-testi' );
|
154 |
+
$post_columns['position'] = esc_html__( 'Position', 'cherry-testi' );
|
155 |
+
$post_columns['company_name'] = esc_html__( 'Company Name', 'cherry-testi' );
|
156 |
+
$post_columns[ 'taxonomy-' . $this->post_type . '_category' ] = esc_html__( 'Category', 'cherry-testi' );
|
157 |
+
$post_columns['shortcode'] = esc_html__( 'Shortcode', 'cherry-testi' );
|
158 |
+
|
159 |
+
// Return the columns.
|
160 |
+
return $post_columns;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Add output for custom columns on the "menu items" screen.
|
165 |
+
*
|
166 |
+
* @since 1.0.0
|
167 |
+
* @param string $column The name of the column to display.
|
168 |
+
* @param int $post_id The ID of the current post.
|
169 |
+
*/
|
170 |
+
public function custom_column( $column, $post_id ) {
|
171 |
+
static $prefix = '';
|
172 |
+
|
173 |
+
if ( '' === $prefix ) {
|
174 |
+
$shortcode = TM_Testimonials_Shortcode::get_instance();
|
175 |
+
$prefix = $shortcode->get_prefix();
|
176 |
+
}
|
177 |
+
|
178 |
+
require_once( TM_TESTI_DIR . 'public/includes/class-tm-testimonials-template-callbacks.php' );
|
179 |
+
|
180 |
+
$callbacks = new TM_Testimonials_Template_Callbacks( array( 'size' => 50 ) );
|
181 |
+
|
182 |
+
switch ( $column ) {
|
183 |
+
case 'author_name':
|
184 |
+
$name = $callbacks->get_name();
|
185 |
+
echo empty( $name ) ? '—' : $name;
|
186 |
+
break;
|
187 |
+
|
188 |
+
case 'thumbnail':
|
189 |
+
$avatar = $callbacks->get_avatar();
|
190 |
+
echo empty( $avatar ) ? '—' : $avatar;
|
191 |
+
break;
|
192 |
+
|
193 |
+
case 'position':
|
194 |
+
$position = $callbacks->get_position();
|
195 |
+
echo empty( $position ) ? '—' : $position;
|
196 |
+
break;
|
197 |
+
|
198 |
+
case 'company_name':
|
199 |
+
$company_name = $callbacks->get_company();
|
200 |
+
echo empty( $company_name ) ? '—' : $company_name;
|
201 |
+
break;
|
202 |
+
|
203 |
+
case 'shortcode':
|
204 |
+
echo '<input style="width:100%" type="text" onfocus="this.select();" readonly="readonly" value="[' . $prefix . 'testimonials ids="' . $post_id . '"]">';
|
205 |
+
break;
|
206 |
+
|
207 |
+
default :
|
208 |
+
break;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Modify the quick links.
|
214 |
+
*
|
215 |
+
* @since 1.0.1
|
216 |
+
* @param array $actions An array of row action links.
|
217 |
+
* @param WP_Post $post The post object.
|
218 |
+
* @return array
|
219 |
+
*/
|
220 |
+
public function modify_row_actions( $actions, $post ) {
|
221 |
+
|
222 |
+
if ( $post->post_type == $this->post_type && isset( $actions['inline hide-if-no-js'] ) ) {
|
223 |
+
|
224 |
+
// Remove `Quick Edit`.
|
225 |
+
unset( $actions['inline hide-if-no-js'] );
|
226 |
+
}
|
227 |
+
|
228 |
+
return $actions;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Print styles.
|
233 |
+
*
|
234 |
+
* @since 1.0.0
|
235 |
+
*/
|
236 |
+
public function print_styles() {
|
237 |
+
?>
|
238 |
+
<style type="text/css">
|
239 |
+
.tm-testi-ui-container { padding-right: 0; padding-left: 0; }
|
240 |
+
.tm-testi-ui-container .cherry-control__content { flex: auto; }
|
241 |
+
</style>
|
242 |
+
<?php }
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Returns the instance.
|
246 |
+
*
|
247 |
+
* @since 1.0.0
|
248 |
+
* @return object
|
249 |
+
*/
|
250 |
+
public static function get_instance() {
|
251 |
+
|
252 |
+
// If the single instance hasn't been set, set it now.
|
253 |
+
if ( null == self::$instance ) {
|
254 |
+
self::$instance = new self;
|
255 |
+
}
|
256 |
+
|
257 |
+
return self::$instance;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
TM_Testimonials_Admin::get_instance();
|
admin/includes/class-tm-testimonials-ajax.php
CHANGED
@@ -1,109 +1,109 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ajax-handlers for page settings.
|
4 |
-
*
|
5 |
-
* @package Cherry_Testi
|
6 |
-
* @subpackage Admin
|
7 |
-
* @author Template Monster
|
8 |
-
* @license GPL-3.0+
|
9 |
-
* @copyright 2002-2016, Template Monster
|
10 |
-
*/
|
11 |
-
|
12 |
-
// If class `TM_Testimonials_Ajax_Handler` doesn't exists yet.
|
13 |
-
if ( ! class_exists( 'TM_Testimonials_Ajax_Handler' ) ) {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* TM_Testimonials_Ajax_Handler class.
|
17 |
-
*/
|
18 |
-
class TM_Testimonials_Ajax_Handler {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* A reference to an instance of this class.
|
22 |
-
*
|
23 |
-
* @since 1.0.0
|
24 |
-
* @var object
|
25 |
-
*/
|
26 |
-
private static $instance = null;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Constructor.
|
30 |
-
*
|
31 |
-
* @since 1.0.0
|
32 |
-
*/
|
33 |
-
public function __construct() {
|
34 |
-
$this->init();
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Init `cherry-handler` module.
|
39 |
-
*
|
40 |
-
* @since 1.0.0
|
41 |
-
*/
|
42 |
-
public function init() {
|
43 |
-
tm_testimonials_plugin()->get_core()->init_module( 'cherry-handler', array(
|
44 |
-
'id' => 'cherry_testi_save_setting',
|
45 |
-
'action' => 'cherry_testi_save_setting',
|
46 |
-
'capability' => 'manage_options',
|
47 |
-
'callback' => array( $this, 'save_handler' ),
|
48 |
-
'sys_messages' => array(
|
49 |
-
'invalid_base_data' => esc_html__( 'Unable to process the request without nonce or server error', 'cherry-testi' ),
|
50 |
-
'no_right' => esc_html__( 'No capabilities for this action', 'cherry-testi' ),
|
51 |
-
'invalid_nonce' => esc_html__( 'Sorry, you are not allowed to save settings', 'cherry-testi' ),
|
52 |
-
'access_is_allowed' => esc_html__( 'Settings save successfully','cherry-testi' ),
|
53 |
-
),
|
54 |
-
) );
|
55 |
-
|
56 |
-
tm_testimonials_plugin()->get_core()->init_module( 'cherry-handler', array(
|
57 |
-
'id' => 'cherry_testi_reset_setting',
|
58 |
-
'action' => 'cherry_testi_reset_setting',
|
59 |
-
'capability' => 'manage_options',
|
60 |
-
'callback' => array( $this, 'reset_handler' ),
|
61 |
-
'sys_messages' => array(
|
62 |
-
'invalid_base_data' => esc_html__( 'Unable to process the request without nonce or server error', 'cherry-testi' ),
|
63 |
-
'no_right' => esc_html__( 'No capabilities for this action', 'cherry-testi' ),
|
64 |
-
'invalid_nonce' => esc_html__( 'Sorry, you are not allowed to save settings', 'cherry-testi' ),
|
65 |
-
'access_is_allowed' => esc_html__( 'Settings reset successfully','cherry-testi' ),
|
66 |
-
),
|
67 |
-
) );
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Handler for save settings option.
|
72 |
-
*
|
73 |
-
* @since 1.0.0
|
74 |
-
*/
|
75 |
-
public function save_handler() {
|
76 |
-
|
77 |
-
if ( ! empty( $_REQUEST['data'] ) ) {
|
78 |
-
update_option( 'cherry-testi', $_REQUEST['data'] );
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Handler for reset settings option to default.
|
84 |
-
*
|
85 |
-
* @since 1.0.0
|
86 |
-
*/
|
87 |
-
public function reset_handler() {
|
88 |
-
delete_option( 'cherry-testi' );
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Returns the instance.
|
93 |
-
*
|
94 |
-
* @since 1.0.0
|
95 |
-
* @return object
|
96 |
-
*/
|
97 |
-
public static function get_instance() {
|
98 |
-
|
99 |
-
// If the single instance hasn't been set, set it now.
|
100 |
-
if ( null == self::$instance ) {
|
101 |
-
self::$instance = new self;
|
102 |
-
}
|
103 |
-
|
104 |
-
return self::$instance;
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
TM_Testimonials_Ajax_Handler::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ajax-handlers for page settings.
|
4 |
+
*
|
5 |
+
* @package Cherry_Testi
|
6 |
+
* @subpackage Admin
|
7 |
+
* @author Template Monster
|
8 |
+
* @license GPL-3.0+
|
9 |
+
* @copyright 2002-2016, Template Monster
|
10 |
+
*/
|
11 |
+
|
12 |
+
// If class `TM_Testimonials_Ajax_Handler` doesn't exists yet.
|
13 |
+
if ( ! class_exists( 'TM_Testimonials_Ajax_Handler' ) ) {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* TM_Testimonials_Ajax_Handler class.
|
17 |
+
*/
|
18 |
+
class TM_Testimonials_Ajax_Handler {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* A reference to an instance of this class.
|
22 |
+
*
|
23 |
+
* @since 1.0.0
|
24 |
+
* @var object
|
25 |
+
*/
|
26 |
+
private static $instance = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
public function __construct() {
|
34 |
+
$this->init();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Init `cherry-handler` module.
|
39 |
+
*
|
40 |
+
* @since 1.0.0
|
41 |
+
*/
|
42 |
+
public function init() {
|
43 |
+
tm_testimonials_plugin()->get_core()->init_module( 'cherry-handler', array(
|
44 |
+
'id' => 'cherry_testi_save_setting',
|
45 |
+
'action' => 'cherry_testi_save_setting',
|
46 |
+
'capability' => 'manage_options',
|
47 |
+
'callback' => array( $this, 'save_handler' ),
|
48 |
+
'sys_messages' => array(
|
49 |
+
'invalid_base_data' => esc_html__( 'Unable to process the request without nonce or server error', 'cherry-testi' ),
|
50 |
+
'no_right' => esc_html__( 'No capabilities for this action', 'cherry-testi' ),
|
51 |
+
'invalid_nonce' => esc_html__( 'Sorry, you are not allowed to save settings', 'cherry-testi' ),
|
52 |
+
'access_is_allowed' => esc_html__( 'Settings save successfully','cherry-testi' ),
|
53 |
+
),
|
54 |
+
) );
|
55 |
+
|
56 |
+
tm_testimonials_plugin()->get_core()->init_module( 'cherry-handler', array(
|
57 |
+
'id' => 'cherry_testi_reset_setting',
|
58 |
+
'action' => 'cherry_testi_reset_setting',
|
59 |
+
'capability' => 'manage_options',
|
60 |
+
'callback' => array( $this, 'reset_handler' ),
|
61 |
+
'sys_messages' => array(
|
62 |
+
'invalid_base_data' => esc_html__( 'Unable to process the request without nonce or server error', 'cherry-testi' ),
|
63 |
+
'no_right' => esc_html__( 'No capabilities for this action', 'cherry-testi' ),
|
64 |
+
'invalid_nonce' => esc_html__( 'Sorry, you are not allowed to save settings', 'cherry-testi' ),
|
65 |
+
'access_is_allowed' => esc_html__( 'Settings reset successfully','cherry-testi' ),
|
66 |
+
),
|
67 |
+
) );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Handler for save settings option.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
*/
|
75 |
+
public function save_handler() {
|
76 |
+
|
77 |
+
if ( ! empty( $_REQUEST['data'] ) ) {
|
78 |
+
update_option( 'cherry-testi', $_REQUEST['data'] );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Handler for reset settings option to default.
|
84 |
+
*
|
85 |
+
* @since 1.0.0
|
86 |
+
*/
|
87 |
+
public function reset_handler() {
|
88 |
+
delete_option( 'cherry-testi' );
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Returns the instance.
|
93 |
+
*
|
94 |
+
* @since 1.0.0
|
95 |
+
* @return object
|
96 |
+
*/
|
97 |
+
public static function get_instance() {
|
98 |
+
|
99 |
+
// If the single instance hasn't been set, set it now.
|
100 |
+
if ( null == self::$instance ) {
|
101 |
+
self::$instance = new self;
|
102 |
+
}
|
103 |
+
|
104 |
+
return self::$instance;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
TM_Testimonials_Ajax_Handler::get_instance();
|
admin/includes/index.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Silence is golden
|
4 |
-
*
|
5 |
-
* @package Cherry_Testi
|
6 |
-
* @author Template Monster
|
7 |
-
* @license GPL-3.0+
|
8 |
-
* @copyright 2002-2016, Template Monster
|
9 |
-
*/
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Cherry_Testi
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
admin/index.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Silence is golden
|
4 |
-
*
|
5 |
-
* @package Cherry_Testi
|
6 |
-
* @author Template Monster
|
7 |
-
* @license GPL-3.0+
|
8 |
-
* @copyright 2002-2016, Template Monster
|
9 |
-
*/
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden
|
4 |
+
*
|
5 |
+
* @package Cherry_Testi
|
6 |
+
* @author Template Monster
|
7 |
+
* @license GPL-3.0+
|
8 |
+
* @copyright 2002-2016, Template Monster
|
9 |
+
*/
|
admin/views/shortcode-settings.php
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Shortcode settings view.
|
4 |
-
*
|
5 |
-
* @package Cherry_Testi
|
6 |
-
* @subpackage Views
|
7 |
-
* @author Template Monster
|
8 |
-
* @license GPL-3.0+
|
9 |
-
* @copyright 2002-2016, Template Monster
|
10 |
-
*/
|
11 |
-
|
12 |
-
$
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
$code_text .= sprintf( ' %s="%s"', esc_html( $key ), $
|
23 |
-
$list
|
24 |
-
}
|
25 |
-
|
26 |
-
printf( '<code>[%1$s%2$s%
|
27 |
-
printf( '<h4 class="cherry-testi-shortcode-title">%s</h4><ul class="cherry-testi-shortcode-params">%s</ul>', esc_html__( 'Parameters list:', '
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shortcode settings view.
|
4 |
+
*
|
5 |
+
* @package Cherry_Testi
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Template Monster
|
8 |
+
* @license GPL-3.0+
|
9 |
+
* @copyright 2002-2016, Template Monster
|
10 |
+
*/
|
11 |
+
|
12 |
+
$atts = tm_testimonials_shortcode()->get_shortcode_atts();
|
13 |
+
|
14 |
+
if ( empty( $atts ) || ! is_array( $atts ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
$code_text = $list = '';
|
19 |
+
|
20 |
+
foreach ( $atts as $key => $attr ) {
|
21 |
+
$default = isset( $attr['default'] ) ? $attr['default'] : $attr['value'];
|
22 |
+
$code_text .= sprintf( ' %s="%s"', esc_html( $key ), $default );
|
23 |
+
$list .= sprintf( '<li><strong class="cherry-testi-shortcode-params__name">%s</strong> - %s</li>', esc_html( $key ), $attr['description'] );
|
24 |
+
}
|
25 |
+
|
26 |
+
printf( '<code>[%1$s%2$s%]</code>', tm_testimonials_shortcode()->get_tag(), $code_text );
|
27 |
+
printf( '<h4 class="cherry-testi-shortcode-title">%s</h4><ul class="cherry-testi-shortcode-params">%s</ul>', esc_html__( 'Parameters list:', 'cherry-testi' ), $list );
|
cherry-framework/cherry-core.php
CHANGED
@@ -1,496 +1,469 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Cherry Core
|
4 |
-
* Version: 1.
|
5 |
-
*
|
6 |
-
* @package Cherry_Framework
|
7 |
-
* @subpackage Class
|
8 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
9 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
10 |
-
* @link http://www.cherryframework.com/
|
11 |
-
* @license http://www.gnu.org/licenses/
|
12 |
-
*/
|
13 |
-
|
14 |
-
// If this file is called directly, abort.
|
15 |
-
if ( ! defined( 'WPINC' ) ) {
|
16 |
-
die;
|
17 |
-
}
|
18 |
-
|
19 |
-
if ( ! class_exists( 'Cherry_Core' ) ) {
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Class Cherry Core.
|
23 |
-
*/
|
24 |
-
class Cherry_Core {
|
25 |
-
|
26 |
-
/**
|
27 |
-
* A reference to an instance of this class.
|
28 |
-
*
|
29 |
-
* @since 1.0.0
|
30 |
-
* @var object
|
31 |
-
*/
|
32 |
-
private static $instance = null;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Core settings.
|
36 |
-
*
|
37 |
-
* @since 1.0.0
|
38 |
-
* @var array
|
39 |
-
*/
|
40 |
-
public $settings = array();
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Holder for all registered modules for current core instance.
|
44 |
-
*
|
45 |
-
* @since 1.0.0
|
46 |
-
* @var array
|
47 |
-
*/
|
48 |
-
public $modules = array();
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Holder for all modules.
|
52 |
-
*
|
53 |
-
* @since 1.1.0
|
54 |
-
* @var array
|
55 |
-
*/
|
56 |
-
public static $all_modules = array();
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Constructor.
|
60 |
-
*
|
61 |
-
* @since 1.0.0
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
$
|
67 |
-
|
68 |
-
|
69 |
-
'
|
70 |
-
'
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
add_action( 'after_setup_theme', array(
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
}
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
);
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
$
|
396 |
-
}
|
397 |
-
|
398 |
-
return (
|
399 |
-
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
*
|
403 |
-
*
|
404 |
-
*
|
405 |
-
* @
|
406 |
-
* @
|
407 |
-
* @
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
*
|
444 |
-
*
|
445 |
-
* @
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
return
|
467 |
-
}
|
468 |
-
|
469 |
-
|
470 |
-
* Get URI to the core directory.
|
471 |
-
*
|
472 |
-
* @since 1.0.0
|
473 |
-
* @deprecated 1.1.0 Use `base_url()` method
|
474 |
-
* @return string
|
475 |
-
*/
|
476 |
-
public function get_core_url() {
|
477 |
-
return trailingslashit( $this->settings['base_url'] );
|
478 |
-
}
|
479 |
-
|
480 |
-
/**
|
481 |
-
* Returns the instance.
|
482 |
-
*
|
483 |
-
* @since 1.0.0
|
484 |
-
* @return object
|
485 |
-
*/
|
486 |
-
public static function get_instance() {
|
487 |
-
|
488 |
-
// If the single instance hasn't been set, set it now.
|
489 |
-
if ( null == self::$instance ) {
|
490 |
-
self::$instance = new self;
|
491 |
-
}
|
492 |
-
|
493 |
-
return self::$instance;
|
494 |
-
}
|
495 |
-
}
|
496 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Cherry Core
|
4 |
+
* Version: 1.5.4
|
5 |
+
*
|
6 |
+
* @package Cherry_Framework
|
7 |
+
* @subpackage Class
|
8 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
9 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
10 |
+
* @link http://www.cherryframework.com/
|
11 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.en.html
|
12 |
+
*/
|
13 |
+
|
14 |
+
// If this file is called directly, abort.
|
15 |
+
if ( ! defined( 'WPINC' ) ) {
|
16 |
+
die;
|
17 |
+
}
|
18 |
+
|
19 |
+
if ( ! class_exists( 'Cherry_Core' ) ) {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Class Cherry Core.
|
23 |
+
*/
|
24 |
+
class Cherry_Core {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* A reference to an instance of this class.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @var object
|
31 |
+
*/
|
32 |
+
private static $instance = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Core settings.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
public $settings = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Holder for all registered modules for current core instance.
|
44 |
+
*
|
45 |
+
* @since 1.0.0
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
public $modules = array();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Holder for all modules.
|
52 |
+
*
|
53 |
+
* @since 1.1.0
|
54 |
+
* @var array
|
55 |
+
*/
|
56 |
+
public static $all_modules = array();
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Constructor.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
*/
|
63 |
+
public function __construct( $settings = array() ) {
|
64 |
+
global $chery_core_version;
|
65 |
+
|
66 |
+
$defaults = array(
|
67 |
+
'framework_path' => 'cherry-framework',
|
68 |
+
'modules' => array(),
|
69 |
+
'base_dir' => '',
|
70 |
+
'base_url' => '',
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->settings = array_merge( $defaults, $settings );
|
74 |
+
|
75 |
+
if ( isset( $chery_core_version ) && 0 < sizeof( $chery_core_version ) ) {
|
76 |
+
$core_paths = array_values( $chery_core_version );
|
77 |
+
$path_parts = pathinfo( $core_paths[0] );
|
78 |
+
$this->settings['base_dir'] = trailingslashit( $path_parts['dirname'] );
|
79 |
+
} else {
|
80 |
+
// This condition and the using of the function dirname is due to core backwards compatibility with old framework versions
|
81 |
+
$this->settings['base_dir'] = trailingslashit( dirname( __FILE__ ) );
|
82 |
+
}
|
83 |
+
|
84 |
+
$this->settings['base_url'] = trailingslashit( $this->base_url( '', $this->settings['base_dir'] ) );
|
85 |
+
|
86 |
+
$this->run_collector();
|
87 |
+
|
88 |
+
/**
|
89 |
+
* In this hooks priority parameter are very important.
|
90 |
+
*/
|
91 |
+
add_action( 'after_setup_theme', array( 'Cherry_Core', 'load_all_modules' ), 2 );
|
92 |
+
add_action( 'after_setup_theme', array( $this, 'init_required_modules' ), 2 );
|
93 |
+
|
94 |
+
// Load the framework textdomain.
|
95 |
+
add_action( 'after_setup_theme', array( $this, 'load_textdomain' ), 10 );
|
96 |
+
|
97 |
+
// Init modules with autoload seted up into true.
|
98 |
+
add_action( 'after_setup_theme', array( $this, 'init_autoload_modules' ), 9999 );
|
99 |
+
|
100 |
+
// Backward compatibility for `cherry-widget-factory` module.
|
101 |
+
remove_all_filters( 'cherry_widget_factory_core', 10 );
|
102 |
+
add_filter( 'cherry_widget_factory_core', array( $this, 'pass_core_to_widgets' ), 11, 2 );
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Fire collector for modules.
|
107 |
+
*
|
108 |
+
* @since 1.0.0
|
109 |
+
* @return bool
|
110 |
+
*/
|
111 |
+
private function run_collector() {
|
112 |
+
|
113 |
+
if ( ! is_array( $this->settings['modules'] ) || empty( $this->settings['modules'] ) ) {
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
|
117 |
+
// Cherry_Toolkit module should be loaded by default.
|
118 |
+
if ( ! isset( $this->settings['modules']['cherry-toolkit'] ) ) {
|
119 |
+
$this->settings['modules']['cherry-toolkit'] = array(
|
120 |
+
'autoload' => true,
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
foreach ( $this->settings['modules'] as $module => $settings ) {
|
125 |
+
$file_path = $this->get_module_file( $module );
|
126 |
+
|
127 |
+
if ( ! array_key_exists( $module, self::$all_modules ) ) {
|
128 |
+
self::$all_modules[ $module ] = $file_path;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Filter a holder for all modules.
|
134 |
+
*
|
135 |
+
* @since 1.1.0
|
136 |
+
* @var array
|
137 |
+
*/
|
138 |
+
self::$all_modules = apply_filters( 'cherry_core_all_modules', self::$all_modules, $this );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Loaded all modules.
|
143 |
+
*
|
144 |
+
* @since 1.1.0
|
145 |
+
*/
|
146 |
+
public static function load_all_modules() {
|
147 |
+
foreach ( self::$all_modules as $module => $path ) {
|
148 |
+
|
149 |
+
$loaded = self::load_module( $module, $path );
|
150 |
+
|
151 |
+
if ( ! $loaded ) {
|
152 |
+
continue;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Load the framework textdomain.
|
159 |
+
*
|
160 |
+
* @since 1.4.0
|
161 |
+
*/
|
162 |
+
public function load_textdomain() {
|
163 |
+
$mo_file_path = $this->settings['base_dir'] . 'languages/' . get_locale() . '.mo';
|
164 |
+
|
165 |
+
load_textdomain( 'cherry-framework', $mo_file_path );
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Init a required modules.
|
170 |
+
*
|
171 |
+
* @since 1.1.0
|
172 |
+
*/
|
173 |
+
public function init_required_modules() {
|
174 |
+
$required_modules = apply_filters( 'cherry_core_required_modules', array(
|
175 |
+
'cherry-toolkit',
|
176 |
+
'cherry-widget-factory',
|
177 |
+
), $this );
|
178 |
+
|
179 |
+
foreach ( $required_modules as $module ) {
|
180 |
+
|
181 |
+
if ( ! array_key_exists( $module, $this->settings['modules'] ) ) {
|
182 |
+
continue;
|
183 |
+
}
|
184 |
+
|
185 |
+
$settings = $this->settings['modules'][ $module ];
|
186 |
+
$args = ! empty( $settings['args'] ) ? $settings['args'] : array();
|
187 |
+
|
188 |
+
$this->init_module( $module, $args );
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Init autoload modules.
|
194 |
+
*
|
195 |
+
* @since 1.1.0
|
196 |
+
*/
|
197 |
+
public function init_autoload_modules() {
|
198 |
+
if ( empty( $this->modules ) ) {
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
+
foreach ( $this->settings['modules'] as $module => $settings ) {
|
203 |
+
|
204 |
+
if ( ! $this->is_module_autoload( $module ) ) {
|
205 |
+
continue;
|
206 |
+
}
|
207 |
+
|
208 |
+
if ( ! empty( $this->modules[ $module ] ) ) {
|
209 |
+
continue;
|
210 |
+
}
|
211 |
+
|
212 |
+
$args = ! empty( $settings['args'] ) ? $settings['args'] : array();
|
213 |
+
|
214 |
+
$this->init_module( $module, $args );
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Init single module.
|
220 |
+
*
|
221 |
+
* @since 1.0.0
|
222 |
+
* @param string $module Module slug.
|
223 |
+
* @param array $args Module arguments array.
|
224 |
+
* @return mixed
|
225 |
+
*/
|
226 |
+
public function init_module( $module, $args = array() ) {
|
227 |
+
|
228 |
+
if ( empty( $args[ 'module_path' ] ) ) {
|
229 |
+
$get_module_path = $this->get_module_path( $module );
|
230 |
+
$args['module_path'] = ( $get_module_path ) ? $get_module_path : '';
|
231 |
+
}
|
232 |
+
|
233 |
+
$this->modules[ $module ] = $this->get_module_instance( $module, $args );
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Filter a single module after initialization.
|
237 |
+
*
|
238 |
+
* @since 1.1.0
|
239 |
+
*/
|
240 |
+
return apply_filters( 'cherry_core_init_module', $this->modules[ $module ], $module, $args, $this );
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Check module autoload.
|
245 |
+
*
|
246 |
+
* @since 1.0.0
|
247 |
+
* @param string $module Module slug.
|
248 |
+
* @return bool
|
249 |
+
*/
|
250 |
+
public function is_module_autoload( $module ) {
|
251 |
+
|
252 |
+
if ( empty( $this->settings['modules'][ $module ]['autoload'] ) ) {
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
|
256 |
+
return $this->settings['modules'][ $module ]['autoload'];
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Include module.
|
261 |
+
*
|
262 |
+
* @since 1.0.0
|
263 |
+
* @param string $module Module slug.
|
264 |
+
* @param string $path Module path.
|
265 |
+
* @return bool
|
266 |
+
*/
|
267 |
+
public static function load_module( $module, $path ) {
|
268 |
+
$class_name = self::get_class_name( $module );
|
269 |
+
|
270 |
+
if ( ! $path ) {
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
+
if ( class_exists( $class_name ) ) {
|
275 |
+
return true;
|
276 |
+
}
|
277 |
+
|
278 |
+
require_once( $path );
|
279 |
+
|
280 |
+
return true;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Get module instance.
|
285 |
+
*
|
286 |
+
* @since 1.0.0
|
287 |
+
* @param string $module Module slug.
|
288 |
+
* @param array $args Module arguments.
|
289 |
+
* @return object
|
290 |
+
*/
|
291 |
+
public function get_module_instance( $module, $args = array() ) {
|
292 |
+
$class_name = self::get_class_name( $module );
|
293 |
+
|
294 |
+
if ( ! class_exists( $class_name ) ) {
|
295 |
+
echo '<p>Class <b>' . esc_html( $class_name ) . '</b> not exist!</p>';
|
296 |
+
return false;
|
297 |
+
}
|
298 |
+
|
299 |
+
$this->modules[ $module ] = call_user_func( array( $class_name, 'get_instance' ), $this, $args );
|
300 |
+
|
301 |
+
return $this->modules[ $module ];
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Get class name by module slug.
|
306 |
+
*
|
307 |
+
* @since 1.0.0
|
308 |
+
* @param string $slug Module slug.
|
309 |
+
* @return string
|
310 |
+
*/
|
311 |
+
public static function get_class_name( $slug = '' ) {
|
312 |
+
$slug = str_replace( '-', ' ', $slug );
|
313 |
+
$class = str_replace( ' ', '_', ucwords( $slug ) );
|
314 |
+
|
315 |
+
return $class;
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Get path to main file for passed module.
|
320 |
+
*
|
321 |
+
* @since 1.0.1
|
322 |
+
* @param string $module Module slug.
|
323 |
+
* @return string
|
324 |
+
*/
|
325 |
+
public function get_module_path( $module ) {
|
326 |
+
$abs_path = false;
|
327 |
+
$rel_path = 'modules/' . $module . '/';
|
328 |
+
|
329 |
+
if ( file_exists( $this->settings['base_dir'] . $rel_path ) ) {
|
330 |
+
$abs_path = $this->settings['base_dir'] . $rel_path;
|
331 |
+
}
|
332 |
+
|
333 |
+
return $abs_path;
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Get path to main file for passed module.
|
338 |
+
*
|
339 |
+
* @since 1.0.1
|
340 |
+
* @param string $module Module slug.
|
341 |
+
* @return string
|
342 |
+
*/
|
343 |
+
public function get_module_file( $module ) {
|
344 |
+
$abs_path = false;
|
345 |
+
$rel_path = 'modules/' . $module . '/' . $module . '.php';
|
346 |
+
|
347 |
+
if ( file_exists( $this->settings['base_dir'] . $rel_path ) ) {
|
348 |
+
$abs_path = $this->settings['base_dir'] . $rel_path;
|
349 |
+
}
|
350 |
+
|
351 |
+
return $abs_path;
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Retrieves the absolute URL to the current file.
|
356 |
+
* Like a WordPress function `plugins_url`.
|
357 |
+
*
|
358 |
+
* @link https://codex.wordpress.org/Function_Reference/plugins_url
|
359 |
+
* @since 1.0.1
|
360 |
+
* @param string $file_path Optional. Extra path appended to the end of the URL.
|
361 |
+
* @param string $module_path A full path to the core or module file.
|
362 |
+
* @return string
|
363 |
+
*/
|
364 |
+
public static function base_url( $file_path = '', $module_path ) {
|
365 |
+
$module_path = wp_normalize_path( $module_path );
|
366 |
+
preg_match( '/\.[0-9a-z]+$/', $module_path, $ext );
|
367 |
+
|
368 |
+
if ( empty( $ext ) ) {
|
369 |
+
$module_dir = $module_path;
|
370 |
+
} else {
|
371 |
+
// This condition and the using of the function dirname is due to core backwards compatibility with old framework versions
|
372 |
+
$module_dir = dirname( $module_path );
|
373 |
+
}
|
374 |
+
|
375 |
+
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
|
376 |
+
$stylesheet = get_stylesheet();
|
377 |
+
$theme_root = get_raw_theme_root( $stylesheet );
|
378 |
+
$theme_dir = "$theme_root/$stylesheet";
|
379 |
+
|
380 |
+
if ( 0 === strpos( $module_dir, $plugin_dir ) ) {
|
381 |
+
$site_url = site_url();
|
382 |
+
$abs_path = wp_normalize_path( ABSPATH );
|
383 |
+
$url = str_replace( untrailingslashit( $abs_path ), $site_url, $module_dir );
|
384 |
+
} else if ( false !== strpos( $module_path, $theme_dir ) ) {
|
385 |
+
$explode = explode( $theme_dir, $module_dir );
|
386 |
+
$url = get_stylesheet_directory_uri() . end( $explode );
|
387 |
+
} else {
|
388 |
+
$site_url = site_url();
|
389 |
+
$abs_path = wp_normalize_path( ABSPATH );
|
390 |
+
$url = str_replace( untrailingslashit( $abs_path ), $site_url, $module_dir );
|
391 |
+
}
|
392 |
+
|
393 |
+
if ( $file_path && is_string( $file_path ) ) {
|
394 |
+
$url = trailingslashit( $url );
|
395 |
+
$url .= ltrim( $file_path, '/' );
|
396 |
+
}
|
397 |
+
|
398 |
+
return apply_filters( 'cherry_core_base_url', $url, $file_path, $module_path );
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Pass core instance into widget.
|
403 |
+
*
|
404 |
+
* @since 1.1.0
|
405 |
+
* @param mixed $core Current core object.
|
406 |
+
* @param string $path Abstract widget file path.
|
407 |
+
* @return mixed
|
408 |
+
*/
|
409 |
+
public function pass_core_to_widgets( $core, $path ) {
|
410 |
+
$path = str_replace( '\\', '/', $path );
|
411 |
+
$current_core = str_replace( '\\', '/', $this->settings['base_dir'] );
|
412 |
+
|
413 |
+
if ( false !== strpos( $path, $current_core ) ) {
|
414 |
+
return self::get_instance();
|
415 |
+
}
|
416 |
+
|
417 |
+
return $core;
|
418 |
+
}
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Get core version.
|
422 |
+
*
|
423 |
+
* @since 1.5.0
|
424 |
+
* @return string
|
425 |
+
*/
|
426 |
+
public function get_core_version() {
|
427 |
+
global $chery_core_version;
|
428 |
+
|
429 |
+
return key( $chery_core_version );
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Get path to the core directory.
|
434 |
+
*
|
435 |
+
* @since 1.0.0
|
436 |
+
* @return string
|
437 |
+
*/
|
438 |
+
public function get_core_dir() {
|
439 |
+
return trailingslashit( $this->settings['base_dir'] );
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Get URI to the core directory.
|
444 |
+
*
|
445 |
+
* @since 1.0.0
|
446 |
+
* @deprecated 1.1.0 Use `base_url()` method
|
447 |
+
* @return string
|
448 |
+
*/
|
449 |
+
public function get_core_url() {
|
450 |
+
return trailingslashit( $this->settings['base_url'] );
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Returns the instance.
|
455 |
+
*
|
456 |
+
* @since 1.0.0
|
457 |
+
* @return object
|
458 |
+
*/
|
459 |
+
public static function get_instance() {
|
460 |
+
|
461 |
+
// If the single instance hasn't been set, set it now.
|
462 |
+
if ( null == self::$instance ) {
|
463 |
+
self::$instance = new self;
|
464 |
+
}
|
465 |
+
|
466 |
+
return self::$instance;
|
467 |
+
}
|
468 |
+
}
|
469 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/config.json
CHANGED
@@ -1,174 +1,196 @@
|
|
1 |
-
{
|
2 |
-
"name" : "Cherry Framework",
|
3 |
-
"version" : "1.3.1",
|
4 |
-
"description" : "",
|
5 |
-
"doc_link" : "",
|
6 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework",
|
7 |
-
"modules" : {
|
8 |
-
"cherry-breadcrumbs" : {
|
9 |
-
"name" : "Breadcrumb Trail",
|
10 |
-
"description" : "A breadcrumb menu script for WordPress.",
|
11 |
-
"version" : "1.1.
|
12 |
-
"doc_link" : "",
|
13 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-breadcrumbs",
|
14 |
-
"compatible" : ["theme", "plugin"],
|
15 |
-
"wordpress_org" : true,
|
16 |
-
"required" : false,
|
17 |
-
"dependencies" : []
|
18 |
-
},
|
19 |
-
"cherry-customizer" : {
|
20 |
-
"name" : "Customizer API",
|
21 |
-
"description" : "Customizer functionality.",
|
22 |
-
"version" : "1.1.
|
23 |
-
"doc_link" : "",
|
24 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-customizer",
|
25 |
-
"compatible" : ["theme", "plugin"],
|
26 |
-
"wordpress_org" : true,
|
27 |
-
"required" : false,
|
28 |
-
"dependencies" : []
|
29 |
-
},
|
30 |
-
"cherry-
|
31 |
-
"name" : "
|
32 |
-
"description" : "
|
33 |
-
"version" : "1.
|
34 |
-
"doc_link" : "",
|
35 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
36 |
-
"compatible" : ["theme", "plugin"],
|
37 |
-
"wordpress_org" : true,
|
38 |
-
"required" : false,
|
39 |
-
"dependencies" : []
|
40 |
-
},
|
41 |
-
"cherry-
|
42 |
-
"name" : "
|
43 |
-
"description" : "
|
44 |
-
"version" : "1.
|
45 |
-
"doc_link" : "",
|
46 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
47 |
-
"compatible" : ["theme", "plugin"],
|
48 |
-
"wordpress_org" : true,
|
49 |
-
"required" : false,
|
50 |
-
"dependencies" : []
|
51 |
-
},
|
52 |
-
"cherry-
|
53 |
-
"name" : "
|
54 |
-
"description" : "
|
55 |
-
"version" : "1.1.0",
|
56 |
-
"doc_link" : "",
|
57 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
58 |
-
"compatible" : ["theme", "plugin"],
|
59 |
-
"wordpress_org" : true,
|
60 |
-
"required" : false,
|
61 |
-
"dependencies" : [
|
62 |
-
},
|
63 |
-
"cherry-
|
64 |
-
"name" : "
|
65 |
-
"description" : "
|
66 |
-
"version" : "1.1.
|
67 |
-
"doc_link" : "",
|
68 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
69 |
-
"compatible" : ["theme", "plugin"],
|
70 |
-
"wordpress_org" : true,
|
71 |
-
"required" : false,
|
72 |
-
"dependencies" : [ "cherry-
|
73 |
-
},
|
74 |
-
"cherry-
|
75 |
-
"name" : "
|
76 |
-
"description" : "
|
77 |
-
"version" : "1.1.2",
|
78 |
-
"doc_link" : "",
|
79 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
80 |
-
"compatible" : ["theme", "plugin"],
|
81 |
-
"wordpress_org" : true,
|
82 |
-
"required" : false,
|
83 |
-
"dependencies" : []
|
84 |
-
},
|
85 |
-
"cherry-
|
86 |
-
"name" : "
|
87 |
-
"description" : "
|
88 |
-
"version" : "1.1.2",
|
89 |
-
"doc_link" : "",
|
90 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
91 |
-
"compatible" : ["theme", "plugin"],
|
92 |
-
"wordpress_org" : true,
|
93 |
-
"required" : false,
|
94 |
-
"dependencies" : [
|
95 |
-
},
|
96 |
-
"cherry-post-
|
97 |
-
"name" : "Post
|
98 |
-
"description" : "
|
99 |
-
"version" : "1.2
|
100 |
-
"doc_link" : "",
|
101 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-
|
102 |
-
"compatible" : ["theme", "plugin"],
|
103 |
-
"wordpress_org" : true,
|
104 |
-
"required" : false,
|
105 |
-
"dependencies" : [ "cherry-
|
106 |
-
},
|
107 |
-
"cherry-
|
108 |
-
"name" : "
|
109 |
-
"description" : "
|
110 |
-
"version" : "1.
|
111 |
-
"doc_link" : "",
|
112 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
113 |
-
"compatible" : ["theme", "plugin"],
|
114 |
-
"wordpress_org" : true,
|
115 |
-
"required" : false,
|
116 |
-
"dependencies" : []
|
117 |
-
},
|
118 |
-
"cherry-term-meta" : {
|
119 |
-
"name" : "Term Meta",
|
120 |
-
"description" : "Manage term metadata.",
|
121 |
-
"version" : "1.1.4",
|
122 |
-
"doc_link" : "",
|
123 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-term-meta",
|
124 |
-
"compatible" : ["theme", "plugin"],
|
125 |
-
"wordpress_org" : true,
|
126 |
-
"required" : false,
|
127 |
-
"dependencies" : [ "cherry-ui-elements" ]
|
128 |
-
},
|
129 |
-
"cherry-toolkit": {
|
130 |
-
"name": "Framework Toolkit",
|
131 |
-
"description": "Framework Toolkit contains various PHP utilities",
|
132 |
-
"version" : "1.2.0",
|
133 |
-
"doc_link": "",
|
134 |
-
"git_link": "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-toolkit",
|
135 |
-
"compatible": ["theme", "plugin"],
|
136 |
-
"wordpress_org": true,
|
137 |
-
"required": true,
|
138 |
-
"dependencies": []
|
139 |
-
},
|
140 |
-
"cherry-ui-elements" : {
|
141 |
-
"name" : "UI Elements",
|
142 |
-
"description" : "UI Elements",
|
143 |
-
"version" : "1.3
|
144 |
-
"doc_link" : "",
|
145 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-ui-elements",
|
146 |
-
"compatible" : ["theme", "plugin"],
|
147 |
-
"wordpress_org" : true,
|
148 |
-
"required" : false,
|
149 |
-
"dependencies" : [ "cherry-js-core" ]
|
150 |
-
},
|
151 |
-
"cherry-utility" : {
|
152 |
-
"name" : "Utility",
|
153 |
-
"description" : "Multiple utility functions.",
|
154 |
-
"version" : "1.1.
|
155 |
-
"doc_link" : "",
|
156 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-utility",
|
157 |
-
"compatible" : ["theme", "plugin"],
|
158 |
-
"wordpress_org" : true,
|
159 |
-
"required" : false,
|
160 |
-
"dependencies" : []
|
161 |
-
},
|
162 |
-
"cherry-widget-factory" : {
|
163 |
-
"name" : "Widget Factory",
|
164 |
-
"description" : "Base widget class that simplifies creating of your own widgets.",
|
165 |
-
"version" : "1.2.1",
|
166 |
-
"doc_link" : "",
|
167 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-widget-factory",
|
168 |
-
"compatible" : ["theme", "plugin"],
|
169 |
-
"wordpress_org" : true,
|
170 |
-
"required" : false,
|
171 |
-
"dependencies" : [ "cherry-ui-elements" ]
|
172 |
-
}
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name" : "Cherry Framework",
|
3 |
+
"version" : "1.4.3.1",
|
4 |
+
"description" : "",
|
5 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs",
|
6 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework",
|
7 |
+
"modules" : {
|
8 |
+
"cherry-breadcrumbs" : {
|
9 |
+
"name" : "Breadcrumb Trail",
|
10 |
+
"description" : "A breadcrumb menu script for WordPress.",
|
11 |
+
"version" : "1.1.3",
|
12 |
+
"doc_link" : "",
|
13 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-breadcrumbs",
|
14 |
+
"compatible" : ["theme", "plugin"],
|
15 |
+
"wordpress_org" : true,
|
16 |
+
"required" : false,
|
17 |
+
"dependencies" : []
|
18 |
+
},
|
19 |
+
"cherry-customizer" : {
|
20 |
+
"name" : "Customizer API",
|
21 |
+
"description" : "Customizer functionality.",
|
22 |
+
"version" : "1.1.7",
|
23 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/01.%20cherry-customizer.md",
|
24 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-customizer",
|
25 |
+
"compatible" : ["theme", "plugin"],
|
26 |
+
"wordpress_org" : true,
|
27 |
+
"required" : false,
|
28 |
+
"dependencies" : []
|
29 |
+
},
|
30 |
+
"cherry-db-updater" : {
|
31 |
+
"name" : "Database Updater",
|
32 |
+
"description" : "Handle database updates if required.",
|
33 |
+
"version" : "1.0.0",
|
34 |
+
"doc_link" : "",
|
35 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-db-updater",
|
36 |
+
"compatible" : ["theme", "plugin"],
|
37 |
+
"wordpress_org" : true,
|
38 |
+
"required" : false,
|
39 |
+
"dependencies" : []
|
40 |
+
},
|
41 |
+
"cherry-dynamic-css" : {
|
42 |
+
"name" : "Dynamic CSS",
|
43 |
+
"description" : "Generate CSS.",
|
44 |
+
"version" : "1.4.0",
|
45 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/03.%20cherry-dynamic-css.md",
|
46 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-dynamic-css",
|
47 |
+
"compatible" : ["theme", "plugin"],
|
48 |
+
"wordpress_org" : true,
|
49 |
+
"required" : false,
|
50 |
+
"dependencies" : []
|
51 |
+
},
|
52 |
+
"cherry-google-fonts-loader" : {
|
53 |
+
"name" : "Google Fonts Loader",
|
54 |
+
"description" : "Enqueue Google fonts.",
|
55 |
+
"version" : "1.1.0",
|
56 |
+
"doc_link" : "",
|
57 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-google-fonts-loader",
|
58 |
+
"compatible" : ["theme", "plugin"],
|
59 |
+
"wordpress_org" : true,
|
60 |
+
"required" : false,
|
61 |
+
"dependencies" : []
|
62 |
+
},
|
63 |
+
"cherry-handler" : {
|
64 |
+
"name" : "Cherry handler",
|
65 |
+
"description" : "Initialize handlers.",
|
66 |
+
"version" : "1.1.3",
|
67 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/02.%20cherry-handler.md",
|
68 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-handler",
|
69 |
+
"compatible" : ["theme", "plugin"],
|
70 |
+
"wordpress_org" : true,
|
71 |
+
"required" : false,
|
72 |
+
"dependencies" : [ "cherry-js-core" ]
|
73 |
+
},
|
74 |
+
"cherry-interface-builder" : {
|
75 |
+
"name" : "Interface Builder",
|
76 |
+
"description" : "The module for the creation of interfaces in the WordPress admin panel.",
|
77 |
+
"version" : "1.1.2",
|
78 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/07.%20cherry-interface-builder.md",
|
79 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-interface-builder",
|
80 |
+
"compatible" : ["theme", "plugin"],
|
81 |
+
"wordpress_org" : true,
|
82 |
+
"required" : false,
|
83 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
84 |
+
},
|
85 |
+
"cherry-js-core" : {
|
86 |
+
"name" : "JS Core",
|
87 |
+
"description" : "Initialize global JS object which provides additional plugin functionality.",
|
88 |
+
"version" : "1.1.2",
|
89 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/04.%20cherry-js-core.md",
|
90 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-js-core",
|
91 |
+
"compatible" : ["theme", "plugin"],
|
92 |
+
"wordpress_org" : true,
|
93 |
+
"required" : false,
|
94 |
+
"dependencies" : []
|
95 |
+
},
|
96 |
+
"cherry-post-formats-api" : {
|
97 |
+
"name" : "Post Formats API",
|
98 |
+
"description" : "API for post formats specific content.",
|
99 |
+
"version" : "1.1.2",
|
100 |
+
"doc_link" : "",
|
101 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-formats-api",
|
102 |
+
"compatible" : ["theme", "plugin"],
|
103 |
+
"wordpress_org" : true,
|
104 |
+
"required" : false,
|
105 |
+
"dependencies" : [ "cherry-js-core" ]
|
106 |
+
},
|
107 |
+
"cherry-post-meta" : {
|
108 |
+
"name" : "Post Meta",
|
109 |
+
"description" : "Manage post meta.",
|
110 |
+
"version" : "1.2.1",
|
111 |
+
"doc_link" : "",
|
112 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-meta",
|
113 |
+
"compatible" : ["theme", "plugin"],
|
114 |
+
"wordpress_org" : true,
|
115 |
+
"required" : false,
|
116 |
+
"dependencies" : [ "cherry-interface-builder" ]
|
117 |
+
},
|
118 |
+
"cherry-term-meta" : {
|
119 |
+
"name" : "Term Meta",
|
120 |
+
"description" : "Manage term metadata.",
|
121 |
+
"version" : "1.1.4",
|
122 |
+
"doc_link" : "",
|
123 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-term-meta",
|
124 |
+
"compatible" : ["theme", "plugin"],
|
125 |
+
"wordpress_org" : true,
|
126 |
+
"required" : false,
|
127 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
128 |
+
},
|
129 |
+
"cherry-toolkit": {
|
130 |
+
"name": "Framework Toolkit",
|
131 |
+
"description": "Framework Toolkit contains various PHP utilities",
|
132 |
+
"version" : "1.2.0",
|
133 |
+
"doc_link": "https://github.com/CherryFramework/cherry-framework-docs/blob/master/100.%20cherry-toolkit.md",
|
134 |
+
"git_link": "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-toolkit",
|
135 |
+
"compatible": ["theme", "plugin"],
|
136 |
+
"wordpress_org": true,
|
137 |
+
"required": true,
|
138 |
+
"dependencies": []
|
139 |
+
},
|
140 |
+
"cherry-ui-elements" : {
|
141 |
+
"name" : "UI Elements",
|
142 |
+
"description" : "UI Elements",
|
143 |
+
"version" : "1.4.3",
|
144 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/09.%20cherry-ui-elements.md",
|
145 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-ui-elements",
|
146 |
+
"compatible" : ["theme", "plugin"],
|
147 |
+
"wordpress_org" : true,
|
148 |
+
"required" : false,
|
149 |
+
"dependencies" : [ "cherry-js-core" ]
|
150 |
+
},
|
151 |
+
"cherry-utility" : {
|
152 |
+
"name" : "Utility",
|
153 |
+
"description" : "Multiple utility functions.",
|
154 |
+
"version" : "1.1.7",
|
155 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/08.%20cherry-utility.md",
|
156 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-utility",
|
157 |
+
"compatible" : ["theme", "plugin"],
|
158 |
+
"wordpress_org" : true,
|
159 |
+
"required" : false,
|
160 |
+
"dependencies" : []
|
161 |
+
},
|
162 |
+
"cherry-widget-factory" : {
|
163 |
+
"name" : "Widget Factory",
|
164 |
+
"description" : "Base widget class that simplifies creating of your own widgets.",
|
165 |
+
"version" : "1.2.1",
|
166 |
+
"doc_link" : "https://github.com/CherryFramework/cherry-framework-docs/blob/master/06.%20cherry-widget-factory.md",
|
167 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-widget-factory",
|
168 |
+
"compatible" : ["theme", "plugin"],
|
169 |
+
"wordpress_org" : true,
|
170 |
+
"required" : false,
|
171 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
172 |
+
},
|
173 |
+
"cherry5-assets-loader" : {
|
174 |
+
"name" : "Assets Loader",
|
175 |
+
"description" : "The module allows you deferred loading scripts and styles.",
|
176 |
+
"version" : "1.0.0",
|
177 |
+
"doc_link" : "",
|
178 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry5-assets-loader",
|
179 |
+
"compatible" : [ "theme", "plugin" ],
|
180 |
+
"wordpress_org" : true,
|
181 |
+
"required" : false,
|
182 |
+
"dependencies" : [ "cherry-js-core" ]
|
183 |
+
},
|
184 |
+
"cherry5-insert-shortcode" : {
|
185 |
+
"name" : "Insert Shortcode",
|
186 |
+
"description" : "The module allows you to add shortcodes from editor tinyMCE.",
|
187 |
+
"version" : "1.0.2",
|
188 |
+
"doc_link" : "",
|
189 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry5-insert-shortcode",
|
190 |
+
"compatible" : [ "plugin" ],
|
191 |
+
"wordpress_org" : true,
|
192 |
+
"required" : false,
|
193 |
+
"dependencies" : [ "cherry-ui-elements", "cherry-interface-builder" ]
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
cherry-framework/languages/cherry-framework.pot
CHANGED
@@ -1,69 +1,119 @@
|
|
1 |
-
#, fuzzy
|
2 |
-
msgid ""
|
3 |
-
msgstr ""
|
4 |
-
"Project-Id-Version: cherry-framework\n"
|
5 |
-
"POT-Creation-Date: 2016-
|
6 |
-
"PO-Revision-Date: 2016-
|
7 |
-
"Last-Translator: \n"
|
8 |
-
"Language-Team: TemplateMonster\n"
|
9 |
-
"Language: en\n"
|
10 |
-
"MIME-Version: 1.0\n"
|
11 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
-
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Generator: Poedit 1.8.11\n"
|
14 |
-
"X-Poedit-Basepath: ..\n"
|
15 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_n_noop:1,2;_x:1,2c;_nx:1,2,4c;"
|
18 |
-
"_nx_noop:1,2,3c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;"
|
19 |
-
"esc_html_e;esc_html_x:1,2c\n"
|
20 |
-
"X-Poedit-SearchPath-0: .\n"
|
21 |
-
"X-Poedit-SearchPath-1: .\n"
|
22 |
-
|
23 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:346
|
24 |
-
msgid "Home"
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:352
|
28 |
-
msgid "Browse:"
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:354
|
32 |
-
msgid "404 Not Found"
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:355
|
36 |
-
msgid "Archives"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:356
|
40 |
-
#, php-format
|
41 |
-
msgid "Search results for “%s”"
|
42 |
-
msgstr ""
|
43 |
-
|
44 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:357
|
45 |
-
#, php-format
|
46 |
-
msgid "Page %s"
|
47 |
-
msgstr ""
|
48 |
-
|
49 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:358
|
50 |
-
#, php-format
|
51 |
-
msgid "Minute %s"
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:359
|
55 |
-
#, php-format
|
56 |
-
msgid "Week %s"
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: modules/cherry-customizer/cherry-customizer.php:269
|
60 |
-
msgid "Untitled Panel"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: modules/cherry-customizer/cherry-customizer.php:305
|
64 |
-
msgid "Untitled Section"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: modules/cherry-customizer/cherry-customizer.php:338
|
68 |
-
msgid "Untitled Control"
|
69 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Project-Id-Version: cherry-framework\n"
|
5 |
+
"POT-Creation-Date: 2016-12-26 14:10+0200\n"
|
6 |
+
"PO-Revision-Date: 2016-12-09 16:29+0200\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: TemplateMonster\n"
|
9 |
+
"Language: en\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.8.11\n"
|
14 |
+
"X-Poedit-Basepath: ..\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_n_noop:1,2;_x:1,2c;_nx:1,2,4c;"
|
18 |
+
"_nx_noop:1,2,3c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;"
|
19 |
+
"esc_html_e;esc_html_x:1,2c\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Poedit-SearchPath-1: .\n"
|
22 |
+
|
23 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:346
|
24 |
+
msgid "Home"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:352
|
28 |
+
msgid "Browse:"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:354
|
32 |
+
msgid "404 Not Found"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:355
|
36 |
+
msgid "Archives"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:356
|
40 |
+
#, php-format
|
41 |
+
msgid "Search results for “%s”"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:357
|
45 |
+
#, php-format
|
46 |
+
msgid "Page %s"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:358
|
50 |
+
#, php-format
|
51 |
+
msgid "Minute %s"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: modules/cherry-breadcrumbs/cherry-breadcrumbs.php:359
|
55 |
+
#, php-format
|
56 |
+
msgid "Week %s"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: modules/cherry-customizer/cherry-customizer.php:269
|
60 |
+
msgid "Untitled Panel"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: modules/cherry-customizer/cherry-customizer.php:305
|
64 |
+
msgid "Untitled Section"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: modules/cherry-customizer/cherry-customizer.php:338
|
68 |
+
msgid "Untitled Control"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: modules/cherry-db-updater/cherry-db-updater.php:105
|
72 |
+
#, php-format
|
73 |
+
msgid ""
|
74 |
+
"Module DB Updater init error in %s - version and slug is required arguments"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: modules/cherry-db-updater/cherry-db-updater.php:106
|
78 |
+
msgid "We need to update your database to the latest version."
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: modules/cherry-db-updater/cherry-db-updater.php:107
|
82 |
+
msgid "Update complete, thank you for updating to the latest version!"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: modules/cherry-db-updater/cherry-db-updater.php:331
|
86 |
+
msgid "Start Update"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: modules/cherry-db-updater/cherry-db-updater.php:368
|
90 |
+
msgid "Data Update"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-button.php:63
|
94 |
+
msgid "Cherry shortcodes"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-popup.php:128
|
98 |
+
msgid "insert shortcode"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-popup.php:148
|
102 |
+
msgid "Shortcode List"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-popup.php:206
|
106 |
+
msgid "Shortcode not found."
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-popup.php:261
|
110 |
+
msgid "Shortcode content."
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-popup.php:262
|
114 |
+
msgid "Input shortcode content."
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: modules/cherry5-insert-shortcode/inc/class-cherry5-insertion-popup.php:277
|
118 |
+
msgid "Shortcode not a have options."
|
119 |
+
msgstr ""
|
cherry-framework/modules/cherry-breadcrumbs/cherry-breadcrumbs.php
ADDED
@@ -0,0 +1,1597 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Breadcrumb Trail
|
4 |
+
* Description: A breadcrumb menu script for WordPress
|
5 |
+
* Author: Cherry Team
|
6 |
+
* Author URI: http://www.cherryframework.com/
|
7 |
+
* License: GPLv3
|
8 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
*
|
10 |
+
* Breadcrumb Trail - A breadcrumb menu script for WordPress.
|
11 |
+
*
|
12 |
+
* Breadcrumb Trail is a script for showing a breadcrumb trail for any type of page. It tries to
|
13 |
+
* anticipate any type of structure and display the best possible trail that matches your site's
|
14 |
+
* permalink structure. While not perfect, it attempts to fill in the gaps left by many other
|
15 |
+
* breadcrumb scripts.
|
16 |
+
*
|
17 |
+
* @package Cherry_Framework
|
18 |
+
* @subpackage Modules
|
19 |
+
* @author Cherry Team <support@cherryframework.com>, Justin Tadlock <justin@justintadlock.com>
|
20 |
+
* @copyright Copyright (c) 2008 - 2014, Justin Tadlock
|
21 |
+
* @link http://themehybrid.com/plugins/breadcrumb-trail
|
22 |
+
* @link http://www.cherryframework.com
|
23 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
24 |
+
*/
|
25 |
+
|
26 |
+
// If this file is called directly, abort.
|
27 |
+
if ( ! defined( 'WPINC' ) ) {
|
28 |
+
die;
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! class_exists( 'Cherry_Breadcrumbs' ) ) {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Breadcrumbs builder class.
|
35 |
+
* Class is based on Breadcrumb Trail plugin by Justin Tadlock.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*/
|
39 |
+
class Cherry_Breadcrumbs {
|
40 |
+
|
41 |
+
/**
|
42 |
+
* A reference to an instance of this class.
|
43 |
+
*
|
44 |
+
* @since 1.0.0
|
45 |
+
* @var object
|
46 |
+
*/
|
47 |
+
private static $instance = null;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Core instance.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
* @var object
|
54 |
+
*/
|
55 |
+
public $core = null;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Indexed array of breadcrumb trail items.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
* @var array
|
62 |
+
*/
|
63 |
+
public $items = array();
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Breadcrumb arguments.
|
67 |
+
*
|
68 |
+
* @since 1.0.0
|
69 |
+
* @var array
|
70 |
+
*/
|
71 |
+
public $args = array();
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Page title.
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
* @var array
|
78 |
+
*/
|
79 |
+
public $page_title = null;
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Breadcrumbs CSS.
|
83 |
+
*
|
84 |
+
* @since 1.0.0
|
85 |
+
* @var array
|
86 |
+
*/
|
87 |
+
public $css = array(
|
88 |
+
'module' => 'cherry-breadcrumbs',
|
89 |
+
'content' => 'cherry-breadcrumbs_content',
|
90 |
+
'wrap' => 'cherry-breadcrumbs_wrap',
|
91 |
+
'browse' => 'cherry-breadcrumbs_browse',
|
92 |
+
'item' => 'cherry-breadcrumbs_item',
|
93 |
+
'separator' => 'cherry-breadcrumbs_item_sep',
|
94 |
+
'link' => 'cherry-breadcrumbs_item_link',
|
95 |
+
'target' => 'cherry-breadcrumbs_item_target',
|
96 |
+
);
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Check if Breadcrumbs class was extended.
|
100 |
+
*
|
101 |
+
* @since 1.0.0
|
102 |
+
* @var boolean
|
103 |
+
*/
|
104 |
+
public $is_extend = false;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Constructor of class.
|
108 |
+
*/
|
109 |
+
function __construct( $core, $args = array() ) {
|
110 |
+
|
111 |
+
$this->core = $core;
|
112 |
+
|
113 |
+
$defaults = array(
|
114 |
+
'separator' => '/',
|
115 |
+
'before' => '',
|
116 |
+
'after' => '',
|
117 |
+
'show_mobile' => true,
|
118 |
+
'show_tablet' => true,
|
119 |
+
'wrapper_format' => '<div>%1$s</div><div>%2$s</div>',
|
120 |
+
'page_title_format' => '<h1 class="page-title">%s</h1>',
|
121 |
+
'item_format' => '<div class="%2$s">%1$s</div>',
|
122 |
+
'home_format' => '<a href="%4$s" class="%2$s is-home" rel="home" title="%3$s">%1$s</a>',
|
123 |
+
'link_format' => '<a href="%4$s" class="%2$s" rel="tag" title="%3$s">%1$s</a>',
|
124 |
+
'target_format' => '<span class="%2$s">%1$s</span>',
|
125 |
+
'show_on_front' => true,
|
126 |
+
'network' => false,
|
127 |
+
'show_title' => true,
|
128 |
+
'show_items' => true,
|
129 |
+
'show_browse' => true,
|
130 |
+
'echo' => true,
|
131 |
+
'labels' => array(),
|
132 |
+
'date_labels' => array(),
|
133 |
+
// Cherry team editing start
|
134 |
+
'action' => 'cherry_breadcrumbs_render',
|
135 |
+
'css_namespace' => array(),
|
136 |
+
'path_type' => 'full',
|
137 |
+
// Cherry team editing end
|
138 |
+
'post_taxonomy' => apply_filters(
|
139 |
+
'cherry_breadcrumbs_trail_taxonomies',
|
140 |
+
array(
|
141 |
+
'post' => 'category',
|
142 |
+
)
|
143 |
+
),
|
144 |
+
);
|
145 |
+
|
146 |
+
$this->args = apply_filters( 'cherry_breadcrumb_args', wp_parse_args( $args, $defaults ) );
|
147 |
+
|
148 |
+
// Cherry team editing start
|
149 |
+
if ( isset( $this->args['css_namespace'] ) && ! empty( $this->args['css_namespace'] ) ) {
|
150 |
+
$this->css = wp_parse_args( $this->args['css_namespace'], $this->css );
|
151 |
+
}
|
152 |
+
// Cherry team editing end
|
153 |
+
if ( ! empty( $args['labels'] ) ) {
|
154 |
+
$this->args['labels'] = wp_parse_args( $args['labels'], $this->default_labels() );
|
155 |
+
} else {
|
156 |
+
$this->args['labels'] = $this->default_labels();
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( ! empty( $args['date_labels'] ) ) {
|
160 |
+
$this->args['date_labels'] = wp_parse_args( $args['date_labels'], $this->default_date_labels() );
|
161 |
+
} else {
|
162 |
+
$this->args['date_labels'] = $this->default_date_labels();
|
163 |
+
}
|
164 |
+
|
165 |
+
if ( is_front_page() && false === $this->args['show_on_front'] ) {
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
|
169 |
+
$this->build_trail();
|
170 |
+
|
171 |
+
if ( ! $this->is_extend ) {
|
172 |
+
add_action( $this->args['action'], array( $this, 'get_trail' ) );
|
173 |
+
}
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Formats and outputs the breadcrumb trail.
|
179 |
+
*
|
180 |
+
* @since 1.0.0
|
181 |
+
*/
|
182 |
+
public function get_trail() {
|
183 |
+
|
184 |
+
if ( is_front_page() && false === $this->args['show_on_front'] ) {
|
185 |
+
return;
|
186 |
+
}
|
187 |
+
|
188 |
+
$breadcrumb = $this->get_items();
|
189 |
+
$title = $this->get_title();
|
190 |
+
|
191 |
+
$wrapper_classes = array(
|
192 |
+
esc_attr( $this->css['module'] )
|
193 |
+
);
|
194 |
+
|
195 |
+
if ( false === $this->args['show_mobile'] ) {
|
196 |
+
$wrapper_classes[] = 'hidden-xs';
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( false === $this->args['show_tablet'] ) {
|
200 |
+
$wrapper_classes[] = 'hidden-sm';
|
201 |
+
}
|
202 |
+
|
203 |
+
$wrapper_classes = apply_filters( 'cherry_breadcrumbs_wrapper_classes', $wrapper_classes );
|
204 |
+
$wrapper_classes = array_unique( $wrapper_classes );
|
205 |
+
$wrapper_classes = array_map( 'sanitize_html_class', $wrapper_classes );
|
206 |
+
$wrapper_css = implode( ' ', $wrapper_classes );
|
207 |
+
|
208 |
+
/* Open the breadcrumb trail containers. */
|
209 |
+
$result = "\n\t\t" . '<div class="' . esc_attr( $wrapper_css ) . '">';
|
210 |
+
|
211 |
+
$result .= sprintf( $this->args['wrapper_format'], $title, $breadcrumb );
|
212 |
+
|
213 |
+
/* Close the breadcrumb trail containers. */
|
214 |
+
$result .= "\n\t\t" . '</div>';
|
215 |
+
|
216 |
+
if ( true === $this->args['echo'] ) {
|
217 |
+
echo $result;
|
218 |
+
} else {
|
219 |
+
return $result;
|
220 |
+
}
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Get breacrumbs list items.
|
226 |
+
*
|
227 |
+
* @since 1.0.0
|
228 |
+
*/
|
229 |
+
public function get_items() {
|
230 |
+
|
231 |
+
if ( false == $this->args['show_items'] ) {
|
232 |
+
return;
|
233 |
+
}
|
234 |
+
|
235 |
+
$breadcrumb = '';
|
236 |
+
|
237 |
+
/* Connect the breadcrumb trail if there are items in the trail. */
|
238 |
+
if ( empty( $this->items ) && ! is_array( $this->items ) ) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( is_front_page() && false === $this->args['show_on_front'] ) {
|
243 |
+
return;
|
244 |
+
}
|
245 |
+
|
246 |
+
/* Make sure we have a unique array of items. */
|
247 |
+
$this->items = array_unique( $this->items );
|
248 |
+
|
249 |
+
if ( $this->args['before'] ) {
|
250 |
+
$breadcrumb .= $this->args['before'];
|
251 |
+
}
|
252 |
+
|
253 |
+
/* Open the breadcrumb trail containers. */
|
254 |
+
$breadcrumb .= "\n\t\t" . '<div class="' . esc_attr( $this->css['content'] ) . '">';
|
255 |
+
|
256 |
+
/* Add 'browse' label if it should be shown. */
|
257 |
+
if ( true === $this->args['show_browse'] && ! empty( $this->args['labels']['browse'] ) ) {
|
258 |
+
$browse = $this->prepare_label( $this->args['labels']['browse'] );
|
259 |
+
$breadcrumb .= "\n\t\t\t" . '<div class="' . esc_attr( $this->css['browse'] ) . '">' . $browse . '</div> ';
|
260 |
+
}
|
261 |
+
|
262 |
+
$breadcrumb .= "\n\t\t" . '<div class="' . esc_attr( $this->css['wrap'] ) . '">';
|
263 |
+
|
264 |
+
/* Format the separator. */
|
265 |
+
$separator = ! empty( $this->args['separator'] )
|
266 |
+
? $this->args['separator']
|
267 |
+
: '/';
|
268 |
+
|
269 |
+
$separator = $this->prepare_label( $separator );
|
270 |
+
$separator = '<div class="' . esc_attr( $this->css['separator'] ) . '">' . $separator . '</div>';
|
271 |
+
$separator = sprintf( $this->args['item_format'], $separator, $this->css['item'] );
|
272 |
+
|
273 |
+
/* Join the individual trail items into a single string. */
|
274 |
+
$breadcrumb .= join( "\n\t\t\t {$separator} ", $this->items );
|
275 |
+
|
276 |
+
$breadcrumb .= "\n\t\t" . '</div>';
|
277 |
+
|
278 |
+
$breadcrumb .= "\n\t\t" . '</div>';
|
279 |
+
|
280 |
+
if ( $this->args['after'] ) {
|
281 |
+
$breadcrumb .= $this->args['after'];
|
282 |
+
}
|
283 |
+
|
284 |
+
/* Allow developers to filter the breadcrumb trail HTML and page title. */
|
285 |
+
$breadcrumb = apply_filters( 'cherry_breadcrumbs_trail', $breadcrumb, $this->args );
|
286 |
+
|
287 |
+
return $breadcrumb;
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Get page title.
|
293 |
+
*
|
294 |
+
* @since 1.0.0
|
295 |
+
*/
|
296 |
+
public function get_title() {
|
297 |
+
|
298 |
+
if ( false == $this->args['show_title'] || ! $this->page_title ) {
|
299 |
+
return;
|
300 |
+
}
|
301 |
+
|
302 |
+
$title = apply_filters(
|
303 |
+
'cherry_page_title',
|
304 |
+
sprintf( $this->args['page_title_format'], $this->page_title ), $this->args
|
305 |
+
);
|
306 |
+
|
307 |
+
return $title;
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Returns an array of the default labels.
|
313 |
+
*
|
314 |
+
* @since 1.0.0
|
315 |
+
*/
|
316 |
+
public function default_date_labels() {
|
317 |
+
$labels = array(
|
318 |
+
'archive_minute_hour' => 'g:i a', // minute and hour archives time format
|
319 |
+
'archive_minute' => 'i', // minute archives time format
|
320 |
+
'archive_hour' => 'g a', // hour archives time format
|
321 |
+
'archive_year' => 'Y', // yearly archives date format
|
322 |
+
'archive_month' => 'F', // monthly archives date format
|
323 |
+
'archive_day' => 'j', // daily archives date format
|
324 |
+
'archive_week' => 'W', // weekly archives date format
|
325 |
+
);
|
326 |
+
|
327 |
+
return $labels;
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Returns an array of the default labels.
|
332 |
+
*
|
333 |
+
* @since 1.0.0
|
334 |
+
*/
|
335 |
+
public function default_labels() {
|
336 |
+
|
337 |
+
$labels = array(
|
338 |
+
'browse' => esc_html__( 'Browse:', 'cherry-framework' ),
|
339 |
+
'home' => $this->home_title(),
|
340 |
+
'error_404' => esc_html__( '404 Not Found', 'cherry-framework' ),
|
341 |
+
'archives' => esc_html__( 'Archives', 'cherry-framework' ),
|
342 |
+
'search' => esc_html__( 'Search results for “%s”', 'cherry-framework' ),
|
343 |
+
'paged' => esc_html__( 'Page %s', 'cherry-framework' ),
|
344 |
+
'archive_minute' => esc_html__( 'Minute %s', 'cherry-framework' ),
|
345 |
+
'archive_week' => esc_html__( 'Week %s', 'cherry-framework' ),
|
346 |
+
|
347 |
+
/* "%s" is replaced with the translated date/time format. */
|
348 |
+
'archive_minute_hour' => '%s',
|
349 |
+
'archive_hour' => '%s',
|
350 |
+
'archive_day' => '%s',
|
351 |
+
'archive_month' => '%s',
|
352 |
+
'archive_year' => '%s',
|
353 |
+
);
|
354 |
+
|
355 |
+
return $labels;
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Returns home title
|
360 |
+
*
|
361 |
+
* @return string
|
362 |
+
*/
|
363 |
+
public function home_title() {
|
364 |
+
|
365 |
+
$title = esc_html__( 'Home', 'cherry-framework' );
|
366 |
+
$use_custom_title = apply_filters( 'cherry_breadcrumbs_custom_home_title', true );
|
367 |
+
|
368 |
+
if ( $use_custom_title ) {
|
369 |
+
|
370 |
+
$page_on_front_id = get_option( 'page_on_front' );
|
371 |
+
$page_title = false;
|
372 |
+
|
373 |
+
if ( $page_on_front_id ) {
|
374 |
+
$page_title = get_the_title( $page_on_front_id );
|
375 |
+
}
|
376 |
+
|
377 |
+
if ( ! empty( $page_title ) ) {
|
378 |
+
$title = $page_title;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
return $this->prepare_label( $title );
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Build breadcrumbs trail items array.
|
387 |
+
*
|
388 |
+
* @since 1.0.0
|
389 |
+
*/
|
390 |
+
public function build_trail() {
|
391 |
+
|
392 |
+
// Break trail building, if use custom trailing for this page
|
393 |
+
$custom_trail = apply_filters( 'cherry_breadcrumbs_custom_trail', false, $this->args );
|
394 |
+
if ( is_array( $custom_trail ) && ! empty( $custom_trail ) ) {
|
395 |
+
$this->items = $custom_trail['items'];
|
396 |
+
$this->page_title = $custom_trail['page_title'];
|
397 |
+
return;
|
398 |
+
}
|
399 |
+
|
400 |
+
if ( is_front_page() ) {
|
401 |
+
|
402 |
+
// if we on front page
|
403 |
+
$this->add_front_page();
|
404 |
+
|
405 |
+
} else {
|
406 |
+
|
407 |
+
// do this for all other pages
|
408 |
+
$this->add_network_home_link();
|
409 |
+
$this->add_site_home_link();
|
410 |
+
|
411 |
+
// add blog page related items
|
412 |
+
if ( is_home() ) {
|
413 |
+
|
414 |
+
$this->add_blog_page();
|
415 |
+
|
416 |
+
} elseif ( is_singular() ) {
|
417 |
+
|
418 |
+
// add single page/post items
|
419 |
+
$this->add_singular_items();
|
420 |
+
|
421 |
+
} elseif ( is_archive() ) {
|
422 |
+
|
423 |
+
// is is archive page
|
424 |
+
if ( is_post_type_archive() ) {
|
425 |
+
$this->add_post_type_archive_items();
|
426 |
+
|
427 |
+
} elseif ( is_category() || is_tag() || is_tax() ) {
|
428 |
+
$this->add_term_archive_items();
|
429 |
+
|
430 |
+
} elseif ( is_author() ) {
|
431 |
+
$this->add_user_archive_items();
|
432 |
+
|
433 |
+
} elseif ( get_query_var( 'minute' ) && get_query_var( 'hour' ) ) {
|
434 |
+
$this->add_minute_hour_archive_items();
|
435 |
+
|
436 |
+
} elseif ( get_query_var( 'minute' ) ) {
|
437 |
+
$this->add_minute_archive_items();
|
438 |
+
|
439 |
+
} elseif ( get_query_var( 'hour' ) ) {
|
440 |
+
$this->add_hour_archive_items();
|
441 |
+
|
442 |
+
} elseif ( is_day() ) {
|
443 |
+
$this->add_day_archive_items();
|
444 |
+
|
445 |
+
} elseif ( get_query_var( 'w' ) ) {
|
446 |
+
$this->add_week_archive_items();
|
447 |
+
|
448 |
+
} elseif ( is_month() ) {
|
449 |
+
$this->add_month_archive_items();
|
450 |
+
|
451 |
+
} elseif ( is_year() ) {
|
452 |
+
$this->add_year_archive_items();
|
453 |
+
|
454 |
+
} else {
|
455 |
+
$this->add_default_archive_items();
|
456 |
+
|
457 |
+
}
|
458 |
+
} elseif ( is_search() ) {
|
459 |
+
/* If viewing a search results page. */
|
460 |
+
$this->add_search_items();
|
461 |
+
} elseif ( is_404() ) {
|
462 |
+
/* If viewing the 404 page. */
|
463 |
+
$this->add_404_items();
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
/* Add paged items if they exist. */
|
468 |
+
$this->add_paged_items();
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Filter final items array
|
472 |
+
*
|
473 |
+
* @since 1.0.0
|
474 |
+
* @since 1.1.5 Added 3rd parameter $this.
|
475 |
+
*
|
476 |
+
* @param array $this->items Current items array.
|
477 |
+
* @param array $this->args Current instance arguments array.
|
478 |
+
* @param array $this Current instance.
|
479 |
+
*/
|
480 |
+
$this->items = apply_filters( 'cherry_breadcrumbs_items', $this->items, $this->args, $this );
|
481 |
+
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Add trail item int array.
|
486 |
+
*
|
487 |
+
* @since 1.0.0
|
488 |
+
* @since 1.1.5 $prepend parameter.
|
489 |
+
*
|
490 |
+
* @param string $format Item format to add.
|
491 |
+
* @param string $label Item label.
|
492 |
+
* @param string $url Item URL.
|
493 |
+
* @param string $class Item CSS class.
|
494 |
+
*/
|
495 |
+
public function _add_item( $format = 'link_format', $label, $url = '', $class = '', $prepend = false ) {
|
496 |
+
|
497 |
+
$title = esc_attr( wp_strip_all_tags( $label ) );
|
498 |
+
$css = ( 'target_format' == $format ) ? 'target' : 'link';
|
499 |
+
|
500 |
+
if ( $class ) {
|
501 |
+
$class .= ' ' . $this->css[ $css ];
|
502 |
+
} else {
|
503 |
+
$class = $this->css[ $css ];
|
504 |
+
}
|
505 |
+
|
506 |
+
$item = sprintf( $this->args[ $format ], $label, $class, $title, $url );
|
507 |
+
$result = sprintf( $this->args['item_format'], $item, esc_attr( $this->css['item'] ) );
|
508 |
+
|
509 |
+
if ( true === $prepend ) {
|
510 |
+
array_unshift( $this->items, $result );
|
511 |
+
} else {
|
512 |
+
$this->items[] = $result;
|
513 |
+
}
|
514 |
+
|
515 |
+
if ( 'target_format' == $format ) {
|
516 |
+
$this->page_title = $label;
|
517 |
+
}
|
518 |
+
|
519 |
+
}
|
520 |
+
|
521 |
+
/**
|
522 |
+
* Add front items based on $wp_rewrite->front.
|
523 |
+
*
|
524 |
+
* @since 1.0.0
|
525 |
+
*/
|
526 |
+
public function add_rewrite_front_items() {
|
527 |
+
|
528 |
+
global $wp_rewrite;
|
529 |
+
|
530 |
+
if ( $wp_rewrite->front ) {
|
531 |
+
$this->add_path_parents( $wp_rewrite->front );
|
532 |
+
}
|
533 |
+
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Adds the page/paged number to the items array.
|
537 |
+
*
|
538 |
+
* @since 1.0.0
|
539 |
+
* @return void
|
540 |
+
*/
|
541 |
+
public function add_paged_items() {
|
542 |
+
|
543 |
+
/* If viewing a paged singular post. */
|
544 |
+
if ( is_singular() && 1 < get_query_var( 'page' ) ) {
|
545 |
+
$label = sprintf(
|
546 |
+
$this->args['labels']['paged'],
|
547 |
+
number_format_i18n( absint( get_query_var( 'page' ) ) )
|
548 |
+
);
|
549 |
+
$this->_add_item( 'target_format', $label );
|
550 |
+
} elseif ( is_paged() ) {
|
551 |
+
/* If viewing a paged archive-type page. */
|
552 |
+
$label = sprintf(
|
553 |
+
$this->args['labels']['paged'],
|
554 |
+
number_format_i18n( absint( get_query_var( 'paged' ) ) )
|
555 |
+
);
|
556 |
+
$this->_add_item( 'target_format', $label );
|
557 |
+
}
|
558 |
+
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Get parent posts by path. Currently, this method only supports getting parents of the 'page'
|
563 |
+
* post type. The goal of this function is to create a clear path back to home given what would
|
564 |
+
* normally be a "ghost" directory. If any page matches the given path, it'll be added.
|
565 |
+
*
|
566 |
+
* @since 1.0.0
|
567 |
+
*
|
568 |
+
* @param string $path The path (slug) to search for posts by.
|
569 |
+
*/
|
570 |
+
function add_path_parents( $path ) {
|
571 |
+
|
572 |
+
/* Trim '/' off $path in case we just got a simple '/' instead of a real path. */
|
573 |
+
$path = trim( $path, '/' );
|
574 |
+
|
575 |
+
/* If there's no path, return. */
|
576 |
+
if ( empty( $path ) ) {
|
577 |
+
return;
|
578 |
+
}
|
579 |
+
|
580 |
+
// process default Cherry permalinks by own way
|
581 |
+
if ( in_array( $path, array( 'tag', 'category' ) ) ) {
|
582 |
+
return;
|
583 |
+
}
|
584 |
+
|
585 |
+
/* Get parent post by the path. */
|
586 |
+
$post = get_page_by_path( $path );
|
587 |
+
|
588 |
+
if ( ! empty( $post ) ) {
|
589 |
+
$this->add_post_parents( $post->ID );
|
590 |
+
} elseif ( is_null( $post ) ) {
|
591 |
+
|
592 |
+
/* Separate post names into separate paths by '/'. */
|
593 |
+
$path = trim( $path, '/' );
|
594 |
+
preg_match_all( '/\/.*?\z/', $path, $matches );
|
595 |
+
|
596 |
+
/* If matches are found for the path. */
|
597 |
+
if ( isset( $matches ) ) {
|
598 |
+
|
599 |
+
/* Reverse the array of matches to search for posts in the proper order. */
|
600 |
+
$matches = array_reverse( $matches );
|
601 |
+
|
602 |
+
/* Loop through each of the path matches. */
|
603 |
+
foreach ( $matches as $match ) {
|
604 |
+
|
605 |
+
/* If a match is found. */
|
606 |
+
if ( isset( $match[0] ) ) {
|
607 |
+
|
608 |
+
/* Get the parent post by the given path. */
|
609 |
+
$path = str_replace( $match[0], '', $path );
|
610 |
+
$post = get_page_by_path( trim( $path, '/' ) );
|
611 |
+
|
612 |
+
/* If a parent post is found, set the $post_id and break out of the loop. */
|
613 |
+
if ( ! empty( $post ) && 0 < $post->ID ) {
|
614 |
+
$this->add_post_parents( $post->ID );
|
615 |
+
break;
|
616 |
+
}
|
617 |
+
}
|
618 |
+
}
|
619 |
+
}
|
620 |
+
}
|
621 |
+
}
|
622 |
+
|
623 |
+
/**
|
624 |
+
* Build front page breadcrumb items.
|
625 |
+
*
|
626 |
+
* @since 1.0.0
|
627 |
+
*/
|
628 |
+
public function add_front_page() {
|
629 |
+
|
630 |
+
// do nothing if 'show_on_front' arg not true
|
631 |
+
if ( true !== $this->args['show_on_front'] ) {
|
632 |
+
return;
|
633 |
+
}
|
634 |
+
|
635 |
+
// always add network home link (if is multisite)
|
636 |
+
$this->add_network_home_link();
|
637 |
+
|
638 |
+
// if is paged front page - add home link
|
639 |
+
if ( is_paged() || ( is_singular() && 1 < get_query_var( 'page' ) ) ) {
|
640 |
+
|
641 |
+
$this->add_site_home_link();
|
642 |
+
|
643 |
+
} else {
|
644 |
+
|
645 |
+
$label = ( is_multisite() && true === $this->args['network'] )
|
646 |
+
? get_bloginfo( 'name' )
|
647 |
+
: $this->args['labels']['home'];
|
648 |
+
|
649 |
+
$this->_add_item( 'target_format', $label );
|
650 |
+
}
|
651 |
+
|
652 |
+
}
|
653 |
+
|
654 |
+
/**
|
655 |
+
* Add network home link for multisite.
|
656 |
+
* Check if is multisite and add link to parent site to breadcrumb items.
|
657 |
+
*
|
658 |
+
* @since 1.0.0
|
659 |
+
*/
|
660 |
+
public function add_network_home_link() {
|
661 |
+
|
662 |
+
// do nothing if network support diasabled in args
|
663 |
+
if ( true !== $this->args['network'] ) {
|
664 |
+
return;
|
665 |
+
}
|
666 |
+
|
667 |
+
if ( ! is_multisite() ) {
|
668 |
+
return;
|
669 |
+
}
|
670 |
+
|
671 |
+
if ( ! is_main_site() ) {
|
672 |
+
return;
|
673 |
+
}
|
674 |
+
|
675 |
+
$url = esc_url( network_home_url() );
|
676 |
+
$label = $this->args['labels']['home'];
|
677 |
+
|
678 |
+
$this->_add_item( 'home_format', $label, $url );
|
679 |
+
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Add site home link.
|
684 |
+
* Add site home link if is paged front page.
|
685 |
+
*
|
686 |
+
* @since 1.0.0
|
687 |
+
*/
|
688 |
+
public function add_site_home_link() {
|
689 |
+
|
690 |
+
$format = ( is_multisite() && ! is_main_site() && true === $this->args['network'] )
|
691 |
+
? 'link_format'
|
692 |
+
: 'home_format';
|
693 |
+
|
694 |
+
$url = esc_url( home_url( '/' ) );
|
695 |
+
$label = ( is_multisite() && ! is_main_site() && true === $this->args['network'] )
|
696 |
+
? get_bloginfo( 'name' )
|
697 |
+
: $this->args['labels']['home'];
|
698 |
+
|
699 |
+
$this->_add_item( $format, $label, $url );
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Add blog page breadcrumbs item.
|
704 |
+
*
|
705 |
+
* @since 1.0.0
|
706 |
+
*/
|
707 |
+
public function add_blog_page() {
|
708 |
+
|
709 |
+
// Get the post ID and post.
|
710 |
+
$post_id = get_queried_object_id();
|
711 |
+
$post = get_page( $post_id );
|
712 |
+
|
713 |
+
// If the post has parents, add them to the trail.
|
714 |
+
if ( 0 < $post->post_parent ) {
|
715 |
+
$this->add_post_parents( $post->post_parent );
|
716 |
+
}
|
717 |
+
|
718 |
+
$url = get_permalink( $post_id );
|
719 |
+
$label = get_the_title( $post_id );
|
720 |
+
|
721 |
+
if ( is_paged() ) {
|
722 |
+
$this->_add_item( 'link_format', $label, $url );
|
723 |
+
} elseif ( $label ) {
|
724 |
+
$this->_add_item( 'target_format', $label );
|
725 |
+
}
|
726 |
+
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Adds singular post items to the items array.
|
731 |
+
*
|
732 |
+
* @since 1.0.0
|
733 |
+
*/
|
734 |
+
public function add_singular_items() {
|
735 |
+
|
736 |
+
/* Get the queried post. */
|
737 |
+
$post = get_queried_object();
|
738 |
+
$post_id = get_queried_object_id();
|
739 |
+
|
740 |
+
/* If the post has a parent, follow the parent trail. */
|
741 |
+
if ( 0 < $post->post_parent ) {
|
742 |
+
$this->add_post_parents( $post->post_parent );
|
743 |
+
} else {
|
744 |
+
/* If the post doesn't have a parent, get its hierarchy based off the post type. */
|
745 |
+
$this->add_post_hierarchy( $post_id );
|
746 |
+
}
|
747 |
+
|
748 |
+
/* Display terms for specific post type taxonomy if requested. */
|
749 |
+
$this->add_post_terms( $post_id );
|
750 |
+
|
751 |
+
$post_title = single_post_title( '', false );
|
752 |
+
|
753 |
+
/* End with the post title. */
|
754 |
+
if ( $post_title ) {
|
755 |
+
|
756 |
+
if ( 1 < get_query_var( 'page' ) ) {
|
757 |
+
|
758 |
+
$url = get_permalink( $post_id );
|
759 |
+
$label = $post_title;
|
760 |
+
|
761 |
+
$this->_add_item( 'link_format', $label, $url );
|
762 |
+
|
763 |
+
}
|
764 |
+
|
765 |
+
$label = $post_title;
|
766 |
+
$this->_add_item( 'target_format', $label );
|
767 |
+
|
768 |
+
}
|
769 |
+
}
|
770 |
+
|
771 |
+
/**
|
772 |
+
* Adds a post's terms from a specific taxonomy to the items array.
|
773 |
+
*
|
774 |
+
* @since 1.0.0
|
775 |
+
*
|
776 |
+
* @param int $post_id The ID of the post to get the terms for.
|
777 |
+
*/
|
778 |
+
public function add_post_terms( $post_id ) {
|
779 |
+
|
780 |
+
if ( 'minified' == $this->args['path_type'] ) {
|
781 |
+
return;
|
782 |
+
}
|
783 |
+
|
784 |
+
/* Get the post type. */
|
785 |
+
$post_type = get_post_type( $post_id );
|
786 |
+
|
787 |
+
/* Add the terms of the taxonomy for this post. */
|
788 |
+
if ( ! empty( $this->args['post_taxonomy'][ $post_type ] ) ) {
|
789 |
+
|
790 |
+
$post_terms = wp_get_post_terms( $post_id, $this->args['post_taxonomy'][ $post_type ] );
|
791 |
+
|
792 |
+
if ( is_array( $post_terms ) && isset( $post_terms[0] ) && is_object( $post_terms[0] ) ) {
|
793 |
+
$term_id = $post_terms[0]->term_id;
|
794 |
+
$this->add_term_parents( $term_id, $this->args['post_taxonomy'][ $post_type ] );
|
795 |
+
}
|
796 |
+
}
|
797 |
+
}
|
798 |
+
|
799 |
+
/**
|
800 |
+
* Gets post types by slug. This is needed because the get_post_types() function doesn't exactly
|
801 |
+
* match the 'has_archive' argument when it's set as a string instead of a boolean.
|
802 |
+
*
|
803 |
+
* @since 1.0.0
|
804 |
+
*
|
805 |
+
* @param int $slug The post type archive slug to search for.
|
806 |
+
*/
|
807 |
+
public function get_post_types_by_slug( $slug ) {
|
808 |
+
|
809 |
+
$return = array();
|
810 |
+
|
811 |
+
$post_types = get_post_types( array(), 'objects' );
|
812 |
+
|
813 |
+
foreach ( $post_types as $type ) {
|
814 |
+
|
815 |
+
if ( $slug === $type->has_archive || ( true === $type->has_archive && $slug === $type->rewrite['slug'] ) ) {
|
816 |
+
$return[] = $type;
|
817 |
+
}
|
818 |
+
}
|
819 |
+
|
820 |
+
return $return;
|
821 |
+
}
|
822 |
+
|
823 |
+
/**
|
824 |
+
* Adds the items to the trail items array for taxonomy term archives.
|
825 |
+
*
|
826 |
+
* @since 1.0.0
|
827 |
+
*/
|
828 |
+
public function add_term_archive_items() {
|
829 |
+
|
830 |
+
global $wp_rewrite;
|
831 |
+
|
832 |
+
/* Get some taxonomy and term variables. */
|
833 |
+
$term = get_queried_object();
|
834 |
+
$taxonomy = get_taxonomy( $term->taxonomy );
|
835 |
+
|
836 |
+
/* If there are rewrite rules for the taxonomy. */
|
837 |
+
if ( false !== $taxonomy->rewrite ) {
|
838 |
+
|
839 |
+
$post_type_catched = false;
|
840 |
+
|
841 |
+
/* If 'with_front' is true, dd $wp_rewrite->front to the trail. */
|
842 |
+
if ( $taxonomy->rewrite['with_front'] && $wp_rewrite->front ) {
|
843 |
+
$this->add_rewrite_front_items();
|
844 |
+
}
|
845 |
+
|
846 |
+
/* Get parent pages by path if they exist. */
|
847 |
+
$this->add_path_parents( $taxonomy->rewrite['slug'] );
|
848 |
+
|
849 |
+
/* Add post type archive if its 'has_archive' matches the taxonomy rewrite 'slug'. */
|
850 |
+
if ( $taxonomy->rewrite['slug'] ) {
|
851 |
+
|
852 |
+
$slug = trim( $taxonomy->rewrite['slug'], '/' );
|
853 |
+
|
854 |
+
/**
|
855 |
+
* Deals with the situation if the slug has a '/' between multiple strings. For
|
856 |
+
* example, "movies/genres" where "movies" is the post type archive.
|
857 |
+
*/
|
858 |
+
$matches = explode( '/', $slug );
|
859 |
+
|
860 |
+
/* If matches are found for the path. */
|
861 |
+
if ( isset( $matches ) ) {
|
862 |
+
|
863 |
+
/* Reverse the array of matches to search for posts in the proper order. */
|
864 |
+
$matches = array_reverse( $matches );
|
865 |
+
|
866 |
+
/* Loop through each of the path matches. */
|
867 |
+
foreach ( $matches as $match ) {
|
868 |
+
|
869 |
+
/* If a match is found. */
|
870 |
+
$slug = $match;
|
871 |
+
|
872 |
+
/* Get public post types that match the rewrite slug. */
|
873 |
+
$post_types = $this->get_post_types_by_slug( $match );
|
874 |
+
|
875 |
+
if ( ! empty( $post_types ) ) {
|
876 |
+
|
877 |
+
$post_type_object = $post_types[0];
|
878 |
+
|
879 |
+
$url = get_post_type_archive_link( $post_type_object->name );
|
880 |
+
/* Add support for a non-standard label of 'archive_title' (special use case). */
|
881 |
+
$label = ! empty( $post_type_object->labels->archive_title )
|
882 |
+
? $post_type_object->labels->archive_title
|
883 |
+
: $post_type_object->labels->name;
|
884 |
+
|
885 |
+
/* Add the post type archive link to the trail. */
|
886 |
+
$this->_add_item( 'link_format', $label, $url );
|
887 |
+
|
888 |
+
$post_type_catched = true;
|
889 |
+
/* Break out of the loop. */
|
890 |
+
break;
|
891 |
+
}
|
892 |
+
}
|
893 |
+
}
|
894 |
+
}
|
895 |
+
|
896 |
+
/* Add the post type archive link to the trail for custom post types */
|
897 |
+
if ( ! $post_type_catched ) {
|
898 |
+
$post_type = isset( $taxonomy->object_type[0] ) ? $taxonomy->object_type[0] : false;
|
899 |
+
|
900 |
+
if ( $post_type && 'post' != $post_type ) {
|
901 |
+
$post_type_object = get_post_type_object( $post_type );
|
902 |
+
|
903 |
+
$url = get_post_type_archive_link( $post_type_object->name );
|
904 |
+
/* Add support for a non-standard label of 'archive_title' (special use case). */
|
905 |
+
$label = ! empty( $post_type_object->labels->archive_title )
|
906 |
+
? $post_type_object->labels->archive_title
|
907 |
+
: $post_type_object->labels->name;
|
908 |
+
|
909 |
+
$this->_add_item( 'link_format', $label, $url );
|
910 |
+
|
911 |
+
}
|
912 |
+
}
|
913 |
+
}
|
914 |
+
|
915 |
+
/* If the taxonomy is hierarchical, list its parent terms. */
|
916 |
+
if ( is_taxonomy_hierarchical( $term->taxonomy ) && $term->parent ) {
|
917 |
+
$this->add_term_parents( $term->parent, $term->taxonomy );
|
918 |
+
}
|
919 |
+
|
920 |
+
$label = single_term_title( '', false );
|
921 |
+
|
922 |
+
/* Add the term name to the trail end. */
|
923 |
+
if ( is_paged() ) {
|
924 |
+
|
925 |
+
$url = esc_url( get_term_link( $term, $term->taxonomy ) );
|
926 |
+
$this->_add_item( 'link_format', $label, $url );
|
927 |
+
|
928 |
+
}
|
929 |
+
|
930 |
+
$this->_add_item( 'target_format', $label );
|
931 |
+
|
932 |
+
}
|
933 |
+
|
934 |
+
/**
|
935 |
+
* Adds the items to the trail items array for post type archives.
|
936 |
+
*
|
937 |
+
* @since 1.0.0
|
938 |
+
*/
|
939 |
+
public function add_post_type_archive_items() {
|
940 |
+
|
941 |
+
/* Get the post type object. */
|
942 |
+
$post_type_object = get_post_type_object( get_query_var( 'post_type' ) );
|
943 |
+
|
944 |
+
if ( ! empty( $post_type_object ) && false !== $post_type_object->rewrite ) {
|
945 |
+
|
946 |
+
/* If 'with_front' is true, add $wp_rewrite->front to the trail. */
|
947 |
+
if ( ! empty( $post_type_object->rewrite ) && $post_type_object->rewrite['with_front'] ) {
|
948 |
+
$this->add_rewrite_front_items();
|
949 |
+
}
|
950 |
+
}
|
951 |
+
|
952 |
+
/* Add the post type [plural] name to the trail end. */
|
953 |
+
if ( is_paged() ) {
|
954 |
+
|
955 |
+
$url = esc_url( get_post_type_archive_link( $post_type_object->name ) );
|
956 |
+
$label = post_type_archive_title( '', false );
|
957 |
+
|
958 |
+
$this->_add_item( 'link_format', $label, $url );
|
959 |
+
|
960 |
+
}
|
961 |
+
|
962 |
+
$label = post_type_archive_title( '', false );
|
963 |
+
$this->_add_item( 'target_format', $label );
|
964 |
+
|
965 |
+
}
|
966 |
+
|
967 |
+
/**
|
968 |
+
* Adds the items to the trail items array for user (author) archives.
|
969 |
+
*
|
970 |
+
* @since 1.0.0
|
971 |
+
*/
|
972 |
+
public function add_user_archive_items() {
|
973 |
+
global $wp_rewrite;
|
974 |
+
|
975 |
+
/* Add $wp_rewrite->front to the trail. */
|
976 |
+
$this->add_rewrite_front_items();
|
977 |
+
|
978 |
+
/* Get the user ID. */
|
979 |
+
$user_id = get_query_var( 'author' );
|
980 |
+
|
981 |
+
/* If $author_base exists, check for parent pages. */
|
982 |
+
if ( ! empty( $wp_rewrite->author_base ) ) {
|
983 |
+
$this->add_path_parents( $wp_rewrite->author_base );
|
984 |
+
}
|
985 |
+
|
986 |
+
$label = get_the_author_meta( 'display_name', $user_id );
|
987 |
+
|
988 |
+
/* Add the author's display name to the trail end. */
|
989 |
+
if ( is_paged() ) {
|
990 |
+
|
991 |
+
$url = esc_url( get_author_posts_url( $user_id ) );
|
992 |
+
$this->_add_item( 'link_format', $label, $url );
|
993 |
+
|
994 |
+
}
|
995 |
+
|
996 |
+
$this->_add_item( 'target_format', $label );
|
997 |
+
|
998 |
+
}
|
999 |
+
|
1000 |
+
/**
|
1001 |
+
* Adds the items to the trail items array for minute + hour archives.
|
1002 |
+
*
|
1003 |
+
* @since 1.0.0
|
1004 |
+
*/
|
1005 |
+
public function add_minute_hour_archive_items() {
|
1006 |
+
|
1007 |
+
/* Add $wp_rewrite->front to the trail. */
|
1008 |
+
$this->add_rewrite_front_items();
|
1009 |
+
|
1010 |
+
/* Add the minute + hour item. */
|
1011 |
+
$label = sprintf(
|
1012 |
+
$this->args['labels']['archive_minute_hour'],
|
1013 |
+
get_the_time( $this->args['date_labels']['archive_minute_hour'] )
|
1014 |
+
);
|
1015 |
+
$this->_add_item( 'target_format', $label );
|
1016 |
+
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
/**
|
1020 |
+
* Adds the items to the trail items array for minute archives.
|
1021 |
+
*
|
1022 |
+
* @since 1.0.0
|
1023 |
+
*/
|
1024 |
+
public function add_minute_archive_items() {
|
1025 |
+
|
1026 |
+
/* Add $wp_rewrite->front to the trail. */
|
1027 |
+
$this->add_rewrite_front_items();
|
1028 |
+
|
1029 |
+
/* Add the minute item. */
|
1030 |
+
$label = sprintf(
|
1031 |
+
$this->args['labels']['archive_minute'],
|
1032 |
+
get_the_time( $this->args['date_labels']['archive_minute'] )
|
1033 |
+
);
|
1034 |
+
|
1035 |
+
$this->_add_item( 'target_format', $label );
|
1036 |
+
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
/**
|
1040 |
+
* Adds the items to the trail items array for hour archives.
|
1041 |
+
*
|
1042 |
+
* @since 1.0.0
|
1043 |
+
*/
|
1044 |
+
public function add_hour_archive_items() {
|
1045 |
+
|
1046 |
+
/* Add $wp_rewrite->front to the trail. */
|
1047 |
+
$this->add_rewrite_front_items();
|
1048 |
+
|
1049 |
+
/* Add the hour item. */
|
1050 |
+
$label = sprintf(
|
1051 |
+
$this->args['labels']['archive_hour'],
|
1052 |
+
get_the_time( $this->args['date_labels']['archive_hour'] )
|
1053 |
+
);
|
1054 |
+
$this->_add_item( 'target_format', $label );
|
1055 |
+
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
/**
|
1059 |
+
* Adds the items to the trail items array for day archives.
|
1060 |
+
*
|
1061 |
+
* @since 1.0.0
|
1062 |
+
*/
|
1063 |
+
public function add_day_archive_items() {
|
1064 |
+
|
1065 |
+
/* Add $wp_rewrite->front to the trail. */
|
1066 |
+
$this->add_rewrite_front_items();
|
1067 |
+
|
1068 |
+
/* Get year, month, and day. */
|
1069 |
+
$year = sprintf(
|
1070 |
+
$this->args['labels']['archive_year'],
|
1071 |
+
get_the_time( $this->args['date_labels']['archive_year'] )
|
1072 |
+
);
|
1073 |
+
|
1074 |
+
$month = sprintf(
|
1075 |
+
$this->args['labels']['archive_month'],
|
1076 |
+
get_the_time( $this->args['date_labels']['archive_month'] )
|
1077 |
+
);
|
1078 |
+
|
1079 |
+
$day = sprintf(
|
1080 |
+
$this->args['labels']['archive_day'],
|
1081 |
+
get_the_time( $this->args['date_labels']['archive_day'] )
|
1082 |
+
);
|
1083 |
+
|
1084 |
+
/* Add the year and month items. */
|
1085 |
+
$this->_add_item(
|
1086 |
+
'link_format',
|
1087 |
+
$year,
|
1088 |
+
get_year_link( get_the_time( 'Y' ) )
|
1089 |
+
);
|
1090 |
+
|
1091 |
+
$this->_add_item(
|
1092 |
+
'link_format',
|
1093 |
+
$month,
|
1094 |
+
get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) )
|
1095 |
+
);
|
1096 |
+
|
1097 |
+
/* Add the day item. */
|
1098 |
+
if ( is_paged() ) {
|
1099 |
+
|
1100 |
+
$this->_add_item(
|
1101 |
+
'link_format',
|
1102 |
+
$day,
|
1103 |
+
get_day_link( get_the_time( 'Y' ), get_the_time( 'm' ), get_the_time( 'd' ) )
|
1104 |
+
);
|
1105 |
+
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
$this->_add_item( 'target_format', $day );
|
1109 |
+
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* Adds the items to the trail items array for week archives.
|
1114 |
+
*
|
1115 |
+
* @since 1.0.0
|
1116 |
+
*/
|
1117 |
+
public function add_week_archive_items() {
|
1118 |
+
|
1119 |
+
/* Add $wp_rewrite->front to the trail. */
|
1120 |
+
$this->add_rewrite_front_items();
|
1121 |
+
|
1122 |
+
/* Get the year and week. */
|
1123 |
+
$year = sprintf(
|
1124 |
+
$this->args['labels']['archive_year'],
|
1125 |
+
get_the_time( $this->args['date_labels']['archive_year'] )
|
1126 |
+
);
|
1127 |
+
$week = sprintf(
|
1128 |
+
$this->args['labels']['archive_week'],
|
1129 |
+
get_the_time( $this->args['date_labels']['archive_week'] )
|
1130 |
+
);
|
1131 |
+
|
1132 |
+
/* Add the year item. */
|
1133 |
+
$this->_add_item(
|
1134 |
+
'link_format',
|
1135 |
+
$year,
|
1136 |
+
get_year_link( get_the_time( 'Y' ) )
|
1137 |
+
);
|
1138 |
+
|
1139 |
+
/* Add the week item. */
|
1140 |
+
if ( is_paged() ) {
|
1141 |
+
|
1142 |
+
$this->_add_item(
|
1143 |
+
'link_format',
|
1144 |
+
$week,
|
1145 |
+
add_query_arg(
|
1146 |
+
array(
|
1147 |
+
'm' => get_the_time( 'Y' ),
|
1148 |
+
'w' => get_the_time( 'W' ),
|
1149 |
+
),
|
1150 |
+
esc_url( home_url( '/' ) )
|
1151 |
+
)
|
1152 |
+
);
|
1153 |
+
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
$this->_add_item( 'target_format', $week );
|
1157 |
+
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
/**
|
1161 |
+
* Adds the items to the trail items array for month archives.
|
1162 |
+
*
|
1163 |
+
* @since 1.0.0
|
1164 |
+
*/
|
1165 |
+
public function add_month_archive_items() {
|
1166 |
+
|
1167 |
+
/* Add $wp_rewrite->front to the trail. */
|
1168 |
+
$this->add_rewrite_front_items();
|
1169 |
+
|
1170 |
+
/* Get the year and month. */
|
1171 |
+
$year = sprintf(
|
1172 |
+
$this->args['labels']['archive_year'],
|
1173 |
+
get_the_time( $this->args['date_labels']['archive_year'] )
|
1174 |
+
);
|
1175 |
+
$month = sprintf(
|
1176 |
+
$this->args['labels']['archive_month'],
|
1177 |
+
get_the_time( $this->args['date_labels']['archive_month'] )
|
1178 |
+
);
|
1179 |
+
|
1180 |
+
/* Add the year item. */
|
1181 |
+
$this->_add_item(
|
1182 |
+
'link_format',
|
1183 |
+
$year,
|
1184 |
+
get_year_link( get_the_time( 'Y' ) )
|
1185 |
+
);
|
1186 |
+
|
1187 |
+
/* Add the month item. */
|
1188 |
+
if ( is_paged() ) {
|
1189 |
+
$this->_add_item(
|
1190 |
+
'link_format',
|
1191 |
+
$month,
|
1192 |
+
get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) )
|
1193 |
+
);
|
1194 |
+
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
$this->_add_item( 'target_format', $month );
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
/**
|
1201 |
+
* Adds the items to the trail items array for year archives.
|
1202 |
+
*
|
1203 |
+
* @since 1.0.0
|
1204 |
+
*/
|
1205 |
+
public function add_year_archive_items() {
|
1206 |
+
|
1207 |
+
/* Add $wp_rewrite->front to the trail. */
|
1208 |
+
$this->add_rewrite_front_items();
|
1209 |
+
|
1210 |
+
/* Get the year. */
|
1211 |
+
$year = sprintf(
|
1212 |
+
$this->args['labels']['archive_year'],
|
1213 |
+
get_the_time( $this->args['date_labels']['archive_year'] )
|
1214 |
+
);
|
1215 |
+
|
1216 |
+
/* Add the year item. */
|
1217 |
+
if ( is_paged() ) {
|
1218 |
+
$this->_add_item(
|
1219 |
+
'link_format',
|
1220 |
+
$year,
|
1221 |
+
get_year_link( get_the_time( 'Y' ) )
|
1222 |
+
);
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
$this->_add_item( 'target_format', $year );
|
1226 |
+
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
/**
|
1230 |
+
* Adds the items to the trail items array for archives that don't have a more specific method
|
1231 |
+
* defined in this class.
|
1232 |
+
*
|
1233 |
+
* @since 1.0.0
|
1234 |
+
*/
|
1235 |
+
public function add_default_archive_items() {
|
1236 |
+
|
1237 |
+
/* If this is a date-/time-based archive, add $wp_rewrite->front to the trail. */
|
1238 |
+
if ( is_date() || is_time() ) {
|
1239 |
+
$this->add_rewrite_front_items();
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
$this->_add_item( 'target_format', $this->args['labels']['archives'] );
|
1243 |
+
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
/**
|
1247 |
+
* Adds the items to the trail items array for search results.
|
1248 |
+
*
|
1249 |
+
* @since 1.0.0
|
1250 |
+
*/
|
1251 |
+
public function add_search_items() {
|
1252 |
+
|
1253 |
+
$label = sprintf( $this->args['labels']['search'], get_search_query() );
|
1254 |
+
|
1255 |
+
if ( is_paged() ) {
|
1256 |
+
$url = get_search_link();
|
1257 |
+
$this->_add_item( 'link_format', $label, $url );
|
1258 |
+
} else {
|
1259 |
+
$this->_add_item( 'target_format', $label );
|
1260 |
+
}
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
/**
|
1264 |
+
* Adds the items to the trail items array for 404 pages.
|
1265 |
+
*
|
1266 |
+
* @since 1.0.0
|
1267 |
+
* @return void
|
1268 |
+
*/
|
1269 |
+
public function add_404_items() {
|
1270 |
+
|
1271 |
+
$this->_add_item( 'target_format', $this->args['labels']['error_404'] );
|
1272 |
+
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
/**
|
1276 |
+
* Add post parents link to breadcrumbs items
|
1277 |
+
*
|
1278 |
+
* @since 1.0.0
|
1279 |
+
*
|
1280 |
+
* @param int $post_id first parent post ID.
|
1281 |
+
*/
|
1282 |
+
public function add_post_parents( $post_id ) {
|
1283 |
+
|
1284 |
+
$parents = array();
|
1285 |
+
|
1286 |
+
while ( $post_id ) {
|
1287 |
+
|
1288 |
+
$url = get_permalink( $post_id );
|
1289 |
+
$label = get_the_title( $post_id );
|
1290 |
+
$title = esc_attr( $label );
|
1291 |
+
|
1292 |
+
$item = sprintf(
|
1293 |
+
$this->args['link_format'],
|
1294 |
+
$label, $this->css['link'], $title, $url
|
1295 |
+
);
|
1296 |
+
|
1297 |
+
$parents[] = sprintf( $this->args['item_format'], $item, esc_attr( $this->css['item'] ) );
|
1298 |
+
|
1299 |
+
$post = get_post( $post_id );
|
1300 |
+
// If there's no longer a post parent, break out of the loop.
|
1301 |
+
if ( 0 >= $post->post_parent ) {
|
1302 |
+
break;
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
// Change the post ID to the parent post to continue looping.
|
1306 |
+
$post_id = $post->post_parent;
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
// Get the post hierarchy based off the final parent post.
|
1310 |
+
$this->add_post_hierarchy( $post_id );
|
1311 |
+
$this->add_post_terms( $post_id );
|
1312 |
+
|
1313 |
+
// Merge the parent items into the items array.
|
1314 |
+
$this->items = array_merge( $this->items, array_reverse( $parents ) );
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
/**
|
1318 |
+
* Adds a specific post's hierarchy to the items array.
|
1319 |
+
* The hierarchy is determined by post type's
|
1320 |
+
* rewrite arguments and whether it has an archive page.
|
1321 |
+
*
|
1322 |
+
* @since 1.0.0
|
1323 |
+
*
|
1324 |
+
* @param int $post_id The ID of the post to get the hierarchy for.
|
1325 |
+
* @return void
|
1326 |
+
*/
|
1327 |
+
public function add_post_hierarchy( $post_id ) {
|
1328 |
+
|
1329 |
+
if ( 'minified' == $this->args['path_type'] ) {
|
1330 |
+
return;
|
1331 |
+
}
|
1332 |
+
|
1333 |
+
// Get the post type.
|
1334 |
+
$post_type = get_post_type( $post_id );
|
1335 |
+
$post_type_object = get_post_type_object( $post_type );
|
1336 |
+
|
1337 |
+
// If this is the 'post' post type, get the rewrite front items and map the rewrite tags.
|
1338 |
+
if ( 'post' === $post_type ) {
|
1339 |
+
// Get permalink specific breadcrumb items
|
1340 |
+
$this->add_rewrite_front_items();
|
1341 |
+
$this->map_rewrite_tags( $post_id, get_option( 'permalink_structure' ) );
|
1342 |
+
} elseif ( false !== $post_type_object->rewrite ) {
|
1343 |
+
// Add post type specific items
|
1344 |
+
if ( isset( $post_type_object->rewrite['with_front'] ) && $post_type_object->rewrite['with_front'] ) {
|
1345 |
+
$this->add_rewrite_front_items();
|
1346 |
+
}
|
1347 |
+
}
|
1348 |
+
|
1349 |
+
/* If there's an archive page, add it to the trail. */
|
1350 |
+
if ( ! empty( $post_type_object->has_archive ) ) {
|
1351 |
+
|
1352 |
+
$url = get_post_type_archive_link( $post_type );
|
1353 |
+
/* Add support for a non-standard label of 'archive_title' (special use case). */
|
1354 |
+
$label = ! empty( $post_type_object->labels->archive_title )
|
1355 |
+
? $post_type_object->labels->archive_title
|
1356 |
+
: $post_type_object->labels->name;
|
1357 |
+
|
1358 |
+
$this->_add_item( 'link_format', $label, $url );
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
/**
|
1363 |
+
* Searches for term parents of hierarchical taxonomies.
|
1364 |
+
* This function is similar to the WordPress function get_category_parents() but handles any type of taxonomy.
|
1365 |
+
*
|
1366 |
+
* @since 1.0.0
|
1367 |
+
*
|
1368 |
+
* @param int $term_id ID of the term to get the parents of.
|
1369 |
+
* @param string $taxonomy Name of the taxonomy for the given term.
|
1370 |
+
*/
|
1371 |
+
function add_term_parents( $term_id, $taxonomy ) {
|
1372 |
+
|
1373 |
+
if ( 'minified' == $this->args['path_type'] ) {
|
1374 |
+
return;
|
1375 |
+
}
|
1376 |
+
|
1377 |
+
/* Set up some default arrays. */
|
1378 |
+
$parents = array();
|
1379 |
+
|
1380 |
+
/* While there is a parent ID, add the parent term link to the $parents array. */
|
1381 |
+
while ( $term_id ) {
|
1382 |
+
|
1383 |
+
/* Get the parent term. */
|
1384 |
+
$term = get_term( $term_id, $taxonomy );
|
1385 |
+
|
1386 |
+
$url = get_term_link( $term_id, $taxonomy );
|
1387 |
+
$label = $term->name;
|
1388 |
+
$title = esc_attr( $label );
|
1389 |
+
|
1390 |
+
$item = sprintf(
|
1391 |
+
$this->args['link_format'],
|
1392 |
+
$label, $this->css['link'], $title, $url
|
1393 |
+
);
|
1394 |
+
|
1395 |
+
$parents[] = sprintf( $this->args['item_format'], $item, esc_attr( $this->css['item'] ) );
|
1396 |
+
|
1397 |
+
/* Set the parent term's parent as the parent ID. */
|
1398 |
+
$term_id = $term->parent;
|
1399 |
+
}
|
1400 |
+
|
1401 |
+
/* If we have parent terms, reverse the array to put them in the proper order for the trail. */
|
1402 |
+
if ( ! empty( $parents ) ) {
|
1403 |
+
$this->items = array_merge( $this->items, array_reverse( $parents ) );
|
1404 |
+
}
|
1405 |
+
}
|
1406 |
+
|
1407 |
+
/**
|
1408 |
+
* Service function to process single tag item.
|
1409 |
+
*
|
1410 |
+
* @param string $tag Single tag.
|
1411 |
+
* @param int $post_id Processed post ID.
|
1412 |
+
*/
|
1413 |
+
function _process_single_tag( $tag, $post_id ) {
|
1414 |
+
|
1415 |
+
global $post;
|
1416 |
+
|
1417 |
+
/* Trim any '/' from the $tag. */
|
1418 |
+
$tag = trim( $tag, '/' );
|
1419 |
+
|
1420 |
+
/* If using the %year% tag, add a link to the yearly archive. */
|
1421 |
+
if ( '%year%' == $tag ) {
|
1422 |
+
|
1423 |
+
$url = get_year_link( get_the_time( 'Y', $post_id ) );
|
1424 |
+
$label = sprintf(
|
1425 |
+
$this->args['labels']['archive_year'],
|
1426 |
+
get_the_time( $this->args['date_labels']['archive_year'] )
|
1427 |
+
);
|
1428 |
+
|
1429 |
+
$this->_add_item( 'link_format', $label, $url );
|
1430 |
+
|
1431 |
+
/* If using the %monthnum% tag, add a link to the monthly archive. */
|
1432 |
+
} elseif ( '%monthnum%' == $tag ) {
|
1433 |
+
|
1434 |
+
$url = get_month_link( get_the_time( 'Y', $post_id ), get_the_time( 'm', $post_id ) );
|
1435 |
+
$label = sprintf(
|
1436 |
+
$this->args['labels']['archive_month'],
|
1437 |
+
get_the_time( $this->args['date_labels']['archive_month'] )
|
1438 |
+
);
|
1439 |
+
|
1440 |
+
$this->_add_item( 'link_format', $label, $url );
|
1441 |
+
|
1442 |
+
/* If using the %day% tag, add a link to the daily archive. */
|
1443 |
+
} elseif ( '%day%' == $tag ) {
|
1444 |
+
|
1445 |
+
$url = get_day_link(
|
1446 |
+
get_the_time( 'Y', $post_id ), get_the_time( 'm', $post_id ), get_the_time( 'd', $post_id )
|
1447 |
+
);
|
1448 |
+
$label = sprintf(
|
1449 |
+
$this->args['labels']['archive_day'],
|
1450 |
+
get_the_time( $this->args['date_labels']['archive_day'] )
|
1451 |
+
);
|
1452 |
+
|
1453 |
+
$this->_add_item( 'link_format', $label, $url );
|
1454 |
+
|
1455 |
+
/* If using the %author% tag, add a link to the post author archive. */
|
1456 |
+
} elseif ( '%author%' == $tag ) {
|
1457 |
+
|
1458 |
+
$url = get_author_posts_url( $post->post_author );
|
1459 |
+
$label = get_the_author_meta( 'display_name', $post->post_author );
|
1460 |
+
|
1461 |
+
$this->_add_item( 'link_format', $label, $url );
|
1462 |
+
|
1463 |
+
/* If using the %category% tag, add a link to the first category archive to match permalinks. */
|
1464 |
+
} elseif ( '%category%' == $tag ) {
|
1465 |
+
|
1466 |
+
/* Force override terms in this post type. */
|
1467 |
+
$this->args['post_taxonomy'][ $post->post_type ] = false;
|
1468 |
+
|
1469 |
+
/* Get the post categories. */
|
1470 |
+
$terms = get_the_category( $post_id );
|
1471 |
+
|
1472 |
+
/* Check that categories were returned. */
|
1473 |
+
if ( $terms ) {
|
1474 |
+
|
1475 |
+
/* Sort the terms by ID and get the first category. */
|
1476 |
+
if ( function_exists( 'wp_list_sort' ) ) {
|
1477 |
+
$terms = wp_list_sort( $terms, array(
|
1478 |
+
'term_id' => 'ASC',
|
1479 |
+
) );
|
1480 |
+
|
1481 |
+
} else {
|
1482 |
+
|
1483 |
+
// Backward compatibility with WordPress 4.6 or later.
|
1484 |
+
usort( $terms, '_usort_terms_by_ID' );
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
$term = get_term( $terms[0], 'category' );
|
1488 |
+
|
1489 |
+
/* If the category has a parent, add the hierarchy to the trail. */
|
1490 |
+
if ( 0 < $term->parent ) {
|
1491 |
+
$this->add_term_parents( $term->parent, 'category' );
|
1492 |
+
}
|
1493 |
+
|
1494 |
+
$url = get_term_link( $term, 'category' );
|
1495 |
+
$label = $term->name;
|
1496 |
+
|
1497 |
+
$this->_add_item( 'link_format', $label, $url );
|
1498 |
+
}
|
1499 |
+
}
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
|
1503 |
+
/**
|
1504 |
+
* Turns %tag% from permalink structures into usable links for the breadcrumb trail.
|
1505 |
+
* This feels kind of hackish for now because we're checking for specific %tag% examples and only doing
|
1506 |
+
* it for the 'post' post type. In the future, maybe it'll handle a wider variety of possibilities,
|
1507 |
+
* especially for custom post types.
|
1508 |
+
*
|
1509 |
+
* @since 1.0.0
|
1510 |
+
*
|
1511 |
+
* @param int $post_id ID of the post whose parents we want.
|
1512 |
+
* @param string $path Path of a potential parent page.
|
1513 |
+
*/
|
1514 |
+
public function map_rewrite_tags( $post_id, $path ) {
|
1515 |
+
|
1516 |
+
/* Get the post based on the post ID. */
|
1517 |
+
$post = get_post( $post_id );
|
1518 |
+
|
1519 |
+
/* If no post is returned, an error is returned, or the post does not have a 'post' post type, return. */
|
1520 |
+
if ( empty( $post ) || is_wp_error( $post ) || 'post' !== $post->post_type ) {
|
1521 |
+
return;
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
/* Trim '/' from both sides of the $path. */
|
1525 |
+
$path = trim( $path, '/' );
|
1526 |
+
|
1527 |
+
/* Split the $path into an array of strings. */
|
1528 |
+
$matches = explode( '/', $path );
|
1529 |
+
|
1530 |
+
/* If matches are found for the path. */
|
1531 |
+
if ( ! is_array( $matches ) ) {
|
1532 |
+
return;
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
/* Loop through each of the matches, adding each to the $trail array. */
|
1536 |
+
foreach ( $matches as $match ) {
|
1537 |
+
$this->_process_single_tag( $match, $post_id );
|
1538 |
+
}
|
1539 |
+
}
|
1540 |
+
|
1541 |
+
/**
|
1542 |
+
* Try to escape font icon from passed label and return it if found, or return label
|
1543 |
+
*
|
1544 |
+
* @since 1.0.0
|
1545 |
+
* @param string $label Passed label.
|
1546 |
+
* @param bool|string $fallback Optional fallback text to add inside icon tag.
|
1547 |
+
* @return string
|
1548 |
+
*/
|
1549 |
+
public function prepare_label( $label, $fallback = false ) {
|
1550 |
+
|
1551 |
+
$prefix = 'icon:';
|
1552 |
+
|
1553 |
+
// Return simple text label if icon not found
|
1554 |
+
if ( false === strpos( $label, $prefix ) ) {
|
1555 |
+
return $label;
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
$label = str_replace( $prefix, '', $label );
|
1559 |
+
$label = str_replace( '.', '', $label );
|
1560 |
+
|
1561 |
+
if ( false !== $fallback ) {
|
1562 |
+
$fallback = sprintf(
|
1563 |
+
apply_filters( 'cherry_breadcrumbs_icon_fallback', '<span class="hidden">%s</span>', $fallback ),
|
1564 |
+
esc_attr( $fallback )
|
1565 |
+
);
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
// Check if is Font Awesome icon
|
1569 |
+
if ( 0 === strpos( $label, 'fa-' ) ) {
|
1570 |
+
return sprintf( '<i class="fa %1$s">%2$s</i>', esc_attr( $label ), $fallback );
|
1571 |
+
}
|
1572 |
+
|
1573 |
+
// Return default icon
|
1574 |
+
return sprintf(
|
1575 |
+
apply_filters( 'cherry_breadcrumbs_default_icon_format', '<span class="%1$s">%2$s</span>', $label, $fallback ),
|
1576 |
+
esc_attr( $label ), $fallback
|
1577 |
+
);
|
1578 |
+
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
/**
|
1582 |
+
* Returns the instance.
|
1583 |
+
*
|
1584 |
+
* @since 1.0.0
|
1585 |
+
* @return object
|
1586 |
+
*/
|
1587 |
+
public static function get_instance( $core, $args ) {
|
1588 |
+
|
1589 |
+
// If the single instance hasn't been set, set it now.
|
1590 |
+
if ( null == self::$instance ) {
|
1591 |
+
self::$instance = new self( $core, $args );
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
return self::$instance;
|
1595 |
+
}
|
1596 |
+
}
|
1597 |
+
}
|
cherry-framework/modules/cherry-customizer/assets/fonts/google.json
ADDED
@@ -0,0 +1,15622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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