Version Description
- Released: Jul 25, 2019 = New: Support to WooCommerce 3.7.0 Update: Plugin Core 3.3.7
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Ajax Search |
Version | 1.6.9 |
Comparing to | |
See all releases |
Code changes from version 1.6.8 to 1.6.9
- README.txt +5 -1
- class.yith-wcas-admin.php +13 -20
- init.php +3 -3
- plugin-fw/assets/css/admin.css +112 -33
- plugin-fw/assets/css/yith-fields.css +74 -34
- plugin-fw/assets/js/yit-plugin-panel.js +2 -3
- plugin-fw/assets/js/yit-plugin-panel.min.js +2 -2
- plugin-fw/assets/js/yith-fields.js +443 -419
- plugin-fw/assets/js/yith-fields.min.js +27 -1
- plugin-fw/assets/js/yith-system-info.js +13 -0
- plugin-fw/assets/js/yith-system-info.min.js +13 -0
- plugin-fw/init.php +2 -2
- plugin-fw/lib/promo/yith-promo.php +1 -1
- plugin-fw/lib/yit-assets.php +8 -9
- plugin-fw/lib/yit-plugin-panel-wc.php +81 -114
- plugin-fw/lib/yith-system-status.php +382 -0
- plugin-fw/templates/fields/colorpicker.php +1 -0
- plugin-fw/templates/fields/list-table.php +5 -2
- plugin-fw/templates/fields/radio.php +1 -1
- plugin-fw/templates/fields/upload.php +8 -8
- plugin-fw/templates/sysinfo/system-information-panel.php +135 -0
- plugin-fw/yit-functions.php +11 -0
- plugin-fw/yit-plugin.php +2 -0
- plugin-options/settings-options.php +15 -31
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
|
5 |
Requires at least: 4.0.0
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -138,6 +138,10 @@ If you have created your own language pack for YITH WooCommerce Ajax Search, or
|
|
138 |
2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
|
139 |
|
140 |
== Changelog ==
|
|
|
|
|
|
|
|
|
141 |
= 1.6.8 - Released: Jun 12, 2019 =
|
142 |
Update: Plugin Core 3.3.1
|
143 |
|
4 |
Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
|
5 |
Requires at least: 4.0.0
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 1.6.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
138 |
2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
|
139 |
|
140 |
== Changelog ==
|
141 |
+
= 1.6.9 - Released: Jul 25, 2019 =
|
142 |
+
New: Support to WooCommerce 3.7.0
|
143 |
+
Update: Plugin Core 3.3.7
|
144 |
+
|
145 |
= 1.6.8 - Released: Jun 12, 2019 =
|
146 |
Update: Plugin Core 3.3.1
|
147 |
|
class.yith-wcas-admin.php
CHANGED
@@ -54,14 +54,6 @@ if( !class_exists( 'YITH_WCAS_Admin' ) ) {
|
|
54 |
*/
|
55 |
protected $_panel_page = 'yith_wcas_panel';
|
56 |
|
57 |
-
/**
|
58 |
-
* Various links
|
59 |
-
*
|
60 |
-
* @var string
|
61 |
-
* @access public
|
62 |
-
* @since 1.0.0
|
63 |
-
*/
|
64 |
-
public $doc_url = 'https://docs.yithemes.com/yith-woocommerce-ajax-search/';
|
65 |
|
66 |
/**
|
67 |
* Constructor
|
@@ -136,18 +128,19 @@ if( !class_exists( 'YITH_WCAS_Admin' ) ) {
|
|
136 |
'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-search' ),
|
137 |
);
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
151 |
|
152 |
|
153 |
/* === Fixed: not updated theme === */
|
54 |
*/
|
55 |
protected $_panel_page = 'yith_wcas_panel';
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
/**
|
59 |
* Constructor
|
128 |
'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-search' ),
|
129 |
);
|
130 |
|
131 |
+
$args = array(
|
132 |
+
'create_menu_page' => true,
|
133 |
+
'parent_slug' => '',
|
134 |
+
'page_title' => __( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' ),
|
135 |
+
'menu_title' => __( 'Ajax Search', 'yith-woocommerce-ajax-search' ),
|
136 |
+
'capability' => 'manage_options',
|
137 |
+
'parent' => '',
|
138 |
+
'parent_page' => 'yith_plugin_panel',
|
139 |
+
'page' => $this->_panel_page,
|
140 |
+
'admin-tabs' => $admin_tabs,
|
141 |
+
'class' => yith_set_wrapper_class(),
|
142 |
+
'options-path' => YITH_WCAS_DIR . '/plugin-options'
|
143 |
+
);
|
144 |
|
145 |
|
146 |
/* === Fixed: not updated theme === */
|
init.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Search
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
|
5 |
* Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
-
* Version: 1.6.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-search
|
10 |
* Domain Path: /languages/
|
11 |
* WC requires at least: 3.0.0
|
12 |
-
* WC tested up to: 3.
|
13 |
*/
|
14 |
|
15 |
|
@@ -67,7 +67,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
|
67 |
if ( defined( 'YITH_WCAS_VERSION' ) ){
|
68 |
return;
|
69 |
}else{
|
70 |
-
define( 'YITH_WCAS_VERSION', '1.6.
|
71 |
}
|
72 |
|
73 |
if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
|
3 |
* Plugin Name: YITH WooCommerce Ajax Search
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
|
5 |
* Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 1.6.9
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-search
|
10 |
* Domain Path: /languages/
|
11 |
* WC requires at least: 3.0.0
|
12 |
+
* WC tested up to: 3.7.0
|
13 |
*/
|
14 |
|
15 |
|
67 |
if ( defined( 'YITH_WCAS_VERSION' ) ){
|
68 |
return;
|
69 |
}else{
|
70 |
+
define( 'YITH_WCAS_VERSION', '1.6.9' );
|
71 |
}
|
72 |
|
73 |
if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
|
plugin-fw/assets/css/admin.css
CHANGED
@@ -3,51 +3,51 @@
|
|
3 |
------------------------*/
|
4 |
#wpadminbar .yith-debug-admin-bar div,
|
5 |
#wpadminbar .yith-debug-admin-bar:hover div {
|
6 |
-
background
|
7 |
-
color
|
8 |
}
|
9 |
|
10 |
#wpadminbar .yith-debug-admin-bar a,
|
11 |
#wpadminbar .yith-debug-admin-bar strong {
|
12 |
-
color
|
13 |
}
|
14 |
|
15 |
#wpadminbar .yith-debug-admin-bar strong {
|
16 |
-
font-weight
|
17 |
}
|
18 |
|
19 |
#wpadminbar .yith-debug-admin-bar-post-meta .ab-empty-item,
|
20 |
#wpadminbar .yith-debug-admin-bar-option .ab-empty-item {
|
21 |
-
display
|
22 |
}
|
23 |
|
24 |
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-post-meta-default,
|
25 |
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-option-default {
|
26 |
-
padding
|
27 |
-
max-height
|
28 |
-
overflow-y
|
29 |
}
|
30 |
|
31 |
#wpadminbar .yith-debug-admin-bar pre {
|
32 |
-
padding
|
33 |
-
line-height
|
34 |
}
|
35 |
|
36 |
-
.notice-yith{
|
37 |
margin-left: 0;
|
38 |
border-left-color: #acc327;
|
39 |
}
|
40 |
|
41 |
-
.notice-yith.notice-alt{
|
42 |
background-color: #ecf7ed;
|
43 |
}
|
44 |
|
45 |
-
.yith-promo-banner-image-link{
|
46 |
display: block;
|
47 |
margin-bottom: 15px;
|
48 |
}
|
49 |
|
50 |
-
.yith-promo-banner-image{
|
51 |
max-width: 100%;
|
52 |
margin: 0 auto;
|
53 |
display: block;
|
@@ -57,7 +57,7 @@
|
|
57 |
YITH FEEDS
|
58 |
------------------------*/
|
59 |
|
60 |
-
.yith-feeds-logo{
|
61 |
display: table-cell;
|
62 |
background: #005b7c;
|
63 |
padding: 5px;
|
@@ -69,7 +69,7 @@
|
|
69 |
vertical-align: middle;
|
70 |
}
|
71 |
|
72 |
-
.yith-feeds-plugin-name{
|
73 |
display: table-cell;
|
74 |
vertical-align: middle;
|
75 |
}
|
@@ -77,41 +77,120 @@
|
|
77 |
/*-----------------------
|
78 |
YITH Plugins Columns
|
79 |
------------------------*/
|
80 |
-
@media screen and (min-width
|
81 |
|
82 |
.auto-fold #adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu-head {
|
83 |
-
width
|
84 |
}
|
85 |
|
86 |
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu {
|
87 |
-
min-width
|
88 |
-
display
|
89 |
-
flex-flow
|
90 |
}
|
91 |
|
92 |
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
93 |
-
width
|
94 |
-
border-left
|
95 |
-
box-sizing
|
96 |
}
|
97 |
|
98 |
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(2n) {
|
99 |
-
border-left
|
100 |
}
|
101 |
|
102 |
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu {
|
103 |
-
min-width
|
104 |
-
display
|
105 |
-
flex-flow
|
106 |
}
|
107 |
|
108 |
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
109 |
-
width
|
110 |
-
border-left
|
111 |
-
box-sizing
|
112 |
}
|
113 |
|
114 |
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(3n + 2) {
|
115 |
-
border-left
|
116 |
}
|
117 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
------------------------*/
|
4 |
#wpadminbar .yith-debug-admin-bar div,
|
5 |
#wpadminbar .yith-debug-admin-bar:hover div {
|
6 |
+
background: #05789c !important;
|
7 |
+
color: #fff !important;
|
8 |
}
|
9 |
|
10 |
#wpadminbar .yith-debug-admin-bar a,
|
11 |
#wpadminbar .yith-debug-admin-bar strong {
|
12 |
+
color: #fff !important;
|
13 |
}
|
14 |
|
15 |
#wpadminbar .yith-debug-admin-bar strong {
|
16 |
+
font-weight: 600;
|
17 |
}
|
18 |
|
19 |
#wpadminbar .yith-debug-admin-bar-post-meta .ab-empty-item,
|
20 |
#wpadminbar .yith-debug-admin-bar-option .ab-empty-item {
|
21 |
+
display: none;
|
22 |
}
|
23 |
|
24 |
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-post-meta-default,
|
25 |
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-option-default {
|
26 |
+
padding: 0;
|
27 |
+
max-height: 500px;
|
28 |
+
overflow-y: auto;
|
29 |
}
|
30 |
|
31 |
#wpadminbar .yith-debug-admin-bar pre {
|
32 |
+
padding: 10px;
|
33 |
+
line-height: 1.5em;
|
34 |
}
|
35 |
|
36 |
+
.notice-yith {
|
37 |
margin-left: 0;
|
38 |
border-left-color: #acc327;
|
39 |
}
|
40 |
|
41 |
+
.notice-yith.notice-alt {
|
42 |
background-color: #ecf7ed;
|
43 |
}
|
44 |
|
45 |
+
.yith-promo-banner-image-link {
|
46 |
display: block;
|
47 |
margin-bottom: 15px;
|
48 |
}
|
49 |
|
50 |
+
.yith-promo-banner-image {
|
51 |
max-width: 100%;
|
52 |
margin: 0 auto;
|
53 |
display: block;
|
57 |
YITH FEEDS
|
58 |
------------------------*/
|
59 |
|
60 |
+
.yith-feeds-logo {
|
61 |
display: table-cell;
|
62 |
background: #005b7c;
|
63 |
padding: 5px;
|
69 |
vertical-align: middle;
|
70 |
}
|
71 |
|
72 |
+
.yith-feeds-plugin-name {
|
73 |
display: table-cell;
|
74 |
vertical-align: middle;
|
75 |
}
|
77 |
/*-----------------------
|
78 |
YITH Plugins Columns
|
79 |
------------------------*/
|
80 |
+
@media screen and (min-width: 783px) {
|
81 |
|
82 |
.auto-fold #adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu-head {
|
83 |
+
width: 100%;
|
84 |
}
|
85 |
|
86 |
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu {
|
87 |
+
min-width: 320px;
|
88 |
+
display: flex;
|
89 |
+
flex-flow: row wrap;
|
90 |
}
|
91 |
|
92 |
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
93 |
+
width: 50%;
|
94 |
+
border-left: 1px solid #555;
|
95 |
+
box-sizing: border-box;
|
96 |
}
|
97 |
|
98 |
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(2n) {
|
99 |
+
border-left: none;
|
100 |
}
|
101 |
|
102 |
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu {
|
103 |
+
min-width: 480px;
|
104 |
+
display: flex;
|
105 |
+
flex-flow: row wrap;
|
106 |
}
|
107 |
|
108 |
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
109 |
+
width: calc(100% / 3);
|
110 |
+
border-left: 1px solid #555;
|
111 |
+
box-sizing: border-box;
|
112 |
}
|
113 |
|
114 |
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(3n + 2) {
|
115 |
+
border-left: none;
|
116 |
}
|
117 |
+
}
|
118 |
+
|
119 |
+
/*---------------------------
|
120 |
+
YITH System Information
|
121 |
+
----------------------------*/
|
122 |
+
.yith-phpinfo img {
|
123 |
+
float: right;
|
124 |
+
border: 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
#yith-system-alert span.yith-logo,
|
128 |
+
.yith-system-info h1 span.yith-logo {
|
129 |
+
border-radius: 50%;
|
130 |
+
background: #265b7a;
|
131 |
+
height: 30px;
|
132 |
+
width: 30px;
|
133 |
+
display: flex;
|
134 |
+
text-align: center;
|
135 |
+
margin: 0 10px 0 0;
|
136 |
+
float: left;
|
137 |
+
align-items: center;
|
138 |
+
justify-content: center;
|
139 |
+
}
|
140 |
+
|
141 |
+
.yith-system-info table {
|
142 |
+
margin: 20px 0;
|
143 |
+
}
|
144 |
+
|
145 |
+
.yith-system-info table th {
|
146 |
+
font-weight: bold;
|
147 |
+
width: 25%;
|
148 |
+
padding: 20px 12px;
|
149 |
+
}
|
150 |
+
|
151 |
+
.yith-system-info table td {
|
152 |
+
word-break: break-all;
|
153 |
+
padding: 20px 12px;
|
154 |
+
}
|
155 |
+
|
156 |
+
.yith-system-info table td.requirement-value {
|
157 |
+
font-size: 14px;
|
158 |
+
vertical-align: middle;
|
159 |
+
text-align: left;
|
160 |
+
color: #5da726;
|
161 |
+
line-height: 19px;
|
162 |
+
width: 90px;
|
163 |
+
}
|
164 |
+
|
165 |
+
.yith-system-info table td.requirement-value.has-errors {
|
166 |
+
color: #a00;
|
167 |
+
}
|
168 |
+
|
169 |
+
.yith-system-info table td.requirement-value.has-warnings {
|
170 |
+
color: #ffa200;
|
171 |
+
}
|
172 |
+
|
173 |
+
.yith-system-info table td.requirement-messages ul {
|
174 |
+
margin: 0;
|
175 |
+
padding: 0 0 10px 0;
|
176 |
+
list-style: none!important;
|
177 |
+
}
|
178 |
+
|
179 |
+
.yith-system-info table td.requirement-messages ul li {
|
180 |
+
margin-bottom: 3px;
|
181 |
+
}
|
182 |
+
|
183 |
+
.yith-system-info table td.requirement-messages ul li span.error {
|
184 |
+
color: #a00;
|
185 |
+
font-weight: bold;
|
186 |
+
}
|
187 |
+
|
188 |
+
.yith-system-info table td.requirement-messages ul li span.warning {
|
189 |
+
color: #a00;
|
190 |
+
font-weight: bold;
|
191 |
+
}
|
192 |
+
|
193 |
+
.yith-system-info-menu {
|
194 |
+
font-weight: bold;
|
195 |
+
font-size: 11px !important;
|
196 |
+
}
|
plugin-fw/assets/css/yith-fields.css
CHANGED
@@ -205,6 +205,7 @@ ul.yit-icons-manager-list li.active {
|
|
205 |
text-indent: -9999px;
|
206 |
display: block;
|
207 |
width: 36px;
|
|
|
208 |
height: 20px;
|
209 |
background: #a4a4a4;
|
210 |
border-radius: 24px;
|
@@ -212,6 +213,7 @@ ul.yit-icons-manager-list li.active {
|
|
212 |
transition: all 0.3s;
|
213 |
}
|
214 |
|
|
|
215 |
.yith-plugin-fw-onoff-container input + span:before {
|
216 |
content : '';
|
217 |
background : #fff;
|
@@ -568,7 +570,7 @@ YITH UI
|
|
568 |
margin-right: 2px;
|
569 |
background-color: #336374;
|
570 |
color: #fff;
|
571 |
-
font-size:
|
572 |
padding: 7px 20px;
|
573 |
border: 0;
|
574 |
}
|
@@ -596,14 +598,24 @@ YITH UI
|
|
596 |
padding: 15px 20px;
|
597 |
}
|
598 |
|
599 |
-
.yith-plugin-ui label{
|
600 |
color: #33373b;
|
601 |
-
font-size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
}
|
603 |
|
604 |
.yith-plugin-ui span.description{
|
605 |
color: #716269;
|
606 |
-
font-size:
|
607 |
font-style: normal;
|
608 |
font-weight: 400;
|
609 |
margin-top: 15px;
|
@@ -633,7 +645,7 @@ YITH UI
|
|
633 |
|
634 |
.yith-plugin-ui h2 {
|
635 |
color: #2a8db0;
|
636 |
-
font-size:
|
637 |
text-transform: uppercase;
|
638 |
border: 1px solid #d8d8d8;
|
639 |
border-bottom: 0;
|
@@ -661,7 +673,7 @@ YITH UI
|
|
661 |
|
662 |
.yith-plugin-ui #plugin-fw-wc h2 + div p, .yith-plugin-ui p.info-box{
|
663 |
background: #f1f1f1;
|
664 |
-
font-size:
|
665 |
font-weight: 700;
|
666 |
width: 40%;
|
667 |
display:block;
|
@@ -747,7 +759,7 @@ YITH UI
|
|
747 |
.woocommerce .yith-plugin-ui table.form-table select,
|
748 |
.yith-plugin-ui select{
|
749 |
-webkit-appearance: none;
|
750 |
-
line-height: 1;
|
751 |
min-height: 35px;
|
752 |
background: url("../images/arrow_down.svg") no-repeat right center;
|
753 |
background-size: 35px 13px;
|
@@ -980,7 +992,7 @@ YITH UI
|
|
980 |
border-radius: 12px;
|
981 |
padding: 3px 11px;
|
982 |
border-color: #33937e;
|
983 |
-
font-size:
|
984 |
}
|
985 |
|
986 |
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before{
|
@@ -1113,7 +1125,7 @@ YITH UI
|
|
1113 |
line-height: 20px;
|
1114 |
display: inline-block;
|
1115 |
color: #716269;
|
1116 |
-
font-size:
|
1117 |
}
|
1118 |
.yith-plugin-ui [type="radio"]:checked + label:before,
|
1119 |
.yith-plugin-ui [type="radio"]:not(:checked) + label:before {
|
@@ -1121,8 +1133,8 @@ YITH UI
|
|
1121 |
position: absolute;
|
1122 |
left: 0;
|
1123 |
top: 0;
|
1124 |
-
width:
|
1125 |
-
height:
|
1126 |
border: 1px solid #d8d8d8;
|
1127 |
border-radius: 100%;
|
1128 |
background: #fff;
|
@@ -1130,8 +1142,8 @@ YITH UI
|
|
1130 |
.yith-plugin-ui [type="radio"]:checked + label:after,
|
1131 |
.yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
1132 |
content: '';
|
1133 |
-
width:
|
1134 |
-
height:
|
1135 |
background: #4e8ba2;
|
1136 |
position: absolute;
|
1137 |
top: 4px;
|
@@ -1192,7 +1204,8 @@ YITH UI
|
|
1192 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
|
1193 |
border: 1px solid #d8d8d8;
|
1194 |
background-color: #fff;
|
1195 |
-
width:
|
|
|
1196 |
}
|
1197 |
|
1198 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before{
|
@@ -1202,18 +1215,22 @@ YITH UI
|
|
1202 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1203 |
width: 14px;
|
1204 |
height: 14px;
|
1205 |
-
top:
|
1206 |
-
left:
|
1207 |
background-color: #d8d8d8;
|
1208 |
}
|
1209 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after{
|
1210 |
content: 'OFF';
|
1211 |
width: 14px;
|
1212 |
height: 14px;
|
1213 |
-
font-size:
|
1214 |
-
|
|
|
1215 |
color: #979797;
|
|
|
|
|
1216 |
}
|
|
|
1217 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span,
|
1218 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input.onoffchecked + span{
|
1219 |
background-color: #fff;
|
@@ -1223,7 +1240,7 @@ YITH UI
|
|
1223 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1224 |
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before{
|
1225 |
background-color: #98aa36;
|
1226 |
-
left:
|
1227 |
}
|
1228 |
|
1229 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
@@ -1233,8 +1250,10 @@ YITH UI
|
|
1233 |
width: 14px;
|
1234 |
height: 14px;
|
1235 |
display: inline-block;
|
1236 |
-
font-size:
|
|
|
1237 |
padding: 0 10px;
|
|
|
1238 |
}
|
1239 |
|
1240 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
|
@@ -1374,15 +1393,15 @@ DATEPICKER
|
|
1374 |
}
|
1375 |
|
1376 |
/** colorpicker **/
|
1377 |
-
.yith-plugin-ui .yith-plugin-fw-
|
1378 |
-
.yith-plugin-ui .yith-plugin-fw-
|
1379 |
display: none !important;
|
1380 |
}
|
1381 |
-
.yith-plugin-ui .yith-plugin-fw-
|
1382 |
display: inline !important;
|
1383 |
}
|
1384 |
-
.yith-plugin-ui .yith-plugin-fw-
|
1385 |
-
.yith-plugin-ui .yith-plugin-fw-
|
1386 |
display: block !important;
|
1387 |
}
|
1388 |
.woocommerce .yith-plugin-ui .iris-picker{
|
@@ -1540,6 +1559,9 @@ DATEPICKER
|
|
1540 |
box-sizing: border-box;
|
1541 |
background: white;
|
1542 |
}
|
|
|
|
|
|
|
1543 |
.yith-plugin-ui .yith-add-box{
|
1544 |
padding: 30px 25px;
|
1545 |
display: none;
|
@@ -1551,6 +1573,7 @@ DATEPICKER
|
|
1551 |
.yith-plugin-ui .yith-toggle-title h3{
|
1552 |
padding: 0px 20px 0px 25px;
|
1553 |
margin: 0;
|
|
|
1554 |
display: inline-block;
|
1555 |
position: relative;
|
1556 |
min-width: 173px;
|
@@ -1572,7 +1595,7 @@ DATEPICKER
|
|
1572 |
display: block;
|
1573 |
cursor: pointer;
|
1574 |
left: 0px;
|
1575 |
-
top:
|
1576 |
bottom: 0;
|
1577 |
}
|
1578 |
.yith-plugin-ui .yith-toggle > span:before{
|
@@ -1597,7 +1620,7 @@ DATEPICKER
|
|
1597 |
padding: 30px 25px;
|
1598 |
}
|
1599 |
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content{
|
1600 |
-
|
1601 |
}
|
1602 |
.yith-plugin-ui .yith-add-box-row,
|
1603 |
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row{
|
@@ -1610,14 +1633,14 @@ DATEPICKER
|
|
1610 |
width: 250px;
|
1611 |
padding-right:40px;
|
1612 |
color: #33373b;
|
1613 |
-
font-size:
|
1614 |
vertical-align: top;
|
1615 |
font-weight: 600;
|
1616 |
}
|
1617 |
|
1618 |
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper),
|
1619 |
.yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
|
1620 |
-
|
1621 |
width: auto;
|
1622 |
float: none;
|
1623 |
vertical-align: middle;
|
@@ -1650,7 +1673,7 @@ DATEPICKER
|
|
1650 |
line-height: 1;
|
1651 |
}
|
1652 |
.yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle{
|
1653 |
-
|
1654 |
}
|
1655 |
.yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle-onoff{
|
1656 |
top: 25%;
|
@@ -1730,12 +1753,20 @@ DATEPICKER
|
|
1730 |
float: left;
|
1731 |
}
|
1732 |
|
|
|
|
|
|
|
|
|
1733 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
1734 |
-
width: calc(33% -
|
1735 |
-
padding-right:
|
1736 |
float: left;
|
1737 |
}
|
1738 |
|
|
|
|
|
|
|
|
|
1739 |
|
1740 |
.yith-plugin-fw-checkbox-field-wrapper {
|
1741 |
display: inline-block !important;
|
@@ -1785,10 +1816,18 @@ DATEPICKER
|
|
1785 |
}
|
1786 |
|
1787 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
1788 |
-
width: calc(50% -
|
1789 |
-
padding-right:
|
1790 |
float: left;
|
1791 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1792 |
}
|
1793 |
@media screen and (max-width: 782px){
|
1794 |
.yith-plugin-fw-banner.yith-plugin-fw-banner-free{
|
@@ -1815,6 +1854,7 @@ DATEPICKER
|
|
1815 |
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset,
|
1816 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset{
|
1817 |
width: 100%;
|
|
|
1818 |
}
|
1819 |
|
1820 |
}
|
205 |
text-indent: -9999px;
|
206 |
display: block;
|
207 |
width: 36px;
|
208 |
+
line-height: 1;
|
209 |
height: 20px;
|
210 |
background: #a4a4a4;
|
211 |
border-radius: 24px;
|
213 |
transition: all 0.3s;
|
214 |
}
|
215 |
|
216 |
+
|
217 |
.yith-plugin-fw-onoff-container input + span:before {
|
218 |
content : '';
|
219 |
background : #fff;
|
570 |
margin-right: 2px;
|
571 |
background-color: #336374;
|
572 |
color: #fff;
|
573 |
+
font-size: 15px;
|
574 |
padding: 7px 20px;
|
575 |
border: 0;
|
576 |
}
|
598 |
padding: 15px 20px;
|
599 |
}
|
600 |
|
601 |
+
.yith-plugin-ui.metaboxes-tab label{
|
602 |
color: #33373b;
|
603 |
+
font-size: 15px;
|
604 |
+
margin-left: -310px;
|
605 |
+
}
|
606 |
+
.yith-plugin-ui.metaboxes-tab .the-metabox{
|
607 |
+
margin: 40px 0 40px 290px;
|
608 |
+
margin-left:327px;
|
609 |
+
|
610 |
+
}
|
611 |
+
.yith-plugin-ui.metaboxes-tab label{
|
612 |
+
width:250px;
|
613 |
+
font-weight: 600;
|
614 |
}
|
615 |
|
616 |
.yith-plugin-ui span.description{
|
617 |
color: #716269;
|
618 |
+
font-size: 14px;
|
619 |
font-style: normal;
|
620 |
font-weight: 400;
|
621 |
margin-top: 15px;
|
645 |
|
646 |
.yith-plugin-ui h2 {
|
647 |
color: #2a8db0;
|
648 |
+
font-size: 15px;
|
649 |
text-transform: uppercase;
|
650 |
border: 1px solid #d8d8d8;
|
651 |
border-bottom: 0;
|
673 |
|
674 |
.yith-plugin-ui #plugin-fw-wc h2 + div p, .yith-plugin-ui p.info-box{
|
675 |
background: #f1f1f1;
|
676 |
+
font-size: 14px;
|
677 |
font-weight: 700;
|
678 |
width: 40%;
|
679 |
display:block;
|
759 |
.woocommerce .yith-plugin-ui table.form-table select,
|
760 |
.yith-plugin-ui select{
|
761 |
-webkit-appearance: none;
|
762 |
+
line-height: 1.2em;
|
763 |
min-height: 35px;
|
764 |
background: url("../images/arrow_down.svg") no-repeat right center;
|
765 |
background-size: 35px 13px;
|
992 |
border-radius: 12px;
|
993 |
padding: 3px 11px;
|
994 |
border-color: #33937e;
|
995 |
+
font-size: 13px;
|
996 |
}
|
997 |
|
998 |
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before{
|
1125 |
line-height: 20px;
|
1126 |
display: inline-block;
|
1127 |
color: #716269;
|
1128 |
+
font-size: 14px;
|
1129 |
}
|
1130 |
.yith-plugin-ui [type="radio"]:checked + label:before,
|
1131 |
.yith-plugin-ui [type="radio"]:not(:checked) + label:before {
|
1133 |
position: absolute;
|
1134 |
left: 0;
|
1135 |
top: 0;
|
1136 |
+
width: 19px;
|
1137 |
+
height: 19px;
|
1138 |
border: 1px solid #d8d8d8;
|
1139 |
border-radius: 100%;
|
1140 |
background: #fff;
|
1142 |
.yith-plugin-ui [type="radio"]:checked + label:after,
|
1143 |
.yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
1144 |
content: '';
|
1145 |
+
width: 13px;
|
1146 |
+
height: 13px;
|
1147 |
background: #4e8ba2;
|
1148 |
position: absolute;
|
1149 |
top: 4px;
|
1204 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
|
1205 |
border: 1px solid #d8d8d8;
|
1206 |
background-color: #fff;
|
1207 |
+
width: 60px;
|
1208 |
+
height: 24px;
|
1209 |
}
|
1210 |
|
1211 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before{
|
1215 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1216 |
width: 14px;
|
1217 |
height: 14px;
|
1218 |
+
top: 5px;
|
1219 |
+
left: 6px;
|
1220 |
background-color: #d8d8d8;
|
1221 |
}
|
1222 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after{
|
1223 |
content: 'OFF';
|
1224 |
width: 14px;
|
1225 |
height: 14px;
|
1226 |
+
font-size: 13px;
|
1227 |
+
font-weight: 600;
|
1228 |
+
padding-left: 27px;
|
1229 |
color: #979797;
|
1230 |
+
margin-top: 5px;
|
1231 |
+
display: inline-block;
|
1232 |
}
|
1233 |
+
|
1234 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span,
|
1235 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input.onoffchecked + span{
|
1236 |
background-color: #fff;
|
1240 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1241 |
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before{
|
1242 |
background-color: #98aa36;
|
1243 |
+
left: 41px;
|
1244 |
}
|
1245 |
|
1246 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
1250 |
width: 14px;
|
1251 |
height: 14px;
|
1252 |
display: inline-block;
|
1253 |
+
font-size: 13px;
|
1254 |
+
font-weight: 600;
|
1255 |
padding: 0 10px;
|
1256 |
+
margin-top: 5px;
|
1257 |
}
|
1258 |
|
1259 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
|
1393 |
}
|
1394 |
|
1395 |
/** colorpicker **/
|
1396 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .iris-picker,
|
1397 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-holder {
|
1398 |
display: none !important;
|
1399 |
}
|
1400 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap {
|
1401 |
display: inline !important;
|
1402 |
}
|
1403 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
|
1404 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .wp-picker-holder {
|
1405 |
display: block !important;
|
1406 |
}
|
1407 |
.woocommerce .yith-plugin-ui .iris-picker{
|
1559 |
box-sizing: border-box;
|
1560 |
background: white;
|
1561 |
}
|
1562 |
+
.yith-plugin-ui .yith-toggle-row{
|
1563 |
+
cursor: pointer;
|
1564 |
+
}
|
1565 |
.yith-plugin-ui .yith-add-box{
|
1566 |
padding: 30px 25px;
|
1567 |
display: none;
|
1573 |
.yith-plugin-ui .yith-toggle-title h3{
|
1574 |
padding: 0px 20px 0px 25px;
|
1575 |
margin: 0;
|
1576 |
+
margin-top: 4px;
|
1577 |
display: inline-block;
|
1578 |
position: relative;
|
1579 |
min-width: 173px;
|
1595 |
display: block;
|
1596 |
cursor: pointer;
|
1597 |
left: 0px;
|
1598 |
+
top: 4px;
|
1599 |
bottom: 0;
|
1600 |
}
|
1601 |
.yith-plugin-ui .yith-toggle > span:before{
|
1620 |
padding: 30px 25px;
|
1621 |
}
|
1622 |
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content{
|
1623 |
+
/* display: block;*/
|
1624 |
}
|
1625 |
.yith-plugin-ui .yith-add-box-row,
|
1626 |
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row{
|
1633 |
width: 250px;
|
1634 |
padding-right:40px;
|
1635 |
color: #33373b;
|
1636 |
+
font-size: 15px;
|
1637 |
vertical-align: top;
|
1638 |
font-weight: 600;
|
1639 |
}
|
1640 |
|
1641 |
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper),
|
1642 |
.yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
|
1643 |
+
/* display: table-cell;*/
|
1644 |
width: auto;
|
1645 |
float: none;
|
1646 |
vertical-align: middle;
|
1673 |
line-height: 1;
|
1674 |
}
|
1675 |
.yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle{
|
1676 |
+
top: auto;
|
1677 |
}
|
1678 |
.yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle-onoff{
|
1679 |
top: 25%;
|
1753 |
float: left;
|
1754 |
}
|
1755 |
|
1756 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset:nth-child(2n+1){
|
1757 |
+
clear: both;
|
1758 |
+
}
|
1759 |
+
|
1760 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
1761 |
+
width: calc(33% - 10px);
|
1762 |
+
padding-right: 10px;
|
1763 |
float: left;
|
1764 |
}
|
1765 |
|
1766 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1){
|
1767 |
+
clear: both;
|
1768 |
+
}
|
1769 |
+
|
1770 |
|
1771 |
.yith-plugin-fw-checkbox-field-wrapper {
|
1772 |
display: inline-block !important;
|
1816 |
}
|
1817 |
|
1818 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
1819 |
+
width: calc(50% - 10px);
|
1820 |
+
padding-right: 10px;
|
1821 |
float: left;
|
1822 |
}
|
1823 |
+
|
1824 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset:nth-child(2n+1){
|
1825 |
+
clear: both;
|
1826 |
+
}
|
1827 |
+
|
1828 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1){
|
1829 |
+
clear: initial;
|
1830 |
+
}
|
1831 |
}
|
1832 |
@media screen and (max-width: 782px){
|
1833 |
.yith-plugin-fw-banner.yith-plugin-fw-banner-free{
|
1854 |
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset,
|
1855 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset{
|
1856 |
width: 100%;
|
1857 |
+
clear: initial;
|
1858 |
}
|
1859 |
|
1860 |
}
|
plugin-fw/assets/js/yit-plugin-panel.js
CHANGED
@@ -7,8 +7,7 @@
|
|
7 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
8 |
*/
|
9 |
|
10 |
-
|
11 |
-
(function ( $ ) {
|
12 |
//dependencies handler
|
13 |
$( '[data-dep-target]' ).each( function () {
|
14 |
var t = $( this );
|
@@ -150,4 +149,4 @@
|
|
150 |
// prevents the WC message for changes when leaving the panel page
|
151 |
$( '.yith-plugin-fw-panel .woo-nav-tab-wrapper' ).removeClass( 'woo-nav-tab-wrapper' ).addClass( 'yith-nav-tab-wrapper' );
|
152 |
|
153 |
-
}
|
7 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
8 |
*/
|
9 |
|
10 |
+
jQuery( function ( $ ) {
|
|
|
11 |
//dependencies handler
|
12 |
$( '[data-dep-target]' ).each( function () {
|
13 |
var t = $( this );
|
149 |
// prevents the WC message for changes when leaving the panel page
|
150 |
$( '.yith-plugin-fw-panel .woo-nav-tab-wrapper' ).removeClass( 'woo-nav-tab-wrapper' ).addClass( 'yith-nav-tab-wrapper' );
|
151 |
|
152 |
+
} );
|
plugin-fw/assets/js/yit-plugin-panel.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,b){a instanceof String&&(a=String(a));for(var c=a.length,d=0;d<c;d++){var g=a[d];if(e.call(b,g,d,a))return{i:d,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,b){a!=Array.prototype&&a!=Object.prototype&&(a[e]=b.value)};
|
2 |
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,b,c){if(e){b=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var d=a[c];d in b||(b[d]={});b=b[d]}a=a[a.length-1];c=b[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:e})}};
|
3 |
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
-
(function(a){function e(b,c,d,e){var f=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var h=a(c).val();"checkbox"==a(c).attr("type")&&(h=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(h!=d[c])f=!1;else{f=!0;break}}d=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=d.closest(".yith-plugin-fw-panel-wc-row"));e=e.split("-");for(var g in e)if(h=e[g],f)switch(h){case "disable":b.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();
|
5 |
break;default:b.show()}else switch(h){case "disable":b.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;default:b.hide()}}a("[data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),d="#"+b.data("dep-id"),g=b.data("dep-value"),f=b.data("dep-type");e(c,d,g.toString(),f);a(d).on("change",function(){e(c,d,g.toString(),f)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,
|
6 |
update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+
|
7 |
-
("ga('create', '"+c+"', '"+d+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")})
|
1 |
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,b){a instanceof String&&(a=String(a));for(var c=a.length,d=0;d<c;d++){var g=a[d];if(e.call(b,g,d,a))return{i:d,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,b){a!=Array.prototype&&a!=Object.prototype&&(a[e]=b.value)};
|
2 |
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,b,c){if(e){b=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var d=a[c];d in b||(b[d]={});b=b[d]}a=a[a.length-1];c=b[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:e})}};
|
3 |
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
+
jQuery(function(a){function e(b,c,d,e){var f=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var h=a(c).val();"checkbox"==a(c).attr("type")&&(h=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(h!=d[c])f=!1;else{f=!0;break}}d=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=d.closest(".yith-plugin-fw-panel-wc-row"));e=e.split("-");for(var g in e)if(h=e[g],f)switch(h){case "disable":b.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();
|
5 |
break;default:b.show()}else switch(h){case "disable":b.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;default:b.hide()}}a("[data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),d="#"+b.data("dep-id"),g=b.data("dep-value"),f=b.data("dep-type");e(c,d,g.toString(),f);a(d).on("change",function(){e(c,d,g.toString(),f)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,
|
6 |
update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+
|
7 |
+
("ga('create', '"+c+"', '"+d+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")});
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -1,258 +1,270 @@
|
|
1 |
-
|
|
|
|
|
2 |
/* global yith_framework_fw_fields*/
|
3 |
|
4 |
var yith_fields_init = function () {
|
5 |
-
var $datepicker
|
6 |
-
$colorpicker
|
7 |
-
$upload
|
8 |
-
imgPreviewHandler: '.yith-plugin-fw-upload-img-preview',
|
9 |
uploadButtonHandler: '.yith-plugin-fw-upload-button',
|
10 |
-
imgUrlHandler: '.yith-plugin-fw-upload-img-url',
|
11 |
-
resetButtonHandler: '.yith-plugin-fw-upload-button-reset',
|
12 |
-
imgUrl: $('.yith-plugin-fw-upload-img-url')
|
13 |
},
|
14 |
-
$wpAddMedia
|
15 |
$imageGallery = {
|
16 |
-
sliderWrapper: $('.yith-plugin-fw .image-gallery ul.slides-wrapper'),
|
17 |
buttonHandler: '.yith-plugin-fw .image-gallery-button'
|
18 |
},
|
19 |
-
$sidebars
|
20 |
-
$slider
|
21 |
-
$codemirror
|
22 |
-
$icons
|
23 |
-
$checkgroup
|
24 |
|
25 |
/* Datepicker */
|
26 |
-
$datepicker.each(function () {
|
27 |
-
var args = $(this).data();
|
28 |
-
$(this).datepicker(args);
|
29 |
-
});
|
30 |
|
31 |
/* Colorpicker */
|
32 |
-
$colorpicker.wpColorPicker({
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
-
});
|
42 |
-
|
43 |
-
|
44 |
-
$colorpicker.each(function () {
|
45 |
-
var select_label = $(this).data('variations-label'),
|
46 |
-
wrap_main = $(this).closest( '.yith-plugin-fw-field-wrapper' ),
|
47 |
-
wrap = wrap_main.find('.wp-picker-input-wrap');
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
});
|
55 |
-
wrap.find( '.wp-picker-default' ).wrap( button );
|
56 |
}
|
57 |
-
});
|
58 |
-
|
59 |
|
60 |
|
61 |
/* Upload */
|
62 |
-
if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
|
63 |
var _custom_media = true;
|
64 |
// preview
|
65 |
-
$upload.imgUrl.change(function () {
|
66 |
-
var url
|
67 |
-
re
|
68 |
-
preview = $(this).parent().find($upload.imgPreviewHandler).first();
|
69 |
|
70 |
-
if (preview.length < 1)
|
71 |
-
preview = $(this).parent().parent().find($upload.imgPreviewHandler).first();
|
|
|
72 |
|
73 |
-
if (re.test(url)) {
|
74 |
-
preview.html('<img src="' + url + '" style="max-width:100px; max-height:100px;" />');
|
75 |
} else {
|
76 |
-
preview.html('');
|
77 |
}
|
78 |
-
}).trigger('change');
|
79 |
|
80 |
-
$(document).on('click', $upload.uploadButtonHandler, function (e) {
|
81 |
e.preventDefault();
|
82 |
|
83 |
-
var t
|
84 |
custom_uploader,
|
85 |
-
id = t.attr('id').replace(/-button$/, '');
|
86 |
|
87 |
//If the uploader object has already been created, reopen the dialog
|
88 |
-
if (custom_uploader) {
|
89 |
custom_uploader.open();
|
90 |
return;
|
91 |
}
|
92 |
|
93 |
var custom_uploader_states = [
|
94 |
// Main states.
|
95 |
-
new wp.media.controller.Library({
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
];
|
103 |
|
104 |
// Create the media frame.
|
105 |
-
custom_uploader = wp.media.frames.downloadable_file = wp.media({
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
|
118 |
//When a file is selected, grab the URL and set it as the text field's value
|
119 |
-
custom_uploader.on('select', function () {
|
120 |
-
var attachment = custom_uploader.state().get('selection').first().toJSON();
|
121 |
|
122 |
-
$("#" + id).val(attachment.url);
|
123 |
// Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
|
124 |
-
if ($("#" + id + "-yith-attachment-id")) {
|
125 |
-
$("#" + id + "-yith-attachment-id").val(attachment.id);
|
126 |
}
|
127 |
-
$upload.imgUrl.trigger('change');
|
128 |
-
});
|
129 |
|
130 |
//Open the uploader dialog
|
131 |
custom_uploader.open();
|
132 |
-
});
|
133 |
|
134 |
-
$(document).on('click', $upload.resetButtonHandler, function (e) {
|
135 |
-
var t
|
136 |
-
id
|
137 |
-
input_id
|
138 |
-
default_value = $('#' + id).data('default');
|
139 |
|
140 |
-
$("#" + input_id).val(default_value);
|
141 |
-
$upload.imgUrl.trigger('change');
|
142 |
-
});
|
143 |
}
|
144 |
|
145 |
-
$wpAddMedia.on('click', function () {
|
146 |
_custom_media = false;
|
147 |
-
});
|
148 |
|
149 |
/* Image Gallery */
|
150 |
-
if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
|
151 |
-
$(document).on('click', $imageGallery.buttonHandler, function (e) {
|
152 |
-
var $t
|
153 |
-
$container
|
154 |
-
$image_gallery_ids
|
155 |
-
attachment_ids
|
156 |
-
$gallery_images_wrapper = $container.find('ul.slides-wrapper');
|
157 |
|
158 |
// Create the media frame.
|
159 |
-
var image_gallery_frame = wp.media.frames.image_gallery = wp.media({
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
|
174 |
// When an image is selected, run a callback.
|
175 |
-
image_gallery_frame.on('select', function () {
|
176 |
-
var selection = image_gallery_frame.state().get('selection');
|
177 |
-
selection.map(function (attachment) {
|
178 |
attachment = attachment.toJSON();
|
179 |
|
180 |
-
if (attachment.id) {
|
181 |
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
|
182 |
-
$gallery_images_wrapper.append('<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data('delete') + '">x</a></li></ul></li>');
|
183 |
}
|
184 |
-
});
|
185 |
|
186 |
-
$image_gallery_ids.val(attachment_ids);
|
187 |
-
});
|
188 |
|
189 |
image_gallery_frame.open();
|
190 |
|
191 |
-
});
|
192 |
|
193 |
// Image ordering
|
194 |
-
$imageGallery.sliderWrapper.each(function () {
|
195 |
-
var $t = $(this);
|
196 |
-
$t.sortable({
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
});
|
222 |
|
223 |
// Remove images
|
224 |
-
$imageGallery.sliderWrapper.on('click', 'a.delete', function () {
|
225 |
-
var $wrapper
|
226 |
-
$gallery
|
227 |
-
$image_gallery_ids = $wrapper.find('.image_gallery_ids'),
|
228 |
-
attachment_ids
|
229 |
|
230 |
-
$(this).closest('li.image').remove();
|
231 |
|
232 |
-
$gallery.find('li.image').css('cursor', 'default').each(function () {
|
233 |
-
var attachment_id = $(this).attr('data-attachment_id');
|
234 |
-
attachment_ids
|
235 |
-
});
|
236 |
|
237 |
-
$image_gallery_ids.val(attachment_ids);
|
238 |
-
});
|
239 |
}
|
240 |
|
241 |
|
242 |
/* Sidebars */
|
243 |
-
$sidebars.each(function () {
|
244 |
-
var $images = $(this).find('img');
|
245 |
-
$images.on('click', function () {
|
246 |
-
var $container = $(this).closest('.yith-plugin-fw-sidebar-layout'),
|
247 |
-
$left
|
248 |
-
$right
|
249 |
-
type
|
250 |
-
|
251 |
-
$(this).parent().children(':radio').attr('checked', false);
|
252 |
-
$(this).prev(':radio').attr('checked', true);
|
253 |
-
|
254 |
-
if (typeof type != 'undefined') {
|
255 |
-
switch (type) {
|
256 |
case 'left':
|
257 |
$left.show();
|
258 |
$right.hide();
|
@@ -271,156 +283,156 @@ jQuery(function ($) {
|
|
271 |
break;
|
272 |
}
|
273 |
}
|
274 |
-
});
|
275 |
-
});
|
276 |
|
277 |
/* Slider */
|
278 |
-
$slider.each(function () {
|
279 |
-
var val
|
280 |
-
minValue = $(this).data('min'),
|
281 |
-
maxValue = $(this).data('max'),
|
282 |
-
step
|
283 |
-
labels
|
284 |
-
|
285 |
-
$(this).slider({
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
});
|
304 |
|
305 |
/* codemirror */
|
306 |
-
$codemirror.each(function (i, v) {
|
307 |
-
var editor = CodeMirror.fromTextArea(v, {
|
308 |
-
lineNumbers: 1,
|
309 |
-
mode: 'javascript',
|
310 |
showCursorWhenSelecting: true
|
311 |
-
});
|
312 |
|
313 |
-
$(v).data('codemirrorInstance', editor);
|
314 |
-
});
|
315 |
|
316 |
/* Select All - Deselect All */
|
317 |
-
$(document).on('click', '.yith-plugin-fw-select-all', function () {
|
318 |
-
var $targetSelect = $('#' + $(this).data('select-id'));
|
319 |
-
$targetSelect.find('option').prop('selected', true).trigger('change');
|
320 |
-
});
|
321 |
|
322 |
-
$(document).on('click', '.yith-plugin-fw-deselect-all', function () {
|
323 |
-
var $targetSelect = $('#' + $(this).data('select-id'));
|
324 |
-
$targetSelect.find('option').prop('selected', false).trigger('change');
|
325 |
-
});
|
326 |
|
327 |
|
328 |
-
$icons.each(function () {
|
329 |
-
var $container = $(this),
|
330 |
-
$preview
|
331 |
-
$text
|
332 |
|
333 |
-
$container.on('click', '.yit-icons-manager-list li', function (event) {
|
334 |
-
var $target = $(event.target).closest('li'),
|
335 |
-
font
|
336 |
-
icon
|
337 |
-
key
|
338 |
-
name
|
339 |
|
340 |
-
$preview.attr('data-font', font);
|
341 |
-
$preview.attr('data-icon', icon);
|
342 |
-
$preview.attr('data-key', key);
|
343 |
-
$preview.attr('data-name', name);
|
344 |
|
345 |
-
$text.val(font + ':' + name);
|
346 |
|
347 |
-
$container.find('.yit-icons-manager-list li').removeClass('active');
|
348 |
-
$target.addClass('active');
|
349 |
-
});
|
350 |
|
351 |
-
$container.on('click', '.yit-icons-manager-action-set-default', function () {
|
352 |
-
$container.find('.yit-icons-manager-list li.default').trigger('click');
|
353 |
-
});
|
354 |
-
});
|
355 |
|
356 |
/** Select Images */
|
357 |
-
$(document).on('click', '.yith-plugin-fw-select-images__item', function () {
|
358 |
-
var item
|
359 |
-
key
|
360 |
-
wrapper = item.closest('.yith-plugin-fw-select-images__wrapper'),
|
361 |
-
items
|
362 |
-
select
|
363 |
-
|
364 |
-
if (select.length) {
|
365 |
-
select.val(key);
|
366 |
-
items.removeClass('yith-plugin-fw-select-images__item--selected');
|
367 |
-
item.addClass('yith-plugin-fw-select-images__item--selected');
|
368 |
}
|
369 |
-
});
|
370 |
|
371 |
-
$(document.body).trigger('wc-enhanced-select-init');
|
372 |
|
373 |
-
$(document).find('.ui-sortable .yith-toggle-elements').sortable(
|
374 |
{
|
375 |
-
cursor: 'move',
|
376 |
-
axis: 'y',
|
377 |
-
scrollSensitivity: 40,
|
378 |
forcePlaceholderSize: true,
|
379 |
-
helper: 'clone',
|
380 |
|
381 |
-
stop: function (event, ui) {
|
382 |
-
var keys
|
383 |
-
i
|
384 |
array_keys = new Array();
|
385 |
-
for (i = 0; i < keys.length; i++) {
|
386 |
-
array_keys[i] = $(keys[i]).data('item_key');
|
387 |
}
|
388 |
-
if (array_keys.length > 0) {
|
389 |
-
var toggle = $(this).closest('.toggle-element');
|
390 |
-
toggle.saveToggleElement(null, array_keys);
|
391 |
}
|
392 |
}
|
393 |
}
|
394 |
);
|
395 |
|
396 |
-
$.each($checkgroup, function () {
|
397 |
-
var children = $(this).find('fieldset');
|
398 |
-
if (children.length > 3 && children.length < 6) {
|
399 |
-
$(this).addClass('two-cols')
|
400 |
}
|
401 |
-
if (children.length > 6) {
|
402 |
-
$(this).addClass('three-cols')
|
403 |
}
|
404 |
-
});
|
405 |
|
406 |
-
$(document.body).trigger('yith-framework-enhanced-select-init');
|
407 |
};
|
408 |
|
409 |
yith_fields_init();
|
410 |
|
411 |
/* on-off */
|
412 |
-
$(document).on('click', '.yith-plugin-fw-onoff-container span', function () {
|
413 |
-
var input
|
414 |
-
checked = input.prop('checked');
|
415 |
|
416 |
-
if (checked) {
|
417 |
-
input.prop('checked', false).attr('value', 'no').removeClass('onoffchecked');
|
418 |
} else {
|
419 |
-
input.prop('checked', true).attr('value', 'yes').addClass('onoffchecked');
|
420 |
}
|
421 |
|
422 |
input.change();
|
423 |
-
});
|
424 |
|
425 |
|
426 |
/** Toggle **/
|
@@ -428,222 +440,234 @@ jQuery(function ($) {
|
|
428 |
|
429 |
|
430 |
//TOGGLE ELEMENT
|
431 |
-
$.fn.saveToggleElement = function (spinner, array_keys) {
|
432 |
-
var toggle
|
433 |
-
action
|
434 |
-
formdata
|
435 |
-
id
|
436 |
-
current_tab = $.urlParam('tab');
|
437 |
-
|
438 |
-
if (typeof array_keys != 'undefined' && array_keys.length > 0) {
|
439 |
-
formdata.append('yith_toggle_elements_order_keys', array_keys);
|
440 |
}
|
441 |
|
442 |
-
if (toggle.closest('.metaboxes-tab.yith-plugin-ui').length) {
|
443 |
-
action
|
444 |
-
post_id
|
445 |
-
yit_metaboxes_nonce = $(this).closest('form#post').find('#yit_metaboxes_nonce').val();
|
446 |
-
url
|
447 |
} else {
|
448 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
449 |
}
|
450 |
|
451 |
-
$.ajax({
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
};
|
466 |
|
467 |
$.fn.serializeToggleElement = function () {
|
468 |
-
var obj = $(this);
|
469 |
/* ADD FILE TO PARAM AJAX */
|
470 |
var formData = new FormData();
|
471 |
-
var params
|
472 |
|
473 |
-
$.each(params, function (i, val) {
|
474 |
el_name = val.name;
|
475 |
-
formData.append(val.name, val.value);
|
476 |
-
});
|
477 |
|
478 |
return formData;
|
479 |
};
|
480 |
|
481 |
$.fn.formatToggleTitle = function () {
|
482 |
-
var toggle_el = $(this),
|
483 |
-
fields
|
484 |
-
title
|
485 |
-
subtitle
|
486 |
-
regExp
|
487 |
|
488 |
-
if (typeof title != 'undefined') {
|
489 |
var res = title.match( regExp );
|
490 |
}
|
491 |
|
492 |
-
if (typeof subtitle != 'undefined') {
|
493 |
var ressub = subtitle.match( regExp );
|
494 |
}
|
495 |
|
496 |
-
$.each(fields, function (i, field) {
|
497 |
-
if (typeof $(field).attr('id') != 'undefined') {
|
498 |
-
$field_id
|
499 |
-
$field_array = $field_id.split('_');
|
500 |
$field_array.pop();
|
501 |
-
$field_id
|
502 |
-
$field_val = $(field).val();
|
503 |
|
504 |
-
if (res != null && typeof res != 'undefined' && res.indexOf($field_id) !== -1) {
|
505 |
-
title = title.replace('%%' + $field_id + '%%', $field_val);
|
506 |
}
|
507 |
-
if (ressub != null && typeof ressub != 'undefined' && ressub.indexOf($field_id) !== -1) {
|
508 |
-
subtitle = subtitle.replace('%%' + $field_id + '%%', $field_val);
|
509 |
}
|
510 |
}
|
511 |
-
});
|
512 |
|
513 |
-
if ('' !== title) {
|
514 |
-
toggle_el.find('span.title').html(title);
|
515 |
}
|
516 |
|
517 |
-
if ('' !== subtitle) {
|
518 |
-
toggle_el.find('.subtitle').html(subtitle);
|
519 |
}
|
520 |
|
521 |
-
$(document).trigger('yith-toggle-element-item-title', [toggle_el]);
|
522 |
};
|
523 |
|
524 |
-
$.urlParam = function (name) {
|
525 |
-
var results = new RegExp('[\?&]' + name + '=([^&#]*)')
|
526 |
-
.exec(window.location.search);
|
527 |
|
528 |
-
return (results !== null) ? results[1] || 0 : false;
|
529 |
};
|
530 |
|
531 |
-
$(document).on('click', '.yith-toggle', function (event) {
|
532 |
-
var _toggle
|
533 |
-
_section = _toggle.closest('.yith-toggle-row'),
|
534 |
-
_content = _section.find('.yith-toggle-content');
|
|
|
|
|
|
|
|
|
535 |
|
536 |
-
if (_section.is('.yith-toggle-row-opened')) {
|
537 |
-
_content.slideUp(400);
|
538 |
} else {
|
539 |
-
_content.slideDown(400);
|
540 |
}
|
541 |
-
_section.toggleClass('yith-toggle-row-opened');
|
542 |
-
});
|
543 |
|
544 |
/**Add new box toggle**/
|
545 |
-
$(document).on('click', '.yith-add-box-button', function (event) {
|
546 |
event.preventDefault();
|
547 |
-
var target_id = $(this).data('box_id'),
|
548 |
-
id
|
549 |
-
template
|
550 |
-
if ('' !== target_id) {
|
551 |
-
$('#' + target_id).html(template({index: 'box_id'})).slideToggle();
|
552 |
yith_fields_init();
|
553 |
-
$(document).trigger('yith-add-box-button-toggle', [$(this)]);
|
554 |
}
|
555 |
-
});
|
556 |
|
557 |
-
$(document).on('click', '.yith-add-box-buttons .yith-save-button', function (event) {
|
558 |
event.preventDefault();
|
559 |
-
var add_box
|
560 |
-
id
|
561 |
-
spinner
|
562 |
-
toggle_element = $(this).parents('.toggle-element'),
|
563 |
-
fields
|
564 |
-
counter
|
565 |
-
hidden_obj
|
566 |
-
hidden_obj.val(counter);
|
567 |
-
$(document).trigger('yith-toggle-change-counter', [hidden_obj, add_box]);
|
568 |
-
|
569 |
-
counter
|
570 |
-
var template
|
571 |
-
toggle_el = $(template({index: counter}));
|
572 |
-
|
573 |
-
spinner.addClass('show');
|
574 |
-
|
575 |
-
$.each(fields, function (i, field) {
|
576 |
-
if (typeof $(field).attr('id') != 'undefined') {
|
577 |
-
|
578 |
-
$field_id
|
579 |
-
$field_val = $(field).val();
|
580 |
-
|
581 |
-
if ('radio' == $(field).attr('type')) {
|
582 |
-
$field_id = $field_id.replace('new_', '');
|
583 |
-
$field_id = $field_id.replace('-' + $field_val, '');
|
584 |
$field_id = $field_id + '_dataindex-' + $field_val;
|
585 |
} else {
|
586 |
-
$field_id = $field_id.replace('new_', '') + '_' + counter;
|
587 |
}
|
588 |
|
589 |
-
if ($(field).is(':checked')) {
|
590 |
-
$(toggle_el).find('#' + $field_id).prop('checked', true);
|
591 |
}
|
592 |
|
593 |
-
if ($(field).hasClass('yith-post-search') || $(field).hasClass('yith-term-search')) {
|
594 |
-
$(toggle_el).find('#' + $field_id).html($('#' + $(field).attr('id')).html());
|
595 |
}
|
596 |
|
597 |
-
$(toggle_el).find('#' + $field_id).val($field_val);
|
598 |
|
599 |
}
|
600 |
|
601 |
-
});
|
602 |
|
603 |
-
$(toggle_el).formatToggleTitle();
|
604 |
-
var form_is_valid = $('<input type="hidden">').val('yes');
|
605 |
-
$(document).trigger('yith-toggle-element-item-before-add', [add_box, toggle_el, form_is_valid]);
|
606 |
|
607 |
|
608 |
-
if (form_is_valid.val() === 'yes') {
|
609 |
-
$(toggle_element).find('.yith-toggle-elements').append(toggle_el);
|
610 |
-
$(add_box).find('.yith-plugin-fw-datepicker').datepicker('destroy');
|
611 |
-
$(add_box).html('').toggle();
|
612 |
toggle_element.saveToggleElement();
|
613 |
yith_fields_init();
|
614 |
}
|
615 |
-
});
|
616 |
|
617 |
-
$(document).on('click', '.yith-toggle-row .yith-save-button', function (event) {
|
618 |
event.preventDefault();
|
619 |
-
var toggle
|
620 |
-
toggle_row = $(this).closest('.yith-toggle-row'),
|
621 |
-
spinner
|
622 |
toggle_row.formatToggleTitle();
|
623 |
|
624 |
-
var form_is_valid = $('<input type="hidden">').val('yes');
|
625 |
-
$(document).trigger('yith-toggle-element-item-before-update', [toggle, toggle_row, form_is_valid]);
|
626 |
-
if (form_is_valid.val() === 'yes') {
|
627 |
-
spinner.addClass('show');
|
628 |
-
toggle.saveToggleElement(spinner);
|
629 |
}
|
630 |
-
});
|
631 |
|
632 |
//register remove the dome and save the toggle
|
633 |
-
$(document).on('click', '.yith-toggle-row .yith-delete-button', function (event) {
|
634 |
event.preventDefault();
|
635 |
-
var toggle
|
636 |
-
toggle_row = $(this).closest('.yith-toggle-row');
|
637 |
toggle_row.remove();
|
638 |
toggle.saveToggleElement();
|
639 |
-
});
|
640 |
|
641 |
//register onoff status
|
642 |
-
$(document).on('click', '.yith-toggle-onoff', function (event) {
|
643 |
event.preventDefault();
|
644 |
-
var toggle = $(this).closest('.toggle-element');
|
645 |
toggle.saveToggleElement();
|
646 |
-
});
|
|
|
|
|
|
|
|
|
|
|
647 |
|
|
|
|
|
|
|
648 |
|
649 |
-
});
|
1 |
+
|
2 |
+
jQuery( function ( $ ) {
|
3 |
+
|
4 |
/* global yith_framework_fw_fields*/
|
5 |
|
6 |
var yith_fields_init = function () {
|
7 |
+
var $datepicker = $( '.yith-plugin-fw-datepicker' ),
|
8 |
+
$colorpicker = $( '.yith-plugin-fw-colorpicker' ),
|
9 |
+
$upload = {
|
10 |
+
imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
|
11 |
uploadButtonHandler: '.yith-plugin-fw-upload-button',
|
12 |
+
imgUrlHandler : '.yith-plugin-fw-upload-img-url',
|
13 |
+
resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
|
14 |
+
imgUrl : $( '.yith-plugin-fw-upload-img-url' )
|
15 |
},
|
16 |
+
$wpAddMedia = $( '.add_media' ),
|
17 |
$imageGallery = {
|
18 |
+
sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
|
19 |
buttonHandler: '.yith-plugin-fw .image-gallery-button'
|
20 |
},
|
21 |
+
$sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
|
22 |
+
$slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
|
23 |
+
$codemirror = $( '.codemirror' ),
|
24 |
+
$icons = $( '.yit-icons-manager-wrapper' ),
|
25 |
+
$checkgroup = $( ".yith-plugin-ui td.forminp-checkbox" );
|
26 |
|
27 |
/* Datepicker */
|
28 |
+
$datepicker.each( function () {
|
29 |
+
var args = $( this ).data();
|
30 |
+
$( this ).datepicker( args );
|
31 |
+
} );
|
32 |
|
33 |
/* Colorpicker */
|
34 |
+
$colorpicker.wpColorPicker( {
|
35 |
+
palettes: false,
|
36 |
+
width : 200,
|
37 |
+
mode : 'hsl',
|
38 |
+
clear : function () {
|
39 |
+
var input = $( this );
|
40 |
+
input.val( input.data( 'default-color' ) );
|
41 |
+
input.change();
|
42 |
+
}
|
43 |
+
} );
|
44 |
+
|
45 |
+
|
46 |
+
$colorpicker.each( function () {
|
47 |
+
var select_label = $( this ).data( 'variations-label' ),
|
48 |
+
wrap_main1 = $( this ).closest( '.yith-plugin-fw-colorpicker-field-wrapper' ),
|
49 |
+
wrap_main2 = $( this ).closest( '.yith-single-colorpicker' ),
|
50 |
+
wrap1 = wrap_main1.find( '.wp-picker-input-wrap' ),
|
51 |
+
wrap2 = wrap_main2.find( '.wp-picker-input-wrap' );
|
52 |
+
|
53 |
+
wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
|
54 |
+
wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
|
55 |
+
|
56 |
+
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
57 |
+
var button = $( '<span/>' ).attr( {
|
58 |
+
class: "wp-picker-default-custom"
|
59 |
+
} );
|
60 |
+
wrap1.find( '.wp-picker-default' ).wrap( button );
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
64 |
+
var button = $( '<span/>' ).attr( {
|
65 |
+
class: "wp-picker-default-custom"
|
66 |
+
} );
|
67 |
+
wrap2.find( '.wp-picker-default' ).wrap( button );
|
|
|
|
|
68 |
}
|
69 |
+
} );
|
|
|
70 |
|
71 |
|
72 |
/* Upload */
|
73 |
+
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
74 |
var _custom_media = true;
|
75 |
// preview
|
76 |
+
$upload.imgUrl.change( function () {
|
77 |
+
var url = $( this ).val(),
|
78 |
+
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)" ),
|
79 |
+
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
80 |
|
81 |
+
if ( preview.length < 1 ) {
|
82 |
+
preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
|
83 |
+
}
|
84 |
|
85 |
+
if ( re.test( url ) ) {
|
86 |
+
preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
|
87 |
} else {
|
88 |
+
preview.html( '' );
|
89 |
}
|
90 |
+
} ).trigger( 'change' );
|
91 |
|
92 |
+
$( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
|
93 |
e.preventDefault();
|
94 |
|
95 |
+
var t = $( this ),
|
96 |
custom_uploader,
|
97 |
+
id = t.attr( 'id' ).replace( /-button$/, '' );
|
98 |
|
99 |
//If the uploader object has already been created, reopen the dialog
|
100 |
+
if ( custom_uploader ) {
|
101 |
custom_uploader.open();
|
102 |
return;
|
103 |
}
|
104 |
|
105 |
var custom_uploader_states = [
|
106 |
// Main states.
|
107 |
+
new wp.media.controller.Library( {
|
108 |
+
library : wp.media.query(),
|
109 |
+
multiple : false,
|
110 |
+
title : 'Choose Image',
|
111 |
+
priority : 20,
|
112 |
+
filterable: 'uploaded'
|
113 |
+
} )
|
114 |
];
|
115 |
|
116 |
// Create the media frame.
|
117 |
+
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
118 |
+
// Set the title of the modal.
|
119 |
+
title : 'Choose Image',
|
120 |
+
library : {
|
121 |
+
type: ''
|
122 |
+
},
|
123 |
+
button : {
|
124 |
+
text: 'Choose Image'
|
125 |
+
},
|
126 |
+
multiple: false,
|
127 |
+
states : custom_uploader_states
|
128 |
+
} );
|
129 |
|
130 |
//When a file is selected, grab the URL and set it as the text field's value
|
131 |
+
custom_uploader.on( 'select', function () {
|
132 |
+
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
133 |
|
134 |
+
$( "#" + id ).val( attachment.url );
|
135 |
// Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
|
136 |
+
if ( $( "#" + id + "-yith-attachment-id" ) ) {
|
137 |
+
$( "#" + id + "-yith-attachment-id" ).val( attachment.id );
|
138 |
}
|
139 |
+
$upload.imgUrl.trigger( 'change' );
|
140 |
+
} );
|
141 |
|
142 |
//Open the uploader dialog
|
143 |
custom_uploader.open();
|
144 |
+
} );
|
145 |
|
146 |
+
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
147 |
+
var t = $( this ),
|
148 |
+
id = t.attr( 'id' ),
|
149 |
+
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
|
150 |
+
default_value = $( '#' + id ).data( 'default' );
|
151 |
|
152 |
+
$( "#" + input_id ).val( default_value );
|
153 |
+
$upload.imgUrl.trigger( 'change' );
|
154 |
+
} );
|
155 |
}
|
156 |
|
157 |
+
$wpAddMedia.on( 'click', function () {
|
158 |
_custom_media = false;
|
159 |
+
} );
|
160 |
|
161 |
/* Image Gallery */
|
162 |
+
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
163 |
+
$( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
|
164 |
+
var $t = $( this ),
|
165 |
+
$container = $t.closest( '.image-gallery' ),
|
166 |
+
$image_gallery_ids = $container.find( '.image_gallery_ids' ),
|
167 |
+
attachment_ids = $image_gallery_ids.val(),
|
168 |
+
$gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
|
169 |
|
170 |
// Create the media frame.
|
171 |
+
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
172 |
+
// Set the title of the modal.
|
173 |
+
title : $t.data( 'choose' ),
|
174 |
+
button: {
|
175 |
+
text: $t.data( 'update' )
|
176 |
+
},
|
177 |
+
states: [
|
178 |
+
new wp.media.controller.Library( {
|
179 |
+
title : $t.data( 'choose' ),
|
180 |
+
filterable: 'all',
|
181 |
+
multiple : true
|
182 |
+
} )
|
183 |
+
]
|
184 |
+
} );
|
185 |
|
186 |
// When an image is selected, run a callback.
|
187 |
+
image_gallery_frame.on( 'select', function () {
|
188 |
+
var selection = image_gallery_frame.state().get( 'selection' );
|
189 |
+
selection.map( function ( attachment ) {
|
190 |
attachment = attachment.toJSON();
|
191 |
|
192 |
+
if ( attachment.id ) {
|
193 |
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
|
194 |
+
$gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
|
195 |
}
|
196 |
+
} );
|
197 |
|
198 |
+
$image_gallery_ids.val( attachment_ids );
|
199 |
+
} );
|
200 |
|
201 |
image_gallery_frame.open();
|
202 |
|
203 |
+
} );
|
204 |
|
205 |
// Image ordering
|
206 |
+
$imageGallery.sliderWrapper.each( function () {
|
207 |
+
var $t = $( this );
|
208 |
+
$t.sortable( {
|
209 |
+
items : 'li.image',
|
210 |
+
cursor : 'move',
|
211 |
+
scrollSensitivity : 40,
|
212 |
+
forcePlaceholderSize: true,
|
213 |
+
forceHelperSize : false,
|
214 |
+
helper : 'clone',
|
215 |
+
opacity : 0.65,
|
216 |
+
start : function ( event, ui ) {
|
217 |
+
ui.item.css( 'background-color', '#f6f6f6' );
|
218 |
+
},
|
219 |
+
stop : function ( event, ui ) {
|
220 |
+
ui.item.removeAttr( 'style' );
|
221 |
+
},
|
222 |
+
update : function ( event, ui ) {
|
223 |
+
var attachment_ids = '';
|
224 |
+
|
225 |
+
$t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
226 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
227 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
228 |
+
} );
|
229 |
+
|
230 |
+
$t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
|
231 |
+
}
|
232 |
+
} );
|
233 |
+
} );
|
234 |
|
235 |
// Remove images
|
236 |
+
$imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
|
237 |
+
var $wrapper = $( this ).closest( '.image-gallery' ),
|
238 |
+
$gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
|
239 |
+
$image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
|
240 |
+
attachment_ids = '';
|
241 |
|
242 |
+
$( this ).closest( 'li.image' ).remove();
|
243 |
|
244 |
+
$gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
245 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
246 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
247 |
+
} );
|
248 |
|
249 |
+
$image_gallery_ids.val( attachment_ids );
|
250 |
+
} );
|
251 |
}
|
252 |
|
253 |
|
254 |
/* Sidebars */
|
255 |
+
$sidebars.each( function () {
|
256 |
+
var $images = $( this ).find( 'img' );
|
257 |
+
$images.on( 'click', function () {
|
258 |
+
var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
|
259 |
+
$left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
|
260 |
+
$right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
|
261 |
+
type = $( this ).data( 'type' );
|
262 |
+
|
263 |
+
$( this ).parent().children( ':radio' ).attr( 'checked', false );
|
264 |
+
$( this ).prev( ':radio' ).attr( 'checked', true );
|
265 |
+
|
266 |
+
if ( typeof type != 'undefined' ) {
|
267 |
+
switch ( type ) {
|
268 |
case 'left':
|
269 |
$left.show();
|
270 |
$right.hide();
|
283 |
break;
|
284 |
}
|
285 |
}
|
286 |
+
} );
|
287 |
+
} );
|
288 |
|
289 |
/* Slider */
|
290 |
+
$slider.each( function () {
|
291 |
+
var val = $( this ).data( 'val' ),
|
292 |
+
minValue = $( this ).data( 'min' ),
|
293 |
+
maxValue = $( this ).data( 'max' ),
|
294 |
+
step = $( this ).data( 'step' ),
|
295 |
+
labels = $( this ).data( 'labels' );
|
296 |
+
|
297 |
+
$( this ).slider( {
|
298 |
+
value: val,
|
299 |
+
min : minValue,
|
300 |
+
max : maxValue,
|
301 |
+
range: 'min',
|
302 |
+
step : step,
|
303 |
+
|
304 |
+
create: function () {
|
305 |
+
$( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
|
306 |
+
},
|
307 |
+
|
308 |
+
|
309 |
+
slide: function ( event, ui ) {
|
310 |
+
$( this ).find( 'input' ).val( ui.value );
|
311 |
+
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
312 |
+
$( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
|
313 |
+
}
|
314 |
+
} );
|
315 |
+
} );
|
316 |
|
317 |
/* codemirror */
|
318 |
+
$codemirror.each( function ( i, v ) {
|
319 |
+
var editor = CodeMirror.fromTextArea( v, {
|
320 |
+
lineNumbers : 1,
|
321 |
+
mode : 'javascript',
|
322 |
showCursorWhenSelecting: true
|
323 |
+
} );
|
324 |
|
325 |
+
$( v ).data( 'codemirrorInstance', editor );
|
326 |
+
} );
|
327 |
|
328 |
/* Select All - Deselect All */
|
329 |
+
$( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
|
330 |
+
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
331 |
+
$targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
|
332 |
+
} );
|
333 |
|
334 |
+
$( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
|
335 |
+
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
336 |
+
$targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
|
337 |
+
} );
|
338 |
|
339 |
|
340 |
+
$icons.each( function () {
|
341 |
+
var $container = $( this ),
|
342 |
+
$preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
|
343 |
+
$text = $container.find( '.yit-icons-manager-icon-text' );
|
344 |
|
345 |
+
$container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
|
346 |
+
var $target = $( event.target ).closest( 'li' ),
|
347 |
+
font = $target.data( 'font' ),
|
348 |
+
icon = $target.data( 'icon' ),
|
349 |
+
key = $target.data( 'key' ),
|
350 |
+
name = $target.data( 'name' );
|
351 |
|
352 |
+
$preview.attr( 'data-font', font );
|
353 |
+
$preview.attr( 'data-icon', icon );
|
354 |
+
$preview.attr( 'data-key', key );
|
355 |
+
$preview.attr( 'data-name', name );
|
356 |
|
357 |
+
$text.val( font + ':' + name );
|
358 |
|
359 |
+
$container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
|
360 |
+
$target.addClass( 'active' );
|
361 |
+
} );
|
362 |
|
363 |
+
$container.on( 'click', '.yit-icons-manager-action-set-default', function () {
|
364 |
+
$container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
|
365 |
+
} );
|
366 |
+
} );
|
367 |
|
368 |
/** Select Images */
|
369 |
+
$( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
|
370 |
+
var item = $( this ),
|
371 |
+
key = item.data( 'key' ),
|
372 |
+
wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
|
373 |
+
items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
|
374 |
+
select = wrapper.find( 'select' ).first();
|
375 |
+
|
376 |
+
if ( select.length ) {
|
377 |
+
select.val( key );
|
378 |
+
items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
|
379 |
+
item.addClass( 'yith-plugin-fw-select-images__item--selected' );
|
380 |
}
|
381 |
+
} );
|
382 |
|
383 |
+
$( document.body ).trigger( 'wc-enhanced-select-init' );
|
384 |
|
385 |
+
$( document ).find( '.ui-sortable .yith-toggle-elements' ).sortable(
|
386 |
{
|
387 |
+
cursor : 'move',
|
388 |
+
axis : 'y',
|
389 |
+
scrollSensitivity : 40,
|
390 |
forcePlaceholderSize: true,
|
391 |
+
helper : 'clone',
|
392 |
|
393 |
+
stop: function ( event, ui ) {
|
394 |
+
var keys = jQuery( '.ui-sortable-handle' ),
|
395 |
+
i = 0,
|
396 |
array_keys = new Array();
|
397 |
+
for ( i = 0; i < keys.length; i++ ) {
|
398 |
+
array_keys[ i ] = $( keys[ i ] ).data( 'item_key' );
|
399 |
}
|
400 |
+
if ( array_keys.length > 0 ) {
|
401 |
+
var toggle = $( this ).closest( '.toggle-element' );
|
402 |
+
toggle.saveToggleElement( null, array_keys );
|
403 |
}
|
404 |
}
|
405 |
}
|
406 |
);
|
407 |
|
408 |
+
$.each( $checkgroup, function () {
|
409 |
+
var children = $( this ).find( 'fieldset' );
|
410 |
+
if ( children.length > 3 && children.length < 6 ) {
|
411 |
+
$( this ).addClass( 'two-cols' )
|
412 |
}
|
413 |
+
if ( children.length > 6 ) {
|
414 |
+
$( this ).addClass( 'three-cols' )
|
415 |
}
|
416 |
+
} );
|
417 |
|
418 |
+
$( document.body ).trigger( 'yith-framework-enhanced-select-init' );
|
419 |
};
|
420 |
|
421 |
yith_fields_init();
|
422 |
|
423 |
/* on-off */
|
424 |
+
$( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
|
425 |
+
var input = $( this ).prev( 'input' ),
|
426 |
+
checked = input.prop( 'checked' );
|
427 |
|
428 |
+
if ( checked ) {
|
429 |
+
input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
|
430 |
} else {
|
431 |
+
input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
|
432 |
}
|
433 |
|
434 |
input.change();
|
435 |
+
} );
|
436 |
|
437 |
|
438 |
/** Toggle **/
|
440 |
|
441 |
|
442 |
//TOGGLE ELEMENT
|
443 |
+
$.fn.saveToggleElement = function ( spinner, array_keys ) {
|
444 |
+
var toggle = $( this ),
|
445 |
+
action = 'yith_plugin_fw_save_toggle_element',
|
446 |
+
formdata = toggle.serializeToggleElement(),
|
447 |
+
id = toggle.find( '.yith-toggle_wrapper' ).attr( 'id' ),
|
448 |
+
current_tab = $.urlParam( 'tab' );
|
449 |
+
|
450 |
+
if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
|
451 |
+
formdata.append( 'yith_toggle_elements_order_keys', array_keys );
|
452 |
}
|
453 |
|
454 |
+
if ( toggle.closest( '.metaboxes-tab.yith-plugin-ui' ).length ) {
|
455 |
+
action = 'yith_plugin_fw_save_toggle_element_metabox';
|
456 |
+
post_id = $( this ).closest( 'form#post' ).find( '#post_ID' ).val();
|
457 |
+
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
458 |
+
url = yith_framework_fw_fields.ajax_url + '?action=' + action + "&post_ID=" + post_id + '&yit_metaboxes_nonce=' + yit_metaboxes_nonce + "&toggle_id=" + id;
|
459 |
} else {
|
460 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
461 |
}
|
462 |
|
463 |
+
$.ajax( {
|
464 |
+
type : "POST",
|
465 |
+
url : url,
|
466 |
+
data : formdata,
|
467 |
+
contentType: false,
|
468 |
+
processData: false,
|
469 |
+
success : function ( result ) {
|
470 |
+
if ( spinner ) {
|
471 |
+
spinner.removeClass( 'show' );
|
472 |
+
}
|
473 |
|
474 |
+
$( document ).trigger( 'yith_save_toggle_element_done', [ result, toggle ] );
|
475 |
+
}
|
476 |
+
} );
|
477 |
};
|
478 |
|
479 |
$.fn.serializeToggleElement = function () {
|
480 |
+
var obj = $( this );
|
481 |
/* ADD FILE TO PARAM AJAX */
|
482 |
var formData = new FormData();
|
483 |
+
var params = $( obj ).find( ":input" ).serializeArray();
|
484 |
|
485 |
+
$.each( params, function ( i, val ) {
|
486 |
el_name = val.name;
|
487 |
+
formData.append( val.name, val.value );
|
488 |
+
} );
|
489 |
|
490 |
return formData;
|
491 |
};
|
492 |
|
493 |
$.fn.formatToggleTitle = function () {
|
494 |
+
var toggle_el = $( this ),
|
495 |
+
fields = toggle_el.find( ':input' ),
|
496 |
+
title = toggle_el.find( 'span.title' ).data( 'title_format' ),
|
497 |
+
subtitle = toggle_el.find( '.subtitle' ).data( 'subtitle_format' ),
|
498 |
+
regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
|
499 |
|
500 |
+
if ( typeof title != 'undefined' ) {
|
501 |
var res = title.match( regExp );
|
502 |
}
|
503 |
|
504 |
+
if ( typeof subtitle != 'undefined' ) {
|
505 |
var ressub = subtitle.match( regExp );
|
506 |
}
|
507 |
|
508 |
+
$.each( fields, function ( i, field ) {
|
509 |
+
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
510 |
+
$field_id = $( field ).attr( 'id' );
|
511 |
+
$field_array = $field_id.split( '_' );
|
512 |
$field_array.pop();
|
513 |
+
$field_id = $field_array.join( '_' );
|
514 |
+
$field_val = $( field ).val();
|
515 |
|
516 |
+
if ( res != null && typeof res != 'undefined' && res.indexOf( $field_id ) !== -1 ) {
|
517 |
+
title = title.replace( '%%' + $field_id + '%%', $field_val );
|
518 |
}
|
519 |
+
if ( ressub != null && typeof ressub != 'undefined' && ressub.indexOf( $field_id ) !== -1 ) {
|
520 |
+
subtitle = subtitle.replace( '%%' + $field_id + '%%', $field_val );
|
521 |
}
|
522 |
}
|
523 |
+
} );
|
524 |
|
525 |
+
if ( '' !== title ) {
|
526 |
+
toggle_el.find( 'span.title' ).html( title );
|
527 |
}
|
528 |
|
529 |
+
if ( '' !== subtitle ) {
|
530 |
+
toggle_el.find( '.subtitle' ).html( subtitle );
|
531 |
}
|
532 |
|
533 |
+
$( document ).trigger( 'yith-toggle-element-item-title', [ toggle_el ] );
|
534 |
};
|
535 |
|
536 |
+
$.urlParam = function ( name ) {
|
537 |
+
var results = new RegExp( '[\?&]' + name + '=([^&#]*)' )
|
538 |
+
.exec( window.location.search );
|
539 |
|
540 |
+
return ( results !== null ) ? results[ 1 ] || 0 : false;
|
541 |
};
|
542 |
|
543 |
+
$( document ).on( 'click', '.yith-toggle-title', function ( event ) {
|
544 |
+
var _toggle = $( event.target ),
|
545 |
+
_section = _toggle.closest( '.yith-toggle-row' ),
|
546 |
+
_content = _section.find( '.yith-toggle-content' );
|
547 |
+
|
548 |
+
if ( _toggle.hasClass( 'yith-plugin-fw-onoff' ) || _toggle.hasClass( 'icon-drag' ) ) {
|
549 |
+
return false;
|
550 |
+
}
|
551 |
|
552 |
+
if ( _section.is( '.yith-toggle-row-opened' ) ) {
|
553 |
+
_content.slideUp( 400 );
|
554 |
} else {
|
555 |
+
_content.slideDown( 400 );
|
556 |
}
|
557 |
+
_section.toggleClass( 'yith-toggle-row-opened' );
|
558 |
+
} );
|
559 |
|
560 |
/**Add new box toggle**/
|
561 |
+
$( document ).on( 'click', '.yith-add-box-button', function ( event ) {
|
562 |
event.preventDefault();
|
563 |
+
var target_id = $( this ).data( 'box_id' ),
|
564 |
+
id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' );
|
565 |
+
template = wp.template( 'yith-toggle-element-add-box-content-' + id );
|
566 |
+
if ( '' !== target_id ) {
|
567 |
+
$( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
|
568 |
yith_fields_init();
|
569 |
+
$( document ).trigger( 'yith-add-box-button-toggle', [ $( this ) ] );
|
570 |
}
|
571 |
+
} );
|
572 |
|
573 |
+
$( document ).on( 'click', '.yith-add-box-buttons .yith-save-button', function ( event ) {
|
574 |
event.preventDefault();
|
575 |
+
var add_box = $( this ).parents( '.yith-add-box' ),
|
576 |
+
id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' ),
|
577 |
+
spinner = add_box.find( '.spinner' ),
|
578 |
+
toggle_element = $( this ).parents( '.toggle-element' ),
|
579 |
+
fields = add_box.find( ':input' ),
|
580 |
+
counter = toggle_element.find( '.yith-toggle-row' ).length,
|
581 |
+
hidden_obj = $( '<input type="hidden">' );
|
582 |
+
hidden_obj.val( counter );
|
583 |
+
$( document ).trigger( 'yith-toggle-change-counter', [ hidden_obj, add_box ] );
|
584 |
+
|
585 |
+
counter = hidden_obj.val();
|
586 |
+
var template = wp.template( 'yith-toggle-element-item-' + id ),
|
587 |
+
toggle_el = $( template( { index: counter } ) );
|
588 |
+
|
589 |
+
spinner.addClass( 'show' );
|
590 |
+
|
591 |
+
$.each( fields, function ( i, field ) {
|
592 |
+
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
593 |
+
|
594 |
+
$field_id = $( field ).attr( 'id' );
|
595 |
+
$field_val = $( field ).val();
|
596 |
+
|
597 |
+
if ( 'radio' == $( field ).attr( 'type' ) ) {
|
598 |
+
$field_id = $field_id.replace( 'new_', '' );
|
599 |
+
$field_id = $field_id.replace( '-' + $field_val, '' );
|
600 |
$field_id = $field_id + '_dataindex-' + $field_val;
|
601 |
} else {
|
602 |
+
$field_id = $field_id.replace( 'new_', '' ) + '_' + counter;
|
603 |
}
|
604 |
|
605 |
+
if ( $( field ).is( ':checked' ) ) {
|
606 |
+
$( toggle_el ).find( '#' + $field_id ).prop( 'checked', true );
|
607 |
}
|
608 |
|
609 |
+
if ( $( field ).hasClass( 'yith-post-search' ) || $( field ).hasClass( 'yith-term-search' ) ) {
|
610 |
+
$( toggle_el ).find( '#' + $field_id ).html( $( '#' + $( field ).attr( 'id' ) ).html() );
|
611 |
}
|
612 |
|
613 |
+
$( toggle_el ).find( '#' + $field_id ).val( $field_val );
|
614 |
|
615 |
}
|
616 |
|
617 |
+
} );
|
618 |
|
619 |
+
$( toggle_el ).formatToggleTitle();
|
620 |
+
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
621 |
+
$( document ).trigger( 'yith-toggle-element-item-before-add', [ add_box, toggle_el, form_is_valid ] );
|
622 |
|
623 |
|
624 |
+
if ( form_is_valid.val() === 'yes' ) {
|
625 |
+
$( toggle_element ).find( '.yith-toggle-elements' ).append( toggle_el );
|
626 |
+
$( add_box ).find( '.yith-plugin-fw-datepicker' ).datepicker( 'destroy' );
|
627 |
+
$( add_box ).html( '' ).toggle();
|
628 |
toggle_element.saveToggleElement();
|
629 |
yith_fields_init();
|
630 |
}
|
631 |
+
} );
|
632 |
|
633 |
+
$( document ).on( 'click', '.yith-toggle-row .yith-save-button', function ( event ) {
|
634 |
event.preventDefault();
|
635 |
+
var toggle = $( this ).closest( '.toggle-element' ),
|
636 |
+
toggle_row = $( this ).closest( '.yith-toggle-row' ),
|
637 |
+
spinner = toggle_row.find( '.spinner' );
|
638 |
toggle_row.formatToggleTitle();
|
639 |
|
640 |
+
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
641 |
+
$( document ).trigger( 'yith-toggle-element-item-before-update', [ toggle, toggle_row, form_is_valid ] );
|
642 |
+
if ( form_is_valid.val() === 'yes' ) {
|
643 |
+
spinner.addClass( 'show' );
|
644 |
+
toggle.saveToggleElement( spinner );
|
645 |
}
|
646 |
+
} );
|
647 |
|
648 |
//register remove the dome and save the toggle
|
649 |
+
$( document ).on( 'click', '.yith-toggle-row .yith-delete-button', function ( event ) {
|
650 |
event.preventDefault();
|
651 |
+
var toggle = $( this ).closest( '.toggle-element' ),
|
652 |
+
toggle_row = $( this ).closest( '.yith-toggle-row' );
|
653 |
toggle_row.remove();
|
654 |
toggle.saveToggleElement();
|
655 |
+
} );
|
656 |
|
657 |
//register onoff status
|
658 |
+
$( document ).on( 'click', '.yith-toggle-onoff', function ( event ) {
|
659 |
event.preventDefault();
|
660 |
+
var toggle = $( this ).closest( '.toggle-element' );
|
661 |
toggle.saveToggleElement();
|
662 |
+
} );
|
663 |
+
|
664 |
+
// Radio
|
665 |
+
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
666 |
+
$( this ).closest( '.yith-plugin-fw-radio' ).val( $( this ).val() ).trigger( 'change' );
|
667 |
+
} );
|
668 |
|
669 |
+
$( '.yith-plugin-fw-radio' ).each( function () {
|
670 |
+
$( this ).val( $( this ).attr( 'value' ) );
|
671 |
+
} );
|
672 |
|
673 |
+
} );
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1 +1,27 @@
|
|
1 |
-
jQuery(function(g){function f(){var e=g(".yith-plugin-fw-datepicker"),t=g(".yith-plugin-fw-colorpicker"),n={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:g(".yith-plugin-fw-upload-img-url")},i=g(".add_media"),a={sliderWrapper:g(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},l=g(".yith-plugin-fw-sidebar-layout"),o=g(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=g(".codemirror"),d=g(".yit-icons-manager-wrapper"),s=g(".yith-plugin-ui td.forminp-checkbox");if(e.each(function(){var e=g(this).data();g(this).datepicker(e)}),t.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var e=g(this);e.val(e.data("default-color")),e.change()}}),t.each(function(){var e=g(this).data("variations-label"),t=g(this).closest(".yith-plugin-fw-field-wrapper"),i=t.find(".wp-picker-input-wrap");if(t.find("a.wp-color-result").attr("title",e),!i.find(".wp-picker-clear-custom").length){var a=g("<span/>").attr({class:"wp-picker-default-custom"});i.find(".wp-picker-default").wrap(a)}}),"undefined"!=typeof wp&&void 0!==wp.media){n.imgUrl.change(function(){var e=g(this).val(),t=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),i=g(this).parent().find(n.imgPreviewHandler).first();i.length<1&&(i=g(this).parent().parent().find(n.imgPreviewHandler).first()),t.test(e)?i.html('<img src="'+e+'" style="max-width:100px; max-height:100px;" />'):i.html("")}).trigger("change"),g(document).on("click",n.uploadButtonHandler,function(e){e.preventDefault();var t,i=g(this).attr("id").replace(/-button$/,"");if(t)t.open();else{var a=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(t=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:a})).on("select",function(){var e=t.state().get("selection").first().toJSON();g("#"+i).val(e.url),g("#"+i+"-yith-attachment-id")&&g("#"+i+"-yith-attachment-id").val(e.id),n.imgUrl.trigger("change")}),t.open()}}),g(document).on("click",n.resetButtonHandler,function(e){var t=g(this),i=t.attr("id"),a=t.attr("id").replace(/-button-reset$/,""),l=g("#"+i).data("default");g("#"+a).val(l),n.imgUrl.trigger("change")})}i.on("click",function(){!1}),"undefined"!=typeof wp&&void 0!==wp.media&&(g(document).on("click",a.buttonHandler,function(e){var t=g(this),i=t.closest(".image-gallery"),a=i.find(".image_gallery_ids"),l=a.val(),n=i.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:t.data("choose"),button:{text:t.data("update")},states:[new wp.media.controller.Library({title:t.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,n.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+t.data("delete")+'">x</a></li></ul></li>'))}),a.val(l)}),o.open()}),a.sliderWrapper.each(function(){var a=g(this);a.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(e,t){var i="";a.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");i=i+e+","}),a.closest(".image-gallery").find(".image_gallery_ids").val(i)}})}),a.sliderWrapper.on("click","a.delete",function(){var e=g(this).closest(".image-gallery"),t=g(this).closest(".image-gallery ul.slides-wrapper"),i=e.find(".image_gallery_ids"),a="";g(this).closest("li.image").remove(),t.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");a=a+e+","}),i.val(a)})),l.each(function(){g(this).find("img").on("click",function(){var e=g(this).closest(".yith-plugin-fw-sidebar-layout"),t=e.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),i=e.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),a=g(this).data("type");if(g(this).parent().children(":radio").attr("checked",!1),g(this).prev(":radio").attr("checked",!0),void 0!==a)switch(a){case"left":t.show(),i.hide();break;case"right":i.show(),t.hide();break;case"double":t.show(),i.show();break;default:t.hide(),i.hide()}})}),o.each(function(){var e=g(this).data("val"),t=g(this).data("min"),i=g(this).data("max"),a=g(this).data("step"),l=g(this).data("labels");g(this).slider({value:e,min:t,max:i,range:"min",step:a,create:function(){g(this).find(".ui-slider-handle").text(g(this).slider("value"))},slide:function(e,t){g(this).find("input").val(t.value),g(this).find(".ui-slider-handle").text(t.value),g(this).siblings(".feedback").find("strong").text(t.value+l)}})}),r.each(function(e,t){var i=CodeMirror.fromTextArea(t,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});g(t).data("codemirrorInstance",i)}),g(document).on("click",".yith-plugin-fw-select-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),g(document).on("click",".yith-plugin-fw-deselect-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var o=g(this),r=o.find(".yit-icons-manager-icon-preview").first(),d=o.find(".yit-icons-manager-icon-text");o.on("click",".yit-icons-manager-list li",function(e){var t=g(e.target).closest("li"),i=t.data("font"),a=t.data("icon"),l=t.data("key"),n=t.data("name");r.attr("data-font",i),r.attr("data-icon",a),r.attr("data-key",l),r.attr("data-name",n),d.val(i+":"+n),o.find(".yit-icons-manager-list li").removeClass("active"),t.addClass("active")}),o.on("click",".yit-icons-manager-action-set-default",function(){o.find(".yit-icons-manager-list li.default").trigger("click")})}),g(document).on("click",".yith-plugin-fw-select-images__item",function(){var e=g(this),t=e.data("key"),i=e.closest(".yith-plugin-fw-select-images__wrapper"),a=i.find(".yith-plugin-fw-select-images__item"),l=i.find("select").first();l.length&&(l.val(t),a.removeClass("yith-plugin-fw-select-images__item--selected"),e.addClass("yith-plugin-fw-select-images__item--selected"))}),g(document.body).trigger("wc-enhanced-select-init"),g(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(e,t){var i=jQuery(".ui-sortable-handle"),a=0,l=new Array;for(a=0;a<i.length;a++)l[a]=g(i[a]).data("item_key");0<l.length&&g(this).closest(".toggle-element").saveToggleElement(null,l)}}),g.each(s,function(){var e=g(this).find("fieldset");3<e.length&&e.length<6&&g(this).addClass("two-cols"),6<e.length&&g(this).addClass("three-cols")}),g(document.body).trigger("yith-framework-enhanced-select-init")}f(),g(document).on("click",".yith-plugin-fw-onoff-container span",function(){var e=g(this).prev("input");e.prop("checked")?e.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):e.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),e.change()}),g.fn.saveToggleElement=function(t,e){var i=g(this),a="yith_plugin_fw_save_toggle_element",l=i.serializeToggleElement(),n=i.find(".yith-toggle_wrapper").attr("id"),o=g.urlParam("tab");void 0!==e&&0<e.length&&l.append("yith_toggle_elements_order_keys",e),i.closest(".metaboxes-tab.yith-plugin-ui").length?(a="yith_plugin_fw_save_toggle_element_metabox",post_id=g(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=g(this).closest("form#post").find("#yit_metaboxes_nonce").val(),url=yith_framework_fw_fields.ajax_url+"?action="+a+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+n):url=yith_framework_fw_fields.admin_url+"?action="+a+"&tab="+o+"&toggle_id="+n,g.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(e){t&&t.removeClass("show"),g(document).trigger("yith_save_toggle_element_done",[e,i])}})},g.fn.serializeToggleElement=function(){var e=g(this),i=new FormData,t=g(e).find(":input").serializeArray();return g.each(t,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},g.fn.formatToggleTitle=function(){var e=g(this),t=e.find(":input"),i=e.find("span.title").data("title_format"),a=e.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==i)var n=i.match(l);if(void 0!==a)var o=a.match(l);g.each(t,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=g(t).val(),null!=n&&void 0!==n&&-1!==n.indexOf($field_id)&&(i=i.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)))}),""!==i&&e.find("span.title").html(i),""!==a&&e.find(".subtitle").html(a),g(document).trigger("yith-toggle-element-item-title",[e])},g.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},g(document).on("click",".yith-toggle",function(e){var t=g(e.target).closest(".yith-toggle-row"),i=t.find(".yith-toggle-content");t.is(".yith-toggle-row-opened")?i.slideUp(400):i.slideDown(400),t.toggleClass("yith-toggle-row-opened")}),g(document).on("click",".yith-add-box-button",function(e){e.preventDefault();var t=g(this).data("box_id"),i=g(this).closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+i),""!==t&&(g("#"+t).html(template({index:"box_id"})).slideToggle(),f(),g(document).trigger("yith-add-box-button-toggle",[g(this)]))}),g(document).on("click",".yith-add-box-buttons .yith-save-button",function(e){e.preventDefault();var t=g(this).parents(".yith-add-box"),i=g(this).closest(".yith-toggle_wrapper").attr("id"),a=t.find(".spinner"),l=g(this).parents(".toggle-element"),n=t.find(":input"),o=l.find(".yith-toggle-row").length,r=g('<input type="hidden">');r.val(o),g(document).trigger("yith-toggle-change-counter",[r,t]),o=r.val();var d=wp.template("yith-toggle-element-item-"+i),s=g(d({index:o}));a.addClass("show"),g.each(n,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_val=g(t).val(),"radio"==g(t).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,g(t).is(":checked")&&g(s).find("#"+$field_id).prop("checked",!0),(g(t).hasClass("yith-post-search")||g(t).hasClass("yith-term-search"))&&g(s).find("#"+$field_id).html(g("#"+g(t).attr("id")).html()),g(s).find("#"+$field_id).val($field_val))}),g(s).formatToggleTitle();var c=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-add",[t,s,c]),"yes"===c.val()&&(g(l).find(".yith-toggle-elements").append(s),g(t).find(".yith-plugin-fw-datepicker").datepicker("destroy"),g(t).html("").toggle(),l.saveToggleElement(),f())}),g(document).on("click",".yith-toggle-row .yith-save-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element"),i=g(this).closest(".yith-toggle-row"),a=i.find(".spinner");i.formatToggleTitle();var l=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-update",[t,i,l]),"yes"===l.val()&&(a.addClass("show"),t.saveToggleElement(a))}),g(document).on("click",".yith-toggle-row .yith-delete-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element");g(this).closest(".yith-toggle-row").remove(),t.saveToggleElement()}),g(document).on("click",".yith-toggle-onoff",function(e){e.preventDefault(),g(this).closest(".toggle-element").saveToggleElement()})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,g,b){a instanceof String&&(a=String(a));for(var d=a.length,c=0;c<d;c++){var e=a[c];if(g.call(b,e,c,a))return{i:c,v:e}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,b){a!=Array.prototype&&a!=Object.prototype&&(a[g]=b.value)};
|
2 |
+
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,g,b,d){if(g){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var c=a[d];c in b||(b[c]={});b=b[c]}a=a[a.length-1];d=b[a];g=g(d);g!=d&&null!=g&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:g})}};
|
3 |
+
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
+
jQuery(function(a){var g=function(){var b=a(".yith-plugin-fw-datepicker"),d=a(".yith-plugin-fw-colorpicker"),c=a(".yith-plugin-fw-upload-img-url"),e=a(".add_media"),g=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),h=a(".yith-plugin-fw-sidebar-layout"),l=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),m=a(".codemirror"),p=a(".yit-icons-manager-wrapper"),q=a(".yith-plugin-ui td.forminp-checkbox");b.each(function(){var b=a(this).data();a(this).datepicker(b)});d.wpColorPicker({palettes:!1,
|
5 |
+
width:200,mode:"hsl",clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});d.each(function(){var b=a(this).data("variations-label"),f=a(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),c=a(this).closest(".yith-single-colorpicker"),d=f.find(".wp-picker-input-wrap"),e=c.find(".wp-picker-input-wrap");d.length&&f.find("a.wp-color-result").attr("title",b);c.length&&c.find("a.wp-color-result").attr("title",b);d.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({class:"wp-picker-default-custom"}),
|
6 |
+
d.find(".wp-picker-default").wrap(b));e.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({class:"wp-picker-default-custom"}),e.find(".wp-picker-default").wrap(b))});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(c.change(function(){var b=a(this).val(),f=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>f.length&&(f=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?
|
7 |
+
f.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):f.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var f=a(this).attr("id").replace(/-button$/,"");if(!k){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var k=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,
|
8 |
+
states:b});k.on("select",function(){var b=k.state().get("selection").first().toJSON();a("#"+f).val(b.url);a("#"+f+"-yith-attachment-id")&&a("#"+f+"-yith-attachment-id").val(b.id);c.trigger("change")})}k.open()}),a(document).on("click",".yith-plugin-fw-upload-button-reset",function(b){var f=a(this);b=f.attr("id");f=f.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+f).val(b);c.trigger("change")}));e.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&
|
9 |
+
(a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var f=a(this);b=f.closest(".image-gallery");var k=b.find(".image_gallery_ids"),c=k.val(),d=b.find("ul.slides-wrapper"),e=wp.media.frames.image_gallery=wp.media({title:f.data("choose"),button:{text:f.data("update")},states:[new wp.media.controller.Library({title:f.data("choose"),filterable:"all",multiple:!0})]});e.on("select",function(){e.state().get("selection").map(function(a){a=a.toJSON();a.id&&(c=c?c+","+a.id:a.id,d.append('<li class="image" data-attachment_id="'+
|
10 |
+
a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+f.data("delete")+'">x</a></li></ul></li>'))});k.val(c)});e.open()}),g.each(function(){var b=a(this);b.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(f,c){var k="";b.find("li.image").css("cursor",
|
11 |
+
"default").each(function(){var b=a(this).attr("data-attachment_id");k=k+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(k)}})}),g.on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),f=a(this).closest(".image-gallery ul.slides-wrapper");b=b.find(".image_gallery_ids");var c="";a(this).closest("li.image").remove();f.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");c=c+b+","});b.val(c)}));h.each(function(){a(this).find("img").on("click",
|
12 |
+
function(){var b=a(this).closest(".yith-plugin-fw-sidebar-layout"),c=b.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container");b=b.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container");var d=a(this).data("type");a(this).parent().children(":radio").attr("checked",!1);a(this).prev(":radio").attr("checked",!0);if("undefined"!=typeof d)switch(d){case "left":c.show();b.hide();break;case "right":b.show();c.hide();break;case "double":c.show();b.show();break;default:c.hide(),b.hide()}})});
|
13 |
+
l.each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),g=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,create:function(){a(this).find(".ui-slider-handle").text(a(this).slider("value"))},slide:function(b,c){a(this).find("input").val(c.value);a(this).find(".ui-slider-handle").text(c.value);a(this).siblings(".feedback").find("strong").text(c.value+g)}})});m.each(function(b,c){b=CodeMirror.fromTextArea(c,{lineNumbers:1,
|
14 |
+
mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",b)});a(document).on("click",".yith-plugin-fw-select-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!0).trigger("change")});a(document).on("click",".yith-plugin-fw-deselect-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!1).trigger("change")});p.each(function(){var b=a(this),c=b.find(".yit-icons-manager-icon-preview").first(),d=b.find(".yit-icons-manager-icon-text");
|
15 |
+
b.on("click",".yit-icons-manager-list li",function(e){e=a(e.target).closest("li");var f=e.data("font"),k=e.data("icon"),g=e.data("key"),h=e.data("name");c.attr("data-font",f);c.attr("data-icon",k);c.attr("data-key",g);c.attr("data-name",h);d.val(f+":"+h);b.find(".yit-icons-manager-list li").removeClass("active");e.addClass("active")});b.on("click",".yit-icons-manager-action-set-default",function(){b.find(".yit-icons-manager-list li.default").trigger("click")})});a(document).on("click",".yith-plugin-fw-select-images__item",
|
16 |
+
function(){var b=a(this),c=b.data("key"),d=b.closest(".yith-plugin-fw-select-images__wrapper"),e=d.find(".yith-plugin-fw-select-images__item");d=d.find("select").first();d.length&&(d.val(c),e.removeClass("yith-plugin-fw-select-images__item--selected"),b.addClass("yith-plugin-fw-select-images__item--selected"))});a(document.body).trigger("wc-enhanced-select-init");a(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",
|
17 |
+
stop:function(b,c){b=jQuery(".ui-sortable-handle");var d=[];for(c=0;c<b.length;c++)d[c]=a(b[c]).data("item_key");0<d.length&&a(this).closest(".toggle-element").saveToggleElement(null,d)}});a.each(q,function(){var b=a(this).find("fieldset");3<b.length&&6>b.length&&a(this).addClass("two-cols");6<b.length&&a(this).addClass("three-cols")});a(document.body).trigger("yith-framework-enhanced-select-init")};g();a(document).on("click",".yith-plugin-fw-onoff-container span",function(){var b=a(this).prev("input");
|
18 |
+
b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a.fn.saveToggleElement=function(b,d){var c=a(this),e="yith_plugin_fw_save_toggle_element",g=c.serializeToggleElement(),h=c.find(".yith-toggle_wrapper").attr("id"),l=a.urlParam("tab");"undefined"!=typeof d&&0<d.length&&g.append("yith_toggle_elements_order_keys",d);c.closest(".metaboxes-tab.yith-plugin-ui").length?(e="yith_plugin_fw_save_toggle_element_metabox",
|
19 |
+
post_id=a(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=a(this).closest("form#post").find("#yit_metaboxes_nonce").val(),url=yith_framework_fw_fields.ajax_url+"?action="+e+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+h):url=yith_framework_fw_fields.admin_url+"?action="+e+"&tab="+l+"&toggle_id="+h;a.ajax({type:"POST",url:url,data:g,contentType:!1,processData:!1,success:function(d){b&&b.removeClass("show");a(document).trigger("yith_save_toggle_element_done",
|
20 |
+
[d,c])}})};a.fn.serializeToggleElement=function(){var b=a(this),d=new FormData;b=a(b).find(":input").serializeArray();a.each(b,function(a,b){el_name=b.name;d.append(b.name,b.value)});return d};a.fn.formatToggleTitle=function(){var b=a(this),d=b.find(":input"),c=b.find("span.title").data("title_format"),e=b.find(".subtitle").data("subtitle_format"),g=/[^%%]+(?=[%%])/g;if("undefined"!=typeof c)var h=c.match(g);if("undefined"!=typeof e)var l=e.match(g);a.each(d,function(b,d){"undefined"!=typeof a(d).attr("id")&&
|
21 |
+
($field_id=a(d).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=a(d).val(),null!=h&&"undefined"!=typeof h&&-1!==h.indexOf($field_id)&&(c=c.replace("%%"+$field_id+"%%",$field_val)),null!=l&&"undefined"!=typeof l&&-1!==l.indexOf($field_id)&&(e=e.replace("%%"+$field_id+"%%",$field_val)))});""!==c&&b.find("span.title").html(c);""!==e&&b.find(".subtitle").html(e);a(document).trigger("yith-toggle-element-item-title",[b])};a.urlParam=function(a){a=
|
22 |
+
(new RegExp("[?&]"+a+"=([^&#]*)")).exec(window.location.search);return null!==a?a[1]||0:!1};a(document).on("click",".yith-toggle-title",function(b){b=a(b.target);var d=b.closest(".yith-toggle-row"),c=d.find(".yith-toggle-content");if(b.hasClass("yith-plugin-fw-onoff")||b.hasClass("icon-drag"))return!1;d.is(".yith-toggle-row-opened")?c.slideUp(400):c.slideDown(400);d.toggleClass("yith-toggle-row-opened")});a(document).on("click",".yith-add-box-button",function(b){b.preventDefault();b=a(this).data("box_id");
|
23 |
+
var d=a(this).closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+d);""!==b&&(a("#"+b).html(template({index:"box_id"})).slideToggle(),g(),a(document).trigger("yith-add-box-button-toggle",[a(this)]))});a(document).on("click",".yith-add-box-buttons .yith-save-button",function(b){b.preventDefault();b=a(this).parents(".yith-add-box");var d=a(this).closest(".yith-toggle_wrapper").attr("id"),c=b.find(".spinner"),e=a(this).parents(".toggle-element"),n=b.find(":input"),
|
24 |
+
h=e.find(".yith-toggle-row").length,l=a('<input type="hidden">');l.val(h);a(document).trigger("yith-toggle-change-counter",[l,b]);h=l.val();d=wp.template("yith-toggle-element-item-"+d);var m=a(d({index:h}));c.addClass("show");a.each(n,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_val=a(c).val(),"radio"==a(c).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=
|
25 |
+
$field_id.replace("new_","")+"_"+h,a(c).is(":checked")&&a(m).find("#"+$field_id).prop("checked",!0),(a(c).hasClass("yith-post-search")||a(c).hasClass("yith-term-search"))&&a(m).find("#"+$field_id).html(a("#"+a(c).attr("id")).html()),a(m).find("#"+$field_id).val($field_val))});a(m).formatToggleTitle();c=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-add",[b,m,c]);"yes"===c.val()&&(a(e).find(".yith-toggle-elements").append(m),a(b).find(".yith-plugin-fw-datepicker").datepicker("destroy"),
|
26 |
+
a(b).html("").toggle(),e.saveToggleElement(),g())});a(document).on("click",".yith-toggle-row .yith-save-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");var d=a(this).closest(".yith-toggle-row"),c=d.find(".spinner");d.formatToggleTitle();var e=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-update",[b,d,e]);"yes"===e.val()&&(c.addClass("show"),b.saveToggleElement(c))});a(document).on("click",".yith-toggle-row .yith-delete-button",
|
27 |
+
function(b){b.preventDefault();b=a(this).closest(".toggle-element");a(this).closest(".yith-toggle-row").remove();b.saveToggleElement()});a(document).on("click",".yith-toggle-onoff",function(b){b.preventDefault();a(this).closest(".toggle-element").saveToggleElement()});a(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){a(this).closest(".yith-plugin-fw-radio").val(a(this).val()).trigger("change")});a(".yith-plugin-fw-radio").each(function(){a(this).val(a(this).attr("value"))})});
|
plugin-fw/assets/js/yith-system-info.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
$(document).on('click', '.notice-dismiss', function () {
|
3 |
+
var t = $(this),
|
4 |
+
wrapper_id = t.parent().attr('id');
|
5 |
+
|
6 |
+
if (wrapper_id === 'yith-system-alert') {
|
7 |
+
var cname = 'hide_yith_system_alert',
|
8 |
+
cvalue = 'yes';
|
9 |
+
|
10 |
+
document.cookie = cname + "=" + cvalue + ";path=/";
|
11 |
+
}
|
12 |
+
});
|
13 |
+
})(jQuery);
|
plugin-fw/assets/js/yith-system-info.min.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
$(document).on('click', '.notice-dismiss', function () {
|
3 |
+
var t = $(this),
|
4 |
+
wrapper_id = t.parent().attr('id');
|
5 |
+
|
6 |
+
if (wrapper_id === 'yith-system-alert') {
|
7 |
+
var cname = 'hide_yith_system_alert',
|
8 |
+
cvalue = 'yes';
|
9 |
+
|
10 |
+
document.cookie = cname + "=" + cvalue + ";path=/";
|
11 |
+
}
|
12 |
+
});
|
13 |
+
})(jQuery);
|
plugin-fw/init.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.3.
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
-
* @version 3.3.
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.3.7
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
+
* @version 3.3.6
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
plugin-fw/lib/promo/yith-promo.php
CHANGED
@@ -21,7 +21,7 @@ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
|
21 |
return false;
|
22 |
}
|
23 |
|
24 |
-
$base_url = apply_filters( 'yith_plugin_fw_promo_base_url',
|
25 |
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url', $base_url . 'yith-promo.xml' );
|
26 |
$transient = "yith_promo_message";
|
27 |
$remote_data = get_site_transient( $transient );
|
21 |
return false;
|
22 |
}
|
23 |
|
24 |
+
$base_url = apply_filters( 'yith_plugin_fw_promo_base_url', YIT_CORE_PLUGIN_PATH . '/lib/promo/' );
|
25 |
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url', $base_url . 'yith-promo.xml' );
|
26 |
$transient = "yith_promo_message";
|
27 |
$remote_data = get_site_transient( $transient );
|
plugin-fw/lib/yit-assets.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This file belongs to the YIT Plugin Framework.
|
4 |
-
*
|
5 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
* that is bundled with this package in the file LICENSE.txt.
|
7 |
* It is also available through the world-wide-web at this URL:
|
@@ -38,7 +37,7 @@ if ( !class_exists( 'YIT_Assets' ) ) {
|
|
38 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
39 |
*/
|
40 |
private function __construct() {
|
41 |
-
|
42 |
add_action( 'admin_enqueue_scripts', array( $this, 'register_styles_and_scripts' ) );
|
43 |
}
|
44 |
|
@@ -51,9 +50,9 @@ if ( !class_exists( 'YIT_Assets' ) ) {
|
|
51 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
52 |
|
53 |
//scripts
|
54 |
-
wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider','jquery-ui-sortable' ), $this->version, true );
|
55 |
-
wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
56 |
-
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable' ), $this->version, true );
|
57 |
wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
|
58 |
wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
|
59 |
wp_register_script( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/js/jquery.colorbox' . $suffix . '.js', array( 'jquery' ), '1.6.3', true );
|
@@ -88,10 +87,10 @@ if ( !class_exists( 'YIT_Assets' ) ) {
|
|
88 |
'search_terms_nonce' => wp_create_nonce( 'search-terms' ),
|
89 |
) );
|
90 |
|
91 |
-
wp_localize_script('yith-plugin-fw-fields','yith_framework_fw_fields', array(
|
92 |
-
|
93 |
-
|
94 |
-
));
|
95 |
wp_enqueue_style( 'yith-plugin-fw-admin', YIT_CORE_PLUGIN_URL . '/assets/css/admin.css', array(), $this->version );
|
96 |
}
|
97 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* This file belongs to the YIT Plugin Framework.
|
|
|
4 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
37 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
38 |
*/
|
39 |
private function __construct() {
|
40 |
+
defined( 'YITH_PLUGIN_FW_VERSION' ) && $this->version = YITH_PLUGIN_FW_VERSION;
|
41 |
add_action( 'admin_enqueue_scripts', array( $this, 'register_styles_and_scripts' ) );
|
42 |
}
|
43 |
|
50 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
51 |
|
52 |
//scripts
|
53 |
+
wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider', 'jquery-ui-sortable' ), $this->version, true );
|
54 |
+
wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'yith-plugin-fw-fields' ), $this->version, true );
|
55 |
+
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'yith-plugin-fw-fields' ), $this->version, true );
|
56 |
wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
|
57 |
wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
|
58 |
wp_register_script( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/js/jquery.colorbox' . $suffix . '.js', array( 'jquery' ), '1.6.3', true );
|
87 |
'search_terms_nonce' => wp_create_nonce( 'search-terms' ),
|
88 |
) );
|
89 |
|
90 |
+
wp_localize_script( 'yith-plugin-fw-fields', 'yith_framework_fw_fields', array(
|
91 |
+
'admin_url' => admin_url( 'admin.php' ),
|
92 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
93 |
+
) );
|
94 |
wp_enqueue_style( 'yith-plugin-fw-admin', YIT_CORE_PLUGIN_URL . '/assets/css/admin.css', array(), $this->version );
|
95 |
}
|
96 |
}
|
plugin-fw/lib/yit-plugin-panel-wc.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This file belongs to the YIT Plugin Framework.
|
4 |
-
*
|
5 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
* that is bundled with this package in the file LICENSE.txt.
|
7 |
* It is also available through the world-wide-web at this URL:
|
@@ -15,7 +14,6 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
15 |
if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
16 |
/**
|
17 |
* YIT Plugin Panel for WooCommerce
|
18 |
-
*
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
@@ -47,7 +45,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
47 |
public static $body_class = ' yith-plugin-fw-panel ';
|
48 |
|
49 |
|
50 |
-
|
51 |
/**
|
52 |
* @var array
|
53 |
*/
|
@@ -83,7 +80,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
83 |
$this->links = $this->settings[ 'links' ];
|
84 |
}
|
85 |
|
86 |
-
|
87 |
add_action( 'admin_menu', array( $this, 'add_setting_page' ) );
|
88 |
add_action( 'admin_menu', array( $this, 'add_premium_version_upgrade_to_menu' ), 100 );
|
89 |
add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
|
@@ -93,11 +90,10 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
93 |
|
94 |
add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'maybe_unserialize_panel_data' ), 10, 3 );
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
add_filter( 'yith_plugin_fw_wc_panel_pre_field_value', array( $this, 'get_toggle_element_option' ), 10, 2 );
|
101 |
|
102 |
|
103 |
// init actions once to prevent multiple actions
|
@@ -131,7 +127,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
131 |
|
132 |
/**
|
133 |
* Show a tabbed panel to setting page
|
134 |
-
*
|
135 |
* a callback function called by add_setting_page => add_submenu_page
|
136 |
*
|
137 |
* @return void
|
@@ -145,7 +140,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
145 |
'available_tabs' => $this->settings[ 'admin-tabs' ],
|
146 |
'default_tab' => $this->get_available_tabs( true ), //get default tabs
|
147 |
'page' => $this->settings[ 'page' ],
|
148 |
-
'wrap_class' => isset($this->settings[ 'class' ]) ? $this->settings[ 'class' ] : '',
|
149 |
);
|
150 |
|
151 |
|
@@ -159,7 +154,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
159 |
/**
|
160 |
* Show a input fields to upload images
|
161 |
*
|
162 |
-
*
|
163 |
* @return string
|
164 |
* @since 1.0
|
165 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
@@ -172,9 +166,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
172 |
/**
|
173 |
* Show a input fields to upload images
|
174 |
*
|
175 |
-
*
|
176 |
* @param array $args
|
177 |
-
*
|
178 |
* @since 1.0
|
179 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
180 |
*/
|
@@ -192,7 +184,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
192 |
* Add the plugin woocommerce page settings in the screen ids of woocommerce
|
193 |
*
|
194 |
* @param $screen_ids
|
195 |
-
*
|
196 |
* @return mixed
|
197 |
* @since 1.0.0
|
198 |
* @author Antonino Scarfì <antonino.scarfi@yithemes.com>
|
@@ -230,11 +221,9 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
230 |
|
231 |
/**
|
232 |
* Return available tabs
|
233 |
-
*
|
234 |
* read all options and show sections and fields
|
235 |
*
|
236 |
* @param bool false for all tabs slug, true for current tab
|
237 |
-
*
|
238 |
* @return mixed Array tabs | String current tab
|
239 |
* @since 1.0
|
240 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
@@ -249,7 +238,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
249 |
|
250 |
/**
|
251 |
* Add sections and fields to setting panel
|
252 |
-
*
|
253 |
* read all options and show sections and fields
|
254 |
*
|
255 |
* @return void
|
@@ -272,7 +260,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
272 |
|
273 |
/**
|
274 |
* Print the panel content
|
275 |
-
*
|
276 |
* check if the tab is a wc options tab or custom tab and print the content
|
277 |
*
|
278 |
* @return void
|
@@ -419,7 +406,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
419 |
|
420 |
/**
|
421 |
* Default options
|
422 |
-
*
|
423 |
* Sets up the default options used on the settings page
|
424 |
*
|
425 |
* @access public
|
@@ -460,7 +446,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
460 |
* Delete the "default options added" option
|
461 |
*
|
462 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
463 |
-
*
|
464 |
*/
|
465 |
public static function delete_default_options_set_option() {
|
466 |
delete_option( 'yit_plugin_fw_panel_wc_default_options_set' );
|
@@ -471,9 +456,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
471 |
*
|
472 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
473 |
* @since 2.0
|
474 |
-
*
|
475 |
* @param $classes The body classes
|
476 |
-
*
|
477 |
* @return array Filtered body classes
|
478 |
*/
|
479 |
public static function admin_body_class( $admin_body_classes ) {
|
@@ -491,7 +474,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
491 |
* @param $value mixed Option value
|
492 |
* @param $option mixed Option settings array
|
493 |
* @param $raw_value string Raw option value
|
494 |
-
*
|
495 |
* @return mixed Filtered return value
|
496 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
497 |
* @since 2.0
|
@@ -523,7 +505,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
523 |
* @param $value mixed Option value
|
524 |
* @param $option mixed Option settings array
|
525 |
* @param $raw_value string Raw option value
|
526 |
-
*
|
527 |
* @return mixed Filtered return value
|
528 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
529 |
* @since 3.0.0
|
@@ -545,42 +526,42 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
545 |
$value = $raw_value;
|
546 |
}
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
|
554 |
-
|
555 |
|
556 |
-
|
557 |
|
558 |
-
|
559 |
|
560 |
-
|
561 |
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
|
568 |
-
|
569 |
-
|
570 |
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
|
577 |
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
|
582 |
|
583 |
-
|
584 |
$value = call_user_func( $option[ 'yith-sanitize-callback' ], $value );
|
585 |
}
|
586 |
}
|
@@ -592,7 +573,6 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
592 |
* Add YITH Fields
|
593 |
*
|
594 |
* @param array $field
|
595 |
-
*
|
596 |
* @return void
|
597 |
* @since 3.0.0
|
598 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
@@ -608,7 +588,11 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
608 |
|
609 |
$value = apply_filters( 'yith_plugin_fw_wc_panel_pre_field_value', null, $field );
|
610 |
if ( is_null( $value ) ) {
|
611 |
-
|
|
|
|
|
|
|
|
|
612 |
}
|
613 |
$field[ 'value' ] = $value;
|
614 |
|
@@ -616,69 +600,52 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
616 |
}
|
617 |
}
|
618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
|
620 |
-
|
621 |
-
* Return the option value for the toggle element to the filter 'yith_plugin_fw_wc_panel_pre_field_value',
|
622 |
-
* it is an array of arrays and could trigger warning if recovered using
|
623 |
-
* WC_Admin_Settings::get_option
|
624 |
-
*
|
625 |
-
* @param $value mixed
|
626 |
-
* @param $field array
|
627 |
-
*
|
628 |
-
* @return $value mixed
|
629 |
-
*
|
630 |
-
* @author Emanuela Castorina
|
631 |
-
*/
|
632 |
-
public function get_toggle_element_option( $value, $field ) {
|
633 |
-
return get_option( $field[ 'id' ], $field[ 'default' ] );
|
634 |
-
}
|
635 |
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
if ( $order_elements ) {
|
667 |
-
$i = 0;
|
668 |
-
$new_value = array();
|
669 |
-
foreach ( $order_elements as $key ) {
|
670 |
-
$index = apply_filters('yith_toggle_elements_index', $i++, $key );
|
671 |
-
$new_value[ $index ] = $value[ $key ];
|
672 |
-
}
|
673 |
-
|
674 |
-
$value = $new_value;
|
675 |
-
}
|
676 |
-
$value = self::sanitize_option( $value, $option_array[ $option_id ], $value );
|
677 |
-
$updated = update_option( $option_id, $value );
|
678 |
-
}
|
679 |
-
}
|
680 |
-
|
681 |
-
return $updated;
|
682 |
-
}
|
683 |
}
|
684 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* This file belongs to the YIT Plugin Framework.
|
|
|
4 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
14 |
if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
15 |
/**
|
16 |
* YIT Plugin Panel for WooCommerce
|
|
|
17 |
* Setting Page to Manage Plugins
|
18 |
*
|
19 |
* @class YIT_Plugin_Panel
|
45 |
public static $body_class = ' yith-plugin-fw-panel ';
|
46 |
|
47 |
|
|
|
48 |
/**
|
49 |
* @var array
|
50 |
*/
|
80 |
$this->links = $this->settings[ 'links' ];
|
81 |
}
|
82 |
|
83 |
+
add_action( 'admin_init', array( $this, 'set_default_options' ) );
|
84 |
add_action( 'admin_menu', array( $this, 'add_setting_page' ) );
|
85 |
add_action( 'admin_menu', array( $this, 'add_premium_version_upgrade_to_menu' ), 100 );
|
86 |
add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
|
90 |
|
91 |
add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'maybe_unserialize_panel_data' ), 10, 3 );
|
92 |
|
93 |
+
//yith-plugin-ui
|
94 |
+
add_action( 'yith_plugin_fw_get_field_after', array( $this, 'add_yith_ui' ) );
|
95 |
+
add_action( 'yith_plugin_fw_before_woocommerce_panel', array( $this, 'add_plugin_banner' ), 10, 1 );
|
96 |
+
add_action( 'admin_action_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
|
|
|
97 |
|
98 |
|
99 |
// init actions once to prevent multiple actions
|
127 |
|
128 |
/**
|
129 |
* Show a tabbed panel to setting page
|
|
|
130 |
* a callback function called by add_setting_page => add_submenu_page
|
131 |
*
|
132 |
* @return void
|
140 |
'available_tabs' => $this->settings[ 'admin-tabs' ],
|
141 |
'default_tab' => $this->get_available_tabs( true ), //get default tabs
|
142 |
'page' => $this->settings[ 'page' ],
|
143 |
+
'wrap_class' => isset( $this->settings[ 'class' ] ) ? $this->settings[ 'class' ] : '',
|
144 |
);
|
145 |
|
146 |
|
154 |
/**
|
155 |
* Show a input fields to upload images
|
156 |
*
|
|
|
157 |
* @return string
|
158 |
* @since 1.0
|
159 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
166 |
/**
|
167 |
* Show a input fields to upload images
|
168 |
*
|
|
|
169 |
* @param array $args
|
|
|
170 |
* @since 1.0
|
171 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
172 |
*/
|
184 |
* Add the plugin woocommerce page settings in the screen ids of woocommerce
|
185 |
*
|
186 |
* @param $screen_ids
|
|
|
187 |
* @return mixed
|
188 |
* @since 1.0.0
|
189 |
* @author Antonino Scarfì <antonino.scarfi@yithemes.com>
|
221 |
|
222 |
/**
|
223 |
* Return available tabs
|
|
|
224 |
* read all options and show sections and fields
|
225 |
*
|
226 |
* @param bool false for all tabs slug, true for current tab
|
|
|
227 |
* @return mixed Array tabs | String current tab
|
228 |
* @since 1.0
|
229 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
238 |
|
239 |
/**
|
240 |
* Add sections and fields to setting panel
|
|
|
241 |
* read all options and show sections and fields
|
242 |
*
|
243 |
* @return void
|
260 |
|
261 |
/**
|
262 |
* Print the panel content
|
|
|
263 |
* check if the tab is a wc options tab or custom tab and print the content
|
264 |
*
|
265 |
* @return void
|
406 |
|
407 |
/**
|
408 |
* Default options
|
|
|
409 |
* Sets up the default options used on the settings page
|
410 |
*
|
411 |
* @access public
|
446 |
* Delete the "default options added" option
|
447 |
*
|
448 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
|
|
449 |
*/
|
450 |
public static function delete_default_options_set_option() {
|
451 |
delete_option( 'yit_plugin_fw_panel_wc_default_options_set' );
|
456 |
*
|
457 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
458 |
* @since 2.0
|
|
|
459 |
* @param $classes The body classes
|
|
|
460 |
* @return array Filtered body classes
|
461 |
*/
|
462 |
public static function admin_body_class( $admin_body_classes ) {
|
474 |
* @param $value mixed Option value
|
475 |
* @param $option mixed Option settings array
|
476 |
* @param $raw_value string Raw option value
|
|
|
477 |
* @return mixed Filtered return value
|
478 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
479 |
* @since 2.0
|
505 |
* @param $value mixed Option value
|
506 |
* @param $option mixed Option settings array
|
507 |
* @param $raw_value string Raw option value
|
|
|
508 |
* @return mixed Filtered return value
|
509 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
510 |
* @since 3.0.0
|
526 |
$value = $raw_value;
|
527 |
}
|
528 |
|
529 |
+
// sanitize the option date-format when the user choose the custom option
|
530 |
+
if ( isset( $option[ 'yith-type' ] ) && in_array( $option[ 'yith-type' ], array( 'date-format' ) ) && '\c\u\s\t\o\m' == $raw_value ) {
|
531 |
+
$custom = isset( $_REQUEST[ $option[ 'id' ] . '_text' ] ) ? $_REQUEST[ $option[ 'id' ] . '_text' ] : $option[ 'default' ];
|
532 |
+
$value = $custom;
|
533 |
+
}
|
534 |
|
535 |
+
if ( isset( $option[ 'yith-type' ] ) && in_array( $option[ 'yith-type' ], array( 'toggle-element' ) ) ) {
|
536 |
|
537 |
+
// error_log( print_r( $raw_value, true ) );
|
538 |
|
539 |
+
if ( $value && isset( $option[ 'elements' ] ) && !empty( $option[ 'elements' ] ) ) {
|
540 |
|
541 |
+
foreach ( $value as $index => $single_toggle ) {
|
542 |
|
543 |
+
if ( $value && isset( $option[ 'onoff_field' ] ) && !empty( $option[ 'onoff_field' ] ) ) {
|
544 |
+
$onoff = $option[ 'onoff_field' ];
|
545 |
+
$onoff[ 'type' ] = 'yith-field';
|
546 |
+
$onoff[ 'yith-type' ] = 'onoff';
|
547 |
+
$onoff_id = $onoff[ 'id' ];
|
548 |
|
549 |
+
$value[ $index ][ $onoff_id ] = isset( $single_toggle[ $onoff_id ] ) ? self::sanitize_option( $single_toggle[ $onoff_id ], $onoff, $single_toggle[ $onoff_id ] ) : 'no';
|
550 |
+
}
|
551 |
|
552 |
+
foreach ( $option[ 'elements' ] as $element ) {
|
553 |
+
$value[ $index ][ $element[ 'id' ] ] = self::sanitize_option( $value[ $index ][ $element[ 'id' ] ], $element, $value[ $index ][ $element[ 'id' ] ] );
|
554 |
+
}
|
555 |
+
}
|
556 |
+
}
|
557 |
|
558 |
|
559 |
+
// error_log('sanitizes value');
|
560 |
+
// error_log( print_r( $value, true ) );
|
561 |
+
}
|
562 |
|
563 |
|
564 |
+
if ( !empty( $option[ 'yith-sanitize-callback' ] ) && is_callable( $option[ 'yith-sanitize-callback' ] ) ) {
|
565 |
$value = call_user_func( $option[ 'yith-sanitize-callback' ], $value );
|
566 |
}
|
567 |
}
|
573 |
* Add YITH Fields
|
574 |
*
|
575 |
* @param array $field
|
|
|
576 |
* @return void
|
577 |
* @since 3.0.0
|
578 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
588 |
|
589 |
$value = apply_filters( 'yith_plugin_fw_wc_panel_pre_field_value', null, $field );
|
590 |
if ( is_null( $value ) ) {
|
591 |
+
if ( 'toggle-element' === $field[ 'type' ] ) {
|
592 |
+
$value = get_option( $field[ 'id' ], $field[ 'default' ] );
|
593 |
+
} else {
|
594 |
+
$value = WC_Admin_Settings::get_option( $field[ 'id' ], $field[ 'default' ] );
|
595 |
+
}
|
596 |
}
|
597 |
$field[ 'value' ] = $value;
|
598 |
|
600 |
}
|
601 |
}
|
602 |
|
603 |
+
/**
|
604 |
+
* Save the content of the toggle element present inside the panel.
|
605 |
+
* Called by the action 'admin_action_yith_plugin_fw_save_toggle_element'
|
606 |
+
* via Ajax
|
607 |
+
*
|
608 |
+
* @author Emanuela Castorina
|
609 |
+
*/
|
610 |
+
public function save_toggle_element_options() {
|
611 |
+
$posted = $_POST;
|
612 |
+
$tabs = $this->get_available_tabs();
|
613 |
+
$yit_options = $this->get_main_array_options();
|
614 |
+
$current_tab = isset( $_REQUEST[ 'tab' ] ) && in_array( $_REQUEST[ 'tab' ], $tabs ) ? $_REQUEST[ 'tab' ] : $tabs[ 0 ];
|
615 |
+
$option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
|
616 |
+
$updated = false;
|
617 |
|
618 |
+
if ( !empty( $yit_options[ $current_tab ] ) && !empty( $option_id ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
|
620 |
+
$tab_options = $yit_options[ $current_tab ];
|
621 |
+
foreach ( $tab_options as $key => $item ) {
|
622 |
+
if ( !isset( $item[ 'id' ] ) ) {
|
623 |
+
unset( $tab_options[ $key ] );
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
$option_array = array_combine( wp_list_pluck( $tab_options, 'id' ), $tab_options );
|
628 |
+
if ( isset( $option_array[ $option_id ] ) ) {
|
629 |
+
$value = isset( $posted[ $option_id ] ) ? $posted[ $option_id ] : '';
|
630 |
+
|
631 |
+
//drag and drop
|
632 |
+
$order_elements = isset( $posted[ 'yith_toggle_elements_order_keys' ] ) ? explode( ',', $posted[ 'yith_toggle_elements_order_keys' ] ) : false;
|
633 |
+
if ( $order_elements ) {
|
634 |
+
$i = 0;
|
635 |
+
$new_value = array();
|
636 |
+
foreach ( $order_elements as $key ) {
|
637 |
+
$index = apply_filters( 'yith_toggle_elements_index', $i++, $key );
|
638 |
+
$new_value[ $index ] = $value[ $key ];
|
639 |
+
}
|
640 |
+
|
641 |
+
$value = $new_value;
|
642 |
+
}
|
643 |
+
$value = self::sanitize_option( $value, $option_array[ $option_id ], $value );
|
644 |
+
$updated = update_option( $option_id, $value );
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
return $updated;
|
649 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
}
|
651 |
}
|
plugin-fw/lib/yith-system-status.php
ADDED
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file belongs to the YIT Plugin Framework.
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
+
* that is bundled with this package in the file LICENSE.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
} // Exit if accessed directly
|
14 |
+
|
15 |
+
if ( ! class_exists( 'YITH_System_Status' ) ) {
|
16 |
+
/**
|
17 |
+
* YITH System Status Panel
|
18 |
+
*
|
19 |
+
* Setting Page to Manage Plugins
|
20 |
+
*
|
21 |
+
* @class YITH_System_Status
|
22 |
+
* @package YITH
|
23 |
+
* @since 1.0
|
24 |
+
* @author Alberto Ruggiero
|
25 |
+
*/
|
26 |
+
class YITH_System_Status {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var array The settings require to add the submenu page "System Status"
|
30 |
+
*/
|
31 |
+
protected $_settings = array();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string the page slug
|
35 |
+
*/
|
36 |
+
protected $_page = 'yith_system_info';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var array plugins requirements list
|
40 |
+
*/
|
41 |
+
protected $_plugins_requirements = array();
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var array requirements labels
|
45 |
+
*/
|
46 |
+
protected $_requirement_labels = array();
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Single instance of the class
|
50 |
+
*
|
51 |
+
* @var \YITH_System_Status
|
52 |
+
* @since 1.0.0
|
53 |
+
*/
|
54 |
+
protected static $_instance = null;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Main plugin Instance
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
* @return YITH_System_Status
|
61 |
+
* @author Alberto Ruggiero
|
62 |
+
*/
|
63 |
+
public static function instance() {
|
64 |
+
if ( is_null( self::$_instance ) ) {
|
65 |
+
self::$_instance = new self();
|
66 |
+
}
|
67 |
+
|
68 |
+
return self::$_instance;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Constructor
|
73 |
+
*
|
74 |
+
* @since 1.0.0
|
75 |
+
* @return void
|
76 |
+
* @author Alberto Ruggiero
|
77 |
+
*/
|
78 |
+
public function __construct() {
|
79 |
+
|
80 |
+
if ( ! is_admin() ) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
$system_info = get_option( 'yith_system_info' );
|
85 |
+
$error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
|
86 |
+
|
87 |
+
$this->_settings = array(
|
88 |
+
'parent_page' => 'yith_plugin_panel',
|
89 |
+
'page_title' => __( 'System Status', 'yith-plugin-fw' ),
|
90 |
+
'menu_title' => __( 'System Status', 'yith-plugin-fw' ) . $error_notice,
|
91 |
+
'capability' => 'manage_options',
|
92 |
+
'page' => $this->_page,
|
93 |
+
);
|
94 |
+
|
95 |
+
$this->_requirement_labels = array(
|
96 |
+
'min_wp_version' => __( 'WordPress Version', 'yith-plugin-fw' ),
|
97 |
+
'min_wc_version' => __( 'WooCommerce Version', 'yith-plugin-fw' ),
|
98 |
+
'wp_memory_limit' => __( 'Available Memory', 'yith-plugin-fw' ),
|
99 |
+
'min_php_version' => __( 'PHP Version', 'yith-plugin-fw' ),
|
100 |
+
'min_tls_version' => __( 'TLS Version', 'yith-plugin-fw' ),
|
101 |
+
'wp_cron_enabled' => __( 'WordPress Cron', 'yith-plugin-fw' ),
|
102 |
+
'simplexml_enabled' => __( 'SimpleXML', 'yith-plugin-fw' ),
|
103 |
+
'mbstring_enabled' => __( 'MultiByte String', 'yith-plugin-fw' ),
|
104 |
+
'imagick_version' => __( 'ImageMagick Version', 'yith-plugin-fw' ),
|
105 |
+
'gd_enabled' => __( 'GD Library', 'yith-plugin-fw' ),
|
106 |
+
'opcache_enabled' => __( 'OPCache Save Comments', 'yith-plugin-fw' ),
|
107 |
+
'url_fopen_enabled' => __( 'URL FOpen', 'yith-plugin-fw' ),
|
108 |
+
);
|
109 |
+
|
110 |
+
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
111 |
+
add_action( 'admin_init', array( $this, 'check_system_status' ) );
|
112 |
+
add_action( 'admin_notices', array( $this, 'activate_system_notice' ), 15 );
|
113 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'dismissable_notice' ), 20 );
|
114 |
+
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Add "System Information" submenu page under YITH Plugins
|
120 |
+
*
|
121 |
+
* @since 1.0.0
|
122 |
+
* @return void
|
123 |
+
* @author Alberto Ruggiero
|
124 |
+
*/
|
125 |
+
public function add_submenu_page() {
|
126 |
+
add_submenu_page(
|
127 |
+
$this->_settings['parent_page'],
|
128 |
+
$this->_settings['page_title'],
|
129 |
+
$this->_settings['menu_title'],
|
130 |
+
$this->_settings['capability'],
|
131 |
+
$this->_settings['page'],
|
132 |
+
array( $this, 'show_information_panel' )
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Add "System Information" page template under YITH Plugins
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
* @return void
|
141 |
+
* @author Alberto Ruggiero
|
142 |
+
*/
|
143 |
+
public function show_information_panel() {
|
144 |
+
|
145 |
+
$path = defined( 'YIT_CORE_PLUGIN_PATH' ) ? YIT_CORE_PLUGIN_PATH : get_template_directory() . '/core/plugin-fw/';
|
146 |
+
$labels = $this->_requirement_labels;
|
147 |
+
|
148 |
+
require_once( $path . '/templates/sysinfo/system-information-panel.php' );
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Perform system status check
|
154 |
+
*
|
155 |
+
* @since 1.0.0
|
156 |
+
* @return void
|
157 |
+
* @author Alberto Ruggiero
|
158 |
+
*/
|
159 |
+
public function check_system_status() {
|
160 |
+
|
161 |
+
if ( '' == get_option( 'yith_system_info' ) || ( isset( $_GET['page'] ) && $_GET['page'] == $this->_page ) ) {
|
162 |
+
|
163 |
+
$this->add_requirements( __( 'YITH Plugins', 'yith-plugin-fw' ), array( 'min_wp_version' => '4.9', 'min_wc_version' => '3.4', 'min_php_version' => '5.6.20' ) );
|
164 |
+
$this->add_requirements( __( 'WooCommerce', 'yith-plugin-fw' ), array( 'wp_memory_limit' => '64M' ) );
|
165 |
+
|
166 |
+
$system_info = $this->get_system_info();
|
167 |
+
$check_results = array();
|
168 |
+
$errors = false;
|
169 |
+
|
170 |
+
foreach ( $system_info as $key => $value ) {
|
171 |
+
$check_results[ $key ] = array( 'value' => $value );
|
172 |
+
|
173 |
+
if ( isset( $this->_plugins_requirements[ $key ] ) ) {
|
174 |
+
|
175 |
+
foreach ( $this->_plugins_requirements[ $key ] as $plugin_name => $required_value ) {
|
176 |
+
|
177 |
+
switch ( $key ) {
|
178 |
+
case 'wp_cron_enabled' :
|
179 |
+
case 'mbstring_enabled' :
|
180 |
+
case 'simplexml_enabled':
|
181 |
+
case 'gd_enabled':
|
182 |
+
case 'url_fopen_enabled':
|
183 |
+
case 'opcache_enabled' :
|
184 |
+
|
185 |
+
if ( ! $value ) {
|
186 |
+
$check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
|
187 |
+
$errors = true;
|
188 |
+
}
|
189 |
+
break;
|
190 |
+
|
191 |
+
case 'wp_memory_limit' :
|
192 |
+
$required_memory = $this->memory_size_to_num( $required_value );
|
193 |
+
|
194 |
+
if ( $required_memory > $value ) {
|
195 |
+
$check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
|
196 |
+
$errors = true;
|
197 |
+
}
|
198 |
+
break;
|
199 |
+
|
200 |
+
default:
|
201 |
+
if ( ! version_compare( $value, $required_value, '>=' ) ) {
|
202 |
+
$check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
|
203 |
+
$errors = true;
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
update_option( 'yith_system_info', array( 'system_info' => $check_results, 'errors' => $errors ) );
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Handle plugin requirements
|
222 |
+
*
|
223 |
+
* @since 1.0.0
|
224 |
+
*
|
225 |
+
* @param $plugin_name string
|
226 |
+
* @param $requirements array
|
227 |
+
*
|
228 |
+
* @return void
|
229 |
+
* @author Alberto Ruggiero
|
230 |
+
*/
|
231 |
+
public function add_requirements( $plugin_name, $requirements ) {
|
232 |
+
|
233 |
+
$allowed_requirements = array_keys( $this->_requirement_labels );
|
234 |
+
|
235 |
+
foreach ( $requirements as $requirement => $value ) {
|
236 |
+
|
237 |
+
if ( in_array( $requirement, $allowed_requirements ) ) {
|
238 |
+
$this->_plugins_requirements[ $requirement ][ $plugin_name ] = $value;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Manages notice dismissing
|
246 |
+
*
|
247 |
+
* @since 1.0.0
|
248 |
+
* @return void
|
249 |
+
* @author Alberto Ruggiero
|
250 |
+
*/
|
251 |
+
public function dismissable_notice() {
|
252 |
+
$script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
|
253 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
254 |
+
wp_register_script( 'yith-system-info', $script_path . '/assets/js/yith-system-info' . $suffix . '.js', array( 'jquery' ), '1.0.0', true );
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Show system notice
|
259 |
+
*
|
260 |
+
* @since 1.0.0
|
261 |
+
* @return void
|
262 |
+
* @author Alberto Ruggiero
|
263 |
+
*/
|
264 |
+
public function activate_system_notice() {
|
265 |
+
|
266 |
+
$system_info = get_option( 'yith_system_info', '' );
|
267 |
+
|
268 |
+
if ( ( isset( $_GET['page'] ) && $_GET['page'] == $this->_page ) || ( ! empty( $_COOKIE['hide_yith_system_alert'] ) && 'yes' == $_COOKIE['hide_yith_system_alert'] ) || ( $system_info == '' ) || ( $system_info != '' && $system_info['errors'] === false ) ) {
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
|
272 |
+
$show_notice = true;
|
273 |
+
|
274 |
+
if ( true === $show_notice ) :
|
275 |
+
wp_enqueue_script( 'yith-system-info' );
|
276 |
+
?>
|
277 |
+
<div id="yith-system-alert" class="notice notice-error is-dismissible" style="position: relative;">
|
278 |
+
<p>
|
279 |
+
<span class="yith-logo"><img src="<?php echo yith_plugin_fw_get_default_logo() ?>" /></span>
|
280 |
+
<b><?php echo __( 'Warning!', 'yith-plugin-fw' ) ?></b><br />
|
281 |
+
<?php echo sprintf( __( 'The system check has detected some compatibility issues on your installation. %sClick here%s to know more', 'yith-plugin-fw' ), '<a href="' . esc_url( add_query_arg( array( 'page' => $this->_page ), admin_url( 'admin.php' ) ) ) . '">', '</a>' ) ?>
|
282 |
+
</p>
|
283 |
+
<span class="notice-dismiss"></span>
|
284 |
+
|
285 |
+
</div>
|
286 |
+
<?php endif;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Get system information
|
291 |
+
*
|
292 |
+
* @since 1.0.0
|
293 |
+
* @return array
|
294 |
+
* @author Alberto Ruggiero
|
295 |
+
*/
|
296 |
+
public function get_system_info() {
|
297 |
+
|
298 |
+
//Get TLS version
|
299 |
+
$ch = curl_init( 'https://www.howsmyssl.com/a/check' );
|
300 |
+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
301 |
+
$data = curl_exec( $ch );
|
302 |
+
curl_close( $ch );
|
303 |
+
$json = json_decode( $data );
|
304 |
+
$tls = str_replace( 'TLS ', '', $json->tls_version );
|
305 |
+
|
306 |
+
//Get PHP version
|
307 |
+
preg_match( "#^\d+(\.\d+)*#", PHP_VERSION, $match );
|
308 |
+
$php_version = $match[0];
|
309 |
+
|
310 |
+
// WP memory limit.
|
311 |
+
$wp_memory_limit = $this->memory_size_to_num( WP_MEMORY_LIMIT );
|
312 |
+
if ( function_exists( 'memory_get_usage' ) ) {
|
313 |
+
$wp_memory_limit = max( $wp_memory_limit, $this->memory_size_to_num( @ini_get( 'memory_limit' ) ) );
|
314 |
+
}
|
315 |
+
|
316 |
+
$imagick_version = '0.0.0';
|
317 |
+
if ( class_exists( 'Imagick' ) ) {
|
318 |
+
preg_match( "/([0-9]+\.[0-9]+\.[0-9]+)/", Imagick::getVersion()['versionString'], $imatch );
|
319 |
+
$imagick_version = $imatch[0];
|
320 |
+
}
|
321 |
+
|
322 |
+
return apply_filters( 'yith_system_additional_check', array(
|
323 |
+
'min_wp_version' => get_bloginfo( 'version' ),
|
324 |
+
'min_wc_version' => function_exists( 'WC' ) ? WC()->version : __( 'Not installed', 'yith-plugin-fw' ),
|
325 |
+
'wp_memory_limit' => $wp_memory_limit,
|
326 |
+
'min_php_version' => $php_version,
|
327 |
+
'min_tls_version' => $tls,
|
328 |
+
'imagick_version' => $imagick_version,
|
329 |
+
'wp_cron_enabled' => ! ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ),
|
330 |
+
'mbstring_enabled' => extension_loaded( 'mbstring' ),
|
331 |
+
'simplexml_enabled' => extension_loaded( 'simplexml' ),
|
332 |
+
'gd_enabled' => extension_loaded( 'gd' ) && function_exists( 'gd_info' ),
|
333 |
+
'opcache_enabled' => ini_get( 'opcache.save_comments' ),
|
334 |
+
'url_fopen_enabled' => ini_get( 'allow_url_fopen' ),
|
335 |
+
) );
|
336 |
+
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Convert site into number
|
341 |
+
*
|
342 |
+
* @since 1.0.0
|
343 |
+
*
|
344 |
+
* @param $memory_size string
|
345 |
+
*
|
346 |
+
* @return integer
|
347 |
+
* @author Alberto Ruggiero
|
348 |
+
*/
|
349 |
+
public function memory_size_to_num( $memory_size ) {
|
350 |
+
$unit = strtoupper( substr( $memory_size, - 1 ) );
|
351 |
+
$size = substr( $memory_size, 0, - 1 );
|
352 |
+
$multiplier = array(
|
353 |
+
'P' => 5,
|
354 |
+
'T' => 4,
|
355 |
+
'G' => 3,
|
356 |
+
'M' => 2,
|
357 |
+
'K' => 1,
|
358 |
+
);
|
359 |
+
for ( $i = 1; $i <= $multiplier[ $unit ]; $i ++ ) {
|
360 |
+
$size *= 1024;
|
361 |
+
}
|
362 |
+
|
363 |
+
return $size;
|
364 |
+
}
|
365 |
+
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Main instance of plugin
|
371 |
+
*
|
372 |
+
* @return YITH_System_Status object
|
373 |
+
* @since 1.0
|
374 |
+
* @author Alberto Ruggiero
|
375 |
+
*/
|
376 |
+
if ( ! function_exists( 'YITH_System_Status' ) ) {
|
377 |
+
function YITH_System_Status() {
|
378 |
+
return YITH_System_Status::instance();
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
YITH_System_Status();
|
plugin-fw/templates/fields/colorpicker.php
CHANGED
@@ -25,3 +25,4 @@ $class = !empty( $class ) ? $class : 'yith-plugin-fw-colorpicker';
|
|
25 |
class="<?php echo $class ?>"
|
26 |
<?php echo $custom_attributes ?>
|
27 |
<?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
|
|
25 |
class="<?php echo $class ?>"
|
26 |
<?php echo $custom_attributes ?>
|
27 |
<?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
|
28 |
+
|
plugin-fw/templates/fields/list-table.php
CHANGED
@@ -17,7 +17,7 @@ if ( isset( $add_new_button ) && isset( $post_type ) ) {
|
|
17 |
$show_button = true;
|
18 |
$admin_url = admin_url( 'post-new.php' );
|
19 |
$params['post_type'] = $post_type;
|
20 |
-
$add_new_url = esc_url( add_query_arg( $params, $admin_url ) );
|
21 |
}
|
22 |
|
23 |
if ( isset( $list_table_class ) && ! class_exists( $list_table_class ) && isset( $list_table_class_dir ) ) {
|
@@ -25,7 +25,7 @@ if ( isset( $list_table_class ) && ! class_exists( $list_table_class ) && isset(
|
|
25 |
}
|
26 |
|
27 |
if ( class_exists( $list_table_class ) ):
|
28 |
-
$list_table = new $list_table_class();
|
29 |
?>
|
30 |
|
31 |
<div id="<?php echo $id ?>" class="yith-plugin-fw-list-table <?php echo $class ?>">
|
@@ -49,6 +49,9 @@ if ( class_exists( $list_table_class ) ):
|
|
49 |
$list_table->views();
|
50 |
?>
|
51 |
<form method="post">
|
|
|
|
|
|
|
52 |
<?php
|
53 |
$list_table->display();
|
54 |
?>
|
17 |
$show_button = true;
|
18 |
$admin_url = admin_url( 'post-new.php' );
|
19 |
$params['post_type'] = $post_type;
|
20 |
+
$add_new_url = apply_filters( 'yith_plugin_fw_add_new_post_url', esc_url( add_query_arg( $params, $admin_url ) ), $params, isset( $args ) ? $args : false );
|
21 |
}
|
22 |
|
23 |
if ( isset( $list_table_class ) && ! class_exists( $list_table_class ) && isset( $list_table_class_dir ) ) {
|
25 |
}
|
26 |
|
27 |
if ( class_exists( $list_table_class ) ):
|
28 |
+
$list_table = isset( $args ) ? new $list_table_class( $args ) : new $list_table_class() ;
|
29 |
?>
|
30 |
|
31 |
<div id="<?php echo $id ?>" class="yith-plugin-fw-list-table <?php echo $class ?>">
|
49 |
$list_table->views();
|
50 |
?>
|
51 |
<form method="post">
|
52 |
+
<?php if( isset( $search_form ) ) {
|
53 |
+
$list_table->search_box( $search_form['text'], $search_form['input_id'] );
|
54 |
+
} ?>
|
55 |
<?php
|
56 |
$list_table->display();
|
57 |
?>
|
plugin-fw/templates/fields/radio.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This file belongs to the YIT Plugin Framework.
|
4 |
-
*
|
5 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
* that is bundled with this package in the file LICENSE.txt.
|
7 |
* It is also available through the world-wide-web at this URL:
|
@@ -31,3 +30,4 @@ $class = 'yith-plugin-fw-radio ' . $class;
|
|
31 |
</div>
|
32 |
<?php endforeach; ?>
|
33 |
</div>
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This file belongs to the YIT Plugin Framework.
|
|
|
4 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
30 |
</div>
|
31 |
<?php endforeach; ?>
|
32 |
</div>
|
33 |
+
|
plugin-fw/templates/fields/upload.php
CHANGED
@@ -14,15 +14,15 @@
|
|
14 |
|
15 |
extract( $field );
|
16 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
<input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php if ( isset( $default ) ) : ?>data-std="<?php echo $default ?>"<?php endif ?> class="yith-plugin-fw-upload-img-url"/>
|
18 |
<button class="button-secondary yith-plugin-fw-upload-button" id="<?php echo $id ?>-button"><?php _e( 'Upload', 'yith-plugin-fw' ) ?></button>
|
19 |
<button type="button" id="<?php echo $id ?>-button-reset" class="yith-plugin-fw-upload-button-reset button"
|
20 |
data-default="<?php echo isset( $default ) ? $default : '' ?>"><?php _e( 'Reset', 'yith-plugin-fw' ) ?></button>
|
21 |
-
<div class="yith-plugin-fw-upload-img-preview" style="margin-top:10px;">
|
22 |
-
<?php
|
23 |
-
$file = $value;
|
24 |
-
if ( preg_match( '/(jpg|jpeg|png|gif|ico)$/', $file ) ) {
|
25 |
-
echo "<img src='$file' style='max-width:600px; max-height:300px;' />";
|
26 |
-
}
|
27 |
-
?>
|
28 |
-
</div>
|
14 |
|
15 |
extract( $field );
|
16 |
?>
|
17 |
+
<div class="yith-plugin-fw-upload-img-preview" style="margin-top:10px;">
|
18 |
+
<?php
|
19 |
+
$file = $value;
|
20 |
+
if ( preg_match( '/(jpg|jpeg|png|gif|ico)$/', $file ) ) {
|
21 |
+
echo "<img src='$file' style='max-width:600px; max-height:300px;' />";
|
22 |
+
}
|
23 |
+
?>
|
24 |
+
</div>
|
25 |
<input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php if ( isset( $default ) ) : ?>data-std="<?php echo $default ?>"<?php endif ?> class="yith-plugin-fw-upload-img-url"/>
|
26 |
<button class="button-secondary yith-plugin-fw-upload-button" id="<?php echo $id ?>-button"><?php _e( 'Upload', 'yith-plugin-fw' ) ?></button>
|
27 |
<button type="button" id="<?php echo $id ?>-button-reset" class="yith-plugin-fw-upload-button-reset button"
|
28 |
data-default="<?php echo isset( $default ) ? $default : '' ?>"><?php _e( 'Reset', 'yith-plugin-fw' ) ?></button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/templates/sysinfo/system-information-panel.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* This file belongs to the YIT Framework.
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
+
* that is bundled with this package in the file LICENSE.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
+
*/
|
10 |
+
|
11 |
+
$system_info = get_option( 'yith_system_info' );
|
12 |
+
$recommended_memory = '128M';
|
13 |
+
|
14 |
+
?>
|
15 |
+
<div id="yith-sysinfo" class="wrap yith-system-info">
|
16 |
+
<h1>
|
17 |
+
<span class="yith-logo"><img src="<?php echo yith_plugin_fw_get_default_logo() ?>" /></span> <?php _e( 'YITH System Information', 'yith-plugin-fw' ) ?>
|
18 |
+
</h1>
|
19 |
+
|
20 |
+
<?php if ( ! isset( $_GET['yith-phpinfo'] ) || $_GET['yith-phpinfo'] != 'true' ): ?>
|
21 |
+
|
22 |
+
<table class="widefat striped">
|
23 |
+
<?php foreach ( $system_info['system_info'] as $key => $item ): ?>
|
24 |
+
<?php
|
25 |
+
$to_be_enabled = strpos( $key, '_enabled' ) !== false;
|
26 |
+
$has_errors = isset( $item['errors'] );
|
27 |
+
$has_warnings = false;
|
28 |
+
|
29 |
+
if ( $key == 'wp_memory_limit' && ! $has_errors ) {
|
30 |
+
$has_warnings = $item['value'] < $recommended_memory;
|
31 |
+
}
|
32 |
+
|
33 |
+
?>
|
34 |
+
<tr>
|
35 |
+
<th class="requirement-name">
|
36 |
+
<?php echo $labels[ $key ]; ?>
|
37 |
+
</th>
|
38 |
+
<td class="requirement-value <?php echo( $has_errors ? 'has-errors' : '' ) ?> <?php echo( $has_warnings ? 'has-warnings' : '' ) ?>">
|
39 |
+
<span class="dashicons dashicons-<?php echo( $has_errors || $has_warnings ? 'warning' : 'yes' ) ?>"></span>
|
40 |
+
|
41 |
+
<?php if ( $to_be_enabled ) {
|
42 |
+
echo $item['value'] ? __( 'Enabled', 'yith-plugin-fw' ) : __( 'Disabled', 'yith-plugin-fw' );
|
43 |
+
} elseif ( $key == 'wp_memory_limit' ) {
|
44 |
+
echo esc_html( size_format( $item['value'] ) );
|
45 |
+
} else {
|
46 |
+
echo $item['value'];
|
47 |
+
} ?>
|
48 |
+
|
49 |
+
</td>
|
50 |
+
<td class="requirement-messages">
|
51 |
+
<?php if ( $has_errors ) : ?>
|
52 |
+
<ul>
|
53 |
+
<?php foreach ( $item['errors'] as $plugin => $requirement ) : ?>
|
54 |
+
<li>
|
55 |
+
<?php if ( $to_be_enabled ) {
|
56 |
+
echo sprintf( __( '%s needs %s enabled', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<b>' . $labels[ $key ] . '</b>' );
|
57 |
+
} elseif ( $key == 'wp_memory_limit' ) {
|
58 |
+
echo sprintf( __( '%s needs at least %s of available memory', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $requirement ) ) ) . '</span>' );
|
59 |
+
echo '<br/>';
|
60 |
+
echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $recommended_memory ) ) ) . '</span>' );
|
61 |
+
|
62 |
+
} else {
|
63 |
+
echo sprintf( __( '%s needs at least %s version', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . $requirement . '</span>' );
|
64 |
+
} ?>
|
65 |
+
</li>
|
66 |
+
<?php endforeach; ?>
|
67 |
+
</ul>
|
68 |
+
<?php switch ( $key ) {
|
69 |
+
|
70 |
+
case 'min_wp_version':
|
71 |
+
case 'min_wc_version':
|
72 |
+
echo __( 'Update it to the latest version in order to benefit of all new features and security updates.', 'yith-plugin-fw' );
|
73 |
+
break;
|
74 |
+
case 'min_php_version':
|
75 |
+
case 'min_tls_version':
|
76 |
+
case 'imagick_version':
|
77 |
+
echo __( 'Contact your hosting company in order to update it.', 'yith-plugin-fw' );
|
78 |
+
break;
|
79 |
+
case 'wp_cron_enabled':
|
80 |
+
echo sprintf( __( 'Remove %s from %s file', 'yith-plugin-fw' ), '<code>define( \'DISABLE_WP_CRON\', true );</code>', '<b>wp-config.php</b>' );
|
81 |
+
break;
|
82 |
+
case 'mbstring_enabled':
|
83 |
+
case 'simplexml_enabled':
|
84 |
+
case 'gd_enabled':
|
85 |
+
case 'opcache_enabled':
|
86 |
+
case 'url_fopen_enabled':
|
87 |
+
echo __( 'Contact your hosting company in order to enable it.', 'yith-plugin-fw' );
|
88 |
+
break;
|
89 |
+
case 'wp_memory_limit':
|
90 |
+
echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' );
|
91 |
+
break;
|
92 |
+
default:
|
93 |
+
echo apply_filters( 'yith_system_generic_message', '', $item );
|
94 |
+
|
95 |
+
} ?>
|
96 |
+
<?php endif; ?>
|
97 |
+
|
98 |
+
<?php if ( $has_warnings ) : ?>
|
99 |
+
<ul>
|
100 |
+
<li>
|
101 |
+
<?php echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="warning">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $recommended_memory ) ) ) . '</span>' ); ?>
|
102 |
+
</li>
|
103 |
+
</ul>
|
104 |
+
<?php echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' ); ?>
|
105 |
+
<?php endif; ?>
|
106 |
+
</td>
|
107 |
+
</tr>
|
108 |
+
<?php endforeach; ?>
|
109 |
+
</table>
|
110 |
+
|
111 |
+
<a href="<?php echo add_query_arg( array( 'yith-phpinfo' => 'true' ) ) ?> "><?php _e( 'Show full PHPInfo', 'yith-plugin-fw' ) ?></a>
|
112 |
+
|
113 |
+
<?php else : ?>
|
114 |
+
|
115 |
+
<a href="<?php echo add_query_arg( array( 'yith-phpinfo' => 'false' ) ) ?> "><?php _e( 'Back to System panel', 'yith-plugin-fw' ) ?></a>
|
116 |
+
|
117 |
+
<?php
|
118 |
+
|
119 |
+
ob_start();
|
120 |
+
phpinfo( 61 );
|
121 |
+
$pinfo = ob_get_contents();
|
122 |
+
ob_end_clean();
|
123 |
+
|
124 |
+
$pinfo = preg_replace( '%^.*<div class="center">(.*)</div>.*$%ms', '$1', $pinfo );
|
125 |
+
$pinfo = preg_replace( '%(^.*)<a name=\".*\">(.*)</a>(.*$)%m', '$1$2$3', $pinfo );
|
126 |
+
$pinfo = str_replace( '<table>', '<table class="widefat striped yith-phpinfo">', $pinfo );
|
127 |
+
$pinfo = str_replace( '<td class="e">', '<th class="e">', $pinfo );
|
128 |
+
echo $pinfo;
|
129 |
+
|
130 |
+
?>
|
131 |
+
|
132 |
+
<a href="#yith-sysinfo"><?php _e( 'Back to top', 'yith-plugin-fw' ) ?></a>
|
133 |
+
|
134 |
+
<?php endif; ?>
|
135 |
+
</div>
|
plugin-fw/yit-functions.php
CHANGED
@@ -1376,4 +1376,15 @@ if ( ! function_exists( 'yith_plugin_fw_remove_duplicate_classes' ) ) {
|
|
1376 |
|
1377 |
return $classes;
|
1378 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1379 |
}
|
1376 |
|
1377 |
return $classes;
|
1378 |
}
|
1379 |
+
}
|
1380 |
+
|
1381 |
+
if ( ! function_exists( 'yith_plugin_fw_add_requirements' ) ) {
|
1382 |
+
|
1383 |
+
function yith_plugin_fw_add_requirements( $plugin_name, $requirements ) {
|
1384 |
+
if ( ! empty( $requirements ) ) {
|
1385 |
+
YITH_System_Status()->add_requirements( $plugin_name, $requirements );
|
1386 |
+
|
1387 |
+
|
1388 |
+
}
|
1389 |
+
}
|
1390 |
}
|
plugin-fw/yit-plugin.php
CHANGED
@@ -40,6 +40,7 @@ include_once( 'lib/yith-dashboard.php' );
|
|
40 |
include_once( 'lib/privacy/yit-privacy.php' );
|
41 |
include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
|
42 |
include_once( 'lib/promo/yith-promo.php' );
|
|
|
43 |
|
44 |
/* === Gutenberg Support === */
|
45 |
if( class_exists( 'WP_Block_Type_Registry' ) ){
|
@@ -183,6 +184,7 @@ if( ! function_exists( 'yith_add_action_links' ) ){
|
|
183 |
* @use plugin_action_links_{$plugin_file_name}
|
184 |
*/
|
185 |
function yith_add_action_links( $links, $panel_page = '', $is_premium = false ) {
|
|
|
186 |
if( ! empty( $panel_page ) ){
|
187 |
$links[] = sprintf( '<a href="%s">%s</a>', admin_url( "admin.php?page={$panel_page}" ), _x( 'Settings', 'Action links', 'yith-plugin-fw' ) );
|
188 |
}
|
40 |
include_once( 'lib/privacy/yit-privacy.php' );
|
41 |
include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
|
42 |
include_once( 'lib/promo/yith-promo.php' );
|
43 |
+
include_once( 'lib/yith-system-status.php' );
|
44 |
|
45 |
/* === Gutenberg Support === */
|
46 |
if( class_exists( 'WP_Block_Type_Registry' ) ){
|
184 |
* @use plugin_action_links_{$plugin_file_name}
|
185 |
*/
|
186 |
function yith_add_action_links( $links, $panel_page = '', $is_premium = false ) {
|
187 |
+
$links = is_array( $links ) ? $links : array();
|
188 |
if( ! empty( $panel_page ) ){
|
189 |
$links[] = sprintf( '<a href="%s">%s</a>', admin_url( "admin.php?page={$panel_page}" ), _x( 'Settings', 'Action links', 'yith-plugin-fw' ) );
|
190 |
}
|
plugin-options/settings-options.php
CHANGED
@@ -17,29 +17,6 @@ return array(
|
|
17 |
|
18 |
'settings' => array(
|
19 |
|
20 |
-
'section_general_settings_videobox' => array(
|
21 |
-
'name' => __( 'Upgrade to the PREMIUM VERSION', 'yith-woocommerce-ajax-search' ),
|
22 |
-
'type' => 'videobox',
|
23 |
-
'default' => array(
|
24 |
-
'plugin_name' => __( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' ),
|
25 |
-
'title_first_column' => __( 'Discover the Advanced Features', 'yith-woocommerce-ajax-search' ),
|
26 |
-
'description_first_column' => __('Upgrade to the PREMIUM VERSION
|
27 |
-
of YITH WOOCOMMERCE AJAX SEARCH to benefit from all features!', 'yith-woocommerce-ajax-search'),
|
28 |
-
'video' => array(
|
29 |
-
'video_id' => '118917627',
|
30 |
-
'video_image_url' => YITH_WCAS_ASSETS_IMAGES_URL.'ajax-search-premium.jpg',
|
31 |
-
'video_description' => __( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' ),
|
32 |
-
),
|
33 |
-
'title_second_column' => __( 'Get Support and Pro Features', 'yith-woocommerce-ajax-search' ),
|
34 |
-
'description_second_column' => __('By purchasing the premium version of the plugin, you will take advantage of the advanced features of the product and you will get one year of free updates and support through our platform available 24h/24.', 'yith-woocommerce-ajax-search'),
|
35 |
-
'button' => array(
|
36 |
-
'href' => $yith_wcas->obj->get_premium_landing_uri(),
|
37 |
-
'title' => 'Get Support and Pro Features'
|
38 |
-
)
|
39 |
-
),
|
40 |
-
'id' => 'yith_wcas_general_videobox'
|
41 |
-
),
|
42 |
-
|
43 |
'section_general_settings' => array(
|
44 |
'name' => __( 'General settings', 'yith-woocommerce-ajax-search' ),
|
45 |
'type' => 'title',
|
@@ -93,13 +70,14 @@ of YITH WOOCOMMERCE AJAX SEARCH to benefit from all features!', 'yith-woocommerc
|
|
93 |
)
|
94 |
),
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
103 |
|
104 |
|
105 |
'transient_duration' => array(
|
@@ -107,7 +85,13 @@ of YITH WOOCOMMERCE AJAX SEARCH to benefit from all features!', 'yith-woocommerc
|
|
107 |
'desc' => __( '(hours)','yith-woocommerce-ajax-search' ),
|
108 |
'id' => 'yith_wcas_transient_duration',
|
109 |
'default' => 12,
|
110 |
-
'type'
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
),
|
112 |
|
113 |
|
17 |
|
18 |
'settings' => array(
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
'section_general_settings' => array(
|
21 |
'name' => __( 'General settings', 'yith-woocommerce-ajax-search' ),
|
22 |
'type' => 'title',
|
70 |
)
|
71 |
),
|
72 |
|
73 |
+
'enable_transient' => array(
|
74 |
+
'name' => __( 'Enable transients to cache autocomplete results', 'yith-woocommerce-ajax-search' ),
|
75 |
+
'desc' => __( 'Save the results of a query in a transient', 'yith-woocommerce-ajax-search' ),
|
76 |
+
'id' => 'yith_wcas_enable_transient',
|
77 |
+
'default' => 'no',
|
78 |
+
'type' => 'yith-field',
|
79 |
+
'yith-type' => 'onoff',
|
80 |
+
),
|
81 |
|
82 |
|
83 |
'transient_duration' => array(
|
85 |
'desc' => __( '(hours)','yith-woocommerce-ajax-search' ),
|
86 |
'id' => 'yith_wcas_transient_duration',
|
87 |
'default' => 12,
|
88 |
+
'type' => 'yith-field',
|
89 |
+
'yith-type' => 'text',
|
90 |
+
'deps' => array(
|
91 |
+
'id' => 'yith_wcas_enable_transient',
|
92 |
+
'value' => 'yes',
|
93 |
+
'type' => 'hide'
|
94 |
+
),
|
95 |
),
|
96 |
|
97 |
|