Version Description
- Updated editing interface types of projects
- Fixed archive template
- Fixed bugs
- Added new filters
- Add new macros "termattachments" for projects_terms shortcode
Download this release
Release Info
Developer | TemplateMonster 2002 |
Plugin | ![]() |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- admin/assets/css/admin-style.css +10 -8
- admin/assets/scss/admin-style.scss +9 -4
- admin/includes/class-projects-meta-boxes.php +294 -4
- cherry-framework/cherry-core.php +6 -5
- cherry-framework/config.json +53 -68
- cherry-framework/modules/cherry-breadcrumbs/cherry-breadcrumbs.php +8 -13
- cherry-framework/modules/cherry-creator/cherry-creator.php +0 -122
- cherry-framework/modules/cherry-creator/inc/cherry-creator-term.php +0 -126
- cherry-framework/modules/cherry-customizer/cherry-customizer.php +58 -15
- 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 +55 -29
- 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 +1 -1
- cherry-framework/modules/cherry-handler/assets/css/cherry-handler-styles.min.css +1 -0
- cherry-framework/modules/cherry-handler/assets/js/cherry-handler.js +286 -0
- cherry-framework/modules/cherry-handler/assets/js/min/cherry-handler.min.js +1 -0
- cherry-framework/modules/cherry-handler/assets/scss/cherry-handler-styles.scss +65 -0
- cherry-framework/modules/cherry-handler/cherry-handler.php +233 -0
- cherry-framework/modules/cherry-interface-builder/cherry-interface-builder.php +471 -0
- cherry-framework/modules/cherry-interface-builder/inc/assets/_use-in-js.scss +17 -0
- cherry-framework/modules/cherry-interface-builder/inc/assets/cherry-interface-builder.js +189 -0
- cherry-framework/modules/cherry-interface-builder/inc/assets/cherry-interface-builder.scss +463 -0
- cherry-framework/modules/cherry-interface-builder/inc/assets/min/cherry-interface-builder.min.css +1 -0
- cherry-framework/modules/cherry-interface-builder/inc/assets/min/cherry-interface-builder.min.js +1 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/component-accordion.php +30 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/component-repeater.php +30 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/component-tab-horizontal.php +35 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/component-tab-vertical.php +35 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/component-toggle.php +30 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/control.php +34 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/form.php +24 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/html.php +24 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/section.php +36 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/settings-children-title.php +18 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/settings.php +32 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/tab-children-title.php +20 -0
- cherry-framework/modules/cherry-interface-builder/inc/views/toggle-children-title.php +22 -0
- cherry-framework/modules/cherry-js-core/assets/js/cherry-js-core.js +1 -56
- cherry-framework/modules/cherry-js-core/assets/js/min/cherry-js-core.min.js +1 -1
- cherry-framework/modules/cherry-page-builder/assets/css/min/page-settings.min.css +0 -18
- cherry-framework/modules/cherry-page-builder/assets/js/min/page-settings.min.js +0 -1
- cherry-framework/modules/cherry-page-builder/assets/js/page-settings.js +0 -92
- cherry-framework/modules/cherry-page-builder/assets/scss/page-setting.scss +0 -80
- cherry-framework/modules/cherry-page-builder/cherry-page-builder.php +0 -406
- cherry-framework/modules/cherry-page-builder/views/page.php +0 -46
- cherry-framework/modules/cherry-page-builder/views/section.php +0 -10
- cherry-framework/modules/cherry-plugin-updater/cherry-plugin-updater.php +0 -143
- cherry-framework/modules/cherry-plugin-updater/inc/cherry-base-updater.php +0 -156
- cherry-framework/modules/cherry-post-formats-api/cherry-post-formats-api.php +23 -6
- cherry-framework/modules/cherry-post-formats-api/inc/class-cherry-facebook-embed.php +1 -1
- cherry-framework/modules/cherry-post-meta/cherry-post-meta.php +239 -146
- cherry-framework/modules/cherry-post-meta/views/meta.php +0 -20
- cherry-framework/modules/cherry-post-types/cherry-post-types.php +0 -155
- cherry-framework/modules/cherry-post-types/inc/cherry-post-type.php +0 -112
- cherry-framework/modules/cherry-taxonomies/cherry-taxonomies.php +0 -132
- cherry-framework/modules/cherry-taxonomies/inc/cherry-taxonomy.php +0 -210
- cherry-framework/modules/cherry-template-manager/cherry-template-manager.php +129 -0
- cherry-framework/modules/cherry-template-manager/inc/cherry-template-loader.php +223 -0
- cherry-framework/modules/cherry-template-manager/inc/cherry-template-parser.php +219 -0
- cherry-framework/modules/cherry-term-meta/cherry-term-meta.php +19 -9
- cherry-framework/modules/cherry-theme-updater/cherry-theme-updater.php +0 -141
- cherry-framework/modules/cherry-theme-updater/inc/cherry-base-updater.php +0 -156
- cherry-framework/modules/cherry-toolkit/cherry-toolkit.php +19 -8
- cherry-framework/modules/cherry-ui-elements/cherry-ui-elements.php +7 -5
- cherry-framework/modules/cherry-ui-elements/i-ui.php +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/min/ui-button.min.css +1 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-button.scss +52 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-kit/_mixins.scss +182 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-kit/_variables.scss +25 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/ui-button.php +87 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/view/button-view.php +31 -0
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/min/ui-checkbox.min.css +1 -56
- 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 +40 -57
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/assets/ui-checkbox.scss +14 -8
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-checkbox/ui-checkbox.php +8 -7
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.css +1 -41
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/min/ui-colorpicker.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.js +3 -2
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/assets/ui-colorpicker.scss +2 -2
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-colorpicker/ui-colorpicker.php +6 -6
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/ui-iconpicker.min.css +1 -326
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/min/ui-iconpicker.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-iconpicker.js +4 -2
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/assets/ui-iconpicker.scss +6 -8
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-iconpicker/ui-iconpicker.php +5 -3
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/min/ui-media.min.js +156 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/assets/ui-media.js +98 -101
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-media/ui-media.php +99 -88
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/min/ui-radio.min.css +1 -67
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/min/ui-radio.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-radio.js +35 -40
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/assets/ui-radio.scss +24 -13
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-radio/ui-radio.php +14 -14
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/min/ui-repeater.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/assets/ui-repeater.js +4 -2
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-repeater/ui-repeater.php +12 -13
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/select2.min.css +7 -7
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/ui-select.min.css +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/min/ui-select.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-select.js +41 -9
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/ui-select.scss +18 -5
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/ui-select.php +26 -15
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/min/ui-slider.min.css +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/min/ui-slider.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-slider.js +3 -3
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/assets/ui-slider.scss +11 -8
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-slider/ui-slider.php +6 -6
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-stepper/ui-stepper.php +6 -6
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/min/ui-switcher.min.css +1 -80
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/min/ui-switcher.min.js +1 -1
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-switcher.js +46 -36
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/assets/ui-switcher.scss +30 -24
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-switcher/ui-switcher.php +12 -10
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-text/ui-text.php +6 -4
- cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-textarea/ui-textarea.php +6 -6
- cherry-framework/modules/cherry-ui-elements/ui-element.php +2 -2
- cherry-framework/modules/cherry-utility/cherry-utility.php +4 -3
- cherry-framework/modules/cherry-utility/inc/cherry-attributes-utilit.php +26 -28
- cherry-framework/modules/cherry-utility/inc/cherry-media-utilit.php +42 -3
- cherry-framework/modules/cherry-utility/inc/cherry-meta-data-utilit.php +13 -7
- cherry-framework/modules/cherry-utility/inc/cherry-satellite-utilit.php +9 -7
- cherry-framework/modules/cherry-widget-factory/cherry-widget-factory.php +4 -3
- cherry-framework/modules/cherry-widget-factory/inc/class-cherry-abstract-widget.php +25 -1
- cherry-framework/setup.php +1 -1
- cherry-projects.php +6 -3
- public/assets/css/styles.css +21 -0
- public/assets/js/cherry-projects-plugin.js +21 -2
- public/assets/js/cherry-projects-scripts.js +43 -1
- public/assets/scss/_projects-terms.scss +13 -1
- public/includes/class-cherry-projects-template-callbacks.php +33 -4
- public/includes/class-projects-data.php +43 -18
- public/includes/class-projects-shortcode.php +1 -1
- public/includes/class-projects-term-data.php +23 -11
- readme.txt +11 -3
- templates/shortcodes/projects-terms/terms-cascading-grid-default.tmpl +11 -0
- templates/shortcodes/projects-terms/terms-grid-default.tmpl +2 -1
- templates/shortcodes/projects-terms/terms-list-default.tmpl +1 -0
- templates/shortcodes/projects-terms/terms-masonry-default.tmpl +2 -1
admin/assets/css/admin-style.css
CHANGED
@@ -184,6 +184,9 @@
|
|
184 |
50% {
|
185 |
-webkit-transform: scale(1);
|
186 |
transform: scale(1); } }
|
|
|
|
|
|
|
187 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box {
|
188 |
display: -webkit-box;
|
189 |
display: -webkit-flex;
|
@@ -206,16 +209,15 @@
|
|
206 |
margin-left: 1%; }
|
207 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box .skill_label-wrap {
|
208 |
-webkit-box-flex: 0;
|
209 |
-
-webkit-flex: 0 1
|
210 |
-
-ms-flex: 0 1
|
211 |
-
flex: 0 1
|
212 |
-
margin-
|
213 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box .skill_value-wrap {
|
214 |
-webkit-box-flex: 0;
|
215 |
-
-webkit-flex: 0 1
|
216 |
-
-ms-flex: 0 1
|
217 |
-
flex: 0 1
|
218 |
-
margin-left: 1%; }
|
219 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box .video_type-wrap {
|
220 |
-webkit-box-flex: 0;
|
221 |
-webkit-flex: 0 1 100%;
|
184 |
50% {
|
185 |
-webkit-transform: scale(1);
|
186 |
transform: scale(1); } }
|
187 |
+
.cherry-project-tabs-wrapper.cherry-component {
|
188 |
+
padding: 5px 0; }
|
189 |
+
|
190 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box {
|
191 |
display: -webkit-box;
|
192 |
display: -webkit-flex;
|
209 |
margin-left: 1%; }
|
210 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box .skill_label-wrap {
|
211 |
-webkit-box-flex: 0;
|
212 |
+
-webkit-flex: 0 1 100%;
|
213 |
+
-ms-flex: 0 1 100%;
|
214 |
+
flex: 0 1 100%;
|
215 |
+
margin-bottom: 20px; }
|
216 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box .skill_value-wrap {
|
217 |
-webkit-box-flex: 0;
|
218 |
+
-webkit-flex: 0 1 100%;
|
219 |
+
-ms-flex: 0 1 100%;
|
220 |
+
flex: 0 1 100%; }
|
|
|
221 |
.cherry-ui-repeater-container .cheryr-ui-repeater-content-box .video_type-wrap {
|
222 |
-webkit-box-flex: 0;
|
223 |
-webkit-flex: 0 1 100%;
|
admin/assets/scss/admin-style.scss
CHANGED
@@ -225,6 +225,12 @@
|
|
225 |
}
|
226 |
}
|
227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
.cherry-ui-repeater-container{
|
229 |
.cheryr-ui-repeater-content-box{
|
230 |
display: flex;
|
@@ -238,12 +244,11 @@
|
|
238 |
margin-left: 1%;
|
239 |
}
|
240 |
.skill_label-wrap{
|
241 |
-
flex: 0 1
|
242 |
-
margin-
|
243 |
}
|
244 |
.skill_value-wrap{
|
245 |
-
flex: 0 1
|
246 |
-
margin-left: 1%;
|
247 |
}
|
248 |
.video_type-wrap{
|
249 |
flex: 0 1 100%;
|
225 |
}
|
226 |
}
|
227 |
|
228 |
+
.cherry-project-tabs-wrapper{
|
229 |
+
&.cherry-component{
|
230 |
+
padding: 5px 0;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
.cherry-ui-repeater-container{
|
235 |
.cheryr-ui-repeater-content-box{
|
236 |
display: flex;
|
244 |
margin-left: 1%;
|
245 |
}
|
246 |
.skill_label-wrap{
|
247 |
+
flex: 0 1 100%;
|
248 |
+
margin-bottom: 20px;
|
249 |
}
|
250 |
.skill_value-wrap{
|
251 |
+
flex: 0 1 100%;
|
|
|
252 |
}
|
253 |
.video_type-wrap{
|
254 |
flex: 0 1 100%;
|
admin/includes/class-projects-meta-boxes.php
CHANGED
@@ -39,12 +39,302 @@ class Cherry_Projects_Meta_Boxes {
|
|
39 |
/**
|
40 |
* Run initialization of modules.
|
41 |
*
|
42 |
-
* @since 1.
|
43 |
*/
|
44 |
public function init() {
|
45 |
$prefix = CHERRY_PROJECTS_POSTMETA;
|
46 |
|
47 |
-
cherry_projects()->get_core()->init_module( 'cherry-post-meta',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
'id' => 'projects-settings',
|
49 |
'title' => esc_html__( 'Projects settings', '__tm' ),
|
50 |
'page' => array( CHERRY_PROJECTS_NAME ),
|
@@ -304,7 +594,7 @@ class Cherry_Projects_Meta_Boxes {
|
|
304 |
),
|
305 |
),
|
306 |
),
|
307 |
-
) )
|
308 |
}
|
309 |
|
310 |
/**
|
@@ -324,4 +614,4 @@ class Cherry_Projects_Meta_Boxes {
|
|
324 |
}
|
325 |
}
|
326 |
|
327 |
-
Cherry_Projects_Meta_Boxes::get_instance();
|
39 |
/**
|
40 |
* Run initialization of modules.
|
41 |
*
|
42 |
+
* @since 1.1.0
|
43 |
*/
|
44 |
public function init() {
|
45 |
$prefix = CHERRY_PROJECTS_POSTMETA;
|
46 |
|
47 |
+
cherry_projects()->get_core()->init_module( 'cherry-post-meta',
|
48 |
+
array(
|
49 |
+
'id' => 'projects-settings',
|
50 |
+
'title' => esc_html__( 'Popup settings', 'cherry-projects' ),
|
51 |
+
'page' => array( CHERRY_PROJECTS_NAME ),
|
52 |
+
'context' => 'normal',
|
53 |
+
'priority' => 'high',
|
54 |
+
'callback_args' => false,
|
55 |
+
'fields' => array(
|
56 |
+
'project_meta_data' => array(
|
57 |
+
'type' => 'settings',
|
58 |
+
'element' => 'settings',
|
59 |
+
),
|
60 |
+
'tab_vertical' => array(
|
61 |
+
'type' => 'component-tab-horizontal',
|
62 |
+
'element' => 'component',
|
63 |
+
'parent' => 'project_meta_data',
|
64 |
+
'class' => 'cherry-project-tabs-wrapper',
|
65 |
+
),
|
66 |
+
'general_tab' => array(
|
67 |
+
'element' => 'settings',
|
68 |
+
'parent' => 'tab_vertical',
|
69 |
+
'title' => esc_html__( 'General', 'cherry-projects' ),
|
70 |
+
'description' => esc_html__( 'General project settings', 'cherry-projects' ),
|
71 |
+
),
|
72 |
+
'image_format_tab' => array(
|
73 |
+
'element' => 'settings',
|
74 |
+
'parent' => 'tab_vertical',
|
75 |
+
'title' => esc_html__( 'Image Format', 'cherry-projects' ),
|
76 |
+
'description' => esc_html__( 'Project options for Image format', 'cherry-projects' ),
|
77 |
+
),
|
78 |
+
'gallery_format_tab' => array(
|
79 |
+
'element' => 'settings',
|
80 |
+
'parent' => 'tab_vertical',
|
81 |
+
'title' => esc_html__( 'Gallery Format', 'cherry-projects' ),
|
82 |
+
'description' => esc_html__( 'Project options for Gallery format', 'cherry-projects' ),
|
83 |
+
),
|
84 |
+
'audio_format_tab' => array(
|
85 |
+
'element' => 'settings',
|
86 |
+
'parent' => 'tab_vertical',
|
87 |
+
'title' => esc_html__( 'Audio Format', 'cherry-projects' ),
|
88 |
+
'description' => esc_html__( 'Project options for Audio format', 'cherry-projects' ),
|
89 |
+
),
|
90 |
+
'video_format_tab' => array(
|
91 |
+
'element' => 'settings',
|
92 |
+
'parent' => 'tab_vertical',
|
93 |
+
'title' => esc_html__( 'Video Format', 'cherry-projects' ),
|
94 |
+
'description' => esc_html__( 'Project options for Video format', 'cherry-projects' ),
|
95 |
+
),
|
96 |
+
$prefix . '_external_link' => array(
|
97 |
+
'type' => 'text',
|
98 |
+
'parent' => 'general_tab',
|
99 |
+
'title' => esc_html__( 'External link', 'cherry-projects' ),
|
100 |
+
'description' => esc_html__( 'Input external link address', 'cherry-projects' ),
|
101 |
+
'value' => '#',
|
102 |
+
),
|
103 |
+
$prefix . '_external_link_text' => array(
|
104 |
+
'type' => 'text',
|
105 |
+
'parent' => 'general_tab',
|
106 |
+
'title' => esc_html__( 'External link text', 'cherry-projects' ),
|
107 |
+
'description' => esc_html__( 'Text for external link', 'cherry-projects' ),
|
108 |
+
'value' => '',
|
109 |
+
),
|
110 |
+
$prefix . '_external_link_target' => array(
|
111 |
+
'type' => 'radio',
|
112 |
+
'parent' => 'general_tab',
|
113 |
+
'title' => esc_html__( 'External link target', 'cherry-projects' ),
|
114 |
+
'description' => esc_html__( 'Target for external link', 'cherry-projects' ),
|
115 |
+
'value' => 'blank',
|
116 |
+
'display-input' => true,
|
117 |
+
'options' => array(
|
118 |
+
'blank' => array(
|
119 |
+
'label' => esc_html__( 'Blank', 'cherry-projects' ),
|
120 |
+
),
|
121 |
+
'self' => array(
|
122 |
+
'label' => esc_html__( 'Self', 'cherry-projects' ),
|
123 |
+
),
|
124 |
+
),
|
125 |
+
),
|
126 |
+
$prefix . '_details' => array(
|
127 |
+
'type' => 'repeater',
|
128 |
+
'parent' => 'general_tab',
|
129 |
+
'title' => esc_html__( 'Projects Details', 'cherry-projects' ),
|
130 |
+
'description' => esc_html__( 'Here you can create a list of project details', 'cherry-projects' ),
|
131 |
+
'add_label' => esc_html__( 'Add Projects Details', 'cherry-projects' ),
|
132 |
+
'title_field' => 'detail_label',
|
133 |
+
'fields' => array(
|
134 |
+
'detail_label' => array(
|
135 |
+
'type' => 'text',
|
136 |
+
'id' => 'detail_label',
|
137 |
+
'name' => 'detail_label',
|
138 |
+
'placeholder' => esc_html__( 'Enter label', 'cherry-projects' ),
|
139 |
+
'label' => esc_html__( 'Detail Label', 'cherry-projects' ),
|
140 |
+
),
|
141 |
+
'detail_info' => array(
|
142 |
+
'type' => 'text',
|
143 |
+
'id' => 'detail_info',
|
144 |
+
'name' => 'detail_info',
|
145 |
+
'placeholder' => esc_html__( 'Enter info', 'cherry-projects' ),
|
146 |
+
'label' => esc_html__( 'Detail Info', 'cherry-projects' ),
|
147 |
+
),
|
148 |
+
),
|
149 |
+
),
|
150 |
+
$prefix . '_skills' => array(
|
151 |
+
'type' => 'repeater',
|
152 |
+
'parent' => 'general_tab',
|
153 |
+
'title' => esc_html__( 'Projects skills', 'cherry-projects' ),
|
154 |
+
'description' => esc_html__( 'Here you can create a list of participants in the creation of the project', 'cherry-projects' ),
|
155 |
+
'add_label' => esc_html__( 'Add Skill', 'cherry-projects' ),
|
156 |
+
'title_field' => 'skill_label',
|
157 |
+
'fields' => array(
|
158 |
+
'skill_label' => array(
|
159 |
+
'type' => 'text',
|
160 |
+
'id' => 'skill_label',
|
161 |
+
'name' => 'skill_label',
|
162 |
+
'placeholder' => esc_html__( 'Skill label', 'cherry-projects' ),
|
163 |
+
'label' => esc_html__( 'Skill Label', 'cherry-projects' ),
|
164 |
+
),
|
165 |
+
'skill_value' => array(
|
166 |
+
'type' => 'slider',
|
167 |
+
'id' => 'skill_value',
|
168 |
+
'name' => 'skill_value',
|
169 |
+
'label' => esc_html__( 'Skill Value', 'cherry-projects' ),
|
170 |
+
),
|
171 |
+
),
|
172 |
+
),
|
173 |
+
$prefix . '_image_attachments_ids' => array(
|
174 |
+
'type' => 'media',
|
175 |
+
'parent' => 'image_format_tab',
|
176 |
+
'title' => esc_html__( 'Additional images', 'cherry-projects' ),
|
177 |
+
'description' => esc_html__( 'Select attachments images', 'cherry-projects' ),
|
178 |
+
'display_image' => true,
|
179 |
+
'multi_upload' => true,
|
180 |
+
'upload_button_text' => __( 'Add images', 'cherry-projects' ),
|
181 |
+
'library_type' => 'image',
|
182 |
+
),
|
183 |
+
$prefix . '_listing_layout' => array(
|
184 |
+
'type' => 'radio',
|
185 |
+
'parent' => 'image_format_tab',
|
186 |
+
'title' => esc_html__( 'Image listing layout', 'cherry-projects' ),
|
187 |
+
'description' => esc_html__( 'Select listing layout', 'cherry-projects' ),
|
188 |
+
'value' => 'grid-layout',
|
189 |
+
'class' => '',
|
190 |
+
'display_input' => false,
|
191 |
+
'options' => array(
|
192 |
+
'grid-layout' => array(
|
193 |
+
'label' => esc_html__( 'Grid', 'cherry-projects' ),
|
194 |
+
'img_src' => CHERRY_PROJECTS_URI . 'public/assets/images/svg/list-layout-grid.svg',
|
195 |
+
'slave' => 'projects-listing-layout-grid-layout',
|
196 |
+
),
|
197 |
+
'masonry-layout' => array(
|
198 |
+
'label' => esc_html__( 'Masonry', 'cherry-projects' ),
|
199 |
+
'img_src' => CHERRY_PROJECTS_URI . 'public/assets/images/svg/list-layout-masonry.svg',
|
200 |
+
'slave' => 'projects-listing-layout-masonry-layout',
|
201 |
+
),
|
202 |
+
),
|
203 |
+
),
|
204 |
+
$prefix . '_column_number' => array(
|
205 |
+
'type' => 'slider',
|
206 |
+
'parent' => 'image_format_tab',
|
207 |
+
'title' => esc_html__( 'Column number', 'cherry-projects' ),
|
208 |
+
'description' => esc_html__( 'Select number of columns for masonry and grid projects layouts.', 'cherry-projects' ),
|
209 |
+
'max_value' => 10,
|
210 |
+
'min_value' => 1,
|
211 |
+
'value' => 3,
|
212 |
+
),
|
213 |
+
$prefix . '_image_margin' => array(
|
214 |
+
'type' => 'slider',
|
215 |
+
'parent' => 'image_format_tab',
|
216 |
+
'title' => esc_html__( 'Image margin', 'cherry-projects' ),
|
217 |
+
'description' => esc_html__( 'Select projects item margin (outer indent) value.(px)', 'cherry-projects' ),
|
218 |
+
'max_value' => 30,
|
219 |
+
'min_value' => 0,
|
220 |
+
'value' => 10,
|
221 |
+
),
|
222 |
+
$prefix . '_slider_attachments_ids' => array(
|
223 |
+
'type' => 'media',
|
224 |
+
'parent' => 'gallery_format_tab',
|
225 |
+
'title' => esc_html__( 'Gallery images', 'cherry-projects' ),
|
226 |
+
'description' => esc_html__( 'Select gallery images', 'cherry-projects' ),
|
227 |
+
'display_image' => true,
|
228 |
+
'multi_upload' => true,
|
229 |
+
'upload_button_text' => __( 'Add images', 'cherry-projects' ),
|
230 |
+
'library_type' => 'image',
|
231 |
+
),
|
232 |
+
$prefix . '_slider_navigation' => array(
|
233 |
+
'type' => 'switcher',
|
234 |
+
'parent' => 'gallery_format_tab',
|
235 |
+
'value' => 'true',
|
236 |
+
'title' => esc_html__( 'Use navigation?', 'cherry-projects' ),
|
237 |
+
'description' => esc_html__( 'Set the value to true if you want to use navigation', 'cherry-projects' ),
|
238 |
+
),
|
239 |
+
$prefix . '_slider_loop' => array(
|
240 |
+
'type' => 'switcher',
|
241 |
+
'parent' => 'gallery_format_tab',
|
242 |
+
'value' => 'true',
|
243 |
+
'title' => esc_html__( 'Use infinite scrolling?', 'cherry-projects' ),
|
244 |
+
'description' => esc_html__( 'Set the value to true if you want to use infinite scrolling', 'cherry-projects' ),
|
245 |
+
),
|
246 |
+
$prefix . '_slider_thumbnails_position' => array(
|
247 |
+
'type' => 'radio',
|
248 |
+
'parent' => 'gallery_format_tab',
|
249 |
+
'title' => esc_html__( 'Thumbnails position', 'cherry-projects' ),
|
250 |
+
'description' => esc_html__( 'Select position for Thumbnails list', 'cherry-projects' ),
|
251 |
+
'value' => 'bottom',
|
252 |
+
'display-input' => true,
|
253 |
+
'options' => array(
|
254 |
+
'top' => array(
|
255 |
+
'label' => esc_html__( 'Top', 'cherry-projects' ),
|
256 |
+
),
|
257 |
+
'bottom' => array(
|
258 |
+
'label' => esc_html__( 'Bottom', 'cherry-projects' ),
|
259 |
+
),
|
260 |
+
'right' => array(
|
261 |
+
'label' => esc_html__( 'Right', 'cherry-projects' ),
|
262 |
+
),
|
263 |
+
'left' => array(
|
264 |
+
'label' => esc_html__( 'Left', 'cherry-projects' ),
|
265 |
+
),
|
266 |
+
),
|
267 |
+
),
|
268 |
+
$prefix . '_audio_attachments_ids' => array(
|
269 |
+
'type' => 'media',
|
270 |
+
'parent' => 'audio_format_tab',
|
271 |
+
'title' => esc_html__( 'Audio source', 'cherry-projects' ),
|
272 |
+
'description' => esc_html__( 'Select audio source( mp3, m4a, ogg, wav, wma )', 'cherry-projects' ),
|
273 |
+
'display_image' => true,
|
274 |
+
'multi_upload' => true,
|
275 |
+
'upload_button_text' => esc_html__( 'Add sound', 'cherry-projects' ),
|
276 |
+
'library_type' => 'audio',
|
277 |
+
),
|
278 |
+
$prefix . '_video_list' => array(
|
279 |
+
'type' => 'repeater',
|
280 |
+
'parent' => 'video_format_tab',
|
281 |
+
'title' => esc_html__( 'Video list', 'cherry-projects' ),
|
282 |
+
'description' => esc_html__( 'Select video source', 'cherry-projects' ),
|
283 |
+
'add_label' => esc_html__( 'Add New Video', 'cherry-projects' ),
|
284 |
+
'title_field' => 'detail_label',
|
285 |
+
'fields' => array(
|
286 |
+
'video_type' => array(
|
287 |
+
'type' => 'radio',
|
288 |
+
'label' => esc_html__( 'Video source type', 'cherry-projects' ),
|
289 |
+
'id' => 'video_type',
|
290 |
+
'name' => 'video_type',
|
291 |
+
'display-input' => true,
|
292 |
+
'options' => array(
|
293 |
+
'embed' => array(
|
294 |
+
'label' => esc_html__( 'Embed video type', 'cherry-projects' ),
|
295 |
+
),
|
296 |
+
'html5' => array(
|
297 |
+
'label' => esc_html__( 'HTML5 video type', 'cherry-projects' ),
|
298 |
+
),
|
299 |
+
),
|
300 |
+
),
|
301 |
+
'video_embed' => array(
|
302 |
+
'type' => 'text',
|
303 |
+
'id' => 'video_embed',
|
304 |
+
'name' => 'video_embed',
|
305 |
+
'placeholder' => esc_html__( 'Select embed url', 'cherry-projects' ),
|
306 |
+
'label' => esc_html__( 'Video embed url', 'cherry-projects' ),
|
307 |
+
),
|
308 |
+
'video_src' => array(
|
309 |
+
'type' => 'media',
|
310 |
+
'id' => 'video_src',
|
311 |
+
'name' => 'video_src',
|
312 |
+
'label' => esc_html__( 'HTML5 Video source', 'cherry-projects' ),
|
313 |
+
'display_image' => true,
|
314 |
+
'multi_upload' => false,
|
315 |
+
'upload_button_text' => esc_html__( 'Add Video', 'cherry-projects' ),
|
316 |
+
'library_type' => 'video',
|
317 |
+
),
|
318 |
+
'poster_src' => array(
|
319 |
+
'type' => 'media',
|
320 |
+
'id' => 'poster_src',
|
321 |
+
'name' => 'poster_src',
|
322 |
+
'label' => esc_html__( 'HTML5 video poster', 'cherry-projects' ),
|
323 |
+
'display_image' => true,
|
324 |
+
'multi_upload' => false,
|
325 |
+
'upload_button_text' => esc_html__( 'Add Poster', 'cherry-projects' ),
|
326 |
+
'library_type' => 'image',
|
327 |
+
),
|
328 |
+
),
|
329 |
+
),
|
330 |
+
//
|
331 |
+
)
|
332 |
+
)
|
333 |
+
);
|
334 |
+
|
335 |
+
|
336 |
+
|
337 |
+
/*cherry_projects()->get_core()->init_module( 'cherry-post-meta', array(
|
338 |
'id' => 'projects-settings',
|
339 |
'title' => esc_html__( 'Projects settings', '__tm' ),
|
340 |
'page' => array( CHERRY_PROJECTS_NAME ),
|
594 |
),
|
595 |
),
|
596 |
),
|
597 |
+
) );*/
|
598 |
}
|
599 |
|
600 |
/**
|
614 |
}
|
615 |
}
|
616 |
|
617 |
+
Cherry_Projects_Meta_Boxes::get_instance();
|
cherry-framework/cherry-core.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class Cherry Core
|
4 |
-
* Version: 1.
|
5 |
*
|
6 |
* @package Cherry_Framework
|
7 |
* @subpackage Class
|
@@ -59,9 +59,10 @@ if ( ! class_exists( 'Cherry_Core' ) ) {
|
|
59 |
* Constructor.
|
60 |
*
|
61 |
* @since 1.0.0
|
|
|
62 |
*/
|
63 |
public function __construct( $settings = array() ) {
|
64 |
-
$base_dir = trailingslashit(
|
65 |
$base_url = trailingslashit( $this->base_url( '', __FILE__ ) );
|
66 |
|
67 |
$defaults = array(
|
@@ -405,8 +406,8 @@ if ( ! class_exists( 'Cherry_Core' ) ) {
|
|
405 |
if ( 0 === strpos( $module_path, $plugin_dir ) ) {
|
406 |
$url = plugin_dir_url( $module_path );
|
407 |
} else if ( false !== strpos( $module_path, $theme_dir ) ) {
|
408 |
-
$explode = explode( $theme_dir, $module_dir
|
409 |
-
$url = get_stylesheet_directory_uri() . $explode
|
410 |
} else {
|
411 |
$site_url = site_url();
|
412 |
$abs_path = wp_normalize_path( ABSPATH );
|
@@ -444,7 +445,7 @@ if ( ! class_exists( 'Cherry_Core' ) ) {
|
|
444 |
* Get path to the core directory.
|
445 |
*
|
446 |
* @since 1.0.0
|
447 |
-
* @deprecated 1.1.0 Use constant `
|
448 |
* @return string
|
449 |
*/
|
450 |
public function get_core_dir() {
|
1 |
<?php
|
2 |
/**
|
3 |
* Class Cherry Core
|
4 |
+
* Version: 1.3.0
|
5 |
*
|
6 |
* @package Cherry_Framework
|
7 |
* @subpackage Class
|
59 |
* Constructor.
|
60 |
*
|
61 |
* @since 1.0.0
|
62 |
+
* @since 1.1.1 Using dirname( __FILE__ ) instead of __DIR__.
|
63 |
*/
|
64 |
public function __construct( $settings = array() ) {
|
65 |
+
$base_dir = trailingslashit( dirname( __FILE__ ) );
|
66 |
$base_url = trailingslashit( $this->base_url( '', __FILE__ ) );
|
67 |
|
68 |
$defaults = array(
|
406 |
if ( 0 === strpos( $module_path, $plugin_dir ) ) {
|
407 |
$url = plugin_dir_url( $module_path );
|
408 |
} else if ( false !== strpos( $module_path, $theme_dir ) ) {
|
409 |
+
$explode = explode( $theme_dir, $module_dir );
|
410 |
+
$url = get_stylesheet_directory_uri() . end( $explode );
|
411 |
} else {
|
412 |
$site_url = site_url();
|
413 |
$abs_path = wp_normalize_path( ABSPATH );
|
445 |
* Get path to the core directory.
|
446 |
*
|
447 |
* @since 1.0.0
|
448 |
+
* @deprecated 1.1.0 Use constant `dirname( __FILE__ )`
|
449 |
* @return string
|
450 |
*/
|
451 |
public function get_core_dir() {
|
cherry-framework/config.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"name" : "Cherry Framework",
|
3 |
-
"version" : "1.
|
4 |
"description" : "",
|
5 |
"doc_link" : "",
|
6 |
"git_link" : "https://github.com/CherryFramework/cherry-framework",
|
@@ -8,6 +8,7 @@
|
|
8 |
"cherry-breadcrumbs" : {
|
9 |
"name" : "Breadcrumb Trail",
|
10 |
"description" : "A breadcrumb menu script for WordPress.",
|
|
|
11 |
"doc_link" : "",
|
12 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-breadcrumbs",
|
13 |
"compatible" : ["theme", "plugin"],
|
@@ -15,19 +16,10 @@
|
|
15 |
"required" : false,
|
16 |
"dependencies" : []
|
17 |
},
|
18 |
-
"cherry-creator" : {
|
19 |
-
"name" : "Creator.",
|
20 |
-
"description" : "Creator.",
|
21 |
-
"doc_link" : "",
|
22 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-creator",
|
23 |
-
"compatible" : ["theme", "plugin"],
|
24 |
-
"wordpress_org" : true,
|
25 |
-
"required" : false,
|
26 |
-
"dependencies" : []
|
27 |
-
},
|
28 |
"cherry-customizer" : {
|
29 |
-
"name" : "Customizer",
|
30 |
"description" : "Customizer functionality.",
|
|
|
31 |
"doc_link" : "",
|
32 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-customizer",
|
33 |
"compatible" : ["theme", "plugin"],
|
@@ -36,8 +28,9 @@
|
|
36 |
"dependencies" : []
|
37 |
},
|
38 |
"cherry-dynamic-css" : {
|
39 |
-
"name" : "Dynamic
|
40 |
-
"description" : "Generate
|
|
|
41 |
"doc_link" : "",
|
42 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-dynamic-css",
|
43 |
"compatible" : ["theme", "plugin"],
|
@@ -47,7 +40,8 @@
|
|
47 |
},
|
48 |
"cherry-google-fonts-loader" : {
|
49 |
"name" : "Google Fonts Loader",
|
50 |
-
"description" : "Enqueue Google
|
|
|
51 |
"doc_link" : "",
|
52 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-google-fonts-loader",
|
53 |
"compatible" : ["theme", "plugin"],
|
@@ -55,39 +49,43 @@
|
|
55 |
"required" : false,
|
56 |
"dependencies" : []
|
57 |
},
|
58 |
-
"cherry-
|
59 |
-
"name" : "
|
60 |
-
"description" : "
|
|
|
61 |
"doc_link" : "",
|
62 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
63 |
"compatible" : ["theme", "plugin"],
|
64 |
"wordpress_org" : true,
|
65 |
"required" : false,
|
66 |
-
"dependencies" : []
|
67 |
},
|
68 |
-
"cherry-
|
69 |
-
"name" : "
|
70 |
-
"description" : "
|
|
|
71 |
"doc_link" : "",
|
72 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
73 |
-
"compatible" : ["plugin"],
|
74 |
"wordpress_org" : true,
|
75 |
"required" : false,
|
76 |
-
"dependencies" : []
|
77 |
},
|
78 |
-
"cherry-
|
79 |
-
"name" : "
|
80 |
-
"description" : "
|
|
|
81 |
"doc_link" : "",
|
82 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
83 |
-
"compatible" : ["plugin"],
|
84 |
-
"wordpress_org" :
|
85 |
"required" : false,
|
86 |
"dependencies" : []
|
87 |
},
|
88 |
"cherry-post-formats-api" : {
|
89 |
"name" : "Post Formats API",
|
90 |
"description" : "API for post formats specific content.",
|
|
|
91 |
"doc_link" : "",
|
92 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-formats-api",
|
93 |
"compatible" : ["theme", "plugin"],
|
@@ -98,29 +96,21 @@
|
|
98 |
"cherry-post-meta" : {
|
99 |
"name" : "Post Meta",
|
100 |
"description" : "Manage post meta.",
|
|
|
101 |
"doc_link" : "",
|
102 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-meta",
|
103 |
"compatible" : ["theme", "plugin"],
|
104 |
"wordpress_org" : true,
|
105 |
"required" : false,
|
106 |
-
"dependencies" : [ "cherry-
|
107 |
-
},
|
108 |
-
"cherry-post-types" : {
|
109 |
-
"name" : "Post Types",
|
110 |
-
"description" : "Provides functionality for creating custom post types.",
|
111 |
-
"doc_link" : "",
|
112 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-types",
|
113 |
-
"compatible" : ["plugin"],
|
114 |
-
"wordpress_org" : true,
|
115 |
-
"required" : false,
|
116 |
-
"dependencies" : [ "cherry-ui-elements" ]
|
117 |
},
|
118 |
-
"cherry-
|
119 |
-
"name" : "
|
120 |
-
"description" : "
|
|
|
121 |
"doc_link" : "",
|
122 |
-
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-
|
123 |
-
"compatible" : ["plugin"],
|
124 |
"wordpress_org" : true,
|
125 |
"required" : false,
|
126 |
"dependencies" : []
|
@@ -128,6 +118,7 @@
|
|
128 |
"cherry-term-meta" : {
|
129 |
"name" : "Term Meta",
|
130 |
"description" : "Manage term metadata.",
|
|
|
131 |
"doc_link" : "",
|
132 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-term-meta",
|
133 |
"compatible" : ["theme", "plugin"],
|
@@ -135,19 +126,21 @@
|
|
135 |
"required" : false,
|
136 |
"dependencies" : [ "cherry-ui-elements" ]
|
137 |
},
|
138 |
-
"cherry-
|
139 |
-
"name"
|
140 |
-
"description"
|
141 |
-
"
|
142 |
-
"
|
143 |
-
"
|
144 |
-
"
|
145 |
-
"
|
146 |
-
"
|
|
|
147 |
},
|
148 |
"cherry-ui-elements" : {
|
149 |
"name" : "UI Elements",
|
150 |
"description" : "UI Elements",
|
|
|
151 |
"doc_link" : "",
|
152 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-ui-elements",
|
153 |
"compatible" : ["theme", "plugin"],
|
@@ -158,6 +151,7 @@
|
|
158 |
"cherry-utility" : {
|
159 |
"name" : "Utility",
|
160 |
"description" : "Multiple utility functions.",
|
|
|
161 |
"doc_link" : "",
|
162 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-utility",
|
163 |
"compatible" : ["theme", "plugin"],
|
@@ -166,24 +160,15 @@
|
|
166 |
"dependencies" : []
|
167 |
},
|
168 |
"cherry-widget-factory" : {
|
169 |
-
"name" : "Widget Factory
|
170 |
"description" : "Base widget class that simplifies creating of your own widgets.",
|
|
|
171 |
"doc_link" : "",
|
172 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-widget-factory",
|
173 |
"compatible" : ["theme", "plugin"],
|
174 |
"wordpress_org" : true,
|
175 |
"required" : false,
|
176 |
"dependencies" : [ "cherry-ui-elements" ]
|
177 |
-
},
|
178 |
-
"cherry-toolkit": {
|
179 |
-
"name": "Framework Toolkit",
|
180 |
-
"description": "Framework Toolkit contains various PHP utilities",
|
181 |
-
"doc_link": "",
|
182 |
-
"git_link": "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-toolkit",
|
183 |
-
"compatible": ["theme", "plugin"],
|
184 |
-
"wordpress_org": true,
|
185 |
-
"required": true,
|
186 |
-
"dependencies": []
|
187 |
}
|
188 |
}
|
189 |
}
|
1 |
{
|
2 |
"name" : "Cherry Framework",
|
3 |
+
"version" : "1.3.0",
|
4 |
"description" : "",
|
5 |
"doc_link" : "",
|
6 |
"git_link" : "https://github.com/CherryFramework/cherry-framework",
|
8 |
"cherry-breadcrumbs" : {
|
9 |
"name" : "Breadcrumb Trail",
|
10 |
"description" : "A breadcrumb menu script for WordPress.",
|
11 |
+
"version" : "1.1.1",
|
12 |
"doc_link" : "",
|
13 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-breadcrumbs",
|
14 |
"compatible" : ["theme", "plugin"],
|
16 |
"required" : false,
|
17 |
"dependencies" : []
|
18 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
"cherry-customizer" : {
|
20 |
+
"name" : "Customizer API",
|
21 |
"description" : "Customizer functionality.",
|
22 |
+
"version" : "1.1.4",
|
23 |
"doc_link" : "",
|
24 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-customizer",
|
25 |
"compatible" : ["theme", "plugin"],
|
28 |
"dependencies" : []
|
29 |
},
|
30 |
"cherry-dynamic-css" : {
|
31 |
+
"name" : "Dynamic CSS",
|
32 |
+
"description" : "Generate CSS.",
|
33 |
+
"version" : "1.2.0",
|
34 |
"doc_link" : "",
|
35 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-dynamic-css",
|
36 |
"compatible" : ["theme", "plugin"],
|
40 |
},
|
41 |
"cherry-google-fonts-loader" : {
|
42 |
"name" : "Google Fonts Loader",
|
43 |
+
"description" : "Enqueue Google fonts.",
|
44 |
+
"version" : "1.1.0",
|
45 |
"doc_link" : "",
|
46 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-google-fonts-loader",
|
47 |
"compatible" : ["theme", "plugin"],
|
49 |
"required" : false,
|
50 |
"dependencies" : []
|
51 |
},
|
52 |
+
"cherry-handler" : {
|
53 |
+
"name" : "Cherry handler",
|
54 |
+
"description" : "Initialize handlers.",
|
55 |
+
"version" : "1.0.0",
|
56 |
"doc_link" : "",
|
57 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-handler",
|
58 |
"compatible" : ["theme", "plugin"],
|
59 |
"wordpress_org" : true,
|
60 |
"required" : false,
|
61 |
+
"dependencies" : [ "cherry-js-core" ]
|
62 |
},
|
63 |
+
"cherry-interface-builder" : {
|
64 |
+
"name" : "Interface Builder",
|
65 |
+
"description" : "The module for the creation of interfaces in the WordPress admin panel.",
|
66 |
+
"version" : "1.0.3",
|
67 |
"doc_link" : "",
|
68 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-interface-builder",
|
69 |
+
"compatible" : ["theme", "plugin"],
|
70 |
"wordpress_org" : true,
|
71 |
"required" : false,
|
72 |
+
"dependencies" : [ "cherry-ui-elements" ]
|
73 |
},
|
74 |
+
"cherry-js-core" : {
|
75 |
+
"name" : "JS Core",
|
76 |
+
"description" : "Initialize global JS object which provides additional plugin functionality.",
|
77 |
+
"version" : "1.1.2",
|
78 |
"doc_link" : "",
|
79 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-js-core",
|
80 |
+
"compatible" : ["theme", "plugin"],
|
81 |
+
"wordpress_org" : true,
|
82 |
"required" : false,
|
83 |
"dependencies" : []
|
84 |
},
|
85 |
"cherry-post-formats-api" : {
|
86 |
"name" : "Post Formats API",
|
87 |
"description" : "API for post formats specific content.",
|
88 |
+
"version" : "1.1.2",
|
89 |
"doc_link" : "",
|
90 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-formats-api",
|
91 |
"compatible" : ["theme", "plugin"],
|
96 |
"cherry-post-meta" : {
|
97 |
"name" : "Post Meta",
|
98 |
"description" : "Manage post meta.",
|
99 |
+
"version" : "1.2.1",
|
100 |
"doc_link" : "",
|
101 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-post-meta",
|
102 |
"compatible" : ["theme", "plugin"],
|
103 |
"wordpress_org" : true,
|
104 |
"required" : false,
|
105 |
+
"dependencies" : [ "cherry-interface-builder" ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
},
|
107 |
+
"cherry-template-manager" : {
|
108 |
+
"name" : "Template Manager",
|
109 |
+
"description" : "Module for load and parse *.tmpl files.",
|
110 |
+
"version" : "1.0.0",
|
111 |
"doc_link" : "",
|
112 |
+
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-template-manager",
|
113 |
+
"compatible" : ["theme", "plugin"],
|
114 |
"wordpress_org" : true,
|
115 |
"required" : false,
|
116 |
"dependencies" : []
|
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"],
|
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.0",
|
144 |
"doc_link" : "",
|
145 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-ui-elements",
|
146 |
"compatible" : ["theme", "plugin"],
|
151 |
"cherry-utility" : {
|
152 |
"name" : "Utility",
|
153 |
"description" : "Multiple utility functions.",
|
154 |
+
"version" : "1.1.4",
|
155 |
"doc_link" : "",
|
156 |
"git_link" : "https://github.com/CherryFramework/cherry-framework/tree/master/modules/cherry-utility",
|
157 |
"compatible" : ["theme", "plugin"],
|
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.0",
|
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 |
}
|
cherry-framework/modules/cherry-breadcrumbs/cherry-breadcrumbs.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: Breadcrumb Trail
|
4 |
* Description: A breadcrumb menu script for WordPress
|
5 |
-
* Version: 1.1.
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -35,18 +35,10 @@ if ( ! class_exists( 'Cherry_Breadcrumbs' ) ) {
|
|
35 |
* Breadcrumbs builder class.
|
36 |
* Class is based on Breadcrumb Trail plugin by Justin Tadlock.
|
37 |
*
|
38 |
-
* @since
|
39 |
*/
|
40 |
class Cherry_Breadcrumbs {
|
41 |
|
42 |
-
/**
|
43 |
-
* Module version.
|
44 |
-
*
|
45 |
-
* @since 1.0.0
|
46 |
-
* @var string
|
47 |
-
*/
|
48 |
-
public $module_version = '1.1.0';
|
49 |
-
|
50 |
/**
|
51 |
* A reference to an instance of this class.
|
52 |
*
|
@@ -657,7 +649,7 @@ if ( ! class_exists( 'Cherry_Breadcrumbs' ) ) {
|
|
657 |
return;
|
658 |
}
|
659 |
|
660 |
-
$url = network_home_url();
|
661 |
$label = $this->args['labels']['home'];
|
662 |
|
663 |
$this->_add_item( 'home_format', $label, $url );
|
@@ -676,7 +668,7 @@ if ( ! class_exists( 'Cherry_Breadcrumbs' ) ) {
|
|
676 |
? 'link_format'
|
677 |
: 'home_format';
|
678 |
|
679 |
-
$url = home_url( '/' );
|
680 |
$label = ( is_multisite() && ! is_main_site() && true === $this->args['network'] )
|
681 |
? get_bloginfo( 'name' )
|
682 |
: $this->args['labels']['home'];
|
@@ -1125,7 +1117,10 @@ if ( ! class_exists( 'Cherry_Breadcrumbs' ) ) {
|
|
1125 |
$this->_add_item(
|
1126 |
'link_format',
|
1127 |
$week,
|
1128 |
-
add_query_arg(
|
|
|
|
|
|
|
1129 |
);
|
1130 |
|
1131 |
}
|
2 |
/**
|
3 |
* Module Name: Breadcrumb Trail
|
4 |
* Description: A breadcrumb menu script for WordPress
|
5 |
+
* Version: 1.1.1
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
35 |
* Breadcrumbs builder class.
|
36 |
* Class is based on Breadcrumb Trail plugin by Justin Tadlock.
|
37 |
*
|
38 |
+
* @since 1.0.0
|
39 |
*/
|
40 |
class Cherry_Breadcrumbs {
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* A reference to an instance of this class.
|
44 |
*
|
649 |
return;
|
650 |
}
|
651 |
|
652 |
+
$url = esc_url( network_home_url() );
|
653 |
$label = $this->args['labels']['home'];
|
654 |
|
655 |
$this->_add_item( 'home_format', $label, $url );
|
668 |
? 'link_format'
|
669 |
: 'home_format';
|
670 |
|
671 |
+
$url = esc_url( home_url( '/' ) );
|
672 |
$label = ( is_multisite() && ! is_main_site() && true === $this->args['network'] )
|
673 |
? get_bloginfo( 'name' )
|
674 |
: $this->args['labels']['home'];
|
1117 |
$this->_add_item(
|
1118 |
'link_format',
|
1119 |
$week,
|
1120 |
+
add_query_arg(
|
1121 |
+
array( 'm' => get_the_time( 'Y' ), 'w' => get_the_time( 'W' ) ),
|
1122 |
+
esc_url( home_url( '/' ) )
|
1123 |
+
)
|
1124 |
);
|
1125 |
|
1126 |
}
|
cherry-framework/modules/cherry-creator/cherry-creator.php
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Creator
|
4 |
-
*
|
5 |
-
* Module Name: Creator
|
6 |
-
* Description: Creator
|
7 |
-
* Version: 1.1.0
|
8 |
-
* Author: Cherry Team
|
9 |
-
* Author URI: http://www.cherryframework.com/
|
10 |
-
* License: GPLv3
|
11 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
-
*
|
13 |
-
* @package Cherry_Framework
|
14 |
-
* @subpackage Modules
|
15 |
-
* @version 1.1.0
|
16 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
17 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
18 |
-
* @link http://www.cherryframework.com/
|
19 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
20 |
-
*/
|
21 |
-
|
22 |
-
// If this file is called directly, abort.
|
23 |
-
if ( ! defined( 'WPINC' ) ) {
|
24 |
-
die;
|
25 |
-
}
|
26 |
-
|
27 |
-
if ( ! class_exists( 'Cherry_Creator' ) ) {
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Cherry post types class
|
31 |
-
*/
|
32 |
-
class Cherry_Creator {
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Module version
|
36 |
-
*
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
public $module_version = '1.1.0';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Module slug
|
43 |
-
*
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
public $module_slug = 'cherry-creator';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Default post type arguments
|
50 |
-
*
|
51 |
-
* @var null
|
52 |
-
*/
|
53 |
-
private $defaults = null;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Module directory
|
57 |
-
*
|
58 |
-
* @since 1.0.0
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
private $module_directory = '';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Cherry_Post_Type class constructor
|
65 |
-
*/
|
66 |
-
public function __construct( $core, $args = array() ) {
|
67 |
-
$this->defaults = $args;
|
68 |
-
$this->module_directory = $core->settings['base_dir'] . '/modules/' . $this->module_slug;
|
69 |
-
|
70 |
-
// Load Creator Term
|
71 |
-
if ( ! class_exists( 'Cherry_Creator_Term' ) ) {
|
72 |
-
require_once( $this->module_directory . '/inc/cherry-creator-term.php' );
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Create Chery_Creator_Term object
|
78 |
-
*
|
79 |
-
* @param [type] $title term.
|
80 |
-
* @param [string] $tax taxonomy.
|
81 |
-
* @param array $args arguments.
|
82 |
-
* @return Chery_Creator_Term
|
83 |
-
*/
|
84 |
-
public static function term( $title, $tax = 'category', $args = array() ) {
|
85 |
-
// Load Creator Term
|
86 |
-
if ( ! class_exists( 'Cherry_Creator_Term' ) ) {
|
87 |
-
require_once( 'cherry-creator-term.php' );
|
88 |
-
}
|
89 |
-
return new Cherry_Creator_Term( $title, $tax, $args );
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* New / Update post
|
94 |
-
*
|
95 |
-
* @param array $properties new or update post properties.
|
96 |
-
* @return post id or 0.
|
97 |
-
*/
|
98 |
-
public static function post( $properties = array(), $unique = false ) {
|
99 |
-
if ( $unique && array_key_exists( 'post_title', $properties ) ) {
|
100 |
-
$post_type = 'page';
|
101 |
-
if ( array_key_exists( 'post_type', $properties ) ) {
|
102 |
-
$post_type = $properties['post_type'];
|
103 |
-
}
|
104 |
-
$post = get_page_by_path( sanitize_title( $properties['post_title'] ), OBJECT, $post_type );
|
105 |
-
if ( null !== $post ) {
|
106 |
-
$properties['ID'] = $post->ID;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
return wp_insert_post( $properties );
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Returns the instance.
|
114 |
-
*
|
115 |
-
* @since 1.0.0
|
116 |
-
* @return object
|
117 |
-
*/
|
118 |
-
public static function get_instance( $core, $args ) {
|
119 |
-
return new self( $core, $args );
|
120 |
-
}
|
121 |
-
}
|
122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-creator/inc/cherry-creator-term.php
DELETED
@@ -1,126 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Creator term
|
4 |
-
*
|
5 |
-
* @package Cherry_Framework
|
6 |
-
* @subpackage Class
|
7 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
-
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Cherry_Creator_Term class
|
15 |
-
*/
|
16 |
-
class Cherry_Creator_Term {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Term title
|
20 |
-
*
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
private $title;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Term taxonomy
|
27 |
-
*
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
private $taxonomy = 'category';
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Term arguments
|
34 |
-
*
|
35 |
-
* @var array
|
36 |
-
*/
|
37 |
-
private $arguments = array();
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Inserted term
|
41 |
-
*
|
42 |
-
* @var null
|
43 |
-
*/
|
44 |
-
private $inserted = null;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Cherry_Creator_Term
|
48 |
-
*
|
49 |
-
* @param [type] $title term title.
|
50 |
-
* @param [string] $tax taxonomy.
|
51 |
-
* @param array $args arguments.
|
52 |
-
*/
|
53 |
-
public function __construct( $title, $tax = 'category', $args = array() ) {
|
54 |
-
$this->title = $title;
|
55 |
-
$this->taxonomy = $tax;
|
56 |
-
$this->arguments = $args;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Insert term
|
61 |
-
*
|
62 |
-
* @return Cherry_Creator_Term
|
63 |
-
*/
|
64 |
-
public function insert( $unique = false ) {
|
65 |
-
if ( ! is_array( $this->inserted ) ) {
|
66 |
-
if ( $unique ) {
|
67 |
-
if ( ! term_exists( $this->get_term_slug(), $this->taxonomy ) ) {
|
68 |
-
$this->_insert();
|
69 |
-
}
|
70 |
-
} else {
|
71 |
-
$this->_insert();
|
72 |
-
}
|
73 |
-
}
|
74 |
-
return $this;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Insert term without checking
|
79 |
-
*
|
80 |
-
* @return Cherry_Creator_Term
|
81 |
-
*/
|
82 |
-
private function _insert() {
|
83 |
-
$this->inserted = wp_insert_term(
|
84 |
-
$this->title,
|
85 |
-
$this->taxonomy,
|
86 |
-
$this->arguments
|
87 |
-
);
|
88 |
-
return $this;
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Set parent by slug
|
93 |
-
*
|
94 |
-
* @param [type] $parent_slug parent.
|
95 |
-
*/
|
96 |
-
public function set_parent_by_slug( $parent_slug = null ) {
|
97 |
-
if ( null !== $parent_slug ) {
|
98 |
-
$term = get_term_by( 'slug', $parent_slug, $this->taxonomy );
|
99 |
-
if ( $term ) {
|
100 |
-
$this->arguments['parent'] = $term->term_id;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
return $this;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Get inserted object
|
108 |
-
*
|
109 |
-
* @return mixed.
|
110 |
-
*/
|
111 |
-
public function get_inserted() {
|
112 |
-
return $this->inserted;
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Get term slug
|
117 |
-
*
|
118 |
-
* @return [type] term slug.
|
119 |
-
*/
|
120 |
-
public function get_term_slug() {
|
121 |
-
if ( array_key_exists( 'slug', $this->arguments ) ) {
|
122 |
-
return $this->arguments['slug'];
|
123 |
-
}
|
124 |
-
return sanitize_title( $this->title );
|
125 |
-
}
|
126 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-customizer/cherry-customizer.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: Customizer
|
4 |
* Description: Customizer functionality.
|
5 |
-
* Version: 1.1.
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -10,7 +10,7 @@
|
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
-
* @version 1.1.
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
@@ -207,11 +207,12 @@ if ( ! class_exists( 'Cherry_Customizer' ) ) {
|
|
207 |
* Include advanced customizer controls classes
|
208 |
*
|
209 |
* @since 1.1.0
|
|
|
210 |
*/
|
211 |
private function include_custom_controls() {
|
212 |
|
213 |
if ( ! class_exists( 'Cherry_WP_Customize_Iconpicker' ) ) {
|
214 |
-
require_once( trailingslashit(
|
215 |
}
|
216 |
|
217 |
}
|
@@ -909,8 +910,8 @@ if ( ! class_exists( 'Cherry_Customizer' ) ) {
|
|
909 |
* @param object $this Cherry_Customiser instance.
|
910 |
*/
|
911 |
return apply_filters( 'cherry_customizer_get_fonts_data', array(
|
912 |
-
'standard' =>
|
913 |
-
'google' =>
|
914 |
), $this );
|
915 |
}
|
916 |
|
@@ -940,12 +941,36 @@ if ( ! class_exists( 'Cherry_Customizer' ) ) {
|
|
940 |
* Retrieve a data from font's file.
|
941 |
*
|
942 |
* @since 1.0.0
|
943 |
-
* @
|
944 |
-
* @param [string] $file File path.
|
945 |
* @return array Fonts data.
|
946 |
*/
|
947 |
public function read_font_file( $file ) {
|
948 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
949 |
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
950 |
include_once( ABSPATH . '/wp-admin/includes/file.php' );
|
951 |
}
|
@@ -953,20 +978,38 @@ if ( ! class_exists( 'Cherry_Customizer' ) ) {
|
|
953 |
WP_Filesystem();
|
954 |
global $wp_filesystem;
|
955 |
|
956 |
-
if (
|
957 |
-
return
|
|
|
|
|
958 |
}
|
|
|
959 |
|
960 |
-
|
961 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
962 |
|
963 |
-
if ( !
|
964 |
-
|
965 |
}
|
966 |
|
967 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
968 |
|
969 |
-
return
|
970 |
}
|
971 |
|
972 |
/**
|
2 |
/**
|
3 |
* Module Name: Customizer
|
4 |
* Description: Customizer functionality.
|
5 |
+
* Version: 1.1.4
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
+
* @version 1.1.4
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
207 |
* Include advanced customizer controls classes
|
208 |
*
|
209 |
* @since 1.1.0
|
210 |
+
* @since 1.1.4 Using dirname( __FILE__ ) instead of __DIR__.
|
211 |
*/
|
212 |
private function include_custom_controls() {
|
213 |
|
214 |
if ( ! class_exists( 'Cherry_WP_Customize_Iconpicker' ) ) {
|
215 |
+
require_once( trailingslashit( dirname( __FILE__ ) ) . '/inc/class-cherry-wp-customize-iconpicker.php' );
|
216 |
}
|
217 |
|
218 |
}
|
910 |
* @param object $this Cherry_Customiser instance.
|
911 |
*/
|
912 |
return apply_filters( 'cherry_customizer_get_fonts_data', array(
|
913 |
+
'standard' => dirname( __FILE__ ) . '/assets/fonts/standard.json',
|
914 |
+
'google' => dirname( __FILE__ ) . '/assets/fonts/google.json',
|
915 |
), $this );
|
916 |
}
|
917 |
|
941 |
* Retrieve a data from font's file.
|
942 |
*
|
943 |
* @since 1.0.0
|
944 |
+
* @param string $file File path.
|
|
|
945 |
* @return array Fonts data.
|
946 |
*/
|
947 |
public function read_font_file( $file ) {
|
948 |
|
949 |
+
if ( ! $this->file_exists( $file ) ) {
|
950 |
+
return false;
|
951 |
+
}
|
952 |
+
|
953 |
+
// Read the file.
|
954 |
+
$json = $this->get_file( $file );
|
955 |
+
|
956 |
+
if ( ! $json ) {
|
957 |
+
return new WP_Error( 'reading_error', 'Error when reading file' );
|
958 |
+
}
|
959 |
+
|
960 |
+
$content = json_decode( $json, true );
|
961 |
+
|
962 |
+
return $content['items'];
|
963 |
+
}
|
964 |
+
|
965 |
+
/**
|
966 |
+
* Safely checks exists file or not
|
967 |
+
*
|
968 |
+
* @global object $wp_filesystem
|
969 |
+
* @param string $file File path.
|
970 |
+
* @return bool
|
971 |
+
*/
|
972 |
+
public function file_exists( $file ) {
|
973 |
+
|
974 |
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
975 |
include_once( ABSPATH . '/wp-admin/includes/file.php' );
|
976 |
}
|
978 |
WP_Filesystem();
|
979 |
global $wp_filesystem;
|
980 |
|
981 |
+
if ( $wp_filesystem->abspath() ) {
|
982 |
+
return $wp_filesystem->exists( $file );
|
983 |
+
} else {
|
984 |
+
return file_exists( $file );
|
985 |
}
|
986 |
+
}
|
987 |
|
988 |
+
/**
|
989 |
+
* Safely get file content.
|
990 |
+
*
|
991 |
+
* @global object $wp_filesystem
|
992 |
+
* @param string $file File path.
|
993 |
+
* @return bool
|
994 |
+
*/
|
995 |
+
public function get_file( $file ) {
|
996 |
|
997 |
+
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
998 |
+
include_once( ABSPATH . '/wp-admin/includes/file.php' );
|
999 |
}
|
1000 |
|
1001 |
+
WP_Filesystem();
|
1002 |
+
global $wp_filesystem;
|
1003 |
+
|
1004 |
+
$result = '';
|
1005 |
+
|
1006 |
+
if ( $wp_filesystem->abspath() ) {
|
1007 |
+
$result = $wp_filesystem->get_contents( $file );
|
1008 |
+
} else {
|
1009 |
+
$result = Cherry_Toolkit::get_file( $file );
|
1010 |
+
}
|
1011 |
|
1012 |
+
return $result;
|
1013 |
}
|
1014 |
|
1015 |
/**
|
cherry-framework/modules/cherry-dynamic-css/assets/cherry-css-collector.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Handler for CSS Collector
|
3 |
+
*/
|
4 |
+
function CherryCSSCollector() {
|
5 |
+
|
6 |
+
'use strict';
|
7 |
+
|
8 |
+
var style,
|
9 |
+
collectedCSS = window.CherryCollectedCSS;
|
10 |
+
|
11 |
+
if ( undefined !== collectedCSS ) {
|
12 |
+
|
13 |
+
style = document.createElement( 'style' );
|
14 |
+
|
15 |
+
style.setAttribute( 'title', collectedCSS.title );
|
16 |
+
style.setAttribute( 'type', collectedCSS.type );
|
17 |
+
|
18 |
+
style.textContent = collectedCSS.css;
|
19 |
+
|
20 |
+
document.head.appendChild( style );
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
CherryCSSCollector();
|
cherry-framework/modules/cherry-dynamic-css/assets/min/cherry-css-collector.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function CherryCSSCollector(){"use strict";var t,e=window.CherryCollectedCSS;void 0!==e&&(t=document.createElement("style"),t.setAttribute("title",e.title),t.setAttribute("type",e.type),t.textContent=e.css,document.head.appendChild(t))}CherryCSSCollector();
|
cherry-framework/modules/cherry-dynamic-css/cherry-dynamic-css.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: Dynamic CSS
|
4 |
* Description: CSS parser which uses variables & functions for CSS code optimization
|
5 |
-
* Version: 1.
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -10,7 +10,7 @@
|
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
-
* @version 1.
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
@@ -29,13 +29,6 @@ if ( ! class_exists( 'Cherry_Dynamic_Css' ) ) {
|
|
29 |
*/
|
30 |
class Cherry_Dynamic_Css {
|
31 |
|
32 |
-
/**
|
33 |
-
* Module version
|
34 |
-
*
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $module_version = '1.1.0';
|
38 |
-
|
39 |
/**
|
40 |
* Module arguments
|
41 |
*
|
@@ -71,6 +64,14 @@ if ( ! class_exists( 'Cherry_Dynamic_Css' ) ) {
|
|
71 |
*/
|
72 |
public $func_pattern = '/@(([a-zA-Z_]+)\(([^@\)]*)?\))/';
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
/**
|
75 |
* Constructor for the module
|
76 |
*/
|
@@ -86,6 +87,50 @@ if ( ! class_exists( 'Cherry_Dynamic_Css' ) ) {
|
|
86 |
) );
|
87 |
|
88 |
add_action( 'wp_head', array( $this, 'print_inline_css' ), 99 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
/**
|
@@ -192,25 +237,6 @@ if ( ! class_exists( 'Cherry_Dynamic_Css' ) ) {
|
|
192 |
|
193 |
}
|
194 |
|
195 |
-
/**
|
196 |
-
* Get path inside of current module
|
197 |
-
*
|
198 |
-
* @since 1.0.0
|
199 |
-
* @param [type] $path file inside module directory to get path for.
|
200 |
-
* @return string
|
201 |
-
*/
|
202 |
-
public function get_path( $path = null ) {
|
203 |
-
|
204 |
-
$result = trailingslashit( __DIR__ );
|
205 |
-
|
206 |
-
if ( null !== $path ) {
|
207 |
-
$result .= $path;
|
208 |
-
}
|
209 |
-
|
210 |
-
return $result;
|
211 |
-
|
212 |
-
}
|
213 |
-
|
214 |
/**
|
215 |
* Get avaliable functions into array
|
216 |
*
|
@@ -219,7 +245,7 @@ if ( ! class_exists( 'Cherry_Dynamic_Css' ) ) {
|
|
219 |
*/
|
220 |
public function get_css_functions() {
|
221 |
|
222 |
-
require_once
|
223 |
$utilities = Cherry_Dynamic_Css_Utilities::get_instance();
|
224 |
|
225 |
$func_list = array(
|
2 |
/**
|
3 |
* Module Name: Dynamic CSS
|
4 |
* Description: CSS parser which uses variables & functions for CSS code optimization
|
5 |
+
* Version: 1.2.0
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
+
* @version 1.2.0
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
29 |
*/
|
30 |
class Cherry_Dynamic_Css {
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Module arguments
|
34 |
*
|
64 |
*/
|
65 |
public $func_pattern = '/@(([a-zA-Z_]+)\(([^@\)]*)?\))/';
|
66 |
|
67 |
+
/**
|
68 |
+
* Collector instance holder
|
69 |
+
*
|
70 |
+
* @since 1.2.0
|
71 |
+
* @var object
|
72 |
+
*/
|
73 |
+
public static $collector = null;
|
74 |
+
|
75 |
/**
|
76 |
* Constructor for the module
|
77 |
*/
|
87 |
) );
|
88 |
|
89 |
add_action( 'wp_head', array( $this, 'print_inline_css' ), 99 );
|
90 |
+
|
91 |
+
$this->init_collector();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Initalize CSS collector class
|
96 |
+
*
|
97 |
+
* @since 1.2.0
|
98 |
+
* @return bool
|
99 |
+
*/
|
100 |
+
public function init_collector() {
|
101 |
+
|
102 |
+
if ( null !== self::$collector ) {
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
|
106 |
+
require_once 'inc/class-cherry-dynamic-css-collector.php';
|
107 |
+
|
108 |
+
ob_start();
|
109 |
+
include 'assets/min/cherry-css-collector.min.js';
|
110 |
+
$handler = ob_get_clean();
|
111 |
+
|
112 |
+
self::$collector = Cherry_Dynamic_Css_Collector::get_instance( $handler );
|
113 |
+
add_action( 'wp_footer', array( self::$collector, 'print_style' ), 11 );
|
114 |
+
add_action( 'wp_footer', array( self::$collector, 'add_js_handler' ), 11 );
|
115 |
+
|
116 |
+
return true;
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Add new style to collector
|
122 |
+
*
|
123 |
+
* @since 1.2.0
|
124 |
+
* @param string $selector CSS selector to add styles for.
|
125 |
+
* @param array $style Styles array to add.
|
126 |
+
* @param array $media Media breakpoints.
|
127 |
+
* @return void
|
128 |
+
*/
|
129 |
+
public function add_style( $selector, $style = array(), $media = array() ) {
|
130 |
+
if ( ! $selector ) {
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
self::$collector->add_style( $selector, $style, $media );
|
134 |
}
|
135 |
|
136 |
/**
|
237 |
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
/**
|
241 |
* Get avaliable functions into array
|
242 |
*
|
245 |
*/
|
246 |
public function get_css_functions() {
|
247 |
|
248 |
+
require_once 'inc/class-cherry-dynamic-css-utilities.php';
|
249 |
$utilities = Cherry_Dynamic_Css_Utilities::get_instance();
|
250 |
|
251 |
$func_list = array(
|
cherry-framework/modules/cherry-dynamic-css/inc/class-cherry-dynamic-css-collector.php
ADDED
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dynamic CSS collector class.
|
4 |
+
*
|
5 |
+
* @package Cherry_Framework
|
6 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
7 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
8 |
+
* @link http://www.cherryframework.com/
|
9 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*/
|
11 |
+
|
12 |
+
// If this file is called directly, abort.
|
13 |
+
if ( ! defined( 'WPINC' ) ) {
|
14 |
+
die;
|
15 |
+
}
|
16 |
+
|
17 |
+
if ( ! class_exists( 'Cherry_Dynamic_Css_Collector' ) ) {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Define Cherry_Dynamic_Css_Collector class
|
21 |
+
*/
|
22 |
+
class Cherry_Dynamic_Css_Collector {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* A reference to an instance of this class.
|
26 |
+
*
|
27 |
+
* @since 1.2.0
|
28 |
+
* @var object
|
29 |
+
*/
|
30 |
+
private static $instance = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Array with sorted css
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
public static $sorted_css = array();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Apropriate JS handle name
|
41 |
+
*
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
public static $js_handle = 'cherry-js-core';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Passed handler file content
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
public static $handler_file = null;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Set handler file on construct
|
55 |
+
*/
|
56 |
+
function __construct( $handler_file = null ) {
|
57 |
+
self::$handler_file = $handler_file;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Add new style to collector
|
62 |
+
*
|
63 |
+
* @param string $selector CSS selector to add styles for.
|
64 |
+
* @param array $style Styles array to add.
|
65 |
+
* @param array $media Media breakpoints.
|
66 |
+
* @return void
|
67 |
+
*/
|
68 |
+
public function add_style( $selector, $style = array(), $media = array() ) {
|
69 |
+
|
70 |
+
$this->prepare_rule(
|
71 |
+
$selector,
|
72 |
+
array(
|
73 |
+
'style' => $style,
|
74 |
+
'media' => $media,
|
75 |
+
)
|
76 |
+
);
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Return JS handle name
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
public function get_handle() {
|
86 |
+
return apply_filters( 'cherry_dynamic_css_collector_handle', self::$js_handle );
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Add inline JS handler
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function add_js_handler() {
|
95 |
+
|
96 |
+
if ( ! self::$handler_file ) {
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
wp_add_inline_script( $this->get_handle(), self::$handler_file );
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Print grabbed CSS
|
105 |
+
*
|
106 |
+
* @return void
|
107 |
+
*/
|
108 |
+
public function print_style() {
|
109 |
+
|
110 |
+
self::$sorted_css = apply_filters(
|
111 |
+
'cherry_dynamic_css_collected_styles',
|
112 |
+
self::$sorted_css
|
113 |
+
);
|
114 |
+
|
115 |
+
if ( empty( self::$sorted_css ) || ! is_array( self::$sorted_css ) ) {
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
|
119 |
+
ob_start();
|
120 |
+
|
121 |
+
do_action( 'cherry_dynamic_css_before_print_collected' );
|
122 |
+
|
123 |
+
array_walk( self::$sorted_css, array( $this, 'print_breakpoint' ) );
|
124 |
+
|
125 |
+
do_action( 'cherry_dynamic_css_after_print_collected' );
|
126 |
+
|
127 |
+
$styles = ob_get_clean();
|
128 |
+
|
129 |
+
$localize_var = apply_filters( 'cherry_dynamic_css_collector_localize_object', array(
|
130 |
+
'type' => 'text/css',
|
131 |
+
'title' => 'cherry-collected-dynamic-style',
|
132 |
+
'css' => $styles,
|
133 |
+
) );
|
134 |
+
|
135 |
+
wp_localize_script( $this->get_handle(), 'CherryCollectedCSS', $localize_var );
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Print single breakpoint
|
141 |
+
*
|
142 |
+
* @param array $rules Rules array.
|
143 |
+
* @param string $breakpoint Breakpoint name.
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
+
public function print_breakpoint( $rules, $breakpoint ) {
|
147 |
+
|
148 |
+
if ( empty( $rules ) ) {
|
149 |
+
return;
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( 'all' !== $breakpoint ) {
|
153 |
+
echo '@' . $breakpoint . ' {';
|
154 |
+
}
|
155 |
+
|
156 |
+
do_action( 'cherry_dynamic_css_breakpoint_start', $breakpoint );
|
157 |
+
|
158 |
+
array_walk( $rules, array( $this, 'print_rules' ) );
|
159 |
+
|
160 |
+
do_action( 'cherry_dynamic_css_breakpoint_end', $breakpoint );
|
161 |
+
|
162 |
+
if ( 'all' !== $breakpoint ) {
|
163 |
+
echo '}';
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Print rules for selector.
|
170 |
+
*
|
171 |
+
* @param array $rule Single rule.
|
172 |
+
* @param string $selector Selector name.
|
173 |
+
* @return void
|
174 |
+
*/
|
175 |
+
public function print_rules( $rule, $selector ) {
|
176 |
+
|
177 |
+
echo $selector . ' {';
|
178 |
+
|
179 |
+
do_action( 'cherry_dynamic_css_rule_start', $selector );
|
180 |
+
|
181 |
+
array_walk( $rule, array( $this, 'print_property' ) );
|
182 |
+
|
183 |
+
do_action( 'cherry_dynamic_css_rule_end', $selector );
|
184 |
+
|
185 |
+
echo '}';
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Print single rule.
|
191 |
+
*
|
192 |
+
* @param string $value Property value.
|
193 |
+
* @param string $name Property name.
|
194 |
+
* @return void
|
195 |
+
*/
|
196 |
+
public function print_property( $value, $name ) {
|
197 |
+
printf( '%1$s:%2$s; ', $name, $value );
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Print passed rule.
|
202 |
+
*
|
203 |
+
* @param string $selector Selector name.
|
204 |
+
* @param array $rule CSS rule data.
|
205 |
+
* @return void|bool
|
206 |
+
*/
|
207 |
+
public function prepare_rule( $selector, $rule ) {
|
208 |
+
|
209 |
+
$rule = array_merge( array(
|
210 |
+
'style' => array(),
|
211 |
+
'media' => array(),
|
212 |
+
), $rule );
|
213 |
+
|
214 |
+
if ( empty( $rule['style'] ) ) {
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
|
218 |
+
$breakpoint = $this->breakpoint_name( $rule['media'] );
|
219 |
+
|
220 |
+
if ( ! isset( self::$sorted_css[ $breakpoint ] ) ) {
|
221 |
+
self::$sorted_css[ $breakpoint ] = array();
|
222 |
+
}
|
223 |
+
|
224 |
+
if ( isset( self::$sorted_css[ $breakpoint ][ $selector ] ) ) {
|
225 |
+
self::$sorted_css[ $breakpoint ][ $selector ] = array_merge(
|
226 |
+
self::$sorted_css[ $breakpoint ][ $selector ],
|
227 |
+
$rule['style']
|
228 |
+
);
|
229 |
+
} else {
|
230 |
+
self::$sorted_css[ $breakpoint ][ $selector ] = $rule['style'];
|
231 |
+
}
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Generate media rule name
|
237 |
+
*
|
238 |
+
* @param array $media Media breakpoints.
|
239 |
+
* @return string
|
240 |
+
*/
|
241 |
+
public function breakpoint_name( $media ) {
|
242 |
+
|
243 |
+
$has_media = false;
|
244 |
+
$min = '';
|
245 |
+
$max = '';
|
246 |
+
|
247 |
+
if ( ! empty( $media['min'] ) ) {
|
248 |
+
$has_media = true;
|
249 |
+
$min = sprintf( '(min-width: %1$s)', esc_attr( $media['min'] ) );
|
250 |
+
}
|
251 |
+
|
252 |
+
if ( ! empty( $media['max'] ) ) {
|
253 |
+
$sep = true === $has_media ? ' and ' : '';
|
254 |
+
$has_media = true;
|
255 |
+
$max = sprintf( '(max-width: %1$s)', esc_attr( $media['max'] ) );
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( ! $has_media ) {
|
259 |
+
return 'all';
|
260 |
+
}
|
261 |
+
|
262 |
+
return sprintf( 'media %1$s%3$s%2$s', $min, $max, $sep );
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Returns the instance.
|
267 |
+
*
|
268 |
+
* @since 1.2.0
|
269 |
+
* @return object
|
270 |
+
*/
|
271 |
+
public static function get_instance( $handler_file = null ) {
|
272 |
+
|
273 |
+
// If the single instance hasn't been set, set it now.
|
274 |
+
if ( null == self::$instance ) {
|
275 |
+
self::$instance = new self( $handler_file );
|
276 |
+
}
|
277 |
+
return self::$instance;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
}
|
cherry-framework/modules/cherry-dynamic-css/inc/class-cherry-dynamic-css-utilities.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package package_name
|
6 |
* @author Cherry Team
|
7 |
-
* @license GPL-
|
8 |
*/
|
9 |
|
10 |
// If this file is called directly, abort.
|
4 |
*
|
5 |
* @package package_name
|
6 |
* @author Cherry Team
|
7 |
+
* @license GPL-3.0+
|
8 |
*/
|
9 |
|
10 |
// If this file is called directly, abort.
|
cherry-framework/modules/cherry-handler/assets/css/cherry-handler-styles.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-handler-notice{background:#23282d;position:fixed;margin:5px 0;box-shadow:1px 1px 5px rgba(0,0,0,0.2);box-sizing:border-box;padding:8px 15px 8px 8px;min-width:200px;overflow:hidden;color:#fff;z-index:999;border-radius:2px;-webkit-transition:all 250ms cubic-bezier(0.85, 0.04, 1, 1);transition:all 250ms cubic-bezier(0.85, 0.04, 1, 1)}.cherry-handler-notice span.dashicons{position:relative;margin-right:10px}.cherry-handler-notice span.dashicons:before{position:absolute;font-size:30px;left:-6px;top:-4px}.cherry-handler-notice.success-notice span.dashicons{color:#48c569}.cherry-handler-notice.success-notice span.dashicons:before{content:"\f147"}.cherry-handler-notice.success-notice .inner b{color:#48c569}.cherry-handler-notice.info-notice span.dashicons{color:#faa730}.cherry-handler-notice.info-notice span.dashicons:before{content:"\f534"}.cherry-handler-notice.info-notice .inner b{color:#faa730}.cherry-handler-notice.error-notice span.dashicons{color:#e54343}.cherry-handler-notice.error-notice span.dashicons:before{content:"\f158"}.cherry-handler-notice.show-state{-webkit-transition:all 500ms cubic-bezier(0.1, 0.67, 0.26, 1);transition:all 500ms cubic-bezier(0.1, 0.67, 0.26, 1)}.cherry-handler-notice .inner{display:inline-block}
|
cherry-framework/modules/cherry-handler/assets/js/cherry-handler.js
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( $, CherryJsCore ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* CherryAjaxHandler class
|
6 |
+
*
|
7 |
+
* @param {object} options Handler options
|
8 |
+
*/
|
9 |
+
|
10 |
+
CherryJsCore.utilites.namespace( 'CherryAjaxHandler' );
|
11 |
+
CherryJsCore.CherryAjaxHandler = function( options ) {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* General default settings
|
15 |
+
*
|
16 |
+
* @type {Object}
|
17 |
+
*/
|
18 |
+
var self = this,
|
19 |
+
settings = {
|
20 |
+
'handlerId': '',
|
21 |
+
'cache': false,
|
22 |
+
'processData': true,
|
23 |
+
'url': '',
|
24 |
+
'beforeSendCallback': function() {},
|
25 |
+
'errorCallback': function() {},
|
26 |
+
'successCallback': function() {},
|
27 |
+
'completeCallback': function() {}
|
28 |
+
};
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Checking options, settings and options merging
|
32 |
+
*
|
33 |
+
*/
|
34 |
+
if ( options ) {
|
35 |
+
$.extend( settings, options );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Check if handlerId ready to using
|
40 |
+
*
|
41 |
+
*/
|
42 |
+
if ( ! window[ settings.handlerId ] ) {
|
43 |
+
if ( window.console ) {
|
44 |
+
window.console.warn( 'Handler id not found' );
|
45 |
+
}
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Set handler settings from localized global variable
|
51 |
+
*
|
52 |
+
* @type {Object}
|
53 |
+
*/
|
54 |
+
self.handlerSettings = window[ settings.handlerId ] || {};
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Ajax request instance
|
58 |
+
*
|
59 |
+
* @type {Object}
|
60 |
+
*/
|
61 |
+
self.ajaxRequest = null;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Ajax processing state
|
65 |
+
*
|
66 |
+
* @type {Boolean}
|
67 |
+
*/
|
68 |
+
self.ajaxProcessing = false;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Set ajax request data
|
72 |
+
*
|
73 |
+
* @type {Object}
|
74 |
+
*/
|
75 |
+
self.data = {
|
76 |
+
'action': self.handlerSettings.action,
|
77 |
+
'nonce': self.handlerSettings.nonce
|
78 |
+
};
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Check ajax url is empty
|
82 |
+
*/
|
83 |
+
if ( '' === settings.url ) {
|
84 |
+
|
85 |
+
// Check public request
|
86 |
+
if ( 'false' === self.handlerSettings.is_public ) {
|
87 |
+
settings.url = window.ajaxurl;
|
88 |
+
} else {
|
89 |
+
settings.url = window.cherryHandlerAjaxUrl.ajax_url;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Init ajax request
|
95 |
+
*
|
96 |
+
* @return {Void}
|
97 |
+
*/
|
98 |
+
self.send = function() {
|
99 |
+
if ( self.ajaxProcessing ) {
|
100 |
+
CherryJsCore.cherryHandlerUtils.noticeCreate( 'error-notice', self.handlerSettings.sys_messages.wait_processing );
|
101 |
+
}
|
102 |
+
self.ajaxProcessing = true;
|
103 |
+
|
104 |
+
self.ajaxRequest = jQuery.ajax( {
|
105 |
+
type: self.handlerSettings.type.toUpperCase(),
|
106 |
+
url: settings.url,
|
107 |
+
data: self.data,
|
108 |
+
cache: settings.cache,
|
109 |
+
dataType: self.handlerSettings.data_type,
|
110 |
+
processData: settings.processData,
|
111 |
+
beforeSend: function( jqXHR, ajaxSettings ) {
|
112 |
+
if ( null !== self.ajaxRequest ) {
|
113 |
+
self.ajaxRequest.abort();
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( settings.beforeSendCallback && 'function' === typeof( settings.beforeSendCallback ) ) {
|
117 |
+
settings.beforeSendCallback( jqXHR, ajaxSettings );
|
118 |
+
}
|
119 |
+
},
|
120 |
+
error: function( jqXHR, textStatus, errorThrown ) {
|
121 |
+
if ( settings.errorCallback && 'function' === typeof( settings.errorCallback ) ) {
|
122 |
+
settings.errorCallback( jqXHR, textStatus, errorThrown );
|
123 |
+
}
|
124 |
+
},
|
125 |
+
success: function( data, textStatus, jqXHR ) {
|
126 |
+
self.ajaxProcessing = false;
|
127 |
+
if ( settings.successCallback && 'function' === typeof( settings.successCallback ) ) {
|
128 |
+
settings.successCallback( data, textStatus, jqXHR );
|
129 |
+
}
|
130 |
+
|
131 |
+
CherryJsCore.cherryHandlerUtils.noticeCreate( data.type, data.message );
|
132 |
+
},
|
133 |
+
complete: function( jqXHR, textStatus ) {
|
134 |
+
if ( settings.completeCallback && 'function' === typeof( settings.completeCallback ) ) {
|
135 |
+
settings.completeCallback( jqXHR, textStatus );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
} );
|
140 |
+
};
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Send data ajax request
|
144 |
+
*
|
145 |
+
* @param {Object} data User data
|
146 |
+
* @return {Void}
|
147 |
+
*/
|
148 |
+
self.sendData = function( data ) {
|
149 |
+
var sendData = data || {};
|
150 |
+
self.data = {
|
151 |
+
'action': self.handlerSettings.action,
|
152 |
+
'nonce': self.handlerSettings.nonce,
|
153 |
+
'data': sendData
|
154 |
+
};
|
155 |
+
|
156 |
+
self.send();
|
157 |
+
};
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Send form serialized data
|
161 |
+
* @param {String} formId Form selector
|
162 |
+
* @return {Void}
|
163 |
+
*/
|
164 |
+
self.sendFormData = function( formId ) {
|
165 |
+
var form = $( formId ),
|
166 |
+
data;
|
167 |
+
|
168 |
+
data = CherryJsCore.cherryHandlerUtils.serializeObject( form );
|
169 |
+
|
170 |
+
self.sendData( data );
|
171 |
+
};
|
172 |
+
};
|
173 |
+
|
174 |
+
CherryJsCore.utilites.namespace( 'cherryHandlerUtils' );
|
175 |
+
CherryJsCore.cherryHandlerUtils = {
|
176 |
+
/**
|
177 |
+
* Rendering notice message
|
178 |
+
*
|
179 |
+
* @param {String} type Message type
|
180 |
+
* @param {String} message Message content
|
181 |
+
* @return {Void}
|
182 |
+
*/
|
183 |
+
noticeCreate: function( type, message ) {
|
184 |
+
var notice,
|
185 |
+
rightDelta = 0,
|
186 |
+
timeoutId;
|
187 |
+
|
188 |
+
if ( ! message ) {
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
|
192 |
+
notice = $( '<div class="cherry-handler-notice ' + type + '"><span class="dashicons"></span><div class="inner">' + message + '</div></div>' );
|
193 |
+
|
194 |
+
$( 'body' ).prepend( notice );
|
195 |
+
reposition();
|
196 |
+
rightDelta = -1 * ( notice.outerWidth( true ) + 10 );
|
197 |
+
notice.css( { 'right': rightDelta } );
|
198 |
+
|
199 |
+
timeoutId = setTimeout( function() {
|
200 |
+
notice.css( { 'right': 10 } ).addClass( 'show-state' );
|
201 |
+
}, 100 );
|
202 |
+
timeoutId = setTimeout( function() {
|
203 |
+
rightDelta = -1 * ( notice.outerWidth( true ) + 10 );
|
204 |
+
notice.css( { right: rightDelta } ).removeClass( 'show-state' );
|
205 |
+
}, 4000 );
|
206 |
+
timeoutId = setTimeout( function() {
|
207 |
+
notice.remove();
|
208 |
+
clearTimeout( timeoutId );
|
209 |
+
}, 4500 );
|
210 |
+
|
211 |
+
function reposition() {
|
212 |
+
var topDelta = 100;
|
213 |
+
|
214 |
+
$( '.cherry-handler-notice' ).each( function() {
|
215 |
+
$( this ).css( { top: topDelta } );
|
216 |
+
topDelta += $( this ).outerHeight( true );
|
217 |
+
} );
|
218 |
+
}
|
219 |
+
},
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Serialize form into
|
223 |
+
*
|
224 |
+
* @return {Object}
|
225 |
+
*/
|
226 |
+
serializeObject: function( form ) {
|
227 |
+
|
228 |
+
var self = this,
|
229 |
+
json = {},
|
230 |
+
pushCounters = {},
|
231 |
+
patterns = {
|
232 |
+
'validate': /^[a-zA-Z][a-zA-Z0-9_-]*(?:\[(?:\d*|[a-zA-Z0-9_-]+)\])*$/,
|
233 |
+
'key': /[a-zA-Z0-9_-]+|(?=\[\])/g,
|
234 |
+
'push': /^$/,
|
235 |
+
'fixed': /^\d+$/,
|
236 |
+
'named': /^[a-zA-Z0-9_-]+$/
|
237 |
+
};
|
238 |
+
|
239 |
+
this.build = function( base, key, value ) {
|
240 |
+
base[ key ] = value;
|
241 |
+
|
242 |
+
return base;
|
243 |
+
};
|
244 |
+
|
245 |
+
this.push_counter = function( key ) {
|
246 |
+
if ( undefined === pushCounters[ key ] ) {
|
247 |
+
pushCounters[ key ] = 0;
|
248 |
+
}
|
249 |
+
|
250 |
+
return pushCounters[ key ]++;
|
251 |
+
};
|
252 |
+
|
253 |
+
$.each( form.serializeArray(), function() {
|
254 |
+
var k, keys, merge, reverseKey;
|
255 |
+
|
256 |
+
// Skip invalid keys
|
257 |
+
if ( ! patterns.validate.test( this.name ) ) {
|
258 |
+
return;
|
259 |
+
}
|
260 |
+
|
261 |
+
keys = this.name.match( patterns.key );
|
262 |
+
merge = this.value;
|
263 |
+
reverseKey = this.name;
|
264 |
+
|
265 |
+
while ( undefined !== ( k = keys.pop() ) ) {
|
266 |
+
|
267 |
+
// Adjust reverseKey
|
268 |
+
reverseKey = reverseKey.replace( new RegExp( '\\[' + k + '\\]$' ), '' );
|
269 |
+
|
270 |
+
// Push
|
271 |
+
if ( k.match( patterns.push ) ) {
|
272 |
+
merge = self.build( [], self.push_counter( reverseKey ), merge );
|
273 |
+
} else if ( k.match( patterns.fixed ) ) {
|
274 |
+
merge = self.build( [], k, merge );
|
275 |
+
} else if ( k.match( patterns.named ) ) {
|
276 |
+
merge = self.build( {}, k, merge );
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
json = $.extend( true, json, merge );
|
281 |
+
});
|
282 |
+
|
283 |
+
return json;
|
284 |
+
}
|
285 |
+
};
|
286 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-handler/assets/js/min/cherry-handler.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,a){"use strict";a.utilites.namespace("CherryAjaxHandler"),a.CherryAjaxHandler=function(n){var t=this,r={handlerId:"",cache:!1,processData:!0,url:"",beforeSendCallback:function(){},errorCallback:function(){},successCallback:function(){},completeCallback:function(){}};return n&&e.extend(r,n),window[r.handlerId]?(t.handlerSettings=window[r.handlerId]||{},t.ajaxRequest=null,t.ajaxProcessing=!1,t.data={action:t.handlerSettings.action,nonce:t.handlerSettings.nonce},""===r.url&&(r.url="false"===t.handlerSettings.is_public?window.ajaxurl:window.cherryHandlerAjaxUrl.ajax_url),t.send=function(){t.ajaxProcessing&&a.cherryHandlerUtils.noticeCreate("error-notice",t.handlerSettings.sys_messages.wait_processing),t.ajaxProcessing=!0,t.ajaxRequest=jQuery.ajax({type:t.handlerSettings.type.toUpperCase(),url:r.url,data:t.data,cache:r.cache,dataType:t.handlerSettings.data_type,processData:r.processData,beforeSend:function(e,a){null!==t.ajaxRequest&&t.ajaxRequest.abort(),r.beforeSendCallback&&"function"==typeof r.beforeSendCallback&&r.beforeSendCallback(e,a)},error:function(e,a,n){r.errorCallback&&"function"==typeof r.errorCallback&&r.errorCallback(e,a,n)},success:function(e,n,c){t.ajaxProcessing=!1,r.successCallback&&"function"==typeof r.successCallback&&r.successCallback(e,n,c),a.cherryHandlerUtils.noticeCreate(e.type,e.message)},complete:function(e,a){r.completeCallback&&"function"==typeof r.completeCallback&&r.completeCallback(e,a)}})},t.sendData=function(e){var a=e||{};t.data={action:t.handlerSettings.action,nonce:t.handlerSettings.nonce,data:a},t.send()},void(t.sendFormData=function(n){var r,c=e(n);r=a.cherryHandlerUtils.serializeObject(c),t.sendData(r)})):(window.console&&window.console.warn("Handler id not found"),!1)},a.utilites.namespace("cherryHandlerUtils"),a.cherryHandlerUtils={noticeCreate:function(a,n){function t(){var a=100;e(".cherry-handler-notice").each(function(){e(this).css({top:a}),a+=e(this).outerHeight(!0)})}var r,c,s=0;return n?(r=e('<div class="cherry-handler-notice '+a+'"><span class="dashicons"></span><div class="inner">'+n+"</div></div>"),e("body").prepend(r),t(),s=-1*(r.outerWidth(!0)+10),r.css({right:s}),c=setTimeout(function(){r.css({right:10}).addClass("show-state")},100),c=setTimeout(function(){s=-1*(r.outerWidth(!0)+10),r.css({right:s}).removeClass("show-state")},4e3),void(c=setTimeout(function(){r.remove(),clearTimeout(c)},4500))):!1},serializeObject:function(a){var n=this,t={},r={},c={validate:/^[a-zA-Z][a-zA-Z0-9_-]*(?:\[(?:\d*|[a-zA-Z0-9_-]+)\])*$/,key:/[a-zA-Z0-9_-]+|(?=\[\])/g,push:/^$/,fixed:/^\d+$/,named:/^[a-zA-Z0-9_-]+$/};return this.build=function(e,a,n){return e[a]=n,e},this.push_counter=function(e){return void 0===r[e]&&(r[e]=0),r[e]++},e.each(a.serializeArray(),function(){var a,r,s,i;if(c.validate.test(this.name)){for(r=this.name.match(c.key),s=this.value,i=this.name;void 0!==(a=r.pop());)i=i.replace(new RegExp("\\["+a+"\\]$"),""),a.match(c.push)?s=n.build([],n.push_counter(i),s):a.match(c.fixed)?s=n.build([],a,s):a.match(c.named)&&(s=n.build({},a,s));t=e.extend(!0,t,s)}}),t}}}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-handler/assets/scss/cherry-handler-styles.scss
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-handler-notice{
|
2 |
+
background: #23282d;
|
3 |
+
position: fixed;
|
4 |
+
margin: 5px 0;
|
5 |
+
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
|
6 |
+
box-sizing: border-box;
|
7 |
+
padding: 8px 15px 8px 8px;
|
8 |
+
min-width: 200px;
|
9 |
+
overflow: hidden;
|
10 |
+
color: #fff;
|
11 |
+
z-index: 999;
|
12 |
+
border-radius: 2px;
|
13 |
+
transition: all 250ms cubic-bezier(0.85, 0.04, 1, 1);
|
14 |
+
span.dashicons{
|
15 |
+
position: relative;
|
16 |
+
margin-right: 10px;
|
17 |
+
&:before{
|
18 |
+
position: absolute;
|
19 |
+
font-size: 30px;
|
20 |
+
left: -6px;
|
21 |
+
top: -4px;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
&.success-notice{
|
25 |
+
span.dashicons{
|
26 |
+
color: #48c569;
|
27 |
+
&:before{
|
28 |
+
content: "\f147";
|
29 |
+
}
|
30 |
+
}
|
31 |
+
.inner{
|
32 |
+
b{
|
33 |
+
color: #48c569;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
&.info-notice{
|
38 |
+
span.dashicons{
|
39 |
+
color: #faa730;
|
40 |
+
&:before{
|
41 |
+
content: "\f534";
|
42 |
+
}
|
43 |
+
}
|
44 |
+
.inner{
|
45 |
+
b{
|
46 |
+
color: #faa730;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
&.error-notice{
|
51 |
+
span.dashicons{
|
52 |
+
color: #e54343;
|
53 |
+
&:before{
|
54 |
+
content: "\f158";
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
&.show-state{
|
59 |
+
-webkit-transition: all 500ms cubic-bezier(0.1, 0.67, 0.26, 1);
|
60 |
+
transition: all 500ms cubic-bezier(0.1, 0.67, 0.26, 1);
|
61 |
+
}
|
62 |
+
.inner{
|
63 |
+
display: inline-block;
|
64 |
+
}
|
65 |
+
}
|
cherry-framework/modules/cherry-handler/cherry-handler.php
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Cherry handler
|
4 |
+
* Description: Initializes handlers
|
5 |
+
* Version: 1.0.0
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.0.0
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_Handler' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Cherry_Handler class.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Cherry_Handler {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* A reference to an instance of this class.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var object
|
40 |
+
*/
|
41 |
+
private static $handlers_list = array();
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Default settings.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @var array
|
48 |
+
*/
|
49 |
+
private $settings = array(
|
50 |
+
'id' => '',
|
51 |
+
'action' => '',
|
52 |
+
'capability' => '',
|
53 |
+
'is_public' => false,
|
54 |
+
'callback' => '',
|
55 |
+
'type' => 'post',
|
56 |
+
'data_type' => 'json',
|
57 |
+
'sys_messages' => array(
|
58 |
+
'invalid_base_data' => 'Unable to process the request without nonce or server error',
|
59 |
+
'no_right' => 'No right for this action',
|
60 |
+
'invalid_nonce' => 'Stop CHEATING!!!',
|
61 |
+
'access_is_allowed' => 'Access is allowed',
|
62 |
+
'wait_processing' => 'Please wait, processing the previous request',
|
63 |
+
),
|
64 |
+
);
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Class constructor.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
* @param object $core Core instance.
|
71 |
+
* @param array $args Class args.
|
72 |
+
*/
|
73 |
+
public function __construct( $core, $args = array() ) {
|
74 |
+
$this->settings = array_merge( $this->settings, $args );
|
75 |
+
|
76 |
+
if ( empty( $this->settings['id'] ) ) {
|
77 |
+
echo '<h3>ID is required attr</h3>';
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( empty( $this->settings['action'] ) ) {
|
82 |
+
echo '<h3>Action is required attr</h3>';
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
// Action empty check
|
87 |
+
if ( ! empty( $this->settings['action'] ) ) {
|
88 |
+
add_action( 'wp_ajax_' . $this->settings['action'], array( $this, 'handler_init' ) );
|
89 |
+
|
90 |
+
// Public action check
|
91 |
+
if ( filter_var( $this->settings['is_public'], FILTER_VALIDATE_BOOLEAN ) ) {
|
92 |
+
add_action( 'wp_ajax_nopriv_' . $this->settings['action'], array( $this, 'handler_init' ) );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
97 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
98 |
+
add_action( 'wp_print_scripts', array( $this, 'localize_script' ) );
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Handler initialization
|
103 |
+
*
|
104 |
+
* @since 1.0.0
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function handler_init() {
|
108 |
+
if ( ! empty( $_POST ) && array_key_exists( 'nonce', $_POST ) ) {
|
109 |
+
|
110 |
+
$nonce = $_POST['nonce'];
|
111 |
+
|
112 |
+
$nonce_action = ! empty( $this->settings['action'] ) ? $this->settings['action'] : 'cherry_ajax_nonce';
|
113 |
+
|
114 |
+
if ( ! wp_verify_nonce( $nonce, $nonce_action ) ) {
|
115 |
+
$response = array(
|
116 |
+
'message' => $this->settings['sys_messages']['invalid_nonce'],
|
117 |
+
'type' => 'error-notice',
|
118 |
+
);
|
119 |
+
|
120 |
+
wp_send_json( $response );
|
121 |
+
}
|
122 |
+
|
123 |
+
if ( ! empty( $this->settings['capability'] ) && ! current_user_can( $this->settings['capability'] ) ) {
|
124 |
+
$response = array(
|
125 |
+
'message' => $this->settings['sys_messages']['no_right'],
|
126 |
+
'type' => 'error-notice',
|
127 |
+
);
|
128 |
+
|
129 |
+
wp_send_json( $response );
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( ! empty( $this->settings['callback'] ) && is_callable( $this->settings['callback'] ) ) {
|
133 |
+
|
134 |
+
ob_start();
|
135 |
+
$data = call_user_func( $this->settings['callback'] );
|
136 |
+
|
137 |
+
if ( ! $data ) {
|
138 |
+
$data = ob_get_contents();
|
139 |
+
}
|
140 |
+
ob_end_clean();
|
141 |
+
|
142 |
+
$response = array(
|
143 |
+
'message' => $this->settings['sys_messages']['access_is_allowed'],
|
144 |
+
'type' => 'success-notice',
|
145 |
+
'data' => $data,
|
146 |
+
);
|
147 |
+
|
148 |
+
wp_send_json( $response );
|
149 |
+
}
|
150 |
+
} else {
|
151 |
+
$response = array(
|
152 |
+
'message' => $this->settings['sys_messages']['invalid_base_data'],
|
153 |
+
'type' => 'error-notice',
|
154 |
+
);
|
155 |
+
|
156 |
+
wp_send_json( $response );
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Register and enqueue handlers js.
|
162 |
+
*
|
163 |
+
* @since 1.0.0
|
164 |
+
*/
|
165 |
+
public function enqueue_scripts() {
|
166 |
+
wp_enqueue_script(
|
167 |
+
'cherry-handler-js',
|
168 |
+
esc_url( Cherry_Core::base_url( 'assets/js/min/cherry-handler.min.js', __FILE__ ) ),
|
169 |
+
array( 'jquery' ),
|
170 |
+
'1.0.0',
|
171 |
+
true
|
172 |
+
);
|
173 |
+
|
174 |
+
wp_enqueue_style(
|
175 |
+
'cherry-handler-css',
|
176 |
+
esc_url( Cherry_Core::base_url( 'assets/css/cherry-handler-styles.min.css', __FILE__ ) ),
|
177 |
+
array(),
|
178 |
+
'1.0.0',
|
179 |
+
'all'
|
180 |
+
);
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Prepare data for henler script.
|
185 |
+
*
|
186 |
+
* @since 1.0.0
|
187 |
+
* @return void
|
188 |
+
*/
|
189 |
+
public function localize_script() {
|
190 |
+
|
191 |
+
$nonce = $this->create_nonce( $this->settings['action'] );
|
192 |
+
|
193 |
+
wp_localize_script( 'cherry-handler-js', $this->settings['id'],
|
194 |
+
array(
|
195 |
+
'action' => $this->settings['action'],
|
196 |
+
'nonce' => $nonce,
|
197 |
+
'type' => $this->settings['type'],
|
198 |
+
'data_type' => $this->settings['data_type'],
|
199 |
+
'is_public' => $this->settings['is_public'] ? 'true' : 'false',
|
200 |
+
'sys_messages' => $this->settings['sys_messages'],
|
201 |
+
)
|
202 |
+
);
|
203 |
+
|
204 |
+
if ( $this->settings['is_public'] ) {
|
205 |
+
wp_localize_script( 'cherry-handler-js', 'cherryHandlerAjaxUrl', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Create nonce by action
|
211 |
+
*
|
212 |
+
* @param string $action Nonce name.
|
213 |
+
* @return string
|
214 |
+
*/
|
215 |
+
public function create_nonce( $action = '' ) {
|
216 |
+
if ( ! empty( $action ) ) {
|
217 |
+
return wp_create_nonce( $action );
|
218 |
+
}
|
219 |
+
|
220 |
+
return wp_create_nonce( 'cherry_ajax_nonce' );
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Returns the instance.
|
225 |
+
*
|
226 |
+
* @since 1.0.0
|
227 |
+
* @return object
|
228 |
+
*/
|
229 |
+
public static function get_instance( $core, $args ) {
|
230 |
+
return new self( $core, $args );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
cherry-framework/modules/cherry-interface-builder/cherry-interface-builder.php
ADDED
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Interface Builder
|
4 |
+
* Description: The module for the creation of interfaces in the WordPress admin panel
|
5 |
+
* Version: 1.0.3
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.0.3
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_Interface_Builder' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Cherry Interface Builder.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Cherry_Interface_Builder {
|
33 |
+
/**
|
34 |
+
* Module settings.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @access private
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
private $args = array(
|
41 |
+
'views' => array(
|
42 |
+
'section' => 'inc/views/section.php',
|
43 |
+
'component-tab-vertical' => 'inc/views/component-tab-vertical.php',
|
44 |
+
'component-tab-horizontal' => 'inc/views/component-tab-horizontal.php',
|
45 |
+
'component-toggle' => 'inc/views/component-toggle.php',
|
46 |
+
'component-accordion' => 'inc/views/component-accordion.php',
|
47 |
+
'component-repeater' => 'inc/views/component-repeater.php',
|
48 |
+
'settings' => 'inc/views/settings.php',
|
49 |
+
'control' => 'inc/views/control.php',
|
50 |
+
'settings-children-title' => 'inc/views/settings-children-title.php',
|
51 |
+
'tab-children-title' => 'inc/views/tab-children-title.php',
|
52 |
+
'toggle-children-title' => 'inc/views/toggle-children-title.php',
|
53 |
+
'form' => 'inc/views/form.php',
|
54 |
+
'html' => 'inc/views/html.php',
|
55 |
+
),
|
56 |
+
'views_args' => array(
|
57 |
+
'parent' => '',
|
58 |
+
'type' => '',
|
59 |
+
'view' => '',
|
60 |
+
'view_wrapping' => true,
|
61 |
+
'html' => '',
|
62 |
+
'scroll' => false,
|
63 |
+
'master' => false,
|
64 |
+
'title' => '',
|
65 |
+
'description' => '',
|
66 |
+
),
|
67 |
+
);
|
68 |
+
|
69 |
+
/**
|
70 |
+
* A reference to an instance of this class.
|
71 |
+
*
|
72 |
+
* @since 1.0.0
|
73 |
+
* @access private
|
74 |
+
* @var object
|
75 |
+
*/
|
76 |
+
private static $instance = null;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* UI element instance.
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
* @access public
|
83 |
+
* @var object
|
84 |
+
*/
|
85 |
+
public $ui_elements = null;
|
86 |
+
|
87 |
+
/**
|
88 |
+
* The structure of the interface elements.
|
89 |
+
*
|
90 |
+
* @since 1.0.0
|
91 |
+
* @access private
|
92 |
+
* @var array
|
93 |
+
*/
|
94 |
+
private $structure = array();
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Cherry_Interface_Builder constructor.
|
98 |
+
*
|
99 |
+
* @since 1.0.0
|
100 |
+
* @access public
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
+
public function __construct( $core, array $args = array() ) {
|
104 |
+
$this->args = array_merge_recursive(
|
105 |
+
$args,
|
106 |
+
$this->args
|
107 |
+
);
|
108 |
+
|
109 |
+
$this->ui_elements = $core->init_module( 'cherry-ui-elements' );
|
110 |
+
|
111 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Register element type section.
|
116 |
+
*
|
117 |
+
* @since 1.0.0
|
118 |
+
* @access public
|
119 |
+
* @param array $args Options section.
|
120 |
+
* @return void
|
121 |
+
*/
|
122 |
+
public function register_section( array $args = array() ) {
|
123 |
+
$this->add_new_element( $args, 'section' );
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Register element type component.
|
128 |
+
*
|
129 |
+
* @since 1.0.0
|
130 |
+
* @access public
|
131 |
+
* @param array $args Options component.
|
132 |
+
* @return void
|
133 |
+
*/
|
134 |
+
public function register_component( array $args = array() ) {
|
135 |
+
$this->add_new_element( $args, 'component' );
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Register element type settings.
|
140 |
+
*
|
141 |
+
* @since 1.0.0
|
142 |
+
* @access public
|
143 |
+
* @param array $args Options settings.
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
+
public function register_settings( array $args = array() ) {
|
147 |
+
$this->add_new_element( $args, 'settings' );
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Register element type control.
|
152 |
+
*
|
153 |
+
* @since 1.0.0
|
154 |
+
* @access public
|
155 |
+
* @param array $args Options control.
|
156 |
+
* @return void
|
157 |
+
*/
|
158 |
+
public function register_control( array $args = array() ) {
|
159 |
+
$this->add_new_element( $args, 'control' );
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Register element type form.
|
164 |
+
*
|
165 |
+
* @since 1.0.0
|
166 |
+
* @access public
|
167 |
+
* @param array $args Options form.
|
168 |
+
* @return void
|
169 |
+
*/
|
170 |
+
public function register_form( array $args = array() ) {
|
171 |
+
$this->add_new_element( $args, 'form' );
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Register element type html.
|
176 |
+
*
|
177 |
+
* @since 1.0.0
|
178 |
+
* @access public
|
179 |
+
* @param array $args Options control.
|
180 |
+
* @return void
|
181 |
+
*/
|
182 |
+
public function register_html( array $args = array() ) {
|
183 |
+
$this->add_new_element( $args, 'html' );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* This function adds a new element to the structure.
|
188 |
+
*
|
189 |
+
* @since 1.0.0
|
190 |
+
* @access protected
|
191 |
+
* @param array $args Options new element.
|
192 |
+
* @param string $type Type new element.
|
193 |
+
* @return void
|
194 |
+
*/
|
195 |
+
protected function add_new_element( array $args = array(), $type = 'section' ) {
|
196 |
+
if ( ! isset( $args[0] ) && ! is_array( current( $args ) ) ) {
|
197 |
+
|
198 |
+
if ( 'control' !== $type && 'component' !== $type ) {
|
199 |
+
$args['type'] = $type;
|
200 |
+
}
|
201 |
+
|
202 |
+
$this->structure[ $args['id'] ] = $args;
|
203 |
+
} else {
|
204 |
+
foreach ( $args as $key => $value ) {
|
205 |
+
|
206 |
+
if ( 'control' !== $type && 'component' !== $type ) {
|
207 |
+
$value['type'] = $type;
|
208 |
+
}
|
209 |
+
|
210 |
+
$this->structure[ $key ] = $value;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Sorts the elements of the structure, adding child items to the parent.
|
217 |
+
*
|
218 |
+
* @since 1.0.0
|
219 |
+
* @access protected
|
220 |
+
* @param array $structure The original structure of the elements.
|
221 |
+
* @param string $parent_key The key of the parent element.
|
222 |
+
* @return array
|
223 |
+
*/
|
224 |
+
protected function sort_structure( array $structure = array(), $parent_key = null ) {
|
225 |
+
$new_array = array();
|
226 |
+
|
227 |
+
foreach ( $structure as $key => $value ) {
|
228 |
+
if (
|
229 |
+
( null === $parent_key && ! isset( $value['parent'] ) )
|
230 |
+
|| null === $parent_key && ! isset( $structure[ $value['parent'] ] )
|
231 |
+
|| ( isset( $value['parent'] ) && $value['parent'] === $parent_key )
|
232 |
+
) {
|
233 |
+
|
234 |
+
if ( ! isset( $value['id'] ) ) {
|
235 |
+
$value['id'] = $key;
|
236 |
+
}
|
237 |
+
if ( ! isset( $value['name'] ) ) {
|
238 |
+
$value['name'] = $key;
|
239 |
+
}
|
240 |
+
$new_array[ $key ] = $value;
|
241 |
+
|
242 |
+
$children = $this->sort_structure( $structure, $key );
|
243 |
+
if ( ! empty( $children ) ) {
|
244 |
+
$new_array[ $key ]['children'] = $children;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
return $new_array;
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Reset structure array.
|
254 |
+
* Call this method only after render.
|
255 |
+
*
|
256 |
+
* @since 1.0.1
|
257 |
+
* @return void
|
258 |
+
*/
|
259 |
+
public function reset_structure() {
|
260 |
+
$this->structure = array();
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Get view for interface elements.
|
265 |
+
*
|
266 |
+
* @since 1.0.0
|
267 |
+
* @access protected
|
268 |
+
* @param string $type View type.
|
269 |
+
* @param array $args Input data.
|
270 |
+
* @return string
|
271 |
+
*/
|
272 |
+
protected function get_view( $type = 'control', array $args = array() ) {
|
273 |
+
|
274 |
+
if ( empty( $view ) ) {
|
275 |
+
$path = dirname( __FILE__ ) . '/';
|
276 |
+
$path .= ( array_key_exists( $type, $this->args['views'] ) ) ? $this->args['views'][ $type ] : $this->args['views']['control'] ;
|
277 |
+
} else {
|
278 |
+
$path = $view;
|
279 |
+
}
|
280 |
+
|
281 |
+
$view = Cherry_Toolkit::render_view( $path, $args );
|
282 |
+
|
283 |
+
return $view;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Render HTML elements.
|
288 |
+
*
|
289 |
+
* @since 1.0.0
|
290 |
+
* @access public
|
291 |
+
* @param bool $echo Input data.
|
292 |
+
* @param array $args The original structure of the elements.
|
293 |
+
* @return string
|
294 |
+
*/
|
295 |
+
public function render( $echo = true, array $args = array() ) {
|
296 |
+
|
297 |
+
if ( empty( $args ) ) {
|
298 |
+
$args = $this->structure;
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( empty( $args ) ) {
|
302 |
+
return false;
|
303 |
+
}
|
304 |
+
|
305 |
+
$sorted_structure = $this->sort_structure( $args );
|
306 |
+
|
307 |
+
$output = $this->build( $sorted_structure );
|
308 |
+
$output = str_replace( array( "\r\n", "\r", "\n", "\t" ), '', $output );
|
309 |
+
|
310 |
+
$this->reset_structure();
|
311 |
+
|
312 |
+
return $this->output_method( $output, $echo );
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Render HTML elements.
|
317 |
+
*
|
318 |
+
* @since 1.0.0
|
319 |
+
* @access protected
|
320 |
+
* @param array $args Input data.
|
321 |
+
* @return string
|
322 |
+
*/
|
323 |
+
protected function build( array $args = array() ) {
|
324 |
+
$output = '';
|
325 |
+
$views = $this->args['views'];
|
326 |
+
|
327 |
+
foreach ( $args as $key => $value ) {
|
328 |
+
$value = wp_parse_args(
|
329 |
+
$value,
|
330 |
+
$this->args['views_args']
|
331 |
+
);
|
332 |
+
|
333 |
+
$value['class'] = isset( $value['class'] ) ? $value['class'] . ' ' : '' ;
|
334 |
+
$value['class'] .= $value['id'] . ' ' ;
|
335 |
+
if ( $value['scroll'] ) {
|
336 |
+
$value['class'] .= 'cherry-scroll ';
|
337 |
+
}
|
338 |
+
if ( $value['master'] ) {
|
339 |
+
$value['class'] .= $value['master'] . ' ' ;
|
340 |
+
}
|
341 |
+
|
342 |
+
$type = array_key_exists( $value['type'], $views ) ? $value['type'] : 'field' ;
|
343 |
+
$has_child = isset( $value['children'] ) && is_array( $value['children'] ) && ! empty( $value['children'] );
|
344 |
+
|
345 |
+
switch ( $type ) {
|
346 |
+
case 'component-tab-vertical':
|
347 |
+
case 'component-tab-horizontal':
|
348 |
+
if ( $has_child ) {
|
349 |
+
$value['tabs'] = '';
|
350 |
+
|
351 |
+
foreach ( $value['children'] as $key_children => $value_children ) {
|
352 |
+
$value['tabs'] .= $this->get_view( 'tab-children-title', $value_children );
|
353 |
+
|
354 |
+
unset( $value['children'][ $key_children ]['title'] );
|
355 |
+
}
|
356 |
+
}
|
357 |
+
break;
|
358 |
+
|
359 |
+
case 'component-toggle':
|
360 |
+
case 'component-accordion':
|
361 |
+
if ( $has_child ) {
|
362 |
+
foreach ( $value['children'] as $key_children => $value_children ) {
|
363 |
+
$value['children'][ $key_children ]['title_in_view'] = $this->get_view( 'toggle-children-title', $value_children );
|
364 |
+
}
|
365 |
+
}
|
366 |
+
break;
|
367 |
+
|
368 |
+
case 'settings':
|
369 |
+
if ( isset( $value['title'] ) && $value['title'] ) {
|
370 |
+
$value['title'] = isset( $value['title_in_view'] ) ? $value['title_in_view'] : $this->get_view( 'settings-children-title', $value );
|
371 |
+
}
|
372 |
+
break;
|
373 |
+
|
374 |
+
case 'html':
|
375 |
+
$value['children'] = $value['html'];
|
376 |
+
break;
|
377 |
+
|
378 |
+
case 'form':
|
379 |
+
$value['accept-charset'] = isset( $value['accept-charset'] ) ? 'accept-charset="' . $value['accept-charset'] . '" ' : 'accept-charset="utf-8"';
|
380 |
+
$value['action'] = isset( $value['action'] ) ? 'action="' . $value['action'] . '" ' : '' ;
|
381 |
+
$value['autocomplete'] = isset( $value['autocomplete'] ) ? 'autocomplete="' . $value['autocomplete'] . '" ' : 'autocomplete="on"';
|
382 |
+
$value['enctype'] = isset( $value['enctype'] ) ? 'enctype="' . $value['enctype'] . '" ' : 'enctype="application/x-www-form-urlencoded"';
|
383 |
+
$value['method'] = isset( $value['method'] ) ? 'method="' . $value['method'] . '" ' : 'method="post"';
|
384 |
+
$value['novalidate'] = ( isset( $value['novalidate'] ) && $value['novalidate'] ) ? 'novalidate' : '';
|
385 |
+
$value['target'] = isset( $value['target'] ) ? 'target="' . $value['target'] . '" ' : '';
|
386 |
+
break;
|
387 |
+
|
388 |
+
case 'field':
|
389 |
+
$ui_args = $value;
|
390 |
+
|
391 |
+
$ui_args['class'] = isset( $ui_args['child_class'] ) ? $ui_args['child_class'] : '' ;
|
392 |
+
|
393 |
+
if ( isset( $ui_args['options_callback'] ) ) {
|
394 |
+
$ui_args['options'] = call_user_func( $ui_args['options_callback'] );
|
395 |
+
}
|
396 |
+
|
397 |
+
unset( $ui_args['master'] );
|
398 |
+
|
399 |
+
$value['children'] = $this->ui_elements->get_ui_element_instance( $ui_args['type'], $ui_args )->render();
|
400 |
+
break;
|
401 |
+
}
|
402 |
+
|
403 |
+
if ( $has_child ) {
|
404 |
+
$value['children'] = $this->build( $value['children'] );
|
405 |
+
}
|
406 |
+
|
407 |
+
$output .= ( $value['view_wrapping'] ) ? $this->get_view( $type, $value ) : $value['children'];
|
408 |
+
}
|
409 |
+
|
410 |
+
return $output;
|
411 |
+
}
|
412 |
+
|
413 |
+
/**
|
414 |
+
* Output HTML.
|
415 |
+
*
|
416 |
+
* @since 1.0.0
|
417 |
+
* @access protected
|
418 |
+
* @param string $output Output HTML.
|
419 |
+
* @param boolean $echo Output type.
|
420 |
+
* @return string
|
421 |
+
*/
|
422 |
+
protected function output_method( $output = '', $echo = true ) {
|
423 |
+
if ( ! filter_var( $echo, FILTER_VALIDATE_BOOLEAN ) ) {
|
424 |
+
return $output;
|
425 |
+
} else {
|
426 |
+
echo $output;
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Enqueue javascript and stylesheet interface builder.
|
432 |
+
*
|
433 |
+
* @since 4.0.0
|
434 |
+
* @access public
|
435 |
+
* @return void
|
436 |
+
*/
|
437 |
+
public function enqueue_assets() {
|
438 |
+
wp_enqueue_script(
|
439 |
+
'cherry-interface-builder',
|
440 |
+
esc_url( Cherry_Core::base_url( 'inc/assets/min/cherry-interface-builder.min.js', __FILE__ ) ),
|
441 |
+
array( 'jquery' ),
|
442 |
+
'1.0.0',
|
443 |
+
true
|
444 |
+
);
|
445 |
+
wp_enqueue_style(
|
446 |
+
'cherry-interface-builder',
|
447 |
+
esc_url( Cherry_Core::base_url( 'inc/assets/min/cherry-interface-builder.min.css', __FILE__ ) ),
|
448 |
+
array(),
|
449 |
+
'1.0.0',
|
450 |
+
'all'
|
451 |
+
);
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Returns the instance.
|
456 |
+
*
|
457 |
+
* @since 1.0.0
|
458 |
+
* @access public
|
459 |
+
* @return object
|
460 |
+
*/
|
461 |
+
public static function get_instance( $core, $args ) {
|
462 |
+
|
463 |
+
// If the single instance hasn't been set, set it now.
|
464 |
+
if ( null == self::$instance ) {
|
465 |
+
self::$instance = new self( $core, $args );
|
466 |
+
}
|
467 |
+
|
468 |
+
return self::$instance;
|
469 |
+
}
|
470 |
+
}
|
471 |
+
}
|
cherry-framework/modules/cherry-interface-builder/inc/assets/_use-in-js.scss
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cherry-ui-kit{
|
2 |
+
button{
|
3 |
+
*{
|
4 |
+
pointer-events: none;
|
5 |
+
}
|
6 |
+
}
|
7 |
+
}
|
8 |
+
.cherry-component{
|
9 |
+
&__content{
|
10 |
+
.cherry-settings__content{
|
11 |
+
display: none;
|
12 |
+
&.show{
|
13 |
+
display: inherit;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
cherry-framework/modules/cherry-interface-builder/inc/assets/cherry-interface-builder.js
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Interface Builder
|
3 |
+
*/
|
4 |
+
;( function( $, CherryJsCore ) {
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
CherryJsCore.utilites.namespace( 'interfaceBuilder' );
|
8 |
+
|
9 |
+
CherryJsCore.interfaceBuilder = {
|
10 |
+
init: function() {
|
11 |
+
this.component.init();
|
12 |
+
},
|
13 |
+
component: {
|
14 |
+
tabClass: '.cherry-tab',
|
15 |
+
accordionClass: '.cherry-accordion',
|
16 |
+
toggleClass: '.cherry-toggle',
|
17 |
+
|
18 |
+
buttonClass: '.cherry-component__button',
|
19 |
+
contentClass: '.cherry-settings__content',
|
20 |
+
|
21 |
+
buttonActiveClass: 'active',
|
22 |
+
showClass: 'show',
|
23 |
+
|
24 |
+
localStorage: {},
|
25 |
+
|
26 |
+
init: function () {
|
27 |
+
this.localStorage = this.getState() || {};
|
28 |
+
|
29 |
+
this.componentInit( this.tabClass );
|
30 |
+
this.componentInit( this.accordionClass );
|
31 |
+
this.componentInit( this.toggleClass );
|
32 |
+
|
33 |
+
this.addEvent();
|
34 |
+
},
|
35 |
+
|
36 |
+
addEvent: function() {
|
37 |
+
$( 'body' )
|
38 |
+
.on( 'click',
|
39 |
+
this.tabClass + ' ' + this.buttonClass + ', ' +
|
40 |
+
this.toggleClass + ' ' + this.buttonClass + ', ' +
|
41 |
+
this.accordionClass + ' ' + this.buttonClass,
|
42 |
+
|
43 |
+
this.componentClick.bind( this )
|
44 |
+
);
|
45 |
+
},
|
46 |
+
|
47 |
+
componentInit: function( componentClass ) {
|
48 |
+
var _this = this,
|
49 |
+
components = $( componentClass ),
|
50 |
+
componentId = null,
|
51 |
+
button = null,
|
52 |
+
contentId = null,
|
53 |
+
notShow = '';
|
54 |
+
|
55 |
+
components.each( function( index, component ) {
|
56 |
+
component = $( component );
|
57 |
+
componentId = component.data( 'compotent-id' );
|
58 |
+
|
59 |
+
switch ( componentClass ) {
|
60 |
+
case _this.toggleClass:
|
61 |
+
if ( _this.localStorage[ componentId ] && _this.localStorage[ componentId ].length ) {
|
62 |
+
notShow = _this.localStorage[ componentId ].join( ', ' );
|
63 |
+
}
|
64 |
+
|
65 |
+
$( _this.contentClass, component )
|
66 |
+
.not( notShow )
|
67 |
+
.addClass( _this.showClass )
|
68 |
+
.prevAll( _this.buttonClass )
|
69 |
+
.addClass( _this.buttonActiveClass );
|
70 |
+
break;
|
71 |
+
|
72 |
+
case _this.tabClass:
|
73 |
+
case _this.accordionClass:
|
74 |
+
if ( _this.localStorage[ componentId ] ) {
|
75 |
+
contentId = _this.localStorage[ componentId ][ 0 ];
|
76 |
+
button = $( '[data-content-id="' + contentId + '"]', component );
|
77 |
+
} else {
|
78 |
+
button = $( _this.buttonClass, component ).eq( 0 );
|
79 |
+
contentId = button.data( 'content-id' );
|
80 |
+
}
|
81 |
+
|
82 |
+
_this.showElement( button, component, contentId );
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
} );
|
86 |
+
},
|
87 |
+
|
88 |
+
componentClick: function( event ) {
|
89 |
+
var $target = $( event.target ),
|
90 |
+
$parent = $target.closest( this.tabClass + ', ' + this.accordionClass + ', ' + this.toggleClass ),
|
91 |
+
expr = new RegExp( this.tabClass + '|' + this.accordionClass + '|' + this.toggleClass ),
|
92 |
+
componentName = $parent[0].className.match( expr )[ 0 ].replace( ' ', '.' ),
|
93 |
+
contentId = $target.data( 'content-id' ),
|
94 |
+
componentId = $parent.data( 'compotent-id' ),
|
95 |
+
activeFlag = $target.hasClass( this.buttonActiveClass ),
|
96 |
+
itemClosed;
|
97 |
+
|
98 |
+
switch ( componentName ) {
|
99 |
+
case this.tabClass:
|
100 |
+
if ( ! activeFlag ) {
|
101 |
+
this.hideElement( $parent );
|
102 |
+
this.showElement( $target, $parent, contentId );
|
103 |
+
|
104 |
+
this.localStorage[ componentId ] = new Array( contentId );
|
105 |
+
this.setState();
|
106 |
+
}
|
107 |
+
break;
|
108 |
+
|
109 |
+
case this.accordionClass:
|
110 |
+
this.hideElement( $parent );
|
111 |
+
|
112 |
+
if ( ! activeFlag ) {
|
113 |
+
this.showElement( $target, $parent, contentId );
|
114 |
+
|
115 |
+
this.localStorage[ componentId ] = new Array( contentId );
|
116 |
+
} else {
|
117 |
+
this.localStorage[ componentId ] = {};
|
118 |
+
}
|
119 |
+
this.setState();
|
120 |
+
break;
|
121 |
+
|
122 |
+
case this.toggleClass:
|
123 |
+
$target
|
124 |
+
.toggleClass( this.buttonActiveClass )
|
125 |
+
.nextAll( contentId )
|
126 |
+
.toggleClass( this.showClass );
|
127 |
+
|
128 |
+
if ( Array.isArray( this.localStorage[ componentId ] ) ) {
|
129 |
+
itemClosed = this.localStorage[ componentId ].indexOf( contentId );
|
130 |
+
|
131 |
+
if ( -1 !== itemClosed ) {
|
132 |
+
this.localStorage[ componentId ].splice( itemClosed, 1 );
|
133 |
+
} else {
|
134 |
+
this.localStorage[ componentId ].push( contentId );
|
135 |
+
}
|
136 |
+
|
137 |
+
} else {
|
138 |
+
this.localStorage[ componentId ] = new Array( contentId );
|
139 |
+
}
|
140 |
+
|
141 |
+
this.setState();
|
142 |
+
break;
|
143 |
+
}
|
144 |
+
$target.blur();
|
145 |
+
|
146 |
+
return false;
|
147 |
+
},
|
148 |
+
|
149 |
+
showElement: function ( button, holder, contentId ) {
|
150 |
+
button
|
151 |
+
.addClass( this.buttonActiveClass );
|
152 |
+
|
153 |
+
holder
|
154 |
+
.data( 'content-id', contentId );
|
155 |
+
|
156 |
+
$( contentId, holder )
|
157 |
+
.addClass( this.showClass );
|
158 |
+
},
|
159 |
+
|
160 |
+
hideElement: function ( holder ) {
|
161 |
+
var contsntId = holder.data( 'content-id' );
|
162 |
+
|
163 |
+
$( '[data-content-id="' + contsntId + '"]', holder )
|
164 |
+
.removeClass( this.buttonActiveClass );
|
165 |
+
|
166 |
+
$( contsntId, holder )
|
167 |
+
.removeClass( this.showClass );
|
168 |
+
},
|
169 |
+
|
170 |
+
getState: function() {
|
171 |
+
try {
|
172 |
+
return JSON.parse( localStorage.getItem( 'interface-builder' ) );
|
173 |
+
} catch ( e ) {
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
},
|
177 |
+
|
178 |
+
setState: function() {
|
179 |
+
try {
|
180 |
+
localStorage.setItem( 'interface-builder', JSON.stringify( this.localStorage ) );
|
181 |
+
} catch ( e ) {
|
182 |
+
return false;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
186 |
+
};
|
187 |
+
|
188 |
+
CherryJsCore.interfaceBuilder.init();
|
189 |
+
}( jQuery, window.CherryJsCore ) );
|
cherry-framework/modules/cherry-interface-builder/inc/assets/cherry-interface-builder.scss
ADDED
@@ -0,0 +1,463 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$color-1: #fff; // Background color.
|
2 |
+
$color-2: #efefef; // Background color.
|
3 |
+
$color-3: #96989a; // Description color and tabs button text color.
|
4 |
+
$color-4: #b4b7ba; //
|
5 |
+
$color-5: #f1f1f1; // Scrollbar background
|
6 |
+
$color-6: #e5e5e5; // Hover scrollbar background
|
7 |
+
$color-7: #495159; // Scrollbar track background
|
8 |
+
$link-color: #298ffc; // link color.
|
9 |
+
$link-hover-color: #23282d; // link hover color.
|
10 |
+
|
11 |
+
$shadow: 0px 5px 21px rgba(0, 0, 0, 0.1); //Shadow.
|
12 |
+
$border: 1px solid rgba(0, 0, 0, 0.1) ;
|
13 |
+
|
14 |
+
$br-radius: 5px; // Border radius.
|
15 |
+
|
16 |
+
$padding: 10px;
|
17 |
+
$margin: 10px;
|
18 |
+
$max-heught: 700px;
|
19 |
+
|
20 |
+
@import "use-in-js";
|
21 |
+
|
22 |
+
html{
|
23 |
+
font-size: 13px;
|
24 |
+
}
|
25 |
+
.cherry-ui-kit{
|
26 |
+
h1{
|
27 |
+
font-weight: 700;
|
28 |
+
font-size: 2.308rem;
|
29 |
+
line-height: 2.308rem;
|
30 |
+
.dashicons{
|
31 |
+
font-size: 3rem;
|
32 |
+
line-height: inherit;
|
33 |
+
width: 20px;
|
34 |
+
margin: 0 $margin * 2 0 $margin * -0.5;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
h2{
|
38 |
+
font-weight: 600;
|
39 |
+
font-size: 1.538rem;
|
40 |
+
line-height: 1.538rem;
|
41 |
+
.dashicons{
|
42 |
+
font-size: 2rem;
|
43 |
+
line-height: inherit;
|
44 |
+
width: 20px;
|
45 |
+
margin-right: $margin * 2;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
h3{
|
49 |
+
font-weight: 600;
|
50 |
+
font-size: 1.231rem;
|
51 |
+
line-height: 1.231rem;
|
52 |
+
.dashicons{
|
53 |
+
font-size: 1.7rem;
|
54 |
+
line-height: inherit;
|
55 |
+
margin-right: $margin * 0.5;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
h4{
|
59 |
+
font-weight: 500;
|
60 |
+
font-size: 1.077rem;
|
61 |
+
line-height: 1.077rem;
|
62 |
+
|
63 |
+
}
|
64 |
+
h5{
|
65 |
+
font-weight: 500;
|
66 |
+
font-size: 1.077rem;
|
67 |
+
line-height: 1.077rem;
|
68 |
+
}
|
69 |
+
h6{
|
70 |
+
font-weight: 400;
|
71 |
+
font-size: 1rem;
|
72 |
+
line-height: 1rem;
|
73 |
+
}
|
74 |
+
a{
|
75 |
+
color: $link-color;
|
76 |
+
text-decoration: none;
|
77 |
+
&:hover{
|
78 |
+
color: $link-hover-color;
|
79 |
+
}
|
80 |
+
&:focus{
|
81 |
+
outline: 1px solid $link-hover-color;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
&__description{
|
85 |
+
font-style: 1rem;
|
86 |
+
color: $color-3;
|
87 |
+
margin: $margin 0;
|
88 |
+
}
|
89 |
+
&__title{
|
90 |
+
margin: $margin*2 0;
|
91 |
+
}
|
92 |
+
&.hide{
|
93 |
+
display: none;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
.cherry-control + .cherry-control, .cherry-settings + .cherry-control{
|
98 |
+
border-top: $border;
|
99 |
+
}
|
100 |
+
|
101 |
+
.cherry-section{
|
102 |
+
padding: $padding;
|
103 |
+
background-color: $color-1;
|
104 |
+
margin-left: -10px;
|
105 |
+
&__title, &__description{
|
106 |
+
margin: $margin 0 0 0;
|
107 |
+
}
|
108 |
+
& + .cherry-ui-kit {
|
109 |
+
border-top: $border;
|
110 |
+
}
|
111 |
+
@media ( min-width: 783px ) {
|
112 |
+
box-shadow:$shadow;
|
113 |
+
border-radius: $br-radius;
|
114 |
+
border: $border;
|
115 |
+
padding: $padding * 1.5;
|
116 |
+
margin: $margin * 1.5 $margin * 1.5 0 0;
|
117 |
+
&__holder{
|
118 |
+
background-color: $color-2;
|
119 |
+
border-radius: $br-radius;
|
120 |
+
padding: $padding * 1.5;
|
121 |
+
}
|
122 |
+
&__inner{
|
123 |
+
|
124 |
+
}
|
125 |
+
&__info{
|
126 |
+
background-color: $color-1;
|
127 |
+
border-radius: $br-radius;
|
128 |
+
padding: $padding * 1.5;
|
129 |
+
box-shadow: $shadow;
|
130 |
+
margin-bottom: $padding * 1.5;
|
131 |
+
}
|
132 |
+
.cherry-settings{
|
133 |
+
box-shadow: $shadow;
|
134 |
+
border-radius: $br-radius;
|
135 |
+
border: $border;
|
136 |
+
background-color: $color-1;
|
137 |
+
margin-top: $padding * 1.5;
|
138 |
+
&:first-child{
|
139 |
+
margin-top: 0;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
@media ( min-width: 961px ) {
|
144 |
+
padding: $padding * 3;
|
145 |
+
margin: $margin * 2 $margin * 2 0 0;
|
146 |
+
&__info{
|
147 |
+
padding: $padding * 3;
|
148 |
+
margin-bottom: $padding * 3;
|
149 |
+
}
|
150 |
+
&__holder{
|
151 |
+
padding: $padding * 3;
|
152 |
+
}
|
153 |
+
.cherry-settings{
|
154 |
+
margin-top: $padding * 3;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
.cherry-component{
|
160 |
+
padding: $padding * 2 0;
|
161 |
+
@media ( min-width: 783px ) {
|
162 |
+
padding: $padding * 1.5;
|
163 |
+
}
|
164 |
+
@media ( min-width: 961px ) {
|
165 |
+
padding: $padding * 3;
|
166 |
+
}
|
167 |
+
& + * {
|
168 |
+
border-top: $border;
|
169 |
+
}
|
170 |
+
&__title{
|
171 |
+
margin-top: 0;
|
172 |
+
}
|
173 |
+
& &__content{
|
174 |
+
.cherry-settings{
|
175 |
+
padding: 0;
|
176 |
+
border-top: none;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
&__button{
|
180 |
+
display: block;
|
181 |
+
min-height: 45px;
|
182 |
+
.cherry-ui-kit__title {
|
183 |
+
color: inherit;
|
184 |
+
}
|
185 |
+
&.active, &:hover{
|
186 |
+
color: $link-color;
|
187 |
+
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
|
188 |
+
}
|
189 |
+
&:focus{
|
190 |
+
outline: none;
|
191 |
+
box-shadow: inset 0px 0px 10px rgba(41,143,252,0.5);
|
192 |
+
transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
193 |
+
}
|
194 |
+
transition: all 300ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
195 |
+
}
|
196 |
+
&.cherry-accordion, &.cherry-toggle{
|
197 |
+
.cherry-component__button{
|
198 |
+
width: 100%;
|
199 |
+
padding: $padding * 1.5 $padding * 2;
|
200 |
+
border:0;
|
201 |
+
background: none;
|
202 |
+
cursor: pointer;
|
203 |
+
.cherry-toggle__title {
|
204 |
+
font-weight: 700;
|
205 |
+
font-size: 14px;
|
206 |
+
float: left;
|
207 |
+
margin: 0;
|
208 |
+
}
|
209 |
+
span{
|
210 |
+
font-size: 25px;
|
211 |
+
color: $color-4;
|
212 |
+
float: right;
|
213 |
+
padding: 5px 5px;
|
214 |
+
width: 10px;
|
215 |
+
height: 9px;
|
216 |
+
text-align: left;
|
217 |
+
margin-right: -6px;
|
218 |
+
&.hide-icon{
|
219 |
+
&:before{
|
220 |
+
position: relative;
|
221 |
+
top: -8px;
|
222 |
+
left: -9px;
|
223 |
+
}
|
224 |
+
transform:scaleX(1);
|
225 |
+
transition: all 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
226 |
+
}
|
227 |
+
&.show-icon{
|
228 |
+
&:before{
|
229 |
+
position: relative;
|
230 |
+
top: -7px;
|
231 |
+
left: -9px;
|
232 |
+
}
|
233 |
+
position: relative;
|
234 |
+
left: 14px;
|
235 |
+
transform:scaleX(0);
|
236 |
+
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
237 |
+
}
|
238 |
+
}
|
239 |
+
&.active{
|
240 |
+
span{
|
241 |
+
&.show-icon{
|
242 |
+
transform:scaleX(1);
|
243 |
+
transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
244 |
+
}
|
245 |
+
&.hide-icon{
|
246 |
+
transform:scaleX(0);
|
247 |
+
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}
|
252 |
+
.cherry-component__button + .cherry-settings__content{
|
253 |
+
border-top: $border;
|
254 |
+
}
|
255 |
+
> .cherry-ui-kit__content{
|
256 |
+
& > .cherry-settings + .cherry-settings{
|
257 |
+
margin-top: $margin;
|
258 |
+
}
|
259 |
+
> .cherry-settings{
|
260 |
+
box-shadow:$shadow;
|
261 |
+
border-radius: $br-radius;
|
262 |
+
border: $border;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
&.cherry-tab{
|
267 |
+
.cherry-tab__tabs{
|
268 |
+
display: flex;
|
269 |
+
flex-flow: row wrap;
|
270 |
+
justify-content: flex-start;
|
271 |
+
align-items: flex-start;
|
272 |
+
align-content: flex-start;
|
273 |
+
border-bottom: $border;
|
274 |
+
.cherry-component__button{
|
275 |
+
order: 0;
|
276 |
+
flex: 0 1 100%;
|
277 |
+
align-self: auto;
|
278 |
+
padding: $padding * 1.5 $padding * 2;
|
279 |
+
border: 0;
|
280 |
+
background: none;
|
281 |
+
cursor: pointer;
|
282 |
+
&.active{
|
283 |
+
-ms-box-shadow: inset 0px -3px 0px 0px $link-color;
|
284 |
+
box-shadow: inset 0px -3px 0px 0px $link-color;
|
285 |
+
}
|
286 |
+
.cherry-tab__title {
|
287 |
+
font-weight: 700;
|
288 |
+
font-size: 14px;
|
289 |
+
float: left;
|
290 |
+
margin: 0;
|
291 |
+
}
|
292 |
+
& + button{
|
293 |
+
border-top: $border;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
.cherry-tab__body{
|
298 |
+
box-shadow:$shadow;
|
299 |
+
border-radius: $br-radius;
|
300 |
+
border: $border;
|
301 |
+
background-color: $color-1;
|
302 |
+
.cherry-settings{
|
303 |
+
box-shadow: none;
|
304 |
+
border-radius: 0;
|
305 |
+
border: none;
|
306 |
+
background-color: inherit;
|
307 |
+
margin: 0;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
@media ( min-width: 783px ) {
|
311 |
+
.cherry-tab__tabs{
|
312 |
+
border: solid 1px rgba(0,0,0,0.1);
|
313 |
+
.cherry-component__button{
|
314 |
+
& + button{
|
315 |
+
border-top: none;
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
.cherry-tab__body{
|
320 |
+
border: none;
|
321 |
+
.cherry-tab__content{
|
322 |
+
border: $border;
|
323 |
+
}
|
324 |
+
}
|
325 |
+
&--horizontal{
|
326 |
+
>.cherry-tab__body{
|
327 |
+
border-radius: none;
|
328 |
+
>.cherry-tab__tabs{
|
329 |
+
flex-wrap: nowrap;
|
330 |
+
flex-direction: row;
|
331 |
+
border-radius:$br-radius $br-radius 0 0;
|
332 |
+
border-bottom: none;
|
333 |
+
.cherry-component__button{
|
334 |
+
flex: 0 1 auto;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
>.cherry-tab__content{
|
338 |
+
border-radius: 0 0 $br-radius $br-radius;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
342 |
+
&--vertical{
|
343 |
+
>.cherry-tab__body{
|
344 |
+
display: flex;
|
345 |
+
border-radius: none;
|
346 |
+
>.cherry-tab__tabs{
|
347 |
+
flex-direction: row;
|
348 |
+
-webkit-box-flex: 0;
|
349 |
+
flex: 0 1 25%;
|
350 |
+
border-radius:$br-radius 0 0 $br-radius;
|
351 |
+
border-right: none;
|
352 |
+
.cherry-component__button{
|
353 |
+
text-align: right;
|
354 |
+
.cherry-tab__title {
|
355 |
+
width: 100%;
|
356 |
+
}
|
357 |
+
&.active{
|
358 |
+
box-shadow: inset -3px 0px 0px $link-color;
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
>.cherry-tab__content{
|
363 |
+
-webkit-box-flex: 0;
|
364 |
+
flex: 0 1 75%;
|
365 |
+
border-radius: 0 $br-radius $br-radius 0;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
@media ( min-width: 1200px ) {
|
371 |
+
&--vertical{
|
372 |
+
.cherry-tab__tabs{
|
373 |
+
flex: 0 1 20%;
|
374 |
+
}
|
375 |
+
.cherry-tab__content{
|
376 |
+
flex: 0 1 80%;
|
377 |
+
}
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
.cherry-settings{
|
383 |
+
& + & {
|
384 |
+
border-top: $border;
|
385 |
+
}
|
386 |
+
& &__title{
|
387 |
+
margin-bottom: $margin;
|
388 |
+
}
|
389 |
+
&__description, & &__title{
|
390 |
+
margin-left: $margin;
|
391 |
+
@media ( min-width: 783px ) {
|
392 |
+
margin-left: $margin * 1.5;
|
393 |
+
}
|
394 |
+
@media ( min-width: 961px ) {
|
395 |
+
margin-left: $margin * 3;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
.cherry-control{
|
400 |
+
padding: $padding * 1.5 $padding * 2;
|
401 |
+
&__title{
|
402 |
+
margin: 0 0 $margin 0 ;
|
403 |
+
}
|
404 |
+
&__description{
|
405 |
+
margin-top: 0;
|
406 |
+
}
|
407 |
+
.cherry-ui-container {
|
408 |
+
margin: 0;
|
409 |
+
}
|
410 |
+
@media (min-width: 783px) {
|
411 |
+
padding: $padding * 1.5;
|
412 |
+
display: flex;
|
413 |
+
flex-flow: row nowrap;
|
414 |
+
&__info{
|
415 |
+
-webkit-box-flex: 0;
|
416 |
+
flex: 0 1 30%;
|
417 |
+
padding-right: $padding * 1.5;
|
418 |
+
}
|
419 |
+
&__content{
|
420 |
+
-webkit-box-flex: 0;
|
421 |
+
flex: 0 1 70%;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
@media ( min-width: 961px ) {
|
425 |
+
padding: $padding * 3;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
.cherry-section.cherry-scroll > .cherry-section__holder > .cherry-section__inner,
|
430 |
+
.cherry-tab__content > .cherry-scroll,
|
431 |
+
.cherry-accordion__content > .cherry-scroll > .cherry-settings__content,
|
432 |
+
.cherry-toggle__content > .cherry-scroll > .cherry-settings__content,
|
433 |
+
{
|
434 |
+
@media ( min-width: 783px ) {
|
435 |
+
max-height: $max-heught;
|
436 |
+
overflow-y: scroll;
|
437 |
+
position: relative;
|
438 |
+
&::-webkit-scrollbar {
|
439 |
+
width: 10px;
|
440 |
+
height: 10px;
|
441 |
+
&-button {
|
442 |
+
width: 0px;
|
443 |
+
height: 0px;
|
444 |
+
}
|
445 |
+
&-thumb {
|
446 |
+
background-color: $link-color;
|
447 |
+
border: none;
|
448 |
+
border-radius: $br-radius;
|
449 |
+
&:hover, &:active {
|
450 |
+
background: #206ff4;
|
451 |
+
}
|
452 |
+
}
|
453 |
+
&-track {
|
454 |
+
background-color: $color-1;
|
455 |
+
border: none;
|
456 |
+
border-radius: $br-radius;
|
457 |
+
}
|
458 |
+
&-corner {
|
459 |
+
background: transparent;
|
460 |
+
}
|
461 |
+
}
|
462 |
+
}
|
463 |
+
}
|
cherry-framework/modules/cherry-interface-builder/inc/assets/min/cherry-interface-builder.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.cherry-ui-kit button *{pointer-events:none}.cherry-component__content .cherry-settings__content{display:none}.cherry-component__content .cherry-settings__content.show{display:inherit}html{font-size:13px}.cherry-ui-kit h1{font-weight:700;font-size:2.308rem;line-height:2.308rem}.cherry-ui-kit h1 .dashicons{font-size:3rem;line-height:inherit;width:20px;margin:0 20px 0 -5px}.cherry-ui-kit h2{font-weight:600;font-size:1.538rem;line-height:1.538rem}.cherry-ui-kit h2 .dashicons{font-size:2rem;line-height:inherit;width:20px;margin-right:20px}.cherry-ui-kit h3{font-weight:600;font-size:1.231rem;line-height:1.231rem}.cherry-ui-kit h3 .dashicons{font-size:1.7rem;line-height:inherit;margin-right:5px}.cherry-ui-kit h4{font-weight:500;font-size:1.077rem;line-height:1.077rem}.cherry-ui-kit h5{font-weight:500;font-size:1.077rem;line-height:1.077rem}.cherry-ui-kit h6{font-weight:400;font-size:1rem;line-height:1rem}.cherry-ui-kit a{color:#298ffc;text-decoration:none}.cherry-ui-kit a:hover{color:#23282d}.cherry-ui-kit a:focus{outline:1px solid #23282d}.cherry-ui-kit__description{font-style:1rem;color:#96989a;margin:10px 0}.cherry-ui-kit__title{margin:20px 0}.cherry-ui-kit.hide{display:none}.cherry-control+.cherry-control,.cherry-settings+.cherry-control{border-top:1px solid rgba(0,0,0,0.1)}.cherry-section{padding:10px;background-color:#fff;margin-left:-10px}.cherry-section__title,.cherry-section__description{margin:10px 0 0 0}.cherry-section+.cherry-ui-kit{border-top:1px solid rgba(0,0,0,0.1)}@media (min-width: 783px){.cherry-section{box-shadow:0px 5px 21px rgba(0,0,0,0.1);border-radius:5px;border:1px solid rgba(0,0,0,0.1);padding:15px;margin:15px 15px 0 0}.cherry-section__holder{background-color:#efefef;border-radius:5px;padding:15px}.cherry-section__info{background-color:#fff;border-radius:5px;padding:15px;box-shadow:0px 5px 21px rgba(0,0,0,0.1);margin-bottom:15px}.cherry-section .cherry-settings{box-shadow:0px 5px 21px rgba(0,0,0,0.1);border-radius:5px;border:1px solid rgba(0,0,0,0.1);background-color:#fff;margin-top:15px}.cherry-section .cherry-settings:first-child{margin-top:0}}@media (min-width: 961px){.cherry-section{padding:30px;margin:20px 20px 0 0}.cherry-section__info{padding:30px;margin-bottom:30px}.cherry-section__holder{padding:30px}.cherry-section .cherry-settings{margin-top:30px}}.cherry-component{padding:20px 0}@media (min-width: 783px){.cherry-component{padding:15px}}@media (min-width: 961px){.cherry-component{padding:30px}}.cherry-component+*{border-top:1px solid rgba(0,0,0,0.1)}.cherry-component__title{margin-top:0}.cherry-component .cherry-component__content .cherry-settings{padding:0;border-top:none}.cherry-component__button{display:block;min-height:45px;-webkit-transition:all 300ms cubic-bezier(0.55, 0.055, 0.675, 0.19);transition:all 300ms cubic-bezier(0.55, 0.055, 0.675, 0.19)}.cherry-component__button .cherry-ui-kit__title{color:inherit}.cherry-component__button.active,.cherry-component__button:hover{color:#298ffc;-webkit-transition-timing-function:cubic-bezier(0.215, 0.61, 0.355, 1);transition-timing-function:cubic-bezier(0.215, 0.61, 0.355, 1)}.cherry-component__button:focus{outline:none;box-shadow:inset 0px 0px 10px rgba(41,143,252,0.5);-webkit-transition-timing-function:cubic-bezier(0.175, 0.885, 0.32, 1.275);transition-timing-function:cubic-bezier(0.175, 0.885, 0.32, 1.275)}.cherry-component.cherry-accordion .cherry-component__button,.cherry-component.cherry-toggle .cherry-component__button{width:100%;padding:15px 20px;border:0;background:none;cursor:pointer}.cherry-component.cherry-accordion .cherry-component__button .cherry-toggle__title,.cherry-component.cherry-toggle .cherry-component__button .cherry-toggle__title{font-weight:700;font-size:14px;float:left;margin:0}.cherry-component.cherry-accordion .cherry-component__button span,.cherry-component.cherry-toggle .cherry-component__button span{font-size:25px;color:#b4b7ba;float:right;padding:5px 5px;width:10px;height:9px;text-align:left;margin-right:-6px}.cherry-component.cherry-accordion .cherry-component__button span.hide-icon,.cherry-component.cherry-toggle .cherry-component__button span.hide-icon{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);-webkit-transition:all 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:all 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275)}.cherry-component.cherry-accordion .cherry-component__button span.hide-icon:before,.cherry-component.cherry-toggle .cherry-component__button span.hide-icon:before{position:relative;top:-8px;left:-9px}.cherry-component.cherry-accordion .cherry-component__button span.show-icon,.cherry-component.cherry-toggle .cherry-component__button span.show-icon{position:relative;left:14px;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transition:all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);transition:all 300ms cubic-bezier(0.215, 0.61, 0.355, 1)}.cherry-component.cherry-accordion .cherry-component__button span.show-icon:before,.cherry-component.cherry-toggle .cherry-component__button span.show-icon:before{position:relative;top:-7px;left:-9px}.cherry-component.cherry-accordion .cherry-component__button.active span.show-icon,.cherry-component.cherry-toggle .cherry-component__button.active span.show-icon{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);-webkit-transition-timing-function:cubic-bezier(0.175, 0.885, 0.32, 1.275);transition-timing-function:cubic-bezier(0.175, 0.885, 0.32, 1.275)}.cherry-component.cherry-accordion .cherry-component__button.active span.hide-icon,.cherry-component.cherry-toggle .cherry-component__button.active span.hide-icon{-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transition-timing-function:cubic-bezier(0.215, 0.61, 0.355, 1);transition-timing-function:cubic-bezier(0.215, 0.61, 0.355, 1)}.cherry-component.cherry-accordion .cherry-component__button+.cherry-settings__content,.cherry-component.cherry-toggle .cherry-component__button+.cherry-settings__content{border-top:1px solid rgba(0,0,0,0.1)}.cherry-component.cherry-accordion>.cherry-ui-kit__content>.cherry-settings+.cherry-settings,.cherry-component.cherry-toggle>.cherry-ui-kit__content>.cherry-settings+.cherry-settings{margin-top:10px}.cherry-component.cherry-accordion>.cherry-ui-kit__content>.cherry-settings,.cherry-component.cherry-toggle>.cherry-ui-kit__content>.cherry-settings{box-shadow:0px 5px 21px rgba(0,0,0,0.1);border-radius:5px;border:1px solid rgba(0,0,0,0.1)}.cherry-component.cherry-tab .cherry-tab__tabs{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start;border-bottom:1px solid rgba(0,0,0,0.1)}.cherry-component.cherry-tab .cherry-tab__tabs .cherry-component__button{-webkit-box-ordinal-group:1;-webkit-order:0;-ms-flex-order:0;order:0;-webkit-box-flex:0;-webkit-flex:0 1 100%;-ms-flex:0 1 100%;flex:0 1 100%;-webkit-align-self:auto;-ms-flex-item-align:auto;align-self:auto;padding:15px 20px;border:0;background:none;cursor:pointer}.cherry-component.cherry-tab .cherry-tab__tabs .cherry-component__button.active{-ms-box-shadow:inset 0px -3px 0px 0px #298ffc;box-shadow:inset 0px -3px 0px 0px #298ffc}.cherry-component.cherry-tab .cherry-tab__tabs .cherry-component__button .cherry-tab__title{font-weight:700;font-size:14px;float:left;margin:0}.cherry-component.cherry-tab .cherry-tab__tabs .cherry-component__button+button{border-top:1px solid rgba(0,0,0,0.1)}.cherry-component.cherry-tab .cherry-tab__body{box-shadow:0px 5px 21px rgba(0,0,0,0.1);border-radius:5px;border:1px solid rgba(0,0,0,0.1);background-color:#fff}.cherry-component.cherry-tab .cherry-tab__body .cherry-settings{box-shadow:none;border-radius:0;border:none;background-color:inherit;margin:0}@media (min-width: 783px){.cherry-component.cherry-tab .cherry-tab__tabs{border:solid 1px rgba(0,0,0,0.1)}.cherry-component.cherry-tab .cherry-tab__tabs .cherry-component__button+button{border-top:none}.cherry-component.cherry-tab .cherry-tab__body{border:none}.cherry-component.cherry-tab .cherry-tab__body .cherry-tab__content{border:1px solid rgba(0,0,0,0.1)}.cherry-component.cherry-tab--horizontal>.cherry-tab__body{border-radius:none}.cherry-component.cherry-tab--horizontal>.cherry-tab__body>.cherry-tab__tabs{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;border-radius:5px 5px 0 0;border-bottom:none}.cherry-component.cherry-tab--horizontal>.cherry-tab__body>.cherry-tab__tabs .cherry-component__button{-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto}.cherry-component.cherry-tab--horizontal>.cherry-tab__body>.cherry-tab__content{border-radius:0 0 5px 5px}.cherry-component.cherry-tab--vertical>.cherry-tab__body{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-radius:none}.cherry-component.cherry-tab--vertical>.cherry-tab__body>.cherry-tab__tabs{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-flex:0;-webkit-flex:0 1 25%;-ms-flex:0 1 25%;flex:0 1 25%;border-radius:5px 0 0 5px;border-right:none}.cherry-component.cherry-tab--vertical>.cherry-tab__body>.cherry-tab__tabs .cherry-component__button{text-align:right}.cherry-component.cherry-tab--vertical>.cherry-tab__body>.cherry-tab__tabs .cherry-component__button .cherry-tab__title{width:100%}.cherry-component.cherry-tab--vertical>.cherry-tab__body>.cherry-tab__tabs .cherry-component__button.active{box-shadow:inset -3px 0px 0px #298ffc}.cherry-component.cherry-tab--vertical>.cherry-tab__body>.cherry-tab__content{-webkit-box-flex:0;-webkit-flex:0 1 75%;-ms-flex:0 1 75%;flex:0 1 75%;border-radius:0 5px 5px 0}}@media (min-width: 1200px){.cherry-component.cherry-tab--vertical .cherry-tab__tabs{-webkit-box-flex:0;-webkit-flex:0 1 20%;-ms-flex:0 1 20%;flex:0 1 20%}.cherry-component.cherry-tab--vertical .cherry-tab__content{-webkit-box-flex:0;-webkit-flex:0 1 80%;-ms-flex:0 1 80%;flex:0 1 80%}}.cherry-settings+.cherry-settings{border-top:1px solid rgba(0,0,0,0.1)}.cherry-settings .cherry-settings__title{margin-bottom:10px}.cherry-settings__description,.cherry-settings .cherry-settings__title{margin-left:10px}@media (min-width: 783px){.cherry-settings__description,.cherry-settings .cherry-settings__title{margin-left:15px}}@media (min-width: 961px){.cherry-settings__description,.cherry-settings .cherry-settings__title{margin-left:30px}}.cherry-control{padding:15px 20px}.cherry-control__title{margin:0 0 10px 0}.cherry-control__description{margin-top:0}.cherry-control .cherry-ui-container{margin:0}@media (min-width: 783px){.cherry-control{padding:15px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row nowrap;-ms-flex-flow:row nowrap;flex-flow:row nowrap}.cherry-control__info{-webkit-box-flex:0;-webkit-flex:0 1 30%;-ms-flex:0 1 30%;flex:0 1 30%;padding-right:15px}.cherry-control__content{-webkit-box-flex:0;-webkit-flex:0 1 70%;-ms-flex:0 1 70%;flex:0 1 70%}}@media (min-width: 961px){.cherry-control{padding:30px}}@media (min-width: 783px){.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner,.cherry-tab__content>.cherry-scroll,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content{max-height:700px;overflow-y:scroll;position:relative}.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar{width:10px;height:10px}.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar-button,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar-button,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-button,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-button{width:0px;height:0px}.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar-thumb,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar-thumb,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-thumb,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-thumb{background-color:#298ffc;border:none;border-radius:5px}.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar-thumb:hover,.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar-thumb:active,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar-thumb:hover,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar-thumb:active,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-thumb:hover,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-thumb:active,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-thumb:hover,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-thumb:active{background:#206ff4}.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar-track,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar-track,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-track,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-track{background-color:#fff;border:none;border-radius:5px}.cherry-section.cherry-scroll>.cherry-section__holder>.cherry-section__inner::-webkit-scrollbar-corner,.cherry-tab__content>.cherry-scroll::-webkit-scrollbar-corner,.cherry-accordion__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-corner,.cherry-toggle__content>.cherry-scroll>.cherry-settings__content::-webkit-scrollbar-corner{background:transparent}}
|
cherry-framework/modules/cherry-interface-builder/inc/assets/min/cherry-interface-builder.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t,s){"use strict";s.utilites.namespace("interfaceBuilder"),s.interfaceBuilder={init:function(){this.component.init()},component:{tabClass:".cherry-tab",accordionClass:".cherry-accordion",toggleClass:".cherry-toggle",buttonClass:".cherry-component__button",contentClass:".cherry-settings__content",buttonActiveClass:"active",showClass:"show",localStorage:{},init:function(){this.localStorage=this.getState()||{},this.componentInit(this.tabClass),this.componentInit(this.accordionClass),this.componentInit(this.toggleClass),this.addEvent()},addEvent:function(){t("body").on("click",this.tabClass+" "+this.buttonClass+", "+this.toggleClass+" "+this.buttonClass+", "+this.accordionClass+" "+this.buttonClass,this.componentClick.bind(this))},componentInit:function(s){var a=this,e=t(s),o=null,i=null,l=null,n="";e.each(function(e,c){switch(c=t(c),o=c.data("compotent-id"),s){case a.toggleClass:a.localStorage[o]&&a.localStorage[o].length&&(n=a.localStorage[o].join(", ")),t(a.contentClass,c).not(n).addClass(a.showClass).prevAll(a.buttonClass).addClass(a.buttonActiveClass);break;case a.tabClass:case a.accordionClass:a.localStorage[o]?(l=a.localStorage[o][0],i=t('[data-content-id="'+l+'"]',c)):(i=t(a.buttonClass,c).eq(0),l=i.data("content-id")),a.showElement(i,c,l)}})},componentClick:function(s){var a,e=t(s.target),o=e.closest(this.tabClass+", "+this.accordionClass+", "+this.toggleClass),i=new RegExp(this.tabClass+"|"+this.accordionClass+"|"+this.toggleClass),l=o[0].className.match(i)[0].replace(" ","."),n=e.data("content-id"),c=o.data("compotent-id"),r=e.hasClass(this.buttonActiveClass);switch(l){case this.tabClass:r||(this.hideElement(o),this.showElement(e,o,n),this.localStorage[c]=new Array(n),this.setState());break;case this.accordionClass:this.hideElement(o),r?this.localStorage[c]={}:(this.showElement(e,o,n),this.localStorage[c]=new Array(n)),this.setState();break;case this.toggleClass:e.toggleClass(this.buttonActiveClass).nextAll(n).toggleClass(this.showClass),Array.isArray(this.localStorage[c])?(a=this.localStorage[c].indexOf(n),-1!==a?this.localStorage[c].splice(a,1):this.localStorage[c].push(n)):this.localStorage[c]=new Array(n),this.setState()}return e.blur(),!1},showElement:function(s,a,e){s.addClass(this.buttonActiveClass),a.data("content-id",e),t(e,a).addClass(this.showClass)},hideElement:function(s){var a=s.data("content-id");t('[data-content-id="'+a+'"]',s).removeClass(this.buttonActiveClass),t(a,s).removeClass(this.showClass)},getState:function(){try{return JSON.parse(localStorage.getItem("interface-builder"))}catch(t){return!1}},setState:function(){try{localStorage.setItem("interface-builder",JSON.stringify(this.localStorage))}catch(t){return!1}}}},s.interfaceBuilder.init()}(jQuery,window.CherryJsCore);
|
cherry-framework/modules/cherry-interface-builder/inc/views/component-accordion.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Accordion template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-component cherry-accordion <?php echo $__data['class']; ?>" data-compotent-id="#<?php echo $__data['id'] ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
20 |
+
<h2 class="cherry-ui-kit__title cherry-component__title" role="banner" ><?php echo $__data['title'] ?></h2>
|
21 |
+
<?php } ?>
|
22 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
23 |
+
<div class="cherry-ui-kit__description cherry-component__description" role="note" ><?php echo $__data['description'] ?></div>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
26 |
+
<div class="cherry-ui-kit__content cherry-component__content cherry-accordion__content" role="group" >
|
27 |
+
<?php echo $__data['children'] ?>
|
28 |
+
</div>
|
29 |
+
<?php } ?>
|
30 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/component-repeater.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Repeater template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-component cherry-repeater <?php echo $__data['class']; ?>" data-compotent-id="#<?php echo $__data['id']; ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
20 |
+
<h2 class="cherry-ui-kit__title cherry-component__title" role="banner" ><?php echo $__data['title']; ?></h2>
|
21 |
+
<?php } ?>
|
22 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
23 |
+
<div class="cherry-ui-kit__description cherry-component__description" role="note" ><?php echo $__data['description']; ?></div>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
26 |
+
<div class="cherry-ui-kit__content cherry-component__content" role="group" >
|
27 |
+
<?php echo $__data['children']; ?>
|
28 |
+
</div>
|
29 |
+
<?php } ?>
|
30 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/component-tab-horizontal.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Horizontal tab template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-component cherry-tab cherry-tab--horizontal <?php echo $__data['class'] ?>" data-compotent-id="#<?php echo $__data['id'] ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
20 |
+
<h2 class="cherry-ui-kit__title cherry-component__title" role="banner" ><?php echo $__data['title']; ?></h2>
|
21 |
+
<?php } ?>
|
22 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
23 |
+
<div class="cherry-ui-kit__description cherry-component__description" role="note" ><?php echo $__data['description']; ?></div>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
26 |
+
<div class="cherry-tab__body" >
|
27 |
+
<div class="cherry-tab__tabs" role="navigation" >
|
28 |
+
<?php echo $__data['tabs']; ?>
|
29 |
+
</div>
|
30 |
+
<div class="cherry-ui-kit__content cherry-component__content cherry-tab__content" role="group" >
|
31 |
+
<?php echo $__data['children']; ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
<?php } ?>
|
35 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/component-tab-vertical.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Verticall tab template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-component cherry-tab cherry-tab--vertical <?php echo $__data['class']; ?>" data-compotent-id="#<?php echo $__data['id']; ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
20 |
+
<h2 class="cherry-ui-kit__title cherry-component__title" role="banner" ><?php echo $__data['title']; ?></h2>
|
21 |
+
<?php } ?>
|
22 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
23 |
+
<div class="cherry-ui-kit__description cherry-component__description" role="note" ><?php echo $__data['description']; ?></div>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
26 |
+
<div class="cherry-tab__body" >
|
27 |
+
<div class="cherry-tab__tabs" role="navigation" >
|
28 |
+
<?php echo $__data['tabs'] ?>
|
29 |
+
</div>
|
30 |
+
<div class="cherry-ui-kit__content cherry-component__content cherry-tab__content" role="group" >
|
31 |
+
<?php echo $__data['children']; ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
<?php } ?>
|
35 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/component-toggle.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Toggle template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-component cherry-toggle <?php echo $__data['class']; ?>" data-compotent-id="#<?php echo $__data['id'] ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
20 |
+
<h2 class="cherry-ui-kit__title cherry-component__title" role="banner" ><?php echo $__data['title']; ?></h2>
|
21 |
+
<?php } ?>
|
22 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
23 |
+
<div class="cherry-ui-kit__description cherry-component__description" role="note" ><?php echo $__data['description']; ?></div>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
26 |
+
<div class="cherry-ui-kit__content cherry-component__content cherry-toggle__content" role="group" >
|
27 |
+
<?php echo $__data['children']; ?>
|
28 |
+
</div>
|
29 |
+
<?php } ?>
|
30 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/control.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Control template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-control <?php echo $__data['class']; ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) || ! empty( $__data['description'] ) ) { ?>
|
20 |
+
<div class="cherry-control__info">
|
21 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
22 |
+
<h4 class="cherry-ui-kit__title cherry-control__title" role="banner" ><?php echo $__data['title']; ?></h4>
|
23 |
+
<?php } ?>
|
24 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
25 |
+
<div class="cherry-ui-kit__description cherry-control__description" role="note" ><?php echo $__data['description']; ?></div>
|
26 |
+
<?php } ?>
|
27 |
+
</div>
|
28 |
+
<?php } ?>
|
29 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
30 |
+
<div class="cherry-ui-kit__content cherry-control__content" role="group" >
|
31 |
+
<?php echo $__data['children']; ?>
|
32 |
+
</div>
|
33 |
+
<?php } ?>
|
34 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/form.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Form template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<form class="cherry-form <?php echo $__data['class']; ?>" id="<?php echo $__data['id']; ?>" name="<?php echo $__data['id']; ?>" <?php echo $__data['accept-charset'] . $__data['action'] . $__data['autocomplete'] . $__data['enctype'] . $__data['method'] . $__data['novalidate'] . $__data['target']; ?>>
|
19 |
+
<?php
|
20 |
+
if ( ! empty( $__data['children'] ) ) {
|
21 |
+
echo $__data['children'];
|
22 |
+
}
|
23 |
+
?>
|
24 |
+
</form>
|
cherry-framework/modules/cherry-interface-builder/inc/views/html.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit <?php echo $__data['class']; ?>">
|
19 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
20 |
+
<div class="cherry-ui-kit__content" role="group" >
|
21 |
+
<?php echo $__data['children']; ?>
|
22 |
+
</div>
|
23 |
+
<?php } ?>
|
24 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/section.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Section template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-section <?php echo $__data['class']; ?>" onclick="void(0)">
|
19 |
+
<div class="cherry-section__holder">
|
20 |
+
<div class="cherry-section__inner">
|
21 |
+
<div class="cherry-section__info">
|
22 |
+
<?php if ( ! empty( $__data['title'] ) ) { ?>
|
23 |
+
<h1 class="cherry-ui-kit__title cherry-section__title" role="banner" ><?php echo $__data['title']; ?></h1>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
26 |
+
<div class="cherry-ui-kit__description cherry-section__description " role="note" ><?php echo $__data['description']; ?></div>
|
27 |
+
<?php } ?>
|
28 |
+
</div>
|
29 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
30 |
+
<div class="cherry-ui-kit__content cherry-section__content" role="group" >
|
31 |
+
<?php echo $__data['children']; ?>
|
32 |
+
</div>
|
33 |
+
<?php } ?>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/settings-children-title.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Settings title template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<h3 class="cherry-ui-kit__title cherry-settings__title" role="banner" ><?php echo $__data['title']; ?></h3>
|
cherry-framework/modules/cherry-interface-builder/inc/views/settings.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Settings template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<div class="cherry-ui-kit cherry-settings <?php echo $__data['class']; ?>">
|
19 |
+
<?php if ( ! empty( $__data['title'] ) ) {
|
20 |
+
echo $__data['title'];
|
21 |
+
} ?>
|
22 |
+
<?php if ( ! empty( $__data['children'] ) || ! empty( $__data['description'] ) ) { ?>
|
23 |
+
<div class="cherry-ui-kit__content cherry-settings__content" role="group" id="<?php echo $__data['id']; ?>" >
|
24 |
+
<?php if ( ! empty( $__data['description'] ) ) { ?>
|
25 |
+
<div class="cherry-ui-kit__description cherry-settings__description" role="note" ><?php echo $__data['description']; ?></div>
|
26 |
+
<?php } ?>
|
27 |
+
<?php if ( ! empty( $__data['children'] ) ) { ?>
|
28 |
+
<?php echo $__data['children']; ?>
|
29 |
+
<?php } ?>
|
30 |
+
</div>
|
31 |
+
<?php } ?>
|
32 |
+
</div>
|
cherry-framework/modules/cherry-interface-builder/inc/views/tab-children-title.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Tabs title template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<button class="cherry-tab__button cherry-component__button" role="button" title="<?php echo $__data['title']; ?>" aria-expanded="false" data-content-id="#<?php echo $__data['id'] ?>">
|
19 |
+
<h3 class="cherry-ui-kit__title cherry-tab__title" aria-grabbed="true" role="banner" ><?php echo $__data['title']; ?></h3>
|
20 |
+
</button>
|
cherry-framework/modules/cherry-interface-builder/inc/views/toggle-children-title.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Toggle title template.
|
4 |
+
*
|
5 |
+
* @package Cherry_Interface_Builder
|
6 |
+
* @subpackage Views
|
7 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
+
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
*/
|
12 |
+
|
13 |
+
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<button class="cherry-toggle__header cherry-component__button" role="button" aria-expanded="false" data-content-id="#<?php echo $__data['id'] ?>">
|
19 |
+
<h3 class="cherry-ui-kit__title cherry-toggle__title" aria-grabbed="true" role="banner" ><?php echo $__data['title']; ?></h3>
|
20 |
+
<span class="dashicons dashicons-arrow-down hide-icon"></span>
|
21 |
+
<span class="dashicons dashicons-arrow-up show-icon"></span>
|
22 |
+
</button>
|
cherry-framework/modules/cherry-js-core/assets/js/cherry-js-core.js
CHANGED
@@ -70,7 +70,7 @@ var CherryJsCore = {};
|
|
70 |
expressions: {
|
71 |
widget_ui_init: function() {
|
72 |
$( document ).on( 'widget-added widget-updated', function( event, data ) {
|
73 |
-
$(
|
74 |
type: 'cherry-ui-elements-init',
|
75 |
_target: data
|
76 |
} );
|
@@ -92,61 +92,6 @@ var CherryJsCore = {};
|
|
92 |
parent = parent[ parts[ i ] ];
|
93 |
}
|
94 |
return parent;
|
95 |
-
},
|
96 |
-
get_compress_assets: function( url, callback ) {
|
97 |
-
var data = {
|
98 |
-
action: 'get_compress_assets',
|
99 |
-
security: CherryJsCore.variable.security,
|
100 |
-
style: [],
|
101 |
-
script: []
|
102 |
-
},
|
103 |
-
reg_name = /([\S.]+\/)/gmi,
|
104 |
-
reg_type = /(\.js|\.css)/gmi,
|
105 |
-
callback_function = callback || function() {};
|
106 |
-
|
107 |
-
if( !$.isArray( url ) ){
|
108 |
-
url = [ url ];
|
109 |
-
}
|
110 |
-
|
111 |
-
for( var index in url ){
|
112 |
-
var file_url = url[ index ],
|
113 |
-
file_name = file_url.replace( reg_name, '' ),
|
114 |
-
file_type = file_url.match( reg_type )[ 0 ];
|
115 |
-
|
116 |
-
if( '.js' === file_type && -1 === $.inArray( file_name, CherryJsCore.variable.loaded_assets.script ) ){
|
117 |
-
data.script.push( file_url );
|
118 |
-
CherryJsCore.variable.loaded_assets.script.push( file_name );
|
119 |
-
}
|
120 |
-
|
121 |
-
if( '.css' === file_type && -1 === $.inArray( file_name, CherryJsCore.variable.loaded_assets.style ) ){
|
122 |
-
data.style.push( file_url );
|
123 |
-
CherryJsCore.variable.loaded_assets.style.push( file_name );
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
$.get( window.ajaxurl, data, function( response ) {
|
128 |
-
var json = $.parseJSON(response),
|
129 |
-
compressStyle = json.style,
|
130 |
-
compressScript = json.script,
|
131 |
-
script = null;
|
132 |
-
|
133 |
-
if(compressStyle){
|
134 |
-
var style = document.createElement('style');
|
135 |
-
|
136 |
-
style.type = 'text/css';
|
137 |
-
style.media = 'all';
|
138 |
-
style.innerHTML = compressStyle;
|
139 |
-
|
140 |
-
$('body', document).append(style);
|
141 |
-
|
142 |
-
}
|
143 |
-
|
144 |
-
if ( compressScript ) {
|
145 |
-
script = new Function( compressScript ) ();
|
146 |
-
}
|
147 |
-
|
148 |
-
return callback_function();
|
149 |
-
});
|
150 |
}
|
151 |
}
|
152 |
};
|
70 |
expressions: {
|
71 |
widget_ui_init: function() {
|
72 |
$( document ).on( 'widget-added widget-updated', function( event, data ) {
|
73 |
+
$( 'body' ).trigger( {
|
74 |
type: 'cherry-ui-elements-init',
|
75 |
_target: data
|
76 |
} );
|
92 |
parent = parent[ parts[ i ] ];
|
93 |
}
|
94 |
return parent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
}
|
97 |
};
|
cherry-framework/modules/cherry-js-core/assets/js/min/cherry-js-core.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var CherryJsCore={};!function(
|
1 |
+
var CherryJsCore={};!function(r){"use strict";CherryJsCore={name:"Cherry Js Core",version:"1.0.0",author:"Cherry Team",variable:{$document:r(document),$window:r(window),browser:r.browser,browser_supported:!0,security:window.cherry_ajax,loaded_assets:{script:window.wp_load_script,style:window.wp_load_style},ui_auto_init:"true"===window.ui_init_object.auto_init?!0:!1,ui_auto_target:window.ui_init_object.targets},status:{on_load:!1,is_ready:!1},init:function(){CherryJsCore.set_variable(),r(document).on("ready",CherryJsCore.ready),r(window).on("load",CherryJsCore.load)},set_variable:function(){CherryJsCore.variable.browser_supported=function(){var r=CherryJsCore.variable.browser,e={msie:[8]};for(var i in e)if("undefined"!==r.browser)for(var o in e[i])if(r.version<=e[i][o])return!1;return!0}()},ready:function(){CherryJsCore.status.is_ready=!0,CherryJsCore.expressions.widget_ui_init()},load:function(){CherryJsCore.status.on_load=!0},expressions:{widget_ui_init:function(){r(document).on("widget-added widget-updated",function(e,i){r("body").trigger({type:"cherry-ui-elements-init",_target:i})})}},utilites:{namespace:function(r){var e=r.split("."),i=CherryJsCore,o=e.length,t=0;for(t=0;o>t;t+=1)"undefined"==typeof i[e[t]]&&(i[e[t]]={}),i=i[e[t]];return i}}},CherryJsCore.init()}(jQuery);
|
cherry-framework/modules/cherry-page-builder/assets/css/min/page-settings.min.css
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
.cherry-settings-page .description:after { content: ' '; clear: both; height: 10px; width: 100%; }
|
2 |
-
|
3 |
-
.notice-box { background: #222222; position: fixed; margin: 5px 0; border-left: 5px solid #2a445d; box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3); box-sizing: border-box; padding: 15px 20px 15px 15px; min-width: 200px; overflow: hidden; z-index: 999; -webkit-transition: all 250ms cubic-bezier(0.85, 0.04, 1, 1); transition: all 250ms cubic-bezier(0.85, 0.04, 1, 1); }
|
4 |
-
.notice-box span.dashicons { position: relative; margin-right: 20px; }
|
5 |
-
.notice-box span.dashicons:before { position: absolute; font-size: 40px; left: -10px; top: -10px; }
|
6 |
-
.notice-box.success-notice { border-color: #8bc735; }
|
7 |
-
.notice-box.success-notice span.dashicons { color: #8bc735; }
|
8 |
-
.notice-box.success-notice span.dashicons:before { content: "\f147"; }
|
9 |
-
.notice-box.success-notice .inner b { color: #8bc735; }
|
10 |
-
.notice-box.info-notice { border-color: #ffcc00; }
|
11 |
-
.notice-box.info-notice span.dashicons { color: #ffcc00; }
|
12 |
-
.notice-box.info-notice span.dashicons:before { content: "\f348"; }
|
13 |
-
.notice-box.info-notice .inner b { color: #ffcc00; }
|
14 |
-
.notice-box.error-notice { border-color: #f62e46; }
|
15 |
-
.notice-box.error-notice span.dashicons { color: #f62e46; }
|
16 |
-
.notice-box.error-notice span.dashicons:before { content: "\f158"; }
|
17 |
-
.notice-box.show-state { -webkit-transition: all 500ms cubic-bezier(0.1, 0.67, 0.26, 1); transition: all 500ms cubic-bezier(0.1, 0.67, 0.26, 1); }
|
18 |
-
.notice-box .inner { display: inline-block; color: #fff; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-page-builder/assets/js/min/page-settings.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(e){"use strict";window.CherryJsCore.utilites.namespace("page_builder"),window.CherryJsCore.page_builder={init:function(){var e=this;e.tabs(".cherry-settings-tabs").saveEvent(".cherry-settings-tabs form")},tabs:function(e){return jQuery(e+" .tabs-section a").each(function(t){var s=jQuery(this),i=s.attr("href");t?jQuery(e+" .section"+i).hide():s.addClass("nav-tab-active")}),jQuery(e+" .tabs-section a").on("click",function(t){var s=jQuery(this),i=s.attr("href");jQuery(e+" .section").hide(),jQuery(e+" .section"+i).show(),jQuery(e+" .tabs-section a").removeClass("nav-tab-active"),s.addClass("nav-tab-active"),t.preventDefault()}),this},saveEvent:function(e){var t=this;return jQuery(e).submit(function(e){var s=jQuery(this);s.ajaxSubmit({success:function(){t.noticeCreate("success",window.TMRealEstateMessage.success)},error:function(){t.noticeCreate("failed",window.TMRealEstateMessage.failed)},timeout:5e3}),e.preventDefault()}),this},noticeCreate:function(t,s){function i(){var t=100;e(".notice-box").each(function(){e(this).css({top:t}),t+=e(this).outerHeight(!0)})}var a,n=e('<div class="notice-box '+t+'-notice"><span class="dashicons"></span><div class="inner">'+s+"</div></div>"),r=0;return jQuery("body").prepend(n),i(),r=-1*(n.outerWidth(!0)+10),n.css({right:r}),a=setTimeout(function(){n.css({right:10}).addClass("show-state")},100),a=setTimeout(function(){r=-1*(n.outerWidth(!0)+10),n.css({right:r}).removeClass("show-state")},4e3),a=setTimeout(function(){n.remove(),clearTimeout(a)},4500),this}},window.CherryJsCore.page_builder.init()}(jQuery);
|
|
cherry-framework/modules/cherry-page-builder/assets/js/page-settings.js
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Page settings
|
3 |
-
*/
|
4 |
-
(function( $ ) {
|
5 |
-
'use strict';
|
6 |
-
|
7 |
-
window.CherryJsCore.utilites.namespace( 'page_builder' );
|
8 |
-
window.CherryJsCore.page_builder = {
|
9 |
-
|
10 |
-
init: function() {
|
11 |
-
var self = this;
|
12 |
-
self.tabs( '.cherry-settings-tabs' ).saveEvent( '.cherry-settings-tabs form' );
|
13 |
-
},
|
14 |
-
|
15 |
-
tabs: function( selectors ) {
|
16 |
-
jQuery( selectors + ' .tabs-section a' ).each( function( index ) {
|
17 |
-
var $this = jQuery( this );
|
18 |
-
var id = $this.attr( 'href' );
|
19 |
-
if ( ! index ) {
|
20 |
-
$this.addClass( 'nav-tab-active' );
|
21 |
-
} else {
|
22 |
-
jQuery( selectors + ' .section' + id ).hide();
|
23 |
-
}
|
24 |
-
});
|
25 |
-
jQuery( selectors + ' .tabs-section a' ).on( 'click', function( e ) {
|
26 |
-
var $this = jQuery( this );
|
27 |
-
var id = $this.attr( 'href' );
|
28 |
-
jQuery( selectors + ' .section' ).hide();
|
29 |
-
jQuery( selectors + ' .section' + id ).show();
|
30 |
-
jQuery( selectors + ' .tabs-section a' ).removeClass( 'nav-tab-active' );
|
31 |
-
$this.addClass( 'nav-tab-active' );
|
32 |
-
e.preventDefault();
|
33 |
-
});
|
34 |
-
return this;
|
35 |
-
},
|
36 |
-
|
37 |
-
saveEvent: function( selectors ) {
|
38 |
-
var self = this;
|
39 |
-
jQuery( selectors ).submit( function( e ) {
|
40 |
-
var $this = jQuery( this );
|
41 |
-
$this.ajaxSubmit({
|
42 |
-
success: function() {
|
43 |
-
self.noticeCreate( 'success', window.TMRealEstateMessage.success );
|
44 |
-
},
|
45 |
-
error: function() {
|
46 |
-
self.noticeCreate( 'failed', window.TMRealEstateMessage.failed );
|
47 |
-
},
|
48 |
-
timeout: 5000
|
49 |
-
});
|
50 |
-
|
51 |
-
e.preventDefault();
|
52 |
-
});
|
53 |
-
return this;
|
54 |
-
},
|
55 |
-
|
56 |
-
noticeCreate: function( type, message ) {
|
57 |
-
var
|
58 |
-
notice = $( '<div class="notice-box ' + type + '-notice"><span class="dashicons"></span><div class="inner">' + message + '</div></div>' ),
|
59 |
-
rightDelta = 0,
|
60 |
-
timeoutId;
|
61 |
-
|
62 |
-
jQuery( 'body' ).prepend( notice );
|
63 |
-
reposition();
|
64 |
-
rightDelta = -1 * ( notice.outerWidth( true ) + 10 );
|
65 |
-
notice.css( { 'right': rightDelta } );
|
66 |
-
|
67 |
-
timeoutId = setTimeout( function() {
|
68 |
-
notice.css( { 'right': 10 } ).addClass( 'show-state' );
|
69 |
-
}, 100 );
|
70 |
-
timeoutId = setTimeout( function() {
|
71 |
-
rightDelta = -1 * ( notice.outerWidth( true ) + 10 );
|
72 |
-
notice.css( { right: rightDelta } ).removeClass( 'show-state' );
|
73 |
-
}, 4000 );
|
74 |
-
timeoutId = setTimeout( function() {
|
75 |
-
notice.remove();
|
76 |
-
clearTimeout( timeoutId );
|
77 |
-
}, 4500 );
|
78 |
-
|
79 |
-
function reposition() {
|
80 |
-
var
|
81 |
-
topDelta = 100;
|
82 |
-
$( '.notice-box' ).each(function() {
|
83 |
-
$( this ).css( { top: topDelta } );
|
84 |
-
topDelta += $( this ).outerHeight( true );
|
85 |
-
});
|
86 |
-
}
|
87 |
-
return this;
|
88 |
-
}
|
89 |
-
};
|
90 |
-
|
91 |
-
window.CherryJsCore.page_builder.init();
|
92 |
-
}( jQuery ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-page-builder/assets/scss/page-setting.scss
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
.cherry-settings-page {
|
2 |
-
.description {
|
3 |
-
&:after {
|
4 |
-
content: ' ';
|
5 |
-
clear: both;
|
6 |
-
height: 10px;
|
7 |
-
width: 100%;
|
8 |
-
}
|
9 |
-
}
|
10 |
-
}
|
11 |
-
|
12 |
-
.notice-box{
|
13 |
-
background: #222222;
|
14 |
-
position: fixed;
|
15 |
-
margin: 5px 0;
|
16 |
-
border-left: 5px solid #2a445d;
|
17 |
-
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
|
18 |
-
box-sizing: border-box;
|
19 |
-
padding: 15px 20px 15px 15px;
|
20 |
-
min-width: 200px;
|
21 |
-
overflow: hidden;
|
22 |
-
z-index: 999;
|
23 |
-
-webkit-transition: all 250ms cubic-bezier(0.85, 0.04, 1, 1);
|
24 |
-
transition: all 250ms cubic-bezier(0.85, 0.04, 1, 1);
|
25 |
-
span.dashicons{
|
26 |
-
position: relative;
|
27 |
-
margin-right: 20px;
|
28 |
-
&:before{
|
29 |
-
position: absolute;
|
30 |
-
font-size: 40px;
|
31 |
-
left: -10px;
|
32 |
-
top: -10px;
|
33 |
-
}
|
34 |
-
}
|
35 |
-
&.success-notice{
|
36 |
-
border-color: #8bc735;
|
37 |
-
span.dashicons{
|
38 |
-
color: #8bc735;
|
39 |
-
&:before{
|
40 |
-
content: "\f147";
|
41 |
-
}
|
42 |
-
}
|
43 |
-
.inner{
|
44 |
-
b{
|
45 |
-
color: #8bc735;
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
&.info-notice{
|
50 |
-
border-color: #ffcc00;
|
51 |
-
span.dashicons{
|
52 |
-
color: #ffcc00;
|
53 |
-
&:before{
|
54 |
-
content: "\f348";
|
55 |
-
}
|
56 |
-
}
|
57 |
-
.inner{
|
58 |
-
b{
|
59 |
-
color: #ffcc00;
|
60 |
-
}
|
61 |
-
}
|
62 |
-
}
|
63 |
-
&.error-notice{
|
64 |
-
border-color: #f62e46;
|
65 |
-
span.dashicons{
|
66 |
-
color: #f62e46;
|
67 |
-
&:before{
|
68 |
-
content: "\f158";
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
&.show-state{
|
73 |
-
-webkit-transition: all 500ms cubic-bezier(0.1, 0.67, 0.26, 1);
|
74 |
-
transition: all 500ms cubic-bezier(0.1, 0.67, 0.26, 1);
|
75 |
-
}
|
76 |
-
.inner{
|
77 |
-
display: inline-block;
|
78 |
-
color: #fff;
|
79 |
-
}
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-page-builder/cherry-page-builder.php
DELETED
@@ -1,406 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Module Name: Page Builder
|
4 |
-
* Description: Provides functionality for building custom options pages
|
5 |
-
* Version: 1.1.0
|
6 |
-
* Author: Cherry Team
|
7 |
-
* Author URI: http://www.cherryframework.com/
|
8 |
-
* License: GPLv3
|
9 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
-
*
|
11 |
-
* @package Cherry_Framework
|
12 |
-
* @subpackage Modules
|
13 |
-
* @version 1.1.0
|
14 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
-
* @link http://www.cherryframework.com/
|
17 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
-
*/
|
19 |
-
|
20 |
-
// If this file is called directly, abort.
|
21 |
-
if ( ! defined( 'WPINC' ) ) {
|
22 |
-
die;
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( ! class_exists( 'Cherry_Page_Builder' ) ) {
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Create options page
|
29 |
-
*/
|
30 |
-
class Cherry_Page_Builder {
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Module version
|
34 |
-
*
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $module_version = '1.1.0';
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Module slug
|
41 |
-
*
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
public $module_slug = 'cherry-page-builder';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Module arguments
|
48 |
-
*
|
49 |
-
* @var array
|
50 |
-
*/
|
51 |
-
public $args = array();
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Page data
|
55 |
-
*
|
56 |
-
* @var array
|
57 |
-
*/
|
58 |
-
public $data = array();
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Core instance
|
62 |
-
*
|
63 |
-
* @var object
|
64 |
-
*/
|
65 |
-
public $core = null;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Current nonce name to check
|
69 |
-
*
|
70 |
-
* @var string
|
71 |
-
*/
|
72 |
-
public $nonce = 'cherry-admin-menu-nonce';
|
73 |
-
|
74 |
-
/**
|
75 |
-
* The page properties.
|
76 |
-
*
|
77 |
-
* @var DataContainer
|
78 |
-
*/
|
79 |
-
public $views;
|
80 |
-
|
81 |
-
/**
|
82 |
-
* The page sections.
|
83 |
-
*
|
84 |
-
* @var array
|
85 |
-
*/
|
86 |
-
protected $sections;
|
87 |
-
|
88 |
-
/**
|
89 |
-
* The page settings.
|
90 |
-
*
|
91 |
-
* @var array
|
92 |
-
*/
|
93 |
-
protected $settings;
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Constructor for the module
|
97 |
-
*/
|
98 |
-
function __construct( $core, $args = array() ) {
|
99 |
-
|
100 |
-
$this->core = $core;
|
101 |
-
$this->args = wp_parse_args(
|
102 |
-
$args,
|
103 |
-
array(
|
104 |
-
'capability' => 'manage_options',
|
105 |
-
'position' => 20,
|
106 |
-
'icon' => 'dashicons-admin-site',
|
107 |
-
'sections' => array(),
|
108 |
-
'settings' => array(),
|
109 |
-
'before' => '',
|
110 |
-
'after' => '',
|
111 |
-
'before_button' => '',
|
112 |
-
'after_button' => '',
|
113 |
-
)
|
114 |
-
);
|
115 |
-
|
116 |
-
$this->views = __DIR__ . '/views/';
|
117 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Add admin menu page
|
122 |
-
*/
|
123 |
-
function add_admin_page() {
|
124 |
-
$page = $this->make( $this->args['slug'], $this->args['title'], $this->args['parent'], $this->args['views'] )->set(
|
125 |
-
array(
|
126 |
-
'capability' => $this->args['capability'],
|
127 |
-
'icon' => $this->args['icon'],
|
128 |
-
'position' => $this->args['position'],
|
129 |
-
'tabs' => $this->args['tabs'],
|
130 |
-
'sections' => $this->args['sections'],
|
131 |
-
'settings' => $this->args['settings'],
|
132 |
-
)
|
133 |
-
);
|
134 |
-
$page->add_sections( $this->args['sections'] );
|
135 |
-
$page->add_settings( $this->args['settings'] );
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Set base data of page
|
140 |
-
*
|
141 |
-
* @param type string $slug The page slug name.
|
142 |
-
* @param type string $title The page display title.
|
143 |
-
* @param type string $parent The parent's page slug if a subpage.
|
144 |
-
*
|
145 |
-
* @return object
|
146 |
-
*/
|
147 |
-
public function make( $slug, $title, $parent = null ) {
|
148 |
-
$page = new Cherry_Page_Builder( $this->core, $this->args );
|
149 |
-
|
150 |
-
// Set the page properties.
|
151 |
-
$page->data['slug'] = $slug;
|
152 |
-
$page->data['title'] = $title;
|
153 |
-
$page->data['parent'] = $parent;
|
154 |
-
$page->data['args'] = array(
|
155 |
-
'capability' => 'manage_options',
|
156 |
-
'icon' => '',
|
157 |
-
'position' => null,
|
158 |
-
'tabs' => true,
|
159 |
-
'menu' => $title,
|
160 |
-
);
|
161 |
-
$page->data['rules'] = array();
|
162 |
-
|
163 |
-
return $page;
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Set the custom page. Allow user to override
|
168 |
-
* the default page properties and add its own
|
169 |
-
* properties.
|
170 |
-
*
|
171 |
-
* @param array $params Base parameter.
|
172 |
-
* @return object
|
173 |
-
*/
|
174 |
-
public function set( array $params = array() ) {
|
175 |
-
$this->args = $params;
|
176 |
-
|
177 |
-
$this->add_sections( $params['sections'] );
|
178 |
-
$this->add_settings( $params['settings'] );
|
179 |
-
|
180 |
-
add_action( 'admin_menu', array( $this, 'build' ) );
|
181 |
-
|
182 |
-
return $this;
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Triggered by the 'admin_menu' action event.
|
187 |
-
* Register/display the custom page in the WordPress admin.
|
188 |
-
*
|
189 |
-
* @return void
|
190 |
-
*/
|
191 |
-
public function build() {
|
192 |
-
if ( ! is_null( $this->data['parent'] ) ) {
|
193 |
-
add_submenu_page( $this->data['parent'], $this->data['title'], $this->data['args']['menu'], $this->data['args']['capability'], $this->data['slug'], array( $this, 'render' ) );
|
194 |
-
} else {
|
195 |
-
add_menu_page( $this->data['title'], $this->data['args']['menu'], $this->data['args']['capability'], $this->data['slug'], array( $this, 'render' ), $this->data['args']['icon'], $this->args['position'] );
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Triggered by the 'add_menu_page' or 'add_submenu_page'.
|
201 |
-
*
|
202 |
-
* @return void
|
203 |
-
*/
|
204 |
-
public function render() {
|
205 |
-
$title = ! empty( $this->data['title'] ) ? $this->data['title'] : '';
|
206 |
-
$page_slug = ! empty( $this->data['slug'] ) ? $this->data['slug'] : '';
|
207 |
-
$page_before = ! empty( $this->args['before'] ) ? $this->args['before'] : '';
|
208 |
-
$page_after = ! empty( $this->args['after'] ) ? $this->args['after'] : '';
|
209 |
-
$button_before = ! empty( $this->args['button_before'] ) ? $this->args['button_before'] : '';
|
210 |
-
$button_after = ! empty( $this->args['button_after'] ) ? $this->args['button_after'] : '';
|
211 |
-
$sections = ( ! empty( $this->sections ) && is_array( $this->sections ) ) ? $this->sections : array();
|
212 |
-
|
213 |
-
$html = Cherry_Toolkit::render_view(
|
214 |
-
$this->views . 'page.php',
|
215 |
-
array(
|
216 |
-
'title' => $title,
|
217 |
-
'page_slug' => $page_slug,
|
218 |
-
'page_before' => $page_before,
|
219 |
-
'page_after' => $page_after,
|
220 |
-
'button_before' => $button_before,
|
221 |
-
'button_after' => $button_after,
|
222 |
-
'sections' => $sections,
|
223 |
-
)
|
224 |
-
);
|
225 |
-
|
226 |
-
echo $html;
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Add custom sections for your settings.
|
231 |
-
*
|
232 |
-
* @param array $sections List of sections.
|
233 |
-
* @return void
|
234 |
-
*/
|
235 |
-
public function add_sections( array $sections = array() ) {
|
236 |
-
$this->sections = $sections;
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Check if the page has sections.
|
241 |
-
*
|
242 |
-
* @return bool
|
243 |
-
*/
|
244 |
-
public function has_sections() {
|
245 |
-
return count( $this->sections ) ? true : false;
|
246 |
-
}
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Check if the page has settings.
|
250 |
-
*
|
251 |
-
* @return bool
|
252 |
-
*/
|
253 |
-
public function has_settings() {
|
254 |
-
return count( $this->settings ) ? true : false;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Add settings to the page. Define settings per section
|
259 |
-
* by setting the 'key' name equal to a registered section and
|
260 |
-
* pass it an array of 'settings' fields.
|
261 |
-
*
|
262 |
-
* @param array $settings The page settings.
|
263 |
-
* @return object
|
264 |
-
*/
|
265 |
-
public function add_settings( array $settings = array() ) {
|
266 |
-
$this->settings = $settings;
|
267 |
-
|
268 |
-
add_action( 'admin_init', array( $this, 'install_settings' ) );
|
269 |
-
|
270 |
-
return $this;
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Triggered by the 'admin_init' action.
|
275 |
-
* Perform the WordPress settings API.
|
276 |
-
*
|
277 |
-
* @return void
|
278 |
-
*/
|
279 |
-
public function install_settings() {
|
280 |
-
if ( $this->has_sections() ) {
|
281 |
-
foreach ( $this->sections as $section ) {
|
282 |
-
if ( false === get_option( $section['slug'] ) ) {
|
283 |
-
add_option( $section['slug'] );
|
284 |
-
}
|
285 |
-
add_settings_section( $section['slug'], $section['name'], array( $this, 'display_sections' ), $section['slug'] );
|
286 |
-
}
|
287 |
-
}
|
288 |
-
|
289 |
-
if ( $this->has_settings() ) {
|
290 |
-
foreach ( $this->settings as $section => $settings ) {
|
291 |
-
foreach ( $settings as &$setting ) {
|
292 |
-
$setting['section'] = $section;
|
293 |
-
add_settings_field( $setting['slug'], $setting['title'], array( $this, 'display_settings' ), $section, $section, $setting );
|
294 |
-
}
|
295 |
-
register_setting( $section, $section );
|
296 |
-
}
|
297 |
-
}
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Clear sections
|
302 |
-
*/
|
303 |
-
public function clear_sections() {
|
304 |
-
if ( $this->has_sections() ) {
|
305 |
-
foreach ( $this->sections as $section ) {
|
306 |
-
delete_option( $section['slug'] );
|
307 |
-
}
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Handle section display of the Settings API.
|
313 |
-
*
|
314 |
-
* @param array $args Page parameter.
|
315 |
-
* @return void
|
316 |
-
*/
|
317 |
-
public function display_sections( array $args ) {
|
318 |
-
$description = '';
|
319 |
-
if ( ! empty( $this->sections[ $args['id'] ] ) ) {
|
320 |
-
if ( ! empty( $this->sections[ $args['id'] ]['description'] ) ) {
|
321 |
-
$description = $this->sections[ $args['id'] ]['description'];
|
322 |
-
}
|
323 |
-
}
|
324 |
-
|
325 |
-
$html = Cherry_Toolkit::render_view(
|
326 |
-
$this->views . 'section.php',
|
327 |
-
array(
|
328 |
-
'description' => $description,
|
329 |
-
)
|
330 |
-
);
|
331 |
-
echo $html;
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Handle setting display of the Settings API.
|
336 |
-
*
|
337 |
-
* @param array $setting Fields setting.
|
338 |
-
* @return void
|
339 |
-
*/
|
340 |
-
public function display_settings( $setting ) {
|
341 |
-
|
342 |
-
// Check if a registered value exists.
|
343 |
-
$value = get_option( $setting['section'] );
|
344 |
-
|
345 |
-
if ( isset( $value[ $setting['slug'] ] ) ) {
|
346 |
-
$setting['field']['value'] = $value[ $setting['slug'] ];
|
347 |
-
} else {
|
348 |
-
$setting['field']['value'] = '';
|
349 |
-
}
|
350 |
-
|
351 |
-
// Set the name attribute.
|
352 |
-
$setting['field']['name'] = $setting['section'] . '[' . $setting['slug'] . ']';
|
353 |
-
|
354 |
-
if ( isset( $setting['custom_callback'] ) && is_callable( $setting['custom_callback'] ) ) {
|
355 |
-
echo call_user_func( $setting['custom_callback'], $setting['field'] );
|
356 |
-
|
357 |
-
} else if ( class_exists( 'UI_' . ucfirst( $setting['type'] ) ) ) {
|
358 |
-
$ui_class = 'UI_' . ucfirst( $setting['type'] );
|
359 |
-
$ui_element = new $ui_class( $setting['field'] );
|
360 |
-
|
361 |
-
// Display the field.
|
362 |
-
echo $ui_element->render();
|
363 |
-
}
|
364 |
-
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* Add styles and scripts
|
368 |
-
*
|
369 |
-
* @return void
|
370 |
-
*/
|
371 |
-
public function assets() {
|
372 |
-
wp_enqueue_script( 'jquery-form' );
|
373 |
-
|
374 |
-
wp_localize_script( 'cherry-settings-page', 'TMRealEstateMessage', array(
|
375 |
-
'success' => 'Successfully',
|
376 |
-
'failed' => 'Failed',
|
377 |
-
) );
|
378 |
-
|
379 |
-
wp_enqueue_script(
|
380 |
-
'cherry-settings-page',
|
381 |
-
Cherry_Core::base_url( 'assets/js/min/page-settings.min.js', __FILE__ ),
|
382 |
-
array( 'jquery' ),
|
383 |
-
'0.2.0',
|
384 |
-
true
|
385 |
-
);
|
386 |
-
|
387 |
-
wp_enqueue_style(
|
388 |
-
'cherry-settings-page',
|
389 |
-
Cherry_Core::base_url( 'assets/css/min/page-settings.min.css', __FILE__ ),
|
390 |
-
array(),
|
391 |
-
'0.1.0',
|
392 |
-
'all'
|
393 |
-
);
|
394 |
-
}
|
395 |
-
|
396 |
-
/**
|
397 |
-
* Returns the instance.
|
398 |
-
*
|
399 |
-
* @since 1.0.0
|
400 |
-
* @return object
|
401 |
-
*/
|
402 |
-
public static function get_instance( $core, $args ) {
|
403 |
-
return new self( $core, $args );
|
404 |
-
}
|
405 |
-
}
|
406 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-page-builder/views/page.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* View for options page
|
4 |
-
*
|
5 |
-
* @package TM Real Estate
|
6 |
-
* @author Guriev Eugen & Sergyj Osadchij
|
7 |
-
* @license GPL-2.0+
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="wrap cherry-settings-page">
|
11 |
-
<h2><?php echo $__data['title'] ?></h2>
|
12 |
-
<?php if ( ! empty( $__data['page_before'] ) ) : ?>
|
13 |
-
<div class="description"><?php echo $__data['page_before'] ?></div>
|
14 |
-
<?php endif; ?>
|
15 |
-
<?php if ( ! empty( $__data['sections'] ) && is_array( $__data['sections'] ) ) : ?>
|
16 |
-
<div class="cherry-settings-tabs">
|
17 |
-
<h2 class="nav-tab-wrapper tabs-section">
|
18 |
-
<?php foreach ( $__data['sections'] as $section_slug => $section ) : ?>
|
19 |
-
<a href="#<?php echo $section_slug ?>" class="nav-tab"><?php echo $section['name'] ?></a>
|
20 |
-
<?php endforeach; ?>
|
21 |
-
</h2>
|
22 |
-
|
23 |
-
<?php foreach ( $__data['sections'] as $section_slug => $section ) : ?>
|
24 |
-
<div id="<?php echo $section_slug ?>" class="section">
|
25 |
-
<form method="POST" action="options.php" id="form-<?php echo $section_slug ?>">
|
26 |
-
<?php settings_fields( $section_slug ); ?>
|
27 |
-
<?php do_settings_sections( $section_slug ); ?>
|
28 |
-
|
29 |
-
<?php if ( ! empty( $__data['button_before'] ) ) : ?>
|
30 |
-
<?php echo $__data['button_before'] ?>
|
31 |
-
<?php endif; ?>
|
32 |
-
|
33 |
-
<?php submit_button( 'Save ' . $section['name'], 'primary small', null, true, array( 'data-ajax' => true ) ); ?>
|
34 |
-
|
35 |
-
<?php if ( ! empty( $__data['button_after'] ) ) : ?>
|
36 |
-
<?php echo $__data['button_after'] ?>
|
37 |
-
<?php endif; ?>
|
38 |
-
</form>
|
39 |
-
</div>
|
40 |
-
<?php endforeach; ?>
|
41 |
-
</div>
|
42 |
-
<?php endif; ?>
|
43 |
-
<?php if ( ! empty( $__data['page_after'] ) ) : ?>
|
44 |
-
<div class="description"><?php echo $__data['page_after'] ?></div>
|
45 |
-
<?php endif; ?>
|
46 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-page-builder/views/section.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* View for section of settings
|
4 |
-
*
|
5 |
-
* @package TM Real Estate
|
6 |
-
* @author Guriev Eugen & Sergyj Osadchij
|
7 |
-
* @license GPL-2.0+
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="description"><?php echo $__data['description'] ?></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-plugin-updater/cherry-plugin-updater.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* Module Name: Plugin Updater
|
5 |
-
* Description: Provides functionality for updating plugins
|
6 |
-
* Version: 1.1.0
|
7 |
-
* Author: Cherry Team
|
8 |
-
* Author URI: http://www.cherryframework.com/
|
9 |
-
* License: GPLv3
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
-
*
|
12 |
-
* @package Cherry_Framework
|
13 |
-
* @subpackage Modules
|
14 |
-
* @version 1.1.0
|
15 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
16 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
17 |
-
* @link http://www.cherryframework.com/
|
18 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
19 |
-
*/
|
20 |
-
|
21 |
-
// If this file is called directly, abort.
|
22 |
-
if ( ! defined( 'WPINC' ) ) {
|
23 |
-
die;
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( ! class_exists( 'Cherry_Plugin_Updater' ) ) {
|
27 |
-
require_once( '/inc/cherry-base-updater.php' );
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Define plugin updater class.
|
31 |
-
*
|
32 |
-
* @since 1.0.0
|
33 |
-
*/
|
34 |
-
class Cherry_Plugin_Updater extends Cherry_Base_Updater {
|
35 |
-
/**
|
36 |
-
* Updater settings.
|
37 |
-
*
|
38 |
-
* @var array
|
39 |
-
*/
|
40 |
-
protected $settings = array();
|
41 |
-
|
42 |
-
/**
|
43 |
-
* A reference to an instance of this class.
|
44 |
-
*
|
45 |
-
* @since 1.0.0
|
46 |
-
* @var object
|
47 |
-
*/
|
48 |
-
private static $instance = null;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Init class parameters.
|
52 |
-
*
|
53 |
-
* @since 1.0.0
|
54 |
-
* @param object $core Core of framework.
|
55 |
-
* @param array $args Argument of base init.
|
56 |
-
* @return void
|
57 |
-
*/
|
58 |
-
public function __construct( $core, $args = array() ) {
|
59 |
-
$this->base_init( $args );
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Need for test update - set_site_transient( 'update_plugins', null );
|
63 |
-
*/
|
64 |
-
add_action( 'pre_set_site_transient_update_plugins', array( $this, 'update' ) );
|
65 |
-
add_filter( 'upgrader_source_selection', array( $this, 'rename_github_folder' ), 11, 3 );
|
66 |
-
add_action( 'admin_footer', array( $this, 'change_details_url' ) );
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Process update.
|
71 |
-
*
|
72 |
-
* @since 1.0.0
|
73 |
-
* @param object $data Update data.
|
74 |
-
* @return object
|
75 |
-
*/
|
76 |
-
public function update( $data ) {
|
77 |
-
$new_update = $this->check_update();
|
78 |
-
|
79 |
-
if ( $new_update['version'] ) {
|
80 |
-
$this->settings['plugin'] = $this->settings['slug'] . '/' . $this->settings['slug'] . '.php';
|
81 |
-
|
82 |
-
$update = new stdClass();
|
83 |
-
|
84 |
-
$update->slug = $this->settings['slug'];
|
85 |
-
$update->plugin = $this->settings['plugin'];
|
86 |
-
$update->new_version = $new_update['version'];
|
87 |
-
$update->url = $this->settings['details_url'];
|
88 |
-
$update->package = $new_update['package'];
|
89 |
-
|
90 |
-
$data->response[ $this->settings['plugin'] ] = $update;
|
91 |
-
|
92 |
-
}
|
93 |
-
|
94 |
-
return $data;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Change plugin detail URL.
|
99 |
-
*
|
100 |
-
* @since 1.0.0
|
101 |
-
* @return void
|
102 |
-
*/
|
103 |
-
public function change_details_url() {
|
104 |
-
global $change_details_plugin_url_script, $pagenow;
|
105 |
-
|
106 |
-
$plugins = get_plugin_updates();
|
107 |
-
|
108 |
-
if ( ! $change_details_plugin_url_script && in_array( $pagenow, array( 'update-core.php', 'plugins.php' ) ) && ! empty( $plugins ) ) {
|
109 |
-
|
110 |
-
$plugins_string = '';
|
111 |
-
|
112 |
-
foreach ( $plugins as $plugin_key => $plugin_value ) {
|
113 |
-
$plugin_key = strtolower( $plugin_key );
|
114 |
-
if ( strpos( $plugin_key, 'cherry' ) !== false ) {
|
115 |
-
$plugins_string .= '"' . $plugin_value ->update ->slug . '" : "' . $plugin_value ->update ->url .'", ';
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
?>
|
120 |
-
<script>
|
121 |
-
( function( $ ){
|
122 |
-
var plugin_updates = {<?php echo $plugins_string; ?>};
|
123 |
-
for ( var plugin in plugin_updates ) {
|
124 |
-
$('[href*="' + plugin + '"].thickbox').removeClass('thickbox').attr( {'href': plugin_updates[plugin], 'target' : "_blank" } );
|
125 |
-
};
|
126 |
-
}( jQuery ) )
|
127 |
-
</script>
|
128 |
-
<?php
|
129 |
-
}
|
130 |
-
|
131 |
-
$change_details_plugin_url_script = true;
|
132 |
-
}
|
133 |
-
/**
|
134 |
-
* Returns the instance.
|
135 |
-
*
|
136 |
-
* @since 1.0.0
|
137 |
-
* @return object
|
138 |
-
*/
|
139 |
-
public static function get_instance( $core, $args ) {
|
140 |
-
return new self( $core, $args );
|
141 |
-
}
|
142 |
-
}
|
143 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-plugin-updater/inc/cherry-base-updater.php
DELETED
@@ -1,156 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class for the base update.
|
4 |
-
*
|
5 |
-
* @package Cherry_Base_Updater
|
6 |
-
* @subpackage Base_Update
|
7 |
-
* @author Cherry Team <support@cherryframework.com>
|
8 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
-
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
|
13 |
-
// If this file is called directly, abort.
|
14 |
-
if ( ! defined( 'WPINC' ) ) {
|
15 |
-
die;
|
16 |
-
}
|
17 |
-
|
18 |
-
if ( ! class_exists( 'Cherry_Base_Updater' ) ) {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Test definitions to allow alpha and beta updates
|
22 |
-
*
|
23 |
-
* Disable updates - define('CHERRY_UPDATE', false);
|
24 |
-
* Enable auto updates - define('CHERRY_ALPHA_UPDATE', true);
|
25 |
-
* Enable beta updates - define('CHERRY_BETA_UPDATE', true);
|
26 |
-
*/
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Base updater class.
|
30 |
-
*
|
31 |
-
* @since 4.0.0
|
32 |
-
*/
|
33 |
-
class Cherry_Base_Updater {
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Default Settings.
|
37 |
-
*
|
38 |
-
* @since 4.0.0
|
39 |
-
* @access protected
|
40 |
-
* @var array
|
41 |
-
*/
|
42 |
-
protected $default_settings = array(
|
43 |
-
'version' => '',
|
44 |
-
'slug' => '',
|
45 |
-
'cloud_url' => 'https://cloud.cherryframework.com/cherry-update/',
|
46 |
-
'product_name' => 'CherryFramework',
|
47 |
-
'repository_name' => '',
|
48 |
-
);
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Init class parameters.
|
52 |
-
*
|
53 |
-
* @since 4.0.0
|
54 |
-
* @param array $settings Settings array.
|
55 |
-
* @return void
|
56 |
-
*/
|
57 |
-
protected function base_init( $settings = array() ) {
|
58 |
-
$this->settings = array_merge( $this->default_settings, $settings );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Check if update are avaliable.
|
63 |
-
*
|
64 |
-
* @since 4.0.0
|
65 |
-
* @return array
|
66 |
-
*/
|
67 |
-
protected function check_update() {
|
68 |
-
$args = array(
|
69 |
-
'user-agent' => 'WordPress',
|
70 |
-
'github_repository' => $this->settings['product_name'] . '/' . $this->settings['repository_name'],
|
71 |
-
'current_version' => $this->settings['version'],
|
72 |
-
'up_query_limit' => false,
|
73 |
-
'get_alpha' => false,
|
74 |
-
'get_beta' => false,
|
75 |
-
);
|
76 |
-
|
77 |
-
if ( defined( 'CHERRY_ALPHA_UPDATE' ) ) {
|
78 |
-
$args['get_alpha'] = true;
|
79 |
-
}
|
80 |
-
|
81 |
-
if ( defined( 'CHERRY_BETA_UPDATE' ) ) {
|
82 |
-
$args['get_beta'] = true;
|
83 |
-
}
|
84 |
-
|
85 |
-
if ( defined( 'CHERRY_UP_QUERY_LIMIT' ) ) {
|
86 |
-
$args['up_query_limit'] = true;
|
87 |
-
}
|
88 |
-
|
89 |
-
$response = $this -> remote_query( $args );
|
90 |
-
|
91 |
-
if ( $response && 'not_update' !== $response ) {
|
92 |
-
$this->settings['details_url'] = $response->details_url;
|
93 |
-
return array( 'version' => $response->new_version, 'package' => $response->package );
|
94 |
-
}
|
95 |
-
|
96 |
-
return array( 'version' => false );
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Remote request to updater API.
|
101 |
-
*
|
102 |
-
* @since 4.0.0
|
103 |
-
* @param array $args Request paprams.
|
104 |
-
* @return array|bool
|
105 |
-
*/
|
106 |
-
protected function remote_query( $args ) {
|
107 |
-
$query = add_query_arg( $args, $this->settings['cloud_url'] );
|
108 |
-
|
109 |
-
$response = wp_remote_get( $query );
|
110 |
-
|
111 |
-
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != '200' ) {
|
112 |
-
return false;
|
113 |
-
}
|
114 |
-
|
115 |
-
$response = json_decode( $response['body'] );
|
116 |
-
|
117 |
-
return $response;
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Rename github folder on update.
|
122 |
-
*
|
123 |
-
* @since 4.0.0
|
124 |
-
* @param [type] $upgrate_dir Theme folder name.
|
125 |
-
* @param [type] $remote_dir Remote folder name.
|
126 |
-
* @param object $skin_upgrader Upgrader object instance.
|
127 |
-
* @return string
|
128 |
-
*/
|
129 |
-
public function rename_github_folder( $upgrate_dir, $remote_dir, $skin_upgrader ) {
|
130 |
-
|
131 |
-
$slug = $this->settings['slug'];
|
132 |
-
$is_theme = isset( $skin_upgrader->skin->theme ) || isset( $skin_upgrader->skin->theme_info ) ? true : false ;
|
133 |
-
$is_plugin = isset( $skin_upgrader->skin->plugin_info ) ? true : false ;
|
134 |
-
$domain_plugin = $is_plugin ? $skin_upgrader->skin->plugin_info['TextDomain'] : '' ;
|
135 |
-
$title_plugin = $is_plugin ? str_replace( ' ', '-', strtolower( $skin_upgrader->skin->plugin_info['Title'] ) ) : '' ;
|
136 |
-
$name_plugin = $is_plugin ? str_replace( ' ', '-', strtolower( $skin_upgrader->skin->plugin_info['Name'] ) ) : '' ;
|
137 |
-
|
138 |
-
if ( $is_theme && strpos( $upgrate_dir, $slug ) !== false
|
139 |
-
|| $is_plugin && $domain_plugin === $slug
|
140 |
-
|| $is_plugin && $title_plugin === $slug
|
141 |
-
|| $is_plugin && $name_plugin === $slug
|
142 |
-
) {
|
143 |
-
$upgrate_dir_path = pathinfo( $upgrate_dir );
|
144 |
-
$new_upgrate_dir = trailingslashit( $upgrate_dir_path['dirname'] ) . trailingslashit( $slug );
|
145 |
-
|
146 |
-
rename( $upgrate_dir, $new_upgrate_dir );
|
147 |
-
|
148 |
-
$upgrate_dir = $new_upgrate_dir;
|
149 |
-
|
150 |
-
remove_filter( 'upgrader_source_selection', array( $this, 'rename_github_folder' ), 11, 3 );
|
151 |
-
}
|
152 |
-
|
153 |
-
return $upgrate_dir;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-post-formats-api/cherry-post-formats-api.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* API functions for post formats specific content
|
4 |
* Module Name: Post Formats API
|
5 |
* Description: API for post formats specific content
|
6 |
-
* Version: 1.1.
|
7 |
* Author: Cherry Team
|
8 |
* Author URI: http://www.cherryframework.com/
|
9 |
* License: GPLv3
|
@@ -11,7 +11,7 @@
|
|
11 |
*
|
12 |
* @package Cherry_Framework
|
13 |
* @subpackage Modules
|
14 |
-
* @version 1.1.
|
15 |
* @author Cherry Team <cherryframework@gmail.com>
|
16 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
17 |
* @link http://www.cherryframework.com/
|
@@ -199,10 +199,11 @@ if ( ! class_exists( 'Cherry_Post_Formats_Api' ) ) {
|
|
199 |
* Include required API files
|
200 |
*
|
201 |
* @since 1.0.0
|
|
|
202 |
* @return void
|
203 |
*/
|
204 |
public function includes() {
|
205 |
-
require_once
|
206 |
|
207 |
// Register Facebook Embed.
|
208 |
if ( class_exists( 'Cherry_Facebook_Embed' ) ) {
|
@@ -755,7 +756,7 @@ if ( ! class_exists( 'Cherry_Post_Formats_Api' ) ) {
|
|
755 |
|
756 |
if ( ! empty( $atts['include'] ) ) {
|
757 |
|
758 |
-
$attachments =
|
759 |
|
760 |
} elseif ( ! empty( $atts['exclude'] ) ) {
|
761 |
|
@@ -960,6 +961,23 @@ if ( ! class_exists( 'Cherry_Post_Formats_Api' ) ) {
|
|
960 |
return $result;
|
961 |
}
|
962 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
963 |
/**
|
964 |
* Prepare attributes string from array
|
965 |
*
|
@@ -1020,8 +1038,7 @@ if ( ! class_exists( 'Cherry_Post_Formats_Api' ) ) {
|
|
1020 |
$image_src = preg_replace( '/^(.+)(-\d+x\d+)(\..+)$/', '$1$3', $image_src );
|
1021 |
|
1022 |
// Try to get current image ID.
|
1023 |
-
$
|
1024 |
-
$id = $wpdb->get_var( $query );
|
1025 |
|
1026 |
if ( ! $id ) {
|
1027 |
$result[] = $image_src;
|
3 |
* API functions for post formats specific content
|
4 |
* Module Name: Post Formats API
|
5 |
* Description: API for post formats specific content
|
6 |
+
* Version: 1.1.2
|
7 |
* Author: Cherry Team
|
8 |
* Author URI: http://www.cherryframework.com/
|
9 |
* License: GPLv3
|
11 |
*
|
12 |
* @package Cherry_Framework
|
13 |
* @subpackage Modules
|
14 |
+
* @version 1.1.2
|
15 |
* @author Cherry Team <cherryframework@gmail.com>
|
16 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
17 |
* @link http://www.cherryframework.com/
|
199 |
* Include required API files
|
200 |
*
|
201 |
* @since 1.0.0
|
202 |
+
* @since 1.1.1 Using dirname( __FILE__ ) instead of __DIR__.
|
203 |
* @return void
|
204 |
*/
|
205 |
public function includes() {
|
206 |
+
require_once dirname( __FILE__ ) . '/inc/class-cherry-facebook-embed.php';
|
207 |
|
208 |
// Register Facebook Embed.
|
209 |
if ( class_exists( 'Cherry_Facebook_Embed' ) ) {
|
756 |
|
757 |
if ( ! empty( $atts['include'] ) ) {
|
758 |
|
759 |
+
$attachments = $this->esc_include_ids( $atts['include'] );
|
760 |
|
761 |
} elseif ( ! empty( $atts['exclude'] ) ) {
|
762 |
|
961 |
return $result;
|
962 |
}
|
963 |
|
964 |
+
/**
|
965 |
+
* Include IDs set (array or string).
|
966 |
+
*
|
967 |
+
* @since 1.1.2
|
968 |
+
* @param mixed $ids ID's set.
|
969 |
+
* @return array
|
970 |
+
*/
|
971 |
+
public function esc_include_ids( $ids ) {
|
972 |
+
|
973 |
+
if ( is_array( $ids ) ) {
|
974 |
+
return $ids;
|
975 |
+
} else {
|
976 |
+
return explode( ',', str_replace( ' ', '', $ids ) );
|
977 |
+
}
|
978 |
+
|
979 |
+
}
|
980 |
+
|
981 |
/**
|
982 |
* Prepare attributes string from array
|
983 |
*
|
1038 |
$image_src = preg_replace( '/^(.+)(-\d+x\d+)(\..+)$/', '$1$3', $image_src );
|
1039 |
|
1040 |
// Try to get current image ID.
|
1041 |
+
$id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid = %s", $image_src ) );
|
|
|
1042 |
|
1043 |
if ( ! $id ) {
|
1044 |
$result[] = $image_src;
|
cherry-framework/modules/cherry-post-formats-api/inc/class-cherry-facebook-embed.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-
|
11 |
*/
|
12 |
|
13 |
// If this file is called directly, abort.
|
7 |
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
11 |
*/
|
12 |
|
13 |
// If this file is called directly, abort.
|
cherry-framework/modules/cherry-post-meta/cherry-post-meta.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: Post Meta
|
4 |
* Description: Manage post meta
|
5 |
-
* Version: 1.1
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -10,7 +10,7 @@
|
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
-
* @version 1.1
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
@@ -33,49 +33,35 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
33 |
class Cherry_Post_Meta {
|
34 |
|
35 |
/**
|
36 |
-
* Module
|
37 |
-
*
|
38 |
-
* @var string
|
39 |
-
*/
|
40 |
-
public $module_version = '1.1.3';
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Module slug
|
44 |
*
|
45 |
* @var string
|
46 |
*/
|
47 |
public $module_slug = 'cherry-post-meta';
|
48 |
|
49 |
/**
|
50 |
-
* Module arguments
|
51 |
*
|
52 |
* @var array
|
53 |
*/
|
54 |
public $args = array();
|
55 |
|
56 |
/**
|
57 |
-
*
|
58 |
-
*
|
59 |
-
* @var array
|
60 |
-
*/
|
61 |
-
public $field_types = array();
|
62 |
-
|
63 |
-
/**
|
64 |
-
* UI builder instance
|
65 |
*
|
66 |
* @var object
|
67 |
*/
|
68 |
-
public $
|
69 |
|
70 |
/**
|
71 |
-
* Core instance
|
72 |
*
|
73 |
* @var object
|
74 |
*/
|
75 |
public $core = null;
|
76 |
|
77 |
/**
|
78 |
-
* Current nonce name to check
|
79 |
*
|
80 |
* @var null
|
81 |
*/
|
@@ -114,28 +100,103 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
114 |
return;
|
115 |
}
|
116 |
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 );
|
119 |
add_action( 'save_post', array( $this, 'save_meta' ), 10, 2 );
|
|
|
120 |
}
|
121 |
|
122 |
/**
|
123 |
-
*
|
124 |
*
|
125 |
-
* @
|
126 |
-
* @return bool
|
127 |
*/
|
128 |
-
public function
|
129 |
|
130 |
-
if (
|
131 |
return;
|
132 |
}
|
133 |
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
-
return true;
|
139 |
}
|
140 |
|
141 |
/**
|
@@ -198,133 +259,86 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
198 |
*/
|
199 |
public function render_metabox( $post, $metabox ) {
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
wp_nonce_field( $this->nonce, $this->nonce );
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
* Get registered control fields
|
207 |
*
|
208 |
* @since 1.0.0
|
209 |
-
* @
|
210 |
-
* @
|
211 |
-
*
|
|
|
|
|
212 |
*/
|
213 |
-
public function get_fields( $post
|
214 |
-
|
215 |
-
$elements = array();
|
216 |
|
217 |
if ( is_array( $this->args['single'] ) && isset( $this->args['single']['key'] ) ) {
|
218 |
$this->meta_values = get_post_meta( $post->ID, $this->args['single']['key'], true );
|
219 |
}
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
$value = ( false !== $value ) ? $value : Cherry_Toolkit::get_arg( $field, 'value', '' );
|
224 |
-
|
225 |
-
if ( isset( $field['options_callback'] ) ) {
|
226 |
-
$options = call_user_func( $field['options_callback'] );
|
227 |
-
} else {
|
228 |
-
$options = Cherry_Toolkit::get_arg( $field, 'options', array() );
|
229 |
-
}
|
230 |
-
|
231 |
-
$args = array(
|
232 |
-
'type' => Cherry_Toolkit::get_arg( $field, 'type', 'text' ),
|
233 |
-
'id' => Cherry_Toolkit::get_arg( $field, 'id', $key ),
|
234 |
-
'name' => Cherry_Toolkit::get_arg( $field, 'name', $key ),
|
235 |
-
'value' => $value,
|
236 |
-
'label' => Cherry_Toolkit::get_arg( $field, 'label', '' ),
|
237 |
-
'add_label' => Cherry_Toolkit::get_arg( $field, 'add_label', '' ),
|
238 |
-
'options' => $options,
|
239 |
-
'multiple' => Cherry_Toolkit::get_arg( $field, 'multiple', false ),
|
240 |
-
'filter' => Cherry_Toolkit::get_arg( $field, 'filter', false ),
|
241 |
-
'size' => Cherry_Toolkit::get_arg( $field, 'size', 1 ),
|
242 |
-
'null_option' => Cherry_Toolkit::get_arg( $field, 'null_option', 'None' ),
|
243 |
-
'multi_upload' => Cherry_Toolkit::get_arg( $field, 'multi_upload', true ),
|
244 |
-
'library_type' => Cherry_Toolkit::get_arg( $field, 'library_type', 'image' ),
|
245 |
-
'upload_button_text' => Cherry_Toolkit::get_arg( $field, 'upload_button_text', 'Choose' ),
|
246 |
-
'max_value' => Cherry_Toolkit::get_arg( $field, 'max_value', '100' ),
|
247 |
-
'min_value' => Cherry_Toolkit::get_arg( $field, 'min_value', '0' ),
|
248 |
-
'max' => Cherry_Toolkit::get_arg( $field, 'max', '100' ),
|
249 |
-
'min' => Cherry_Toolkit::get_arg( $field, 'min', '0' ),
|
250 |
-
'step_value' => Cherry_Toolkit::get_arg( $field, 'step_value', '1' ),
|
251 |
-
'style' => Cherry_Toolkit::get_arg( $field, 'style', 'normal' ),
|
252 |
-
'display_input' => Cherry_Toolkit::get_arg( $field, 'display_input', true ),
|
253 |
-
'controls' => Cherry_Toolkit::get_arg( $field, 'controls', array() ),
|
254 |
-
'fields' => Cherry_Toolkit::get_arg( $field, 'fields', array() ),
|
255 |
-
'auto_parse' => Cherry_Toolkit::get_arg( $field, 'auto_parse', false ),
|
256 |
-
'icon_data' => Cherry_Toolkit::get_arg( $field, 'icon_data', array() ),
|
257 |
-
'toggle' => Cherry_Toolkit::get_arg( $field, 'toggle', array(
|
258 |
-
'true_toggle' => 'On',
|
259 |
-
'false_toggle' => 'Off',
|
260 |
-
'true_slave' => '',
|
261 |
-
'false_slave' => '',
|
262 |
-
) ),
|
263 |
-
'required' => Cherry_Toolkit::get_arg( $field, 'required', false ),
|
264 |
-
'placeholder' => Cherry_Toolkit::get_arg( $field, 'placeholder' ),
|
265 |
-
'master' => Cherry_Toolkit::get_arg( $field, 'master' ),
|
266 |
-
'title_field' => Cherry_Toolkit::get_arg( $field, 'title_field' ),
|
267 |
-
);
|
268 |
-
|
269 |
-
$current_element = $this->ui_builder->get_ui_element_instance( $args['type'], $args );
|
270 |
-
|
271 |
-
$elements[] = array(
|
272 |
-
'html' => $current_element->render(),
|
273 |
-
'field' => $field,
|
274 |
-
);
|
275 |
-
|
276 |
-
}
|
277 |
-
return Cherry_Toolkit::render_view(
|
278 |
-
__DIR__ . '/views/meta.php',
|
279 |
array(
|
280 |
-
'
|
|
|
281 |
)
|
282 |
);
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Store field types used in this widget into class property
|
287 |
-
*
|
288 |
-
* @since 1.0.0
|
289 |
-
* @param array $field field data.
|
290 |
-
* @param [type] $id field key.
|
291 |
-
* @return bool
|
292 |
-
*/
|
293 |
-
public function set_field_types( $field, $id ) {
|
294 |
|
295 |
-
|
296 |
-
return false;
|
297 |
-
}
|
298 |
|
299 |
-
|
300 |
-
$this->
|
301 |
-
}
|
302 |
|
303 |
-
|
|
|
|
|
304 |
|
305 |
-
|
|
|
|
|
|
|
|
|
306 |
|
307 |
-
|
|
|
|
|
|
|
308 |
|
309 |
-
|
310 |
-
* Maybe add reapeater sub-fields to required elements list
|
311 |
-
*
|
312 |
-
* @since 1.0.1
|
313 |
-
* @param array $field field data.
|
314 |
-
* @return bool
|
315 |
-
*/
|
316 |
-
public function maybe_add_repeater_fields( $field ) {
|
317 |
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
foreach ( $field['fields'] as $repeater_field ) {
|
323 |
-
$this->set_field_types( $repeater_field, null );
|
324 |
}
|
325 |
|
326 |
-
|
327 |
-
|
328 |
}
|
329 |
|
330 |
/**
|
@@ -345,7 +359,30 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
345 |
return;
|
346 |
}
|
347 |
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
return;
|
350 |
}
|
351 |
|
@@ -357,11 +394,17 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
357 |
$post = get_post();
|
358 |
}
|
359 |
|
|
|
|
|
|
|
|
|
|
|
360 |
if ( is_array( $this->args['single'] ) && isset( $this->args['single']['key'] ) ) {
|
361 |
$this->save_meta_mod( $post_id );
|
362 |
} else {
|
363 |
$this->save_meta_option( $post_id );
|
364 |
}
|
|
|
365 |
}
|
366 |
|
367 |
/**
|
@@ -376,10 +419,13 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
376 |
// Array of new post meta value.
|
377 |
$new_meta_value = array();
|
378 |
|
|
|
|
|
|
|
|
|
379 |
foreach ( $_POST[ $meta_key ] as $key => $value ) {
|
380 |
|
381 |
-
|
382 |
-
$new_meta_value[ $key ] = sanitize_text_field( $value );
|
383 |
}
|
384 |
|
385 |
// Get current post meta data.
|
@@ -389,7 +435,7 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
389 |
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
|
390 |
} elseif ( $new_meta_value && $new_meta_value != $meta_value ) {
|
391 |
update_post_meta( $post_id, $meta_key, $new_meta_value );
|
392 |
-
} elseif (
|
393 |
delete_post_meta( $post_id, $meta_key, $meta_value );
|
394 |
}
|
395 |
}
|
@@ -401,39 +447,86 @@ if ( ! class_exists( 'Cherry_Post_Meta' ) ) {
|
|
401 |
* @param int $post_id Post ID.
|
402 |
*/
|
403 |
public function save_meta_option( $post_id ) {
|
|
|
404 |
foreach ( $this->args['fields'] as $key => $field ) {
|
405 |
|
|
|
|
|
|
|
|
|
406 |
if ( empty( $_POST[ $key ] ) ) {
|
407 |
update_post_meta( $post_id, $key, false );
|
408 |
continue;
|
409 |
}
|
410 |
|
411 |
-
|
412 |
-
update_post_meta( $post_id, $key, $
|
413 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
}
|
415 |
|
416 |
/**
|
417 |
* Retrieve post meta field.
|
418 |
*
|
419 |
* @since 1.1.0
|
420 |
-
* @
|
421 |
-
*
|
|
|
|
|
|
|
422 |
* @return string
|
423 |
*/
|
424 |
-
public function get_meta( $post, $key ) {
|
425 |
|
426 |
if ( ! is_object( $post ) ) {
|
427 |
return '';
|
428 |
}
|
429 |
|
430 |
if ( is_array( $this->args['single'] ) && isset( $this->args['single']['key'] ) ) {
|
431 |
-
|
432 |
-
} else {
|
433 |
-
$meta = get_post_meta( $post->ID, $key, true );
|
434 |
}
|
435 |
|
436 |
-
|
|
|
|
|
437 |
}
|
438 |
|
439 |
/**
|
2 |
/**
|
3 |
* Module Name: Post Meta
|
4 |
* Description: Manage post meta
|
5 |
+
* Version: 1.2.1
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
+
* @version 1.2.1
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
33 |
class Cherry_Post_Meta {
|
34 |
|
35 |
/**
|
36 |
+
* Module slug.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
*
|
38 |
* @var string
|
39 |
*/
|
40 |
public $module_slug = 'cherry-post-meta';
|
41 |
|
42 |
/**
|
43 |
+
* Module arguments.
|
44 |
*
|
45 |
* @var array
|
46 |
*/
|
47 |
public $args = array();
|
48 |
|
49 |
/**
|
50 |
+
* Interface builder instance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
*
|
52 |
* @var object
|
53 |
*/
|
54 |
+
public $builder = null;
|
55 |
|
56 |
/**
|
57 |
+
* Core instance.
|
58 |
*
|
59 |
* @var object
|
60 |
*/
|
61 |
public $core = null;
|
62 |
|
63 |
/**
|
64 |
+
* Current nonce name to check.
|
65 |
*
|
66 |
* @var null
|
67 |
*/
|
100 |
return;
|
101 |
}
|
102 |
|
103 |
+
$this->builder = $this->core->init_module( 'cherry-interface-builder', array() );
|
104 |
+
|
105 |
+
$this->init_columns_actions();
|
106 |
+
|
107 |
+
if ( ! $this->builder ) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 );
|
112 |
add_action( 'save_post', array( $this, 'save_meta' ), 10, 2 );
|
113 |
+
|
114 |
}
|
115 |
|
116 |
/**
|
117 |
+
* Initalize admin columns
|
118 |
*
|
119 |
+
* @return void
|
|
|
120 |
*/
|
121 |
+
public function init_columns_actions() {
|
122 |
|
123 |
+
if ( empty( $this->args['admin_columns'] ) ) {
|
124 |
return;
|
125 |
}
|
126 |
|
127 |
+
if ( ! is_array( $this->args['page'] ) ) {
|
128 |
+
$pages = array( $this->args['page'] );
|
129 |
+
} else {
|
130 |
+
$pages = $this->args['page'];
|
131 |
+
}
|
132 |
|
133 |
+
foreach ( $pages as $page ) {
|
134 |
+
add_filter( 'manage_edit-' . $page . '_columns', array( $this, 'edit_columns' ) );
|
135 |
+
add_action( 'manage_' . $page . '_posts_custom_column', array( $this, 'manage_columns' ), 10, 2 );
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Edit admin columns
|
142 |
+
*
|
143 |
+
* @since 1.1.3
|
144 |
+
* @param array $columns current post table columns.
|
145 |
+
* @return array
|
146 |
+
*/
|
147 |
+
public function edit_columns( $columns ) {
|
148 |
+
|
149 |
+
foreach ( $this->args['admin_columns'] as $column_key => $column_data ) {
|
150 |
+
|
151 |
+
if ( empty( $column_data['label'] ) ) {
|
152 |
+
continue;
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( ! empty( $column_data['position'] ) && 0 !== (int) $column_data['position'] ) {
|
156 |
+
|
157 |
+
$length = count( $columns );
|
158 |
+
|
159 |
+
if ( (int) $column_data['position'] > $length ) {
|
160 |
+
$columns[ $column_key ] = $column_data['label'];
|
161 |
+
}
|
162 |
+
|
163 |
+
$columns_before = array_slice( $columns, 0, (int) $column_data['position'] );
|
164 |
+
$columns_after = array_slice( $columns, (int) $column_data['position'], $length - (int) $column_data['position'] );
|
165 |
+
|
166 |
+
$columns = array_merge(
|
167 |
+
$columns_before,
|
168 |
+
array( $column_key => $column_data['label'] ),
|
169 |
+
$columns_after
|
170 |
+
);
|
171 |
+
} else {
|
172 |
+
$columns[ $column_key ] = $column_data['label'];
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
return $columns;
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Add output for custom columns.
|
182 |
+
*
|
183 |
+
* @since 1.1.3
|
184 |
+
* @param string $column current post list categories.
|
185 |
+
* @param int $post_id current post ID.
|
186 |
+
* @return void
|
187 |
+
*/
|
188 |
+
public function manage_columns( $column, $post_id ) {
|
189 |
+
|
190 |
+
if ( empty( $this->args['admin_columns'][ $column ] ) ) {
|
191 |
+
return;
|
192 |
+
}
|
193 |
+
|
194 |
+
if ( ! empty( $this->args['admin_columns'][ $column ]['callback'] ) && is_callable( $this->args['admin_columns'][ $column ]['callback'] ) ) {
|
195 |
+
call_user_func( $this->args['admin_columns'][ $column ]['callback'], $column, $post_id );
|
196 |
+
} else {
|
197 |
+
echo get_post_meta( $post_id, $column, true );
|
198 |
+
}
|
199 |
|
|
|
200 |
}
|
201 |
|
202 |
/**
|
259 |
*/
|
260 |
public function render_metabox( $post, $metabox ) {
|
261 |
|
262 |
+
/**
|
263 |
+
* Filter custom metabox output. Prevent from showing main box, if user output passed
|
264 |
+
*
|
265 |
+
* @var string
|
266 |
+
*/
|
267 |
+
$custom_box = apply_filters( 'cherry_post_meta_custom_box', false, $post, $metabox );
|
268 |
+
|
269 |
+
if ( false !== $custom_box ) {
|
270 |
+
echo $custom_box;
|
271 |
+
return;
|
272 |
+
}
|
273 |
+
|
274 |
wp_nonce_field( $this->nonce, $this->nonce );
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Hook fires before metabox output started.
|
278 |
+
*/
|
279 |
+
do_action( 'cherry_post_meta_box_before' );
|
280 |
+
|
281 |
+
$this->get_fields( $post );
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Hook fires after metabox output finished.
|
285 |
+
*/
|
286 |
+
do_action( 'cherry_post_meta_box_after' );
|
287 |
+
|
288 |
}
|
289 |
|
290 |
/**
|
291 |
* Get registered control fields
|
292 |
*
|
293 |
* @since 1.0.0
|
294 |
+
* @since 1.1.3 Using dirname( __FILE__ ) instead of __DIR__.
|
295 |
+
* @since 1.2.0 Use interface builder for HTML rendering.
|
296 |
+
*
|
297 |
+
* @param mixed $post Current post object.
|
298 |
+
* @return void
|
299 |
*/
|
300 |
+
public function get_fields( $post ) {
|
|
|
|
|
301 |
|
302 |
if ( is_array( $this->args['single'] ) && isset( $this->args['single']['key'] ) ) {
|
303 |
$this->meta_values = get_post_meta( $post->ID, $this->args['single']['key'], true );
|
304 |
}
|
305 |
|
306 |
+
$zero_allowed = apply_filters(
|
307 |
+
'cherry_zero_allowed_controls',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
array(
|
309 |
+
'stepper',
|
310 |
+
'slider',
|
311 |
)
|
312 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
+
foreach ( $this->args['fields'] as $key => $field ) {
|
|
|
|
|
315 |
|
316 |
+
$default = Cherry_Toolkit::get_arg( $field, 'value', '' );
|
317 |
+
$value = $this->get_meta( $post, $key, $default );
|
|
|
318 |
|
319 |
+
if ( isset( $field['options_callback'] ) ) {
|
320 |
+
$field['options'] = call_user_func( $field['options_callback'] );
|
321 |
+
}
|
322 |
|
323 |
+
$element = Cherry_Toolkit::get_arg( $field, 'element', 'control' );
|
324 |
+
$field['id'] = Cherry_Toolkit::get_arg( $field, 'id', $key );
|
325 |
+
$field['name'] = Cherry_Toolkit::get_arg( $field, 'name', $key );
|
326 |
+
$field['type'] = Cherry_Toolkit::get_arg( $field, 'type', '' );
|
327 |
+
$field['value'] = $value;
|
328 |
|
329 |
+
// Fix zero values for stepper and slider
|
330 |
+
if ( ! $value && in_array( $field['type'], $zero_allowed ) ) {
|
331 |
+
$field['value'] = 0;
|
332 |
+
}
|
333 |
|
334 |
+
$register_callback = 'register_' . $element;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
|
336 |
+
if ( method_exists( $this->builder, $register_callback ) ) {
|
337 |
+
call_user_func( array( $this->builder, $register_callback ), $field );
|
338 |
+
}
|
|
|
|
|
|
|
339 |
}
|
340 |
|
341 |
+
$this->builder->render();
|
|
|
342 |
}
|
343 |
|
344 |
/**
|
359 |
return;
|
360 |
}
|
361 |
|
362 |
+
$posts = ! empty( $this->args['page'] ) ? $this->args['page'] : array( 'post' );
|
363 |
+
$posts = is_array( $posts ) ? $posts : array( $posts );
|
364 |
+
|
365 |
+
$maybe_break = false;
|
366 |
+
|
367 |
+
foreach ( $posts as $post_type ) {
|
368 |
+
|
369 |
+
if ( get_post_type( $post_id ) !== $post_type ) {
|
370 |
+
$maybe_break = true;
|
371 |
+
continue;
|
372 |
+
}
|
373 |
+
|
374 |
+
$maybe_break = false;
|
375 |
+
$obj = get_post_type_object( $post_type );
|
376 |
+
|
377 |
+
if ( ! isset( $obj->cap->edit_posts ) || ! current_user_can( $obj->cap->edit_posts ) ) {
|
378 |
+
$maybe_break = true;
|
379 |
+
continue;
|
380 |
+
}
|
381 |
+
|
382 |
+
break;
|
383 |
+
}
|
384 |
+
|
385 |
+
if ( true === $maybe_break ) {
|
386 |
return;
|
387 |
}
|
388 |
|
394 |
$post = get_post();
|
395 |
}
|
396 |
|
397 |
+
/**
|
398 |
+
* Hook on current metabox saving
|
399 |
+
*/
|
400 |
+
do_action( 'cherry_save_meta_' . $this->args['id'] );
|
401 |
+
|
402 |
if ( is_array( $this->args['single'] ) && isset( $this->args['single']['key'] ) ) {
|
403 |
$this->save_meta_mod( $post_id );
|
404 |
} else {
|
405 |
$this->save_meta_option( $post_id );
|
406 |
}
|
407 |
+
|
408 |
}
|
409 |
|
410 |
/**
|
419 |
// Array of new post meta value.
|
420 |
$new_meta_value = array();
|
421 |
|
422 |
+
if ( empty( $_POST[ $meta_key ] ) ) {
|
423 |
+
return;
|
424 |
+
}
|
425 |
+
|
426 |
foreach ( $_POST[ $meta_key ] as $key => $value ) {
|
427 |
|
428 |
+
$new_meta_value[ $key ] = $this->sanitize_meta( $key, $value );
|
|
|
429 |
}
|
430 |
|
431 |
// Get current post meta data.
|
435 |
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
|
436 |
} elseif ( $new_meta_value && $new_meta_value != $meta_value ) {
|
437 |
update_post_meta( $post_id, $meta_key, $new_meta_value );
|
438 |
+
} elseif ( empty( $new_meta_value ) && $meta_value ) {
|
439 |
delete_post_meta( $post_id, $meta_key, $meta_value );
|
440 |
}
|
441 |
}
|
447 |
* @param int $post_id Post ID.
|
448 |
*/
|
449 |
public function save_meta_option( $post_id ) {
|
450 |
+
|
451 |
foreach ( $this->args['fields'] as $key => $field ) {
|
452 |
|
453 |
+
if ( isset( $field['element'] ) && 'control' !== $field['element'] ) {
|
454 |
+
continue;
|
455 |
+
}
|
456 |
+
|
457 |
if ( empty( $_POST[ $key ] ) ) {
|
458 |
update_post_meta( $post_id, $key, false );
|
459 |
continue;
|
460 |
}
|
461 |
|
462 |
+
$value = $this->sanitize_meta( $key, $_POST[ $key ] );
|
463 |
+
update_post_meta( $post_id, $key, $value );
|
464 |
}
|
465 |
+
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Sanitize passed meta value
|
470 |
+
*
|
471 |
+
* @since 1.1.3
|
472 |
+
* @param string $key Meta key to sanitize.
|
473 |
+
* @param mixed $value Meta value.
|
474 |
+
* @return mixed
|
475 |
+
*/
|
476 |
+
public function sanitize_meta( $key, $value ) {
|
477 |
+
|
478 |
+
if ( empty( $this->args['fields'][ $key ]['sanitize_callback'] ) ) {
|
479 |
+
return $this->sanitize_deafult( $value );
|
480 |
+
}
|
481 |
+
|
482 |
+
if ( ! is_callable( $this->args['fields'][ $key ]['sanitize_callback'] ) ) {
|
483 |
+
return $this->sanitize_deafult( $value );
|
484 |
+
}
|
485 |
+
|
486 |
+
return call_user_func(
|
487 |
+
$this->args['fields'][ $key ]['sanitize_callback'],
|
488 |
+
$value,
|
489 |
+
$key,
|
490 |
+
$this->args['fields'][ $key ]
|
491 |
+
);
|
492 |
+
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* Cleare value with sanitize_text_field if not is array
|
497 |
+
*
|
498 |
+
* @since 1.1.3
|
499 |
+
* @param mixed $value Passed value.
|
500 |
+
* @return mixed
|
501 |
+
*/
|
502 |
+
public function sanitize_deafult( $value ) {
|
503 |
+
return is_array( $value ) ? $value : sanitize_text_field( $value );
|
504 |
}
|
505 |
|
506 |
/**
|
507 |
* Retrieve post meta field.
|
508 |
*
|
509 |
* @since 1.1.0
|
510 |
+
* @since 1.2.0 Process default value.
|
511 |
+
*
|
512 |
+
* @param object $post Current post object.
|
513 |
+
* @param string $key The meta key to retrieve.
|
514 |
+
* @param mixed $default Default value.
|
515 |
* @return string
|
516 |
*/
|
517 |
+
public function get_meta( $post, $key, $default = false ) {
|
518 |
|
519 |
if ( ! is_object( $post ) ) {
|
520 |
return '';
|
521 |
}
|
522 |
|
523 |
if ( is_array( $this->args['single'] ) && isset( $this->args['single']['key'] ) ) {
|
524 |
+
return isset( $this->meta_values[ $key ] ) ? $this->meta_values[ $key ] : $default;
|
|
|
|
|
525 |
}
|
526 |
|
527 |
+
$meta = get_post_meta( $post->ID, $key, false );
|
528 |
+
|
529 |
+
return ( empty( $meta ) ) ? $default : $meta[0];
|
530 |
}
|
531 |
|
532 |
/**
|
cherry-framework/modules/cherry-post-meta/views/meta.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* POst meta view
|
4 |
-
*
|
5 |
-
* @package Cherry_Framework
|
6 |
-
*/?>
|
7 |
-
<?php if ( is_array( $__data['elements'] ) && count( $__data['elements'] ) ) : ?>
|
8 |
-
<table class="form-table">
|
9 |
-
<tbody>
|
10 |
-
<?php foreach ( $__data['elements'] as $el ) : ?>
|
11 |
-
<tr>
|
12 |
-
<?php if ( array_key_exists( 'name', $el['field'] ) && array_key_exists( 'left_label', $el['field'] ) ) : ?>
|
13 |
-
<th><label for="<?php echo $el['field']['name']; ?>"><?php echo $el['field']['left_label']; ?></label></th>
|
14 |
-
<?php endif; ?>
|
15 |
-
<td><?php echo $el['html']; ?></td>
|
16 |
-
</tr>
|
17 |
-
<?php endforeach; ?>
|
18 |
-
</tbody>
|
19 |
-
</table>
|
20 |
-
<?php endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-post-types/cherry-post-types.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Create custom post type
|
4 |
-
* Module Name: Post Types
|
5 |
-
* Description: Provides functionality for creating custom post types
|
6 |
-
* Version: 1.1.0
|
7 |
-
* Author: Cherry Team
|
8 |
-
* Author URI: http://www.cherryframework.com/
|
9 |
-
* License: GPLv3
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
-
*
|
12 |
-
* @package Cherry_Framework
|
13 |
-
* @subpackage Modules
|
14 |
-
* @version 1.1.0
|
15 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
16 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
17 |
-
* @link http://www.cherryframework.com/
|
18 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
19 |
-
*/
|
20 |
-
|
21 |
-
// If this file is called directly, abort.
|
22 |
-
if ( ! defined( 'WPINC' ) ) {
|
23 |
-
die;
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( ! class_exists( 'Cherry_Post_Types' ) ) {
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Cherry Post Types.
|
30 |
-
*
|
31 |
-
* @since 1.0.0
|
32 |
-
* @since 1.0.1 Removed `module_directory` property.
|
33 |
-
*/
|
34 |
-
class Cherry_Post_Types {
|
35 |
-
/**
|
36 |
-
* Module version
|
37 |
-
*
|
38 |
-
* @var string
|
39 |
-
*/
|
40 |
-
public $module_version = '1.1.0';
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Module slug
|
44 |
-
*
|
45 |
-
* @var string
|
46 |
-
*/
|
47 |
-
public $module_slug = 'cherry-post-types';
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Default post type arguments
|
51 |
-
*
|
52 |
-
* @var null
|
53 |
-
*/
|
54 |
-
private $defaults = null;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Created popst types list
|
58 |
-
*
|
59 |
-
* @var array
|
60 |
-
*/
|
61 |
-
public static $created_post_types = array();
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Cherry_Post_Type class constructor
|
65 |
-
*/
|
66 |
-
public function __construct( $core, $args = array() ) {
|
67 |
-
$this->defaults = $args;
|
68 |
-
|
69 |
-
if ( ! class_exists( 'Cherry_Post_Type' ) ) {
|
70 |
-
require_once( __DIR__ . '/inc/cherry-post-type.php' );
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Create new Post Type.
|
76 |
-
*
|
77 |
-
* @param [type] $slug The post type slug name.
|
78 |
-
* @param [type] $plural The post type plural name for display.
|
79 |
-
* @param [type] $singular The post type singular name for display.
|
80 |
-
* @param array $args The custom post type arguments.
|
81 |
-
* @throws Exception Invalid custom post type parameter.
|
82 |
-
* @return Cherry_Post_Type
|
83 |
-
*/
|
84 |
-
public function create( $slug, $plural, $singular, $args = array() ) {
|
85 |
-
$params = array(
|
86 |
-
'slug' => $slug,
|
87 |
-
'plural' => $plural,
|
88 |
-
'singular' => $singular,
|
89 |
-
);
|
90 |
-
|
91 |
-
foreach ( $params as $name => $param ) {
|
92 |
-
if ( ! is_string( $param ) ) {
|
93 |
-
throw new Exception( 'Invalid custom post type parameter "'.$name.'". Accepts string only.' );
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
// Set main properties.
|
98 |
-
$this->defaults = array_merge(
|
99 |
-
$this->get_default_arguments( $plural, $singular ),
|
100 |
-
$this->defaults
|
101 |
-
);
|
102 |
-
$args = array_merge( $this->defaults, $args );
|
103 |
-
// Register post type
|
104 |
-
self::$created_post_types[ $slug ] = new Cherry_Post_Type( $slug, $args );
|
105 |
-
|
106 |
-
return self::$created_post_types[ $slug ];
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Get the custom post type default arguments.
|
111 |
-
*
|
112 |
-
* @param [type] $plural The post type plural display name.
|
113 |
-
* @param [type] $singular The post type singular display name.
|
114 |
-
* @return array
|
115 |
-
*/
|
116 |
-
private function get_default_arguments( $plural, $singular ) {
|
117 |
-
$labels = array(
|
118 |
-
'name' => 'cherry',
|
119 |
-
'singular_name' => $singular,
|
120 |
-
'add_new' => 'Add New',
|
121 |
-
'add_new_item' => 'Add New '. $singular,
|
122 |
-
'edit_item' => 'Edit '. $singular,
|
123 |
-
'new_item' => 'New ' . $singular,
|
124 |
-
'all_items' => 'All ' . $plural,
|
125 |
-
'view_item' => 'View ' . $singular,
|
126 |
-
'search_items' => 'Search ' . $singular,
|
127 |
-
'not_found' => 'No '. $singular .' found',
|
128 |
-
'not_found_in_trash' => 'No '. $singular .' found in Trash',
|
129 |
-
'parent_item_colon' => '',
|
130 |
-
'menu_name' => $plural,
|
131 |
-
);
|
132 |
-
|
133 |
-
$defaults = array(
|
134 |
-
'label' => $plural,
|
135 |
-
'labels' => $labels,
|
136 |
-
'description' => '',
|
137 |
-
'public' => true,
|
138 |
-
'menu_position' => 20,
|
139 |
-
'has_archive' => true,
|
140 |
-
);
|
141 |
-
|
142 |
-
return $defaults;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Returns the instance.
|
147 |
-
*
|
148 |
-
* @since 1.0.0
|
149 |
-
* @return object
|
150 |
-
*/
|
151 |
-
public static function get_instance( $core, $args ) {
|
152 |
-
return new self( $core, $args );
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-post-types/inc/cherry-post-type.php
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Custom post type
|
4 |
-
*
|
5 |
-
* @package Cherry_Framework
|
6 |
-
* @subpackage Class
|
7 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
-
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Cherry_Post_Type class
|
15 |
-
*/
|
16 |
-
class Cherry_Post_Type {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Post type slug
|
20 |
-
*
|
21 |
-
* @var null
|
22 |
-
*/
|
23 |
-
private $slug = null;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Post type arguments
|
27 |
-
*
|
28 |
-
* @var null
|
29 |
-
*/
|
30 |
-
private $args = null;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* The registered custom post type.
|
34 |
-
*
|
35 |
-
* @var Object|\WP_Error
|
36 |
-
*/
|
37 |
-
private $post_type;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Font awesome icon name.
|
41 |
-
*
|
42 |
-
* @var null
|
43 |
-
*/
|
44 |
-
private $icon = null;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Cherry Post Type Builder class constructor
|
48 |
-
*
|
49 |
-
* @param [type] $slug post type slug.
|
50 |
-
* @param [type] $args post type arguments.
|
51 |
-
*/
|
52 |
-
public function __construct( $slug, $args ) {
|
53 |
-
|
54 |
-
$this->slug = $slug;
|
55 |
-
$this->args = $args;
|
56 |
-
|
57 |
-
// Register post type
|
58 |
-
add_action( 'init', array( &$this, 'register' ) );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Triggered by the 'init' action event.
|
63 |
-
* Register a WordPress custom post type.
|
64 |
-
*
|
65 |
-
* @return void
|
66 |
-
*/
|
67 |
-
public function register() {
|
68 |
-
$this->post_type = register_post_type(
|
69 |
-
$this->slug,
|
70 |
-
$this->args
|
71 |
-
);
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Add font awesome icon to menu
|
76 |
-
*
|
77 |
-
* @param [type] $icon font awesome icon code.
|
78 |
-
* @return boolen true if succes | false if not.
|
79 |
-
*/
|
80 |
-
public function font_awesome_icon( $icon = '' ) {
|
81 |
-
if ( '' === $icon ) {
|
82 |
-
return false;
|
83 |
-
}
|
84 |
-
|
85 |
-
$this->icon = $icon;
|
86 |
-
|
87 |
-
add_action( 'admin_enqueue_scripts', array( &$this, 'load_font_awesome' ) );
|
88 |
-
|
89 |
-
return true;
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Load font awesome fonts to admin menu.
|
94 |
-
*
|
95 |
-
* @return void
|
96 |
-
*/
|
97 |
-
public function load_font_awesome() {
|
98 |
-
wp_enqueue_style(
|
99 |
-
'font-awesome',
|
100 |
-
'//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'
|
101 |
-
);
|
102 |
-
|
103 |
-
?>
|
104 |
-
<style type='text/css' media='screen'>
|
105 |
-
#adminmenu .menu-icon-<?php echo $this->slug; ?> div.wp-menu-image:before {
|
106 |
-
font-family: Fontawesome !important;
|
107 |
-
content: '\<?php echo $this->icon; ?>';
|
108 |
-
}
|
109 |
-
</style>
|
110 |
-
<?php
|
111 |
-
}
|
112 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-taxonomies/cherry-taxonomies.php
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Module Name: Taxanomies
|
4 |
-
* Description: Provides functionality for creating custom taxanomies
|
5 |
-
* Version: 1.1.0
|
6 |
-
* Author: Cherry Team
|
7 |
-
* Author URI: http://www.cherryframework.com/
|
8 |
-
* License: GPLv3
|
9 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
-
*
|
11 |
-
* @package Cherry_Framework
|
12 |
-
* @subpackage Modules
|
13 |
-
* @version 1.1.0
|
14 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
-
* @link http://www.cherryframework.com/
|
17 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
-
*/
|
19 |
-
|
20 |
-
// If this file is called directly, abort.
|
21 |
-
if ( ! defined( 'WPINC' ) ) {
|
22 |
-
die;
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( ! class_exists( 'Cherry_Taxonomies' ) ) {
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Cherry Taxonomies.
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
* @since 1.0.1 Removed `module_directory` property.
|
32 |
-
*/
|
33 |
-
class Cherry_Taxonomies {
|
34 |
-
/**
|
35 |
-
* Module version
|
36 |
-
*
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
public $module_version = '1.1.0';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Module slug
|
43 |
-
*
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
public $module_slug = 'cherry-taxonomies';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Default post type arguments
|
50 |
-
*
|
51 |
-
* @var null
|
52 |
-
*/
|
53 |
-
private $defaults = null;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Cherry_Post_Type class constructor
|
57 |
-
*/
|
58 |
-
public function __construct( $core, $args = array() ) {
|
59 |
-
$this->defaults = $args;
|
60 |
-
|
61 |
-
if ( ! class_exists( 'Cherry_Taxonomy' ) ) {
|
62 |
-
require_once( __DIR__ . '/inc/cherry-taxonomy.php' );
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Create new Post Type.
|
68 |
-
*
|
69 |
-
* @param [type] $single name.
|
70 |
-
* @param [type] $post_type_slug post types slug.
|
71 |
-
* @param [type] $plural name.
|
72 |
-
* @return Cherry_Post_Type
|
73 |
-
*/
|
74 |
-
public function create( $single, $post_type_slug = 'post', $plural = '' ) {
|
75 |
-
$tax = new Cherry_Taxonomy( $single, $post_type_slug, $plural );
|
76 |
-
|
77 |
-
$this->defaults = array_merge(
|
78 |
-
$this->defaults,
|
79 |
-
$this->get_default_arguments(
|
80 |
-
$tax->get_single(),
|
81 |
-
$tax->get_plural(),
|
82 |
-
$tax->get_post_type_slug()
|
83 |
-
)
|
84 |
-
);
|
85 |
-
$tax->set_arguments( $this->defaults );
|
86 |
-
|
87 |
-
return $tax;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Get the taxonomy default arguments.
|
92 |
-
*
|
93 |
-
* @param [type] $plural The post type plural display name.
|
94 |
-
* @param [type] $singular The post type singular display name.
|
95 |
-
* @return array
|
96 |
-
*/
|
97 |
-
public function get_default_arguments( $plural, $singular, $post_type_slug ) {
|
98 |
-
$labels = array(
|
99 |
-
'name' => $plural,
|
100 |
-
'singular_name' => $singular,
|
101 |
-
'search_items' => 'Search ' . $plural,
|
102 |
-
'all_items' => 'All ' . $plural,
|
103 |
-
'parent_item' => 'Parent ' . $singular,
|
104 |
-
'parent_item_colon' => 'Parent ' . $singular . ' :',
|
105 |
-
'edit_item' => 'Edit ' . $singular,
|
106 |
-
'update_item' => 'Update ' . $singular,
|
107 |
-
'add_new_item' => 'Add New ' . $singular,
|
108 |
-
'new_item_name' => 'New ' . $singular . ' Name',
|
109 |
-
'menu_name' => $plural,
|
110 |
-
);
|
111 |
-
|
112 |
-
return array(
|
113 |
-
'hierarchical' => true,
|
114 |
-
'labels' => $labels,
|
115 |
-
'show_ui' => true,
|
116 |
-
'show_admin_column' => true,
|
117 |
-
'query_var' => true,
|
118 |
-
'rewrite' => array( 'slug' => $post_type_slug ),
|
119 |
-
);
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Returns the instance.
|
124 |
-
*
|
125 |
-
* @since 1.0.0
|
126 |
-
* @return object
|
127 |
-
*/
|
128 |
-
public static function get_instance( $core, $args ) {
|
129 |
-
return new self( $core, $args );
|
130 |
-
}
|
131 |
-
}
|
132 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-taxonomies/inc/cherry-taxonomy.php
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Custom taxonomy
|
4 |
-
*
|
5 |
-
* @package Cherry_Framework
|
6 |
-
* @subpackage Class
|
7 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
-
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Cherry_Taxonomy class
|
15 |
-
*/
|
16 |
-
class Cherry_Taxonomy {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Single taxonomy name.
|
20 |
-
*
|
21 |
-
* @var null
|
22 |
-
*/
|
23 |
-
private $single = null;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Taxonomy slug
|
27 |
-
*
|
28 |
-
* @var null
|
29 |
-
*/
|
30 |
-
private $slug = null;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Post type slug
|
34 |
-
*
|
35 |
-
* @var null
|
36 |
-
*/
|
37 |
-
private $post_type_slug = null;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Plural taxonomy name.
|
41 |
-
*
|
42 |
-
* @var null
|
43 |
-
*/
|
44 |
-
private $plural = null;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Taxonomy arguments
|
48 |
-
*
|
49 |
-
* @var array
|
50 |
-
*/
|
51 |
-
private $arguments = array();
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Cherry taxonomy
|
55 |
-
*
|
56 |
-
* @param [type] $single name.
|
57 |
-
* @param [type] $post_type_slug post type slug.
|
58 |
-
* @param [type] $plural name.
|
59 |
-
* @param array $args arguments.
|
60 |
-
*/
|
61 |
-
public function __construct( $single, $post_type_slug = 'post', $plural = '', $args = array() ) {
|
62 |
-
$this->set_single( $single );
|
63 |
-
$this->set_plural( $plural );
|
64 |
-
$this->set_post_type_slug( $post_type_slug );
|
65 |
-
$this->set_slug();
|
66 |
-
$this->set_arguments( $args );
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Init actions
|
71 |
-
*
|
72 |
-
* @return Cherry_Taxonomy object
|
73 |
-
*/
|
74 |
-
public function init() {
|
75 |
-
// Register Taxonomy
|
76 |
-
add_action( 'init', array( &$this, 'register' ), 0 );
|
77 |
-
return $this;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Set single property
|
82 |
-
*
|
83 |
-
* @param [type] $single property.
|
84 |
-
* @return Cherry_Taxonomy object
|
85 |
-
*/
|
86 |
-
public function set_single( $single ) {
|
87 |
-
if ( '' !== $single ) {
|
88 |
-
$this->single = $single;
|
89 |
-
}
|
90 |
-
return $this;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Get single property
|
95 |
-
*
|
96 |
-
* @return string property.
|
97 |
-
*/
|
98 |
-
public function get_single() {
|
99 |
-
return $this->single;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Set plural property
|
104 |
-
*
|
105 |
-
* @param [type] $plural property.
|
106 |
-
* @return Cherry_Taxonomy object
|
107 |
-
*/
|
108 |
-
public function set_plural( $plural = '' ) {
|
109 |
-
if ( '' != $plural ) {
|
110 |
-
$this->plural = $plural;
|
111 |
-
} else {
|
112 |
-
$this->plural = $this->get_single() . 's';
|
113 |
-
}
|
114 |
-
return $this;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Get plural property
|
119 |
-
*
|
120 |
-
* @return string plural property.
|
121 |
-
*/
|
122 |
-
public function get_plural() {
|
123 |
-
return $this->plural;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Set slug
|
128 |
-
*
|
129 |
-
* @param type string $slug taxonomy slug.
|
130 |
-
* @return Cherry_Taxonomy object
|
131 |
-
*/
|
132 |
-
public function set_slug( $slug = '' ) {
|
133 |
-
if ( '' != $slug ) {
|
134 |
-
$this->slug = $slug;
|
135 |
-
} else {
|
136 |
-
$slug = $this->get_single();
|
137 |
-
$slug = strtolower( $slug );
|
138 |
-
$slug = str_replace( ' ', '_', $slug );
|
139 |
-
$this->slug = $slug;
|
140 |
-
}
|
141 |
-
return $this;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Get slug taxonomy
|
146 |
-
*
|
147 |
-
* @return string taxonomy slug.
|
148 |
-
*/
|
149 |
-
public function get_slug() {
|
150 |
-
return $this->slug;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Set post type slug
|
155 |
-
*
|
156 |
-
* @param type string $slug post types slug.
|
157 |
-
* @return Cherry_Taxonomy object
|
158 |
-
*/
|
159 |
-
public function set_post_type_slug( $slug = '' ) {
|
160 |
-
if ( '' != $slug ) {
|
161 |
-
$this->post_type_slug = $slug;
|
162 |
-
} else {
|
163 |
-
$this->post_type_slug = 'post';
|
164 |
-
}
|
165 |
-
return $this;
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Get post type slug
|
170 |
-
*
|
171 |
-
* @return string post type slug.
|
172 |
-
*/
|
173 |
-
public function get_post_type_slug() {
|
174 |
-
return $this->post_type_slug;
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Set arguments
|
179 |
-
*
|
180 |
-
* @param array $args arguments.
|
181 |
-
*/
|
182 |
-
public function set_arguments( $args = array() ) {
|
183 |
-
$this->arguments = array_merge( $this->arguments, (array) $args );
|
184 |
-
return $this;
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Get arguments
|
189 |
-
*
|
190 |
-
* @return array taxonomy arguments.
|
191 |
-
*/
|
192 |
-
public function get_arguments() {
|
193 |
-
return (array) $this->arguments;
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Triggered by the 'init' action event.
|
198 |
-
* Register a WordPress custom taxonomy.
|
199 |
-
*
|
200 |
-
* @return Cherry_Taxonomy object
|
201 |
-
*/
|
202 |
-
public function register() {
|
203 |
-
register_taxonomy(
|
204 |
-
$this->slug,
|
205 |
-
$this->post_type_slug,
|
206 |
-
$this->arguments
|
207 |
-
);
|
208 |
-
return $this;
|
209 |
-
}
|
210 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-template-manager/cherry-template-manager.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Template Manager
|
4 |
+
* Description: Module load and parse tmpl files.
|
5 |
+
* Version: 1.0.0
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.0.0
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_Template_Manager' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Cherry Template Manager.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Cherry_Template_Manager {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* A reference to an instance of this class.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var object
|
40 |
+
*/
|
41 |
+
private static $instance = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Module arguments.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access private
|
48 |
+
* @var array
|
49 |
+
*/
|
50 |
+
private $args = array();
|
51 |
+
|
52 |
+
/**
|
53 |
+
* It contains a class Cherry_Template_Parser.
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access public
|
57 |
+
* @var object
|
58 |
+
*/
|
59 |
+
public $parser = null;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* It contains a class Cherry_Template_Loader.
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
* @access public
|
66 |
+
* @var object
|
67 |
+
*/
|
68 |
+
public $loader = null;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Cherry_Template_Manager constructor.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @access public
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function __construct( $core = null, $args = array() ) {
|
78 |
+
$this->include_class();
|
79 |
+
|
80 |
+
$this->args = array_merge_recursive(
|
81 |
+
$args,
|
82 |
+
$this->args
|
83 |
+
);
|
84 |
+
|
85 |
+
$this->set_class();
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Include abstract widget class
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
* @access public
|
93 |
+
* @return void
|
94 |
+
*/
|
95 |
+
public function include_class() {
|
96 |
+
require_once( dirname( __FILE__ ) . '/inc/cherry-template-loader.php' );
|
97 |
+
require_once( dirname( __FILE__ ) . '/inc/cherry-template-parser.php' );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Function set the child classes.
|
102 |
+
*
|
103 |
+
* @since 1.0.0
|
104 |
+
* @access public
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function set_class() {
|
108 |
+
$this->loader = Cherry_Template_Loader::get_instance( $this->args, $this );
|
109 |
+
$this->parser = Cherry_Template_Parser::get_instance( $this->args, $this );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Returns the instance.
|
114 |
+
*
|
115 |
+
* @since 1.0.0
|
116 |
+
* @access public
|
117 |
+
* @return object
|
118 |
+
*/
|
119 |
+
public static function get_instance() {
|
120 |
+
|
121 |
+
// If the single instance hasn't been set, set it now.
|
122 |
+
if ( null == self::$instance ) {
|
123 |
+
self::$instance = new self;
|
124 |
+
}
|
125 |
+
|
126 |
+
return self::$instance;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
cherry-framework/modules/cherry-template-manager/inc/cherry-template-loader.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Template Loader
|
4 |
+
* Description: Module load tmpl files.
|
5 |
+
* Version: 1.0.0
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.0.0
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_Template_Loader' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Cherry Template Loader.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Cherry_Template_Loader {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* A reference to an instance of this class.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var object
|
40 |
+
*/
|
41 |
+
private static $instance = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* A reference to an instance of this Cherry_Template_Manager class.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access private
|
48 |
+
* @var object
|
49 |
+
*/
|
50 |
+
private $cherry_template_manager_class = null;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Module arguments.
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access private
|
57 |
+
* @var array
|
58 |
+
*/
|
59 |
+
private $args = array(
|
60 |
+
'template_dir' => 'templates/%1$s/%2$s.tmpl',
|
61 |
+
'slug' => '',
|
62 |
+
'upload_dir' => '',
|
63 |
+
);
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Cherry_Template_Loader constructor.
|
67 |
+
*
|
68 |
+
* @since 1.0.0
|
69 |
+
* @access public
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function __construct( $args = array(), $main_class = null ) {
|
73 |
+
|
74 |
+
$this->args = array_merge_recursive(
|
75 |
+
$args,
|
76 |
+
$this->args
|
77 |
+
);
|
78 |
+
|
79 |
+
$this->cherry_template_manager_class = $main_class;
|
80 |
+
|
81 |
+
$this->set_default_variable();
|
82 |
+
$this->includes_file_system();
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Set the default variables.
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
90 |
+
* @access private
|
91 |
+
* @return void
|
92 |
+
*/
|
93 |
+
private function set_default_variable() {
|
94 |
+
if ( ! $this->args['slug'] ) {
|
95 |
+
$this->args['slug'] = $this->get_slug();
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( ! $this->args['upload_dir'] ) {
|
99 |
+
$get_upload_dir = wp_upload_dir();
|
100 |
+
$this->args['upload_dir'] = trailingslashit( $get_upload_dir['basedir'] );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Function Include file with class WP_Filesystem.
|
106 |
+
*
|
107 |
+
* @since 1.0.0
|
108 |
+
* @access private
|
109 |
+
* @return void
|
110 |
+
*/
|
111 |
+
private function includes_file_system() {
|
112 |
+
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
113 |
+
include_once( ABSPATH . '/wp-admin/includes/file.php' );
|
114 |
+
}
|
115 |
+
|
116 |
+
WP_Filesystem();
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Return product slug.
|
121 |
+
*
|
122 |
+
* @since 1.0.0
|
123 |
+
* @access private
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
private function get_slug() {
|
127 |
+
$file_dir = wp_normalize_path( __DIR__ );
|
128 |
+
$product_dir = $this->get_project_root();
|
129 |
+
|
130 |
+
$slug = str_replace( $product_dir, '', $file_dir );
|
131 |
+
preg_match( '/^[a-zA-Z-]*/' , $slug, $slug );
|
132 |
+
|
133 |
+
return $slug[0];
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Function return the project root dir, themes or plugins.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
* @access private
|
141 |
+
* @return string
|
142 |
+
*/
|
143 |
+
private function get_project_root() {
|
144 |
+
$themes_dir = wp_normalize_path( get_theme_root() );
|
145 |
+
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
|
146 |
+
$file_dir = wp_normalize_path( __DIR__ );
|
147 |
+
$project_root = ( false === strpos( $file_dir, $themes_dir ) ) ? $plugin_dir : $themes_dir;
|
148 |
+
|
149 |
+
return trailingslashit( $project_root );
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Retrieve a *.tmpl file content.
|
154 |
+
*
|
155 |
+
* @since 1.0.0
|
156 |
+
* @param string $name File name.
|
157 |
+
* @access private
|
158 |
+
* @return string|bool
|
159 |
+
*/
|
160 |
+
public function get_template_by_name( $name ) {
|
161 |
+
$file = '';
|
162 |
+
$template_dir = sprintf( $this->args['template_dir'], $this->args['slug'], $name );
|
163 |
+
$in_uploads = $this->args['upload_dir'] . $template_dir ;
|
164 |
+
$in_project = trailingslashit( $this->get_project_root() . $this->args['slug'] ) . $template_dir;
|
165 |
+
|
166 |
+
if ( file_exists( $in_uploads ) ) {
|
167 |
+
$file = $in_uploads;
|
168 |
+
} elseif ( $theme_template = locate_template( $template_dir ) ) {
|
169 |
+
$file = $theme_template;
|
170 |
+
} else {
|
171 |
+
$file = $in_project;
|
172 |
+
}
|
173 |
+
|
174 |
+
if ( ! empty( $file ) ) {
|
175 |
+
return $this->get_contents( $file );
|
176 |
+
} else {
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Read template (static).
|
183 |
+
*
|
184 |
+
* @since 1.0.0
|
185 |
+
* @param string $file Correct file path.
|
186 |
+
* @access public
|
187 |
+
* @return string|bool
|
188 |
+
*/
|
189 |
+
public function get_contents( $file ) {
|
190 |
+
global $wp_filesystem;
|
191 |
+
|
192 |
+
$file = wp_normalize_path( $file );
|
193 |
+
|
194 |
+
// Check for existence.
|
195 |
+
if ( ! $content = $wp_filesystem->get_contents( $file ) ) {
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( ! $content ) {
|
200 |
+
// Return error object.
|
201 |
+
return new WP_Error( 'reading_error', 'Error when reading file' );
|
202 |
+
}
|
203 |
+
|
204 |
+
return $content;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Returns the instance.
|
209 |
+
*
|
210 |
+
* @since 1.0.0
|
211 |
+
* @return object
|
212 |
+
*/
|
213 |
+
public static function get_instance( $args, $main_class ) {
|
214 |
+
|
215 |
+
// If the single instance hasn't been set, set it now.
|
216 |
+
if ( null == self::$instance ) {
|
217 |
+
self::$instance = new self( $args, $main_class );
|
218 |
+
}
|
219 |
+
|
220 |
+
return self::$instance;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
cherry-framework/modules/cherry-template-manager/inc/cherry-template-parser.php
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module Name: Template Parser
|
4 |
+
* Description: Module parsed tmpl files.
|
5 |
+
* Version: 1.0.0
|
6 |
+
* Author: Cherry Team
|
7 |
+
* Author URI: http://www.cherryframework.com/
|
8 |
+
* License: GPLv3
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
*
|
11 |
+
* @package Cherry_Framework
|
12 |
+
* @subpackage Modules
|
13 |
+
* @version 1.0.0
|
14 |
+
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
+
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
+
* @link http://www.cherryframework.com/
|
17 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
18 |
+
*/
|
19 |
+
|
20 |
+
// If this file is called directly, abort.
|
21 |
+
if ( ! defined( 'WPINC' ) ) {
|
22 |
+
die;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Cherry_Template_Parser' ) ) {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Cherry Template Parser.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Cherry_Template_Parser {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* A reference to an instance of this class.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var object
|
40 |
+
*/
|
41 |
+
private static $instance = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* A reference to an instance of this Cherry_Template_Manager class.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access private
|
48 |
+
* @var object
|
49 |
+
*/
|
50 |
+
private $cherry_template_manager_class = null;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Module arguments.
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access private
|
57 |
+
* @var array
|
58 |
+
*/
|
59 |
+
private $args = array(
|
60 |
+
'macros_callback' => '/%%.+?%%/',
|
61 |
+
'macros_variable' => '/\$\$.+?\$\$/',
|
62 |
+
);
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Keeps the user callbacks class.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
* @access private
|
69 |
+
* @var object
|
70 |
+
*/
|
71 |
+
private static $callbacks_class = null;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Cherry_Template_Parser constructor.
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
* @access public
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
public function __construct( $args = array(), $main_class = null ) {
|
81 |
+
$this->args = array_merge_recursive(
|
82 |
+
$args,
|
83 |
+
$this->args
|
84 |
+
);
|
85 |
+
|
86 |
+
$this->cherry_template_manager_class = $main_class;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Function parsed template.
|
91 |
+
*
|
92 |
+
* @since 1.0.0
|
93 |
+
* @param string $template_name Template Name.
|
94 |
+
* @param string|stdClass $class An instance or class name.
|
95 |
+
* @param string $macros_callback The regular expression for the callback.
|
96 |
+
* @param string $macros_variable The regular expression for the variable.
|
97 |
+
* @access public
|
98 |
+
* @return string|bool
|
99 |
+
*/
|
100 |
+
public function parsed_template( $template_name = false, $class = false, $macros_callback = false, $macros_variable = false ) {
|
101 |
+
if ( $template_name && $class ) {
|
102 |
+
|
103 |
+
if ( ! $macros_callback ) {
|
104 |
+
$macros_callback = $this->args['macros_callback'];
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( ! $macros_variable ) {
|
108 |
+
$macros_variable = $this->args['macros_variable'];
|
109 |
+
}
|
110 |
+
|
111 |
+
$search_form_template = $this->cherry_template_manager_class->loader->get_template_by_name( $template_name );
|
112 |
+
|
113 |
+
if ( ! $search_form_template ) {
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( 'string' === gettype( $class ) && class_exists( $class ) ) {
|
118 |
+
$class = new $class();
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( $class !== self::$callbacks_class ) {
|
122 |
+
self::$callbacks_class = $class;
|
123 |
+
}
|
124 |
+
|
125 |
+
$ouput = preg_replace_callback( $macros_callback, array( $this, 'replace_callback' ), $search_form_template );
|
126 |
+
$ouput = preg_replace_callback( $macros_variable, array( $this, 'replace_variable' ), $ouput );
|
127 |
+
|
128 |
+
return $ouput;
|
129 |
+
} else {
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Callback to replace macros with data.
|
137 |
+
*
|
138 |
+
* @since 1.0.0
|
139 |
+
* @param array $matches Founded macros.
|
140 |
+
* @access private
|
141 |
+
* @return string
|
142 |
+
*/
|
143 |
+
private function replace_callback( $matches ) {
|
144 |
+
|
145 |
+
if ( ! is_array( $matches ) ) {
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
|
149 |
+
if ( empty( $matches ) ) {
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
$item = trim( $matches[0], '%%' );
|
154 |
+
$arr = explode( ' ', $item, 2 );
|
155 |
+
$macros = strtolower( $arr[0] );
|
156 |
+
$attr = isset( $arr[1] ) ? shortcode_parse_atts( $arr[1] ) : array();
|
157 |
+
|
158 |
+
$callback = array( self::$callbacks_class, 'get_' . $macros );
|
159 |
+
|
160 |
+
if ( ! is_callable( $callback ) ) {
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
|
164 |
+
if ( ! empty( $attr ) ) {
|
165 |
+
// Call a WordPress function.
|
166 |
+
return call_user_func( $callback, $attr );
|
167 |
+
}
|
168 |
+
|
169 |
+
return call_user_func( $callback );
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Callback to replace macros with data.
|
174 |
+
*
|
175 |
+
* @since 1.0.0
|
176 |
+
* @param array $matches Founded macros.
|
177 |
+
* @access private
|
178 |
+
* @return string
|
179 |
+
*/
|
180 |
+
private function replace_variable( $matches ) {
|
181 |
+
|
182 |
+
if ( ! is_array( $matches ) ) {
|
183 |
+
return;
|
184 |
+
}
|
185 |
+
|
186 |
+
if ( empty( $matches ) ) {
|
187 |
+
return;
|
188 |
+
}
|
189 |
+
|
190 |
+
$item = trim( $matches[0], '$$' );
|
191 |
+
$arr = explode( ' ', $item, 2 );
|
192 |
+
$macros = strtoupper( $arr[0] );
|
193 |
+
|
194 |
+
if ( isset( self::$callbacks_class->variable ) && array_key_exists( $macros, self::$callbacks_class->variable ) ) {
|
195 |
+
$variable = self::$callbacks_class->variable[ $macros ];
|
196 |
+
} else {
|
197 |
+
return;
|
198 |
+
}
|
199 |
+
|
200 |
+
return $variable;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Returns the instance.
|
205 |
+
*
|
206 |
+
* @since 1.0.0
|
207 |
+
* @return object
|
208 |
+
*/
|
209 |
+
public static function get_instance( $args, $main_class ) {
|
210 |
+
|
211 |
+
// If the single instance hasn't been set, set it now.
|
212 |
+
if ( null == self::$instance ) {
|
213 |
+
self::$instance = new self( $args, $main_class );
|
214 |
+
}
|
215 |
+
|
216 |
+
return self::$instance;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
cherry-framework/modules/cherry-term-meta/cherry-term-meta.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: Term Meta
|
4 |
* Description: Manage term metadata
|
5 |
-
* Version: 1.1.
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -10,7 +10,7 @@
|
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
-
* @version 1.1.
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
@@ -29,13 +29,6 @@ if ( ! class_exists( 'Cherry_Term_Meta' ) ) {
|
|
29 |
*/
|
30 |
class Cherry_Term_Meta {
|
31 |
|
32 |
-
/**
|
33 |
-
* Module version
|
34 |
-
*
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $module_version = '1.1.1';
|
38 |
-
|
39 |
/**
|
40 |
* Module slug
|
41 |
*
|
@@ -123,6 +116,10 @@ if ( ! class_exists( 'Cherry_Term_Meta' ) ) {
|
|
123 |
|
124 |
array_walk( $this->args['fields'], array( $this, 'set_field_types' ) );
|
125 |
|
|
|
|
|
|
|
|
|
126 |
$this->ui_builder = $this->core->init_module( 'cherry-ui-elements', $this->field_types );
|
127 |
|
128 |
return true;
|
@@ -205,14 +202,27 @@ if ( ! class_exists( 'Cherry_Term_Meta' ) ) {
|
|
205 |
'upload_button_text' => Cherry_Toolkit::get_arg( $field, 'upload_button_text', 'Choose' ),
|
206 |
'max_value' => Cherry_Toolkit::get_arg( $field, 'max_value', '100' ),
|
207 |
'min_value' => Cherry_Toolkit::get_arg( $field, 'min_value', '0' ),
|
|
|
|
|
208 |
'step_value' => Cherry_Toolkit::get_arg( $field, 'step_value', '1' ),
|
209 |
'style' => Cherry_Toolkit::get_arg( $field, 'style', 'normal' ),
|
|
|
|
|
|
|
|
|
|
|
210 |
'toggle' => Cherry_Toolkit::get_arg( $field, 'toggle', array(
|
211 |
'true_toggle' => 'On',
|
212 |
'false_toggle' => 'Off',
|
213 |
'true_slave' => '',
|
214 |
'false_slave' => '',
|
215 |
) ),
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
);
|
217 |
|
218 |
$current_element = $this->ui_builder->get_ui_element_instance( $args['type'], $args );
|
2 |
/**
|
3 |
* Module Name: Term Meta
|
4 |
* Description: Manage term metadata
|
5 |
+
* Version: 1.1.4
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
+
* @version 1.1.4
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
29 |
*/
|
30 |
class Cherry_Term_Meta {
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Module slug
|
34 |
*
|
116 |
|
117 |
array_walk( $this->args['fields'], array( $this, 'set_field_types' ) );
|
118 |
|
119 |
+
if ( in_array( 'slider', $this->field_types ) ) {
|
120 |
+
$this->field_types[] = 'stepper';
|
121 |
+
}
|
122 |
+
|
123 |
$this->ui_builder = $this->core->init_module( 'cherry-ui-elements', $this->field_types );
|
124 |
|
125 |
return true;
|
202 |
'upload_button_text' => Cherry_Toolkit::get_arg( $field, 'upload_button_text', 'Choose' ),
|
203 |
'max_value' => Cherry_Toolkit::get_arg( $field, 'max_value', '100' ),
|
204 |
'min_value' => Cherry_Toolkit::get_arg( $field, 'min_value', '0' ),
|
205 |
+
'max' => Cherry_Toolkit::get_arg( $field, 'max', '100' ),
|
206 |
+
'min' => Cherry_Toolkit::get_arg( $field, 'min', '0' ),
|
207 |
'step_value' => Cherry_Toolkit::get_arg( $field, 'step_value', '1' ),
|
208 |
'style' => Cherry_Toolkit::get_arg( $field, 'style', 'normal' ),
|
209 |
+
'display_input' => Cherry_Toolkit::get_arg( $field, 'display_input', true ),
|
210 |
+
'controls' => Cherry_Toolkit::get_arg( $field, 'controls', array() ),
|
211 |
+
'fields' => Cherry_Toolkit::get_arg( $field, 'fields', array() ),
|
212 |
+
'auto_parse' => Cherry_Toolkit::get_arg( $field, 'auto_parse', false ),
|
213 |
+
'icon_data' => Cherry_Toolkit::get_arg( $field, 'icon_data', array() ),
|
214 |
'toggle' => Cherry_Toolkit::get_arg( $field, 'toggle', array(
|
215 |
'true_toggle' => 'On',
|
216 |
'false_toggle' => 'Off',
|
217 |
'true_slave' => '',
|
218 |
'false_slave' => '',
|
219 |
) ),
|
220 |
+
'class' => Cherry_Toolkit::get_arg( $field, 'class' ),
|
221 |
+
'required' => Cherry_Toolkit::get_arg( $field, 'required', false ),
|
222 |
+
'placeholder' => Cherry_Toolkit::get_arg( $field, 'placeholder' ),
|
223 |
+
'master' => Cherry_Toolkit::get_arg( $field, 'master' ),
|
224 |
+
'title_field' => Cherry_Toolkit::get_arg( $field, 'title_field' ),
|
225 |
+
'ui_kit' => Cherry_Toolkit::get_arg( $field, 'ui_kit', true ),
|
226 |
);
|
227 |
|
228 |
$current_element = $this->ui_builder->get_ui_element_instance( $args['type'], $args );
|
cherry-framework/modules/cherry-theme-updater/cherry-theme-updater.php
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* Module Name: Theme Updater
|
5 |
-
* Description: Provides functionality for updating themes
|
6 |
-
* Version: 1.1.0
|
7 |
-
* Author: Cherry Team
|
8 |
-
* Author URI: http://www.cherryframework.com/
|
9 |
-
* License: GPLv3
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
-
*
|
12 |
-
* @package Cherry_Framework
|
13 |
-
* @subpackage Modules
|
14 |
-
* @version 1.1.0
|
15 |
-
* @author Cherry Team <cherryframework@gmail.com>
|
16 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
17 |
-
* @link http://www.cherryframework.com/
|
18 |
-
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
19 |
-
*/
|
20 |
-
|
21 |
-
// If this file is called directly, abort.
|
22 |
-
if ( ! defined( 'WPINC' ) ) {
|
23 |
-
die;
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( ! class_exists( 'Cherry_Theme_Updater' ) ) {
|
27 |
-
require_once( '/inc/cherry-base-updater.php' );
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Define theme updater class.
|
31 |
-
*
|
32 |
-
* @since 1.0.0
|
33 |
-
*/
|
34 |
-
class Cherry_Theme_Updater extends Cherry_Base_Updater {
|
35 |
-
/**
|
36 |
-
* Updater settings.
|
37 |
-
*
|
38 |
-
* @var array
|
39 |
-
*/
|
40 |
-
protected $settings = array();
|
41 |
-
|
42 |
-
/**
|
43 |
-
* A reference to an instance of this class.
|
44 |
-
*
|
45 |
-
* @since 1.0.0
|
46 |
-
* @var object
|
47 |
-
*/
|
48 |
-
private static $instance = null;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Init class parameters.
|
52 |
-
*
|
53 |
-
* @since 1.0.0
|
54 |
-
* @param object $core core.
|
55 |
-
* @param array $args Input attributes array.
|
56 |
-
* @return void
|
57 |
-
*/
|
58 |
-
public function __construct( $core, $args = array() ) {
|
59 |
-
/**
|
60 |
-
* Set default settings
|
61 |
-
*/
|
62 |
-
$theme_headers = wp_get_theme();
|
63 |
-
|
64 |
-
$this->default_settings['slug'] = $theme_headers->get( 'Name' );
|
65 |
-
$this->default_settings['repository_name'] = $theme_headers->get( 'Name' );
|
66 |
-
$this->default_settings['version'] = $theme_headers->get( 'Version' );
|
67 |
-
|
68 |
-
$this->base_init( $args );
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Need for test update - set_site_transient( 'pre_set_site_transient_', null );
|
72 |
-
*/
|
73 |
-
add_action( 'pre_set_site_transient_update_themes', array( $this, 'update' ), 1, 1 );
|
74 |
-
add_filter( 'upgrader_source_selection', array( $this, 'rename_github_folder' ), 11, 3 );
|
75 |
-
add_filter( 'wp_prepare_themes_for_js', array( $this, 'change_details_url' ) );
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Process update.
|
80 |
-
*
|
81 |
-
* @since 1.0.0
|
82 |
-
* @param object $data Update data.
|
83 |
-
* @return object
|
84 |
-
*/
|
85 |
-
public function update( $data ) {
|
86 |
-
$new_update = $this->check_update();
|
87 |
-
|
88 |
-
if ( $new_update['version'] ) {
|
89 |
-
|
90 |
-
$update = array(
|
91 |
-
'theme' => $this->settings['slug'],
|
92 |
-
'new_version' => $new_update['version'],
|
93 |
-
'url' => $this->settings['details_url'],
|
94 |
-
'package' => $new_update['package'],
|
95 |
-
);
|
96 |
-
|
97 |
-
$data->response[ $this->settings['slug'] ] = $update;
|
98 |
-
}
|
99 |
-
return $data;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Change theme detail URL.
|
104 |
-
*
|
105 |
-
* @since 1.0.0
|
106 |
-
* @param array $prepared_themes array with update parametr.
|
107 |
-
*
|
108 |
-
* @return array
|
109 |
-
*/
|
110 |
-
public function change_details_url( $prepared_themes ) {
|
111 |
-
|
112 |
-
if ( ! empty( $prepared_themes ) ) {
|
113 |
-
|
114 |
-
foreach ( $prepared_themes as $theme_key => $theme_value ) {
|
115 |
-
|
116 |
-
if ( 'cherryframework4' === $theme_key || 'Cherry Framework' === $theme_value['parent'] ) {
|
117 |
-
|
118 |
-
if ( $theme_value['hasUpdate'] ) {
|
119 |
-
|
120 |
-
$prepared_themes[ $theme_key ]['update'] = str_replace( 'class="thickbox"', 'target ="_blank"', $theme_value['update'] );
|
121 |
-
}
|
122 |
-
|
123 |
-
remove_filter( 'wp_prepare_themes_for_js', array( $this, 'change_details_url' ) );
|
124 |
-
}
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
return $prepared_themes;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Returns the instance.
|
133 |
-
*
|
134 |
-
* @since 1.0.0
|
135 |
-
* @return object
|
136 |
-
*/
|
137 |
-
public static function get_instance( $core, $args ) {
|
138 |
-
return new self( $core, $args );
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-theme-updater/inc/cherry-base-updater.php
DELETED
@@ -1,156 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class for the base update.
|
4 |
-
*
|
5 |
-
* @package Cherry_Base_Updater
|
6 |
-
* @subpackage Base_Update
|
7 |
-
* @author Cherry Team <support@cherryframework.com>
|
8 |
-
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
-
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
|
13 |
-
// If this file is called directly, abort.
|
14 |
-
if ( ! defined( 'WPINC' ) ) {
|
15 |
-
die;
|
16 |
-
}
|
17 |
-
|
18 |
-
if ( ! class_exists( 'Cherry_Base_Updater' ) ) {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Test definitions to allow alpha and beta updates
|
22 |
-
*
|
23 |
-
* Disable updates - define('CHERRY_UPDATE', false);
|
24 |
-
* Enable auto updates - define('CHERRY_ALPHA_UPDATE', true);
|
25 |
-
* Enable beta updates - define('CHERRY_BETA_UPDATE', true);
|
26 |
-
*/
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Base updater class.
|
30 |
-
*
|
31 |
-
* @since 4.0.0
|
32 |
-
*/
|
33 |
-
class Cherry_Base_Updater {
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Default Settings.
|
37 |
-
*
|
38 |
-
* @since 4.0.0
|
39 |
-
* @access protected
|
40 |
-
* @var array
|
41 |
-
*/
|
42 |
-
protected $default_settings = array(
|
43 |
-
'version' => '',
|
44 |
-
'slug' => '',
|
45 |
-
'cloud_url' => 'https://cloud.cherryframework.com/cherry-update/',
|
46 |
-
'product_name' => 'CherryFramework',
|
47 |
-
'repository_name' => '',
|
48 |
-
);
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Init class parameters.
|
52 |
-
*
|
53 |
-
* @since 4.0.0
|
54 |
-
* @param array $settings Input attributes array.
|
55 |
-
* @return void
|
56 |
-
*/
|
57 |
-
protected function base_init( $settings = array() ) {
|
58 |
-
$this->settings = array_merge( $this->default_settings, $settings );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Check if update are avaliable.
|
63 |
-
*
|
64 |
-
* @since 4.0.0
|
65 |
-
* @return array
|
66 |
-
*/
|
67 |
-
protected function check_update() {
|
68 |
-
$args = array(
|
69 |
-
'user-agent' => 'WordPress',
|
70 |
-
'github_repository' => $this->settings['product_name'] . '/' . $this->settings['repository_name'],
|
71 |
-
'current_version' => $this->settings['version'],
|
72 |
-
'up_query_limit' => false,
|
73 |
-
'get_alpha' => false,
|
74 |
-
'get_beta' => false,
|
75 |
-
);
|
76 |
-
|
77 |
-
if ( defined( 'CHERRY_ALPHA_UPDATE' ) ) {
|
78 |
-
$args['get_alpha'] = true;
|
79 |
-
}
|
80 |
-
|
81 |
-
if ( defined( 'CHERRY_BETA_UPDATE' ) ) {
|
82 |
-
$args['get_beta'] = true;
|
83 |
-
}
|
84 |
-
|
85 |
-
if ( defined( 'CHERRY_UP_QUERY_LIMIT' ) ) {
|
86 |
-
$args['up_query_limit'] = true;
|
87 |
-
}
|
88 |
-
|
89 |
-
$response = $this -> remote_query( $args );
|
90 |
-
|
91 |
-
if ( $response && 'not_update' !== $response ) {
|
92 |
-
$this->settings['details_url'] = $response->details_url;
|
93 |
-
return array( 'version' => $response->new_version, 'package' => $response->package );
|
94 |
-
}
|
95 |
-
|
96 |
-
return array( 'version' => false );
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Remote request to updater API.
|
101 |
-
*
|
102 |
-
* @since 4.0.0
|
103 |
-
* @param array $args Request paprams.
|
104 |
-
* @return array|bool
|
105 |
-
*/
|
106 |
-
protected function remote_query( $args ) {
|
107 |
-
$query = add_query_arg( $args, $this->settings['cloud_url'] );
|
108 |
-
|
109 |
-
$response = wp_remote_get( $query );
|
110 |
-
|
111 |
-
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != '200' ) {
|
112 |
-
return false;
|
113 |
-
}
|
114 |
-
|
115 |
-
$response = json_decode( $response['body'] );
|
116 |
-
|
117 |
-
return $response;
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Rename github folder on update.
|
122 |
-
*
|
123 |
-
* @since 4.0.0
|
124 |
-
* @param [type] $upgrate_dir Theme folder name.
|
125 |
-
* @param [type] $remote_dir Remote folder name.
|
126 |
-
* @param object $skin_upgrader Upgrader object instance.
|
127 |
-
* @return string
|
128 |
-
*/
|
129 |
-
public function rename_github_folder( $upgrate_dir, $remote_dir, $skin_upgrader ) {
|
130 |
-
|
131 |
-
$slug = $this->settings['slug'];
|
132 |
-
$is_theme = isset( $skin_upgrader->skin->theme ) || isset( $skin_upgrader->skin->theme_info ) ? true : false ;
|
133 |
-
$is_plugin = isset( $skin_upgrader->skin->plugin_info ) ? true : false ;
|
134 |
-
$domain_plugin = $is_plugin ? $skin_upgrader->skin->plugin_info['TextDomain'] : '' ;
|
135 |
-
$title_plugin = $is_plugin ? str_replace( ' ', '-', strtolower( $skin_upgrader->skin->plugin_info['Title'] ) ) : '' ;
|
136 |
-
$name_plugin = $is_plugin ? str_replace( ' ', '-', strtolower( $skin_upgrader->skin->plugin_info['Name'] ) ) : '' ;
|
137 |
-
|
138 |
-
if ( $is_theme && strpos( $upgrate_dir, $slug ) !== false
|
139 |
-
|| $is_plugin && $domain_plugin === $slug
|
140 |
-
|| $is_plugin && $title_plugin === $slug
|
141 |
-
|| $is_plugin && $name_plugin === $slug
|
142 |
-
) {
|
143 |
-
$upgrate_dir_path = pathinfo( $upgrate_dir );
|
144 |
-
$new_upgrate_dir = trailingslashit( $upgrate_dir_path['dirname'] ) . trailingslashit( $slug );
|
145 |
-
|
146 |
-
rename( $upgrate_dir, $new_upgrate_dir );
|
147 |
-
|
148 |
-
$upgrate_dir = $new_upgrate_dir;
|
149 |
-
|
150 |
-
remove_filter( 'upgrader_source_selection', array( $this, 'rename_github_folder' ), 11, 3 );
|
151 |
-
}
|
152 |
-
|
153 |
-
return $upgrate_dir;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cherry-framework/modules/cherry-toolkit/cherry-toolkit.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: Framework Toolkit
|
4 |
* Description: Framework Toolkit contains various PHP utilities
|
5 |
-
* Version: 1.
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -10,6 +10,7 @@
|
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Class
|
|
|
13 |
* @author Cherry Team <cherryframework@gmail.com>
|
14 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
15 |
* @link http://www.cherryframework.com/
|
@@ -28,13 +29,6 @@ if ( ! class_exists( 'Cherry_Toolkit' ) ) {
|
|
28 |
*/
|
29 |
class Cherry_Toolkit {
|
30 |
|
31 |
-
/**
|
32 |
-
* Module version
|
33 |
-
*
|
34 |
-
* @var string Module version
|
35 |
-
*/
|
36 |
-
public $module_version = '1.1.0';
|
37 |
-
|
38 |
/**
|
39 |
* Module slug
|
40 |
*
|
@@ -185,6 +179,23 @@ if ( ! class_exists( 'Cherry_Toolkit' ) ) {
|
|
185 |
return $array;
|
186 |
}
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
/**
|
189 |
* Remove some keys form array
|
190 |
*
|
2 |
/**
|
3 |
* Module Name: Framework Toolkit
|
4 |
* Description: Framework Toolkit contains various PHP utilities
|
5 |
+
* Version: 1.2.0
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Class
|
13 |
+
* @version 1.2.0
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
29 |
*/
|
30 |
class Cherry_Toolkit {
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Module slug
|
34 |
*
|
179 |
return $array;
|
180 |
}
|
181 |
|
182 |
+
/**
|
183 |
+
* Safely get file content by path
|
184 |
+
*
|
185 |
+
* @param string $filepath Path to file.
|
186 |
+
* @return mixed
|
187 |
+
*/
|
188 |
+
public static function get_file( $filepath ) {
|
189 |
+
|
190 |
+
if ( ! file_exists( $filepath ) ) {
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
ob_start();
|
195 |
+
include $filepath;
|
196 |
+
return ob_get_clean();
|
197 |
+
}
|
198 |
+
|
199 |
/**
|
200 |
* Remove some keys form array
|
201 |
*
|
cherry-framework/modules/cherry-ui-elements/cherry-ui-elements.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Module Name: UI Elements
|
4 |
* Description: Class for the building ui elements
|
5 |
-
* Version: 1.
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
@@ -10,7 +10,7 @@
|
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
-
* @version 1.
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
@@ -52,6 +52,7 @@ if ( ! class_exists( 'Cherry_UI_Elements' ) ) {
|
|
52 |
'slider',
|
53 |
'repeater',
|
54 |
'iconpicker',
|
|
|
55 |
),
|
56 |
);
|
57 |
|
@@ -104,22 +105,23 @@ if ( ! class_exists( 'Cherry_UI_Elements' ) ) {
|
|
104 |
* Require UI-elements.
|
105 |
*
|
106 |
* @since 1.0.0
|
|
|
107 |
* @return void
|
108 |
*/
|
109 |
public function ui_elements_require() {
|
110 |
|
111 |
// Add I_UI interface.
|
112 |
if ( ! interface_exists( 'I_UI' ) ) {
|
113 |
-
require_once(
|
114 |
}
|
115 |
|
116 |
if ( ! class_exists( 'UI_Element' ) ) {
|
117 |
-
require_once(
|
118 |
}
|
119 |
|
120 |
if ( ! empty( $this->args['ui_elements'] ) ) {
|
121 |
foreach ( $this->args['ui_elements'] as $ui_element ) {
|
122 |
-
require_once(
|
123 |
}
|
124 |
}
|
125 |
}
|
2 |
/**
|
3 |
* Module Name: UI Elements
|
4 |
* Description: Class for the building ui elements
|
5 |
+
* Version: 1.3.0
|
6 |
* Author: Cherry Team
|
7 |
* Author URI: http://www.cherryframework.com/
|
8 |
* License: GPLv3
|
10 |
*
|
11 |
* @package Cherry_Framework
|
12 |
* @subpackage Modules
|
13 |
+
* @version 1.3.0
|
14 |
* @author Cherry Team <cherryframework@gmail.com>
|
15 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
16 |
* @link http://www.cherryframework.com/
|
52 |
'slider',
|
53 |
'repeater',
|
54 |
'iconpicker',
|
55 |
+
'button',
|
56 |
),
|
57 |
);
|
58 |
|
105 |
* Require UI-elements.
|
106 |
*
|
107 |
* @since 1.0.0
|
108 |
+
* @since 1.1.4 Using dirname( __FILE__ ) instead of __DIR__.
|
109 |
* @return void
|
110 |
*/
|
111 |
public function ui_elements_require() {
|
112 |
|
113 |
// Add I_UI interface.
|
114 |
if ( ! interface_exists( 'I_UI' ) ) {
|
115 |
+
require_once( dirname( __FILE__ ) . '/i-ui.php' );
|
116 |
}
|
117 |
|
118 |
if ( ! class_exists( 'UI_Element' ) ) {
|
119 |
+
require_once( dirname( __FILE__ ) . '/ui-element.php' );
|
120 |
}
|
121 |
|
122 |
if ( ! empty( $this->args['ui_elements'] ) ) {
|
123 |
foreach ( $this->args['ui_elements'] as $ui_element ) {
|
124 |
+
require_once( dirname( __FILE__ ) . '/inc/ui-elements/ui-' . $ui_element . '/ui-' . $ui_element . '.php' );
|
125 |
}
|
126 |
}
|
127 |
}
|
cherry-framework/modules/cherry-ui-elements/i-ui.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
* @link http://www.cherryframework.com/
|
10 |
-
* @license http://www.gnu.org/licenses/old-licenses/gpl-
|
11 |
*/
|
12 |
|
13 |
/**
|
7 |
* @author Cherry Team <cherryframework@gmail.com>
|
8 |
* @copyright Copyright (c) 2012 - 2016, Cherry Team
|
9 |
* @link http://www.cherryframework.com/
|
10 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
11 |
*/
|
12 |
|
13 |
/**
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/min/ui-button.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.ui-button{padding:16px 30px;display:inline-block;background-color:#96989a;font-weight:900;text-transform:uppercase;color:#fff;box-shadow:0px 0px 13px rgba(0,0,0,0.2);cursor:pointer;border-radius:4px;border:none;-webkit-transition:background 300ms ease-in-out;transition:background 300ms ease-in-out}.ui-button:hover{background-color:#b4b7ba}.ui-button:focus{outline:none}.ui-button.ui-button-normal-style{background-color:#495159}.ui-button.ui-button-normal-style:hover{background-color:#393f45}.ui-button.ui-button-success-style{background-color:#48c569}.ui-button.ui-button-success-style:hover{background-color:#3ba956}.ui-button.ui-button-primary-style{background-color:#298ffc}.ui-button.ui-button-primary-style:hover{background-color:#206ff4}.ui-button.ui-button-danger-style{background-color:#e54343}.ui-button.ui-button-danger-style:hover{background-color:#c73434}.ui-button.ui-button-warning-style{background-color:#faa730}.ui-button.ui-button-warning-style:hover{background-color:#ee8425}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-button.scss
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "ui-kit/variables";
|
2 |
+
@import "ui-kit/mixins";
|
3 |
+
|
4 |
+
.ui-button{
|
5 |
+
padding: 16px 30px;
|
6 |
+
display: inline-block;
|
7 |
+
background-color: $grey_color_1;
|
8 |
+
font-weight: 900;
|
9 |
+
text-transform: uppercase;
|
10 |
+
color: #fff;
|
11 |
+
box-shadow: 0px 0px 13px rgba(0, 0, 0, 0.2);
|
12 |
+
cursor: pointer;
|
13 |
+
border-radius: 4px;
|
14 |
+
border: none;
|
15 |
+
transition: background 300ms ease-in-out;
|
16 |
+
&:hover{
|
17 |
+
background-color: $grey_color_4;
|
18 |
+
}
|
19 |
+
&:focus{
|
20 |
+
outline: none;
|
21 |
+
}
|
22 |
+
&.ui-button-normal-style{
|
23 |
+
background-color: $normal_color;
|
24 |
+
&:hover{
|
25 |
+
background-color: $normal_color_h;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
&.ui-button-success-style{
|
29 |
+
background-color: $green_color;
|
30 |
+
&:hover{
|
31 |
+
background-color: $green_color_h;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
&.ui-button-primary-style{
|
35 |
+
background-color: $blue_color;
|
36 |
+
&:hover{
|
37 |
+
background-color: $blue_color_h;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
&.ui-button-danger-style{
|
41 |
+
background-color: $red_color;
|
42 |
+
&:hover{
|
43 |
+
background-color: $red_color_h;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
&.ui-button-warning-style{
|
47 |
+
background-color: $orange_color;
|
48 |
+
&:hover{
|
49 |
+
background-color: $orange_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-kit/_mixins.scss
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@mixin button_base() {
|
2 |
+
display: inline-block;
|
3 |
+
text-decoration: none;
|
4 |
+
font-size: 12px;
|
5 |
+
line-height: 20px;
|
6 |
+
font-weight: bold;
|
7 |
+
padding: 15px 20px;
|
8 |
+
color: #fff;
|
9 |
+
text-transform: uppercase;
|
10 |
+
border-radius: $border_radius_small;
|
11 |
+
transition: all 200ms linear;
|
12 |
+
box-shadow: $box_shadow;
|
13 |
+
&:hover {
|
14 |
+
color: #fff;
|
15 |
+
box-shadow: none;
|
16 |
+
}
|
17 |
+
&:focus,
|
18 |
+
&:active {
|
19 |
+
outline: none;
|
20 |
+
box-shadow: none;
|
21 |
+
color: #fff;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
@mixin button_normal() {
|
26 |
+
background: $dark_color_2;
|
27 |
+
&:hover {
|
28 |
+
background: $dark_color_2_h;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
@mixin button_primary() {
|
33 |
+
background: $blue_color;
|
34 |
+
&:hover {
|
35 |
+
background: $blue_color_h;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
@mixin button_success() {
|
40 |
+
background: $green_color;
|
41 |
+
&:hover {
|
42 |
+
background: $green_color_h;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
@mixin button_danger() {
|
47 |
+
background: $red_color;
|
48 |
+
&:hover {
|
49 |
+
background: $red_color_h;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
@mixin button_warning() {
|
54 |
+
background: $orange_color;
|
55 |
+
&:hover {
|
56 |
+
background: $orange_color_h;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
@mixin input() {
|
61 |
+
font-size: 14px;
|
62 |
+
line-height: 20px;
|
63 |
+
color: $dark_color_1;
|
64 |
+
background-color: $grey_color_3;
|
65 |
+
border-radius: $border_radius_extra_small;
|
66 |
+
padding: 10px 20px;
|
67 |
+
min-height: 50px;
|
68 |
+
border: 1px solid $grey_color_3;
|
69 |
+
box-shadow: none;
|
70 |
+
&:focus{
|
71 |
+
border-color: rgba(72,197,105,.6);
|
72 |
+
box-shadow: 0 0 2px rgba(72,197,105,.6);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
@mixin button_icon( $icon ) {
|
77 |
+
content: $icon;
|
78 |
+
display: inline-block;
|
79 |
+
font-family: dashicons;
|
80 |
+
font-size: 16px;
|
81 |
+
font-style: normal;
|
82 |
+
font-weight: 400;
|
83 |
+
height: 18px;
|
84 |
+
line-height: 18px;
|
85 |
+
text-align: center;
|
86 |
+
text-decoration: inherit;
|
87 |
+
transition: all 200ms linear;
|
88 |
+
vertical-align: middle;
|
89 |
+
}
|
90 |
+
|
91 |
+
@mixin button_icon_before( $icon ) {
|
92 |
+
&:before {
|
93 |
+
@include button_icon( $icon );
|
94 |
+
padding: 0 5px 0 0;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@mixin button_icon_after( $icon ) {
|
99 |
+
&:after {
|
100 |
+
@include button_icon( $icon );
|
101 |
+
padding: 0 0 0 5px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@mixin button_icon_middle( $icon ) {
|
106 |
+
&:before {
|
107 |
+
@include button_icon( $icon );
|
108 |
+
margin: 0 -5px;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
@mixin link() {
|
113 |
+
display: inline-block;
|
114 |
+
text-decoration: none;
|
115 |
+
font-size: 12px;
|
116 |
+
line-height: 20px;
|
117 |
+
font-weight: bold;
|
118 |
+
color: $blue_color;
|
119 |
+
text-transform: uppercase;
|
120 |
+
transition: all 200ms linear;
|
121 |
+
&:hover {
|
122 |
+
color: $dark_color_1;
|
123 |
+
box-shadow: none;
|
124 |
+
}
|
125 |
+
&:focus,
|
126 |
+
&:active {
|
127 |
+
outline: none;
|
128 |
+
box-shadow: none;
|
129 |
+
color: $blue_color;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
@mixin link_icon_before( $icon ) {
|
134 |
+
&:before {
|
135 |
+
@include button_icon( $icon );
|
136 |
+
padding: 0 5px 0 0;
|
137 |
+
color: $grey_color_4;
|
138 |
+
}
|
139 |
+
&:hover {
|
140 |
+
&:before {
|
141 |
+
color: $blue_color;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
@mixin container() {
|
147 |
+
padding: 30px;
|
148 |
+
border: 2px solid $grey_color_2;
|
149 |
+
background: $grey_color_3;
|
150 |
+
border-radius: $border_radius_large;
|
151 |
+
}
|
152 |
+
|
153 |
+
@mixin container_heading() {
|
154 |
+
margin: -30px -30px 30px -30px;
|
155 |
+
border-radius: $border_radius_large $border_radius_large 0 0;
|
156 |
+
border-bottom: 1px solid $grey_color_2;
|
157 |
+
padding: 20px 30px;
|
158 |
+
font-weight: bold;
|
159 |
+
font-size: 16px;
|
160 |
+
line-height: 18px;
|
161 |
+
text-align: center;
|
162 |
+
background: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
@mixin box() {
|
166 |
+
margin: 0 0 30px;
|
167 |
+
padding: 20px;
|
168 |
+
background: #fff;
|
169 |
+
box-shadow: $box_shadow_box;
|
170 |
+
border-radius: $border_radius;
|
171 |
+
}
|
172 |
+
|
173 |
+
@mixin box_heading() {
|
174 |
+
margin: -20px -20px 20px -20px;
|
175 |
+
border-radius: $border_radius_small $border_radius_small 0 0;
|
176 |
+
border-bottom: 1px solid $grey_color_2;
|
177 |
+
padding: 20px 30px;
|
178 |
+
font-weight: bold;
|
179 |
+
font-size: 16px;
|
180 |
+
line-height: 18px;
|
181 |
+
background: #fff;
|
182 |
+
}
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/assets/ui-kit/_variables.scss
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
$dark_color_1: #23282d;
|
2 |
+
$dark_color_2: #495159;
|
3 |
+
$dark_color_2_h: #393f45;
|
4 |
+
$grey_color_1: #96989a;
|
5 |
+
$grey_color_2: #e5e5e5;
|
6 |
+
$grey_color_3: #f1f1f1;
|
7 |
+
$grey_color_4: #b4b7ba;
|
8 |
+
$normal_color: #495159;
|
9 |
+
$normal_color_h: #393f45;
|
10 |
+
$blue_color: #298ffc;
|
11 |
+
$blue_color_h: #206ff4;
|
12 |
+
$green_color: #48c569;
|
13 |
+
$green_color_h: #3ba956;
|
14 |
+
$red_color: #e54343;
|
15 |
+
$red_color_h: #c73434;
|
16 |
+
$orange_color: #faa730;
|
17 |
+
$orange_color_h: #ee8425;
|
18 |
+
|
19 |
+
$border_radius_extra_small: 2px;
|
20 |
+
$border_radius_small: 4px;
|
21 |
+
$border_radius_medium: 6px;
|
22 |
+
$border_radius_large: 8px;
|
23 |
+
|
24 |
+
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
|
25 |
+
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
|
cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-button/ui-button.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|