Version Description
Released: 07 October 2020 =
New: Support for WooCommerce 4.6
Update: plugin framework
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Catalog Mode |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- init.php +3 -3
- plugin-fw/Gruntfile.js +65 -17
- plugin-fw/assets/css/yith-fields.css +37 -3
- plugin-fw/assets/js/yith-fields.js +183 -183
- plugin-fw/assets/js/yith-fields.min.js +1 -1
- plugin-fw/assets/js/yith-gutenberg.js +211 -211
- plugin-fw/assets/js/yith-gutenberg.min.js +6 -1
- plugin-fw/bin/clean-language-files.js +36 -0
- plugin-fw/bin/download-translations-config.json +27 -0
- plugin-fw/bin/download-translations.js +57 -0
- plugin-fw/init.php +1 -1
- plugin-fw/lib/yit-plugin-panel.php +127 -93
- plugin-fw/package.json +7 -1
- plugin-fw/templates/sysinfo/system-information-panel.php +10 -2
- readme.txt +7 -2
init.php
CHANGED
@@ -5,10 +5,10 @@
|
|
5 |
* Description: <code><strong>YITH WooCommerce Catalog Mode</strong></code> allows hiding product prices, cart and checkout from your store and turning it into a performing product catalogue. You will be able to adjust your catalogue settings as you prefer based on your requirements. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
|
6 |
* Author: YITH
|
7 |
* Text Domain: yith-woocommerce-catalog-mode
|
8 |
-
* Version: 2.0.
|
9 |
* Author URI: https://yithemes.com/
|
10 |
* WC requires at least: 4.0.0
|
11 |
-
* WC tested up to: 4.
|
12 |
*
|
13 |
* @package YITH WooCommerce Catalog Mode
|
14 |
*/
|
@@ -61,7 +61,7 @@ function ywctm_install_free_admin_notice() {
|
|
61 |
<?php
|
62 |
}
|
63 |
|
64 |
-
! defined( 'YWCTM_VERSION' ) && define( 'YWCTM_VERSION', '2.0.
|
65 |
! defined( 'YWCTM_FREE_INIT' ) && define( 'YWCTM_FREE_INIT', plugin_basename( __FILE__ ) );
|
66 |
! defined( 'YWCTM_SLUG' ) && define( 'YWCTM_SLUG', 'yith-woocommerce-catalog-mode' );
|
67 |
! defined( 'YWCTM_FILE' ) && define( 'YWCTM_FILE', __FILE__ );
|
5 |
* Description: <code><strong>YITH WooCommerce Catalog Mode</strong></code> allows hiding product prices, cart and checkout from your store and turning it into a performing product catalogue. You will be able to adjust your catalogue settings as you prefer based on your requirements. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
|
6 |
* Author: YITH
|
7 |
* Text Domain: yith-woocommerce-catalog-mode
|
8 |
+
* Version: 2.0.5
|
9 |
* Author URI: https://yithemes.com/
|
10 |
* WC requires at least: 4.0.0
|
11 |
+
* WC tested up to: 4.6.x
|
12 |
*
|
13 |
* @package YITH WooCommerce Catalog Mode
|
14 |
*/
|
61 |
<?php
|
62 |
}
|
63 |
|
64 |
+
! defined( 'YWCTM_VERSION' ) && define( 'YWCTM_VERSION', '2.0.5' );
|
65 |
! defined( 'YWCTM_FREE_INIT' ) && define( 'YWCTM_FREE_INIT', plugin_basename( __FILE__ ) );
|
66 |
! defined( 'YWCTM_SLUG' ) && define( 'YWCTM_SLUG', 'yith-woocommerce-catalog-mode' );
|
67 |
! defined( 'YWCTM_FILE' ) && define( 'YWCTM_FILE', __FILE__ );
|
plugin-fw/Gruntfile.js
CHANGED
@@ -1,12 +1,7 @@
|
|
1 |
-
/**
|
2 |
-
* in vagrant ssh, launch:
|
3 |
-
* - npm install
|
4 |
-
* - grunt (or use npm scripts in package.json)
|
5 |
-
*/
|
6 |
-
|
7 |
const potInfo = {
|
8 |
-
|
9 |
-
|
|
|
10 |
poedit : true, // Includes common Poedit headers.
|
11 |
'x-poedit-keywordslist': true, // Include a list of all possible gettext functions.
|
12 |
'report-msgid-bugs-to' : 'YITH <plugins@yithemes.com>',
|
@@ -63,23 +58,81 @@ module.exports = function ( grunt ) {
|
|
63 |
type : 'wp-plugin',
|
64 |
domainPath : 'languages',
|
65 |
domain : 'yith-plugin-fw',
|
66 |
-
potHeaders : potInfo.
|
67 |
-
updatePoFiles:
|
68 |
},
|
69 |
dist : {
|
70 |
options: {
|
71 |
-
potFilename: potInfo.
|
72 |
exclude : [
|
|
|
73 |
'node_modules/.*',
|
74 |
'tests/.*',
|
75 |
-
'tmp/.*'
|
|
|
76 |
]
|
77 |
}
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
} );
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
// Load NPM tasks to be used here.
|
84 |
grunt.loadNpmTasks( 'grunt-wp-i18n' );
|
85 |
|
@@ -88,9 +141,4 @@ module.exports = function ( grunt ) {
|
|
88 |
|
89 |
// Register tasks.
|
90 |
grunt.registerTask( 'js', ['uglify'] );
|
91 |
-
grunt.registerTask( 'i18n', ['makepot'] );
|
92 |
-
grunt.registerTask( 'default', [
|
93 |
-
'js',
|
94 |
-
'i18n'
|
95 |
-
] );
|
96 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
const potInfo = {
|
2 |
+
languageFolderPath: './languages/',
|
3 |
+
filename : 'yith-plugin-fw.pot',
|
4 |
+
headers : {
|
5 |
poedit : true, // Includes common Poedit headers.
|
6 |
'x-poedit-keywordslist': true, // Include a list of all possible gettext functions.
|
7 |
'report-msgid-bugs-to' : 'YITH <plugins@yithemes.com>',
|
58 |
type : 'wp-plugin',
|
59 |
domainPath : 'languages',
|
60 |
domain : 'yith-plugin-fw',
|
61 |
+
potHeaders : potInfo.headers,
|
62 |
+
updatePoFiles: false
|
63 |
},
|
64 |
dist : {
|
65 |
options: {
|
66 |
+
potFilename: potInfo.filename,
|
67 |
exclude : [
|
68 |
+
'bin/.*',
|
69 |
'node_modules/.*',
|
70 |
'tests/.*',
|
71 |
+
'tmp/.*',
|
72 |
+
'vendor/.*'
|
73 |
]
|
74 |
}
|
75 |
}
|
76 |
+
},
|
77 |
+
update_po: {
|
78 |
+
options: {
|
79 |
+
template: potInfo.languageFolderPath + potInfo.filename
|
80 |
+
},
|
81 |
+
build : {
|
82 |
+
src: potInfo.languageFolderPath + '*.po'
|
83 |
+
}
|
84 |
}
|
85 |
|
86 |
} );
|
87 |
|
88 |
+
grunt.registerMultiTask( 'update_po', 'This task update .po strings by .pot', function () {
|
89 |
+
grunt.log.writeln( 'Updating .po files.' );
|
90 |
+
|
91 |
+
var done = this.async(),
|
92 |
+
options = this.options(),
|
93 |
+
template = options.template;
|
94 |
+
this.files.forEach( function ( file ) {
|
95 |
+
if ( file.src.length ) {
|
96 |
+
var counter = file.src.length;
|
97 |
+
|
98 |
+
grunt.log.writeln( 'Processing ' + file.src.length + ' files.' );
|
99 |
+
|
100 |
+
file.src.forEach( function ( fileSrc ) {
|
101 |
+
grunt.util.spawn( {
|
102 |
+
cmd : 'msgmerge',
|
103 |
+
args: ['-U', fileSrc, template]
|
104 |
+
}, function ( error, result, code ) {
|
105 |
+
const output = fileSrc.replace( '.po', '.mo' );
|
106 |
+
grunt.log.writeln( 'Updating: ' + fileSrc + ' ...' );
|
107 |
+
|
108 |
+
if ( error ) {
|
109 |
+
grunt.verbose.error();
|
110 |
+
} else {
|
111 |
+
grunt.verbose.ok();
|
112 |
+
}
|
113 |
+
|
114 |
+
// Updating also the .mo files
|
115 |
+
grunt.util.spawn( {
|
116 |
+
cmd : 'msgfmt',
|
117 |
+
args: [fileSrc, '-o', output]
|
118 |
+
}, function ( moError, moResult, moCode ) {
|
119 |
+
grunt.log.writeln( 'Updating MO for: ' + fileSrc + ' ...' );
|
120 |
+
counter--;
|
121 |
+
if ( moError || counter === 0 ) {
|
122 |
+
done( moError );
|
123 |
+
}
|
124 |
+
} );
|
125 |
+
if ( error ) {
|
126 |
+
done( error );
|
127 |
+
}
|
128 |
+
} );
|
129 |
+
} );
|
130 |
+
} else {
|
131 |
+
grunt.log.writeln( 'No file to process.' );
|
132 |
+
}
|
133 |
+
} );
|
134 |
+
} );
|
135 |
+
|
136 |
// Load NPM tasks to be used here.
|
137 |
grunt.loadNpmTasks( 'grunt-wp-i18n' );
|
138 |
|
141 |
|
142 |
// Register tasks.
|
143 |
grunt.registerTask( 'js', ['uglify'] );
|
|
|
|
|
|
|
|
|
|
|
144 |
};
|
plugin-fw/assets/css/yith-fields.css
CHANGED
@@ -2111,9 +2111,10 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2111 |
}
|
2112 |
|
2113 |
.yith-plugin-ui span.description {
|
2114 |
-
margin-top
|
2115 |
-
line-height
|
2116 |
-
max-width
|
|
|
2117 |
}
|
2118 |
|
2119 |
.yith-plugin-fw-option-with-description {
|
@@ -2264,9 +2265,41 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2264 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2265 |
width : 80%;
|
2266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2267 |
}
|
2268 |
|
2269 |
@media screen and (max-width : 1024px) {
|
|
|
2270 |
.yith-plugin-ui .yith-add-box,
|
2271 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2272 |
width : 90%;
|
@@ -2291,6 +2324,7 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2291 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2292 |
clear : initial;
|
2293 |
}
|
|
|
2294 |
}
|
2295 |
|
2296 |
@media screen and (max-width : 782px) {
|
2111 |
}
|
2112 |
|
2113 |
.yith-plugin-ui span.description {
|
2114 |
+
margin-top: 10px;
|
2115 |
+
line-height: 20px;
|
2116 |
+
max-width: 40%;
|
2117 |
+
min-width: min(100%,360px);
|
2118 |
}
|
2119 |
|
2120 |
.yith-plugin-fw-option-with-description {
|
2265 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2266 |
width : 80%;
|
2267 |
}
|
2268 |
+
|
2269 |
+
|
2270 |
+
.yith-plugin-ui .yith-add-box-row,
|
2271 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row,
|
2272 |
+
.yith-plugin-ui .yith-add-box-row label{
|
2273 |
+
display:block;
|
2274 |
+
}
|
2275 |
+
|
2276 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row > label{
|
2277 |
+
display:block;
|
2278 |
+
}
|
2279 |
+
|
2280 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-option-with-description {
|
2281 |
+
width: 100%;
|
2282 |
+
}
|
2283 |
+
|
2284 |
+
.yith-plugin-ui .yith-add-box-row,
|
2285 |
+
.yith-plugin-ui .yith-add-box-row label {
|
2286 |
+
display: block;
|
2287 |
+
}
|
2288 |
+
|
2289 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-plugin-fw-option-with-description,
|
2290 |
+
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description {
|
2291 |
+
display: block;
|
2292 |
+
padding-top: 20px;
|
2293 |
+
}
|
2294 |
+
|
2295 |
+
|
2296 |
+
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description span.description {
|
2297 |
+
max-width: 100%;
|
2298 |
+
}
|
2299 |
}
|
2300 |
|
2301 |
@media screen and (max-width : 1024px) {
|
2302 |
+
|
2303 |
.yith-plugin-ui .yith-add-box,
|
2304 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2305 |
width : 90%;
|
2324 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2325 |
clear : initial;
|
2326 |
}
|
2327 |
+
|
2328 |
}
|
2329 |
|
2330 |
@media screen and (max-width : 782px) {
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -41,15 +41,15 @@
|
|
41 |
|
42 |
/* Colorpicker */
|
43 |
$colorpicker.wpColorPicker( {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
|
55 |
$colorpicker.each( function () {
|
@@ -64,15 +64,15 @@
|
|
64 |
|
65 |
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
66 |
var button = $( '<span/>' ).attr( {
|
67 |
-
|
68 |
-
|
69 |
wrap1.find( '.wp-picker-default' ).wrap( button );
|
70 |
}
|
71 |
|
72 |
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
73 |
var button = $( '<span/>' ).attr( {
|
74 |
-
|
75 |
-
|
76 |
wrap2.find( '.wp-picker-default' ).wrap( button );
|
77 |
}
|
78 |
} );
|
@@ -84,7 +84,7 @@
|
|
84 |
// preview
|
85 |
$upload.imgUrl.change( function () {
|
86 |
var url = $( this ).val(),
|
87 |
-
|
88 |
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
89 |
|
90 |
if ( preview.length < 1 ) {
|
@@ -103,7 +103,7 @@
|
|
103 |
|
104 |
var t = $( this ),
|
105 |
custom_uploader,
|
106 |
-
id = t.attr( 'id' ).replace( /-button$/, '' );
|
107 |
|
108 |
//If the uploader object has already been created, reopen the dialog
|
109 |
if ( custom_uploader ) {
|
@@ -114,27 +114,27 @@
|
|
114 |
var custom_uploader_states = [
|
115 |
// Main states.
|
116 |
new wp.media.controller.Library( {
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
];
|
124 |
|
125 |
// Create the media frame.
|
126 |
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
|
139 |
//When a file is selected, grab the URL and set it as the text field's value
|
140 |
custom_uploader.on( 'select', function () {
|
@@ -154,8 +154,8 @@
|
|
154 |
|
155 |
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
156 |
var t = $( this ),
|
157 |
-
id = t.attr( 'id' ),
|
158 |
-
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
|
159 |
default_value = $( '#' + id ).data( 'default' );
|
160 |
|
161 |
$( "#" + input_id ).val( default_value );
|
@@ -178,19 +178,19 @@
|
|
178 |
|
179 |
// Create the media frame.
|
180 |
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
|
195 |
// When an image is selected, run a callback.
|
196 |
image_gallery_frame.on( 'select', function () {
|
@@ -215,30 +215,30 @@
|
|
215 |
$imageGallery.sliderWrapper.each( function () {
|
216 |
var $t = $( this );
|
217 |
$t.sortable( {
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
} );
|
243 |
|
244 |
// Remove images
|
@@ -304,23 +304,23 @@
|
|
304 |
labels = $( this ).data( 'labels' );
|
305 |
|
306 |
$( this ).slider( {
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
} );
|
325 |
|
326 |
/* codemirror */
|
@@ -459,29 +459,29 @@
|
|
459 |
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
460 |
metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
|
461 |
url = yith_framework_fw_fields.ajax_url +
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
} else {
|
468 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
469 |
}
|
470 |
|
471 |
$.ajax( {
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
};
|
486 |
|
487 |
$.fn.serializeToggleElement = function () {
|
@@ -696,22 +696,22 @@
|
|
696 |
toggle.saveToggleElement();
|
697 |
} );
|
698 |
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
|
704 |
-
|
705 |
-
|
706 |
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
|
714 |
-
|
715 |
$( document ).on( 'click', '.yith-password-eye', function () {
|
716 |
var $this = $( this ),
|
717 |
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
@@ -732,70 +732,70 @@
|
|
732 |
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
733 |
}
|
734 |
} );
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
|
801 |
} )( jQuery );
|
41 |
|
42 |
/* Colorpicker */
|
43 |
$colorpicker.wpColorPicker( {
|
44 |
+
palettes: false,
|
45 |
+
width : 200,
|
46 |
+
mode : 'hsl',
|
47 |
+
clear : function () {
|
48 |
+
var input = $( this );
|
49 |
+
input.val( input.data( 'default-color' ) );
|
50 |
+
input.change();
|
51 |
+
}
|
52 |
+
} );
|
53 |
|
54 |
|
55 |
$colorpicker.each( function () {
|
64 |
|
65 |
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
66 |
var button = $( '<span/>' ).attr( {
|
67 |
+
class: "wp-picker-default-custom"
|
68 |
+
} );
|
69 |
wrap1.find( '.wp-picker-default' ).wrap( button );
|
70 |
}
|
71 |
|
72 |
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
73 |
var button = $( '<span/>' ).attr( {
|
74 |
+
class: "wp-picker-default-custom"
|
75 |
+
} );
|
76 |
wrap2.find( '.wp-picker-default' ).wrap( button );
|
77 |
}
|
78 |
} );
|
84 |
// preview
|
85 |
$upload.imgUrl.change( function () {
|
86 |
var url = $( this ).val(),
|
87 |
+
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)" ),
|
88 |
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
89 |
|
90 |
if ( preview.length < 1 ) {
|
103 |
|
104 |
var t = $( this ),
|
105 |
custom_uploader,
|
106 |
+
id = t.attr( 'id' ).replace( /-button$/, '' ).replace(/(\[|\])/g, '\\$1');
|
107 |
|
108 |
//If the uploader object has already been created, reopen the dialog
|
109 |
if ( custom_uploader ) {
|
114 |
var custom_uploader_states = [
|
115 |
// Main states.
|
116 |
new wp.media.controller.Library( {
|
117 |
+
library : wp.media.query(),
|
118 |
+
multiple : false,
|
119 |
+
title : 'Choose Image',
|
120 |
+
priority : 20,
|
121 |
+
filterable: 'uploaded'
|
122 |
+
} )
|
123 |
];
|
124 |
|
125 |
// Create the media frame.
|
126 |
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
127 |
+
// Set the title of the modal.
|
128 |
+
title : 'Choose Image',
|
129 |
+
library : {
|
130 |
+
type: ''
|
131 |
+
},
|
132 |
+
button : {
|
133 |
+
text: 'Choose Image'
|
134 |
+
},
|
135 |
+
multiple: false,
|
136 |
+
states : custom_uploader_states
|
137 |
+
} );
|
138 |
|
139 |
//When a file is selected, grab the URL and set it as the text field's value
|
140 |
custom_uploader.on( 'select', function () {
|
154 |
|
155 |
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
156 |
var t = $( this ),
|
157 |
+
id = t.attr( 'id' ).replace(/(\[|\])/g, '\\$1'),
|
158 |
+
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ).replace(/(\[|\])/g, '\\$1'),
|
159 |
default_value = $( '#' + id ).data( 'default' );
|
160 |
|
161 |
$( "#" + input_id ).val( default_value );
|
178 |
|
179 |
// Create the media frame.
|
180 |
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
181 |
+
// Set the title of the modal.
|
182 |
+
title : $t.data( 'choose' ),
|
183 |
+
button: {
|
184 |
+
text: $t.data( 'update' )
|
185 |
+
},
|
186 |
+
states: [
|
187 |
+
new wp.media.controller.Library( {
|
188 |
+
title : $t.data( 'choose' ),
|
189 |
+
filterable: 'all',
|
190 |
+
multiple : true
|
191 |
+
} )
|
192 |
+
]
|
193 |
+
} );
|
194 |
|
195 |
// When an image is selected, run a callback.
|
196 |
image_gallery_frame.on( 'select', function () {
|
215 |
$imageGallery.sliderWrapper.each( function () {
|
216 |
var $t = $( this );
|
217 |
$t.sortable( {
|
218 |
+
items : 'li.image',
|
219 |
+
cursor : 'move',
|
220 |
+
scrollSensitivity : 40,
|
221 |
+
forcePlaceholderSize: true,
|
222 |
+
forceHelperSize : false,
|
223 |
+
helper : 'clone',
|
224 |
+
opacity : 0.65,
|
225 |
+
start : function ( event, ui ) {
|
226 |
+
ui.item.css( 'background-color', '#f6f6f6' );
|
227 |
+
},
|
228 |
+
stop : function ( event, ui ) {
|
229 |
+
ui.item.removeAttr( 'style' );
|
230 |
+
},
|
231 |
+
update : function ( event, ui ) {
|
232 |
+
var attachment_ids = '';
|
233 |
+
|
234 |
+
$t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
235 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
236 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
237 |
+
} );
|
238 |
+
|
239 |
+
$t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
|
240 |
+
}
|
241 |
+
} );
|
242 |
} );
|
243 |
|
244 |
// Remove images
|
304 |
labels = $( this ).data( 'labels' );
|
305 |
|
306 |
$( this ).slider( {
|
307 |
+
value: val,
|
308 |
+
min : minValue,
|
309 |
+
max : maxValue,
|
310 |
+
range: 'min',
|
311 |
+
step : step,
|
312 |
+
|
313 |
+
create: function () {
|
314 |
+
$( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
|
315 |
+
},
|
316 |
+
|
317 |
+
|
318 |
+
slide: function ( event, ui ) {
|
319 |
+
$( this ).find( 'input' ).val( ui.value );
|
320 |
+
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
321 |
+
$( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
|
322 |
+
}
|
323 |
+
} );
|
324 |
} );
|
325 |
|
326 |
/* codemirror */
|
459 |
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
460 |
metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
|
461 |
url = yith_framework_fw_fields.ajax_url +
|
462 |
+
'?action=' + action +
|
463 |
+
"&post_ID=" + post_id +
|
464 |
+
'&yit_metaboxes_nonce=' + yit_metaboxes_nonce +
|
465 |
+
"&toggle_id=" + id +
|
466 |
+
"&metabox_tab=" + metabox_tab;
|
467 |
} else {
|
468 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
469 |
}
|
470 |
|
471 |
$.ajax( {
|
472 |
+
type : "POST",
|
473 |
+
url : url,
|
474 |
+
data : formdata,
|
475 |
+
contentType: false,
|
476 |
+
processData: false,
|
477 |
+
success : function ( result ) {
|
478 |
+
if ( spinner ) {
|
479 |
+
spinner.removeClass( 'show' );
|
480 |
+
}
|
481 |
|
482 |
+
$( document ).trigger( 'yith_save_toggle_element_done', [result, toggle] );
|
483 |
+
}
|
484 |
+
} );
|
485 |
};
|
486 |
|
487 |
$.fn.serializeToggleElement = function () {
|
696 |
toggle.saveToggleElement();
|
697 |
} );
|
698 |
|
699 |
+
// Radio
|
700 |
+
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
701 |
+
var _radioContainer = $( this ).closest( '.yith-plugin-fw-radio' ),
|
702 |
+
_value = $( this ).val();
|
703 |
|
704 |
+
_radioContainer.val( _value ).data( 'value', _value ).trigger( 'change' );
|
705 |
+
} );
|
706 |
|
707 |
+
$( document.body ).on( 'yith-plugin-fw-init-radio', function () {
|
708 |
+
$( '.yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)' ).each( function () {
|
709 |
+
$( this ).val( $( this ).data( 'value' ) );
|
710 |
+
$( this ).addClass( 'yith-plugin-fw-radio--initialized' );
|
711 |
+
} );
|
712 |
+
} ).trigger( 'yith-plugin-fw-init-radio' );
|
713 |
|
714 |
+
// Password Eye field
|
715 |
$( document ).on( 'click', '.yith-password-eye', function () {
|
716 |
var $this = $( this ),
|
717 |
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
732 |
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
733 |
}
|
734 |
} );
|
735 |
+
/**
|
736 |
+
* Dimensions
|
737 |
+
*/
|
738 |
+
var fw_dimensions = {
|
739 |
+
selectors : {
|
740 |
+
wrapper : '.yith-plugin-fw-dimensions',
|
741 |
+
units : {
|
742 |
+
wrapper : '.yith-plugin-fw-dimensions__units',
|
743 |
+
single : '.yith-plugin-fw-dimensions__unit',
|
744 |
+
value : '.yith-plugin-fw-dimensions__unit__value',
|
745 |
+
selectedClass: 'yith-plugin-fw-dimensions__unit--selected'
|
746 |
+
},
|
747 |
+
linked : {
|
748 |
+
button : '.yith-plugin-fw-dimensions__linked',
|
749 |
+
value : '.yith-plugin-fw-dimensions__linked__value',
|
750 |
+
wrapperActiveClass: 'yith-plugin-fw-dimensions--linked-active'
|
751 |
+
},
|
752 |
+
dimensions: {
|
753 |
+
number: '.yith-plugin-fw-dimensions__dimension__number'
|
754 |
+
}
|
755 |
+
},
|
756 |
+
init : function () {
|
757 |
+
var self = fw_dimensions;
|
758 |
+
$( document ).on( 'click', self.selectors.units.single, self.unitChange );
|
759 |
+
$( document ).on( 'click', self.selectors.linked.button, self.linkedChange );
|
760 |
+
$( document ).on( 'change keyup', self.selectors.dimensions.number, self.numberChange );
|
761 |
+
},
|
762 |
+
unitChange : function ( e ) {
|
763 |
+
var unit = $( this ).closest( fw_dimensions.selectors.units.single ),
|
764 |
+
wrapper = unit.closest( fw_dimensions.selectors.units.wrapper ),
|
765 |
+
units = wrapper.find( fw_dimensions.selectors.units.single ),
|
766 |
+
valueField = wrapper.find( fw_dimensions.selectors.units.value ).first(),
|
767 |
+
value = unit.data( 'value' );
|
768 |
+
|
769 |
+
units.removeClass( fw_dimensions.selectors.units.selectedClass );
|
770 |
+
unit.addClass( fw_dimensions.selectors.units.selectedClass );
|
771 |
+
valueField.val( value );
|
772 |
+
},
|
773 |
+
linkedChange: function () {
|
774 |
+
var button = $( this ).closest( fw_dimensions.selectors.linked.button ),
|
775 |
+
mainWrapper = button.closest( fw_dimensions.selectors.wrapper ),
|
776 |
+
valueField = button.find( fw_dimensions.selectors.linked.value ),
|
777 |
+
value = valueField.val();
|
778 |
+
|
779 |
+
if ( 'yes' === value ) {
|
780 |
+
mainWrapper.removeClass( fw_dimensions.selectors.linked.wrapperActiveClass );
|
781 |
+
valueField.val( 'no' );
|
782 |
+
} else {
|
783 |
+
mainWrapper.addClass( fw_dimensions.selectors.linked.wrapperActiveClass );
|
784 |
+
valueField.val( 'yes' );
|
785 |
+
|
786 |
+
mainWrapper.find( fw_dimensions.selectors.dimensions.number ).first().trigger( 'change' );
|
787 |
+
}
|
788 |
+
},
|
789 |
+
numberChange: function ( e ) {
|
790 |
+
var number = $( this ).closest( fw_dimensions.selectors.dimensions.number ),
|
791 |
+
mainWrapper = number.closest( fw_dimensions.selectors.wrapper );
|
792 |
+
if ( mainWrapper.hasClass( fw_dimensions.selectors.linked.wrapperActiveClass ) ) {
|
793 |
+
var numbers = mainWrapper.find( fw_dimensions.selectors.dimensions.number );
|
794 |
+
|
795 |
+
numbers.val( number.val() );
|
796 |
+
}
|
797 |
+
}
|
798 |
+
};
|
799 |
+
fw_dimensions.init();
|
800 |
|
801 |
} )( jQuery );
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={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:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id"),l=i.attr("id").replace(/-button-reset$/,""),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.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,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.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(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).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,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
|
1 |
+
!function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={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:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.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,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.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(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).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,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
|
plugin-fw/assets/js/yith-gutenberg.js
CHANGED
@@ -1,211 +1,211 @@
|
|
1 |
-
(function ($) {
|
2 |
-
// Get registerBlockType() from wp.blocks in the global scope
|
3 |
-
var __ = wp.i18n.__,
|
4 |
-
el = wp.element.createElement,
|
5 |
-
Fragment = wp.element.Fragment,
|
6 |
-
PanelBody = wp.components.PanelBody,
|
7 |
-
registerBlockType = wp.blocks.registerBlockType,
|
8 |
-
RichText = wp.editor.RichText,
|
9 |
-
BlockControls = wp.editor.BlockControls,
|
10 |
-
InspectorControls = wp.editor.InspectorControls,
|
11 |
-
AlignmentToolbar = wp.editor.AlignmentToolbar,
|
12 |
-
Components = wp.components,
|
13 |
-
RawHTML = wp.element.RawHTML,
|
14 |
-
SelectControl = wp.components.SelectControl,
|
15 |
-
ToggleControl = wp.components.ToggleControl,
|
16 |
-
CheckboxControl = wp.components.CheckboxControl,
|
17 |
-
RangeControl = wp.components.RangeControl,
|
18 |
-
ColorPicker = wp.components.ColorPicker,
|
19 |
-
RadioControl = wp.components.RadioControl,
|
20 |
-
TextControl = wp.components.TextControl,
|
21 |
-
TextareaControl = wp.components.TextareaControl;
|
22 |
-
|
23 |
-
const yith_icon = el('svg', {width: 22, height: 22},
|
24 |
-
el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
|
25 |
-
);
|
26 |
-
|
27 |
-
function create_shortcode(sc_args, props, callback) {
|
28 |
-
var gt_block = '',
|
29 |
-
gutenberg_preview = '';
|
30 |
-
|
31 |
-
if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
|
32 |
-
gt_block = $[props.callback](sc_args, props);
|
33 |
-
}
|
34 |
-
|
35 |
-
else {
|
36 |
-
var sc_name = props.shortcode_name,
|
37 |
-
sc = '[' + sc_name,
|
38 |
-
do_shortcode = null;
|
39 |
-
|
40 |
-
|
41 |
-
$.each(sc_args.attributes, function ($v, $k) {
|
42 |
-
if ($v != '
|
43 |
-
sc += ' ' + $v + '=';
|
44 |
-
var arg = props.attributes[$v],
|
45 |
-
remove_quotes = arg.remove_quotes;
|
46 |
-
|
47 |
-
if( remove_quotes == true ){
|
48 |
-
sc += $k;
|
49 |
-
}
|
50 |
-
|
51 |
-
else {
|
52 |
-
sc += '"' + $k + '"';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
});
|
56 |
-
|
57 |
-
sc += ']';
|
58 |
-
|
59 |
-
var block_id = md5(sc);
|
60 |
-
|
61 |
-
gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
|
62 |
-
|
63 |
-
if (callback == 'edit' && props.do_shortcode != false) {
|
64 |
-
do_shortcode = (function (block_id) {
|
65 |
-
var ajax_call_date = null;
|
66 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
67 |
-
$.ajax({
|
68 |
-
async: true,
|
69 |
-
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
-
method: 'post',
|
71 |
-
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
72 |
-
success: function (data) {
|
73 |
-
ajax_call_date = data;
|
74 |
-
if (ajax_call_date != '') {
|
75 |
-
$('.yith_block_' + block_id).html(ajax_call_date);
|
76 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
77 |
-
}
|
78 |
-
}
|
79 |
-
});
|
80 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
81 |
-
return ajax_call_date;
|
82 |
-
})(block_id);
|
83 |
-
}
|
84 |
-
|
85 |
-
gt_block = el(RawHTML, null, gutenberg_preview);
|
86 |
-
}
|
87 |
-
|
88 |
-
return gt_block;
|
89 |
-
}
|
90 |
-
|
91 |
-
function onChangeEvent(new_value, attribute_name, args, block_type) {
|
92 |
-
var attributes = {};
|
93 |
-
|
94 |
-
if (block_type == 'colorpicker' || block_type == 'color') {
|
95 |
-
new_value = new_value.hex;
|
96 |
-
}
|
97 |
-
|
98 |
-
attributes[attribute_name] = new_value;
|
99 |
-
args.setAttributes(attributes);
|
100 |
-
return args;
|
101 |
-
}
|
102 |
-
|
103 |
-
$.each(yith_gutenberg, function ($block, $props) {
|
104 |
-
registerBlockType("yith/" + $block, {
|
105 |
-
title: $props.title,
|
106 |
-
description: $props.description,
|
107 |
-
category: $props.category,
|
108 |
-
attributes: $props.attributes,
|
109 |
-
icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
|
110 |
-
keywords: $props.keywords,
|
111 |
-
edit: function edit(args) {
|
112 |
-
var elements = new Array();
|
113 |
-
|
114 |
-
$.each($props.attributes, function ($attribute_name, $attribute_args) {
|
115 |
-
var ComponentControl = null,
|
116 |
-
block_type = $attribute_args.blocktype;
|
117 |
-
if (typeof block_type != 'undefined') {
|
118 |
-
switch (block_type) {
|
119 |
-
case 'select':
|
120 |
-
ComponentControl = SelectControl;
|
121 |
-
break;
|
122 |
-
|
123 |
-
case 'text':
|
124 |
-
ComponentControl = TextControl;
|
125 |
-
break;
|
126 |
-
|
127 |
-
case 'textarea':
|
128 |
-
ComponentControl = TextareaControl;
|
129 |
-
break;
|
130 |
-
|
131 |
-
case 'toggle':
|
132 |
-
ComponentControl = ToggleControl;
|
133 |
-
break;
|
134 |
-
|
135 |
-
case 'checkbox':
|
136 |
-
ComponentControl = CheckboxControl;
|
137 |
-
break;
|
138 |
-
|
139 |
-
case 'number':
|
140 |
-
case 'range':
|
141 |
-
ComponentControl = RangeControl;
|
142 |
-
break;
|
143 |
-
|
144 |
-
case 'color':
|
145 |
-
case 'colorpicker':
|
146 |
-
ComponentControl = ColorPicker;
|
147 |
-
break;
|
148 |
-
|
149 |
-
case 'radio':
|
150 |
-
ComponentControl = RadioControl;
|
151 |
-
break;
|
152 |
-
}
|
153 |
-
|
154 |
-
if (ComponentControl != null) {
|
155 |
-
var helpMessageChecked = helpMessageUncheked = '';
|
156 |
-
if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
|
157 |
-
helpMessageChecked = $attribute_args.helps.checked;
|
158 |
-
helpMessageUncheked = $attribute_args.helps.unchecked;
|
159 |
-
}
|
160 |
-
|
161 |
-
else if (typeof $attribute_args.help != 'undefined') {
|
162 |
-
helpMessageChecked = helpMessageUncheked = $attribute_args.help;
|
163 |
-
}
|
164 |
-
|
165 |
-
elements.push(
|
166 |
-
el(
|
167 |
-
ComponentControl,
|
168 |
-
{
|
169 |
-
value: args.attributes[$attribute_name],
|
170 |
-
options: $attribute_args.options,
|
171 |
-
label: $attribute_args.label,
|
172 |
-
checked: args.attributes[$attribute_name],
|
173 |
-
selected: args.attributes[$attribute_name],
|
174 |
-
help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
|
175 |
-
disableAlpha: $attribute_args.disableAlpha,
|
176 |
-
min: $attribute_args.min,
|
177 |
-
max: $attribute_args.max,
|
178 |
-
multiple: $attribute_args.multiple,
|
179 |
-
onChange: function (new_value, attribute_name = $attribute_name) {
|
180 |
-
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
181 |
-
},
|
182 |
-
onChangeComplete: function (new_value, attribute_name = $attribute_name) {
|
183 |
-
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
184 |
-
},
|
185 |
-
},
|
186 |
-
)
|
187 |
-
);
|
188 |
-
}
|
189 |
-
}
|
190 |
-
});
|
191 |
-
|
192 |
-
sc = create_shortcode(args, $props, 'edit');
|
193 |
-
|
194 |
-
return [
|
195 |
-
el(
|
196 |
-
Fragment,
|
197 |
-
null,
|
198 |
-
el(
|
199 |
-
InspectorControls,
|
200 |
-
null,
|
201 |
-
elements,
|
202 |
-
),
|
203 |
-
sc,
|
204 |
-
)];
|
205 |
-
},
|
206 |
-
save: function save(args) {
|
207 |
-
return create_shortcode(args, $props, 'save');
|
208 |
-
}
|
209 |
-
});
|
210 |
-
});
|
211 |
-
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
// Get registerBlockType() from wp.blocks in the global scope
|
3 |
+
var __ = wp.i18n.__,
|
4 |
+
el = wp.element.createElement,
|
5 |
+
Fragment = wp.element.Fragment,
|
6 |
+
PanelBody = wp.components.PanelBody,
|
7 |
+
registerBlockType = wp.blocks.registerBlockType,
|
8 |
+
RichText = wp.editor.RichText,
|
9 |
+
BlockControls = wp.editor.BlockControls,
|
10 |
+
InspectorControls = wp.editor.InspectorControls,
|
11 |
+
AlignmentToolbar = wp.editor.AlignmentToolbar,
|
12 |
+
Components = wp.components,
|
13 |
+
RawHTML = wp.element.RawHTML,
|
14 |
+
SelectControl = wp.components.SelectControl,
|
15 |
+
ToggleControl = wp.components.ToggleControl,
|
16 |
+
CheckboxControl = wp.components.CheckboxControl,
|
17 |
+
RangeControl = wp.components.RangeControl,
|
18 |
+
ColorPicker = wp.components.ColorPicker,
|
19 |
+
RadioControl = wp.components.RadioControl,
|
20 |
+
TextControl = wp.components.TextControl,
|
21 |
+
TextareaControl = wp.components.TextareaControl;
|
22 |
+
|
23 |
+
const yith_icon = el('svg', {width: 22, height: 22},
|
24 |
+
el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
|
25 |
+
);
|
26 |
+
|
27 |
+
function create_shortcode(sc_args, props, callback) {
|
28 |
+
var gt_block = '',
|
29 |
+
gutenberg_preview = '';
|
30 |
+
|
31 |
+
if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
|
32 |
+
gt_block = $[props.callback](sc_args, props);
|
33 |
+
}
|
34 |
+
|
35 |
+
else {
|
36 |
+
var sc_name = props.shortcode_name,
|
37 |
+
sc = '[' + sc_name,
|
38 |
+
do_shortcode = null;
|
39 |
+
|
40 |
+
|
41 |
+
$.each(sc_args.attributes, function ($v, $k) {
|
42 |
+
if ( typeof props.attributes != 'undefined' && typeof props.attributes[$v] != 'undefined' ) {
|
43 |
+
sc += ' ' + $v + '=';
|
44 |
+
var arg = props.attributes[$v],
|
45 |
+
remove_quotes = arg.remove_quotes;
|
46 |
+
|
47 |
+
if( remove_quotes == true ){
|
48 |
+
sc += $k;
|
49 |
+
}
|
50 |
+
|
51 |
+
else {
|
52 |
+
sc += '"' + $k + '"';
|
53 |
+
}
|
54 |
+
}
|
55 |
+
});
|
56 |
+
|
57 |
+
sc += ']';
|
58 |
+
|
59 |
+
var block_id = md5(sc);
|
60 |
+
|
61 |
+
gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
|
62 |
+
|
63 |
+
if (callback == 'edit' && props.do_shortcode != false) {
|
64 |
+
do_shortcode = (function (block_id) {
|
65 |
+
var ajax_call_date = null;
|
66 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
67 |
+
$.ajax({
|
68 |
+
async: true,
|
69 |
+
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
+
method: 'post',
|
71 |
+
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
72 |
+
success: function (data) {
|
73 |
+
ajax_call_date = data;
|
74 |
+
if (ajax_call_date != '') {
|
75 |
+
$('.yith_block_' + block_id).html(ajax_call_date);
|
76 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
});
|
80 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
81 |
+
return ajax_call_date;
|
82 |
+
})(block_id);
|
83 |
+
}
|
84 |
+
|
85 |
+
gt_block = el(RawHTML, null, gutenberg_preview);
|
86 |
+
}
|
87 |
+
|
88 |
+
return gt_block;
|
89 |
+
}
|
90 |
+
|
91 |
+
function onChangeEvent(new_value, attribute_name, args, block_type) {
|
92 |
+
var attributes = {};
|
93 |
+
|
94 |
+
if (block_type == 'colorpicker' || block_type == 'color') {
|
95 |
+
new_value = new_value.hex;
|
96 |
+
}
|
97 |
+
|
98 |
+
attributes[attribute_name] = new_value;
|
99 |
+
args.setAttributes(attributes);
|
100 |
+
return args;
|
101 |
+
}
|
102 |
+
|
103 |
+
$.each(yith_gutenberg, function ($block, $props) {
|
104 |
+
registerBlockType("yith/" + $block, {
|
105 |
+
title: $props.title,
|
106 |
+
description: $props.description,
|
107 |
+
category: $props.category,
|
108 |
+
attributes: $props.attributes,
|
109 |
+
icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
|
110 |
+
keywords: $props.keywords,
|
111 |
+
edit: function edit(args) {
|
112 |
+
var elements = new Array();
|
113 |
+
|
114 |
+
$.each($props.attributes, function ($attribute_name, $attribute_args) {
|
115 |
+
var ComponentControl = null,
|
116 |
+
block_type = $attribute_args.blocktype;
|
117 |
+
if (typeof block_type != 'undefined') {
|
118 |
+
switch (block_type) {
|
119 |
+
case 'select':
|
120 |
+
ComponentControl = SelectControl;
|
121 |
+
break;
|
122 |
+
|
123 |
+
case 'text':
|
124 |
+
ComponentControl = TextControl;
|
125 |
+
break;
|
126 |
+
|
127 |
+
case 'textarea':
|
128 |
+
ComponentControl = TextareaControl;
|
129 |
+
break;
|
130 |
+
|
131 |
+
case 'toggle':
|
132 |
+
ComponentControl = ToggleControl;
|
133 |
+
break;
|
134 |
+
|
135 |
+
case 'checkbox':
|
136 |
+
ComponentControl = CheckboxControl;
|
137 |
+
break;
|
138 |
+
|
139 |
+
case 'number':
|
140 |
+
case 'range':
|
141 |
+
ComponentControl = RangeControl;
|
142 |
+
break;
|
143 |
+
|
144 |
+
case 'color':
|
145 |
+
case 'colorpicker':
|
146 |
+
ComponentControl = ColorPicker;
|
147 |
+
break;
|
148 |
+
|
149 |
+
case 'radio':
|
150 |
+
ComponentControl = RadioControl;
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
|
154 |
+
if (ComponentControl != null) {
|
155 |
+
var helpMessageChecked = helpMessageUncheked = '';
|
156 |
+
if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
|
157 |
+
helpMessageChecked = $attribute_args.helps.checked;
|
158 |
+
helpMessageUncheked = $attribute_args.helps.unchecked;
|
159 |
+
}
|
160 |
+
|
161 |
+
else if (typeof $attribute_args.help != 'undefined') {
|
162 |
+
helpMessageChecked = helpMessageUncheked = $attribute_args.help;
|
163 |
+
}
|
164 |
+
|
165 |
+
elements.push(
|
166 |
+
el(
|
167 |
+
ComponentControl,
|
168 |
+
{
|
169 |
+
value: args.attributes[$attribute_name],
|
170 |
+
options: $attribute_args.options,
|
171 |
+
label: $attribute_args.label,
|
172 |
+
checked: args.attributes[$attribute_name],
|
173 |
+
selected: args.attributes[$attribute_name],
|
174 |
+
help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
|
175 |
+
disableAlpha: $attribute_args.disableAlpha,
|
176 |
+
min: $attribute_args.min,
|
177 |
+
max: $attribute_args.max,
|
178 |
+
multiple: $attribute_args.multiple,
|
179 |
+
onChange: function (new_value, attribute_name = $attribute_name) {
|
180 |
+
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
181 |
+
},
|
182 |
+
onChangeComplete: function (new_value, attribute_name = $attribute_name) {
|
183 |
+
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
184 |
+
},
|
185 |
+
},
|
186 |
+
)
|
187 |
+
);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
});
|
191 |
+
|
192 |
+
sc = create_shortcode(args, $props, 'edit');
|
193 |
+
|
194 |
+
return [
|
195 |
+
el(
|
196 |
+
Fragment,
|
197 |
+
null,
|
198 |
+
el(
|
199 |
+
InspectorControls,
|
200 |
+
null,
|
201 |
+
elements,
|
202 |
+
),
|
203 |
+
sc,
|
204 |
+
)];
|
205 |
+
},
|
206 |
+
save: function save(args) {
|
207 |
+
return create_shortcode(args, $props, 'save');
|
208 |
+
}
|
209 |
+
});
|
210 |
+
});
|
211 |
+
})(jQuery);
|
plugin-fw/assets/js/yith-gutenberg.min.js
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(h){function q(g,b,e){var f="";f="";if("undefined"!=typeof b.callback&&"function"==typeof h[b.callback])f=h[b.callback](g,b);else{var c="["+b.shortcode_name;h.each(g.attributes,function(a,d){"undefined"!=typeof b.attributes&&"undefined"!=typeof b.attributes[a]&&(c+=" "+a+"=",c=1==b.attributes[a].remove_quotes?c+d:c+('"'+d+'"'))});c+="]";g=md5(c);f='<span class="yith_block_'+g+'">'+c+"</span>";"edit"==e&&0!=b.do_shortcode&&function(a){var d=null;h(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",
|
2 |
+
[c,a]);h.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:c},success:function(l){d=l;""!=d&&(h(".yith_block_"+a).html(d),h(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[c,a,d]))}});h(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[c,a,d]);return d}(g);f=m(t,null,f)}return f}function r(g,b,e,f){var c={};if("colorpicker"==f||"color"==f)g=g.hex;c[b]=g;e.setAttributes(c);return e}var m=wp.element.createElement,
|
3 |
+
u=wp.element.Fragment,v=wp.blocks.registerBlockType,w=wp.editor.InspectorControls,t=wp.element.RawHTML,x=wp.components.SelectControl,y=wp.components.ToggleControl,z=wp.components.CheckboxControl,A=wp.components.RangeControl,B=wp.components.ColorPicker,C=wp.components.RadioControl,D=wp.components.TextControl,E=wp.components.TextareaControl,F=m("svg",{width:22,height:22},m("path",{d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"}));
|
4 |
+
h.each(yith_gutenberg,function(g,b){v("yith/"+g,{title:b.title,description:b.description,category:b.category,attributes:b.attributes,icon:"undefined"!=typeof b.icon?b.icon:F,keywords:b.keywords,edit:function(e){var f=[];h.each(b.attributes,function(c,a){var d=null,l=a.blocktype;if("undefined"!=typeof l){switch(l){case "select":d=x;break;case "text":d=D;break;case "textarea":d=E;break;case "toggle":d=y;break;case "checkbox":d=z;break;case "number":case "range":d=A;break;case "color":case "colorpicker":d=
|
5 |
+
B;break;case "radio":d=C}if(null!=d){var n=helpMessageUncheked="";"undefined"!=typeof a.helps&&"undefined"!=typeof a.helps.checked&&"undefined"!=typeof a.helps.unchecked?(n=a.helps.checked,helpMessageUncheked=a.helps.unchecked):"undefined"!=typeof a.help&&(n=helpMessageUncheked=a.help);f.push(m(d,{value:e.attributes[c],options:a.options,label:a.label,checked:e.attributes[c],selected:e.attributes[c],help:e.attributes[c]?n:helpMessageUncheked,disableAlpha:a.disableAlpha,min:a.min,max:a.max,multiple:a.multiple,
|
6 |
+
onChange:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)},onChangeComplete:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)}}))}}});sc=q(e,b,"edit");return[m(u,null,m(w,null,f),sc)]},save:function(e){return q(e,b,"save")}})})})(jQuery);
|
plugin-fw/bin/clean-language-files.js
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* jshint ignore: start */
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
7 |
+
*/
|
8 |
+
|
9 |
+
const fs = require( 'fs' );
|
10 |
+
const glob = require( 'glob' );
|
11 |
+
const chalk = require( 'chalk' );
|
12 |
+
|
13 |
+
const DELETED = chalk.reset.inverse.bold.green( ' DELETED ' );
|
14 |
+
const ERROR = chalk.reset.inverse.bold.red( ' ERROR ' );
|
15 |
+
|
16 |
+
console.log( chalk.green( '\nCleaning language files...' ) );
|
17 |
+
glob( "languages/*.po~", function ( er, files ) {
|
18 |
+
|
19 |
+
if ( files.length ) {
|
20 |
+
console.log( `Processing ${files.length} files:` );
|
21 |
+
|
22 |
+
files.forEach( ( file ) => {
|
23 |
+
fs.unlink( file, ( err ) => {
|
24 |
+
if ( err ) {
|
25 |
+
console.log( chalk.bold( ` - ${file} ` ) + ERROR );
|
26 |
+
console.error( err );
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
console.log( chalk.bold( ` - ${file} ` ) + DELETED );
|
30 |
+
} );
|
31 |
+
} );
|
32 |
+
} else {
|
33 |
+
console.log( `No file to clean.\n` );
|
34 |
+
}
|
35 |
+
|
36 |
+
} );
|
plugin-fw/bin/download-translations-config.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"projectPath": "https://translate.yithemes.com/gp/projects/yith-framework/",
|
3 |
+
"textDomain": "yith-plugin-fw",
|
4 |
+
"destFolder": "languages/",
|
5 |
+
"languages": [
|
6 |
+
{
|
7 |
+
"id": "es",
|
8 |
+
"name": "Spanish",
|
9 |
+
"slug": "es_ES"
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"id": "it",
|
13 |
+
"name": "Italian",
|
14 |
+
"slug": "it_IT"
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"id": "nl",
|
18 |
+
"name": "Dutch",
|
19 |
+
"slug": "nl_NL"
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"id": "el",
|
23 |
+
"name": "Greek",
|
24 |
+
"slug": "el"
|
25 |
+
}
|
26 |
+
]
|
27 |
+
}
|
plugin-fw/bin/download-translations.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* jshint ignore: start */
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This script download translations from https://translate.yithemes.com/
|
5 |
+
*
|
6 |
+
* @version 1.1.0
|
7 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
const fs = require( 'fs' );
|
11 |
+
const path = require( 'path' );
|
12 |
+
const axios = require( 'axios' );
|
13 |
+
const chalk = require( 'chalk' );
|
14 |
+
const options = require( './download-translations-config' );
|
15 |
+
|
16 |
+
const SPACE = '\t';
|
17 |
+
const DONE = chalk.reset.inverse.bold.green( ' DONE ' );
|
18 |
+
const ERROR = chalk.reset.inverse.bold.red( ' ERROR ' );
|
19 |
+
|
20 |
+
async function download( url, dest ) {
|
21 |
+
const destPath = path.resolve( dest );
|
22 |
+
const writer = fs.createWriteStream( destPath );
|
23 |
+
|
24 |
+
const response = await axios( {
|
25 |
+
url,
|
26 |
+
method : 'GET',
|
27 |
+
responseType: 'stream'
|
28 |
+
} );
|
29 |
+
|
30 |
+
response.data.pipe( writer );
|
31 |
+
|
32 |
+
return new Promise( ( resolve, reject ) => {
|
33 |
+
writer.on( 'finish', resolve );
|
34 |
+
writer.on( 'error', reject );
|
35 |
+
} )
|
36 |
+
}
|
37 |
+
|
38 |
+
const downloadLanguage = function ( language ) {
|
39 |
+
const languageName = language.name || language.id;
|
40 |
+
const source = options.projectPath + language.id + "/default/export-translations/";
|
41 |
+
const fileName = options.textDomain + '-' + language.slug + '.po';
|
42 |
+
const dest = options.destFolder + fileName;
|
43 |
+
const message = ' - ' + chalk.bold( languageName ) + SPACE;
|
44 |
+
|
45 |
+
download( source, dest ).then( () => {
|
46 |
+
console.log( message + DONE );
|
47 |
+
} ).catch( ( err ) => {
|
48 |
+
console.log( message + ERROR );
|
49 |
+
throw err;
|
50 |
+
} );
|
51 |
+
};
|
52 |
+
|
53 |
+
console.log( chalk.green( '\nDownloading Transations from translate.yithemes.com...' ) );
|
54 |
+
|
55 |
+
options.languages.forEach( ( language ) => {
|
56 |
+
downloadLanguage( language );
|
57 |
+
} );
|
plugin-fw/init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.4.
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.4.31
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -67,6 +67,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
67 |
* Constructor
|
68 |
*
|
69 |
* @param array $args
|
|
|
70 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
71 |
* @since 1.0
|
72 |
*/
|
@@ -84,8 +85,9 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
84 |
);
|
85 |
|
86 |
$args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
|
87 |
-
if ( isset( $args['parent_page'] ) && 'yit_plugin_panel' === $args['parent_page'] )
|
88 |
$args['parent_page'] = 'yith_plugin_panel';
|
|
|
89 |
|
90 |
$this->settings = $args;
|
91 |
$this->_tabs_path_files = $this->get_tabs_path_files();
|
@@ -113,10 +115,10 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
113 |
|
114 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
|
121 |
/**
|
122 |
* Is this a custom post type page?
|
@@ -130,7 +132,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
130 |
$excluded_post_types = array( 'product', 'page', 'post' );
|
131 |
|
132 |
return in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) &&
|
133 |
-
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -145,7 +147,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
145 |
$excluded_taxonomies = array( 'category', 'post_tag', 'product_cat', 'product_tag' );
|
146 |
|
147 |
return in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) &&
|
148 |
-
|
149 |
}
|
150 |
|
151 |
/**
|
@@ -168,6 +170,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
168 |
$tabs = $this->get_taxonomy_tabs( $taxonomy );
|
169 |
}
|
170 |
|
|
|
|
|
171 |
if ( $tabs ) {
|
172 |
// tabs_in_edit
|
173 |
$current_tab_args = array(
|
@@ -176,14 +180,18 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
176 |
'current_sub_tab' => isset( $tabs['sub_tab'] ) ? $tabs['sub_tab'] : '',
|
177 |
);
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
182 |
|
183 |
if ( ! self::$_panel_tabs_in_wp_pages ) {
|
184 |
self::$_panel_tabs_in_wp_pages = $current_tab_args;
|
185 |
-
|
186 |
-
|
|
|
|
|
187 |
add_filter( 'parent_file', array( $this, 'set_parent_file_to_handle_menu_for_wp_pages' ) );
|
188 |
add_filter( 'submenu_file', array( $this, 'set_submenu_file_to_handle_menu_for_wp_pages' ), 10, 2 );
|
189 |
}
|
@@ -250,14 +258,16 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
250 |
* Add yith-plugin-fw-panel in body classes in Panel pages
|
251 |
*
|
252 |
* @param $admin_body_classes
|
|
|
253 |
* @return string
|
254 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
255 |
* @since 3.0.0
|
256 |
*/
|
257 |
public static function add_body_class( $admin_body_classes ) {
|
258 |
global $pagenow;
|
259 |
-
if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) )
|
260 |
$admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
|
|
|
261 |
|
262 |
return $admin_body_classes;
|
263 |
}
|
@@ -355,6 +365,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
355 |
* a callback function called by Register Settings function
|
356 |
*
|
357 |
* @param $input
|
|
|
358 |
* @return array validate input fields
|
359 |
* @since 1.0
|
360 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -463,6 +474,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
463 |
* Print the tabs navigation
|
464 |
*
|
465 |
* @param array $args
|
|
|
466 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
467 |
* @since 3.4.0
|
468 |
*/
|
@@ -524,6 +536,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
524 |
* @param string $tab
|
525 |
* @param string $sub_tab
|
526 |
* @param string $parent_page
|
|
|
527 |
* @return string
|
528 |
*/
|
529 |
public function get_nav_url( $page, $tab, $sub_tab = '', $parent_page = '' ) {
|
@@ -548,6 +561,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
548 |
* Print the Sub-tabs navigation if the current tab has sub-tabs
|
549 |
*
|
550 |
* @param array $args
|
|
|
551 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
552 |
* @since 3.4.0
|
553 |
*/
|
@@ -597,6 +611,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
597 |
|
598 |
if ( $custom_tab_action ) {
|
599 |
$this->print_custom_tab( $custom_tab_action );
|
|
|
600 |
return;
|
601 |
}
|
602 |
|
@@ -612,17 +627,17 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
612 |
<p> </p>
|
613 |
<?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
|
614 |
<input type="hidden" name="<?php echo $this->get_name_field( 'option_key' ) ?>"
|
615 |
-
|
616 |
<input type="submit" class="button-primary"
|
617 |
-
|
618 |
-
|
619 |
</form>
|
620 |
<form method="post">
|
621 |
<?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
|
622 |
<input type="hidden" name="yit-action" value="reset"/>
|
623 |
<input type="submit" name="yit-reset" class="button-secondary"
|
624 |
-
|
625 |
-
|
626 |
</form>
|
627 |
<p> </p>
|
628 |
<?php endif ?>
|
@@ -637,6 +652,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
637 |
*
|
638 |
* @param array $options
|
639 |
* @param string $option_key
|
|
|
640 |
* @return bool
|
641 |
*/
|
642 |
public function is_custom_tab( $options, $option_key ) {
|
@@ -655,6 +671,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
655 |
$first = ! ! $tab_options && is_array( $tab_options ) ? current( $tab_options ) : array();
|
656 |
$type = isset( $first['type'] ) ? $first['type'] : 'options';
|
657 |
$special_types = array( 'post_type', 'taxonomy', 'custom_tab', 'multi_tab' );
|
|
|
658 |
return in_array( $type, $special_types ) ? $type : 'options';
|
659 |
}
|
660 |
|
@@ -675,6 +692,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
675 |
* Fire the action to print the custom tab
|
676 |
*
|
677 |
* @param string $action Action to fire
|
|
|
678 |
* @return void
|
679 |
* @since 1.0
|
680 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
@@ -730,11 +748,11 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
730 |
foreach ( $this->settings['admin-tabs'] as $item => $title ) {
|
731 |
|
732 |
$wp_admin_bar->add_menu( array(
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
}
|
739 |
}
|
740 |
}
|
@@ -848,6 +866,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
848 |
* @param $message
|
849 |
* @param string $type can be 'error' or 'updated'
|
850 |
* @param bool $echo
|
|
|
851 |
* @return string
|
852 |
* @since 1.0
|
853 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -876,7 +895,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
876 |
|
877 |
$tabs = array();
|
878 |
|
879 |
-
foreach ( ( array )glob( $option_files_path . '*.php' ) as $filename ) {
|
880 |
preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
|
881 |
|
882 |
if ( ! isset( $filename_parts[1] ) ) {
|
@@ -915,6 +934,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
915 |
* Return the sub-tabs array of a specific tab
|
916 |
*
|
917 |
* @param array|bool $_tab the tab; if not set it'll be the current tab
|
|
|
918 |
* @since 3.4.0
|
919 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
920 |
* @return array sub-tabs array
|
@@ -937,6 +957,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
937 |
if ( $_first && is_array( $_first ) && isset( $_first['type'] ) && 'multi_tab' === $_first['type'] && ! empty( $_first['sub-tabs'] ) ) {
|
938 |
return $_first['sub-tabs'];
|
939 |
}
|
|
|
940 |
return array();
|
941 |
}
|
942 |
|
@@ -1005,6 +1026,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1005 |
}
|
1006 |
}
|
1007 |
}
|
|
|
1008 |
return '';
|
1009 |
}
|
1010 |
|
@@ -1013,6 +1035,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1013 |
* return the title of section
|
1014 |
*
|
1015 |
* @param $section
|
|
|
1016 |
* @return string
|
1017 |
* @since 1.0
|
1018 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1026,6 +1049,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1026 |
return $option['name'];
|
1027 |
}
|
1028 |
}
|
|
|
1029 |
return '';
|
1030 |
}
|
1031 |
|
@@ -1034,6 +1058,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1034 |
* return the description of section if is set
|
1035 |
*
|
1036 |
* @param $section
|
|
|
1037 |
* @return string
|
1038 |
* @since 1.0
|
1039 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1047,6 +1072,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1047 |
return '<p>' . $option['desc'] . '</p>';
|
1048 |
}
|
1049 |
}
|
|
|
1050 |
return '';
|
1051 |
}
|
1052 |
|
@@ -1082,6 +1108,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1082 |
* return a string with the name of the input field
|
1083 |
*
|
1084 |
* @param string $name
|
|
|
1085 |
* @return string
|
1086 |
* @since 1.0
|
1087 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1095,6 +1122,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1095 |
* return a string with the id of the input field
|
1096 |
*
|
1097 |
* @param string $id
|
|
|
1098 |
* @return string
|
1099 |
* @since 1.0
|
1100 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1110,6 +1138,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1110 |
* return a text area
|
1111 |
*
|
1112 |
* @param array $param
|
|
|
1113 |
* @return void
|
1114 |
* @since 1.0
|
1115 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1132,11 +1161,13 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1132 |
$std = isset( $option['std'] ) ? $option['std'] : '';
|
1133 |
$db_value = ( isset( $db_options[ $option['id'] ] ) ) ? $db_options[ $option['id'] ] : $std;
|
1134 |
|
1135 |
-
if ( isset( $option['deps'] ) )
|
1136 |
$deps = $option['deps'];
|
|
|
1137 |
|
1138 |
-
if ( 'on-off' === $option['type'] )
|
1139 |
$option['type'] = 'onoff';
|
|
|
1140 |
|
1141 |
if ( $field_template_path = yith_plugin_fw_get_field_template_path( $option ) ) {
|
1142 |
$field_container_path = apply_filters( 'yith_plugin_fw_panel_field_container_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/panel-field-container.php', $option );
|
@@ -1169,6 +1200,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1169 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1170 |
*
|
1171 |
* @param array $args
|
|
|
1172 |
* @return void
|
1173 |
* @since 1.0
|
1174 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
@@ -1184,6 +1216,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1184 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1185 |
*
|
1186 |
* @param array $args
|
|
|
1187 |
* @return void
|
1188 |
* @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
|
1189 |
*/
|
@@ -1278,11 +1311,11 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1278 |
</div>
|
1279 |
<div class="yith-plugin-fw-rate">
|
1280 |
<?php printf( '<strong>%s</strong> %s <a href="%s" target="_blank"><u>%s</u> <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> %s',
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
</div>
|
1287 |
<?php else: ?>
|
1288 |
<h1 class="notice-container"></h1>
|
@@ -1368,72 +1401,73 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1368 |
public function maybe_redirect_to_proper_wp_page() {
|
1369 |
global $pagenow;
|
1370 |
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && $this->settings['page'] === $_GET['page'] &&
|
1371 |
-
|
1372 |
$url = $this->get_nav_url( $this->settings['page'], $this->get_current_tab(), $this->get_current_sub_tab() );
|
1373 |
if ( strpos( $url, 'edit.php' ) !== false || strpos( $url, 'edit-tags.php' ) !== false ) {
|
1374 |
wp_safe_redirect( add_query_arg( array( 'yith-plugin-fw-panel-skip-redirect' => 1 ), $url ) );
|
1375 |
exit;
|
1376 |
}
|
1377 |
}
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
|
|
1439 |
}
|
67 |
* Constructor
|
68 |
*
|
69 |
* @param array $args
|
70 |
+
*
|
71 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
72 |
* @since 1.0
|
73 |
*/
|
85 |
);
|
86 |
|
87 |
$args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
|
88 |
+
if ( isset( $args['parent_page'] ) && 'yit_plugin_panel' === $args['parent_page'] ) {
|
89 |
$args['parent_page'] = 'yith_plugin_panel';
|
90 |
+
}
|
91 |
|
92 |
$this->settings = $args;
|
93 |
$this->_tabs_path_files = $this->get_tabs_path_files();
|
115 |
|
116 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
117 |
|
118 |
+
//yith-plugin-ui
|
119 |
+
add_action( 'yith_plugin_fw_before_yith_panel', array( $this, 'add_plugin_banner' ), 10, 1 );
|
120 |
+
add_action( 'wp_ajax_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
|
121 |
+
}
|
122 |
|
123 |
/**
|
124 |
* Is this a custom post type page?
|
132 |
$excluded_post_types = array( 'product', 'page', 'post' );
|
133 |
|
134 |
return in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) &&
|
135 |
+
! in_array( $post_type, $excluded_post_types, true );
|
136 |
}
|
137 |
|
138 |
/**
|
147 |
$excluded_taxonomies = array( 'category', 'post_tag', 'product_cat', 'product_tag' );
|
148 |
|
149 |
return in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) &&
|
150 |
+
! in_array( $taxonomy, $excluded_taxonomies, true );
|
151 |
}
|
152 |
|
153 |
/**
|
170 |
$tabs = $this->get_taxonomy_tabs( $taxonomy );
|
171 |
}
|
172 |
|
173 |
+
$is_block_editor = function_exists( 'get_current_screen' ) && get_current_screen() && get_current_screen()->is_block_editor();
|
174 |
+
|
175 |
if ( $tabs ) {
|
176 |
// tabs_in_edit
|
177 |
$current_tab_args = array(
|
180 |
'current_sub_tab' => isset( $tabs['sub_tab'] ) ? $tabs['sub_tab'] : '',
|
181 |
);
|
182 |
|
183 |
+
if ( ! $is_block_editor ) {
|
184 |
+
wp_enqueue_style( 'yit-plugin-style' );
|
185 |
+
wp_enqueue_style( 'yith-plugin-fw-fields' );
|
186 |
+
wp_enqueue_script( 'yith-plugin-fw-wp-pages' );
|
187 |
+
}
|
188 |
|
189 |
if ( ! self::$_panel_tabs_in_wp_pages ) {
|
190 |
self::$_panel_tabs_in_wp_pages = $current_tab_args;
|
191 |
+
if ( ! $is_block_editor ) {
|
192 |
+
add_action( 'all_admin_notices', array( $this, 'print_panel_tabs_in_wp_pages' ) );
|
193 |
+
add_action( 'admin_footer', array( $this, 'print_panel_tabs_in_wp_pages_end' ) );
|
194 |
+
}
|
195 |
add_filter( 'parent_file', array( $this, 'set_parent_file_to_handle_menu_for_wp_pages' ) );
|
196 |
add_filter( 'submenu_file', array( $this, 'set_submenu_file_to_handle_menu_for_wp_pages' ), 10, 2 );
|
197 |
}
|
258 |
* Add yith-plugin-fw-panel in body classes in Panel pages
|
259 |
*
|
260 |
* @param $admin_body_classes
|
261 |
+
*
|
262 |
* @return string
|
263 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
264 |
* @since 3.0.0
|
265 |
*/
|
266 |
public static function add_body_class( $admin_body_classes ) {
|
267 |
global $pagenow;
|
268 |
+
if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) ) {
|
269 |
$admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
|
270 |
+
}
|
271 |
|
272 |
return $admin_body_classes;
|
273 |
}
|
365 |
* a callback function called by Register Settings function
|
366 |
*
|
367 |
* @param $input
|
368 |
+
*
|
369 |
* @return array validate input fields
|
370 |
* @since 1.0
|
371 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
474 |
* Print the tabs navigation
|
475 |
*
|
476 |
* @param array $args
|
477 |
+
*
|
478 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
479 |
* @since 3.4.0
|
480 |
*/
|
536 |
* @param string $tab
|
537 |
* @param string $sub_tab
|
538 |
* @param string $parent_page
|
539 |
+
*
|
540 |
* @return string
|
541 |
*/
|
542 |
public function get_nav_url( $page, $tab, $sub_tab = '', $parent_page = '' ) {
|
561 |
* Print the Sub-tabs navigation if the current tab has sub-tabs
|
562 |
*
|
563 |
* @param array $args
|
564 |
+
*
|
565 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
566 |
* @since 3.4.0
|
567 |
*/
|
611 |
|
612 |
if ( $custom_tab_action ) {
|
613 |
$this->print_custom_tab( $custom_tab_action );
|
614 |
+
|
615 |
return;
|
616 |
}
|
617 |
|
627 |
<p> </p>
|
628 |
<?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
|
629 |
<input type="hidden" name="<?php echo $this->get_name_field( 'option_key' ) ?>"
|
630 |
+
value="<?php echo esc_attr( $option_key ) ?>"/>
|
631 |
<input type="submit" class="button-primary"
|
632 |
+
value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>"
|
633 |
+
style="float:left;margin-right:10px;"/>
|
634 |
</form>
|
635 |
<form method="post">
|
636 |
<?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
|
637 |
<input type="hidden" name="yit-action" value="reset"/>
|
638 |
<input type="submit" name="yit-reset" class="button-secondary"
|
639 |
+
value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>"
|
640 |
+
onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');"/>
|
641 |
</form>
|
642 |
<p> </p>
|
643 |
<?php endif ?>
|
652 |
*
|
653 |
* @param array $options
|
654 |
* @param string $option_key
|
655 |
+
*
|
656 |
* @return bool
|
657 |
*/
|
658 |
public function is_custom_tab( $options, $option_key ) {
|
671 |
$first = ! ! $tab_options && is_array( $tab_options ) ? current( $tab_options ) : array();
|
672 |
$type = isset( $first['type'] ) ? $first['type'] : 'options';
|
673 |
$special_types = array( 'post_type', 'taxonomy', 'custom_tab', 'multi_tab' );
|
674 |
+
|
675 |
return in_array( $type, $special_types ) ? $type : 'options';
|
676 |
}
|
677 |
|
692 |
* Fire the action to print the custom tab
|
693 |
*
|
694 |
* @param string $action Action to fire
|
695 |
+
*
|
696 |
* @return void
|
697 |
* @since 1.0
|
698 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
748 |
foreach ( $this->settings['admin-tabs'] as $item => $title ) {
|
749 |
|
750 |
$wp_admin_bar->add_menu( array(
|
751 |
+
'parent' => $this->settings['parent'],
|
752 |
+
'title' => $title,
|
753 |
+
'id' => $this->settings['parent'] . '-' . $item,
|
754 |
+
'href' => admin_url( 'themes.php' ) . '?page=' . $this->settings['parent_page'] . '&tab=' . $item,
|
755 |
+
) );
|
756 |
}
|
757 |
}
|
758 |
}
|
866 |
* @param $message
|
867 |
* @param string $type can be 'error' or 'updated'
|
868 |
* @param bool $echo
|
869 |
+
*
|
870 |
* @return string
|
871 |
* @since 1.0
|
872 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
895 |
|
896 |
$tabs = array();
|
897 |
|
898 |
+
foreach ( ( array ) glob( $option_files_path . '*.php' ) as $filename ) {
|
899 |
preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
|
900 |
|
901 |
if ( ! isset( $filename_parts[1] ) ) {
|
934 |
* Return the sub-tabs array of a specific tab
|
935 |
*
|
936 |
* @param array|bool $_tab the tab; if not set it'll be the current tab
|
937 |
+
*
|
938 |
* @since 3.4.0
|
939 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
940 |
* @return array sub-tabs array
|
957 |
if ( $_first && is_array( $_first ) && isset( $_first['type'] ) && 'multi_tab' === $_first['type'] && ! empty( $_first['sub-tabs'] ) ) {
|
958 |
return $_first['sub-tabs'];
|
959 |
}
|
960 |
+
|
961 |
return array();
|
962 |
}
|
963 |
|
1026 |
}
|
1027 |
}
|
1028 |
}
|
1029 |
+
|
1030 |
return '';
|
1031 |
}
|
1032 |
|
1035 |
* return the title of section
|
1036 |
*
|
1037 |
* @param $section
|
1038 |
+
*
|
1039 |
* @return string
|
1040 |
* @since 1.0
|
1041 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1049 |
return $option['name'];
|
1050 |
}
|
1051 |
}
|
1052 |
+
|
1053 |
return '';
|
1054 |
}
|
1055 |
|
1058 |
* return the description of section if is set
|
1059 |
*
|
1060 |
* @param $section
|
1061 |
+
*
|
1062 |
* @return string
|
1063 |
* @since 1.0
|
1064 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1072 |
return '<p>' . $option['desc'] . '</p>';
|
1073 |
}
|
1074 |
}
|
1075 |
+
|
1076 |
return '';
|
1077 |
}
|
1078 |
|
1108 |
* return a string with the name of the input field
|
1109 |
*
|
1110 |
* @param string $name
|
1111 |
+
*
|
1112 |
* @return string
|
1113 |
* @since 1.0
|
1114 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1122 |
* return a string with the id of the input field
|
1123 |
*
|
1124 |
* @param string $id
|
1125 |
+
*
|
1126 |
* @return string
|
1127 |
* @since 1.0
|
1128 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1138 |
* return a text area
|
1139 |
*
|
1140 |
* @param array $param
|
1141 |
+
*
|
1142 |
* @return void
|
1143 |
* @since 1.0
|
1144 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1161 |
$std = isset( $option['std'] ) ? $option['std'] : '';
|
1162 |
$db_value = ( isset( $db_options[ $option['id'] ] ) ) ? $db_options[ $option['id'] ] : $std;
|
1163 |
|
1164 |
+
if ( isset( $option['deps'] ) ) {
|
1165 |
$deps = $option['deps'];
|
1166 |
+
}
|
1167 |
|
1168 |
+
if ( 'on-off' === $option['type'] ) {
|
1169 |
$option['type'] = 'onoff';
|
1170 |
+
}
|
1171 |
|
1172 |
if ( $field_template_path = yith_plugin_fw_get_field_template_path( $option ) ) {
|
1173 |
$field_container_path = apply_filters( 'yith_plugin_fw_panel_field_container_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/panel-field-container.php', $option );
|
1200 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1201 |
*
|
1202 |
* @param array $args
|
1203 |
+
*
|
1204 |
* @return void
|
1205 |
* @since 1.0
|
1206 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
1216 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1217 |
*
|
1218 |
* @param array $args
|
1219 |
+
*
|
1220 |
* @return void
|
1221 |
* @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
|
1222 |
*/
|
1311 |
</div>
|
1312 |
<div class="yith-plugin-fw-rate">
|
1313 |
<?php printf( '<strong>%s</strong> %s <a href="%s" target="_blank"><u>%s</u> <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> %s',
|
1314 |
+
__( 'We need your support', 'yith-plugin-fw' ),
|
1315 |
+
__( 'to keep updating and improving the plugin. Please,', 'yith-plugin-fw' ),
|
1316 |
+
$rate_link,
|
1317 |
+
__( 'help us by leaving a five-star rating', 'yith-plugin-fw' ),
|
1318 |
+
__( ':) Thanks!', 'yith-plugin-fw' ) ) ?>
|
1319 |
</div>
|
1320 |
<?php else: ?>
|
1321 |
<h1 class="notice-container"></h1>
|
1401 |
public function maybe_redirect_to_proper_wp_page() {
|
1402 |
global $pagenow;
|
1403 |
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && $this->settings['page'] === $_GET['page'] &&
|
1404 |
+
! $this->is_custom_taxonomy_page() && ! $this->is_custom_post_type_page() && ! isset( $_REQUEST['yith-plugin-fw-panel-skip-redirect'] ) ) {
|
1405 |
$url = $this->get_nav_url( $this->settings['page'], $this->get_current_tab(), $this->get_current_sub_tab() );
|
1406 |
if ( strpos( $url, 'edit.php' ) !== false || strpos( $url, 'edit-tags.php' ) !== false ) {
|
1407 |
wp_safe_redirect( add_query_arg( array( 'yith-plugin-fw-panel-skip-redirect' => 1 ), $url ) );
|
1408 |
exit;
|
1409 |
}
|
1410 |
}
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
/**
|
1414 |
+
* Print the Panel tabs and sub-tabs navigation in WP pages
|
1415 |
+
* Important: this opens a wrapper <div> that will be closed through YIT_Plugin_Panel::print_panel_tabs_in_post_edit_page_end()
|
1416 |
+
*
|
1417 |
+
* @since 3.4.0
|
1418 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
1419 |
+
*/
|
1420 |
+
public function print_panel_tabs_in_wp_pages() {
|
1421 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1422 |
+
wp_enqueue_style( 'yit-plugin-style' );
|
1423 |
+
wp_enqueue_script( 'yit-plugin-panel' );
|
1424 |
+
|
1425 |
+
$wrap_class = isset( $this->settings['class'] ) ? $this->settings['class'] : '';
|
1426 |
+
|
1427 |
+
?>
|
1428 |
+
<div class="yith-plugin-fw-wp-page-wrapper">
|
1429 |
+
<?php
|
1430 |
+
echo "<div class='{$wrap_class}'>";
|
1431 |
+
$this->add_plugin_banner( $this->settings['page'] );
|
1432 |
+
$this->print_tabs_nav( self::$_panel_tabs_in_wp_pages );
|
1433 |
+
echo "</div>";
|
1434 |
+
}
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
|
1438 |
+
/**
|
1439 |
+
* Close the wrapper opened in YIT_Plugin_Panel::print_panel_tabs_in_wp_pages()
|
1440 |
+
*
|
1441 |
+
* @since 3.4.0
|
1442 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
1443 |
+
*/
|
1444 |
+
public function print_panel_tabs_in_wp_pages_end() {
|
1445 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1446 |
+
echo "</div><!-- /yith-plugin-fw-wp-page-wrapper -->";
|
1447 |
+
}
|
1448 |
+
}
|
1449 |
+
|
1450 |
+
public function set_parent_file_to_handle_menu_for_wp_pages( $parent_file ) {
|
1451 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1452 |
+
return 'yith_plugin_panel';
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
return $parent_file;
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
public function set_submenu_file_to_handle_menu_for_wp_pages( $submenu_file, $parent_file ) {
|
1459 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1460 |
+
return $this->settings['page'];
|
1461 |
+
}
|
1462 |
+
|
1463 |
+
return $submenu_file;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
/**
|
1467 |
+
*
|
1468 |
+
*/
|
1469 |
+
public function save_toggle_element_options() {
|
1470 |
+
return true;
|
1471 |
+
}
|
1472 |
+
}
|
1473 |
}
|
plugin-fw/package.json
CHANGED
@@ -6,12 +6,18 @@
|
|
6 |
"scripts": {
|
7 |
"build": "npm run js && npm run i18n",
|
8 |
"js": "grunt js",
|
9 |
-
"i18n": "
|
|
|
|
|
|
|
|
|
|
|
10 |
},
|
11 |
"author": "YITH",
|
12 |
"license": "GPL-3.0+",
|
13 |
"keywords": [],
|
14 |
"devDependencies": {
|
|
|
15 |
"grunt": "^1.0.3",
|
16 |
"grunt-cli": "^1.3.2",
|
17 |
"grunt-contrib-jshint": "^2.0.0",
|
6 |
"scripts": {
|
7 |
"build": "npm run js && npm run i18n",
|
8 |
"js": "grunt js",
|
9 |
+
"i18n": "npm run -s i18n:build && npm run -s i18n:translations",
|
10 |
+
"i18n:build": "grunt makepot",
|
11 |
+
"i18n:translations": "npm run -s i18n:download-translations && npm run -s i18n:update-po && npm run -s i18n:clean",
|
12 |
+
"i18n:download-translations": "node ./bin/download-translations.js",
|
13 |
+
"i18n:update-po": "grunt update_po",
|
14 |
+
"i18n:clean": "node ./bin/clean-language-files.js"
|
15 |
},
|
16 |
"author": "YITH",
|
17 |
"license": "GPL-3.0+",
|
18 |
"keywords": [],
|
19 |
"devDependencies": {
|
20 |
+
"axios": "^0.19.2",
|
21 |
"grunt": "^1.0.3",
|
22 |
"grunt-cli": "^1.3.2",
|
23 |
"grunt-contrib-jshint": "^2.0.0",
|
plugin-fw/templates/sysinfo/system-information-panel.php
CHANGED
@@ -104,7 +104,7 @@ if ( 'n/a' === $output_ip && function_exists( 'curl_init' ) && apply_filters( 'y
|
|
104 |
<?php esc_html_e( 'Site URL', 'yith-plugin-fw' ); ?>
|
105 |
</th>
|
106 |
<td class="requirement-value">
|
107 |
-
<?php echo get_site_url(); ?>
|
108 |
</td>
|
109 |
</tr>
|
110 |
<tr>
|
@@ -112,7 +112,7 @@ if ( 'n/a' === $output_ip && function_exists( 'curl_init' ) && apply_filters( 'y
|
|
112 |
<?php esc_html_e( 'Output IP Address', 'yith-plugin-fw' ); ?>
|
113 |
</th>
|
114 |
<td class="requirement-value">
|
115 |
-
<?php echo $output_ip; ?>
|
116 |
</td>
|
117 |
</tr>
|
118 |
<tr>
|
@@ -123,6 +123,14 @@ if ( 'n/a' === $output_ip && function_exists( 'curl_init' ) && apply_filters( 'y
|
|
123 |
<?php echo( defined( 'WP_CACHE' ) && WP_CACHE ? esc_html__( 'Yes', 'yith-plugin-fw' ) : esc_html__( 'No', 'yith-plugin-fw' ) ); ?>
|
124 |
</td>
|
125 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
</table>
|
127 |
|
128 |
<table class="widefat striped">
|
104 |
<?php esc_html_e( 'Site URL', 'yith-plugin-fw' ); ?>
|
105 |
</th>
|
106 |
<td class="requirement-value">
|
107 |
+
<?php echo esc_attr( get_site_url() ); ?>
|
108 |
</td>
|
109 |
</tr>
|
110 |
<tr>
|
112 |
<?php esc_html_e( 'Output IP Address', 'yith-plugin-fw' ); ?>
|
113 |
</th>
|
114 |
<td class="requirement-value">
|
115 |
+
<?php echo esc_attr( $output_ip ); ?>
|
116 |
</td>
|
117 |
</tr>
|
118 |
<tr>
|
123 |
<?php echo( defined( 'WP_CACHE' ) && WP_CACHE ? esc_html__( 'Yes', 'yith-plugin-fw' ) : esc_html__( 'No', 'yith-plugin-fw' ) ); ?>
|
124 |
</td>
|
125 |
</tr>
|
126 |
+
<tr>
|
127 |
+
<th>
|
128 |
+
<?php esc_html_e( 'External object cache', 'yith-plugin-fw' ); ?>
|
129 |
+
</th>
|
130 |
+
<td class="requirement-value">
|
131 |
+
<?php echo( wp_using_ext_object_cache() ? esc_html__( 'Yes', 'yith-plugin-fw' ) : esc_html__( 'No', 'yith-plugin-fw' ) ); ?>
|
132 |
+
</td>
|
133 |
+
</tr>
|
134 |
</table>
|
135 |
|
136 |
<table class="widefat striped">
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce catalog mode plugin, woocommerce catalog only, woocommerce, products, themes, yit, yith, yithemes, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -131,6 +131,11 @@ yith-woocommerce-catalog-mode-<WORDPRESS LOCALE >.mo
|
|
131 |
|
132 |
== Changelog ==
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
= 2.0.4 - Released: 21 September 2020 =
|
135 |
|
136 |
* New: Support for WooCommerce 4.5
|
@@ -374,7 +379,7 @@ yith-woocommerce-catalog-mode-<WORDPRESS LOCALE >.mo
|
|
374 |
|
375 |
== Upgrade Notice ==
|
376 |
|
377 |
-
Last Stable Tag 2.0.
|
378 |
|
379 |
== Suggestions ==
|
380 |
|
4 |
Tags: woocommerce catalog mode plugin, woocommerce catalog only, woocommerce, products, themes, yit, yith, yithemes, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 2.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
131 |
|
132 |
== Changelog ==
|
133 |
|
134 |
+
= 2.0.5 - Released: 07 October 2020 =
|
135 |
+
|
136 |
+
* New: Support for WooCommerce 4.6
|
137 |
+
* Update: plugin framework
|
138 |
+
|
139 |
= 2.0.4 - Released: 21 September 2020 =
|
140 |
|
141 |
* New: Support for WooCommerce 4.5
|
379 |
|
380 |
== Upgrade Notice ==
|
381 |
|
382 |
+
Last Stable Tag 2.0.5
|
383 |
|
384 |
== Suggestions ==
|
385 |
|