YITH WooCommerce Zoom Magnifier - Version 1.3.10

Version Description

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Zoom Magnifier
Version 1.3.10
Comparing to
See all releases

Code changes from version 1.3.9 to 1.3.10

Files changed (55) hide show
  1. README.txt +6 -2
  2. init.php +2 -2
  3. plugin-fw/assets/css/metaboxes.css +18 -1
  4. plugin-fw/assets/css/yith-fields.css +1434 -9
  5. plugin-fw/assets/fonts/yith-icon.eot +0 -0
  6. plugin-fw/assets/fonts/yith-icon.svg +27 -0
  7. plugin-fw/assets/fonts/yith-icon.ttf +0 -0
  8. plugin-fw/assets/fonts/yith-icon.woff +0 -0
  9. plugin-fw/assets/images/arrow_down.svg +9 -0
  10. plugin-fw/assets/images/banner-free.png +0 -0
  11. plugin-fw/assets/images/banner-premium.png +0 -0
  12. plugin-fw/assets/images/rate_banner.png +0 -0
  13. plugin-fw/assets/images/upgrade_banner.png +0 -0
  14. plugin-fw/assets/js/yith-fields.js +631 -346
  15. plugin-fw/assets/js/yith-fields.min.js +1 -15
  16. plugin-fw/init.php +74 -5
  17. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  18. plugin-fw/languages/yith-plugin-fw-it_IT.po +31 -20
  19. plugin-fw/lib/promo/black.jpg +0 -0
  20. plugin-fw/lib/promo/cyber.jpg +0 -0
  21. plugin-fw/lib/promo/halloween.jpg +0 -0
  22. plugin-fw/lib/promo/yith-promo.php +189 -0
  23. plugin-fw/lib/promo/yith-promo.xml +64 -0
  24. plugin-fw/lib/yit-assets.php +8 -4
  25. plugin-fw/lib/yit-metabox.php +127 -34
  26. plugin-fw/lib/yit-plugin-licence.php +119 -0
  27. plugin-fw/lib/yit-plugin-panel-wc.php +123 -4
  28. plugin-fw/lib/yit-plugin-panel.php +106 -2
  29. plugin-fw/lib/yit-theme-licence.php +97 -0
  30. plugin-fw/lib/yit-upgrade.php +8 -649
  31. plugin-fw/licence/assets/css/yit-licence.css +0 -461
  32. plugin-fw/licence/assets/images/licence-error.png +0 -0
  33. plugin-fw/licence/assets/js/yit-licence.js +0 -215
  34. plugin-fw/licence/assets/js/yit-licence.min.js +0 -8
  35. plugin-fw/licence/lib/yit-licence.php +0 -804
  36. plugin-fw/licence/lib/yit-plugin-licence.php +0 -243
  37. plugin-fw/licence/lib/yit-theme-licence.php +0 -191
  38. plugin-fw/licence/templates/panel/activation/activation-panel.php +0 -247
  39. plugin-fw/templates/fields/colorpicker.php +1 -1
  40. plugin-fw/templates/fields/date-format.php +56 -0
  41. plugin-fw/templates/fields/list-table.php +62 -0
  42. plugin-fw/templates/fields/multi-colorpicker.php +39 -0
  43. plugin-fw/templates/fields/onoff.php +1 -1
  44. plugin-fw/templates/fields/select-buttons.php +3 -2
  45. plugin-fw/templates/fields/select.php +4 -2
  46. plugin-fw/templates/fields/text.php +1 -0
  47. plugin-fw/templates/fields/textarea.php +3 -1
  48. plugin-fw/templates/fields/toggle-element.php +264 -0
  49. plugin-fw/templates/fields/upload.php +11 -11
  50. plugin-fw/templates/metaboxes/field-row.php +1 -0
  51. plugin-fw/templates/metaboxes/tab.php +6 -2
  52. plugin-fw/templates/panel/woocommerce/woocommerce-option-row.php +1 -1
  53. plugin-fw/templates/panel/woocommerce/woocommerce-panel.php +7 -3
  54. plugin-fw/yit-functions.php +138 -0
  55. plugin-fw/yit-plugin.php +4 -4
README.txt CHANGED
@@ -3,8 +3,8 @@
3
  Contributors: yithemes
4
  Tags: zoom, magnifier, slider, carousel, woocommerce
5
  Requires at least: 4.0
6
- Tested up to: 5.1.1
7
- Stable tag: 1.3.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
@@ -52,6 +52,10 @@ YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "Y
52
 
53
  == Changelog ==
54
 
 
 
 
 
55
  = Version 1.3.9 - Released: Apr 23, 2019 =
56
 
57
  * Update: plugin framework
3
  Contributors: yithemes
4
  Tags: zoom, magnifier, slider, carousel, woocommerce
5
  Requires at least: 4.0
6
+ Tested up to: 5.2
7
+ Stable tag: 1.3.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
52
 
53
  == Changelog ==
54
 
55
+ = Version 1.3.10 - Released: Jun 18, 2019 =
56
+
57
+ * Update: plugin framework
58
+
59
  = Version 1.3.9 - Released: Apr 23, 2019 =
60
 
61
  * Update: plugin framework
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Zoom Magnifier
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
5
  * Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
- * Version: 1.3.9
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-zoom-magnifier
@@ -78,7 +78,7 @@ register_activation_hook ( __FILE__, 'yith_plugin_registration_hook' );
78
 
79
  defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
80
  defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
81
- defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.9' );
82
  defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
83
  defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
84
  defined ( 'YITH_YWZM_URL' ) || define ( 'YITH_YWZM_URL', plugins_url ( '/', __FILE__ ) );
3
  * Plugin Name: YITH WooCommerce Zoom Magnifier
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
5
  * Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
+ * Version: 1.3.10
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-zoom-magnifier
78
 
79
  defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
80
  defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
81
+ defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.10' );
82
  defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
83
  defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
84
  defined ( 'YITH_YWZM_URL' ) || define ( 'YITH_YWZM_URL', plugins_url ( '/', __FILE__ ) );
plugin-fw/assets/css/metaboxes.css CHANGED
@@ -87,6 +87,20 @@
87
  display : block;
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  .metaboxes-tab .wp-picker-container label {
91
  font-weight : inherit;
92
  width : auto;
@@ -187,7 +201,10 @@
187
  width : 400px;
188
  max-width : 100%;
189
  }
190
-
 
 
 
191
  .metaboxes-tab .yith-plugin-fw-text-array-table input[type=text] {
192
  width : 100%;
193
  }
87
  display : block;
88
  }
89
 
90
+ .metaboxes-tab .yith-plugin-fw-radio__row{
91
+ width: 100%;
92
+ min-height: 20px;
93
+ }
94
+ .metaboxes-tab .yith-plugin-fw-radio__row label,
95
+ .metaboxes-tab .yith-toggle-elements label,
96
+ .metaboxes-tab .yith-add-box label {
97
+ margin-left:0;
98
+ font-weight:normal;
99
+ }
100
+ .metaboxes-tab.yith-plugin-ui .yith-add-box,
101
+ .metaboxes-tab.yith-plugin-ui .yith-toggle-row{
102
+ width : auto;
103
+ }
104
  .metaboxes-tab .wp-picker-container label {
105
  font-weight : inherit;
106
  width : auto;
201
  width : 400px;
202
  max-width : 100%;
203
  }
204
+ .metaboxes-tab.yith-plugin-ui input[type=number]{
205
+ width: auto;
206
+ min-width: 90px;
207
+ }
208
  .metaboxes-tab .yith-plugin-fw-text-array-table input[type=text] {
209
  width : 100%;
210
  }
plugin-fw/assets/css/yith-fields.css CHANGED
@@ -201,17 +201,19 @@ ul.yit-icons-manager-list li.active {
201
  }
202
 
203
  .yith-plugin-fw-onoff-container input + span {
204
- cursor : pointer;
205
- text-indent : -9999px;
206
- display : block;
207
- width : 36px;
208
- height : 20px;
209
- background : #a4a4a4;
210
- border-radius : 24px;
211
- position : relative;
212
- transition : all 0.3s;
 
213
  }
214
 
 
215
  .yith-plugin-fw-onoff-container input + span:before {
216
  content : '';
217
  background : #fff;
@@ -399,4 +401,1427 @@ ul.yit-icons-manager-list li.active {
399
  display : block;
400
  max-width : 100%;
401
  margin : 0 auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
402
  }
201
  }
202
 
203
  .yith-plugin-fw-onoff-container input + span {
204
+ cursor: pointer;
205
+ text-indent: -9999px;
206
+ display: block;
207
+ width: 36px;
208
+ height: 20px;
209
+ line-height: 1;
210
+ background: #a4a4a4;
211
+ border-radius: 24px;
212
+ position: relative;
213
+ transition: all 0.3s;
214
  }
215
 
216
+
217
  .yith-plugin-fw-onoff-container input + span:before {
218
  content : '';
219
  background : #fff;
401
  display : block;
402
  max-width : 100%;
403
  margin : 0 auto;
404
+ }
405
+
406
+ /****************
407
+ YITH UI
408
+ ****************/
409
+ @font-face {
410
+ font-family: 'yith-icon';
411
+ src: url('../fonts/yith-icon.eot?7ik896');
412
+ src: url('../fonts/yith-icon.eot?7ik896#iefix') format('embedded-opentype'),
413
+ url('../fonts/yith-icon.ttf?7ik896') format('truetype'),
414
+ url('../fonts/yith-icon.woff?7ik896') format('woff'),
415
+ url('../fonts/yith-icon.svg?7ik896#yith-icon') format('svg');
416
+ font-weight: normal;
417
+ font-style: normal;
418
+ }
419
+
420
+ [class^="icon-"], [class*=" icon-"] {
421
+ /* use !important to prevent issues with browser extensions that change fonts */
422
+ font-family: 'yith-icon' !important;
423
+ speak: none;
424
+ font-style: normal;
425
+ font-weight: normal;
426
+ font-variant: normal;
427
+ text-transform: none;
428
+ line-height: 1;
429
+
430
+ /* Better Font Rendering =========== */
431
+ -webkit-font-smoothing: antialiased;
432
+ -moz-osx-font-smoothing: grayscale;
433
+ }
434
+ .icon-drag:before {
435
+ content: "\e90f";
436
+ color: #d8d8d8;
437
+ }
438
+ .icon-arrow_down:before {
439
+ content: "\e900";
440
+ color: #d8d8d8;
441
+ }
442
+ .icon-arrow_left:before {
443
+ content: "\e901";
444
+ color: #d8d8d8;
445
+ }
446
+ .icon-arrow_right:before {
447
+ content: "\e902";
448
+ color: #d8d8d8;
449
+ }
450
+ .icon-arrow_up:before {
451
+ content: "\e903";
452
+ color: #d8d8d8;
453
+ }
454
+ .icon-calendar:before {
455
+ content: "\e904";
456
+ color: #d8d8d8;
457
+ }
458
+ .icon-check:before {
459
+ content: "\e905";
460
+ color: #d8d8d8;
461
+ }
462
+ .icon-close:before {
463
+ content: "\e906";
464
+ color: #d8d8d8;
465
+ }
466
+ .icon-edit:before {
467
+ content: "\e907";
468
+ color: #d8d8d8;
469
+ }
470
+ .icon-magnifier:before {
471
+ content: "\e908";
472
+ color: #d8d8d8;
473
+ }
474
+ .icon-pencil:before {
475
+ content: "\e909";
476
+ color: #d8d8d8;
477
+ }
478
+ .icon-plus:before {
479
+ content: "\e90a";
480
+ color: #d8d8d8;
481
+ }
482
+ .icon-update:before {
483
+ content: "\e90b";
484
+ color: #d8d8d8;
485
+ }
486
+ .icon-upload:before {
487
+ content: "\e90c";
488
+ color: #d8d8d8;
489
+ }
490
+ .icon-trash:before {
491
+ content: "\e90d";
492
+ color: #d8d8d8;
493
+ }
494
+ .icon-info:before {
495
+ content: "\e90e";
496
+ color: #d8d8d8;
497
+ }
498
+ .icon-reset:before {
499
+ content: "\e910";
500
+ color: #d8d8d8;
501
+ }
502
+ .yith-plugin-fw-banner{
503
+ width: 100%;
504
+ height: 75px;
505
+ background: url('../images/banner-premium.png');
506
+ }
507
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free{
508
+ height: 290px;
509
+ background: url('../images/banner-free.png') no-repeat;
510
+ }
511
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free h1{
512
+ max-width: auto;
513
+ text-align:left;
514
+ margin-left: 110px;
515
+ padding-top: 15px;
516
+ padding-bottom: 8px;
517
+ }
518
+
519
+ .yith-plugin-fw-banner h1{
520
+ text-transform: uppercase;
521
+ color: #0c5777;
522
+ font-size: 15px;
523
+ padding-left: 150px;
524
+ font-weight: 700;
525
+ text-align: left;
526
+ display: inline-block;
527
+ box-sizing: border-box;
528
+ }
529
+
530
+ .yith-plugin-fw-banner span{
531
+ font-style:italic;
532
+ display: block;
533
+ font-size: 15px;
534
+ color:#214249;
535
+ text-transform:none;
536
+ text-align: right;
537
+ }
538
+
539
+ .yith-plugin-fw-banner a,
540
+ .yith-plugin-fw-banner a:focus{
541
+ text-decoration: none;
542
+ outline: none;
543
+ box-shadow: none;
544
+ }
545
+
546
+ .yith-banners ul{
547
+ list-style: none;
548
+ margin-left: 10px;
549
+ }
550
+
551
+ .yith-banners ul li{
552
+ display: inline-block;
553
+ margin-left: 10px;
554
+ }
555
+ .yith-plugin-ui a{
556
+ outline: none;
557
+ box-shadow: none;
558
+ }
559
+
560
+ .yith-plugin-ui{
561
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
562
+ }
563
+
564
+ .yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper{
565
+ margin-top:10px;
566
+ }
567
+
568
+ .yith-plugin-ui .nav-tab{
569
+ margin-left: 0px;
570
+ margin-right: 2px;
571
+ background-color: #336374;
572
+ color: #fff;
573
+ font-size: 13px;
574
+ padding: 7px 20px;
575
+ border: 0;
576
+ }
577
+ .yith-plugin-ui .nav-tab:first-child{
578
+ border-left: 1px solid #d9d9d9;
579
+ }
580
+
581
+ .yith-plugin-ui .nav-tab.yith-premium{
582
+ background-color: #be421c;
583
+ }
584
+ .yith-plugin-ui .nav-tab-active{
585
+ background-color: #fff;
586
+ color: #336374;
587
+ border-bottom:1px solid #fff;
588
+ }
589
+ .yith-plugin-ui .nav-tab-active.yith-premium{
590
+ background-color: #fff;
591
+ color: #be421c;
592
+ }
593
+ .yith-plugin-ui #plugin-fw-wc{
594
+ padding-top: 0px;
595
+ }
596
+
597
+ .yith-plugin-ui .form-table td{
598
+ padding: 15px 20px;
599
+ }
600
+
601
+ .yith-plugin-ui label{
602
+ color: #33373b;
603
+ font-size: 13px;
604
+ }
605
+
606
+ .yith-plugin-ui span.description{
607
+ color: #716269;
608
+ font-size: 11px;
609
+ font-style: normal;
610
+ font-weight: 400;
611
+ margin-top: 15px;
612
+ margin-left: 0;
613
+ }
614
+ #wpwrap .yith-plugin-ui h2.nav-tab-wrapper, #wpbody-content .yith-plugin-ui h2.nav-tab-wrapper {
615
+ border: 0;
616
+ border-bottom : 1px solid #ccc;
617
+ margin-right: 15px;
618
+ background-color: transparent;
619
+ padding-left: 0;
620
+ }
621
+ .yith-plugin-ui #plugin-fw-wc table.form-table,
622
+ .yith-plugin-ui #yith-plugin-fw-panel table.form-table,
623
+ .yith-plugin-ui table.form-table{
624
+ border: 1px solid #d8d8d8;
625
+ border-top: 0;
626
+ margin-bottom: 40px;
627
+ }
628
+
629
+ .yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper{
630
+ background-color: transparent;
631
+ border: 0;
632
+ text-transform: none;
633
+ border-bottom: 1px solid #ddd;
634
+ }
635
+
636
+ .yith-plugin-ui h2 {
637
+ color: #2a8db0;
638
+ font-size: 13px;
639
+ text-transform: uppercase;
640
+ border: 1px solid #d8d8d8;
641
+ border-bottom: 0;
642
+ background-color: #fff;
643
+ padding: 35px 20px;
644
+ margin: 0px;
645
+ }
646
+ .yith-plugin-ui .yith-plugin-fw-custom-tab h2{
647
+ border: 0px solid #d8d8d8;
648
+ padding-left: 0;
649
+ }
650
+
651
+ .yith-plugin-ui #plugin-fw-wc table.form-table th, #yith-plugin-fw-panel table.form-table th.titledesc, .yith-plugin-ui #plugin-fw-wc table.form-table td, #yith-plugin-fw-panel table.form-table td.forminp {
652
+ padding: 30px 20px;
653
+ }
654
+
655
+ .yith-plugin-ui #plugin-fw-wc h2 + div {
656
+ background: #fff;
657
+ border-left: 1px solid #d9d9d9;
658
+ border-right: 1px solid #d9d9d9;
659
+ margin: -20px 0 0 0;
660
+ padding-left: 20px;
661
+ padding-bottom: 5px;
662
+ }
663
+
664
+ .yith-plugin-ui #plugin-fw-wc h2 + div p, .yith-plugin-ui p.info-box{
665
+ background: #f1f1f1;
666
+ font-size: 12px;
667
+ font-weight: 700;
668
+ width: 40%;
669
+ display:block;
670
+ padding: 15px;
671
+ margin-bottom: 0;
672
+ }
673
+
674
+ .yith-plugin-ui #plugin-fw-wc h2 + div p:before, .yith-plugin-ui p.info-box:before{
675
+ content: "\e90e";
676
+ font-family: yith-icon;
677
+ font-size: 30px;
678
+ font-weight: normal;
679
+ display: block;
680
+ margin-top: -5px;
681
+ float: left;
682
+ margin-right: 15px;
683
+ }
684
+
685
+ .yith-plugin-ui h2:first-child{
686
+ border-top: 0;
687
+ }
688
+
689
+ /*** Icon ***/
690
+ .yith-plugin-ui span.yith-icon {
691
+ margin-left: -36px;
692
+ line-height: 36px;
693
+ font-size: 20px;
694
+ }
695
+
696
+ /*** General Input Style ***/
697
+
698
+ .yith-plugin-ui .yith-plugin-fw select,
699
+ .yith-plugin-ui textarea,
700
+ .yith-plugin-ui input[type=number],
701
+ .yith-plugin-ui.metaboxes-tab input[type=number],
702
+ .yith-plugin-ui input[type=text],
703
+ .yith-plugin-ui input[type=text],
704
+ .yith-plugin-ui input[type=email],
705
+ .yith-plugin-ui input[type=password],
706
+ .yith-plugin-fw.yith-plugin-ui input[type=text]:not(.select2-search__field),
707
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text]:not(.select2-search__field),
708
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table select,
709
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea,
710
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=number],
711
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text] {
712
+ border: 1px solid #d8d8d8;
713
+ border-radius: 8px;
714
+ padding: 8px 10px;
715
+ height: 38px;
716
+ min-width: 90px;
717
+ box-shadow: none;
718
+ color: #716269;
719
+ }
720
+ .yith-plugin-ui textarea,
721
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea{
722
+ height: auto;
723
+ }
724
+ .yith-plugin-ui table.form-table input[type=text].wp-color-picker,
725
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker{
726
+ border: 0;
727
+ height: 30px;
728
+ max-width: 60px;
729
+
730
+ }
731
+
732
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].small-text,
733
+ .yith-plugin-ui input[type=text].small-text {
734
+ width: 100px;
735
+ height: 25px;
736
+ border: 1px solid #d9d9d9;
737
+ }
738
+
739
+ .yith-plugin-ui textarea {
740
+ height: auto;
741
+ padding: 8px;
742
+ }
743
+
744
+ .yith-plugin-ui select:focus,
745
+ .yith-plugin-ui input[type=text]:focus {
746
+ border-color: #a7d9ec;
747
+ }
748
+
749
+ .woocommerce .yith-plugin-ui table.form-table select,
750
+ .yith-plugin-ui select{
751
+ -webkit-appearance: none;
752
+ line-height: 1;
753
+ min-height: 35px;
754
+ background: url("../images/arrow_down.svg") no-repeat right center;
755
+ background-size: 35px 13px;
756
+ border-radius: 8px;
757
+ }
758
+
759
+ .yith-plugin-ui .form-table th{
760
+ width: 280px;
761
+ padding-right: 50px;
762
+ }
763
+
764
+ /** BUTTONS **/
765
+ .yith-plugin-ui .tablenav .button.action,
766
+ .wp-core-ui .yith-plugin-ui .button-primary,
767
+ .wp-core-ui .yith-plugin-ui .button-secondary,
768
+ .yith-plugin-ui .yith-add-button,
769
+ .yith-plugin-ui .yith-save-button,
770
+ .yith-plugin-ui .yith-edit-button,
771
+ .yith-plugin-ui .yith-update-button,
772
+ .yith-plugin-ui .yith-plugin-fw-select-all,
773
+ .yith-plugin-ui .yith-plugin-fw-deselect-all,
774
+ .yith-plugin-ui .yith-plugin-fw-upload-button,
775
+ .yith-plugin-ui .yith-plugin-fw-upload-button-reset {
776
+ border-radius: 3px;
777
+ text-transform: uppercase;
778
+ box-shadow: none;
779
+ border: 0;
780
+ font-weight: 700;
781
+ font-size: 11px;
782
+ padding: 0px 14px;
783
+ outline: none;
784
+ height: auto;
785
+ transition: all ease 0.3s;
786
+ background-color: #d6d6d6;
787
+ color: #656565;
788
+ text-shadow: none;
789
+ vertical-align: middle;
790
+ line-height: 26px;
791
+ display: inline-block;
792
+ text-decoration: none;
793
+ }
794
+ .wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
795
+ .wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button,
796
+ .yith-plugin-ui .yith-plugin-fw-upload-button-reset,
797
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
798
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button{
799
+ height: 38px;
800
+ }
801
+
802
+ .wp-core-ui .yith-plugin-ui .button:focus,
803
+ .wp-core-ui .yith-plugin-ui .button-primary:focus,
804
+ .yith-plugin-ui .yith-add-button:focus,
805
+ .yith-plugin-ui .yith-save-button:focus,
806
+ .yith-plugin-ui .yith-edit-button:focus,
807
+ .yith-plugin-ui .yith-update-button:focus,
808
+ .wp-core-ui .yith-plugin-ui .button-secondary:focus{
809
+ outline: none;
810
+ box-shadow: none;
811
+ }
812
+
813
+ /** button with inside a span with icon class */
814
+ .yith-plugin-ui .button-secondary span.yith-icon{
815
+ margin-left: 0px;
816
+ margin-right: 10px;
817
+ line-height: normal;
818
+ }
819
+
820
+ .yith-plugin-ui .button-secondary span.yith-icon:before{
821
+ color: #656565;
822
+ font-size: 15px;
823
+ }
824
+
825
+ .yith-plugin-ui .tablenav .button.action,
826
+ .wp-core-ui .yith-plugin-ui .button:focus,
827
+ .wp-core-ui .yith-plugin-ui .button-secondary:focus,
828
+ .yith-plugin-ui .yith-save-button:hover,
829
+ .wp-core-ui .yith-plugin-ui .button-secondary:hover,
830
+ .yith-plugin-ui .yith-plugin-fw-upload-button-reset:hover{
831
+ background-color: #cacaca;
832
+ color: #515151;
833
+ }
834
+
835
+ .wp-core-ui .yith-plugin-ui .button-primary,
836
+ .yith-plugin-ui .tablenav .button.action,
837
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-select-all,
838
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button{
839
+ background-color: #007694;
840
+ color: #fff;
841
+ }
842
+
843
+ .yith-plugin-ui .tablenav .button.action:active,
844
+ .yith-plugin-ui .tablenav .button.action:focus,
845
+ .yith-plugin-ui .tablenav .button.action:hover,
846
+ .yith-plugin-ui .yith-add-button,
847
+ .wp-core-ui .yith-plugin-ui .button-primary:focus,
848
+ .wp-core-ui .yith-plugin-ui .button-primary:hover{
849
+ background-color: #375f6b;
850
+ color: #fff;
851
+ }
852
+
853
+
854
+ .yith-plugin-ui .yith-add-button:hover,
855
+ .wp-core-ui .yith-plugin-ui .yith-plugin-fw-upload-button:focus,
856
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:hover,
857
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:focus,
858
+ .yith-plugin-ui .yith-plugin-fw-upload-button:hover{
859
+ border-color: #007694;
860
+ background: #007694;
861
+ color: #fff;
862
+ line-height: 26px;
863
+ margin-left: 0;
864
+ }
865
+
866
+ .yith-plugin-ui .button-primary:before,
867
+ .yith-plugin-ui .yith-add-button:before,
868
+ .yith-plugin-ui .yith-save-button:before,
869
+ .yith-plugin-ui .yith-edit-button:before,
870
+ .yith-plugin-ui .yith-update-button:before,
871
+ .yith-plugin-ui .button-secondary:before{
872
+ font-family: 'yith-icon';
873
+ font-size: 10px;
874
+ font-weight: 700;
875
+ margin-right: 10px;
876
+ vertical-align: bottom;
877
+ display:inline-block;
878
+ }
879
+
880
+ /** yith-edit-button **/
881
+ .yith-plugin-ui .yith-edit-button {
882
+ background-color: #7f9298;
883
+ color: #fff;
884
+ }
885
+ .yith-plugin-ui .yith-edit-button:focus,
886
+ .yith-plugin-ui .yith-edit-button:hover {
887
+ background-color: #718085;
888
+ color: #fff;
889
+ }
890
+ .yith-plugin-ui .yith-edit-button:before{
891
+ content: "\e907";
892
+ }
893
+ /** yith-update-button **/
894
+ .yith-plugin-ui .yith-update-button {
895
+ background-color: #94aa09;
896
+ color: #fff;
897
+ }
898
+ .yith-plugin-ui .yith-update-button:focus,
899
+ .yith-plugin-ui .yith-update-button:hover {
900
+ background-color: #7a9009;
901
+ color: #fff;
902
+ }
903
+ .yith-plugin-ui .yith-update-button:before{
904
+ content: "\e90b";
905
+ font-size: 15px;
906
+ }
907
+
908
+ /** yith-save-button **/
909
+
910
+ .yith-plugin-ui .yith-save-button {
911
+ background-color: #267390;
912
+ color: #fff;
913
+ }
914
+ .yith-plugin-ui .yith-save-button:focus,
915
+ .yith-plugin-ui .yith-save-button:hover {
916
+ background-color: #1c4863;
917
+ color: #fff;
918
+ }
919
+
920
+
921
+ /** yith-remove-button **/
922
+
923
+ .yith-plugin-ui .button-secondary.yith-remove-button:before{
924
+ content: "\e90d";
925
+ font-size: 15px;
926
+ }
927
+
928
+
929
+ /** yith-add-button **/
930
+
931
+ .yith-plugin-ui .yith-add-button:before{
932
+ content: "\e90a";
933
+ }
934
+
935
+ /** yith-plugin-fw-upload-button **/
936
+ .yith-plugin-ui button.yith-plugin-fw-upload-button:before{
937
+ content: "\e90c";
938
+ font-family: 'yith-icon';
939
+ font-size: 19px;
940
+ font-weight: 400;
941
+ margin-right: 10px;
942
+ vertical-align: middle;
943
+ display:inline-block;
944
+ }
945
+ /** SELECT 2 **/
946
+ .yith-plugin-ui .select2-container,
947
+ .yith-plugin-ui .select2-selection--single{
948
+ height: auto;
949
+ padding: 2px;
950
+ outline: none;
951
+ }
952
+
953
+ .yith-plugin-ui .select2-selection--single{
954
+ margin: 0;
955
+ border: 0;
956
+ }
957
+
958
+ /* old panel*/
959
+
960
+ .yith-plugin-ui span.select2.select2-container.select2-container--default{
961
+ border: 1px solid #d8d8d8;
962
+ border-radius:8px;
963
+ }
964
+ .yith-plugin-ui span.select2.select2-container.select2-container--default:hover,
965
+ .yith-plugin-ui span.select2.select2-container.select2-container--default:active,
966
+ .yith-plugin-ui span.select2.select2-container.select2-container--default:focus {
967
+ border-color: #a7d9ec;
968
+ }
969
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
970
+ color: #fff;
971
+ }
972
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].select2-search__field,
973
+ .yith-plugin-ui .yith-plugin-fw table.form-table input.select2-search__field{
974
+ border: 0;
975
+ padding: 0;
976
+ height: initial;
977
+ }
978
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice,
979
+ .yith-plugin-ui .select2-selection__choice{
980
+ color: #fff;
981
+ background-color: #4e8ba2;
982
+ border-radius: 12px;
983
+ padding: 3px 11px;
984
+ border-color: #33937e;
985
+ font-size: 12px;
986
+ }
987
+
988
+ .yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before{
989
+ content: "\e900";
990
+ font-family: 'yith-icon' !important;
991
+ line-height: 36px;
992
+ color: #d9d9d9;
993
+ }
994
+
995
+ .yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow b{
996
+ display: none;
997
+ }
998
+ .yith-plugin-ui .select2-container--open .select2-dropdown--below,
999
+ .yith-plugin-ui .select2-container--open .select2-dropdown--above,
1000
+ .yith-plugin-fw-panel .select2-container--open .select2-dropdown--below,
1001
+ .yith-plugin-fw-panel .select2-container--open .select2-dropdown--above {
1002
+ margin-top: 10px;
1003
+ border-radius: 8px;
1004
+ box-shadow:0 2px 4px 0 rgba(0,0,0,0.12),0 2px 10px 0 rgba(0,0,0,0.12) !important;
1005
+ }
1006
+ .yith-plugin-ui .select2-container--open .select2-dropdown--above,
1007
+ .yith-plugin-fw-panel .select2-container--open .select2-dropdown--above{
1008
+ margin-top: -10px;
1009
+ }
1010
+ .yith-plugin-ui .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
1011
+ .yith-plugin-ui .select2-container--default.select2-container--open.select2-container--above .select2-selection--single,
1012
+ .yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
1013
+ .yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--above .select2-selection--single{
1014
+ border-radius: 8px;
1015
+ }
1016
+ .yith-plugin-ui .select2-results .select2-results__group, .select2-results .select2-results__option:first-child,
1017
+ .yith-plugin-fw-panel .select2-results .select2-results__group, .select2-results .select2-results__option:first-child{
1018
+ border-top-left-radius: 8px;
1019
+ border-top-right-radius: 8px;
1020
+ }
1021
+ .yith-plugin-ui .select2-results .select2-results__group,
1022
+ .yith-plugin-ui .select2-results .select2-results__option:last-child,
1023
+ .yith-plugin-fw-panel .select2-results .select2-results__group,
1024
+ .yith-plugin-fw-panel .select2-results .select2-results__option:last-child{
1025
+ border-bottom-left-radius: 8px;
1026
+ border-bottom-right-radius: 8px;
1027
+ }
1028
+ .yith-plugin-ui .select2-container--default .select2-results__option[data-selected=true],
1029
+ .yith-plugin-ui .select2-container--default .select2-results__option[aria-selected=true],
1030
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option[data-selected=true],
1031
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option[aria-selected=true] {
1032
+ background-color: #fff;
1033
+ outline: none;
1034
+ }
1035
+ .yith-plugin-ui .select2-container--default .select2-results__option--highlighted[aria-selected],
1036
+ .yith-plugin-ui .select2-container--default .select2-results__option--highlighted[data-selected],
1037
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[aria-selected],
1038
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[data-selected]{
1039
+ background-color: #e8eff1;
1040
+ color: #4e8ba2;
1041
+ outline: none;
1042
+ }
1043
+
1044
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove,
1045
+ .yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
1046
+ float: right;
1047
+ padding-left: 15px;
1048
+ text-indent: -9999px;
1049
+ }
1050
+
1051
+
1052
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
1053
+ .woocommerce .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
1054
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after{
1055
+ float: right;
1056
+ color: #fff;
1057
+ content: "\e906";
1058
+ font-family: 'yith-icon' !important;
1059
+ font-size: 9px;
1060
+ line-height: 21px;
1061
+ text-indent: 0;
1062
+ }
1063
+
1064
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after{
1065
+ color: #000;
1066
+ }
1067
+
1068
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after
1069
+ .yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after{
1070
+ color: #000;
1071
+ }
1072
+ .yith-plugin-ui .select2-container .select2-selection--multiple,
1073
+ .yith-plugin-ui .select2-container--default.select2-container--focus .select2-selection--multiple{
1074
+ border: 0;
1075
+ }
1076
+
1077
+ .yith-plugin-fw .select2-search input[type=text]{
1078
+ border: 0;
1079
+ padding: 0;
1080
+ height: auto;
1081
+ }
1082
+ .yith-plugin-ui .yith-plugin-fw-select-field-wrapper span.yith-icon.icon-magnifier,
1083
+ .yith-plugin-fw-panel .yith-plugin-fw-select-field-wrapper span.yith-icon.icon-magnifier {
1084
+ position: absolute;
1085
+ padding-top: 5px;
1086
+ }
1087
+
1088
+ .yith-plugin-ui input[type=text].select2-search__field{
1089
+ border: 0;
1090
+ padding: 0;
1091
+ height: 30px;
1092
+ }
1093
+ .yith-plugin-ui .select2-container--default .select2-search--dropdown .select2-search__field,
1094
+ .yith-plugin-fw-panel .select2-container--default .select2-search--dropdown .select2-search__field {
1095
+ border: 1px solid #d9d9d9;
1096
+ border-radius: 8px;
1097
+ box-shadow: none;
1098
+ }
1099
+ .yith-plugin-ui .select2-dropdown,
1100
+ .yith-plugin-fw-panel .select2-dropdown{
1101
+ border: 1px solid #d9d9d9;
1102
+ }
1103
+ /** RADIO BUTTON **/
1104
+ .yith-plugin-ui [type="radio"]:checked,
1105
+ .yith-plugin-ui [type="radio"]:not(:checked) {
1106
+ position: absolute;
1107
+ left: -9999px;
1108
+ }
1109
+ .yith-plugin-ui [type="radio"]:checked + label,
1110
+ .yith-plugin-ui [type="radio"]:not(:checked) + label
1111
+ {
1112
+ position: relative;
1113
+ padding-left: 35px;
1114
+ cursor: pointer;
1115
+ line-height: 20px;
1116
+ display: inline-block;
1117
+ color: #716269;
1118
+ font-size: 12px;
1119
+ }
1120
+ .yith-plugin-ui [type="radio"]:checked + label:before,
1121
+ .yith-plugin-ui [type="radio"]:not(:checked) + label:before {
1122
+ content: '';
1123
+ position: absolute;
1124
+ left: 0;
1125
+ top: 0;
1126
+ width: 18px;
1127
+ height: 18px;
1128
+ border: 1px solid #d8d8d8;
1129
+ border-radius: 100%;
1130
+ background: #fff;
1131
+ }
1132
+ .yith-plugin-ui [type="radio"]:checked + label:after,
1133
+ .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
1134
+ content: '';
1135
+ width: 12px;
1136
+ height: 12px;
1137
+ background: #4e8ba2;
1138
+ position: absolute;
1139
+ top: 4px;
1140
+ left: 4px;
1141
+ border-radius: 100%;
1142
+ -webkit-transition: all 0.2s ease;
1143
+ transition: all 0.2s ease;
1144
+ }
1145
+ .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
1146
+ opacity: 0;
1147
+ -webkit-transform: scale(0);
1148
+ transform: scale(0);
1149
+ }
1150
+ .yith-plugin-ui [type="radio"]:checked + label:after {
1151
+ opacity: 1;
1152
+ -webkit-transform: scale(1);
1153
+ transform: scale(1);
1154
+ }
1155
+
1156
+ /** CHECKBOX **/
1157
+ .yith-plugin-ui input[type="checkbox"] {
1158
+ -webkit-appearance: none;
1159
+ background-color: #fff;
1160
+ border: 1px solid #d8d8d8;
1161
+ box-shadow: none;
1162
+ width: 18px;
1163
+ height: 18px;
1164
+ border-radius: 3px;
1165
+ display: inline-block;
1166
+ position: relative;
1167
+ }
1168
+ .yith-plugin-ui input[type="checkbox"]:checked{
1169
+ background-color: #4e8ba2;
1170
+ border-color: #488197;
1171
+ }
1172
+ .yith-plugin-ui .forminp-checkbox span.description.inline {
1173
+ margin-left: 10px;
1174
+ }
1175
+ .yith-plugin-ui input[type="checkbox"]:checked:before{
1176
+ display: none;
1177
+ }
1178
+
1179
+ .yith-plugin-ui input[type="checkbox"]:checked:after {
1180
+ content: "\e905";
1181
+ font-family: 'yith-icon';
1182
+ font-size: 15px;
1183
+ position: absolute;
1184
+ top: 8px;
1185
+ left: 1px;
1186
+ color: #fff;
1187
+ }
1188
+
1189
+ /** ONOFF **/
1190
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input[type="checkbox"] {
1191
+ display: none;
1192
+ }
1193
+
1194
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
1195
+ border: 1px solid #d8d8d8;
1196
+ background-color: #fff;
1197
+ width:50px;
1198
+ }
1199
+
1200
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before{
1201
+ background-color: #d8d8d8;
1202
+ }
1203
+
1204
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
1205
+ width: 14px;
1206
+ height: 14px;
1207
+ top: 3px;
1208
+ left: 4px;
1209
+ background-color: #d8d8d8;
1210
+ }
1211
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after{
1212
+ content: 'OFF';
1213
+ width: 14px;
1214
+ height: 14px;
1215
+ font-size: 10px;
1216
+ padding-left:24px;
1217
+ color: #979797;
1218
+ margin-top: 5px;
1219
+ display: inline-block;
1220
+ }
1221
+
1222
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span,
1223
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input.onoffchecked + span{
1224
+ background-color: #fff;
1225
+ border-color: #98aa36;
1226
+ }
1227
+
1228
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
1229
+ .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before{
1230
+ background-color: #98aa36;
1231
+ left:32px;
1232
+ }
1233
+
1234
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
1235
+ .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after{
1236
+ content: 'ON';
1237
+ color: #98aa36;
1238
+ width: 14px;
1239
+ height: 14px;
1240
+ display: inline-block;
1241
+ font-size: 10px;
1242
+ padding: 0 10px;
1243
+ margin-top: 5px;
1244
+
1245
+ }
1246
+
1247
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
1248
+ text-indent: 0;
1249
+ }
1250
+
1251
+
1252
+ /**
1253
+ DATEPICKER
1254
+ */
1255
+ .yith-plugin-ui div#ui-datepicker-div,
1256
+ .yith-plugin-fw-panel div#ui-datepicker-div {
1257
+ border: 0;
1258
+ box-shadow:0 2px 4px 0 rgba(0,0,0,0.12),0 2px 10px 0 rgba(0,0,0,0.12) !important;
1259
+ }
1260
+
1261
+ .yith-plugin-ui .ui-datepicker-header.ui-widget-header,
1262
+ .yith-plugin-fw-panel .ui-datepicker-header.ui-widget-header {
1263
+ background:#4e8ba2;
1264
+ color: #fff;
1265
+ font-size: 11px;
1266
+ line-height: 25px;
1267
+ border:0;
1268
+ min-height: 25px;
1269
+ }
1270
+ .yith-plugin-ui .ui-datepicker-title,
1271
+ .yith-plugin-fw-panel .ui-datepicker-title{
1272
+ line-height: 25px;
1273
+ }
1274
+ .yith-plugin-ui .ui-datepicker th,
1275
+ .yith-plugin-fw-panel .ui-datepicker th{
1276
+ color: #716269;
1277
+ }
1278
+ .yith-plugin-ui .ui-widget-header .ui-icon,
1279
+ .yith-plugin-ui .ui-widget-header .ui-state-hover,
1280
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
1281
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-next,
1282
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w,
1283
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e,
1284
+ .yith-plugin-fw-panel .ui-widget-header .ui-icon,
1285
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-hover,
1286
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
1287
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
1288
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w,
1289
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e{
1290
+ background: none;
1291
+ content: "";
1292
+ border: 0;
1293
+ text-indent: 0;
1294
+ width:15px;
1295
+ height: 20px;
1296
+ display:block;
1297
+ overflow:hidden;
1298
+ }
1299
+
1300
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w:before,
1301
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w:before {
1302
+ content: "\e901";
1303
+ color: #fff;
1304
+ font-family: 'yith-icon';
1305
+ font-size: 12px;
1306
+ font-weight: normal;
1307
+ width:15px;
1308
+ display:block;
1309
+ }
1310
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e:before,
1311
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e:before {
1312
+ content: "\e902";
1313
+ color: #fff;
1314
+ text-indent: 0;
1315
+ font-family: 'yith-icon';
1316
+ font-size: 12px;
1317
+ font-weight: normal;
1318
+ width:15px;
1319
+ display:block;
1320
+ }
1321
+
1322
+ /* arrow */
1323
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
1324
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-next,
1325
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
1326
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-next-hover,
1327
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
1328
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
1329
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover,
1330
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-next-hover{
1331
+ top: 1px;
1332
+ cursor: pointer;
1333
+ }
1334
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev,
1335
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
1336
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev,
1337
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover{
1338
+ left: 5px;
1339
+ }
1340
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-next,
1341
+ .yith-plugin-ui .ui-datepicker-next.ui-datepicker-next-hover,
1342
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
1343
+ .yith-plugin-fw-panel .ui-datepicker-next.ui-datepicker-next-hover{
1344
+ right: 1px;
1345
+ }
1346
+
1347
+ .yith-plugin-ui .ui-datepicker table,
1348
+ .yith-plugin-fw-panel .ui-datepicker table{
1349
+ font-size: 10px;
1350
+ }
1351
+
1352
+ .yith-plugin-ui .ui-state-default,
1353
+ .yith-plugin-ui .ui-widget-content .ui-state-default,
1354
+ .yith-plugin-ui .ui-widget-header .ui-state-default,
1355
+ .yith-plugin-fw-panel .ui-state-default,
1356
+ .yith-plugin-fw-panel .ui-widget-content .ui-state-default,
1357
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-default{
1358
+ background:#fff;
1359
+ border: 1px solid #d9d9d9;
1360
+
1361
+ }
1362
+ .yith-plugin-ui .ui-state-hover,
1363
+ .yith-plugin-ui .ui-widget-content .ui-state-hover,
1364
+ .yith-plugin-ui a.ui-state-default:focus,
1365
+ .yith-plugin-ui .ui-widget-content .ui-state-focus,
1366
+ .yith-plugin-ui .ui-widget-header .ui-state-focus,
1367
+ .yith-plugin-fw-panel .ui-state-hover,
1368
+ .yith-plugin-fw-panel .ui-widget-content .ui-state-hover,
1369
+ .yith-plugin-fw-panel a.ui-state-default:focus,
1370
+ .yith-plugin-fw-panel .ui-widget-content .ui-state-focus,
1371
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-focus{
1372
+ background:#ebf1f3;
1373
+ border:1px solid #bfd5dd;
1374
+ outline: none;
1375
+ box-shadow: none;
1376
+ }
1377
+ .yith-plugin-ui .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus,
1378
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus {
1379
+ background: none;
1380
+ border: 0;
1381
+ }
1382
+
1383
+ /** colorpicker **/
1384
+ .yith-plugin-ui .yith-plugin-fw-colorpicker-field-wrapper .iris-picker,
1385
+ .yith-plugin-ui .yith-plugin-fw-colorpicker-field-wrapper .wp-picker-holder {
1386
+ display: none !important;
1387
+ }
1388
+ .yith-plugin-ui .yith-plugin-fw-colorpicker-field-wrapper .wp-picker-input-wrap {
1389
+ display: inline !important;
1390
+ }
1391
+ .yith-plugin-ui .yith-plugin-fw-colorpicker-field-wrapper .wp-picker-active .iris-picker,
1392
+ .yith-plugin-ui .yith-plugin-fw-colorpicker-field-wrapper .wp-picker-active .wp-picker-holder {
1393
+ display: block !important;
1394
+ }
1395
+ .woocommerce .yith-plugin-ui .iris-picker{
1396
+ border:0;
1397
+ margin-top: 20px;
1398
+ }
1399
+ .yith-plugin-ui .yith-plugin-fw input[type=text].wp-color-picker {
1400
+ border:0;
1401
+ padding: 2px 5px;
1402
+ height:30px;
1403
+ }
1404
+ .yith-plugin-ui .wp-color-result-text{
1405
+ display: none;
1406
+ }
1407
+
1408
+ .yith-plugin-ui .wp-picker-container .wp-color-result.button{
1409
+ width: 30px;
1410
+ height: 30px;
1411
+ border: 0;
1412
+ box-shadow: none;
1413
+ border: 1px solid #d9d9d9;
1414
+ margin-bottom: 0;
1415
+ display: inline-block;
1416
+ vertical-align: middle;
1417
+ }
1418
+ .yith-plugin-ui .wp-picker-default-custom{
1419
+ cursor: pointer;
1420
+ width: 25px;
1421
+ padding: 0 5px;
1422
+ display: inline-block;
1423
+ vertical-align: middle;
1424
+ position: relative;
1425
+ }
1426
+ .yith-plugin-ui .wp-picker-default-custom input.button {
1427
+ opacity: 0;
1428
+ margin: 0;
1429
+ padding: 0;
1430
+ position: absolute;
1431
+ top: 0;
1432
+ right: 0;
1433
+ left: 0;
1434
+ bottom: 0;
1435
+ z-index: 2;
1436
+ }
1437
+ .yith-plugin-ui .wp-picker-default-custom:before{
1438
+ content: "\e910";
1439
+ text-indent: 0;
1440
+ font-family: 'yith-icon';
1441
+ font-size: 20px;
1442
+ color: #d8d8d8;
1443
+ font-weight: normal;
1444
+ width:15px;
1445
+ display:block;
1446
+ background: none;
1447
+ line-height: 20px;
1448
+ margin-left: 8px;
1449
+ }
1450
+ .yith-plugin-ui .wp-picker-container{
1451
+ width: auto;
1452
+ display: inline-block;
1453
+ border: 1px solid #d9d9d9;
1454
+ border-radius: 8px;
1455
+ padding: 5px;
1456
+ }
1457
+
1458
+ .yith-plugin-ui .iris-picker .iris-square-inner{
1459
+ box-shadow: none;
1460
+ border: 1px solid #d9d9d9;
1461
+ }
1462
+
1463
+ .yith-plugin-ui .yith-single-colorpicker{
1464
+ display: inline-block;
1465
+ width: 220px;
1466
+ }
1467
+
1468
+ .yith-plugin-ui .yith-single-colorpicker > label{
1469
+ display: block;
1470
+ font-size: 11px;
1471
+ font-weight: 600;
1472
+ margin-bottom: 10px;
1473
+ }
1474
+
1475
+ /* RANGE SLIDER */
1476
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle{
1477
+ top: -45px!important;
1478
+ }
1479
+
1480
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle {
1481
+ position: absolute;
1482
+ top: -33px;
1483
+ left: 0;
1484
+ width: auto !important;
1485
+ height: auto !important;
1486
+ padding: 2px 8px;
1487
+ margin-left: -15px;
1488
+ font-size: 12px;
1489
+ line-height: 20px;
1490
+ color: #4e8ba2;
1491
+ text-align: center;
1492
+ background-color: #fff;
1493
+ border: 1px solid #fff;
1494
+ border-radius: 3px;
1495
+ -webkit-transition: opacity .3s ease-in-out 0s;
1496
+ transition: opacity .3s ease-in-out 0s;
1497
+ box-shadow: 0px 1px 7px 0px rgba(1, 1, 1, 0.13);
1498
+ }
1499
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:before {
1500
+ position: absolute;
1501
+ bottom: -3px;
1502
+ left: 50%;
1503
+ display: inline-block;
1504
+ width: 6px;
1505
+ height: 6px;
1506
+ margin-left: -3px;
1507
+ content: "";
1508
+ background-color: #fff;
1509
+ -webkit-transform: rotate(-45deg);
1510
+ -ms-transform: rotate(-45deg);
1511
+ transform: rotate(-45deg);
1512
+ }
1513
+ .yith-plugin-ui .ui-slider.ui-widget-content .ui-widget-header{
1514
+ background: #4e8ba2 ;
1515
+ }
1516
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:after{
1517
+ content: '';
1518
+ width: 17px;
1519
+ height: 17px;
1520
+ display: block;
1521
+ position: absolute;
1522
+ background: #fff;
1523
+ top: 37px;
1524
+ border-radius: 50%;
1525
+ box-shadow: 0px 1px 6px 0px rgba(1, 1, 1, 0.25);
1526
+ }
1527
+ .yith-plugin-ui .ui-slider.ui-widget-content{
1528
+ height: 5px !important;
1529
+ }
1530
+
1531
+ .yith-plugin-ui .ui-slider .minCaption,
1532
+ .yith-plugin-ui .ui-slider .maxCaption {
1533
+ font-weight: 700;
1534
+ font-size: 12px;
1535
+ }
1536
+
1537
+
1538
+ /* ADD_BOX AND TOGGLE */
1539
+ .yith-plugin-ui .yith-add-box,
1540
+ .yith-plugin-ui .yith-toggle-row{
1541
+ width:70%;
1542
+ border: 1px solid #d9d9d9;
1543
+ box-shadow:none;
1544
+ border-radius: 4px;
1545
+ margin: 20px 0;
1546
+ padding: 10px;
1547
+ box-sizing: border-box;
1548
+ background: white;
1549
+ }
1550
+ .yith-plugin-ui .yith-add-box{
1551
+ padding: 30px 25px;
1552
+ display: none;
1553
+ }
1554
+ .yith-plugin-ui .yith-toggle-title{
1555
+ position: relative;
1556
+ }
1557
+ .yith-plugin-ui #plugin-fw-wc .yith-toggle-title h3,
1558
+ .yith-plugin-ui .yith-toggle-title h3{
1559
+ padding: 0px 20px 0px 25px;
1560
+ margin: 0;
1561
+ display: inline-block;
1562
+ position: relative;
1563
+ min-width: 173px;
1564
+ box-sizing: border-box;
1565
+ font-weight: 600;
1566
+ font-size: 15px;
1567
+ }
1568
+
1569
+ .yith-plugin-ui .yith-toggle-title .subtitle{
1570
+ padding-left: 0;
1571
+ padding-top:8px;
1572
+ font-size: 12px;
1573
+ }
1574
+
1575
+ .yith-plugin-ui .yith-toggle{
1576
+ position: absolute;
1577
+ width: 30px;
1578
+ height: 30px;
1579
+ display: block;
1580
+ cursor: pointer;
1581
+ left: 0px;
1582
+ top: 0;
1583
+ bottom: 0;
1584
+ }
1585
+ .yith-plugin-ui .yith-toggle > span:before{
1586
+ color: #405e69;
1587
+ }
1588
+
1589
+ .yith-plugin-ui .yith-toggle > span{
1590
+ position: absolute;
1591
+ right: 50%;
1592
+ transition: transform .3s;
1593
+ line-height: 1;
1594
+ }
1595
+
1596
+
1597
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle span{
1598
+ transform: rotateZ(90deg);
1599
+ }
1600
+
1601
+ .yith-plugin-ui .yith-toggle-content{
1602
+ display: none;
1603
+ position: relative;
1604
+ padding: 30px 25px;
1605
+ }
1606
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content{
1607
+ /* display: block;*/
1608
+ }
1609
+ .yith-plugin-ui .yith-add-box-row,
1610
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row{
1611
+ display: table;
1612
+ margin-bottom: 20px;
1613
+ }
1614
+ .yith-plugin-ui .yith-add-box-row label,
1615
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row label{
1616
+ display: table-cell;
1617
+ width: 250px;
1618
+ padding-right:40px;
1619
+ color: #33373b;
1620
+ font-size: 13px;
1621
+ vertical-align: top;
1622
+ font-weight: 600;
1623
+ }
1624
+
1625
+ .yith-plugin-ui .yith-add-box-row .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper),
1626
+ .yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
1627
+ /* display: table-cell;*/
1628
+ width: auto;
1629
+ float: none;
1630
+ vertical-align: middle;
1631
+ position: relative;
1632
+ }
1633
+ .yith-plugin-ui .yith-add-box-row span.yith-icon,
1634
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row span.yith-icon{
1635
+ position: absolute;
1636
+ right: 15px;
1637
+ top: 0;
1638
+ bottom: 0;
1639
+ }
1640
+ .yith-plugin-ui .yith-add-box-buttons,
1641
+ .yith-plugin-ui .yith-toggle-content-buttons{
1642
+ text-align: right;
1643
+ }
1644
+ .yith-plugin-ui .yith-toggle-onoff {
1645
+ position: absolute;
1646
+ cursor: pointer;
1647
+ right: 0;
1648
+ }
1649
+ .yith-plugin-ui .ui-sortable .yith-toggle-onoff{
1650
+ right: 30px;
1651
+ }
1652
+ .yith-plugin-ui .yith-toggle-row .icon-drag{
1653
+ position: absolute;
1654
+ right: 0;
1655
+ top: 25%;
1656
+ bottom: 0;
1657
+ line-height: 1;
1658
+ }
1659
+ .yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle{
1660
+ top: auto;
1661
+ }
1662
+ .yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle-onoff{
1663
+ top: 25%;
1664
+ }
1665
+
1666
+ /** SPINNER **/
1667
+ .yith-plugin-ui .spinner{
1668
+ vertical-align: -5px;
1669
+ float: none;
1670
+ }
1671
+
1672
+ .yith-plugin-ui .spinner.show{
1673
+ visibility: visible;
1674
+ }
1675
+
1676
+ /* LIST TABLE */
1677
+ .yith-plugin-ui .form-table .list-table td{
1678
+ padding: 15px 0px;
1679
+ }
1680
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table .bulkactions select{
1681
+ border: 1px solid #d8d8d8;
1682
+ max-width: 200px;
1683
+ max-height: 30px;
1684
+ padding: 0 10px;
1685
+ }
1686
+ .yith-plugin-ui .form-table .list-table th{
1687
+ width: initial;
1688
+ }
1689
+
1690
+ .yith-plugin-ui #plugin-fw-wc table.form-table th.check-column{
1691
+ padding-left: 3px;
1692
+ }
1693
+ .yith-plugin-ui #plugin-fw-wc table.wp-list-table tbody td{
1694
+ padding-left: 20px;
1695
+ }
1696
+ .yith-plugin-ui .yith-plugin-fw-list-table h2{
1697
+ border: 0;
1698
+ padding: 35px 0 15px;
1699
+ display: inline-block;
1700
+ margin-right: 10px;
1701
+ }
1702
+ .yith-plugin-ui .form-table .yith-plugin-fw-list-table table th{
1703
+ vertical-align: middle;
1704
+ }
1705
+ .yith-plugin-ui .yith-plugin-fw-list-table-container{
1706
+ padding: 0 20px;
1707
+ }
1708
+ .yith-plugin-ui #doaction, .yith-plugin-ui #doaction2, .yith-plugin-ui #post-query-submit{
1709
+ margin-left: 10px;
1710
+ height: 33px;
1711
+ }
1712
+ .yith-plugin-ui .bulkactions{
1713
+ margin: 10px 0;
1714
+ }
1715
+ .yith-plugin-ui .form-table td p.yith-section-description{
1716
+ color:#716269;
1717
+ margin-bottom: 20px;
1718
+ }
1719
+
1720
+ /** Time picker width*/
1721
+ .yith-plugin-ui input.ui-timepicker-input {
1722
+ width: 100px!important;
1723
+ }
1724
+ /** date format **/
1725
+ .yith-plugin-ui .yith-plugin-fw-date-format code {
1726
+ margin-left: 30px;
1727
+ }
1728
+
1729
+ .yith-plugin-ui .yith-plugin-fw-date-format input[type=text].small-text {
1730
+ margin-left: 45px;
1731
+ }
1732
+
1733
+ /** checkbox columns **/
1734
+ .yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
1735
+ width: calc(50% - 20px);
1736
+ padding-right: 20px;
1737
+ float: left;
1738
+ }
1739
+
1740
+ .yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
1741
+ width: calc(33% - 0px);
1742
+ padding-right: 0px;
1743
+ float: left;
1744
+ }
1745
+
1746
+
1747
+ .yith-plugin-fw-checkbox-field-wrapper {
1748
+ display: inline-block !important;
1749
+ width: 19px !important;
1750
+ margin-right: 10px;
1751
+ }
1752
+ .yith-plugin-fw-checkbox-field-wrapper + span.description {
1753
+ display: inline-block;
1754
+ vertical-align: middle;
1755
+ margin: 0;
1756
+ }
1757
+ .yith-plugin-ui span.description {
1758
+ margin-top: 10px;
1759
+ }
1760
+ .yith-plugin-fw-option-with-description {
1761
+ display: table-cell;
1762
+ width: auto;
1763
+ vertical-align: top;
1764
+ }
1765
+ /** YITH PANEL **/
1766
+ .yith-plugin-ui #yith-plugin-fw-panel{
1767
+ margin-top: -10px;
1768
+ }
1769
+ .yith-plugin-ui #plugin-fw-wc, .yith-plugin-ui #yith-plugin-fw-panel{
1770
+ padding-top: 0;
1771
+ }
1772
+ .yith-plugin-ui .plugin-option tr{
1773
+ border: 0;
1774
+ }
1775
+
1776
+ @media screen and (max-width: 1440px){
1777
+ .yith-plugin-ui .yith-add-box,
1778
+ .yith-plugin-ui .yith-toggle-row{
1779
+ width: 80%;
1780
+ }
1781
+ }
1782
+ @media screen and (max-width: 1024px){
1783
+ .yith-plugin-ui .yith-add-box,
1784
+ .yith-plugin-ui .yith-toggle-row{
1785
+ width: 90%;
1786
+ }
1787
+
1788
+ .yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
1789
+ width: 100%;
1790
+ padding-right: 20px;
1791
+ float: left;
1792
+ }
1793
+
1794
+ .yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
1795
+ width: calc(50% - 0px);
1796
+ padding-right: 0px;
1797
+ float: left;
1798
+ }
1799
+ }
1800
+ @media screen and (max-width: 782px){
1801
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free{
1802
+ height: auto;
1803
+ background-color: #a9c7d3;
1804
+ }
1805
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free ul{
1806
+ width: 90%;
1807
+ text-align: center;
1808
+ }
1809
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free li img{
1810
+ width: 90%;
1811
+ margin: 0 auto;
1812
+ }
1813
+ .yith-plugin-fw-banner h1{
1814
+ line-height: 1.2em;
1815
+ }
1816
+
1817
+ .yith-plugin-ui .yith-add-box,
1818
+ .yith-plugin-ui .yith-toggle-row{
1819
+ width: 100%;
1820
+ }
1821
+
1822
+ .yith-plugin-ui td.forminp-checkbox.two-cols fieldset,
1823
+ .yith-plugin-ui td.forminp-checkbox.three-cols fieldset{
1824
+ width: 100%;
1825
+ }
1826
+
1827
  }
plugin-fw/assets/fonts/yith-icon.eot ADDED
Binary file
plugin-fw/assets/fonts/yith-icon.svg ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="yith-icon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe900;" glyph-name="arrow_down" d="M85.333 618.667l426.684-426.65 426.65 426.65-85.35 85.316-341.299-341.299-341.367 341.299z" />
11
+ <glyph unicode="&#xe901;" glyph-name="arrow_left" d="M767.966 106.684l-341.316 341.367 341.316 341.265-85.35 85.35-426.581-426.615 426.581-426.718z" />
12
+ <glyph unicode="&#xe902;" glyph-name="arrow_right" d="M341.385 21.333l426.581 426.718-426.581 426.615-85.35-85.35 341.316-341.265-341.316-341.367z" />
13
+ <glyph unicode="&#xe903;" glyph-name="arrow_up" d="M938.667 277.333l-426.684 426.65-426.65-426.65 85.316-85.316 341.333 341.299 341.333-341.299z" />
14
+ <glyph unicode="&#xe904;" glyph-name="calendar" d="M263.1 341.385h71.083v-71.083h-71.083v71.083zM369.766 341.385h71.083v-71.083h-71.083v71.083zM476.416 341.385h71.083v-71.083h-71.083v71.083zM583.083 341.385h71.083v-71.083h-71.083v71.083zM369.766 448.034h71.083v-71.083h-71.083v71.083zM476.416 448.034h71.083v-71.083h-71.083v71.083zM583.083 448.034h71.083v-71.083h-71.083v71.083zM263.1 234.718h71.083v-71.083h-71.083v71.083zM369.766 234.718h71.083v-71.083h-71.083v71.083zM476.416 234.718h71.083v-71.083h-71.083v71.083zM583.083 234.718h71.083v-71.083h-71.083v71.083zM689.818 341.385h71.083v-71.083h-71.083v71.083zM689.818 448.034h71.083v-71.083h-71.083v71.083zM903.134 803.584h-142.234v71.083h-71.083v-71.083h-355.55v71.083h-71.083v-71.083h-142.319v-782.251h782.251v782.251zM263.1 732.501v-71.083h71.083v71.083h355.55v-71.083h71.083v71.083h71.083v-142.234h-640.017v142.234h71.219zM191.949 92.484v426.701h640.017v-426.701h-640.017z" />
15
+ <glyph unicode="&#xe905;" glyph-name="check" d="M938.667 734.191l-56.371 56.371-566.391-566.391-168.875 207.258-61.696-50.295 224.58-275.695z" />
16
+ <glyph unicode="&#xe906;" glyph-name="close" d="M158.857 21.333l353.143 353.143 353.143-353.143 73.523 73.523-353.143 353.143 353.143 353.143-73.523 73.523-353.143-353.143-353.143 353.143-73.523-73.523 353.143-353.143-353.143-353.143z" />
17
+ <glyph unicode="&#xe907;" glyph-name="edit" d="M868.847 357.239l-517.427 517.427-193.178-193.178 517.427-517.427h193.178v193.178zM705.178 235.435l92.297 92.297v-92.297h-92.297zM654.729 285.884l-306.398 306.398 92.297 92.297 306.398-306.398-92.297-92.297zM351.42 773.786l38.775-38.775-92.297-92.297-38.775 38.775 92.297 92.297zM155.153 92.706h713.677v-71.373h-713.677v71.373z" />
18
+ <glyph unicode="&#xe908;" glyph-name="magnifier" d="M694.528 570.095c0 167.953-136.619 304.572-304.572 304.572s-304.589-136.619-304.589-304.572 136.619-304.572 304.572-304.572c70.229 0 134.895 24.115 186.419 64.239l26.18-26.18-38.076-38.076 244.19-244.173 129.963 129.963-244.173 244.19-38.076-38.076-26.18 26.18c40.124 51.695 64.341 116.258 64.341 186.505zM830.976 151.296l-22.323-22.323-136.533 136.533 22.323 22.323 136.533-136.533zM389.956 341.658c-125.952 0-228.437 102.485-228.437 228.437s102.485 228.42 228.437 228.42 228.437-102.485 228.437-228.437c-0.017-125.935-102.502-228.42-228.437-228.42z" />
19
+ <glyph unicode="&#xe909;" glyph-name="pencil" d="M669.542 874.701l-584.209-584.192 2.628-266.581 266.496-2.628 584.209 584.192-269.124 269.21zM831.010 605.577l-25.515-25.515-161.485 161.553 25.532 25.532 161.468-161.57zM323.277 97.758l-159.915 1.553-1.553 160 428.39 428.476 53.828-53.914-412.894-412.791 53.828-53.828 412.877 412.809 53.828-53.828-428.39-428.476z" />
20
+ <glyph unicode="&#xe90a;" glyph-name="plus" d="M475.409 21.333h78.029v385.229h385.229v78.029h-385.229v390.076h-78.029v-390.076h-390.076v-78.029h390.076z" />
21
+ <glyph unicode="&#xe90b;" glyph-name="update" d="M188.075 400.162c23.313-158.703 159.932-281.139 325.035-281.139 118.903 0 228.949 64.495 287.13 168.38l-63.761 35.703c-45.295-80.828-130.884-131.055-223.369-131.055-120.798 0-222.14 84.275-248.73 197.018l40.209-40.124 51.695 51.695-135.475 135.475-135.475-135.458 51.695-51.695 51.046 51.2zM513.109 703.863c121.941 0 224.017-85.828 249.549-200.141l-43.247 43.247-51.695-51.695 135.475-135.475 135.475 135.475-51.695 51.695-49.152-49.152c-24.132 157.713-160.341 279.159-324.71 279.159-117.009 0-226.236-62.942-284.911-164.369l63.266-36.591c45.705 78.78 130.56 127.846 221.645 127.846z" />
22
+ <glyph unicode="&#xe90c;" glyph-name="upload" d="M937.728 139.315v619.247c0 64-52.105 116.105-116.105 116.105h-619.247c-64 0-116.105-52.105-116.105-116.105v-619.247c0-64 52.105-116.105 116.105-116.105h190.276v77.38h-190.276c-21.333 0-38.724 17.306-38.724 38.724v619.247c0 21.333 17.306 38.724 38.724 38.724h619.247c21.333 0 38.724-17.306 38.724-38.724v-619.247c0-21.333-17.391-38.724-38.724-38.724h-193.485v-77.38h193.485c64 0.017 116.105 52.105 116.105 116.105zM550.69 21.333v412.553l88.61-89.515 54.972 54.391-180.429 182.323-183.876-181.982 54.409-55.057 88.934 87.945v-410.658z" />
23
+ <glyph unicode="&#xe90d;" glyph-name="trash" d="M734.591 132.655c0-20.48-16.696-37.101-37.101-37.101h-371.014c-20.406 0-37.101 16.621-37.101 37.101v519.42h-74.203v-519.42c0-61.403 50.087-111.304 111.304-111.304h371.014c61.217 0 111.304 49.901 111.304 111.304v519.42h-74.203v-519.42zM400.679 800.48h222.608v-37.101h-222.608v37.101zM697.49 800.48c0 40.923-33.391 74.203-74.203 74.203h-222.608c-40.812 0-74.203-33.28-74.203-74.203v-37.101h-185.507v-74.203h742.028v74.203h-185.507v37.101zM474.882 614.973h74.203v-445.217h-74.203v445.217zM363.577 614.973h74.203v-445.217h-74.203v445.217zM586.186 614.973h74.203v-445.217h-74.203v445.217z" />
24
+ <glyph unicode="&#xe90e;" glyph-name="info" d="M511.957 92.471c-196.017 0-355.555 159.466-355.555 355.555 0 196.053 159.538 355.555 355.555 355.555 196.053 0 355.555-159.502 355.555-355.555 0-196.089-159.502-355.555-355.555-355.555zM511.957 874.692c-235.271 0-426.666-191.431-426.666-426.666 0-235.271 191.395-426.666 426.666-426.666 235.306 0 426.666 191.395 426.666 426.666 0 235.235-191.36 426.666-426.666 426.666zM476.402 270.248v177.777h35.555v-177.777h-35.555zM583.068 448.026v71.111h-213.333v-71.111h35.555v-248.888h213.333v71.111h-35.555v177.777zM494.179 661.359c9.813 0 17.778-8 17.778-17.778 0-9.813-7.964-17.778-17.778-17.778-9.778 0-17.778 7.964-17.778 17.778 0 9.778 8 17.778 17.778 17.778zM494.179 554.692c49.031 0 88.889 39.858 88.889 88.889 0 48.995-39.858 88.889-88.889 88.889-48.995 0-88.889-39.893-88.889-88.889 0-49.031 39.893-88.889 88.889-88.889z" />
25
+ <glyph unicode="&#xe90f;" glyph-name="drag" d="M241.835 409.259h232.277v-232.277h-116.053l156.501-154.795 156.501 154.795h-119.467v232.277h233.813v-116.224l154.965 156.672-154.965 156.501v-119.467h-233.813v232.277h119.467l-156.501 154.795-156.501-154.795h116.053v-232.277h-232.277v119.467l-154.795-156.501 154.795-156.672z" />
26
+ <glyph unicode="&#xe910;" glyph-name="reset" d="M188.928 400.384c23.211-158.379 159.573-280.405 324.267-280.405 118.613 0 228.352 64.341 286.379 167.936l-63.488 35.499c-45.227-80.555-130.56-130.731-222.891-130.731-120.491 0-221.525 84.139-248.149 196.608l40.107-40.107 51.541 51.541-135.168 135.168-135.168-135.168 51.541-51.541 51.029 51.2zM513.195 703.317c121.685 0 223.573-85.675 249.003-199.68l-43.179 43.179-51.541-51.541 135.168-135.168 135.168 135.168-51.541 51.541-48.981-48.981c-24.064 157.355-159.915 278.528-323.925 278.528-116.736 0-225.621-62.805-284.16-164.011l63.147-36.523c45.227 78.507 129.877 127.488 220.843 127.488z" />
27
+ </font></defs></svg>
plugin-fw/assets/fonts/yith-icon.ttf ADDED
Binary file
plugin-fw/assets/fonts/yith-icon.woff ADDED
Binary file
plugin-fw/assets/images/arrow_down.svg ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 600 600" style="enable-background:new 0 0 600 600;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#d9d9d9;}
7
+ </style>
8
+ <polygon class="st0" points="50,200 300.01,449.99 550,200 499.99,150.01 300.01,349.99 99.99,150.01 "/>
9
+ </svg>
plugin-fw/assets/images/banner-free.png ADDED
Binary file
plugin-fw/assets/images/banner-premium.png ADDED
Binary file
plugin-fw/assets/images/rate_banner.png ADDED
Binary file
plugin-fw/assets/images/upgrade_banner.png ADDED
Binary file
plugin-fw/assets/js/yith-fields.js CHANGED
@@ -1,364 +1,649 @@
1
- jQuery( function ( $ ) {
2
-
3
- var $datepicker = $( '.yith-plugin-fw-datepicker' ),
4
- $colorpicker = $( '.yith-plugin-fw-colorpicker' ),
5
- $upload = {
6
- imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
7
- uploadButtonHandler: '.yith-plugin-fw-upload-button',
8
- imgUrlHandler : '.yith-plugin-fw-upload-img-url',
9
- resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
10
- imgUrl : $( '.yith-plugin-fw-upload-img-url' )
11
- },
12
- $wpAddMedia = $( '.add_media' ),
13
- $imageGallery = {
14
- sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
15
- buttonHandler: '.yith-plugin-fw .image-gallery-button'
16
- },
17
- $onoff = $( '.yith-plugin-fw-onoff-container span' ),
18
- $sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
19
- $slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
20
- $codemirror = $( '.codemirror' ),
21
- $icons = $( '.yit-icons-manager-wrapper' );
22
-
23
- /* Datepicker */
24
- $datepicker.each( function () {
25
- var args = $( this ).data();
26
- $( this ).datepicker( args );
27
- } );
28
-
29
- /* Colorpicker */
30
- $colorpicker.wpColorPicker( {
31
- clear: function () {
32
- var input = $( this );
33
- input.val( input.data( 'default-color' ) );
34
- input.change();
35
- }
36
- } );
37
- $colorpicker.each( function () {
38
- var select_label = $( this ).data( 'variations-label' );
39
- $( this ).parent().parent().find( 'a.wp-color-result' ).attr( 'title', select_label );
40
- } );
41
-
42
- /* Upload */
43
- if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
44
- var _custom_media = true;
45
- // preview
46
- $upload.imgUrl.change( function () {
47
- var url = $( this ).val(),
48
- re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)" ),
49
- preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
50
-
51
- if ( preview.length < 1 )
52
- preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
53
-
54
- if ( re.test( url ) ) {
55
- preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
56
- } else {
57
- preview.html( '' );
58
  }
59
- } ).trigger( 'change' );
60
 
61
- $( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
62
- e.preventDefault();
63
 
64
- var t = $( this ),
65
- custom_uploader,
66
- id = t.attr( 'id' ).replace( /-button$/, '' );
 
67
 
68
- //If the uploader object has already been created, reopen the dialog
69
- if ( custom_uploader ) {
70
- custom_uploader.open();
71
- return;
 
 
 
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- var custom_uploader_states = [
75
- // Main states.
76
- new wp.media.controller.Library( {
77
- library : wp.media.query(),
78
- multiple : false,
79
- title : 'Choose Image',
80
- priority : 20,
81
- filterable: 'uploaded'
82
- } )
83
- ];
84
-
85
- // Create the media frame.
86
- custom_uploader = wp.media.frames.downloadable_file = wp.media( {
87
- // Set the title of the modal.
88
- title : 'Choose Image',
89
- library : {
90
- type: ''
91
- },
92
- button : {
93
- text: 'Choose Image'
94
- },
95
- multiple: false,
96
- states : custom_uploader_states
97
- } );
98
-
99
- //When a file is selected, grab the URL and set it as the text field's value
100
- custom_uploader.on( 'select', function () {
101
- var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
102
-
103
- $( "#" + id ).val( attachment.url );
104
- // Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
105
- if ( $( "#" + id + "-yith-attachment-id" ) ) {
106
- $( "#" + id + "-yith-attachment-id" ).val( attachment.id );
107
  }
108
- $upload.imgUrl.trigger( 'change' );
109
- } );
110
-
111
- //Open the uploader dialog
112
- custom_uploader.open();
113
- } );
114
-
115
- $( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
116
- var t = $( this ),
117
- id = t.attr( 'id' ),
118
- input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
119
- default_value = $( '#' + id ).data( 'default' );
120
-
121
- $( "#" + input_id ).val( default_value );
122
- $upload.imgUrl.trigger( 'change' );
123
- } );
124
- }
125
-
126
- $wpAddMedia.on( 'click', function () {
127
- _custom_media = false;
128
- } );
129
-
130
- /* Image Gallery */
131
- if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
132
- $( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
133
- var $t = $( this ),
134
- $container = $t.closest( '.image-gallery' ),
135
- $image_gallery_ids = $container.find( '.image_gallery_ids' ),
136
- attachment_ids = $image_gallery_ids.val(),
137
- $gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
138
-
139
- // Create the media frame.
140
- var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
141
- // Set the title of the modal.
142
- title : $t.data( 'choose' ),
143
- button: {
144
- text: $t.data( 'update' )
145
- },
146
- states: [
147
- new wp.media.controller.Library( {
148
- title : $t.data( 'choose' ),
149
- filterable: 'all',
150
- multiple : true
151
- } )
152
- ]
153
- } );
154
-
155
- // When an image is selected, run a callback.
156
- image_gallery_frame.on( 'select', function () {
157
- var selection = image_gallery_frame.state().get( 'selection' );
158
- selection.map( function ( attachment ) {
159
- attachment = attachment.toJSON();
160
-
161
- if ( attachment.id ) {
162
- attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
163
- $gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
164
  }
165
- } );
166
-
167
- $image_gallery_ids.val( attachment_ids );
168
- } );
169
-
170
- image_gallery_frame.open();
171
-
172
- } );
173
-
174
- // Image ordering
175
- $imageGallery.sliderWrapper.each( function () {
176
- var $t = $( this );
177
- $t.sortable( {
178
- items : 'li.image',
179
- cursor : 'move',
180
- scrollSensitivity : 40,
181
- forcePlaceholderSize: true,
182
- forceHelperSize : false,
183
- helper : 'clone',
184
- opacity : 0.65,
185
- start : function ( event, ui ) {
186
- ui.item.css( 'background-color', '#f6f6f6' );
187
- },
188
- stop : function ( event, ui ) {
189
- ui.item.removeAttr( 'style' );
190
- },
191
- update : function ( event, ui ) {
192
- var attachment_ids = '';
193
-
194
- $t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
195
- var attachment_id = $( this ).attr( 'data-attachment_id' );
196
- attachment_ids = attachment_ids + attachment_id + ',';
197
- } );
198
-
199
- $t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
200
- }
201
- } );
202
- } );
203
-
204
- // Remove images
205
- $imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
206
- var $wrapper = $( this ).closest( '.image-gallery' ),
207
- $gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
208
- $image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
209
- attachment_ids = '';
210
-
211
- $( this ).closest( 'li.image' ).remove();
212
-
213
- $gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
214
- var attachment_id = $( this ).attr( 'data-attachment_id' );
215
- attachment_ids = attachment_ids + attachment_id + ',';
216
- } );
217
-
218
- $image_gallery_ids.val( attachment_ids );
219
- } );
220
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
 
222
  /* on-off */
223
- $onoff.on( 'click', function () {
224
- var input = $( this ).prev( 'input' ),
225
- checked = input.prop( 'checked' );
226
 
227
- if ( checked ) {
228
- input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
229
  } else {
230
- input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
231
  }
232
 
233
  input.change();
234
- } );
235
-
236
- /* Sidebars */
237
- $sidebars.each( function () {
238
- var $images = $( this ).find( 'img' );
239
- $images.on( 'click', function () {
240
- var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
241
- $left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
242
- $right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
243
- type = $( this ).data( 'type' );
244
-
245
- $( this ).parent().children( ':radio' ).attr( 'checked', false );
246
- $( this ).prev( ':radio' ).attr( 'checked', true );
247
-
248
- if ( typeof type != 'undefined' ) {
249
- switch ( type ) {
250
- case 'left':
251
- $left.show();
252
- $right.hide();
253
- break;
254
- case 'right':
255
- $right.show();
256
- $left.hide();
257
- break;
258
- case 'double':
259
- $left.show();
260
- $right.show();
261
- break;
262
- default:
263
- $left.hide();
264
- $right.hide();
265
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  }
267
  }
268
- } );
269
- } );
270
-
271
- /* Slider */
272
- $slider.each( function () {
273
- var val = $( this ).data( 'val' ),
274
- minValue = $( this ).data( 'min' ),
275
- maxValue = $( this ).data( 'max' ),
276
- step = $( this ).data( 'step' ),
277
- labels = $( this ).data( 'labels' );
278
-
279
- $( this ).slider( {
280
- value: val,
281
- min : minValue,
282
- max : maxValue,
283
- range: 'min',
284
- step : step,
285
-
286
- create: function () {
287
- $( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
288
- },
289
-
290
-
291
- slide: function ( event, ui ) {
292
- $( this ).find( 'input' ).val( ui.value );
293
- $( this ).find( '.ui-slider-handle' ).text( ui.value );
294
- $( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
295
- }
296
- } );
297
- } );
298
-
299
- /* codemirror */
300
- $codemirror.each( function ( i, v ) {
301
- var editor = CodeMirror.fromTextArea( v, {
302
- lineNumbers : 1,
303
- mode : 'javascript',
304
- showCursorWhenSelecting: true
305
- } );
306
-
307
- $( v ).data( 'codemirrorInstance', editor );
308
- } );
309
-
310
- /* Select All - Deselect All */
311
- $( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
312
- var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
313
- $targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
314
- } );
315
-
316
- $( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
317
- var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
318
- $targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
319
- } );
320
-
321
-
322
- $icons.each( function () {
323
- var $container = $( this ),
324
- $preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
325
- $text = $container.find( '.yit-icons-manager-icon-text' );
326
-
327
- $container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
328
- var $target = $( event.target ).closest( 'li' ),
329
- font = $target.data( 'font' ),
330
- icon = $target.data( 'icon' ),
331
- key = $target.data( 'key' ),
332
- name = $target.data( 'name' );
333
-
334
- $preview.attr( 'data-font', font );
335
- $preview.attr( 'data-icon', icon );
336
- $preview.attr( 'data-key', key );
337
- $preview.attr( 'data-name', name );
338
-
339
- $text.val( font + ':' + name );
340
-
341
- $container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
342
- $target.addClass( 'active' );
343
- } );
344
-
345
- $container.on( 'click', '.yit-icons-manager-action-set-default', function () {
346
- $container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
347
- } );
348
- } );
349
-
350
- /** Select Images */
351
- $( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
352
- var item = $( this ),
353
- key = item.data( 'key' ),
354
- wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
355
- items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
356
- select = wrapper.find( 'select' ).first();
357
-
358
- if ( select.length ) {
359
- select.val( key );
360
- items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
361
- item.addClass( 'yith-plugin-fw-select-images__item--selected' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  }
363
- } );
364
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function ($) {
2
+ /* global yith_framework_fw_fields*/
3
+
4
+ var yith_fields_init = function () {
5
+ var $datepicker = $('.yith-plugin-fw-datepicker'),
6
+ $colorpicker = $('.yith-plugin-fw-colorpicker'),
7
+ $upload = {
8
+ imgPreviewHandler: '.yith-plugin-fw-upload-img-preview',
9
+ uploadButtonHandler: '.yith-plugin-fw-upload-button',
10
+ imgUrlHandler: '.yith-plugin-fw-upload-img-url',
11
+ resetButtonHandler: '.yith-plugin-fw-upload-button-reset',
12
+ imgUrl: $('.yith-plugin-fw-upload-img-url')
13
+ },
14
+ $wpAddMedia = $('.add_media'),
15
+ $imageGallery = {
16
+ sliderWrapper: $('.yith-plugin-fw .image-gallery ul.slides-wrapper'),
17
+ buttonHandler: '.yith-plugin-fw .image-gallery-button'
18
+ },
19
+ $sidebars = $('.yith-plugin-fw-sidebar-layout'),
20
+ $slider = $('.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal'),
21
+ $codemirror = $('.codemirror'),
22
+ $icons = $('.yit-icons-manager-wrapper'),
23
+ $checkgroup = $(".yith-plugin-ui td.forminp-checkbox");
24
+
25
+ /* Datepicker */
26
+ $datepicker.each(function () {
27
+ var args = $(this).data();
28
+ $(this).datepicker(args);
29
+ });
30
+
31
+ /* Colorpicker */
32
+ $colorpicker.wpColorPicker({
33
+ palettes: false,
34
+ width: 200,
35
+ mode: 'hsl',
36
+ clear: function () {
37
+ var input = $(this);
38
+ input.val(input.data('default-color'));
39
+ input.change();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
+ });
42
 
 
 
43
 
44
+ $colorpicker.each(function () {
45
+ var select_label = $(this).data('variations-label'),
46
+ wrap_main = $(this).closest( '.yith-plugin-fw-field-wrapper' ),
47
+ wrap = wrap_main.find('.wp-picker-input-wrap');
48
 
49
+ wrap_main.find('a.wp-color-result').attr('title', select_label);
50
+
51
+ if( ! wrap.find( '.wp-picker-clear-custom' ).length ) {
52
+ var button = $('<span/>').attr({
53
+ class :"wp-picker-default-custom"
54
+ });
55
+ wrap.find( '.wp-picker-default' ).wrap( button );
56
  }
57
+ });
58
+
59
+
60
+
61
+ /* Upload */
62
+ if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
63
+ var _custom_media = true;
64
+ // preview
65
+ $upload.imgUrl.change(function () {
66
+ var url = $(this).val(),
67
+ re = new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),
68
+ preview = $(this).parent().find($upload.imgPreviewHandler).first();
69
+
70
+ if (preview.length < 1)
71
+ preview = $(this).parent().parent().find($upload.imgPreviewHandler).first();
72
 
73
+ if (re.test(url)) {
74
+ preview.html('<img src="' + url + '" style="max-width:100px; max-height:100px;" />');
75
+ } else {
76
+ preview.html('');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
+ }).trigger('change');
79
+
80
+ $(document).on('click', $upload.uploadButtonHandler, function (e) {
81
+ e.preventDefault();
82
+
83
+ var t = $(this),
84
+ custom_uploader,
85
+ id = t.attr('id').replace(/-button$/, '');
86
+
87
+ //If the uploader object has already been created, reopen the dialog
88
+ if (custom_uploader) {
89
+ custom_uploader.open();
90
+ return;
91
+ }
92
+
93
+ var custom_uploader_states = [
94
+ // Main states.
95
+ new wp.media.controller.Library({
96
+ library: wp.media.query(),
97
+ multiple: false,
98
+ title: 'Choose Image',
99
+ priority: 20,
100
+ filterable: 'uploaded'
101
+ })
102
+ ];
103
+
104
+ // Create the media frame.
105
+ custom_uploader = wp.media.frames.downloadable_file = wp.media({
106
+ // Set the title of the modal.
107
+ title: 'Choose Image',
108
+ library: {
109
+ type: ''
110
+ },
111
+ button: {
112
+ text: 'Choose Image'
113
+ },
114
+ multiple: false,
115
+ states: custom_uploader_states
116
+ });
117
+
118
+ //When a file is selected, grab the URL and set it as the text field's value
119
+ custom_uploader.on('select', function () {
120
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
121
+
122
+ $("#" + id).val(attachment.url);
123
+ // Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
124
+ if ($("#" + id + "-yith-attachment-id")) {
125
+ $("#" + id + "-yith-attachment-id").val(attachment.id);
 
 
 
 
 
 
 
 
126
  }
127
+ $upload.imgUrl.trigger('change');
128
+ });
129
+
130
+ //Open the uploader dialog
131
+ custom_uploader.open();
132
+ });
133
+
134
+ $(document).on('click', $upload.resetButtonHandler, function (e) {
135
+ var t = $(this),
136
+ id = t.attr('id'),
137
+ input_id = t.attr('id').replace(/-button-reset$/, ''),
138
+ default_value = $('#' + id).data('default');
139
+
140
+ $("#" + input_id).val(default_value);
141
+ $upload.imgUrl.trigger('change');
142
+ });
143
+ }
144
+
145
+ $wpAddMedia.on('click', function () {
146
+ _custom_media = false;
147
+ });
148
+
149
+ /* Image Gallery */
150
+ if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
151
+ $(document).on('click', $imageGallery.buttonHandler, function (e) {
152
+ var $t = $(this),
153
+ $container = $t.closest('.image-gallery'),
154
+ $image_gallery_ids = $container.find('.image_gallery_ids'),
155
+ attachment_ids = $image_gallery_ids.val(),
156
+ $gallery_images_wrapper = $container.find('ul.slides-wrapper');
157
+
158
+ // Create the media frame.
159
+ var image_gallery_frame = wp.media.frames.image_gallery = wp.media({
160
+ // Set the title of the modal.
161
+ title: $t.data('choose'),
162
+ button: {
163
+ text: $t.data('update')
164
+ },
165
+ states: [
166
+ new wp.media.controller.Library({
167
+ title: $t.data('choose'),
168
+ filterable: 'all',
169
+ multiple: true
170
+ })
171
+ ]
172
+ });
173
+
174
+ // When an image is selected, run a callback.
175
+ image_gallery_frame.on('select', function () {
176
+ var selection = image_gallery_frame.state().get('selection');
177
+ selection.map(function (attachment) {
178
+ attachment = attachment.toJSON();
179
+
180
+ if (attachment.id) {
181
+ attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
182
+ $gallery_images_wrapper.append('<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data('delete') + '">x</a></li></ul></li>');
183
+ }
184
+ });
185
+
186
+ $image_gallery_ids.val(attachment_ids);
187
+ });
188
+
189
+ image_gallery_frame.open();
190
+
191
+ });
192
+
193
+ // Image ordering
194
+ $imageGallery.sliderWrapper.each(function () {
195
+ var $t = $(this);
196
+ $t.sortable({
197
+ items: 'li.image',
198
+ cursor: 'move',
199
+ scrollSensitivity: 40,
200
+ forcePlaceholderSize: true,
201
+ forceHelperSize: false,
202
+ helper: 'clone',
203
+ opacity: 0.65,
204
+ start: function (event, ui) {
205
+ ui.item.css('background-color', '#f6f6f6');
206
+ },
207
+ stop: function (event, ui) {
208
+ ui.item.removeAttr('style');
209
+ },
210
+ update: function (event, ui) {
211
+ var attachment_ids = '';
212
+
213
+ $t.find('li.image').css('cursor', 'default').each(function () {
214
+ var attachment_id = $(this).attr('data-attachment_id');
215
+ attachment_ids = attachment_ids + attachment_id + ',';
216
+ });
217
+
218
+ $t.closest('.image-gallery').find('.image_gallery_ids').val(attachment_ids);
219
+ }
220
+ });
221
+ });
222
+
223
+ // Remove images
224
+ $imageGallery.sliderWrapper.on('click', 'a.delete', function () {
225
+ var $wrapper = $(this).closest('.image-gallery'),
226
+ $gallery = $(this).closest('.image-gallery ul.slides-wrapper'),
227
+ $image_gallery_ids = $wrapper.find('.image_gallery_ids'),
228
+ attachment_ids = '';
229
+
230
+ $(this).closest('li.image').remove();
231
+
232
+ $gallery.find('li.image').css('cursor', 'default').each(function () {
233
+ var attachment_id = $(this).attr('data-attachment_id');
234
+ attachment_ids = attachment_ids + attachment_id + ',';
235
+ });
236
+
237
+ $image_gallery_ids.val(attachment_ids);
238
+ });
239
+ }
240
+
241
+
242
+ /* Sidebars */
243
+ $sidebars.each(function () {
244
+ var $images = $(this).find('img');
245
+ $images.on('click', function () {
246
+ var $container = $(this).closest('.yith-plugin-fw-sidebar-layout'),
247
+ $left = $container.find('.yith-plugin-fw-sidebar-layout-sidebar-left-container'),
248
+ $right = $container.find('.yith-plugin-fw-sidebar-layout-sidebar-right-container'),
249
+ type = $(this).data('type');
250
+
251
+ $(this).parent().children(':radio').attr('checked', false);
252
+ $(this).prev(':radio').attr('checked', true);
253
+
254
+ if (typeof type != 'undefined') {
255
+ switch (type) {
256
+ case 'left':
257
+ $left.show();
258
+ $right.hide();
259
+ break;
260
+ case 'right':
261
+ $right.show();
262
+ $left.hide();
263
+ break;
264
+ case 'double':
265
+ $left.show();
266
+ $right.show();
267
+ break;
268
+ default:
269
+ $left.hide();
270
+ $right.hide();
271
+ break;
272
+ }
273
+ }
274
+ });
275
+ });
276
+
277
+ /* Slider */
278
+ $slider.each(function () {
279
+ var val = $(this).data('val'),
280
+ minValue = $(this).data('min'),
281
+ maxValue = $(this).data('max'),
282
+ step = $(this).data('step'),
283
+ labels = $(this).data('labels');
284
+
285
+ $(this).slider({
286
+ value: val,
287
+ min: minValue,
288
+ max: maxValue,
289
+ range: 'min',
290
+ step: step,
291
+
292
+ create: function () {
293
+ $(this).find('.ui-slider-handle').text($(this).slider("value"));
294
+ },
295
+
296
+
297
+ slide: function (event, ui) {
298
+ $(this).find('input').val(ui.value);
299
+ $(this).find('.ui-slider-handle').text(ui.value);
300
+ $(this).siblings('.feedback').find('strong').text(ui.value + labels);
301
+ }
302
+ });
303
+ });
304
+
305
+ /* codemirror */
306
+ $codemirror.each(function (i, v) {
307
+ var editor = CodeMirror.fromTextArea(v, {
308
+ lineNumbers: 1,
309
+ mode: 'javascript',
310
+ showCursorWhenSelecting: true
311
+ });
312
+
313
+ $(v).data('codemirrorInstance', editor);
314
+ });
315
+
316
+ /* Select All - Deselect All */
317
+ $(document).on('click', '.yith-plugin-fw-select-all', function () {
318
+ var $targetSelect = $('#' + $(this).data('select-id'));
319
+ $targetSelect.find('option').prop('selected', true).trigger('change');
320
+ });
321
+
322
+ $(document).on('click', '.yith-plugin-fw-deselect-all', function () {
323
+ var $targetSelect = $('#' + $(this).data('select-id'));
324
+ $targetSelect.find('option').prop('selected', false).trigger('change');
325
+ });
326
+
327
+
328
+ $icons.each(function () {
329
+ var $container = $(this),
330
+ $preview = $container.find('.yit-icons-manager-icon-preview').first(),
331
+ $text = $container.find('.yit-icons-manager-icon-text');
332
+
333
+ $container.on('click', '.yit-icons-manager-list li', function (event) {
334
+ var $target = $(event.target).closest('li'),
335
+ font = $target.data('font'),
336
+ icon = $target.data('icon'),
337
+ key = $target.data('key'),
338
+ name = $target.data('name');
339
+
340
+ $preview.attr('data-font', font);
341
+ $preview.attr('data-icon', icon);
342
+ $preview.attr('data-key', key);
343
+ $preview.attr('data-name', name);
344
+
345
+ $text.val(font + ':' + name);
346
+
347
+ $container.find('.yit-icons-manager-list li').removeClass('active');
348
+ $target.addClass('active');
349
+ });
350
+
351
+ $container.on('click', '.yit-icons-manager-action-set-default', function () {
352
+ $container.find('.yit-icons-manager-list li.default').trigger('click');
353
+ });
354
+ });
355
+
356
+ /** Select Images */
357
+ $(document).on('click', '.yith-plugin-fw-select-images__item', function () {
358
+ var item = $(this),
359
+ key = item.data('key'),
360
+ wrapper = item.closest('.yith-plugin-fw-select-images__wrapper'),
361
+ items = wrapper.find('.yith-plugin-fw-select-images__item'),
362
+ select = wrapper.find('select').first();
363
+
364
+ if (select.length) {
365
+ select.val(key);
366
+ items.removeClass('yith-plugin-fw-select-images__item--selected');
367
+ item.addClass('yith-plugin-fw-select-images__item--selected');
368
+ }
369
+ });
370
+
371
+ $(document.body).trigger('wc-enhanced-select-init');
372
+
373
+ $(document).find('.ui-sortable .yith-toggle-elements').sortable(
374
+ {
375
+ cursor: 'move',
376
+ axis: 'y',
377
+ scrollSensitivity: 40,
378
+ forcePlaceholderSize: true,
379
+ helper: 'clone',
380
+
381
+ stop: function (event, ui) {
382
+ var keys = jQuery('.ui-sortable-handle'),
383
+ i = 0,
384
+ array_keys = new Array();
385
+ for (i = 0; i < keys.length; i++) {
386
+ array_keys[i] = $(keys[i]).data('item_key');
387
+ }
388
+ if (array_keys.length > 0) {
389
+ var toggle = $(this).closest('.toggle-element');
390
+ toggle.saveToggleElement(null, array_keys);
391
+ }
392
+ }
393
+ }
394
+ );
395
+
396
+ $.each($checkgroup, function () {
397
+ var children = $(this).find('fieldset');
398
+ if (children.length > 3 && children.length < 6) {
399
+ $(this).addClass('two-cols')
400
+ }
401
+ if (children.length > 6) {
402
+ $(this).addClass('three-cols')
403
+ }
404
+ });
405
+
406
+ $(document.body).trigger('yith-framework-enhanced-select-init');
407
+ };
408
+
409
+ yith_fields_init();
410
 
411
  /* on-off */
412
+ $(document).on('click', '.yith-plugin-fw-onoff-container span', function () {
413
+ var input = $(this).prev('input'),
414
+ checked = input.prop('checked');
415
 
416
+ if (checked) {
417
+ input.prop('checked', false).attr('value', 'no').removeClass('onoffchecked');
418
  } else {
419
+ input.prop('checked', true).attr('value', 'yes').addClass('onoffchecked');
420
  }
421
 
422
  input.change();
423
+ });
424
+
425
+
426
+ /** Toggle **/
427
+
428
+
429
+
430
+ //TOGGLE ELEMENT
431
+ $.fn.saveToggleElement = function (spinner, array_keys) {
432
+ var toggle = $(this),
433
+ action = 'yith_plugin_fw_save_toggle_element',
434
+ formdata = toggle.serializeToggleElement(),
435
+ id = toggle.find('.yith-toggle_wrapper').attr('id'),
436
+ current_tab = $.urlParam('tab');
437
+
438
+ if (typeof array_keys != 'undefined' && array_keys.length > 0) {
439
+ formdata.append('yith_toggle_elements_order_keys', array_keys);
440
+ }
441
+
442
+ if (toggle.closest('.metaboxes-tab.yith-plugin-ui').length) {
443
+ action = 'yith_plugin_fw_save_toggle_element_metabox';
444
+ post_id = $(this).closest('form#post').find('#post_ID').val();
445
+ yit_metaboxes_nonce = $(this).closest('form#post').find('#yit_metaboxes_nonce').val();
446
+ url = yith_framework_fw_fields.ajax_url + '?action=' + action + "&post_ID=" + post_id + '&yit_metaboxes_nonce=' + yit_metaboxes_nonce + "&toggle_id=" + id;
447
+ } else {
448
+ url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
449
+ }
450
+
451
+ $.ajax({
452
+ type: "POST",
453
+ url: url,
454
+ data: formdata,
455
+ contentType: false,
456
+ processData: false,
457
+ success: function (result) {
458
+ if (spinner) {
459
+ spinner.removeClass('show');
460
+ }
461
+
462
+ $(document).trigger('yith_save_toggle_element_done', [result, toggle]);
463
+ },
464
+ });
465
+ };
466
+
467
+ $.fn.serializeToggleElement = function () {
468
+ var obj = $(this);
469
+ /* ADD FILE TO PARAM AJAX */
470
+ var formData = new FormData();
471
+ var params = $(obj).find(":input").serializeArray();
472
+
473
+ $.each(params, function (i, val) {
474
+ el_name = val.name;
475
+ formData.append(val.name, val.value);
476
+ });
477
+
478
+ return formData;
479
+ };
480
+
481
+ $.fn.formatToggleTitle = function () {
482
+ var toggle_el = $(this),
483
+ fields = toggle_el.find(':input'),
484
+ title = toggle_el.find('span.title').data('title_format'),
485
+ subtitle = toggle_el.find('.subtitle').data('subtitle_format'),
486
+ regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
487
+
488
+ if (typeof title != 'undefined') {
489
+ var res = title.match( regExp );
490
+ }
491
+
492
+ if (typeof subtitle != 'undefined') {
493
+ var ressub = subtitle.match( regExp );
494
+ }
495
+
496
+ $.each(fields, function (i, field) {
497
+ if (typeof $(field).attr('id') != 'undefined') {
498
+ $field_id = $(field).attr('id');
499
+ $field_array = $field_id.split('_');
500
+ $field_array.pop();
501
+ $field_id = $field_array.join('_');
502
+ $field_val = $(field).val();
503
+
504
+ if (res != null && typeof res != 'undefined' && res.indexOf($field_id) !== -1) {
505
+ title = title.replace('%%' + $field_id + '%%', $field_val);
506
+ }
507
+ if (ressub != null && typeof ressub != 'undefined' && ressub.indexOf($field_id) !== -1) {
508
+ subtitle = subtitle.replace('%%' + $field_id + '%%', $field_val);
509
  }
510
  }
511
+ });
512
+
513
+ if ('' !== title) {
514
+ toggle_el.find('span.title').html(title);
515
+ }
516
+
517
+ if ('' !== subtitle) {
518
+ toggle_el.find('.subtitle').html(subtitle);
519
+ }
520
+
521
+ $(document).trigger('yith-toggle-element-item-title', [toggle_el]);
522
+ };
523
+
524
+ $.urlParam = function (name) {
525
+ var results = new RegExp('[\?&]' + name + '=([^&#]*)')
526
+ .exec(window.location.search);
527
+
528
+ return (results !== null) ? results[1] || 0 : false;
529
+ };
530
+
531
+ $(document).on('click', '.yith-toggle', function (event) {
532
+ var _toggle = $(event.target),
533
+ _section = _toggle.closest('.yith-toggle-row'),
534
+ _content = _section.find('.yith-toggle-content');
535
+
536
+ if (_section.is('.yith-toggle-row-opened')) {
537
+ _content.slideUp(400);
538
+ } else {
539
+ _content.slideDown(400);
540
+ }
541
+ _section.toggleClass('yith-toggle-row-opened');
542
+ });
543
+
544
+ /**Add new box toggle**/
545
+ $(document).on('click', '.yith-add-box-button', function (event) {
546
+ event.preventDefault();
547
+ var target_id = $(this).data('box_id'),
548
+ id = $(this).closest('.yith-toggle_wrapper').attr('id');
549
+ template = wp.template('yith-toggle-element-add-box-content-' + id);
550
+ if ('' !== target_id) {
551
+ $('#' + target_id).html(template({index: 'box_id'})).slideToggle();
552
+ yith_fields_init();
553
+ $(document).trigger('yith-add-box-button-toggle', [$(this)]);
554
+ }
555
+ });
556
+
557
+ $(document).on('click', '.yith-add-box-buttons .yith-save-button', function (event) {
558
+ event.preventDefault();
559
+ var add_box = $(this).parents('.yith-add-box'),
560
+ id = $(this).closest('.yith-toggle_wrapper').attr('id'),
561
+ spinner = add_box.find('.spinner'),
562
+ toggle_element = $(this).parents('.toggle-element'),
563
+ fields = add_box.find(':input'),
564
+ counter = toggle_element.find('.yith-toggle-row').length,
565
+ hidden_obj = $('<input type="hidden">');
566
+ hidden_obj.val(counter);
567
+ $(document).trigger('yith-toggle-change-counter', [hidden_obj, add_box]);
568
+
569
+ counter = hidden_obj.val();
570
+ var template = wp.template('yith-toggle-element-item-' + id),
571
+ toggle_el = $(template({index: counter}));
572
+
573
+ spinner.addClass('show');
574
+
575
+ $.each(fields, function (i, field) {
576
+ if (typeof $(field).attr('id') != 'undefined') {
577
+
578
+ $field_id = $(field).attr('id');
579
+ $field_val = $(field).val();
580
+
581
+ if ('radio' == $(field).attr('type')) {
582
+ $field_id = $field_id.replace('new_', '');
583
+ $field_id = $field_id.replace('-' + $field_val, '');
584
+ $field_id = $field_id + '_dataindex-' + $field_val;
585
+ } else {
586
+ $field_id = $field_id.replace('new_', '') + '_' + counter;
587
+ }
588
+
589
+ if ($(field).is(':checked')) {
590
+ $(toggle_el).find('#' + $field_id).prop('checked', true);
591
+ }
592
+
593
+ if ($(field).hasClass('yith-post-search') || $(field).hasClass('yith-term-search')) {
594
+ $(toggle_el).find('#' + $field_id).html($('#' + $(field).attr('id')).html());
595
+ }
596
+
597
+ $(toggle_el).find('#' + $field_id).val($field_val);
598
+
599
+ }
600
+
601
+ });
602
+
603
+ $(toggle_el).formatToggleTitle();
604
+ var form_is_valid = $('<input type="hidden">').val('yes');
605
+ $(document).trigger('yith-toggle-element-item-before-add', [add_box, toggle_el, form_is_valid]);
606
+
607
+
608
+ if (form_is_valid.val() === 'yes') {
609
+ $(toggle_element).find('.yith-toggle-elements').append(toggle_el);
610
+ $(add_box).find('.yith-plugin-fw-datepicker').datepicker('destroy');
611
+ $(add_box).html('').toggle();
612
+ toggle_element.saveToggleElement();
613
+ yith_fields_init();
614
+ }
615
+ });
616
+
617
+ $(document).on('click', '.yith-toggle-row .yith-save-button', function (event) {
618
+ event.preventDefault();
619
+ var toggle = $(this).closest('.toggle-element'),
620
+ toggle_row = $(this).closest('.yith-toggle-row'),
621
+ spinner = toggle_row.find('.spinner');
622
+ toggle_row.formatToggleTitle();
623
+
624
+ var form_is_valid = $('<input type="hidden">').val('yes');
625
+ $(document).trigger('yith-toggle-element-item-before-update', [toggle, toggle_row, form_is_valid]);
626
+ if (form_is_valid.val() === 'yes') {
627
+ spinner.addClass('show');
628
+ toggle.saveToggleElement(spinner);
629
  }
630
+ });
631
+
632
+ //register remove the dome and save the toggle
633
+ $(document).on('click', '.yith-toggle-row .yith-delete-button', function (event) {
634
+ event.preventDefault();
635
+ var toggle = $(this).closest('.toggle-element'),
636
+ toggle_row = $(this).closest('.yith-toggle-row');
637
+ toggle_row.remove();
638
+ toggle.saveToggleElement();
639
+ });
640
+
641
+ //register onoff status
642
+ $(document).on('click', '.yith-toggle-onoff', function (event) {
643
+ event.preventDefault();
644
+ var toggle = $(this).closest('.toggle-element');
645
+ toggle.saveToggleElement();
646
+ });
647
+
648
+
649
+ });
plugin-fw/assets/js/yith-fields.min.js CHANGED
@@ -1,15 +1 @@
1
- var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,g,d){a instanceof String&&(a=String(a));for(var e=a.length,h=0;h<e;h++){var l=a[h];if(g.call(d,l,h,a))return{i:h,v:l}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,d){a!=Array.prototype&&a!=Object.prototype&&(a[g]=d.value)};
2
- $jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,g,d,e){if(g){d=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var h=a[e];h in d||(d[h]={});d=d[h]}a=a[a.length-1];e=d[a];g=g(e);g!=e&&null!=g&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:g})}};
3
- $jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6","es3");
4
- jQuery(function(a){var g=a(".yith-plugin-fw-datepicker"),d=a(".yith-plugin-fw-colorpicker"),e=a(".yith-plugin-fw-upload-img-url"),h=a(".add_media"),l=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),m=a(".yith-plugin-fw-onoff-container span"),n=a(".yith-plugin-fw-sidebar-layout"),p=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),q=a(".codemirror"),r=a(".yit-icons-manager-wrapper");g.each(function(){var b=a(this).data();a(this).datepicker(b)});d.wpColorPicker({clear:function(){var b=
5
- a(this);b.val(b.data("default-color"));b.change()}});d.each(function(){var b=a(this).data("variations-label");a(this).parent().parent().find("a.wp-color-result").attr("title",b)});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(e.change(function(){var b=a(this).val(),c=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>c.length&&(c=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?
6
- c.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):c.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var c=a(this).attr("id").replace(/-button$/,"");if(!f){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var f=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,
7
- states:b});f.on("select",function(){var b=f.state().get("selection").first().toJSON();a("#"+c).val(b.url);a("#"+c+"-yith-attachment-id")&&a("#"+c+"-yith-attachment-id").val(b.id);e.trigger("change")})}f.open()}),a(document).on("click",".yith-plugin-fw-upload-button-reset",function(b){var c=a(this);b=c.attr("id");c=c.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+c).val(b);e.trigger("change")}));h.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&
8
- (a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var c=a(this);b=c.closest(".image-gallery");var f=b.find(".image_gallery_ids"),k=f.val(),d=b.find("ul.slides-wrapper"),e=wp.media.frames.image_gallery=wp.media({title:c.data("choose"),button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),filterable:"all",multiple:!0})]});e.on("select",function(){e.state().get("selection").map(function(a){a=a.toJSON();a.id&&(k=k?k+","+a.id:a.id,d.append('<li class="image" data-attachment_id="'+
9
- a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+c.data("delete")+'">x</a></li></ul></li>'))});f.val(k)});e.open()}),l.each(function(){var b=a(this);b.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(c,f){var k="";b.find("li.image").css("cursor",
10
- "default").each(function(){var b=a(this).attr("data-attachment_id");k=k+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(k)}})}),l.on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),c=a(this).closest(".image-gallery ul.slides-wrapper");b=b.find(".image_gallery_ids");var f="";a(this).closest("li.image").remove();c.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");f=f+b+","});b.val(f)}));m.on("click",function(){var b=
11
- a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});n.each(function(){a(this).find("img").on("click",function(){var b=a(this).closest(".yith-plugin-fw-sidebar-layout"),c=b.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container");b=b.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container");var f=a(this).data("type");a(this).parent().children(":radio").attr("checked",
12
- !1);a(this).prev(":radio").attr("checked",!0);if("undefined"!=typeof f)switch(f){case "left":c.show();b.hide();break;case "right":b.show();c.hide();break;case "double":c.show();b.show();break;default:c.hide(),b.hide()}})});p.each(function(){var b=a(this).data("val"),c=a(this).data("min"),f=a(this).data("max"),k=a(this).data("step"),d=a(this).data("labels");a(this).slider({value:b,min:c,max:f,range:"min",step:k,create:function(){a(this).find(".ui-slider-handle").text(a(this).slider("value"))},slide:function(b,
13
- c){a(this).find("input").val(c.value);a(this).find(".ui-slider-handle").text(c.value);a(this).siblings(".feedback").find("strong").text(c.value+d)}})});q.each(function(b,c){b=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",b)});a(document).on("click",".yith-plugin-fw-select-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!0).trigger("change")});a(document).on("click",".yith-plugin-fw-deselect-all",
14
- function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!1).trigger("change")});r.each(function(){var b=a(this),c=b.find(".yit-icons-manager-icon-preview").first(),f=b.find(".yit-icons-manager-icon-text");b.on("click",".yit-icons-manager-list li",function(d){d=a(d.target).closest("li");var e=d.data("font"),g=d.data("icon"),k=d.data("key"),h=d.data("name");c.attr("data-font",e);c.attr("data-icon",g);c.attr("data-key",k);c.attr("data-name",h);f.val(e+":"+h);b.find(".yit-icons-manager-list li").removeClass("active");
15
- d.addClass("active")});b.on("click",".yit-icons-manager-action-set-default",function(){b.find(".yit-icons-manager-list li.default").trigger("click")})});a(document).on("click",".yith-plugin-fw-select-images__item",function(){var b=a(this),c=b.data("key"),d=b.closest(".yith-plugin-fw-select-images__wrapper"),e=d.find(".yith-plugin-fw-select-images__item");d=d.find("select").first();d.length&&(d.val(c),e.removeClass("yith-plugin-fw-select-images__item--selected"),b.addClass("yith-plugin-fw-select-images__item--selected"))})});
1
+ jQuery(function(g){function f(){var e=g(".yith-plugin-fw-datepicker"),t=g(".yith-plugin-fw-colorpicker"),n={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:g(".yith-plugin-fw-upload-img-url")},i=g(".add_media"),a={sliderWrapper:g(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},l=g(".yith-plugin-fw-sidebar-layout"),o=g(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=g(".codemirror"),d=g(".yit-icons-manager-wrapper"),s=g(".yith-plugin-ui td.forminp-checkbox");if(e.each(function(){var e=g(this).data();g(this).datepicker(e)}),t.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var e=g(this);e.val(e.data("default-color")),e.change()}}),t.each(function(){var e=g(this).data("variations-label"),t=g(this).closest(".yith-plugin-fw-field-wrapper"),i=t.find(".wp-picker-input-wrap");if(t.find("a.wp-color-result").attr("title",e),!i.find(".wp-picker-clear-custom").length){var a=g("<span/>").attr({class:"wp-picker-default-custom"});i.find(".wp-picker-default").wrap(a)}}),"undefined"!=typeof wp&&void 0!==wp.media){n.imgUrl.change(function(){var e=g(this).val(),t=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),i=g(this).parent().find(n.imgPreviewHandler).first();i.length<1&&(i=g(this).parent().parent().find(n.imgPreviewHandler).first()),t.test(e)?i.html('<img src="'+e+'" style="max-width:100px; max-height:100px;" />'):i.html("")}).trigger("change"),g(document).on("click",n.uploadButtonHandler,function(e){e.preventDefault();var t,i=g(this).attr("id").replace(/-button$/,"");if(t)t.open();else{var a=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(t=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:a})).on("select",function(){var e=t.state().get("selection").first().toJSON();g("#"+i).val(e.url),g("#"+i+"-yith-attachment-id")&&g("#"+i+"-yith-attachment-id").val(e.id),n.imgUrl.trigger("change")}),t.open()}}),g(document).on("click",n.resetButtonHandler,function(e){var t=g(this),i=t.attr("id"),a=t.attr("id").replace(/-button-reset$/,""),l=g("#"+i).data("default");g("#"+a).val(l),n.imgUrl.trigger("change")})}i.on("click",function(){!1}),"undefined"!=typeof wp&&void 0!==wp.media&&(g(document).on("click",a.buttonHandler,function(e){var t=g(this),i=t.closest(".image-gallery"),a=i.find(".image_gallery_ids"),l=a.val(),n=i.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:t.data("choose"),button:{text:t.data("update")},states:[new wp.media.controller.Library({title:t.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,n.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+t.data("delete")+'">x</a></li></ul></li>'))}),a.val(l)}),o.open()}),a.sliderWrapper.each(function(){var a=g(this);a.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(e,t){var i="";a.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");i=i+e+","}),a.closest(".image-gallery").find(".image_gallery_ids").val(i)}})}),a.sliderWrapper.on("click","a.delete",function(){var e=g(this).closest(".image-gallery"),t=g(this).closest(".image-gallery ul.slides-wrapper"),i=e.find(".image_gallery_ids"),a="";g(this).closest("li.image").remove(),t.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");a=a+e+","}),i.val(a)})),l.each(function(){g(this).find("img").on("click",function(){var e=g(this).closest(".yith-plugin-fw-sidebar-layout"),t=e.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),i=e.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),a=g(this).data("type");if(g(this).parent().children(":radio").attr("checked",!1),g(this).prev(":radio").attr("checked",!0),void 0!==a)switch(a){case"left":t.show(),i.hide();break;case"right":i.show(),t.hide();break;case"double":t.show(),i.show();break;default:t.hide(),i.hide()}})}),o.each(function(){var e=g(this).data("val"),t=g(this).data("min"),i=g(this).data("max"),a=g(this).data("step"),l=g(this).data("labels");g(this).slider({value:e,min:t,max:i,range:"min",step:a,create:function(){g(this).find(".ui-slider-handle").text(g(this).slider("value"))},slide:function(e,t){g(this).find("input").val(t.value),g(this).find(".ui-slider-handle").text(t.value),g(this).siblings(".feedback").find("strong").text(t.value+l)}})}),r.each(function(e,t){var i=CodeMirror.fromTextArea(t,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});g(t).data("codemirrorInstance",i)}),g(document).on("click",".yith-plugin-fw-select-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),g(document).on("click",".yith-plugin-fw-deselect-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var o=g(this),r=o.find(".yit-icons-manager-icon-preview").first(),d=o.find(".yit-icons-manager-icon-text");o.on("click",".yit-icons-manager-list li",function(e){var t=g(e.target).closest("li"),i=t.data("font"),a=t.data("icon"),l=t.data("key"),n=t.data("name");r.attr("data-font",i),r.attr("data-icon",a),r.attr("data-key",l),r.attr("data-name",n),d.val(i+":"+n),o.find(".yit-icons-manager-list li").removeClass("active"),t.addClass("active")}),o.on("click",".yit-icons-manager-action-set-default",function(){o.find(".yit-icons-manager-list li.default").trigger("click")})}),g(document).on("click",".yith-plugin-fw-select-images__item",function(){var e=g(this),t=e.data("key"),i=e.closest(".yith-plugin-fw-select-images__wrapper"),a=i.find(".yith-plugin-fw-select-images__item"),l=i.find("select").first();l.length&&(l.val(t),a.removeClass("yith-plugin-fw-select-images__item--selected"),e.addClass("yith-plugin-fw-select-images__item--selected"))}),g(document.body).trigger("wc-enhanced-select-init"),g(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(e,t){var i=jQuery(".ui-sortable-handle"),a=0,l=new Array;for(a=0;a<i.length;a++)l[a]=g(i[a]).data("item_key");0<l.length&&g(this).closest(".toggle-element").saveToggleElement(null,l)}}),g.each(s,function(){var e=g(this).find("fieldset");3<e.length&&e.length<6&&g(this).addClass("two-cols"),6<e.length&&g(this).addClass("three-cols")}),g(document.body).trigger("yith-framework-enhanced-select-init")}f(),g(document).on("click",".yith-plugin-fw-onoff-container span",function(){var e=g(this).prev("input");e.prop("checked")?e.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):e.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),e.change()}),g.fn.saveToggleElement=function(t,e){var i=g(this),a="yith_plugin_fw_save_toggle_element",l=i.serializeToggleElement(),n=i.find(".yith-toggle_wrapper").attr("id"),o=g.urlParam("tab");void 0!==e&&0<e.length&&l.append("yith_toggle_elements_order_keys",e),i.closest(".metaboxes-tab.yith-plugin-ui").length?(a="yith_plugin_fw_save_toggle_element_metabox",post_id=g(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=g(this).closest("form#post").find("#yit_metaboxes_nonce").val(),url=yith_framework_fw_fields.ajax_url+"?action="+a+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+n):url=yith_framework_fw_fields.admin_url+"?action="+a+"&tab="+o+"&toggle_id="+n,g.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(e){t&&t.removeClass("show"),g(document).trigger("yith_save_toggle_element_done",[e,i])}})},g.fn.serializeToggleElement=function(){var e=g(this),i=new FormData,t=g(e).find(":input").serializeArray();return g.each(t,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},g.fn.formatToggleTitle=function(){var e=g(this),t=e.find(":input"),i=e.find("span.title").data("title_format"),a=e.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==i)var n=i.match(l);if(void 0!==a)var o=a.match(l);g.each(t,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=g(t).val(),null!=n&&void 0!==n&&-1!==n.indexOf($field_id)&&(i=i.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)))}),""!==i&&e.find("span.title").html(i),""!==a&&e.find(".subtitle").html(a),g(document).trigger("yith-toggle-element-item-title",[e])},g.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},g(document).on("click",".yith-toggle",function(e){var t=g(e.target).closest(".yith-toggle-row"),i=t.find(".yith-toggle-content");t.is(".yith-toggle-row-opened")?i.slideUp(400):i.slideDown(400),t.toggleClass("yith-toggle-row-opened")}),g(document).on("click",".yith-add-box-button",function(e){e.preventDefault();var t=g(this).data("box_id"),i=g(this).closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+i),""!==t&&(g("#"+t).html(template({index:"box_id"})).slideToggle(),f(),g(document).trigger("yith-add-box-button-toggle",[g(this)]))}),g(document).on("click",".yith-add-box-buttons .yith-save-button",function(e){e.preventDefault();var t=g(this).parents(".yith-add-box"),i=g(this).closest(".yith-toggle_wrapper").attr("id"),a=t.find(".spinner"),l=g(this).parents(".toggle-element"),n=t.find(":input"),o=l.find(".yith-toggle-row").length,r=g('<input type="hidden">');r.val(o),g(document).trigger("yith-toggle-change-counter",[r,t]),o=r.val();var d=wp.template("yith-toggle-element-item-"+i),s=g(d({index:o}));a.addClass("show"),g.each(n,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_val=g(t).val(),"radio"==g(t).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,g(t).is(":checked")&&g(s).find("#"+$field_id).prop("checked",!0),(g(t).hasClass("yith-post-search")||g(t).hasClass("yith-term-search"))&&g(s).find("#"+$field_id).html(g("#"+g(t).attr("id")).html()),g(s).find("#"+$field_id).val($field_val))}),g(s).formatToggleTitle();var c=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-add",[t,s,c]),"yes"===c.val()&&(g(l).find(".yith-toggle-elements").append(s),g(t).find(".yith-plugin-fw-datepicker").datepicker("destroy"),g(t).html("").toggle(),l.saveToggleElement(),f())}),g(document).on("click",".yith-toggle-row .yith-save-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element"),i=g(this).closest(".yith-toggle-row"),a=i.find(".spinner");i.formatToggleTitle();var l=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-update",[t,i,l]),"yes"===l.val()&&(a.addClass("show"),t.saveToggleElement(a))}),g(document).on("click",".yith-toggle-row .yith-delete-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element");g(this).closest(".yith-toggle-row").remove(),t.saveToggleElement()}),g(document).on("click",".yith-toggle-onoff",function(e){e.preventDefault(),g(this).closest(".toggle-element").saveToggleElement()})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.1.29
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.1.26
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
@@ -22,6 +22,8 @@ if ( ! defined ( 'ABSPATH' ) ) {
22
  exit;
23
  } // Exit if accessed directly
24
 
 
 
25
  if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
26
  /**
27
  * yit_maybe_plugin_fw_loader
@@ -29,7 +31,7 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
29
  * @since 1.0.0
30
  */
31
  function yit_maybe_plugin_fw_loader ( $plugin_path ) {
32
- global $plugin_fw_data;
33
 
34
  $default_headers = array (
35
  'Name' => 'Framework Name',
@@ -39,8 +41,9 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
39
  'DomainPath' => 'Domain Path',
40
  );
41
 
42
- $framework_data = get_file_data ( trailingslashit ( $plugin_path ) . 'plugin-fw/init.php', $default_headers );
43
- $plugin_fw_main_file = trailingslashit ( $plugin_path ) . 'plugin-fw/yit-plugin.php';
 
44
 
45
  if ( ! empty( $plugin_fw_data ) ) {
46
  foreach ( $plugin_fw_data as $version => $path ) {
@@ -51,7 +54,73 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
51
  } else {
52
  $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
 
 
 
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.3.3
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.3.2
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
22
  exit;
23
  } // Exit if accessed directly
24
 
25
+
26
+
27
  if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
28
  /**
29
  * yit_maybe_plugin_fw_loader
31
  * @since 1.0.0
32
  */
33
  function yit_maybe_plugin_fw_loader ( $plugin_path ) {
34
+ global $plugin_fw_data, $plugin_upgrade_fw_data;
35
 
36
  $default_headers = array (
37
  'Name' => 'Framework Name',
41
  'DomainPath' => 'Domain Path',
42
  );
43
 
44
+ $plugin_path = trailingslashit( $plugin_path );
45
+ $framework_data = get_file_data( $plugin_path . 'plugin-fw/init.php', $default_headers );
46
+ $plugin_fw_main_file = $plugin_path . 'plugin-fw/yit-plugin.php';
47
 
48
  if ( ! empty( $plugin_fw_data ) ) {
49
  foreach ( $plugin_fw_data as $version => $path ) {
54
  } else {
55
  $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
56
  }
57
+
58
+ if ( ! defined( 'YITH_PLUGIN_FW_VERSION' ) ) {
59
+ $keys = array_keys( $plugin_fw_data );
60
+ $version = empty( $plugin_fw_data ) ? '1.0.0' : array_pop( $keys );
61
+ define( 'YITH_PLUGIN_FW_VERSION', $version );
62
+ }
63
+
64
+ //Check for license & upgrade classes
65
+ $upgrade_fw_init_file = $plugin_path . 'plugin-upgrade/init.php';
66
+ $framework_data = file_exists( $upgrade_fw_init_file ) ? get_file_data( $upgrade_fw_init_file, $default_headers ) : $framework_data;
67
+ $plugin_license_path = $plugin_upgrade_path = $plugin_path . 'plugin-upgrade';
68
+
69
+ if( ! file_exists( $plugin_upgrade_path ) ){
70
+ //Check the path for OLD plugin FW
71
+ if( file_exists( $plugin_path . 'plugin-fw/licence' ) ){
72
+ $plugin_license_path = $plugin_path . 'plugin-fw/licence';
73
+ $plugin_upgrade_path = $plugin_path . 'plugin-fw/';
74
+ }
75
+
76
+ else {
77
+ $plugin_upgrade_path = $plugin_license_path = false;
78
+ }
79
+ }
80
+
81
+ if( file_exists( $plugin_upgrade_path ) ){
82
+ if( ! empty( $plugin_upgrade_fw_data ) ){
83
+ foreach( $plugin_upgrade_fw_data as $version => $files ){
84
+ if( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ){
85
+ $plugin_upgrade_fw_data = array ( $framework_data[ 'Version' ] => yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path ) );
86
+ }
87
+ }
88
+ }
89
+
90
+ else {
91
+ $plugin_upgrade_fw_data = array ( $framework_data[ 'Version' ] => yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path ) );
92
+ }
93
+ }
94
  }
95
  }
96
 
97
+ if( ! function_exists( 'yit_get_upgrade_files' ) ){
98
+ /**
99
+ * Retreive the core files to include to manage license and upgrade if exists
100
+ *
101
+ * @param $plugin_update_path file path
102
+ *
103
+ * @return array to files to include
104
+ */
105
+ function yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path = '' ){
106
+ $to_include = array();
107
+
108
+ if( false ==! $plugin_license_path ){
109
+ $plugin_upgrade_path = empty( $plugin_upgrade_path ) ? $plugin_license_path : $plugin_upgrade_path;
110
+ $license_files = array(
111
+ '%yith-license-path%/lib/yit-licence.php',
112
+ '%yith-license-path%/lib/yit-plugin-licence.php',
113
+ '%yith-license-path%/lib/yit-theme-licence.php',
114
+ );
115
+
116
+ $upgrade_files = array( '%yith-upgrade-path%/lib/yit-plugin-upgrade.php' );
117
+
118
+ $to_include_license = str_replace( '%yith-license-path%', $plugin_license_path, $license_files );
119
+ $to_include_upgrade = str_replace( '%yith-upgrade-path%', $plugin_upgrade_path, $upgrade_files );
120
+
121
+ $to_include = array_merge( $to_include_license, $to_include_upgrade );
122
+ }
123
 
124
+ return $to_include;
125
+ }
126
+ }
plugin-fw/languages/yith-plugin-fw-it_IT.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-it_IT.po CHANGED
@@ -5,14 +5,14 @@ msgstr ""
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
  "POT-Creation-Date: 2019-02-04 16:06+0100\n"
8
- "PO-Revision-Date: 2019-02-04 16:07+0100\n"
9
  "Last-Translator: \n"
10
  "Language-Team: YIThemes <plugins@yithemes.com>\n"
11
  "Language: it_IT\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
- "X-Generator: Poedit 2.2.1\n"
16
  "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
  "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
  "esc_html_x:1,2c\n"
@@ -428,10 +428,15 @@ msgid ""
428
  "\">Downloads page</a>. This is the only way to be sure the version you are "
429
  "using is 100% malware-free."
430
  msgstr ""
 
 
 
 
 
 
 
431
 
432
  #: lib/yit-upgrade.php:303
433
- #, fuzzy
434
- #| msgid "You have to activate the plugin to benefit from automatic updates."
435
  msgctxt "[Update Plugin Message: License not enabled]"
436
  msgid "You have to activate the plugin to benefit from automatic updates."
437
  msgstr "Devi attivare il plugin per usufruire degli update automatici."
@@ -509,6 +514,13 @@ msgid ""
509
  "\">Downloads page</a>. This is the only way to be sure the version you are "
510
  "using is 100%% malware-free."
511
  msgstr ""
 
 
 
 
 
 
 
512
 
513
  #: lib/yit-upgrade.php:635
514
  msgid "You can't update the plugins for this site."
@@ -527,16 +539,16 @@ msgstr "Aggiorna plugin"
527
 
528
  #: lib/yith-dashboard.php:40
529
  msgid "New YITH products"
530
- msgstr ""
531
 
532
  #: lib/yith-dashboard.php:41
533
  msgid "News from the YITH Blog"
534
- msgstr ""
535
 
536
  #: lib/yith-gutenberg.php:134
537
  msgctxt "[gutenberg]: Category Name"
538
  msgid "YITH"
539
- msgstr ""
540
 
541
  #: licence/lib/yit-licence.php:180
542
  #, php-format
@@ -625,7 +637,7 @@ msgctxt ""
625
  "[Plugins List] which means you're missing out on updates and support. Enter "
626
  "your license key, please."
627
  msgid "Warning!"
628
- msgstr ""
629
 
630
  #: licence/lib/yit-plugin-licence.php:142
631
  msgctxt ""
@@ -633,7 +645,7 @@ msgctxt ""
633
  "[Plugins List] which means you're missing out on updates and support. Enter "
634
  "your license key, please."
635
  msgid "You didn't set license key for the following products"
636
- msgstr ""
637
 
638
  #: licence/lib/yit-plugin-licence.php:145
639
  msgctxt ""
@@ -641,17 +653,15 @@ msgctxt ""
641
  "[Plugins List] which means you're missing out on updates and support. Enter "
642
  "your license key, please."
643
  msgid "which means you're missing out on updates and support"
644
- msgstr ""
645
 
646
  #: licence/lib/yit-plugin-licence.php:147
647
- #, fuzzy
648
- #| msgid "license key"
649
  msgctxt ""
650
  "[Part of]: Warning! You didn't set license key for the following products:"
651
  "[Plugins List] which means you're missing out on updates and support. Enter "
652
  "your license key, please."
653
  msgid "Enter your license key"
654
- msgstr "chiave di licenza"
655
 
656
  #: licence/lib/yit-plugin-licence.php:148
657
  msgctxt ""
@@ -659,7 +669,7 @@ msgctxt ""
659
  "[Plugins List] which means you're missing out on updates and support. Enter "
660
  "your license key, please."
661
  msgid "please"
662
- msgstr ""
663
 
664
  #: licence/lib/yit-theme-licence.php:117 licence/lib/yit-theme-licence.php:118
665
  #, php-format
@@ -703,10 +713,8 @@ msgid "YITH License Activation"
703
  msgstr "Attivazione licenza YITH"
704
 
705
  #: licence/templates/panel/activation/activation-panel.php:27
706
- #, fuzzy
707
- #| msgid "License key has expired"
708
  msgid "License expiry date"
709
- msgstr "La chiave di licenza è scaduta"
710
 
711
  #: licence/templates/panel/activation/activation-panel.php:30
712
  msgid ""
@@ -714,10 +722,13 @@ msgid ""
714
  "appear up-to-date, please, click on the button <em>Check Expiry Date</em> "
715
  "below and it will update."
716
  msgstr ""
 
 
 
717
 
718
  #: licence/templates/panel/activation/activation-panel.php:33
719
  msgid "Check expiry date"
720
- msgstr ""
721
 
722
  #: licence/templates/panel/activation/activation-panel.php:47
723
  msgid "Product to activate"
@@ -727,11 +738,11 @@ msgstr[1] "Prodotti da attivare"
727
 
728
  #: licence/templates/panel/activation/activation-panel.php:50
729
  msgid "Are you having issues with the license activation?"
730
- msgstr ""
731
 
732
  #: licence/templates/panel/activation/activation-panel.php:50
733
  msgid "Read this article"
734
- msgstr ""
735
 
736
  #: licence/templates/panel/activation/activation-panel.php:70
737
  msgid "Activate"
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
  "POT-Creation-Date: 2019-02-04 16:06+0100\n"
8
+ "PO-Revision-Date: 2019-05-29 22:44+0200\n"
9
  "Last-Translator: \n"
10
  "Language-Team: YIThemes <plugins@yithemes.com>\n"
11
  "Language: it_IT\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 2.2.3\n"
16
  "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
  "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
  "esc_html_x:1,2c\n"
428
  "\">Downloads page</a>. This is the only way to be sure the version you are "
429
  "using is 100% malware-free."
430
  msgstr ""
431
+ "<br/><b>Attenzione:</b> Stai utilizzando una versione superiore all'ultima "
432
+ "disponibile. </em>Per favore assicurati di aver scaricato la versione più "
433
+ "recente di <em>%1$s</em> dall'unico <a href=\"https://yithemes.com\" target="
434
+ "\"_blank\">sito ufficiale YITH</a>, nello specifico dalla tua <a href="
435
+ "\"https://yithemes.com/my-account/recent-downloads/\" target=\"_blank"
436
+ "\">pagina Downloads</a>. Questo è l'unico modo per essere sicuri che la "
437
+ "versione in uso sia al 100% priva di malware."
438
 
439
  #: lib/yit-upgrade.php:303
 
 
440
  msgctxt "[Update Plugin Message: License not enabled]"
441
  msgid "You have to activate the plugin to benefit from automatic updates."
442
  msgstr "Devi attivare il plugin per usufruire degli update automatici."
514
  "\">Downloads page</a>. This is the only way to be sure the version you are "
515
  "using is 100%% malware-free."
516
  msgstr ""
517
+ "<br/><b>Attenzione:</b> Stai utilizzando una versione superiore all'ultima "
518
+ "disponibile. </em>Per favore assicurati di aver scaricato la versione più "
519
+ "recente di <em>%1$s</em> dall'unico <a href=\"https://yithemes.com\" target="
520
+ "\"_blank\">sito ufficiale YITH</a>, nello specifico dalla tua <a href="
521
+ "\"https://yithemes.com/my-account/recent-downloads/\" target=\"_blank"
522
+ "\">pagina Downloads</a>. Questo è l'unico modo per essere sicuri che la "
523
+ "versione in uso sia al 100%% priva di malware."
524
 
525
  #: lib/yit-upgrade.php:635
526
  msgid "You can't update the plugins for this site."
539
 
540
  #: lib/yith-dashboard.php:40
541
  msgid "New YITH products"
542
+ msgstr "Nuovi prodotti YITH"
543
 
544
  #: lib/yith-dashboard.php:41
545
  msgid "News from the YITH Blog"
546
+ msgstr "Novità dal blog YITH"
547
 
548
  #: lib/yith-gutenberg.php:134
549
  msgctxt "[gutenberg]: Category Name"
550
  msgid "YITH"
551
+ msgstr "YITH"
552
 
553
  #: licence/lib/yit-licence.php:180
554
  #, php-format
637
  "[Plugins List] which means you're missing out on updates and support. Enter "
638
  "your license key, please."
639
  msgid "Warning!"
640
+ msgstr "Attenzione!"
641
 
642
  #: licence/lib/yit-plugin-licence.php:142
643
  msgctxt ""
645
  "[Plugins List] which means you're missing out on updates and support. Enter "
646
  "your license key, please."
647
  msgid "You didn't set license key for the following products"
648
+ msgstr "Non hai impostato la chiave di licenza per i seguenti prodotti"
649
 
650
  #: licence/lib/yit-plugin-licence.php:145
651
  msgctxt ""
653
  "[Plugins List] which means you're missing out on updates and support. Enter "
654
  "your license key, please."
655
  msgid "which means you're missing out on updates and support"
656
+ msgstr "il che significa che ti stai perdendo aggiornamenti e supporto"
657
 
658
  #: licence/lib/yit-plugin-licence.php:147
 
 
659
  msgctxt ""
660
  "[Part of]: Warning! You didn't set license key for the following products:"
661
  "[Plugins List] which means you're missing out on updates and support. Enter "
662
  "your license key, please."
663
  msgid "Enter your license key"
664
+ msgstr "Inserisci la tua chiave di licenza"
665
 
666
  #: licence/lib/yit-plugin-licence.php:148
667
  msgctxt ""
669
  "[Plugins List] which means you're missing out on updates and support. Enter "
670
  "your license key, please."
671
  msgid "please"
672
+ msgstr "per favore"
673
 
674
  #: licence/lib/yit-theme-licence.php:117 licence/lib/yit-theme-licence.php:118
675
  #, php-format
713
  msgstr "Attivazione licenza YITH"
714
 
715
  #: licence/templates/panel/activation/activation-panel.php:27
 
 
716
  msgid "License expiry date"
717
+ msgstr "Data di scadenza della licenza"
718
 
719
  #: licence/templates/panel/activation/activation-panel.php:30
720
  msgid ""
722
  "appear up-to-date, please, click on the button <em>Check Expiry Date</em> "
723
  "below and it will update."
724
  msgstr ""
725
+ "Se hai rinnovato la chiave di licenza del tuo prodotto e la data di scadenza "
726
+ "non risulta aggiornata, ti invitiamo a fare clic sul pulsante <em>Check "
727
+ "Expiry Date</em> in modo da aggiornarla."
728
 
729
  #: licence/templates/panel/activation/activation-panel.php:33
730
  msgid "Check expiry date"
731
+ msgstr "Controlla la data di scadenza"
732
 
733
  #: licence/templates/panel/activation/activation-panel.php:47
734
  msgid "Product to activate"
738
 
739
  #: licence/templates/panel/activation/activation-panel.php:50
740
  msgid "Are you having issues with the license activation?"
741
+ msgstr "Stai riscontrando problemi con l'attivazione della licenza?"
742
 
743
  #: licence/templates/panel/activation/activation-panel.php:50
744
  msgid "Read this article"
745
+ msgstr "Leggi questo articolo"
746
 
747
  #: licence/templates/panel/activation/activation-panel.php:70
748
  msgid "Activate"
plugin-fw/lib/promo/black.jpg ADDED
Binary file
plugin-fw/lib/promo/cyber.jpg ADDED
Binary file
plugin-fw/lib/promo/halloween.jpg ADDED
Binary file
plugin-fw/lib/promo/yith-promo.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if( ! function_exists( 'simplexml_load_string' ) ){
12
+ return false;
13
+ }
14
+
15
+ add_action( 'admin_notices', 'yith_plugin_fw_promo_notices', 15 );
16
+ add_action( 'admin_enqueue_scripts', 'yith_plugin_fw_notice_dismiss', 20 );
17
+
18
+ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
19
+ function yith_plugin_fw_promo_notices(){
20
+ if( function_exists( 'current_user_can' ) && ! current_user_can( 'administrator' ) ){
21
+ return false;
22
+ }
23
+
24
+ $base_url = apply_filters( 'yith_plugin_fw_promo_base_url', YIT_CORE_PLUGIN_PATH . '/lib/promo/' );
25
+ $xml = apply_filters( 'yith_plugin_fw_promo_xml_url', $base_url . 'yith-promo.xml' );
26
+ $transient = "yith_promo_message";
27
+ $remote_data = get_site_transient( $transient );
28
+ $regenerate_promo_transient = isset( $_GET['yith_regenerate_promo_transient'] ) && 'yes' == $_GET['yith_regenerate_promo_transient'] ? $_GET['yith_regenerate_promo_transient'] : '';
29
+ $promo_data = false;
30
+ $create_transient = false;
31
+
32
+ if( false === $remote_data || apply_filters( 'yith_plugin_fw_force_regenerate_promo_transient', false ) || 'yes' == $regenerate_promo_transient ){
33
+ $remote_data = file_get_contents( $xml );
34
+ $create_transient = true;
35
+ }
36
+
37
+ if ( ! is_wp_error( $remote_data ) && ! empty( $remote_data ) ) {
38
+ $promo_data = @simplexml_load_string( $remote_data );
39
+ if( true === $create_transient ){
40
+ $is_membership_user = false;
41
+ $license = function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_licence() : array();
42
+ $xml_expiry_date = '';
43
+
44
+ if( is_array( $license ) && apply_filters( 'yith_plugin_fw_check_for_membership_user', true ) ){
45
+ /* === Check is the user have the YITH Club === */
46
+ foreach( $license as $plugin => $data ){
47
+ if( ! empty( $data['is_membership'] ) ){
48
+ $is_membership_user = true;
49
+ $xml_expiry_date = $data['licence_expires'];
50
+ $remote_data = $promo_data = array();
51
+ break;
52
+ }
53
+ }
54
+ }
55
+
56
+ if( empty( $is_membership_user ) && ! empty( $promo_data->expiry_date ) ){
57
+ $xml_expiry_date = $promo_data->expiry_date;
58
+ }
59
+
60
+ //Set Site Transient
61
+ set_site_transient( $transient, $remote_data, yith_plugin_fw_get_promo_transient_expiry_date( $xml_expiry_date ) );
62
+ }
63
+
64
+ if ( $promo_data && ! empty( $promo_data->promo ) ) {
65
+ $now = strtotime( current_time( 'mysql' ) );
66
+
67
+ foreach ($promo_data->promo as $promo ){
68
+ $show_promo = true;
69
+ /* === Check for Special Promo === */
70
+ if( ! empty( $promo->show_promo_in ) ){
71
+ $show_promo_in = explode( ',', $promo->show_promo_in );
72
+ $show_promo_in = array_map( 'trim', $show_promo_in );
73
+ if( ! empty( $show_promo_in ) ){
74
+ $show_promo = false;
75
+ foreach( $show_promo_in as $plugin ){
76
+ $plugin_slug = constant( $plugin );
77
+ $plugin_is_activated = ! empty( $license[ $plugin_slug ]['activated'] );
78
+ if( defined( $plugin ) && ! apply_filters( 'yith_plugin_fw_promo_plugin_is_activated', $plugin_is_activated ) ){
79
+ $show_promo = true;
80
+ break;
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ $start_date = isset( $promo->start_date ) ? $promo->start_date : '';
87
+ $end_date = isset( $promo->end_date ) ? $promo->end_date : '';
88
+
89
+ if( $show_promo && ! empty( $start_date ) && ! empty( $end_date ) ){
90
+ $start_date = strtotime( $start_date );
91
+ $end_date = strtotime( $end_date );
92
+
93
+ if( $end_date >= $start_date && $now >= $start_date && $now <= $end_date ){
94
+ //is valid promo
95
+ $title = isset( $promo->title ) ? $promo->title : '';
96
+ $description = isset( $promo->description ) ? $promo->description : '';
97
+ $url = isset( $promo->link->url ) ? $promo->link->url : '';
98
+ $url_label = isset( $promo->link->label ) ? $promo->link->label : '';
99
+ $image_bg_color = isset( $promo->style->image_bg_color ) ? $promo->style->image_bg_color : '';
100
+ $border_color = isset( $promo->style->border_color ) ? $promo->style->border_color : '';
101
+ $background_color = isset( $promo->style->background_color ) ? $promo->style->background_color : '';
102
+ $promo_id = isset( $promo->promo_id ) ? $promo->promo_id : '';
103
+ $banner = isset( $promo->banner ) ? $promo->banner : '';
104
+ $style = $link = '';
105
+ $show_notice = false;
106
+
107
+ if( ! empty( $border_color ) ){
108
+ $style .= "border-left-color: {$border_color};";
109
+ }
110
+
111
+ if( ! empty( $background_color ) ){
112
+ $style .= "background-color: {$background_color};";
113
+ }
114
+
115
+ if( ! empty( $image_bg_color ) ){
116
+ $image_bg_color = "background-color: {$image_bg_color};";
117
+ }
118
+
119
+ if( ! empty( $title ) ) {
120
+ $promo_id .= $title;
121
+ $title = sprintf( '%s: ', $title );
122
+ $show_notice = true;
123
+ }
124
+
125
+ if( ! empty( $description ) ) {
126
+ $promo_id .= $description;
127
+ $description = sprintf( '%s', $description );
128
+ $show_notice = true;
129
+ }
130
+
131
+ if( ! empty( $url ) && ! empty( $url_label )) {
132
+ $promo_id .= $url . $url_label;
133
+ $link = sprintf( '<a href="%s" target="_blank">%s</a>', $url, $url_label );
134
+ $show_notice = true;
135
+ }
136
+
137
+ if( ! empty( $banner ) ){
138
+ $banner = sprintf( '<img src="%s" class="yith-promo-banner-image">', $base_url . $banner );
139
+
140
+ if( ! empty( $url ) ){
141
+ $banner = sprintf( '<a class="yith-promo-banner-image-link" href="%s" target="_blank" style="%s">%s</a>', $url, $image_bg_color, $banner);
142
+ }
143
+ }
144
+
145
+ $unique_promo_id = "yith-notice-" . md5 ( $promo_id );
146
+
147
+ if( ! empty( $_COOKIE[ 'hide_' . $unique_promo_id ] ) && 'yes' == $_COOKIE[ 'hide_' . $unique_promo_id ] ){
148
+ $show_notice = false;
149
+ }
150
+
151
+ if ( true === $show_notice ) :
152
+ wp_enqueue_script( 'yith-promo' );
153
+ ?>
154
+ <div id="<?php echo $unique_promo_id; ?>" class="yith-notice-is-dismissible notice notice-yith notice-alt is-dismissible" style="<?php echo $style; ?>" data-expiry= <?php echo $promo->end_date; ?>>
155
+ <p>
156
+ <?php if( ! empty( $banner ) ) { printf( '%s', $banner ); } ?>
157
+ <?php printf( "%s %s %s", $title, $description, $link ); ?>
158
+ </p>
159
+ </div>
160
+ <?php endif;
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ if( ! function_exists( 'yith_plugin_fw_notice_dismiss' ) ){
170
+ function yith_plugin_fw_notice_dismiss(){
171
+ $script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
172
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
173
+ wp_register_script( 'yith-promo', $script_path . '/assets/js/yith-promo' . $suffix . '.js', array( 'jquery' ), '1.0.0', true );
174
+ }
175
+ }
176
+
177
+ if( ! function_exists( 'yith_plugin_fw_get_promo_transient_expiry_date' ) ){
178
+ function yith_plugin_fw_get_promo_transient_expiry_date( $expiry_date ) {
179
+ $xml_expiry_date = ! empty( $expiry_date ) ? $expiry_date : '+24 hours';
180
+ $current = strtotime( current_time( 'Y-m-d H:i:s' ) );
181
+ $expiry_date = strtotime( $xml_expiry_date, $current );
182
+
183
+ if( $expiry_date <= $current ){
184
+ $expiry_date = strtotime( '+24 hours', $current );
185
+ }
186
+
187
+ return $expiry_date;
188
+ }
189
+ }
plugin-fw/lib/promo/yith-promo.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Default border color: #acc327 -->
3
+ <!-- Default background color: #ecf7ed -->
4
+
5
+ <promotions>
6
+ <expiry_date>2019-12-10</expiry_date>
7
+ <promo>
8
+ <promo_id>yithhalloween2019</promo_id>
9
+ <banner>halloween.jpg</banner>
10
+ <title><![CDATA[<strong>YITH Halloween</strong>]]></title>
11
+ <description><![CDATA[
12
+ Don't miss our <strong>30% discount</strong> on all our products! No coupon needed in cart. Valid only on <strong>31st October</strong>.
13
+ ]]></description>
14
+ <link>
15
+ <label>Get your deals now!</label>
16
+ <url><![CDATA[https://yithemes.com]]></url>
17
+ </link>
18
+ <style>
19
+ <image_bg_color>#005c7d</image_bg_color>
20
+ <border_color>#ea5105</border_color>
21
+ <background_color>#ffffff</background_color>
22
+ </style>
23
+ <start_date>2019-10-30 16:00:00</start_date>
24
+ <end_date>2019-11-01 08:00:00</end_date>
25
+ </promo>
26
+ <promo>
27
+ <promo_id>yithcybermonday2019</promo_id>
28
+ <banner>cyber.jpg</banner>
29
+ <title><![CDATA[<strong>YITH Cyber Monday</strong>]]></title>
30
+ <description><![CDATA[
31
+ Don't miss our <strong>30% discount</strong> on all our products! No coupon needed in cart. Valid from <strong>28th November</strong> to <strong>30th November</strong>.
32
+ ]]></description>
33
+ <link>
34
+ <label>Get your deals now!</label>
35
+ <url><![CDATA[https://yithemes.com]]></url>
36
+ </link>
37
+ <style>
38
+ <image_bg_color>#12fdd4</image_bg_color>
39
+ <border_color>#181d7b</border_color>
40
+ <background_color>#ffffff</background_color>
41
+ </style>
42
+ <start_date>2019-12-01 00:00:00</start_date>
43
+ <end_date>2019-12-03 08:00:00</end_date>
44
+ </promo>
45
+ <promo>
46
+ <promo_id>yithblackfriday2019</promo_id>
47
+ <banner>black.jpg</banner>
48
+ <title><![CDATA[<strong>YITH Black Friday</strong>]]></title>
49
+ <description><![CDATA[
50
+ Don't miss our <strong>30% discount</strong> on all our products! No coupon needed in cart. Valid from <strong>1st December</strong> to <strong>2nd December</strong>.
51
+ ]]></description>
52
+ <link>
53
+ <label>Get your deals now!</label>
54
+ <url><![CDATA[https://yithemes.com]]></url>
55
+ </link>
56
+ <style>
57
+ <image_bg_color>#272121</image_bg_color>
58
+ <border_color>#272121</border_color>
59
+ <background_color>#ffffff</background_color>
60
+ </style>
61
+ <start_date>2019-11-27 23:59:59</start_date>
62
+ <end_date>2019-11-30 23:59:59</end_date>
63
+ </promo>
64
+ </promotions>
plugin-fw/lib/yit-assets.php CHANGED
@@ -38,6 +38,7 @@ if ( !class_exists( 'YIT_Assets' ) ) {
38
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
39
  */
40
  private function __construct() {
 
41
  add_action( 'admin_enqueue_scripts', array( $this, 'register_styles_and_scripts' ) );
42
  }
43
 
@@ -50,8 +51,8 @@ if ( !class_exists( 'YIT_Assets' ) ) {
50
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
51
 
52
  //scripts
53
- wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider' ), $this->version, true );
54
- wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker' ), '1.0.0', true );
55
  wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable' ), $this->version, true );
56
  wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
57
  wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
@@ -66,7 +67,7 @@ if ( !class_exists( 'YIT_Assets' ) ) {
66
  wp_register_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
67
  wp_register_style( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/css/colorbox.css', array(), $this->version );
68
  wp_register_style( 'yit-upgrade-to-pro', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrade-to-pro.css', array( 'colorbox' ), $this->version );
69
- wp_register_style( 'yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css' );
70
  wp_register_style( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/css/yith-fields.css', false, $this->version );
71
 
72
  $wc_version_suffix = '';
@@ -87,8 +88,11 @@ if ( !class_exists( 'YIT_Assets' ) ) {
87
  'search_terms_nonce' => wp_create_nonce( 'search-terms' ),
88
  ) );
89
 
 
 
 
 
90
  wp_enqueue_style( 'yith-plugin-fw-admin', YIT_CORE_PLUGIN_URL . '/assets/css/admin.css', array(), $this->version );
91
-
92
  }
93
  }
94
  }
38
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
39
  */
40
  private function __construct() {
41
+ defined('YITH_PLUGIN_FW_VERSION') && $this->version = YITH_PLUGIN_FW_VERSION;
42
  add_action( 'admin_enqueue_scripts', array( $this, 'register_styles_and_scripts' ) );
43
  }
44
 
51
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
52
 
53
  //scripts
54
+ wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider','jquery-ui-sortable' ), $this->version, true );
55
+ wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
56
  wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable' ), $this->version, true );
57
  wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
58
  wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
67
  wp_register_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
68
  wp_register_style( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/css/colorbox.css', array(), $this->version );
69
  wp_register_style( 'yit-upgrade-to-pro', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrade-to-pro.css', array( 'colorbox' ), $this->version );
70
+ wp_register_style( 'yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css', array(), $this->version );
71
  wp_register_style( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/css/yith-fields.css', false, $this->version );
72
 
73
  $wc_version_suffix = '';
88
  'search_terms_nonce' => wp_create_nonce( 'search-terms' ),
89
  ) );
90
 
91
+ wp_localize_script('yith-plugin-fw-fields','yith_framework_fw_fields', array(
92
+ 'admin_url' => admin_url( 'admin.php' ),
93
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
94
+ ));
95
  wp_enqueue_style( 'yith-plugin-fw-admin', YIT_CORE_PLUGIN_URL . '/assets/css/admin.css', array(), $this->version );
 
96
  }
97
  }
98
  }
plugin-fw/lib/yit-metabox.php CHANGED
@@ -134,6 +134,9 @@ if ( !class_exists( 'YIT_Metabox' ) ) {
134
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 15 );
135
 
136
  add_filter( 'yit_icons_screen_ids', array( $this, 'add_screen_ids_for_icons' ) );
 
 
 
137
  }
138
 
139
  /**
@@ -486,56 +489,87 @@ if ( !class_exists( 'YIT_Metabox' ) ) {
486
  return $post_id;
487
  }*/
488
 
489
- $this->reorder_tabs();
490
-
491
  if ( isset( $_POST[ 'yit_metaboxes' ] ) ) {
492
  $yit_metabox_data = $_POST[ 'yit_metaboxes' ];
493
 
494
  if ( is_array( $yit_metabox_data ) ) {
495
-
496
  foreach ( $yit_metabox_data as $field_name => $field_value ) {
497
-
498
  if ( !add_post_meta( $post_id, $field_name, $field_value, true ) ) {
499
  update_post_meta( $post_id, $field_name, $field_value );
500
  }
501
-
502
-
503
  }
504
-
505
  }
506
-
507
-
508
  }
509
 
510
- foreach ( $this->tabs as $tab ) {
511
-
512
- foreach ( $tab[ 'fields' ] as $field ) {
513
 
514
- if ( in_array( $field[ 'type' ], array( 'title' ) ) ) {
515
- continue;
516
- }
517
-
518
- if ( isset( $_POST[ 'yit_metaboxes' ][ $field[ 'id' ] ] ) ) {
519
-
520
- if ( in_array( $field[ 'type' ], array( 'onoff', 'checkbox' ) ) ) {
521
- update_post_meta( $post_id, $field[ 'id' ], '1' );
522
- } else {
523
- $value = $_POST[ 'yit_metaboxes' ][ $field[ 'id' ] ];
524
- if ( !empty( $field[ 'yith-sanitize-callback' ] ) && is_callable( $field[ 'yith-sanitize-callback' ] ) ) {
525
- $value = call_user_func( $field[ 'yith-sanitize-callback' ], $value );
526
- }
527
- add_post_meta( $post_id, $field[ 'id' ], $value, true ) || update_post_meta( $post_id, $field[ 'id' ], $value );
528
- }
529
- } elseif ( in_array( $field[ 'type' ], array( 'onoff', 'checkbox' ) ) ) {
530
- update_post_meta( $post_id, $field[ 'id' ], '0' );
531
- } else {
532
- delete_post_meta( $post_id, $field[ 'id' ] );
533
- }
534
- }
535
- }
536
 
537
  }
538
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
  /**
540
  * Remove Fields
541
  *
@@ -552,6 +586,65 @@ if ( !class_exists( 'YIT_Metabox' ) ) {
552
  $this->remove_field( $field );
553
  }
554
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  }
556
  }
557
 
134
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 15 );
135
 
136
  add_filter( 'yit_icons_screen_ids', array( $this, 'add_screen_ids_for_icons' ) );
137
+
138
+ add_action( 'wp_ajax_yith_plugin_fw_save_toggle_element_metabox', array( $this, 'save_toggle_element' ) );
139
+ add_filter( 'admin_body_class', array( $this, 'add_body_class' ), 10, 1 );
140
  }
141
 
142
  /**
489
  return $post_id;
490
  }*/
491
 
 
 
492
  if ( isset( $_POST[ 'yit_metaboxes' ] ) ) {
493
  $yit_metabox_data = $_POST[ 'yit_metaboxes' ];
494
 
495
  if ( is_array( $yit_metabox_data ) ) {
 
496
  foreach ( $yit_metabox_data as $field_name => $field_value ) {
 
497
  if ( !add_post_meta( $post_id, $field_name, $field_value, true ) ) {
498
  update_post_meta( $post_id, $field_name, $field_value );
499
  }
 
 
500
  }
 
501
  }
 
 
502
  }
503
 
504
+ $this->sanitize_fields( $post_id );
 
 
505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
 
507
  }
508
 
509
+ /**
510
+ * Sanitize the fields of metabox.
511
+ *
512
+ * @return void
513
+ * @since 3.2.1
514
+ * @author Emanuela Castorina
515
+ */
516
+ public function sanitize_fields( $post_id ) {
517
+
518
+ $this->reorder_tabs();
519
+
520
+ foreach ( $this->tabs as $tab ) {
521
+
522
+ foreach ( $tab['fields'] as $field ) {
523
+
524
+ if ( in_array( $field['type'], array( 'title' ) ) ) {
525
+ continue;
526
+ }
527
+
528
+ if ( isset( $_POST['yit_metaboxes'][ $field['id'] ] ) ) {
529
+ if ( in_array( $field['type'], array( 'onoff', 'checkbox' ) ) ) {
530
+ update_post_meta( $post_id, $field['id'], '1' );
531
+ }elseif( in_array( $field['type'], array( 'toggle-element' ) ) ){
532
+ if ( isset( $field['elements'] ) && $field['elements'] ) {
533
+ $elements_value = $_POST['yit_metaboxes'][ $field['id'] ];
534
+ if ( $elements_value ) {
535
+ if( isset( $elements_value['box_id'])){
536
+ unset( $elements_value['box_id']);
537
+ }
538
+
539
+ foreach ( $field['elements'] as $element ) {
540
+ foreach ( $elements_value as $key => $element_value ) {
541
+ if ( isset( $field['onoff_field'] ) ) {
542
+ $elements_value[ $key ][ $field['onoff_field']['id'] ] = ! isset( $element_value[ $field['onoff_field']['id'] ] ) ? 0 : $element_value[ $field['onoff_field']['id'] ];
543
+ }
544
+ if ( in_array( $element['type'], array( 'onoff', 'checkbox' ) ) ) {
545
+ $elements_value[ $key ][ $element['id'] ] = ! isset( $element_value[ $element['id'] ] ) ? 0 : 1;
546
+ }
547
+
548
+ if ( ! empty( $element['yith-sanitize-callback'] ) && is_callable( $element['yith-sanitize-callback'] ) ) {
549
+ $elements_value[ $key ][ $element['id'] ] = call_user_func( $element['yith-sanitize-callback'], $elements_value[ $key ][ $element['id'] ] );
550
+ }
551
+ }
552
+ }
553
+ }
554
+
555
+ update_post_meta( $post_id, $field['id'], maybe_serialize( $elements_value ) );
556
+ }
557
+ } else {
558
+ $value = $_POST['yit_metaboxes'][ $field['id'] ];
559
+ if ( ! empty( $field['yith-sanitize-callback'] ) && is_callable( $field['yith-sanitize-callback'] ) ) {
560
+ $value = call_user_func( $field['yith-sanitize-callback'], $value );
561
+ }
562
+ add_post_meta( $post_id, $field['id'], $value, true ) || update_post_meta( $post_id, $field['id'], $value );
563
+ }
564
+ } elseif ( in_array( $field['type'], array( 'onoff', 'checkbox' ) ) ) {
565
+ update_post_meta( $post_id, $field['id'], '0' );
566
+ } else {
567
+ delete_post_meta( $post_id, $field['id'] );
568
+ }
569
+ }
570
+ }
571
+ }
572
+
573
  /**
574
  * Remove Fields
575
  *
586
  $this->remove_field( $field );
587
  }
588
  }
589
+
590
+
591
+ /**
592
+ * Add custom class to body
593
+ *
594
+ * It is necessary to add new style to the metaboxes
595
+ *
596
+ * @param $classes
597
+ *
598
+ * @return string
599
+ * @author Emanuela Castorina
600
+ */
601
+ public function add_body_class( $classes ) {
602
+ global $post;
603
+
604
+ $exclude_post_types = apply_filters( 'yith_plugin_fw_exclude_post_types_to_additional_classes', array( 'product' ) );
605
+
606
+ if ( $post && in_array( $post->post_type, $exclude_post_types ) ) {
607
+ return $classes;
608
+ }
609
+
610
+ $new_class = apply_filters( 'yith_plugin_fw_metabox_class', '', $post );
611
+
612
+ if ( empty( $new_class ) ) {
613
+ return $classes;
614
+ }
615
+
616
+ $classes = yith_plugin_fw_remove_duplicate_classes( $classes. ' '. $new_class);
617
+
618
+ return $classes;
619
+ }
620
+
621
+ /**
622
+ * Save the element toggle via Ajax.
623
+ *
624
+ * @return void
625
+ * @since 3.2.1
626
+ * @author Emanuela Castorina
627
+ */
628
+ public function save_toggle_element() {
629
+ if ( ! isset( $_REQUEST['post_ID'] ) ) {
630
+ return;
631
+ }
632
+
633
+ if ( !isset( $_REQUEST[ 'yit_metaboxes_nonce' ] ) || !wp_verify_nonce( $_REQUEST[ 'yit_metaboxes_nonce' ], 'metaboxes-fields-nonce' ) ) {
634
+ return;
635
+ }
636
+ $post_id = $_REQUEST['post_ID'];
637
+
638
+ if ( isset( $_REQUEST['yit_metaboxes'] ) ) {
639
+ $yit_metabox_data = $_REQUEST['yit_metaboxes'];
640
+
641
+ if ( is_array( $yit_metabox_data ) ) {
642
+ $this->sanitize_fields( $post_id );
643
+ }
644
+ } elseif ( ! isset( $_REQUEST['yit_metaboxes'] ) || ! isset( $_REQUEST['yit_metaboxes'][ $_REQUEST['toggle_id'] ] ) ) {
645
+ delete_post_meta( $post_id, $_REQUEST['toggle_id'] );
646
+ }
647
+ }
648
  }
649
  }
650
 
plugin-fw/lib/yit-plugin-licence.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( !defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
16
+ /**
17
+ * YIT Licence Panel
18
+ *
19
+ * Setting Page to Manage Products
20
+ *
21
+ * @class YIT_Licence
22
+ * @package YITH
23
+ * @since 1.0
24
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
+ */
26
+ class YIT_Plugin_Licence {
27
+ /**
28
+ * @var object The single instance of the class
29
+ * @since 1.0
30
+ */
31
+ protected static $_instance = null;
32
+
33
+ /**
34
+ * Constructor
35
+ *
36
+ * @since 1.0
37
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
38
+ */
39
+ public function __construct() {
40
+ //Silence is golden
41
+ }
42
+
43
+ /**
44
+ * Premium products registration
45
+ *
46
+ * @param $init string | The products identifier
47
+ * @param $secret_key string | The secret key
48
+ * @param $product_id string | The product id
49
+ *
50
+ * @return void
51
+ *
52
+ * @since 1.0
53
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
54
+ */
55
+ public function register( $init, $secret_key, $product_id ){
56
+ if( ! function_exists( 'YITH_Plugin_Licence' ) ){
57
+ //Try to load YITH_Plugin_Licence class
58
+ yith_plugin_fw_load_update_and_licence_files();
59
+ }
60
+
61
+ try {
62
+ YITH_Plugin_Licence()->register( $init, $secret_key, $product_id );
63
+ } catch( Error $e ){
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Main plugin Instance
69
+ *
70
+ * @static
71
+ * @return object Main instance
72
+ *
73
+ * @since 1.0
74
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
75
+ */
76
+ public static function instance() {
77
+ if ( is_null( self::$_instance ) ) {
78
+ self::$_instance = new self();
79
+ }
80
+
81
+ return self::$_instance;
82
+ }
83
+
84
+ /**
85
+ * Get license activation URL
86
+ *
87
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
88
+ * @since 3.0.17
89
+ */
90
+ public static function get_license_activation_url(){
91
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_license_activation_url() : false;
92
+ }
93
+
94
+ /**
95
+ * Get protected array products
96
+ *
97
+ * @return mixed array
98
+ *
99
+ * @since 1.0
100
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
101
+ */
102
+ public function get_products() {
103
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_products() : array();
104
+ }
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Main instance
110
+ *
111
+ * @return object
112
+ * @since 1.0
113
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
114
+ */
115
+ if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
116
+ function YIT_Plugin_Licence() {
117
+ return YIT_Plugin_Licence::instance();
118
+ }
119
+ }
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -41,6 +41,13 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
41
  */
42
  public static $wc_type = array( 'checkbox', 'textarea', 'multiselect', 'multi_select_countries', 'image_width' );
43
 
 
 
 
 
 
 
 
44
  /**
45
  * @var array
46
  */
@@ -59,6 +66,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
59
  * @author Antonio La Rocca <antonio.larocca@yithemes.com>
60
  */
61
  public function __construct( $args = array() ) {
 
62
  $args = apply_filters( 'yit_plugin_fw_wc_panel_option_args', $args );
63
  if ( !empty( $args ) ) {
64
  if ( isset( $args[ 'parent_page' ] ) && 'yit_plugin_panel' === $args[ 'parent_page' ] )
@@ -75,7 +83,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
75
  $this->links = $this->settings[ 'links' ];
76
  }
77
 
78
- add_action( 'admin_init', array( $this, 'set_default_options' ) );
79
  add_action( 'admin_menu', array( $this, 'add_setting_page' ) );
80
  add_action( 'admin_menu', array( $this, 'add_premium_version_upgrade_to_menu' ), 100 );
81
  add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
@@ -85,6 +93,12 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
85
 
86
  add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'maybe_unserialize_panel_data' ), 10, 3 );
87
 
 
 
 
 
 
 
88
 
89
  // init actions once to prevent multiple actions
90
  static::_init_actions();
@@ -130,9 +144,11 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
130
  'current_tab' => $this->get_current_tab(),
131
  'available_tabs' => $this->settings[ 'admin-tabs' ],
132
  'default_tab' => $this->get_available_tabs( true ), //get default tabs
133
- 'page' => $this->settings[ 'page' ]
 
134
  );
135
 
 
136
  $additional_info = apply_filters( 'yith_admin_tab_params', $additional_info );
137
  $additional_info[ 'additional_info' ] = $additional_info;
138
 
@@ -242,6 +258,8 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
242
  * @author Antonio La Rocca <antonio.larocca@yithemes.com>
243
  */
244
  public function add_fields() {
 
 
245
  $yit_options = $this->get_main_array_options();
246
  $current_tab = $this->get_current_tab();
247
 
@@ -462,7 +480,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
462
  global $pagenow;
463
 
464
  if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) )
465
- $admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
466
 
467
  return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
468
  }
@@ -511,6 +529,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
511
  * @since 3.0.0
512
  */
513
  public static function sanitize_option( $value, $option, $raw_value ) {
 
514
  if ( isset( $option[ 'type' ] ) && 'yith-field' === $option[ 'type' ] ) {
515
  // set empty array if is multiple
516
  if ( !empty( $option[ 'multiple' ] ) && is_null( $value ) ) {
@@ -526,7 +545,42 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
526
  $value = $raw_value;
527
  }
528
 
529
- if ( !empty( $option[ 'yith-sanitize-callback' ] ) && is_callable( $option[ 'yith-sanitize-callback' ] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  $value = call_user_func( $option[ 'yith-sanitize-callback' ], $value );
531
  }
532
  }
@@ -561,5 +615,70 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
561
  require( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-option-row.php' );
562
  }
563
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  }
565
  }
41
  */
42
  public static $wc_type = array( 'checkbox', 'textarea', 'multiselect', 'multi_select_countries', 'image_width' );
43
 
44
+ /**
45
+ * @var array a setting list of parameters
46
+ */
47
+ public static $body_class = ' yith-plugin-fw-panel ';
48
+
49
+
50
+
51
  /**
52
  * @var array
53
  */
66
  * @author Antonio La Rocca <antonio.larocca@yithemes.com>
67
  */
68
  public function __construct( $args = array() ) {
69
+
70
  $args = apply_filters( 'yit_plugin_fw_wc_panel_option_args', $args );
71
  if ( !empty( $args ) ) {
72
  if ( isset( $args[ 'parent_page' ] ) && 'yit_plugin_panel' === $args[ 'parent_page' ] )
83
  $this->links = $this->settings[ 'links' ];
84
  }
85
 
86
+ add_action( 'admin_init', array( $this, 'set_default_options' ) );
87
  add_action( 'admin_menu', array( $this, 'add_setting_page' ) );
88
  add_action( 'admin_menu', array( $this, 'add_premium_version_upgrade_to_menu' ), 100 );
89
  add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
93
 
94
  add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'maybe_unserialize_panel_data' ), 10, 3 );
95
 
96
+ //yith-plugin-ui
97
+ add_action('yith_plugin_fw_get_field_after', array($this, 'add_yith_ui') );
98
+ add_action('yith_plugin_fw_before_woocommerce_panel', array($this, 'add_plugin_banner'), 10, 1 );
99
+ add_action( 'admin_action_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
100
+ add_filter( 'yith_plugin_fw_wc_panel_pre_field_value', array( $this, 'get_toggle_element_option' ), 10, 2 );
101
+
102
 
103
  // init actions once to prevent multiple actions
104
  static::_init_actions();
144
  'current_tab' => $this->get_current_tab(),
145
  'available_tabs' => $this->settings[ 'admin-tabs' ],
146
  'default_tab' => $this->get_available_tabs( true ), //get default tabs
147
+ 'page' => $this->settings[ 'page' ],
148
+ 'wrap_class' => isset($this->settings[ 'class' ]) ? $this->settings[ 'class' ] : '',
149
  );
150
 
151
+
152
  $additional_info = apply_filters( 'yith_admin_tab_params', $additional_info );
153
  $additional_info[ 'additional_info' ] = $additional_info;
154
 
258
  * @author Antonio La Rocca <antonio.larocca@yithemes.com>
259
  */
260
  public function add_fields() {
261
+
262
+
263
  $yit_options = $this->get_main_array_options();
264
  $current_tab = $this->get_current_tab();
265
 
480
  global $pagenow;
481
 
482
  if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) )
483
+ $admin_body_classes = substr_count( $admin_body_classes, self::$body_class ) == 0 ? $admin_body_classes . self::$body_class : $admin_body_classes;
484
 
485
  return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
486
  }
529
  * @since 3.0.0
530
  */
531
  public static function sanitize_option( $value, $option, $raw_value ) {
532
+
533
  if ( isset( $option[ 'type' ] ) && 'yith-field' === $option[ 'type' ] ) {
534
  // set empty array if is multiple
535
  if ( !empty( $option[ 'multiple' ] ) && is_null( $value ) ) {
545
  $value = $raw_value;
546
  }
547
 
548
+ // sanitize the option date-format when the user choose the custom option
549
+ if ( isset( $option['yith-type'] ) && in_array( $option['yith-type'], array( 'date-format' ) ) && '\c\u\s\t\o\m' == $raw_value ) {
550
+ $custom = isset( $_REQUEST[ $option['id'] . '_text' ] ) ? $_REQUEST[ $option['id'] . '_text' ] : $option['default'];
551
+ $value = $custom;
552
+ }
553
+
554
+ if ( isset( $option['yith-type'] ) && in_array( $option['yith-type'], array( 'toggle-element' ) ) ) {
555
+
556
+ // error_log( print_r( $raw_value, true ) );
557
+
558
+ if ( $value && isset( $option['elements'] ) && ! empty( $option['elements'] ) ) {
559
+
560
+ foreach ( $value as $index => $single_toggle ) {
561
+
562
+ if ( $value && isset( $option['onoff_field'] ) && ! empty( $option['onoff_field'] ) ) {
563
+ $onoff = $option['onoff_field'];
564
+ $onoff['type'] = 'yith-field';
565
+ $onoff['yith-type'] = 'onoff';
566
+ $onoff_id = $onoff['id'];
567
+
568
+ $value[ $index ][ $onoff_id ] = isset( $single_toggle[ $onoff_id ] ) ? self::sanitize_option( $single_toggle[ $onoff_id ], $onoff, $single_toggle[ $onoff_id ] ) : 'no';
569
+ }
570
+
571
+ foreach ( $option['elements'] as $element ) {
572
+ $value[ $index ][ $element['id'] ] = self::sanitize_option( $value[ $index ][ $element['id'] ], $element, $value[ $index ][ $element['id'] ] );
573
+ }
574
+ }
575
+ }
576
+
577
+
578
+ // error_log('sanitizes value');
579
+ // error_log( print_r( $value, true ) );
580
+ }
581
+
582
+
583
+ if ( !empty( $option[ 'yith-sanitize-callback' ] ) && is_callable( $option[ 'yith-sanitize-callback' ] ) ) {
584
  $value = call_user_func( $option[ 'yith-sanitize-callback' ], $value );
585
  }
586
  }
615
  require( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-option-row.php' );
616
  }
617
  }
618
+
619
+
620
+ /**
621
+ * Return the option value for the toggle element to the filter 'yith_plugin_fw_wc_panel_pre_field_value',
622
+ * it is an array of arrays and could trigger warning if recovered using
623
+ * WC_Admin_Settings::get_option
624
+ *
625
+ * @param $value mixed
626
+ * @param $field array
627
+ *
628
+ * @return $value mixed
629
+ *
630
+ * @author Emanuela Castorina
631
+ */
632
+ public function get_toggle_element_option( $value, $field ) {
633
+ return get_option( $field[ 'id' ], $field[ 'default' ] );
634
+ }
635
+
636
+ /**
637
+ * Save the content of the toggle element present inside the panel.
638
+ * Called by the action 'admin_action_yith_plugin_fw_save_toggle_element'
639
+ * via Ajax
640
+ *
641
+ * @author Emanuela Castorina
642
+ */
643
+ public function save_toggle_element_options() {
644
+ $posted = $_POST;
645
+ $tabs = $this->get_available_tabs();
646
+ $yit_options = $this->get_main_array_options();
647
+ $current_tab = isset( $_REQUEST['tab'] ) && in_array( $_REQUEST['tab'], $tabs ) ? $_REQUEST['tab'] : $tabs[0];
648
+ $option_id = isset( $_REQUEST['toggle_id'] ) ? $_REQUEST['toggle_id'] : '';
649
+ $updated = false;
650
+
651
+ if ( ! empty( $yit_options[ $current_tab ] ) && ! empty( $option_id ) ) {
652
+
653
+ $tab_options = $yit_options[ $current_tab ];
654
+ foreach ( $tab_options as $key => $item ) {
655
+ if ( ! isset( $item['id'] ) ) {
656
+ unset( $tab_options[ $key ] );
657
+ }
658
+ }
659
+
660
+ $option_array = array_combine( wp_list_pluck( $tab_options, 'id' ), $tab_options );
661
+ if ( isset( $option_array[ $option_id ] ) ) {
662
+ $value = isset( $posted[ $option_id ] ) ? $posted[ $option_id ] : '';
663
+
664
+ //drag and drop
665
+ $order_elements = isset( $posted['yith_toggle_elements_order_keys'] ) ? explode( ',', $posted['yith_toggle_elements_order_keys'] ) : false;
666
+ if ( $order_elements ) {
667
+ $i = 0;
668
+ $new_value = array();
669
+ foreach ( $order_elements as $key ) {
670
+ $index = apply_filters('yith_toggle_elements_index', $i++, $key );
671
+ $new_value[ $index ] = $value[ $key ];
672
+ }
673
+
674
+ $value = $new_value;
675
+ }
676
+ $value = self::sanitize_option( $value, $option_array[ $option_id ], $value );
677
+ $updated = update_option( $option_id, $value );
678
+ }
679
+ }
680
+
681
+ return $updated;
682
+ }
683
  }
684
  }
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -102,6 +102,11 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
102
  }
103
 
104
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
 
 
 
 
 
105
  }
106
 
107
  /**
@@ -358,10 +363,16 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
358
  $tabs = '';
359
  $current_tab = $this->get_current_tab();
360
  $yit_options = $this->get_main_array_options();
361
-
 
 
 
 
 
362
  // tabs
363
  foreach ( $this->settings[ 'admin-tabs' ] as $tab => $tab_value ) {
364
  $active_class = ( $current_tab == $tab ) ? ' nav-tab-active' : '';
 
365
  $tabs .= '<a class="nav-tab' . $active_class . '" href="?' . $this->settings[ 'parent_page' ] . '&page=' . $this->settings[ 'page' ] . '&tab=' . $tab . '">' . $tab_value . '</a>';
366
  }
367
  ?>
@@ -402,6 +413,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
402
  <?php endif ?>
403
  </div>
404
  </div>
 
405
  <?php
406
  }
407
 
@@ -476,7 +488,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
476
  return;
477
  }
478
 
479
- if ( !empty( $this->settings[ 'admin_tabs' ] ) ) {
480
  foreach ( $this->settings[ 'admin-tabs' ] as $item => $title ) {
481
 
482
  $wp_admin_bar->add_menu( array(
@@ -938,5 +950,97 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
938
 
939
  return $menu;
940
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
941
  }
 
 
942
  }
102
  }
103
 
104
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
105
+
106
+ //yith-plugin-ui
107
+ add_action('yith_plugin_fw_before_yith_panel', array($this, 'add_plugin_banner'), 10, 1 );
108
+ add_action( 'wp_ajax_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
109
+
110
  }
111
 
112
  /**
363
  $tabs = '';
364
  $current_tab = $this->get_current_tab();
365
  $yit_options = $this->get_main_array_options();
366
+ $premium_class = isset( $this->settings['class'] ) ? 'yith-premium' : 'premium';
367
+ $wrap_class = isset( $this->settings['class'] ) ? $this->settings['class'] : '';
368
+ ?>
369
+ <div class="wrap <?php echo $wrap_class?>">
370
+ <?php
371
+ do_action('yith_plugin_fw_before_yith_panel', $this->settings[ 'page' ] );
372
  // tabs
373
  foreach ( $this->settings[ 'admin-tabs' ] as $tab => $tab_value ) {
374
  $active_class = ( $current_tab == $tab ) ? ' nav-tab-active' : '';
375
+ $active_class .= 'premium' == $tab ? ' '.$premium_class: '';
376
  $tabs .= '<a class="nav-tab' . $active_class . '" href="?' . $this->settings[ 'parent_page' ] . '&page=' . $this->settings[ 'page' ] . '&tab=' . $tab . '">' . $tab_value . '</a>';
377
  }
378
  ?>
413
  <?php endif ?>
414
  </div>
415
  </div>
416
+ </div>
417
  <?php
418
  }
419
 
488
  return;
489
  }
490
 
491
+ if ( ! empty( $this->settings[ 'admin_tabs' ] ) ) {
492
  foreach ( $this->settings[ 'admin-tabs' ] as $item => $title ) {
493
 
494
  $wp_admin_bar->add_menu( array(
950
 
951
  return $menu;
952
  }
953
+
954
+ /**
955
+ * Check if inside the admin tab there's the premium tab to
956
+ * check if the plugin is a free or not
957
+ *
958
+ * @author Emanuela Castorina
959
+ */
960
+ function is_free() {
961
+ return ( ! empty( $this->settings['admin-tabs'] ) && isset($this->settings['admin-tabs']['premium']));
962
+ }
963
+
964
+ /**
965
+ * Add plugin banner
966
+ */
967
+ public function add_plugin_banner( $page ) {
968
+
969
+ if ( $page != $this->settings['page'] || ! isset( $this->settings['class'] ) ) {
970
+ return;
971
+ }
972
+
973
+ if( $this->is_free() && isset( $this->settings['plugin_slug'] ) ):
974
+ $banners = apply_filters( 'yith_plugin_fw_banners_free', array(
975
+ 'upgrade' => array(
976
+ 'image' => YIT_CORE_PLUGIN_URL. '/assets/images/upgrade_banner.png',
977
+ 'link' => 'https://yithemes.com/themes/plugins/'.$this->settings['plugin_slug'],
978
+ ),
979
+ 'rate' => array(
980
+ 'image' => YIT_CORE_PLUGIN_URL. '/assets/images/rate_banner.png',
981
+ 'link' => 'https://wordpress.org/plugins/'.$this->settings['plugin_slug'].'/reviews/#new-post',
982
+ ),
983
+ ), $page );
984
+ ?>
985
+ <h1 class="notice-container"></h1>
986
+ <div class="yith-plugin-fw-banner yith-plugin-fw-banner-free">
987
+ <h1><?php echo esc_html( $this->settings['page_title'] ) ?></h1>
988
+ <?php if( $banners ) : ?>
989
+ <div class="yith-banners">
990
+ <ul>
991
+ <?php foreach ( $banners as $banner ): ?>
992
+ <li><a href="<?php echo esc_url( $banner['link'])?>" target="_blank"><img src="<?php echo esc_url( $banner['image'])?>"></a></li>
993
+ <?php endforeach; ?>
994
+ </ul>
995
+ </div>
996
+
997
+ <?php endif ?>
998
+ </div>
999
+ <?php else: ?>
1000
+ <h1 class="notice-container"></h1>
1001
+ <div class="yith-plugin-fw-banner">
1002
+ <h1><?php echo esc_html( $this->settings['page_title'] ) ?>
1003
+ <?php if ( isset( $this->settings['plugin_description'] ) ): ?>
1004
+ <span><?php echo esc_html( $this->settings['plugin_description'] ) ?></span>
1005
+ <?php endif ?>
1006
+ </h1>
1007
+ </div>
1008
+
1009
+ <?php endif ?>
1010
+ <?php
1011
+ }
1012
+
1013
+ /**
1014
+ * Add additional element after print the field.
1015
+ *
1016
+ *@since 3.2
1017
+ *@author Emanuela Castorina
1018
+ */
1019
+ public function add_yith_ui( $field ) {
1020
+
1021
+ global $pagenow;
1022
+
1023
+ if ( ! isset( $this->settings['class'] ) || empty( $this->settings['class'] ) || ! isset( $field['type'] ) ) {
1024
+ return;
1025
+ }
1026
+ if ( 'admin.php' === $pagenow && strpos( get_current_screen()->id, $this->settings['page'] ) !== false ) {
1027
+ switch ( $field['type'] ) {
1028
+ case 'datepicker':
1029
+ echo '<span class="yith-icon icon-calendar"></span>';
1030
+ break;
1031
+ default:
1032
+ break;
1033
+ }
1034
+ }
1035
+ }
1036
+
1037
+ /**
1038
+ *
1039
+ */
1040
+ public function save_toggle_element_options( ) {
1041
+ return true;
1042
+ }
1043
  }
1044
+
1045
+
1046
  }
plugin-fw/lib/yit-theme-licence.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( !defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
16
+ /**
17
+ * YIT Licence Panel
18
+ *
19
+ * Setting Page to Manage Products
20
+ *
21
+ * @class YIT_Licence
22
+ * @package YITH
23
+ * @since 1.0
24
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
+ */
26
+ class YIT_Theme_Licence {
27
+ /**
28
+ * @var object The single instance of the class
29
+ * @since 1.0
30
+ */
31
+ protected static $_instance = null;
32
+
33
+ /**
34
+ * Constructor
35
+ *
36
+ * @since 1.0
37
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
38
+ */
39
+ public function __construct() {
40
+ //Silence is golden
41
+ }
42
+
43
+ /**
44
+ * Premium products registration
45
+ *
46
+ * @param $init string | The products identifier
47
+ * @param $secret_key string | The secret key
48
+ * @param $product_id string | The product id
49
+ *
50
+ * @return void
51
+ *
52
+ * @since 1.0
53
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
54
+ */
55
+ public function register( $init, $secret_key, $product_id ){
56
+ if( ! function_exists( 'YITH_Theme_Licence' ) ){
57
+ //Try to load YITH_Theme_Licence class
58
+ yith_plugin_fw_load_update_and_licence_files();
59
+ }
60
+
61
+ try {
62
+ YITH_Theme_Licence()->register( $init, $secret_key, $product_id );
63
+ } catch( Error $e ){
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Main plugin Instance
69
+ *
70
+ * @static
71
+ * @return object Main instance
72
+ *
73
+ * @since 1.0
74
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
75
+ */
76
+ public static function instance() {
77
+ if ( is_null( self::$_instance ) ) {
78
+ self::$_instance = new self();
79
+ }
80
+
81
+ return self::$_instance;
82
+ }
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Main instance
88
+ *
89
+ * @return object
90
+ * @since 1.0
91
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
92
+ */
93
+ if ( !function_exists( 'YIT_Theme_Licence' ) ) {
94
+ function YIT_Theme_Licence() {
95
+ return YIT_Theme_Licence::instance();
96
+ }
97
+ }
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -24,22 +24,6 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
24
  * @see WP_Updater Class
25
  */
26
  class YIT_Upgrade {
27
-
28
- /**
29
- * @var string XML notifier update
30
- */
31
- protected $_remote_url = 'https://update.yithemes.com/plugin-xml.php';
32
-
33
- /**
34
- * @var string api server url
35
- */
36
- protected $_package_url = 'https://yithemes.com';
37
-
38
- /**
39
- * @var array The registered plugins
40
- */
41
- protected $_plugins = array();
42
-
43
  /**
44
  * @var YIT_Upgrade The main instance
45
  */
@@ -52,56 +36,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
52
  * @since 1.0
53
  */
54
  public function __construct() {
55
- add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download' ), 10, 3 );
56
- add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
57
-
58
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-
60
- $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
61
- if ( $is_debug_enabled ) {
62
- $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
- add_filter( 'block_local_requests', '__return_false' );
64
- }
65
-
66
- add_action( 'install_plugins_pre_plugin-information', array(
67
- $this,
68
- 'show_changelog_for_premium_plugins'
69
- ) );
70
- add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array(
71
- $this,
72
- 'show_changelog_for_premium_plugins'
73
- ) );
74
- }
75
-
76
- /**
77
- * show changelog for premium plugins
78
- *
79
- * @since 3.0.14
80
- */
81
- public function show_changelog_for_premium_plugins() {
82
- if ( isset( $_GET['plugin'] ) && isset( $_GET['section'] ) && 'changelog' === $_GET['section'] ) {
83
- $plugin_init = $_GET['plugin'];
84
- if ( isset( $this->_plugins[ $plugin_init ] ) ) {
85
- // this is YITH Premium Plugin
86
- if ( ! empty( $this->_plugins[ $plugin_init ]['info']['changelog'] ) ) {
87
- $plugin_name = $this->_plugins[ $plugin_init ]['info']['Name'];
88
- $changelog = $this->_plugins[ $plugin_init ]['info']['changelog'];
89
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
90
- if ( file_exists( $template ) ) {
91
- include( $template );
92
- }
93
- die();
94
- }
95
- $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
96
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
97
- if ( file_exists( $template ) ) {
98
- include( $template );
99
- } else {
100
- echo "<p>$error</p>";
101
- }
102
- die();
103
- }
104
- }
105
  }
106
 
107
  /**
@@ -116,305 +51,15 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
116
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
117
  */
118
  public function register( $plugin_slug, $plugin_init ) {
119
-
120
- if ( ! function_exists( 'get_plugins' ) ) {
121
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
122
- }
123
-
124
- $plugins = get_plugins();
125
- $plugin_info = $plugins[ $plugin_init ];
126
-
127
- $plugin = $this->_plugins[ $plugin_init ] = array(
128
- 'info' => $plugin_info,
129
- 'slug' => $plugin_slug,
130
- );
131
-
132
- $transient = 'yith_register_' . md5( $plugin_slug );
133
- if ( apply_filters( 'yith_register_delete_transient', false ) ) {
134
- delete_transient( $transient );
135
- }
136
- $info = get_transient( $transient );
137
- if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
138
- $xml = $this->get_remote_url( $plugin );
139
- $remote_xml = wp_remote_get( $xml );
140
-
141
- $error = false;
142
- if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
143
- $plugin_remote_info = function_exists( 'simplexml_load_string' ) ? @simplexml_load_string( $remote_xml['body'] ) : false;
144
- if ( $plugin_remote_info ) {
145
- $info['Latest'] = (string) $plugin_remote_info->latest;
146
- $info['changelog'] = (string) $plugin_remote_info->changelog;
147
- if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
148
- YIT_Plugin_Licence()->check( $plugin_slug, false );
149
- }
150
- set_transient( $transient, $info, DAY_IN_SECONDS );
151
- } else {
152
- $error = true;
153
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
154
- __FILE__, __FUNCTION__, $plugin_slug ) );
155
- }
156
- } else {
157
- $error = true;
158
- }
159
-
160
- if ( $error ) {
161
- // If error, set empty value in the transient to prevent multiple requests
162
- $info = array( 'Latest' => '', 'changelog' => '' );
163
- set_transient( $transient, $info, HOUR_IN_SECONDS );
164
- }
165
- }
166
-
167
- $this->_plugins[ $plugin_init ]['info']['Latest'] = $info['Latest'];
168
- $this->_plugins[ $plugin_init ]['info']['changelog'] = $info['changelog'];
169
-
170
- /* === HOOKS === */
171
- if ( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
172
- add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
173
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
174
- } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
175
- add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
176
- }
177
- }
178
-
179
- /**
180
- * Add the multisite updater scripts
181
- *
182
- * @return void
183
- *
184
- * @since 1.0
185
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
186
- * @return bool
187
- */
188
- public function multisite_updater_script() {
189
- /* === If class YIT_Plugin_Licence doesn't exists, no YITH plugins enabled === */
190
- if( ! function_exists( 'YIT_Plugin_Licence' ) ){
191
- return false;
192
- }
193
-
194
- $update_url = $changelogs = $details_url = array();
195
- $strings = array(
196
- 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
197
- 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
198
- 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
199
- 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
200
- 'update_now' => __( 'Update now.', 'yith-plugin-fw' ),
201
- 'version_issue' => __( '<br/><b>Please note:</b> You are using a higher version than the latest available one. </em>Please, make sure you\'ve downloaded the latest version of <em>%plugin_name%</em> from the only <a href="https://yithemes.com" target="_blank">YITH official website</a>, specifically, from your <a href="https://yithemes.com/my-account/recent-downloads/" target="_blank">Downloads page</a>. This is the only way to be sure the version you are using is 100% malware-free.', 'yith-plugin-fw' ),
202
- );
203
-
204
- foreach ( $this->_plugins as $init => $info ) {
205
- $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
206
- $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
207
- }
208
-
209
- $localize_script_args = array(
210
- 'registered' => $this->_plugins,
211
- 'activated' => YIT_Plugin_Licence()->get_activated_products(),
212
- 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
213
- 'update_url' => $update_url,
214
- 'details_url' => $details_url,
215
- 'strings' => $strings,
216
- );
217
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
218
-
219
- if( defined( 'YIT_CORE_PLUGIN_URL' ) ){
220
- yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
221
- }
222
-
223
- wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
224
- }
225
-
226
- public function admin_enqueue_scripts() {
227
- global $pagenow;
228
- if ( 'plugins.php' === $pagenow && defined( 'YIT_CORE_PLUGIN_URL' ) ) {
229
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
230
- wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
231
- wp_enqueue_script( 'yith-update-plugins', YIT_CORE_PLUGIN_URL . '/assets/js/yith-update-plugins' . $suffix . '.js', array( 'jquery' ), false, true );
232
-
233
- $update_plugins_localized = array(
234
- 'ajax_nonce' => wp_create_nonce( 'updates' ),
235
- 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
236
- 'l10n' => array(
237
- /* translators: %s: Plugin name and version */
238
- 'updating' => _x( 'Updating %s...', 'plugin-fw', 'yith-plugin-fw' ), // No ellipsis.
239
- /* translators: %s: Plugin name and version */
240
- 'updated' => _x( '%s updated!', 'plugin-fw', 'yith-plugin-fw' ),
241
- /* translators: %s: Plugin name and version */
242
- 'failed' => _x( '%s update failed', 'plugin-fw', 'yith-plugin-fw' ),
243
- ),
244
- );
245
-
246
- wp_localize_script( 'yith-update-plugins', 'yith_plugin_fw', $update_plugins_localized );
247
- }
248
- }
249
-
250
- /**
251
- * Retrive the zip package file
252
- *
253
- * @param bool $reply Whether to bail without returning the package. Default false.
254
- * @param string $package The package file name.
255
- * @param \WP_Upgrader $upgrader WP_Upgrader instance.
256
- *
257
- * @return string | The download file
258
- *
259
- * @since 1.0
260
- * @see wp-admin/includes/class-wp-upgrader.php
261
- * @access public
262
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
263
- */
264
- public function upgrader_pre_download( $reply, $package, $upgrader ) {
265
- /* === If class YIT_Plugin_Licence doesn't exists, no YITH plugins enabled === */
266
- if( ! function_exists( 'YIT_Plugin_Licence' ) ){
267
- return $reply;
268
- }
269
-
270
- $plugin = false;
271
- $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
272
- $is_bulk_ajax = $upgrader->skin instanceof WP_Ajax_Upgrader_Skin;
273
-
274
- if ( ! $is_bulk && ! $is_bulk_ajax ) {
275
- //Bulk Action: Support for old WordPress Version
276
- $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
277
- }
278
-
279
- elseif( $is_bulk_ajax ){
280
- //Bulk Update for WordPress 4.9 or greater
281
- if( ! empty( $_POST['plugin'] ) ){
282
- $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) );
283
- }
284
- }
285
-
286
- else {
287
- //Bulk action upgrade
288
- $action_url = parse_url( $upgrader->skin->options['url'] );
289
- parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ), $output );
290
- $plugins = isset( $output['plugins'] ) ? $output['plugins'] : '';
291
- $plugins = explode( ',', $plugins );
292
- foreach ( $plugins as $plugin_init ) {
293
- $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
294
- if ( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ) {
295
- $plugin = $plugin_init;
296
- }
297
- }
298
- }
299
-
300
- /**
301
- * It isn't YITH Premium plugins, please wordpress update it for me!
302
- */
303
- if ( ! $plugin ) {
304
- return $reply;
305
- }
306
-
307
- $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
308
-
309
- /**
310
- * False ? It isn't YITH Premium plugins, please wordpress update it for me!
311
- */
312
- if ( false === $plugin_info ) {
313
- return $reply;
314
- }
315
-
316
- $licence = YIT_Plugin_Licence()->get_licence();
317
- $product_id = $plugin_info['product_id'];
318
-
319
- if( empty( $licence[ $product_id ] ) ){
320
- return new WP_Error( 'license_not_valid', _x( 'You have to activate the plugin to benefit from automatic updates.', '[Update Plugin Message: License not enabled]', 'yith-plugin-fw' ) );
321
- }
322
-
323
- $args = array(
324
- 'email' => $licence[ $product_id ]['email'],
325
- 'licence_key' => $licence[ $product_id ]['licence_key'],
326
- 'product_id' => $plugin_info['product_id'],
327
- 'secret_key' => $plugin_info['secret_key'],
328
- 'instance' => YIT_Plugin_Licence()->get_home_url(),
329
- 'wc-api' => 'download-api',
330
- 'request' => 'download'
331
- );
332
-
333
- if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
334
- //Local file or remote?
335
- return $package;
336
- }
337
-
338
- if ( empty( $package ) ) {
339
- return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
340
- }
341
-
342
- $upgrader->skin->feedback( 'downloading_package', __( 'YITH Repository', 'yith-plugin-fw' ) );
343
-
344
- $download_file = $this->_download_url( $package, $args );
345
-
346
- /**
347
- * Regenerate update_plugins transient
348
- */
349
- yith_plugin_fw_force_regenerate_plugin_update_transient();
350
-
351
- if ( is_wp_error( $download_file ) ) {
352
- return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
353
  }
354
 
355
- return $download_file;
356
- }
357
-
358
- /**
359
- * Retrieve the temp filename
360
- *
361
- * @param string $url The package url
362
- * @param string $body The post data fields
363
- * @param int $timeout Execution timeout (default: 300)
364
- *
365
- * @return string | The temp filename
366
- *
367
- * @since 1.0
368
- * @see wp-admin/includes/class-wp-upgrader.php
369
- * @access protected
370
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
371
- */
372
- protected function _download_url( $url, $body, $timeout = 300 ) {
373
-
374
- //WARNING: The file is not automatically deleted, The script must unlink() the file.
375
- if ( ! $url ) {
376
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yith-plugin-fw' ) );
377
- }
378
-
379
- $tmpfname = wp_tempnam( $url );
380
-
381
- $args = array(
382
- 'timeout' => $timeout,
383
- 'stream' => true,
384
- 'filename' => $tmpfname,
385
- 'body' => $body
386
- );
387
-
388
- if ( ! $tmpfname ) {
389
- return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yith-plugin-fw' ) );
390
- }
391
-
392
- $response = wp_safe_remote_post( $url, $args );
393
-
394
- if ( is_wp_error( $response ) ) {
395
- unlink( $tmpfname );
396
-
397
- return $response;
398
- }
399
-
400
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
401
- unlink( $tmpfname );
402
-
403
- return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
404
- }
405
-
406
- $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
407
-
408
- if ( $content_md5 ) {
409
- $md5_check = verify_file_md5( $tmpfname, $content_md5 );
410
- if ( is_wp_error( $md5_check ) ) {
411
- unlink( $tmpfname );
412
-
413
- return $md5_check;
414
- }
415
- }
416
-
417
- return $tmpfname;
418
  }
419
 
420
  /**
@@ -433,292 +78,6 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
433
 
434
  return self::$_instance;
435
  }
436
-
437
- /**
438
- * Delete the update plugins transient
439
- *
440
- * @return void
441
- *
442
- * @since 1.0
443
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
444
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
445
- * @deprecated From version 3.1.12
446
- */
447
- public function force_regenerate_update_transient() {
448
- delete_site_transient( 'update_plugins' );
449
- }
450
-
451
- /**
452
- * Check for plugins update
453
- *
454
- * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
455
- *
456
- * @param mixed $transient | update_plugins transient value
457
- * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
458
- *
459
- * @return mixed $transient | The new update_plugins transient value
460
- *
461
- * @since 1.0
462
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
463
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
464
- */
465
- public function check_update( $transient, $save = false ) {
466
-
467
- foreach ( $this->_plugins as $init => $plugin ) {
468
- $plugin_slug = $this->_plugins[ $init ]['slug'];
469
- $xml = $this->get_remote_url( $plugin );
470
- $remote_xml = wp_remote_get( $xml );
471
-
472
- if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
473
-
474
- $plugin_remote_info = function_exists( 'simplexml_load_string' ) ? @simplexml_load_string( $remote_xml['body'] ) : false;
475
-
476
- if ( $plugin_remote_info ) {
477
- $wrong_current_version_check = version_compare( $plugin['info']['Version'], $plugin_remote_info->latest, '>' );
478
- $update_available = version_compare( $plugin_remote_info->latest, $plugin['info']['Version'], '>' );
479
-
480
- if ( ( $update_available || $wrong_current_version_check ) && ! isset( $transient->response[ $init ] ) ) {
481
-
482
- $package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
483
-
484
- $tested_up_to = (string) str_replace( '.x', '', $plugin_remote_info->{"up-to"} );
485
- $tested_up_to = preg_replace( '/-.*$/', '', $tested_up_to );
486
- $wp_version = preg_replace( '/-.*$/', '', get_bloginfo( 'version' ) );
487
-
488
- if( strpos( $wp_version, $tested_up_to ) !== false ){
489
- $tested_up_to = $wp_version;
490
- }
491
- $obj = new stdClass();
492
- $obj->slug = (string) $init;
493
- $obj->new_version = (string) $plugin_remote_info->latest;
494
- $obj->changelog = (string) $plugin_remote_info->changelog;
495
- $obj->package = $package;
496
- $obj->plugin = $init;
497
- $obj->tested = $tested_up_to;
498
-
499
- if( ! empty( $plugin_remote_info->icons ) ){
500
- $obj->icons = (array) $plugin_remote_info->icons;
501
- }
502
-
503
- $transient->response[ $init ] = $obj;
504
- }
505
-
506
- } else {
507
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
508
- __FILE__, __FUNCTION__, $plugin_slug ) );
509
-
510
- return $transient;
511
- }
512
- }
513
- }
514
-
515
- if ( $save ) {
516
- set_site_transient( 'update_plugins', $transient );
517
- }
518
-
519
- return $transient;
520
- }
521
-
522
- /**
523
- * Add the plugin update row in plugin page
524
- *
525
- * @return void
526
- * @fire "in_theme_update_message-{$init}" action
527
- *
528
- * @since 1.0
529
- * @see after_plugin_row_{$init} action
530
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
531
- */
532
- public function plugin_update_row() {
533
-
534
- $current = get_site_transient( 'update_plugins' );
535
- $init = str_replace( 'after_plugin_row_', '', current_filter() );
536
- $update_now_class = apply_filters( 'yith_plugin_fw_update_now_class', '' );
537
- $update_now_class = trim( $update_now_class . ' yith-update-link update-link' );
538
-
539
- if ( ! isset( $current->response[ $init ] ) ) {
540
- return false;
541
- }
542
-
543
- /**
544
- * stdClass Object
545
- */
546
- $r = $current->response[ $init ];
547
-
548
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
549
- $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
550
-
551
- /**
552
- * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
553
- */
554
- $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
555
-
556
- global $wp_version;
557
- $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
558
-
559
- echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
560
-
561
- echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
562
-
563
- echo( $is_wp_4_6 ? '<p>' : '' );
564
-
565
- if ( ! current_user_can( 'update_plugins' ) ) {
566
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
567
- }
568
-
569
- elseif ( is_plugin_active_for_network( $init ) ) {
570
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
571
- }
572
-
573
- elseif ( empty( $r->package ) ) {
574
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
575
- }
576
-
577
- else {
578
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s" class="%6$s" data-plugin="%7$s" data-slug="%8$s" data-name="%1$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ), $update_now_class, $init, $this->_plugins[ $init ]['slug'] );
579
- }
580
-
581
- if( version_compare( $this->_plugins[ $init ]['info']['Version'] , $r->new_version, '>' ) ){
582
- printf( __( '<br/><b>Please note:</b> You are using a higher version than the latest available one. </em>Please, make sure you\'ve downloaded the latest version of <em>%1$s</em> from the only <a href="https://yithemes.com" target="_blank">YITH official website</a>, specifically, from your <a href="https://yithemes.com/my-account/recent-downloads/" target="_blank">Downloads page</a>. This is the only way to be sure the version you are using is 100%% malware-free.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
583
- }
584
-
585
-
586
- echo( $is_wp_4_6 ? '</p>' : '' );
587
-
588
- /**
589
- * Fires at the end of the update message container in each
590
- * row of the themes list table.
591
- *
592
- * The dynamic portion of the hook name, `$theme_key`, refers to
593
- * the theme slug as found in the WordPress.org themes repository.
594
- *
595
- * @since Wordpress 3.1.0
596
- * }
597
- */
598
- do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
599
-
600
- echo '</div></td></tr>';
601
- }
602
-
603
- /**
604
- * Remove the standard plugin_update_row
605
- *
606
- * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
607
- *
608
- * @return void
609
- * @fire "in_theme_update_message-{$init}" action
610
- *
611
- * @since 1.0
612
- * @see after_plugin_row_{$init} action
613
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
614
- */
615
- public function remove_wp_plugin_update_row() {
616
- foreach ( $this->_plugins as $init => $plugin ) {
617
- remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
618
- add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
619
- }
620
- }
621
-
622
- public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
623
- $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
624
- <div class='yit-plugin-changelog'>
625
- <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
626
- <p>{$changelog}</p>
627
- </div>
628
- </div>";
629
-
630
- if ( $echo ) {
631
- echo $res;
632
- } else {
633
- return $res;
634
- }
635
- }
636
-
637
- /**
638
- * Auto-Update Plugin in multisite
639
- *
640
- * Manage the non standard upgrade-plugin-multisite action
641
- *
642
- * @return void
643
- *
644
- * @since 1.0
645
- * @see upgrade-plugin action
646
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
647
- */
648
- public function upgrade_plugin_multisite() {
649
-
650
- $plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
651
- $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
652
-
653
- if ( 'upgrade-plugin-multisite' != $action ) {
654
- wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
655
- }
656
-
657
- if ( ! current_user_can( 'update_plugins' ) ) {
658
- wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
659
- }
660
-
661
- $this->check_update( get_site_transient( 'update_plugins' ), true );
662
-
663
- check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
664
-
665
- $title = __( 'Update Plugin', 'yith-plugin-fw' );
666
- $parent_file = 'plugins.php';
667
- $submenu_file = 'plugins.php';
668
-
669
- wp_enqueue_script( 'updates' );
670
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
671
-
672
- $nonce = 'upgrade-plugin-multisite_' . $plugin;
673
- $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
674
-
675
- $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
676
- $upgrader->upgrade( $plugin );
677
-
678
- include( ABSPATH . 'wp-admin/admin-footer.php' );
679
- }
680
-
681
- /**
682
- * Retreive the remote url with query string args
683
- *
684
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
685
- * @return string the remote url
686
- */
687
- public function get_remote_url( $plugin_info ) {
688
-
689
- $license = $is_membership_license = false;
690
- $slug = isset( $plugin_info['slug'] ) ? $plugin_info['slug'] : false;
691
-
692
- if( function_exists( 'YIT_Plugin_Licence' ) && false !== $slug ){
693
- //Get license for YITH Plugins
694
- $enabled_license = YIT_Plugin_Licence()->get_licence();
695
-
696
- if( isset( $enabled_license[ $slug ]['activated'] ) && false !== $enabled_license[ $slug ]['activated'] ){
697
- if( isset( $enabled_license[ $slug ]['licence_key'] ) ){
698
- $license = $enabled_license[ $slug ]['licence_key'];
699
- }
700
-
701
- if( isset( $enabled_license[ $slug ]['is_membership'] ) ){
702
- $is_membership_license = $enabled_license[ $slug ]['is_membership'];
703
- }
704
- }
705
- }
706
-
707
- $args = array(
708
- 'plugin' => $slug,
709
- 'instance' => md5( $_SERVER['SERVER_NAME'] ),
710
- 'license' => $license,
711
- 'is_membership_license' => $is_membership_license,
712
- 'server_ip' => $_SERVER['SERVER_ADDR'],
713
- 'version' => isset( $plugin_info['info']['Version'] ) ? $plugin_info['info']['Version'] : '1.0.0'
714
- );
715
-
716
- $args = apply_filters( 'yith_get_remove_url_args', $args );
717
-
718
- $url = add_query_arg( $args, $this->_remote_url );
719
-
720
- return $url;
721
- }
722
  }
723
  }
724
 
24
  * @see WP_Updater Class
25
  */
26
  class YIT_Upgrade {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  /**
28
  * @var YIT_Upgrade The main instance
29
  */
36
  * @since 1.0
37
  */
38
  public function __construct() {
39
+ //Silence is golden...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  /**
51
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
52
  */
53
  public function register( $plugin_slug, $plugin_init ) {
54
+ if( ! function_exists( 'YITH_Plugin_Upgrade' ) ){
55
+ //Try to load YITH_Plugin_Upgrade class
56
+ yith_plugin_fw_load_update_and_licence_files();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
+ try {
60
+ YITH_Plugin_Upgrade()->register( $plugin_slug, $plugin_init );
61
+ } catch( Error $e ){
62
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
 
65
  /**
78
 
79
  return self::$_instance;
80
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
  }
83
 
plugin-fw/licence/assets/css/yit-licence.css DELETED
@@ -1,461 +0,0 @@
1
- /* === Plugins Upgrader === */
2
-
3
- .yit-plugin-changelog-wrapper {
4
- display: none;
5
- }
6
-
7
- .yit-plugin-changelog-title {
8
- text-transform: uppercase;
9
- }
10
-
11
- .yit-plugin-changelog {
12
- height : calc(100% - 15px);
13
- width : calc(100% - 15px);
14
- overflow-x : hidden;
15
- overflow-y : auto;
16
- z-index : 999;
17
- background: #fcfcfc;
18
- }
19
-
20
- /* === Plugins Licence Activation === */
21
-
22
- .yit-container.product-licence-activation {
23
- font-family: 'Raleway', sans-serif;
24
- }
25
-
26
- .yit-container.product-licence-activation .to-active-wrapper {
27
- margin-bottom: 60px;
28
- max-width: 900px;
29
- }
30
-
31
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form {
32
- position: relative;
33
- border-color: #e1e1e1;
34
- border-style: solid;
35
- border-width: 0;
36
- }
37
-
38
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:first-child {
39
- border-top-width: 1px;
40
- }
41
-
42
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:last-child {
43
- border-bottom-width: 1px;
44
- }
45
-
46
- .yit-container.product-licence-activation .to-active-wrapper table.to-active-table {
47
- border-width: 0;
48
- border-spacing: 0;
49
- width: 100%;
50
- }
51
-
52
- .yit-container.product-licence-activation .message {
53
- display: none;
54
- line-height: normal;
55
- background: #ffffff url(../images/licence-error.png) 15px center no-repeat;
56
- padding-left: 65px;
57
- padding-right: 15px;
58
- width: 150px;
59
- }
60
-
61
- .yit-container.product-licence-activation .message-wrapper {
62
- height: 75px;
63
- display: none;
64
- position: absolute;
65
- top: 0;
66
- right: -250px;
67
- border: 1px solid #ff3838;
68
- }
69
-
70
- .yit-container.product-licence-activation .message-wrapper.visible {
71
- display: table;
72
- }
73
-
74
- .yit-container.product-licence-activation .message {
75
- display: table-cell;
76
- vertical-align: middle;
77
- }
78
-
79
- .yit-container.product-licence-activation .arrow-left:after,
80
- .yit-container.product-licence-activation .arrow-left:before {
81
- content: "";
82
- display: block;
83
- width: 0;
84
- height: 0;
85
- position: absolute;
86
- }
87
-
88
- .yit-container.product-licence-activation .arrow-left:before {
89
- border-top: 9px solid transparent;
90
- border-bottom: 9px solid transparent;
91
- border-right: 9px solid #ff3838;
92
- top: 26px;
93
- left: -9px;
94
- }
95
-
96
- .yit-container.product-licence-activation .arrow-left:after {
97
- border-top: 8px solid transparent;
98
- border-bottom: 8px solid transparent;
99
- border-right: 8px solid #fff;
100
- left: -8px;
101
- top: 27px;
102
- }
103
-
104
- .yit-container.product-licence-activation h2,
105
- .yit-container.product-licence-activation h3 {
106
- text-transform: uppercase;
107
- font-weight: 800;
108
- margin-bottom: 30px;
109
- }
110
-
111
- .yit-container.product-licence-activation h2 {
112
- color: #808a97;
113
- font-size: 25px;
114
- }
115
- .yit-container.product-licence-activation h3 {
116
- color: #313131;
117
- font-size: 15px;
118
- height: 20px;
119
- }
120
-
121
- .yit-container.product-licence-activation h3.to-active {
122
- height: 20px;
123
- position: relative;
124
- vertical-align: top;
125
- }
126
-
127
- .yit-container.product-licence-activation .spinner{
128
- vertical-align: -5px;
129
- float: none;
130
- }
131
-
132
- .yit-container.product-licence-activation .spinner.show{
133
- visibility: visible;
134
- }
135
-
136
- .yit-container.product-licence-activation .licence-check-section{
137
- margin-bottom: 20px;
138
- margin-top: 20px;
139
- background-color: #ffffff;
140
- padding: 10px;
141
- max-width: 670px;
142
- }
143
-
144
- .yit-container.product-licence-activation span.licence-label {
145
- font-weight: 500;
146
- color: #606060;
147
- margin-bottom: 20px;
148
- }
149
-
150
- .yit-container.product-licence-activation .button-licence {
151
- border: 0;
152
- font-size: 13px;
153
- text-transform: uppercase;
154
- background-color: #808a97;
155
- color: #fff;
156
- font-weight: 700;
157
- border-radius: 3px;
158
- cursor: pointer;
159
- text-decoration: none;
160
- padding: 5px 7px;
161
- -webkit-transition: background-color 0.3s ease;
162
- -moz-transition: background-color 0.3s ease;
163
- -ms-transition: background-color 0.3s ease;
164
- -o-transition: background-color 0.3s ease;
165
- transition: background-color 0.3s ease;
166
- }
167
-
168
- .yit-container.product-licence-activation .button-licence:hover {
169
- background-color: #4d5c6f;
170
- }
171
-
172
- .yit-container.product-licence-activation .button-licence.clicked {
173
- cursor: not-allowed;
174
- background-color: #e2e2e2 !important;
175
- }
176
-
177
- .yit-container.product-licence-activation .button-licence.licence-check {
178
- font-weight: 400;
179
- padding: 12px 19px;
180
- }
181
-
182
- .yit-container.product-licence-activation .button-licence.licence-deactive,
183
- .yit-container.product-licence-activation .button-licence.licence-renew {
184
- text-decoration: none;
185
- padding: 7px 12px;
186
- font-size: 9px;
187
- }
188
-
189
- .yit-container.product-licence-activation table:not(.expired-table) .button-licence.licence-renew {
190
- margin-left: 10px;
191
- }
192
-
193
- .yit-container.product-licence-activation .button-licence.licence-deactive:focus,
194
- .yit-container.product-licence-activation .button-licence.licence-renew:focus {
195
- box-shadow: none;
196
- }
197
-
198
- .yit-container.product-licence-activation table:not(.to-active-table) {
199
- width: auto;
200
- border: 1px solid #dcdcdc;
201
- border-spacing: 0;
202
- border-radius: 5px;
203
- border-collapse: separate;
204
- overflow: hidden;
205
- }
206
-
207
- .yit-container.product-licence-activation table:not(.to-active-table) th {
208
- border-bottom: 1px solid #dcdcdc;
209
- padding: 0 10px;
210
- }
211
-
212
- .yit-container.product-licence-activation table tbody tr td.product-licence-key {
213
- text-transform: lowercase;
214
- }
215
-
216
- .yit-container.product-licence-activation table:not(.to-active-table) td,
217
- .yit-container.product-licence-activation table:not(.to-active-table) th {
218
- border-right: 1px solid #dcdcdc;
219
- }
220
-
221
- .yit-container.product-licence-activation table:not(.to-active-table) th{
222
- color: #808a97;
223
- font-weight: bold;
224
- }
225
-
226
- .yit-container.product-licence-activation table td:last-child,
227
- .yit-container.product-licence-activation table th:last-child {
228
- border-right: 0;
229
- }
230
-
231
- .yit-container.product-licence-activation table thead tr {
232
- background-color: #f6f4f4;
233
- }
234
-
235
- .yit-container.product-licence-activation table tbody tr {
236
- background-color: #ffffff;
237
- }
238
-
239
- .yit-container.product-licence-activation table tbody tr:nth-child(2n) {
240
- background-color: #f4f4f4;
241
- }
242
-
243
- .yit-container.product-licence-activation table thead tr th {
244
- font-size: 11px;
245
- color: #313131;
246
- text-transform: uppercase;
247
- font-weight: bold;
248
- }
249
-
250
- .yit-container.product-licence-activation table thead tr,
251
- .yit-container.product-licence-activation table tbody tr {
252
- line-height: 60px;
253
- }
254
-
255
- .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-no-alt {
256
- color: #b20015;
257
- }
258
-
259
- .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-yes {
260
- color: #1ca800;
261
- }
262
-
263
- .yit-container.product-licence-activation table tbody tr td{
264
- text-align: center;
265
- line-height: 20px;
266
- padding: 10px 5px;
267
- }
268
-
269
- .yit-container.product-licence-activation .button-licence.licence-activation {
270
- padding: 12px 18px;
271
- }
272
-
273
- .yit-container.product-licence-activation .to-active-table tr {
274
- line-height: 75px;
275
- }
276
-
277
- .yit-container.product-licence-activation .to-active-table tr.product-row {
278
- background-color: transparent;
279
- -webkit-transition: all 0.3s ease;
280
- -moz-transition: all 0.3s ease;
281
- -ms-transition: all 0.3s ease;
282
- -o-transition: all 0.3s ease;
283
- transition: all 0.3s ease;
284
- }
285
-
286
- .yit-container.product-licence-activation .to-active-table tr.product-row.error {
287
- background-color: #ffdcdc;
288
- }
289
-
290
- .yit-container.product-licence-activation .to-active-table td {
291
- padding-right: 12px;
292
- width: 33%;
293
- }
294
-
295
- .yit-container.product-licence-activation td.product-name {
296
- color: #808a97;
297
- font-size: 12px;
298
- text-transform: uppercase;
299
- font-weight: bold;
300
- line-height: 20px;
301
- padding: 10px 20px;
302
- }
303
-
304
- .yit-container.product-licence-activation .to-active-table td.product-name {
305
- width: 20%;
306
- }
307
-
308
- .yit-container.product-licence-activation .to-active-table td.activate-button {
309
- width: 15%;
310
- position: relative;
311
- }
312
-
313
- .yit-container.product-licence-activation input[type=text],
314
- .yit-container.product-licence-activation input[type=email]{
315
- -webkit-transition: all 0.3s ease;
316
- -moz-transition: all 0.3s ease;
317
- -ms-transition: all 0.3s ease;
318
- -o-transition: all 0.3s ease;
319
- transition: all 0.3s ease;
320
-
321
- border: 1px solid #dcdcdc;
322
- padding: 0 15px;
323
- border-radius: 3px;
324
- height: 41px;
325
- width: 100%;
326
- }
327
-
328
- .yit-container.product-licence-activation input[type=text].require,
329
- .yit-container.product-licence-activation input[type=email].require {
330
- border: 1px solid #ff3838;
331
- }
332
-
333
- .yit-container.product-licence-activation input[type=text]:focus,
334
- .yit-container.product-licence-activation input[type=email]:focus{
335
- webkit-box-shadow: 0 0 1px rgba(30,140,190,.8);
336
- box-shadow: 0 0 1px rgba(30,140,190,.8);
337
- }
338
-
339
- .yit-container.product-licence-activation input[type=text],
340
- .yit-container.product-licence-activation input[type=email]{
341
- text-transform: uppercase;
342
- text-align: center;
343
- }
344
-
345
- .yit-container.product-licence-activation input[type=submit]:focus{
346
- outline: 0;
347
- }
348
-
349
- /* Licence FAQ */
350
- .yit-container.product-licence-activation .activation-faq {
351
- background: #ffffff;
352
- margin-bottom: 20px;
353
- border: 1px solid #dcdcdc;
354
- padding: 0 15px;
355
- border-radius: 3px;
356
- }
357
-
358
- .yit-container.product-licence-activation .activation-faq h3{
359
- color: #808a97;
360
- }
361
-
362
- #yith-licence-notice {
363
- margin-left: 0;
364
- visibility: hidden;
365
- min-height: 38px;
366
- max-width: 660px;
367
- }
368
-
369
- #yith-licence-notice.visible {
370
- visibility: visible;
371
- }
372
-
373
- #yith-licence-issue-how-to{
374
- margin: 20px 10px 20px 0;
375
- font-weight: 500;
376
- color: #606060;
377
- }
378
-
379
- #yith-licence-actions span.dashicons{
380
- line-height: 60px;
381
- }
382
-
383
- /* === Responsive === */
384
-
385
- @media (max-width: 767px) {
386
- .yit-container.product-licence-activation .activation-faq {
387
- margin-right: 5px;
388
- }
389
- }
390
-
391
- @media (max-width: 480px) {
392
- .yit-container.product-licence-activation .activation-faq {
393
- margin-right: 5px;
394
- }
395
- }
396
-
397
- @media (min-width: 768px) and (max-width: 992px) {
398
- .yit-container.product-licence-activation .button-licence.licence-deactive,
399
- .yit-container.product-licence-activation .button-licence.licence-renew {
400
- margin-bottom: 10px;
401
- display: block;
402
- margin-left: 0;
403
- padding: 5px 7px;
404
- }
405
-
406
- .yit-container.product-licence-activation .button-licence.licence-deactive {
407
- margin-bottom: 10px;
408
- }
409
-
410
- .yit-container.product-licence-activation table:not(.to-active-table) th {
411
- line-height: 20px;
412
- }
413
-
414
- .yit-container.product-licence-activation table tbody tr td {
415
- padding: 5px;
416
- }
417
-
418
- .yit-container.product-licence-activation .activation-faq {
419
- margin-right: 20px;
420
- }
421
- }
422
-
423
- @media (min-width: 980px) and (max-width: 1199px) {
424
- .yit-container.product-licence-activation .button-licence.licence-deactive,
425
- .yit-container.product-licence-activation .button-licence.licence-renew {
426
- display: block;
427
- margin-left: 0;
428
- padding: 5px 7px;
429
- }
430
-
431
- .yit-container.product-licence-activation .button-licence.licence-renew {
432
- margin-top: 10px;
433
- }
434
-
435
- .yit-container.product-licence-activation table:not(.to-active-table) th {
436
- line-height: 20px;
437
- }
438
-
439
- .yit-container.product-licence-activation table tbody tr td {
440
- padding: 5px;
441
- }
442
-
443
- .yit-container.product-licence-activation .activation-faq {
444
- width: 75%;
445
- }
446
- }
447
-
448
- @media (min-width: 1200px) {
449
- .yit-container.product-licence-activation{
450
- width: auto;
451
- }
452
-
453
- .yit-container.product-licence-activation .activation-faq {
454
- width: 50%;
455
- }
456
- }
457
-
458
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
459
- only screen and (-o-min-device-pixel-ratio: 3/2),
460
- only screen and (min--moz-device-pixel-ratio: 1.5),
461
- only screen and (min-device-pixel-ratio: 1.5) {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/licence/assets/images/licence-error.png DELETED
Binary file
plugin-fw/licence/assets/js/yit-licence.js DELETED
@@ -1,215 +0,0 @@
1
- /**
2
- * This file belongs to the YIT Plugin Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
-
11
- ( function ( $ ) {
12
-
13
- /* === Licence API === */
14
-
15
- var licence_activation = function ( button ) {
16
- button.on( 'click', function ( e, button ) {
17
- e.preventDefault();
18
-
19
- var t = $( this ),
20
- form_id = t.data( 'formid' ),
21
- form = $( '#' + form_id ),
22
- data = form.serialize(),
23
- message = $( form ).find( '.message' ),
24
- message_wrapper = $( form ).find( '.message-wrapper' ),
25
- email = form.find( '.user-email' ),
26
- licence_key = form.find( '.licence-key' ),
27
- email_val = form.find( '.user-email' ).val(),
28
- licence_key_val = form.find( '.licence-key' ).val(),
29
- error = false,
30
- error_fields = new Array(),
31
- product_row = form.find( '.product-row' ),
32
- licence_activation = $( '.licence-activation' ),
33
- spinner = $( '#products-to-active' ).find( '.spinner' ),
34
- is_mail = function( val ){
35
- /* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */
36
- var re = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
37
- return re.test( val );
38
- };
39
-
40
- /* Init Input Fields */
41
- message.empty();
42
- message_wrapper.removeClass( 'visible' );
43
- email.removeClass( 'require' );
44
- licence_key.removeClass( 'require' );
45
- product_row.removeClass( 'error' );
46
- spinner.addClass( 'show' );
47
- t.add( licence_activation ).prop( "disabled", true ).addClass( 'clicked' );
48
-
49
- if ( '' === email_val || ! is_mail( email_val ) ) {
50
- error = true;
51
- email.addClass( 'require' );
52
-
53
- if( '' === email_val ){
54
- error_fields[ error_fields.length ] = licence_message.email;
55
- }
56
-
57
- else {
58
- error_fields[ error_fields.length ] = licence_message.email;
59
- }
60
-
61
- }
62
-
63
- if ( '' === licence_key_val ) {
64
- error = true;
65
- error_fields[ error_fields.length ] = licence_message.license_key;
66
- licence_key.addClass( 'require' );
67
- }
68
-
69
- if ( false === error ) {
70
- jQuery.ajax( {
71
- type : 'POST',
72
- url : typeof ajaxurl != 'undefined' ? ajaxurl : yith_ajax.url,
73
- data : data,
74
- success: function ( response ) {
75
-
76
- spinner.removeClass( 'show' );
77
- t.add( licence_activation ).prop( "disabled", false ).removeClass( 'clicked' );
78
-
79
- if ( true === response.activated ) {
80
- $( '.product-licence-activation' ).empty().replaceWith( response.template );
81
- licence_api();
82
- } else if ( false !== response && typeof response.error !== 'undefined' ) {
83
- message.text( response.error );
84
- message_wrapper.addClass( 'visible' );
85
- product_row.addClass( 'error' );
86
- } else {
87
- message.text( licence_message.server );
88
- message_wrapper.addClass( 'visible' );
89
- product_row.addClass( 'error' );
90
- }
91
-
92
- if ( typeof response.debug !== 'undefined' ) {
93
- console.log( response.debug );
94
- }
95
- }
96
- } );
97
- } else {
98
- if ( error_fields.length == 1 ) {
99
- message.text( licence_message.error.replace( '%field%', error_fields[ 0 ] ) );
100
- message_wrapper.addClass( 'visible' );
101
- product_row.addClass( 'error' );
102
- } else {
103
- var message_text = licence_message.errors;
104
- for ( var i = 0; i < error_fields.length; i++ ) {
105
- message_text = message_text.replace( '%field_' + ( i + 1 ) + '%', error_fields[ i ] );
106
- message_wrapper.addClass( 'visible' );
107
- }
108
- message.text( message_text );
109
- message_wrapper.addClass( 'visible' );
110
- product_row.addClass( 'error' );
111
- }
112
-
113
- spinner.removeClass( 'show' );
114
- t.add( licence_activation ).prop( "disabled", false ).removeClass( 'clicked' );
115
- }
116
- } );
117
- };
118
-
119
- var licence_update = function ( button ) {
120
- button.on( 'click', function ( e ) {
121
- e.preventDefault();
122
-
123
- var t = $( this ),
124
- form = $( '#licence-check-update' ),
125
- data = form.serialize();
126
-
127
- t.prop( "disabled", true ).addClass( 'clicked' );
128
- form.find( 'div.spinner' ).addClass( 'show' );
129
-
130
- jQuery.ajax( {
131
- type : 'POST',
132
- url : ajaxurl,
133
- data : data,
134
- success: function ( response ) {
135
- $( '.product-licence-activation' ).empty().replaceWith( response.template );
136
- licence_api();
137
- }
138
- } );
139
- } );
140
- };
141
-
142
- var licence_deactivate = function ( button ) {
143
- button.on( 'click', function ( e ) {
144
- e.preventDefault();
145
-
146
- var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
147
-
148
- if ( check == true ) {
149
- var t = $( this ),
150
- licence_key = t.data( 'licence-key' ),
151
- licence_email = t.data( 'licence-email' ),
152
- product_init = t.data( 'product-init' ),
153
- action = t.data( 'action' ),
154
- renew = $( '.licence-renew' ),
155
- deactive = $( '.licence-deactive' ),
156
- message = $( '#yith-licence-notice' ),
157
- activated_table = $( '.activated-table' );
158
-
159
- t.add( renew ).add( deactive ).prop( "disabled", true ).addClass( 'clicked' );
160
- $( '#activated-products' ).find( '.spinner' ).addClass( 'show' );
161
-
162
- jQuery.ajax( {
163
- type : 'POST',
164
- url : ajaxurl,
165
- data : {
166
- action : action,
167
- licence_key : licence_key,
168
- email : licence_email,
169
- product_init: product_init
170
- },
171
- success: function ( response ) {
172
- message.css( 'maxWidth', activated_table.width() );
173
- if ( false == response ) {
174
- message.find( 'p.yith-licence-notice-message' ).html( licence_message.server );
175
- message.removeClass( 'notice-success' ).addClass( 'notice-error visible' );
176
- t.add( renew ).add( deactive ).add( renew ).prop( "disabled", false ).removeClass( 'clicked' );
177
- $( '#activated-products' ).find( '.spinner' ).removeClass( 'show' );
178
- }
179
-
180
- else {
181
- if ( false == response.activated ) {
182
- $( '.product-licence-activation' ).empty().replaceWith( response.template );
183
- licence_api();
184
- }
185
-
186
- if ( typeof response.error != 'undefined' ) {
187
- message.find( 'p.yith-licence-notice-message' ).html( response.error );
188
- message.removeClass( 'notice-success' ).addClass( 'notice-error visible' );
189
- t.add( renew ).add( deactive ).add( renew ).prop( "disabled", false ).removeClass( 'clicked' );
190
- $( '#activated-products' ).find( '.spinner' ).removeClass( 'show' );
191
- }
192
- }
193
- }
194
- } );
195
- }
196
- } );
197
- };
198
-
199
- var licence_api = function () {
200
- var button = $( '.licence-activation' ),
201
- check = $( '.licence-check' ),
202
- deactivated = $( '.licence-deactive' );
203
-
204
- licence_activation( button );
205
- licence_update( check );
206
- licence_deactivate( deactivated );
207
- };
208
-
209
- licence_api();
210
-
211
- $( 'body' ).on( 'click', '.yit-changelog-button', function ( e ) {
212
- $( '#TB_window' ).remove();
213
- } );
214
-
215
- } )( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/licence/assets/js/yit-licence.min.js DELETED
@@ -1,8 +0,0 @@
1
- (function(b){var t=function(c){c.on("click",function(k,e){k.preventDefault();var c=b(this),a=c.data("formid"),d=b("#"+a),f=d.serialize(),h=b(d).find(".message"),g=b(d).find(".message-wrapper"),l=d.find(".user-email"),u=d.find(".licence-key"),v=d.find(".user-email").val(),t=d.find(".licence-key").val(),n=!1;a=[];var p=d.find(".product-row"),q=b(".licence-activation"),r=b("#products-to-active").find(".spinner");h.empty();g.removeClass("visible");l.removeClass("require");u.removeClass("require");p.removeClass("error");
2
- r.addClass("show");c.add(q).prop("disabled",!0).addClass("clicked");""!==v&&(new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i)).test(v)||
3
- (n=!0,l.addClass("require"),a[a.length]=licence_message.email);""===t&&(n=!0,a[a.length]=licence_message.license_key,u.addClass("require"));if(!1===n)jQuery.ajax({type:"POST",url:"undefined"!=typeof ajaxurl?ajaxurl:yith_ajax.url,data:f,success:function(a){r.removeClass("show");c.add(q).prop("disabled",!1).removeClass("clicked");!0===a.activated?(b(".product-licence-activation").empty().replaceWith(a.template),m()):(!1!==a&&"undefined"!==typeof a.error?h.text(a.error):h.text(licence_message.server),
4
- g.addClass("visible"),p.addClass("error"));"undefined"!==typeof a.debug&&console.log(a.debug)}});else{if(1==a.length)h.text(licence_message.error.replace("%field%",a[0]));else{d=licence_message.errors;for(f=0;f<a.length;f++)d=d.replace("%field_"+(f+1)+"%",a[f]),g.addClass("visible");h.text(d)}g.addClass("visible");p.addClass("error");r.removeClass("show");c.add(q).prop("disabled",!1).removeClass("clicked")}})},w=function(c){c.on("click",function(c){c.preventDefault();c=b(this);var e=b("#licence-check-update"),
5
- k=e.serialize();c.prop("disabled",!0).addClass("clicked");e.find("div.spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:k,success:function(a){b(".product-licence-activation").empty().replaceWith(a.template);m()}})})},x=function(c){c.on("click",function(c){c.preventDefault();if(1==(1==script_info.is_debug?!0:confirm(licence_message.are_you_sure))){var e=b(this);c=e.data("licence-key");var k=e.data("licence-email"),a=e.data("product-init"),d=e.data("action"),f=b(".licence-renew"),
6
- h=b(".licence-deactive"),g=b("#yith-licence-notice"),l=b(".activated-table");e.add(f).add(h).prop("disabled",!0).addClass("clicked");b("#activated-products").find(".spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:{action:d,licence_key:c,email:k,product_init:a},success:function(a){g.css("maxWidth",l.width());0==a?(g.find("p.yith-licence-notice-message").html(licence_message.server),g.removeClass("notice-success").addClass("notice-error visible"),e.add(f).add(h).add(f).prop("disabled",
7
- !1).removeClass("clicked"),b("#activated-products").find(".spinner").removeClass("show")):(0==a.activated&&(b(".product-licence-activation").empty().replaceWith(a.template),m()),"undefined"!=typeof a.error&&(g.find("p.yith-licence-notice-message").html(a.error),g.removeClass("notice-success").addClass("notice-error visible"),e.add(f).add(h).add(f).prop("disabled",!1).removeClass("clicked"),b("#activated-products").find(".spinner").removeClass("show")))}})}})},m=function(){var c=b(".licence-activation"),
8
- k=b(".licence-check"),e=b(".licence-deactive");t(c);w(k);x(e)};m();b("body").on("click",".yit-changelog-button",function(c){b("#TB_window").remove()})})(jQuery);
 
 
 
 
 
 
 
 
plugin-fw/licence/lib/yit-licence.php DELETED
@@ -1,804 +0,0 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( !defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( !class_exists( 'YIT_Licence' ) ) {
16
- /**
17
- * YIT Licence Panel
18
- *
19
- * Setting Page to Manage Products
20
- *
21
- * @class YIT_Licence
22
- * @package YITH
23
- * @since 1.0
24
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
- */
26
- abstract class YIT_Licence {
27
-
28
- /**
29
- * @var mixed array The registered products info
30
- * @since 1.0
31
- */
32
- protected $_products = array();
33
-
34
- /**
35
- * @var array The settings require to add the submenu page "Activation"
36
- * @since 1.0
37
- */
38
- protected $_settings = array();
39
-
40
- /**
41
- * @var string Option name
42
- * @since 1.0
43
- */
44
- protected $_licence_option = 'yit_products_licence_activation';
45
-
46
- /**
47
- * @var string The yithemes api uri
48
- * @since 1.0
49
- */
50
- protected $_api_uri = 'https://yithemes.com';
51
-
52
- /**
53
- * @var string The yithemes api uri query args
54
- * @since 1.0
55
- */
56
- protected $_api_uri_query_args = '?wc-api=software-api&request=%request%';
57
-
58
-
59
- /**
60
- * @var string check for show extra info
61
- * @since 1.0
62
- */
63
- public $show_extra_info = false;
64
-
65
- /**
66
- * @var string check for show extra info
67
- * @since 1.0
68
- */
69
- public $show_renew_button = true;
70
-
71
- /**
72
- * Constructor
73
- *
74
- * @since 1.0
75
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
76
- */
77
- public function __construct() {
78
- $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
79
- if ( $is_debug_enabled ) {
80
- $this->_api_uri = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
81
- add_filter( 'block_local_requests', '__return_false' );
82
- }
83
-
84
- /* Style adn Script */
85
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
86
- if ( $is_debug_enabled ) {
87
- //show extra info and renew button in debug mode
88
- $this->show_extra_info = $this->show_renew_button = true;
89
- } else {
90
- $this->show_extra_info = ( defined( 'YIT_SHOW_EXTRA_LICENCE_INFO' ) && YIT_SHOW_EXTRA_LICENCE_INFO ) || ( ! empty( $_GET['yith_show_extra_license_info'] ) && 'yes' == $_GET['yith_show_extra_license_info'] );
91
- $this->show_renew_button = !( defined( 'YIT_HIDE_LICENCE_RENEW_BUTTON' ) && YIT_HIDE_LICENCE_RENEW_BUTTON );
92
- }
93
- }
94
-
95
- /**
96
- * Premium products registration
97
- *
98
- * @param $init string | The products identifier
99
- * @param $secret_key string | The secret key
100
- * @param $product_id string | The product id
101
- *
102
- * @return void
103
- *
104
- * @since 1.0
105
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
106
- */
107
- abstract public function register( $init, $secret_key, $product_id );
108
-
109
- /**
110
- * Get protected array products
111
- *
112
- * @return mixed array
113
- *
114
- * @since 1.0
115
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
116
- */
117
- public function get_products() {
118
- return $this->_products;
119
- }
120
-
121
- /**
122
- * Get The home url without protocol
123
- *
124
- * @return string the home url
125
- *
126
- * @since 1.0
127
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
128
- */
129
- public function get_home_url() {
130
- $home_url = home_url();
131
- $schemes = array( 'https://', 'http://', 'www.' );
132
-
133
- foreach ( $schemes as $scheme ) {
134
- $home_url = str_replace( $scheme, '', $home_url );
135
- }
136
-
137
- if ( strpos( $home_url, '?' ) !== false ) {
138
- list( $base, $query ) = explode( '?', $home_url, 2 );
139
- $home_url = $base;
140
- }
141
-
142
- $home_url = untrailingslashit( $home_url );
143
-
144
- return $home_url;
145
- }
146
-
147
- /**
148
- * Check if the request is ajax
149
- *
150
- * @return bool true if the request is ajax, false otherwise
151
- *
152
- * @since 1.0
153
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
154
- */
155
- public function is_ajax() {
156
- return defined( 'DOING_AJAX' ) && DOING_AJAX ? true : false;
157
- }
158
-
159
- /**
160
- * Admin Enqueue Scripts
161
- *
162
- * @return void
163
- *
164
- * @since 1.0
165
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
166
- */
167
- public function admin_enqueue_scripts() {
168
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
169
- /**
170
- * Support to YIT Framework < 2.0
171
- */
172
- $script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
173
- $style_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
174
-
175
- wp_register_script( 'yit-licence', $script_path . '/licence/assets/js/yit-licence' . $suffix . '.js', array( 'jquery' ), '1.0.0', true );
176
- wp_register_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
177
-
178
- /* Localize Scripts */
179
- wp_localize_script( 'yit-licence', 'licence_message', array(
180
- 'error' => sprintf( _x( 'Please, insert a valid %s', '%s = field name', 'yith-plugin-fw' ), '%field%' ), // sprintf must be used to avoid errors with '%field%' string in translation in .po file
181
- 'errors' => sprintf( __( 'Please, insert a valid %s and a valid %s', 'yith-plugin-fw' ), '%field_1%', '%field_2%' ),
182
- 'server' => __( 'Unable to contact the remote server, please try again later. Thanks!', 'yith-plugin-fw' ),
183
- 'email' => __( 'email address', 'yith-plugin-fw' ),
184
- 'license_key' => __( 'license key', 'yith-plugin-fw' ),
185
- 'are_you_sure' => __( 'Are you sure you want to deactivate the license for current site?', 'yith-plugin-fw' )
186
- )
187
- );
188
-
189
- wp_localize_script( 'yit-licence', 'script_info', array(
190
- 'is_debug' => defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG
191
- )
192
- );
193
-
194
- wp_localize_script( 'yit-licence', 'yith_ajax', array(
195
- 'url' => admin_url( 'admin-ajax.php', 'relative' )
196
- )
197
- );
198
-
199
- /* Enqueue Scripts only in Licence Activation page of plugins and themes */
200
- if ( strpos( get_current_screen()->id, 'yith_plugins_activation' ) !== false || strpos( get_current_screen()->id, 'yit_panel_license' ) !== false ) {
201
- wp_enqueue_script( 'yit-licence' );
202
- wp_enqueue_style( 'yit-theme-licence' );
203
- }
204
- }
205
-
206
- /**
207
- * Activate Plugins
208
- *
209
- * Send a request to API server to activate plugins
210
- *
211
- * @return void
212
- * @use wp_send_json
213
- *
214
- * @since 1.0
215
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
216
- */
217
- public function activate() {
218
- $product_init = $_REQUEST[ 'product_init' ];
219
- $product = $this->get_product( $product_init );
220
-
221
- $args = array(
222
- 'email' => urlencode( sanitize_email( $_REQUEST[ 'email' ] ) ),
223
- 'licence_key' => sanitize_text_field( $_REQUEST[ 'licence_key' ] ),
224
- 'product_id' => sanitize_text_field( $product[ 'product_id' ] ),
225
- 'secret_key' => sanitize_text_field( $product[ 'secret_key' ] ),
226
- 'instance' => $this->get_home_url()
227
- );
228
-
229
- $api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'activation' ) ) );
230
- $timeout = apply_filters( 'yith_plugin_fw_licence_timeout', 30, __FUNCTION__ );
231
- $response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) );
232
-
233
- if ( is_wp_error( $response ) ) {
234
- $body = false;
235
- } else {
236
- $body = json_decode( $response[ 'body' ] );
237
- $body = is_object( $body ) ? get_object_vars( $body ) : false;
238
- }
239
-
240
- if ( $body && is_array( $body ) && isset( $body[ 'activated' ] ) && $body[ 'activated' ] ) {
241
-
242
- $option[ $product[ 'product_id' ] ] = array(
243
- 'email' => urldecode( $args[ 'email' ] ),
244
- 'licence_key' => $args[ 'licence_key' ],
245
- 'licence_expires' => $body[ 'licence_expires' ],
246
- 'message' => $body[ 'message' ],
247
- 'activated' => true,
248
- 'activation_limit' => $body[ 'activation_limit' ],
249
- 'activation_remaining' => $body[ 'activation_remaining' ],
250
- 'is_membership' => isset( $body[ 'is_membership' ] ) ? $body[ 'is_membership' ] : false,
251
- );
252
-
253
- /* === Check for other plugins activation === */
254
- $options = $this->get_licence();
255
- $options[ $product[ 'product_id' ] ] = $option[ $product[ 'product_id' ] ];
256
-
257
- update_option( $this->_licence_option, $options );
258
-
259
- /* === Update Plugin Licence Information === */
260
- yith_plugin_fw_force_regenerate_plugin_update_transient();
261
-
262
- /* === Licence Activation Template === */
263
- $body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
264
- }
265
-
266
- if ( !empty( $_REQUEST[ 'debug' ] ) ) {
267
- $body = is_array( $body ) ? $body : array();
268
- $body[ 'debug' ] = array( 'response' => $response );
269
- if ( 'print_r' === $_REQUEST[ 'debug' ] ) {
270
- $body[ 'debug' ] = print_r( $body[ 'debug' ], true );
271
- }
272
- }
273
-
274
- wp_send_json( $body );
275
- }
276
-
277
- /**
278
- * Deactivate Plugins
279
- *
280
- * Send a request to API server to activate plugins
281
- *
282
- * @return void
283
- * @use wp_send_json
284
- *
285
- * @since 1.0
286
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
287
- */
288
- public function deactivate() {
289
- $product_init = $_REQUEST[ 'product_init' ];
290
- $product = $this->get_product( $product_init );
291
-
292
- $args = array(
293
- 'email' => urlencode( sanitize_email( $_REQUEST[ 'email' ] ) ),
294
- 'licence_key' => sanitize_text_field( $_REQUEST[ 'licence_key' ] ),
295
- 'product_id' => sanitize_text_field( $product[ 'product_id' ] ),
296
- 'secret_key' => sanitize_text_field( $product[ 'secret_key' ] ),
297
- 'instance' => $this->get_home_url()
298
- );
299
-
300
- $api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'deactivation' ) ) );
301
- $timeout = apply_filters( 'yith_plugin_fw_licence_timeout', 30, __FUNCTION__ );
302
- $response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) );
303
-
304
- if ( is_wp_error( $response ) ) {
305
- $body = false;
306
- } else {
307
- $body = json_decode( $response[ 'body' ] );
308
- $body = is_object( $body ) ? get_object_vars( $body ) : false;
309
- }
310
-
311
- if ( $body && is_array( $body ) ) {
312
- /* === Get License === */
313
- $options = $this->get_licence();
314
- if( isset( $body[ 'activated' ] ) && ! $body[ 'activated' ] && ! isset( $body[ 'error' ] ) ){
315
- $option[ $product[ 'product_id' ] ] = array(
316
- 'activated' => false,
317
- 'email' => urldecode( $args[ 'email' ] ),
318
- 'licence_key' => $args[ 'licence_key' ],
319
- 'licence_expires' => $body[ 'licence_expires' ],
320
- 'message' => $body[ 'message' ],
321
- 'activation_limit' => $body[ 'activation_limit' ],
322
- 'activation_remaining' => $body[ 'activation_remaining' ],
323
- 'is_membership' => isset( $body[ 'is_membership' ] ) ? $body[ 'is_membership' ] : false,
324
- );
325
-
326
- /* === Check for other plugins activation === */
327
- $options[ $product[ 'product_id' ] ] = $option[ $product[ 'product_id' ] ];
328
-
329
- /* === Update Plugin Licence Information === */
330
- yith_plugin_fw_force_regenerate_plugin_update_transient();
331
-
332
- update_option( $this->_licence_option, $options );
333
-
334
- /* === Licence Activation Template === */
335
- $body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 'deactivated', array( 'instance' => $body[ 'instance' ] ) ) );
336
- }
337
-
338
- else {
339
- $body[ 'error' ] = $this->get_response_code_message( $body[ 'code' ] );
340
-
341
- switch ( $body[ 'code' ] ) {
342
-
343
- /**
344
- * Error Code List:
345
- *
346
- * 100 -> Invalid Request
347
- * 101 -> Invalid licence key
348
- * 102 -> Software has been deactivate
349
- * 103 -> Exceeded maximum number of activations
350
- * 104 -> Invalid instance ID
351
- * 105 -> Invalid security key
352
- * 106 -> Licence key has expired
353
- * 107 -> Licence key has be banned
354
- *
355
- * Only code 101, 106 and 107 have effect on DB during activation
356
- * All error code have effect on DB during deactivation
357
- *
358
- */
359
-
360
- case '101':
361
- case '102':
362
- case '104':
363
- unset( $options[ $product[ 'product_id' ] ] );
364
- break;
365
-
366
- case '106':
367
- $options[ $product[ 'product_id' ] ][ 'activated' ] = false;
368
- $options[ $product[ 'product_id' ] ][ 'message' ] = $body[ 'error' ];
369
- $options[ $product[ 'product_id' ] ][ 'status_code' ] = $body[ 'code' ];
370
- $options[ $product[ 'product_id' ] ][ 'licence_expires' ] = $body[ 'licence_expires' ];
371
- break;
372
-
373
- case '107':
374
- $options[ $product[ 'product_id' ] ][ 'activated' ] = false;
375
- $options[ $product[ 'product_id' ] ][ 'message' ] = $body[ 'error' ];
376
- $options[ $product[ 'product_id' ] ][ 'status_code' ] = $body[ 'code' ];
377
- break;
378
- }
379
-
380
- update_option( $this->_licence_option, $options );
381
-
382
- /* === Licence Activation Template === */
383
- $deactivate_message = $this->get_response_code_message( 'deactivated' );
384
- $error_code_message = $this->get_response_code_message( $body['code'] );
385
- $message = sprintf( "<strong>%s</strong>: %s", $deactivate_message, $error_code_message );
386
- $body['template'] = $this->show_activation_panel( $message );
387
- $body['activated'] = false;
388
- }
389
- }
390
-
391
- wp_send_json( $body );
392
- }
393
-
394
- /**
395
- * Check Plugins Licence
396
- *
397
- * Send a request to API server to check if plugins is activated
398
- *
399
- * @param string|The plugin init slug $plugin_init
400
- * @param boolean $regenerate_transient
401
- * @param boolean $force_check
402
- *
403
- * @return bool | true if activated, false otherwise
404
- *
405
- * @since 1.0
406
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
407
- */
408
- public function check( $product_init, $regenerate_transient = true, $force_check = false ) {
409
-
410
- $status = false;
411
- $body = false;
412
- $product = $this->get_product( $product_init );
413
- $licence = $this->get_licence();
414
- $product_id = $product[ 'product_id' ];
415
-
416
- if ( ! isset( $licence[ $product_id ] ) ) {
417
- return false;
418
- }
419
-
420
- if( ! $force_check && ! $this->is_check_needed( $licence[ $product_id ] ) ) {
421
- return true;
422
- }
423
-
424
- $args = array(
425
- 'email' => urlencode( $licence[ $product_id ][ 'email' ] ),
426
- 'licence_key' => $licence[ $product_id ][ 'licence_key' ],
427
- 'product_id' => $product_id,
428
- 'secret_key' => $product[ 'secret_key' ],
429
- 'instance' => $this->get_home_url()
430
- );
431
-
432
- $api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'check' ) ) );
433
- $timeout = apply_filters( 'yith_plugin_fw_licence_timeout', 30, __FUNCTION__ );
434
- $response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) );
435
-
436
- if ( ! is_wp_error( $response ) ) {
437
- $body = json_decode( $response[ 'body' ] );
438
- $body = is_object( $body ) ? get_object_vars( $body ) : false;
439
- }
440
-
441
- if ( $body && is_array( $body ) ) {
442
- if ( isset( $body[ 'success' ] ) && $body[ 'success' ] == true ) {
443
-
444
- /**
445
- * Code 200 -> Licence key is valid
446
- */
447
- $licence[ $product_id ][ 'status_code' ] = '200';
448
- $licence[ $product_id ][ 'activated' ] = $body[ 'activated' ];
449
- $licence[ $product_id ][ 'licence_expires' ] = $body[ 'licence_expires' ];
450
- $licence[ $product_id ][ 'licence_next_check' ] = time() + ( 12 * HOUR_IN_SECONDS );
451
- $licence[ $product_id ][ 'activation_remaining' ] = $body[ 'activation_remaining' ];
452
- $licence[ $product_id ][ 'activation_limit' ] = $body[ 'activation_limit' ];
453
- $licence[ $product_id ][ 'is_membership' ] = isset( $body[ 'is_membership' ] ) ? $body[ 'is_membership' ] : false;
454
- $status = (bool) $body[ 'activated' ];
455
- } elseif ( isset( $body[ 'code' ] ) ) {
456
-
457
- switch ( $body[ 'code' ] ) {
458
-
459
- /**
460
- * Error Code List:
461
- *
462
- * 100 -> Invalid Request
463
- * 101 -> Invalid licence key
464
- * 102 -> Software has been deactivate
465
- * 103 -> Exceeded maximum number of activations
466
- * 104 -> Invalid instance ID
467
- * 105 -> Invalid security key
468
- * 106 -> Licence key has expired
469
- * 107 -> Licence key has be banned
470
- *
471
- * Only code 101, 106 and 107 have effect on DB during activation
472
- * All error code have effect on DB during deactivation
473
- *
474
- */
475
-
476
- case '101':
477
- case '102':
478
- case '104':
479
- unset( $licence[ $product_id ] );
480
- break;
481
-
482
- case '106':
483
- $licence[ $product_id ][ 'activated' ] = false;
484
- $licence[ $product_id ][ 'message' ] = $body[ 'error' ];
485
- $licence[ $product_id ][ 'status_code' ] = $body[ 'code' ];
486
- $licence[ $product_id ][ 'licence_expires' ] = $body[ 'licence_expires' ];
487
- break;
488
-
489
- case '107':
490
- $licence[ $product_id ][ 'activated' ] = false;
491
- $licence[ $product_id ][ 'message' ] = $body[ 'error' ];
492
- $licence[ $product_id ][ 'status_code' ] = $body[ 'code' ];
493
- break;
494
- }
495
- }
496
-
497
- /* === Update Plugin Licence Information === */
498
- update_option( $this->_licence_option, $licence );
499
-
500
- /* === Update Plugin Licence Information === */
501
- if ( $regenerate_transient ) {
502
- yith_plugin_fw_force_regenerate_plugin_update_transient();
503
- }
504
- }
505
-
506
- return $status;
507
- }
508
-
509
- /**
510
- * Check if given licence needs to be checked
511
- *
512
- * @since 3.1.18
513
- * @author Francesco Licandro
514
- * @param array $licence The licence to check
515
- * @return boolean
516
- */
517
- public function is_check_needed( $licence ){
518
- if( empty( $licence['licence_expires'] ) || $licence['licence_expires'] < time()
519
- || empty( $licence['licence_next_check'] ) || $licence['licence_next_check'] < time() ){
520
- return true;
521
- }
522
-
523
- return false;
524
- }
525
-
526
- /**
527
- * Check for licence update
528
- *
529
- * @return void
530
- * @since 2.5
531
- *
532
- * @use YIT_Theme_Licence->check()
533
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
534
- * @param boolean $regenerate_transient
535
- * @param boolean $force_check
536
- */
537
- public function check_all( $regenerate_transient = true, $force_check = false ) {
538
- foreach ( $this->_products as $init => $info ) {
539
- $this->check( $init, $regenerate_transient, $force_check );
540
- }
541
- }
542
-
543
- /**
544
- * Update Plugins Information
545
- *
546
- * Send a request to API server to check activate plugins and update the informations
547
- *
548
- * @return void
549
- * @use YIT_Theme_Licence->check()
550
- *
551
- * @since 1.0
552
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
553
- */
554
- public function update_licence_information() {
555
- /* Check licence information for alla products */
556
- $this->check_all( false, true );
557
-
558
- /* === Regenerate Update Plugins Transient === */
559
- yith_plugin_fw_force_regenerate_plugin_update_transient();
560
-
561
- do_action( 'yit_licence_after_check' );
562
-
563
- if ( $this->is_ajax() ) {
564
- $response[ 'template' ] = $this->show_activation_panel();
565
- wp_send_json( $response );
566
- }
567
- }
568
-
569
- /**
570
- * Include activation page template
571
- *
572
- * @return mixed void | string the contents of the output buffer and end output buffering.
573
- *
574
- * @since 1.0
575
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
576
- */
577
- public function show_activation_panel( $notice = '' ) {
578
-
579
- $path = defined( 'YIT_CORE_PLUGIN_PATH' ) ? YIT_CORE_PLUGIN_PATH : get_template_directory() . '/core/plugin-fw/';
580
-
581
- if ( $this->is_ajax() ) {
582
- ob_start();
583
- require_once( $path . '/licence/templates/panel/activation/activation-panel.php' );
584
-
585
- return ob_get_clean();
586
- } else {
587
- require_once( $path . '/licence/templates/panel/activation/activation-panel.php' );
588
- }
589
- }
590
-
591
- /**
592
- * Get activated products
593
- *
594
- * @return array
595
- *
596
- * @since 1.0
597
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
598
- */
599
- public function get_activated_products() {
600
- $activated_products = array();
601
- $licence = $this->get_licence();
602
-
603
- if ( is_array( $licence ) ) {
604
- foreach ( $this->_products as $init => $info ) {
605
- if ( in_array( $info[ 'product_id' ], array_keys( $licence ) ) && isset( $licence[ $info[ 'product_id' ] ][ 'activated' ] ) && $licence[ $info[ 'product_id' ] ][ 'activated' ] ) {
606
- $product[ $init ] = $this->_products[ $init ];
607
- $product[ $init ][ 'licence' ] = $licence[ $info[ 'product_id' ] ];
608
- $activated_products[ $init ] = $product[ $init ];
609
- }
610
- }
611
- }
612
-
613
- return $activated_products;
614
- }
615
-
616
- /**
617
- * Get to active products
618
- *
619
- * @return array
620
- *
621
- * @since 1.0
622
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
623
- */
624
- public function get_to_active_products() {
625
- return array_diff_key( $this->get_products(), $this->get_activated_products() );
626
- }
627
-
628
- /**
629
- * Get no active products
630
- *
631
- * @return array
632
- *
633
- * @since 1.0
634
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
635
- */
636
- public function get_no_active_licence_key() {
637
- $unactive_products = $this->get_to_active_products();
638
- $licence = $this->get_licence();
639
- $licence_key = array();
640
-
641
- /**
642
- * Remove banned licence key
643
- */
644
- foreach ( $unactive_products as $init => $info ) {
645
- $product_id = $unactive_products[ $init ][ 'product_id' ];
646
- if ( isset( $licence[ $product_id ][ 'activated' ] ) && !$licence[ $product_id ][ 'activated' ] && isset( $licence[ $product_id ][ 'status_code' ] ) ) {
647
- $status_code = $licence[ $product_id ][ 'status_code' ];
648
-
649
- switch ( $status_code ) {
650
- case '106':
651
- $licence_key[ $status_code ][ $init ] = $unactive_products[ $init ];
652
- $licence_key[ $status_code ][ $init ][ 'licence' ] = $licence[ $product_id ];
653
- break;
654
-
655
- case '107':
656
- $licence_key[ $status_code ][ $init ] = $unactive_products[ $init ];
657
- $licence_key[ $status_code ][ $init ][ 'licence' ] = $licence[ $product_id ];
658
- break;
659
- }
660
- }
661
- }
662
-
663
- return $licence_key;
664
- }
665
-
666
- /**
667
- * Get a specific product information
668
- *
669
- * @param $product_init | product init file
670
- *
671
- * @return mixed array
672
- *
673
- * @since 1.0
674
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
675
- */
676
- public function get_product( $init ) {
677
- return isset( $this->_products[ $init ] ) ? $this->_products[ $init ] : false;
678
- }
679
-
680
- /**
681
- * Get product product id information
682
- *
683
- * @param $product_init | product init file
684
- *
685
- * @return mixed array
686
- *
687
- * @since 1.0
688
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
689
- */
690
- public function get_product_id( $init ) {
691
- return isset( $this->_products[ $init ][ 'product_id' ] ) ? $this->_products[ $init ][ 'product_id' ] : false;
692
- }
693
-
694
- /**
695
- * Get Renewing uri
696
- *
697
- * @param $licence_key The licence key to renew
698
- *
699
- * @return mixed The renewing uri if licence_key exists, false otherwise
700
- *
701
- * @since 1.0
702
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
703
- */
704
- public function get_renewing_uri( $licence_key ) {
705
- return !empty( $licence_key ) ? str_replace( 'www.', '', $this->_api_uri ) . '?renewing_key=' . $licence_key : false;
706
- }
707
-
708
- /**
709
- * Get protected yithemes api uri
710
- *
711
- * @param $request
712
- *
713
- * @return mixed array
714
- *
715
- * @since 1.0
716
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
717
- */
718
- public function get_api_uri( $request ) {
719
- return str_replace( '%request%', $request, $this->_api_uri . $this->_api_uri_query_args );
720
- }
721
-
722
- /**
723
- * Get the activation page url
724
- *
725
- * @return String | Activation page url
726
- *
727
- * @since 1.0
728
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
729
- */
730
- public function get_licence_activation_page_url() {
731
- return esc_url( add_query_arg( array( 'page' => $this->_settings[ 'page' ] ), admin_url( 'admin.php' ) ) );
732
- }
733
-
734
-
735
- /**
736
- * Get the licence information
737
- *
738
- * @return array | licence array
739
- *
740
- * @since 1.0
741
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
742
- */
743
- public function get_licence() {
744
- return get_option( $this->_licence_option );
745
- }
746
-
747
- /**
748
- * Get the licence information
749
- *
750
- * @param $code string The error code
751
- *
752
- * @return string | Error code message
753
- *
754
- * @since 1.0
755
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
756
- */
757
- public function get_response_code_message( $code, $args = array() ) {
758
- extract( $args );
759
-
760
- $messages = array(
761
- '100' => __( 'Invalid Request', 'yith-plugin-fw' ),
762
- '101' => __( 'Invalid license key', 'yith-plugin-fw' ),
763
- '102' => __( 'Software has been deactivated', 'yith-plugin-fw' ),
764
- '103' => __( 'Maximum number of activations exceeded', 'yith-plugin-fw' ),
765
- '104' => __( 'Invalid instance ID', 'yith-plugin-fw' ),
766
- '105' => __( 'Invalid security key', 'yith-plugin-fw' ),
767
- '106' => __( 'License key has expired', 'yith-plugin-fw' ),
768
- '107' => __( 'License key has been banned', 'yith-plugin-fw' ),
769
- '108' => __( 'Current product is not included in your YITH Club Subscription key', 'yith-plugin-fw' ),
770
- '200' => sprintf( '<strong>%s</strong>! %s', __( 'Great', 'yith-plugin-fw' ), __( 'License successfully activated', 'yith-plugin-fw' ) ),
771
- 'deactivated' => sprintf( '%s <strong>%s</strong>', __( 'License key deactivated for website', 'yith-plugin-fw' ), isset( $instance ) ? $instance : '' )
772
- );
773
-
774
- return isset( $messages[ $code ] ) ? $messages[ $code ] : false;
775
- }
776
-
777
- /**
778
- * Get the product name to display
779
- *
780
- * @param $product_name
781
- *
782
- * @return string the product name
783
- *
784
- * @since 2.2
785
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
786
- */
787
- public function display_product_name( $product_name ) {
788
- return str_replace( array( 'for WooCommerce', 'YITH', 'WooCommerce', 'Premium', 'Theme', 'WordPress' ), '', $product_name );
789
- }
790
-
791
- public function get_number_of_membership_products() {
792
- $activated_products = $this->get_activated_products();
793
- $num_members_products_activate = 0;
794
- foreach ( $activated_products as $activated_product ) {
795
- if ( isset( $activated_product[ 'licence' ][ 'is_membership' ] ) && $activated_product[ 'licence' ][ 'is_membership' ] ) {
796
- $num_members_products_activate++;
797
- }
798
- }
799
-
800
- return $num_members_products_activate;
801
- }
802
-
803
- }
804
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/licence/lib/yit-plugin-licence.php DELETED
@@ -1,243 +0,0 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( !defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
16
- /**
17
- * YIT Plugin Licence Panel
18
- *
19
- * Setting Page to Manage Plugins
20
- *
21
- * @class YIT_Plugin_Licence
22
- * @package YITH
23
- * @since 1.0
24
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
- */
26
- class YIT_Plugin_Licence extends YIT_Licence {
27
-
28
- /**
29
- * @var array The settings require to add the submenu page "Activation"
30
- * @since 1.0
31
- */
32
- protected $_settings = array();
33
-
34
- /**
35
- * @var object The single instance of the class
36
- * @since 1.0
37
- */
38
- protected static $_instance = null;
39
-
40
- /**
41
- * @var string Option name
42
- * @since 1.0
43
- */
44
- protected $_licence_option = 'yit_plugin_licence_activation';
45
-
46
- /**
47
- * @var string product type
48
- * @since 1.0
49
- */
50
- protected $_product_type = 'plugin';
51
-
52
- /**
53
- * Constructor
54
- *
55
- * @since 1.0
56
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
57
- */
58
- public function __construct() {
59
- parent::__construct();
60
-
61
- if ( !is_admin() ) {
62
- return;
63
- }
64
-
65
- $this->_settings = array(
66
- 'parent_page' => 'yith_plugin_panel',
67
- 'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
68
- 'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
69
- 'capability' => 'manage_options',
70
- 'page' => 'yith_plugins_activation',
71
- );
72
-
73
- add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
74
- add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
75
- add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
76
- add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
77
- add_action( 'yit_licence_after_check', 'yith_plugin_fw_force_regenerate_plugin_update_transient' );
78
-
79
- /** @since 3.0.0 */
80
- if( version_compare( PHP_VERSION, '7.0', '>=' ) ) {
81
- add_action( 'admin_notices', function () {
82
- $this->activate_license_notice();
83
- }, 15 );
84
- }
85
-
86
- else {
87
- add_action( 'admin_notices', array( $this, 'activate_license_notice' ), 15 );
88
- }
89
- }
90
-
91
- private function _show_activate_license_notice() {
92
- $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
93
- $show_license_notice = current_user_can( 'update_plugins' ) &&
94
- ( !isset( $_GET[ 'page' ] ) || 'yith_plugins_activation' !== $_GET[ 'page' ] ) &&
95
- !( $current_screen && method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() );
96
- global $wp_filter;
97
-
98
- if ( isset( $wp_filter[ 'yith_plugin_fw_show_activate_license_notice' ] ) ) {
99
- $filter = $wp_filter[ 'yith_plugin_fw_show_activate_license_notice' ];
100
- $v = yith_plugin_fw_get_version();
101
- $a = explode( '.', $v );
102
- $l = end( $a );
103
- $p = absint( $l );
104
- $allowed_hook = isset( $filter[ $p ] ) ? $filter[ $p ] : false;
105
- remove_all_filters( 'yith_plugin_fw_show_activate_license_notice' );
106
-
107
- if ( $allowed_hook && is_array( $allowed_hook ) ) {
108
- $cb = current( $allowed_hook );
109
- if ( isset( $cb[ 'function' ] ) && isset( $cb[ 'accepted_args' ] ) ) {
110
- add_filter( 'yith_plugin_fw_show_activate_license_notice', $cb[ 'function' ], 10, $cb[ 'accepted_args' ] );
111
- }
112
- }
113
-
114
- }
115
-
116
- return apply_filters( 'yith_plugin_fw_show_activate_license_notice', $show_license_notice );
117
- }
118
-
119
- /**
120
- * print notice with products to activate
121
- *
122
- * @since 3.0.0
123
- */
124
- public function activate_license_notice() {
125
- if ( $this->_show_activate_license_notice() ) {
126
- $products_to_activate = $this->get_to_active_products();
127
- if ( !!$products_to_activate ) {
128
- $product_names = array();
129
- foreach ( $products_to_activate as $init => $product ) {
130
- if ( !empty( $product[ 'Name' ] ) )
131
- $product_names[] = $product[ 'Name' ];
132
- }
133
-
134
- if ( !!$product_names ) {
135
- $start = '<span style="display:inline-block; padding:3px 10px; margin: 0 10px 10px 0; background: #f1f1f1; border-radius: 4px;">';
136
- $end = '</span>';
137
- $product_list = '<div>' . $start . implode( $end . $start, $product_names ) . $end . '</div>';
138
- $activation_url = self::get_license_activation_url();
139
- ?>
140
- <div class="notice notice-error">
141
- <p>
142
- <?php printf( '<strong>%s</strong> %s:', _x( 'Warning!', "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' ), _x( "You didn't set license key for the following products", "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.",'yith-plugin-fw' ) ); ?><strong></strong>
143
- <?php echo $product_list ?>
144
- <?php printf( "%s. <a href='%s'>%s</a>, %s",
145
- _x( "which means you're missing out on updates and support", "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' ),
146
- $activation_url,
147
- _x( 'Enter your license key', "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' ),
148
- _x( 'please', "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' )
149
- ); ?>
150
- </p>
151
- </div>
152
- <?php
153
- }
154
- }
155
- }
156
- }
157
-
158
- /**
159
- * Main plugin Instance
160
- *
161
- * @static
162
- * @return object Main instance
163
- *
164
- * @since 1.0
165
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
166
- */
167
- public static function instance() {
168
- if ( is_null( self::$_instance ) ) {
169
- self::$_instance = new self();
170
- }
171
-
172
- return self::$_instance;
173
- }
174
-
175
- /**
176
- * Add "Activation" submenu page under YITH Plugins
177
- *
178
- * @return void
179
- * @since 1.0
180
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
181
- */
182
- public function add_submenu_page() {
183
- add_submenu_page(
184
- $this->_settings[ 'parent_page' ],
185
- $this->_settings[ 'page_title' ],
186
- $this->_settings[ 'menu_title' ],
187
- $this->_settings[ 'capability' ],
188
- $this->_settings[ 'page' ],
189
- array( $this, 'show_activation_panel' )
190
- );
191
- }
192
-
193
- /**
194
- * Premium plugin registration
195
- *
196
- * @param $plugin_init | string | The plugin init file
197
- * @param $secret_key | string | The product secret key
198
- * @param $product_id | string | The plugin slug (product_id)
199
- *
200
- * @return void
201
- *
202
- * @since 1.0
203
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
204
- */
205
- public function register( $plugin_init, $secret_key, $product_id ) {
206
- if ( !function_exists( 'get_plugins' ) ) {
207
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
208
- }
209
-
210
- $plugins = get_plugins();
211
- $plugins[ $plugin_init ][ 'secret_key' ] = $secret_key;
212
- $plugins[ $plugin_init ][ 'product_id' ] = $product_id;
213
- $this->_products[ $plugin_init ] = $plugins[ $plugin_init ];
214
- }
215
-
216
- public function get_product_type() {
217
- return $this->_product_type;
218
- }
219
-
220
- /**
221
- * Get license activation URL
222
- *
223
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
224
- * @since 3.0.17
225
- */
226
- public static function get_license_activation_url(){
227
- return add_query_arg( array( 'page' => 'yith_plugins_activation' ), admin_url( 'admin.php' ) );
228
- }
229
- }
230
- }
231
-
232
- /**
233
- * Main instance of plugin
234
- *
235
- * @return YIT_Plugin_Licence object of license class
236
- * @since 1.0
237
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
238
- */
239
- if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
240
- function YIT_Plugin_Licence() {
241
- return YIT_Plugin_Licence::instance();
242
- }
243
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/licence/lib/yit-theme-licence.php DELETED
@@ -1,191 +0,0 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( !defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( !class_exists( 'YIT_Theme_Licence' ) ) {
16
- /**
17
- * YIT Plugin Licence Panel
18
- *
19
- * Setting Page to Manage Plugins
20
- *
21
- * @class YIT_Theme_Licence
22
- * @package YITH
23
- * @since 1.0
24
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
- */
26
- class YIT_Theme_Licence extends YIT_Licence {
27
-
28
- /**
29
- * @var array The settings require to add the submenu page "Activation"
30
- * @since 1.0
31
- */
32
- protected $_settings = array();
33
-
34
- /**
35
- * @var object The single instance of the class
36
- * @since 1.0
37
- */
38
- protected static $_instance = null;
39
-
40
- /**
41
- * @var string Option name
42
- * @since 1.0
43
- */
44
- protected $_licence_option = 'yit_theme_licence_activation';
45
-
46
- /**
47
- * @var string product type
48
- * @since 1.0
49
- */
50
- protected $_product_type = 'theme';
51
-
52
- /**
53
- * @var string Old theme licence works until 28 January 2016
54
- * @since 1.0
55
- */
56
- protected $_old_licence_expires = 1453939200; //28 January 2016
57
-
58
- /**
59
- * Constructor
60
- *
61
- * @since 1.0
62
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
63
- */
64
- public function __construct() {
65
- parent::__construct();
66
-
67
- $this->_settings = array(
68
- 'parent_page' => 'yit_product_panel',
69
- 'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
70
- 'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
71
- 'capability' => 'manage_options',
72
- 'page' => 'yith_plugins_activation',
73
- );
74
-
75
- add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
76
- add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
77
- add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
78
- add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
79
- }
80
-
81
- /**
82
- * Main plugin Instance
83
- *
84
- * @static
85
- * @return object Main instance
86
- *
87
- * @since 1.0
88
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
89
- */
90
- public static function instance() {
91
- if ( is_null( self::$_instance ) ) {
92
- self::$_instance = new self();
93
- }
94
-
95
- return self::$_instance;
96
- }
97
-
98
- /**
99
- * Add "Activation" submenu page under YITH Plugins
100
- *
101
- * @return void
102
- * @since 1.0
103
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
104
- */
105
- public function add_submenu_page() {
106
-
107
- $admin_tree = array(
108
- 'parent_slug' => apply_filters( 'yit_licence_parent_slug', 'yit_panel' ),
109
- 'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
110
- 'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
111
- 'capability' => 'manage_options',
112
- 'menu_slug' => 'yit_panel_license',
113
- 'function' => 'show_activation_panel'
114
- );
115
-
116
- add_submenu_page( $admin_tree['parent_slug'],
117
- sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['page_title'] ),
118
- sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['menu_title'] ),
119
- $admin_tree['capability'],
120
- $admin_tree['menu_slug'],
121
- array( $this, $admin_tree['function'] )
122
- );
123
- }
124
-
125
- /**
126
- * Premium product registration
127
- *
128
- * @param $product_init | string | The product init file
129
- * @param $secret_key | string | The product secret key
130
- * @param $product_id | string | The product slug (product_id)
131
- *
132
- * @return void
133
- *
134
- * @since 1.0
135
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
136
- */
137
- public function register( $product_init, $secret_key, $product_id ) {
138
- $theme = wp_get_theme();
139
- $products[$product_init]['Name'] = $theme->Name;
140
- $products[$product_init]['secret_key'] = $secret_key;
141
- $products[$product_init]['product_id'] = $product_id;
142
- $this->_products[$product_init] = $products[$product_init];
143
- }
144
-
145
- /**
146
- * Check for old licence
147
- *
148
- * @return bool True for old licence period, false otherwise
149
- * @since 2.2
150
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
151
- */
152
- public function show_old_licence_message() {
153
- return time() < $this->_old_licence_expires;
154
- }
155
-
156
- public function get_old_licence_message() {
157
- ob_start(); ?>
158
- <div class="activation-faq">
159
- <h3><?php _e( 'I cannot find the license key for activating the theme I have bought some time ago. Where can I find it?', 'yith-plugin-fw' ) ?></h3>
160
-
161
- <p>
162
- <?php
163
- _e( 'If you have purchased one of our products before 27 January 2015, you can benefit from support and updates (the services offered with the license)
164
- until 27 January 2016 and you do not have to purchase it again to get a new license key, because, before this date, your license used to be activated automatically by our system.
165
- After 27 January 2016, instead, if you want to benefit from support and updates you have to buy a new license and activate it through the license key you will be
166
- provided with and that you can find in your YITH account, in section "My licenses".', 'yith-plugin-fw' )
167
- ?>
168
- </p>
169
- </div>
170
- <?php
171
- echo ob_get_clean();
172
- }
173
-
174
- public function get_product_type() {
175
- return $this->_product_type;
176
- }
177
- }
178
- }
179
-
180
- /**
181
- * Main instance
182
- *
183
- * @return object
184
- * @since 1.0
185
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
186
- */
187
- if ( !function_exists( 'YIT_Theme_Licence' ) ) {
188
- function YIT_Theme_Licence() {
189
- return YIT_Theme_Licence::instance();
190
- }
191
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/licence/templates/panel/activation/activation-panel.php DELETED
@@ -1,247 +0,0 @@
1
- <?php
2
- /*
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- $to_active_products = $this->get_to_active_products();
12
- $activated_products = $this->get_activated_products();
13
- $no_active_products = $this->get_no_active_licence_key();
14
- $expired_products = isset( $no_active_products[ '106' ] ) ? $no_active_products[ '106' ] : array();
15
- $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_products[ '107' ] : array();
16
- $notice = isset( $notice ) ? $notice : '';
17
- $notice_class = !empty( $notice ) ? 'notice notice-success visible' : 'notice notice-success';
18
- $to_activate_check = $this instanceof YIT_Theme_Licence ? 1 : 2;
19
- $num_members_products_activate = $this->get_number_of_membership_products();
20
- $debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_REQUEST[ 'yith-license-debug' ] : false;
21
- ?>
22
-
23
- <div class="yit-container product-licence-activation">
24
- <h2><?php _e( 'YITH License Activation', 'yith-plugin-fw' ) ?></h2>
25
- <?php if ( !empty( $activated_products ) ) : ?>
26
- <div class="licence-check-section">
27
- <h3><?php _e( 'License expiry date', 'yith-plugin-fw' ); ?></h3>
28
- <form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
29
- <span class="licence-label" style="display: block;">
30
- <?php _e( 'If you have renewed your product license key and the expiry date does not appear up-to-date, please, click on the button <em>Check Expiry Date</em> below and it will update.', 'yith-plugin-fw' ); ?>
31
- </span>
32
- <input type="hidden" name="action" value="yith_update_licence_information-<?php echo $this->get_product_type(); ?>"/>
33
- <input type="submit" name="submit" value="<?php _e( 'Check expiry date', 'yith-plugin-fw' ) ?>" class="button-licence licence-check"/>
34
- <div class="spinner"></div>
35
- </form>
36
- </div>
37
- <?php endif; ?>
38
-
39
- <div id="yith-licence-notice" class="<?php echo $notice_class ?>">
40
- <p class="yith-licence-notice-message"><?php echo $notice ?></p>
41
- </div>
42
-
43
- <!-- To Active Products -->
44
-
45
- <?php if ( !empty( $to_active_products ) ) : ?>
46
- <h3 id="products-to-active" class="to-active">
47
- <?php echo _n( 'Product to activate', 'Products to activate', $to_activate_check, 'yith-plugin-fw' ) ?>
48
- <span class="spinner"></span>
49
- </h3>
50
- <p id="yith-licence-issue-how-to"><?php printf( '%s <a href="%s" target="_blank">%s</a>.', __( 'Are you having issues with the license activation?', 'yith-plugin-fw' ), '//support.yithemes.com/hc/en-us/articles/360012568594-License-activation-issues', __( 'Read this article', '[Part of]: Are you having issues with the license activation? Read this article', 'yith-plugin-fw' ) )?></p>
51
- <div class="to-active-wrapper">
52
- <?php foreach ( $to_active_products as $init => $info ) : ?>
53
- <form class="to-active-form" method="post" id="<?php echo $info[ 'product_id' ] ?>" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
54
- <?php if ( $debug ): ?>
55
- <input type="hidden" name="debug" value="<?php echo $debug ?>"/>
56
- <?php endif ?>
57
- <table class="to-active-table">
58
- <tbody>
59
- <tr class="product-row">
60
- <td class="product-name">
61
- <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
62
- </td>
63
- <td>
64
- <input type="text" name="email" placeholder="Your email on yithemes.com" value="" class="user-email"/>
65
- </td>
66
- <td>
67
- <input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key"/>
68
- </td>
69
- <td class="activate-button">
70
- <input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' ) ?>" class="button-licence licence-activation" data-formid="<?php echo $info[ 'product_id' ] ?>"/>
71
- </td>
72
- </tr>
73
- <input type="hidden" name="action" value="yith_activate-<?php echo $this->get_product_type(); ?>"/>
74
- <input type="hidden" name="product_init" value="<?php echo $init ?>"/>
75
- </tbody>
76
- </table>
77
- <div class="message-wrapper">
78
- <span class="message arrow-left"></span>
79
- </div>
80
- </form>
81
- <?php endforeach; ?>
82
- </div>
83
- <?php endif; ?>
84
-
85
- <!-- Activated Products -->
86
-
87
- <?php if ( !empty( $activated_products ) ) : ?>
88
- <h3 id="activated-products">
89
- <?php _e( 'Activated', 'yith-plugin-fw' ) ?>
90
- <span class="spinner"></span>
91
- </h3>
92
- <table class="activated-table">
93
- <thead>
94
- <tr>
95
- <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
96
- <?php if ( $this->show_extra_info ) : ?>
97
- <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
98
- <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
99
- <?php endif; ?>
100
-
101
- <th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
102
-
103
- <?php if ( $this->show_extra_info ) : ?>
104
- <th><?php _e( 'Remaining', 'yith-plugin-fw' ) ?></th>
105
- <?php if ( $num_members_products_activate ) : ?>
106
- <th><?php _e( 'Club Subscription', 'yith-plugin-fw' ) ?></th>
107
- <?php endif; ?>
108
- <?php endif; ?>
109
-
110
- <th id="yith-licence-actions"><span class="dashicons dashicons-admin-generic"></span></th>
111
- </tr>
112
- </thead>
113
- <tbody>
114
- <?php foreach ( $activated_products as $init => $info ) : ?>
115
- <tr>
116
- <td class="product-name">
117
- <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
118
- </td>
119
-
120
- <?php if ( $this->show_extra_info ) : ?>
121
- <td class="product-licence-email">
122
- <?php echo $info[ 'licence' ][ 'email' ] ?>
123
- </td>
124
- <td class="product-licence-key">
125
- <?php echo $info[ 'licence' ][ 'licence_key' ] ?>
126
- </td>
127
- <?php endif; ?>
128
-
129
- <td class="product-licence-expires">
130
- <?php echo date( "F j, Y", $info[ 'licence' ][ 'licence_expires' ] ); ?>
131
- </td>
132
-
133
- <?php if ( $this->show_extra_info ) : ?>
134
- <td class="product-licence-remaining">
135
- <?php printf( __( '%1s out of %2s', 'yith-plugin-fw' ), $info[ 'licence' ][ 'activation_remaining' ], $info[ 'licence' ][ 'activation_limit' ] ); ?>
136
- </td>
137
- <?php if ( $num_members_products_activate ) : ?>
138
- <td class="product-licence-membership">
139
- <span class="dashicons dashicons-<?php echo $info[ 'licence' ][ 'is_membership' ] ? 'yes' : 'no-alt' ?>"></span>
140
- </td>
141
- <?php endif; ?>
142
- <?php endif; ?>
143
-
144
- <td>
145
- <a class="button-licence licence-deactive"
146
- href="#"
147
- data-licence-email="<?php echo $info[ 'licence' ][ 'email' ] ?>"
148
- data-licence-key="<?php echo $info[ 'licence' ][ 'licence_key' ] ?>"
149
- data-product-init="<?php echo $init ?>"
150
- data-action="yith_deactivate-<?php echo $this->get_product_type(); ?>">
151
- <?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
152
- </a>
153
-
154
- <?php if ( !$info[ 'licence' ][ 'is_membership' ] && $this->show_renew_button ) : ?>
155
- <a class="button-licence licence-renew" href="<?php echo esc_url( $this->get_renewing_uri( $info[ 'licence' ][ 'licence_key' ] ) ) ?>" target="_blank">
156
- <?php _e( 'Renew', 'yith-plugin-fw' ) ?>
157
- </a>
158
- <?php endif; ?>
159
- </td>
160
- </tr>
161
- <?php endforeach; ?>
162
- </tbody>
163
- </table>
164
- <?php endif; ?>
165
-
166
- <!-- Banned Products -->
167
-
168
- <?php if ( !empty( $banned_products ) ) : ?>
169
- <h3><?php _e( 'Banned', 'yith-plugin-fw' ) ?></h3>
170
- <table class="expired-table">
171
- <thead>
172
- <tr>
173
- <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
174
- <?php if ( $this->show_extra_info ) : ?>
175
- <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
176
- <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
177
- <?php endif; ?>
178
- </tr>
179
- </thead>
180
- <tbody>
181
- <?php foreach ( $banned_products as $init => $info ) : ?>
182
- <tr>
183
- <td class="product-name">
184
- <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
185
- </td>
186
- <?php if ( $this->show_extra_info ) : ?>
187
- <td class="product-licence-email"><?php echo $info[ 'licence' ][ 'email' ] ?></td>
188
- <td class="product-licence-key"><?php echo $info[ 'licence' ][ 'licence_key' ] ?></td>
189
- <?php endif; ?>
190
- </tr>
191
- <?php endforeach; ?>
192
- </tbody>
193
- </table>
194
- <?php endif; ?>
195
-
196
- <!-- Expired Products -->
197
-
198
- <?php if ( !empty( $expired_products ) ) : ?>
199
- <h3><?php _e( 'Expired', 'yith-plugin-fw' ) ?></h3>
200
- <table class="expired-table">
201
- <thead>
202
- <tr>
203
- <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
204
-
205
- <?php if ( $this->show_extra_info ) : ?>
206
- <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
207
- <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
208
- <?php endif; ?>
209
-
210
- <th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
211
-
212
- <?php if ( $this->show_renew_button ) : ?>
213
- <th><?php _e( 'Renew', 'yith-plugin-fw' ) ?></th>
214
- <?php endif; ?>
215
- </tr>
216
- </thead>
217
- <tbody>
218
- <?php foreach ( $expired_products as $init => $info ) : ?>
219
- <tr>
220
- <td class="product-name">
221
- <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
222
- </td>
223
-
224
- <?php if ( $this->show_extra_info ) : ?>
225
- <td class="product-licence-email"><?php echo $info[ 'licence' ][ 'email' ] ?></td>
226
- <td class="product-licence-key"><?php echo $info[ 'licence' ][ 'licence_key' ] ?></td>
227
- <?php endif; ?>
228
-
229
- <td class="product-licence-expires"><?php echo date( "F j, Y", $info[ 'licence' ][ 'licence_expires' ] ); ?></td>
230
-
231
- <?php if ( $this->show_renew_button ) : ?>
232
- <td>
233
- <a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info[ 'licence' ][ 'licence_key' ] ) ?>" target="_blank">
234
- <?php if ( $info[ 'licence' ][ 'is_membership' ] ) : ?>
235
- <?php _e( 'Order again', 'yith-plugin-fw' ) ?>
236
- <?php else : ?>
237
- <?php __( 'Renew license', 'yith-plugin-fw' ) ?>
238
- <?php endif; ?>
239
- </a>
240
- </td>
241
- <?php endif; ?>
242
- </tr>
243
- <?php endforeach; ?>
244
- </tbody>
245
- </table>
246
- <?php endif; ?>
247
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-fw/templates/fields/colorpicker.php CHANGED
@@ -21,7 +21,7 @@ $class = !empty( $class ) ? $class : 'yith-plugin-fw-colorpicker';
21
 
22
  <input type="text" name="<?php echo $name ?>"
23
  id="<?php echo $id ?>" value="<?php echo esc_attr( $value ) ?>"
24
- <?php if ( isset( $std ) ) : ?>data-default-color="<?php echo $std ?>"<?php endif ?>
25
  class="<?php echo $class ?>"
26
  <?php echo $custom_attributes ?>
27
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
21
 
22
  <input type="text" name="<?php echo $name ?>"
23
  id="<?php echo $id ?>" value="<?php echo esc_attr( $value ) ?>"
24
+ <?php if ( isset( $default ) ) : ?> data-default-color="<?php echo $default ?>"<?php endif ?>
25
  class="<?php echo $class ?>"
26
  <?php echo $custom_attributes ?>
27
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
plugin-fw/templates/fields/date-format.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @var array $field
11
+ */
12
+
13
+ /** @since 3.1.30 */
14
+
15
+ ! defined( 'ABSPATH' ) && exit; // Exit if accessed directly
16
+
17
+ extract( $field );
18
+
19
+ $class = isset( $class ) ? $class : '';
20
+ $js = isset( $js ) ? $js : false;
21
+ $class = 'yith-plugin-fw-radio ' . $class;
22
+
23
+ $options = yith_get_date_format( $js );
24
+ $custom = true;
25
+ ?>
26
+ <div class="<?php echo $class ?> yith-plugin-fw-date-format" id="<?php echo $id ?>"
27
+ <?php echo $custom_attributes ?>
28
+ <?php if ( isset( $data ) ) {
29
+ echo yith_plugin_fw_html_data_to_string( $data );
30
+ } ?> value="<?php echo $value ?>">
31
+ <?php foreach ( $options as $key => $label ) :
32
+ $checked = '';
33
+ $radio_id = sanitize_key( $id . '-' . $key );
34
+ if ( $value === $key ) { // checked() uses "==" rather than "==="
35
+ $checked = " checked='checked'";
36
+ $custom = false;
37
+ }
38
+ ?>
39
+ <div class="yith-plugin-fw-radio__row">
40
+ <input type="radio" id="<?php echo esc_attr( $radio_id ) ?>" name="<?php echo $name ?>"
41
+ value="<?php echo esc_attr( $key ) ?>" <?php echo $checked ?> />
42
+ <label for="<?php echo esc_attr( $radio_id ) ?>"><?php echo date_i18n( $label ) ?>
43
+ <code><?php echo esc_html( $key ) ?></code></label>
44
+ </div>
45
+ <?php endforeach; ?>
46
+ <?php $radio_id = sanitize_key( $id . '-custom' ); ?>
47
+ <div class="yith-plugin-fw-radio__row">
48
+ <input type="radio" id="<?php echo esc_attr( $radio_id ) ?>" name="<?php echo esc_attr( $name ) ?>"
49
+ value="\c\u\s\t\o\m" <?php checked( $custom ); ?> />
50
+ <label for="<?php echo esc_attr( $radio_id ) ?>"> <?php _e( 'Custom:', 'yith-plugin-fw' ) ?></label>
51
+ <input type="text" name="<?php echo esc_attr( $name . '_text' ) ?>"
52
+ id="<?php echo esc_attr( $radio_id ) ?>_text" value="<?php echo esc_attr( $value ) ?>"
53
+ class="small-text"/>
54
+ </div>
55
+
56
+ </div>
plugin-fw/templates/fields/list-table.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ !defined( 'ABSPATH' ) && exit; // Exit if accessed directly
12
+
13
+ extract( $field );
14
+
15
+ $show_button = false;
16
+ if ( isset( $add_new_button ) && isset( $post_type ) ) {
17
+ $show_button = true;
18
+ $admin_url = admin_url( 'post-new.php' );
19
+ $params['post_type'] = $post_type;
20
+ $add_new_url = apply_filters( 'yith_plugin_fw_add_new_post_url', esc_url( add_query_arg( $params, $admin_url ) ), $params, isset( $args ) ? $args : false );
21
+ }
22
+
23
+ if ( isset( $list_table_class ) && ! class_exists( $list_table_class ) && isset( $list_table_class_dir ) ) {
24
+ include_once( $list_table_class_dir );
25
+ }
26
+
27
+ if ( class_exists( $list_table_class ) ):
28
+ $list_table = isset( $args ) ? new $list_table_class( $args ) : new $list_table_class() ;
29
+ ?>
30
+
31
+ <div id="<?php echo $id ?>" class="yith-plugin-fw-list-table <?php echo $class ?>">
32
+ <div class="yith-plugin-fw-list-table-container yith-plugin-fw yit-admin-panel-container">
33
+ <div class="list-table-title">
34
+ <h2>
35
+ <?php echo isset( $title ) ? $title : '' ?>
36
+ </h2>
37
+ <?php if( $show_button ): ?>
38
+ <a href="<?php echo $add_new_url; ?>" class="yith-add-button">
39
+ <?php echo $add_new_button ?>
40
+ </a>
41
+ <?php endif ?>
42
+ </div>
43
+
44
+ <?php if( isset( $desc) && !empty( $desc ) ) :?>
45
+ <p class="yith-section-description"><?php echo $desc ?></p>
46
+ <?php
47
+ endif;
48
+ $list_table->prepare_items();
49
+ $list_table->views();
50
+ ?>
51
+ <form method="post">
52
+ <?php if( isset( $search_form ) ) {
53
+ $list_table->search_box( $search_form['text'], $search_form['input_id'] );
54
+ } ?>
55
+ <?php
56
+ $list_table->display();
57
+ ?>
58
+ </form>
59
+ </div>
60
+ </div>
61
+
62
+ <?php endif; ?>
plugin-fw/templates/fields/multi-colorpicker.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @var array $field
11
+ */
12
+
13
+ !defined( 'ABSPATH' ) && exit; // Exit if accessed directly
14
+
15
+ wp_enqueue_style( 'wp-color-picker' );
16
+
17
+ extract( $field );
18
+ if ( ! isset( $colorpickers ) ){
19
+ return;
20
+ }
21
+ $class = !empty( $class ) ? $class : 'yith-plugin-fw-multi-colorpicker';
22
+ ?>
23
+ <div class="<?php echo esc_attr( $class )?>">
24
+
25
+ <?php
26
+ foreach ( $colorpickers as $colorpicker ):
27
+ $colorpicker['type'] = 'colorpicker';
28
+ $colorpicker['title'] = $colorpicker['name'];
29
+ $colorpicker['name'] = $name."[{$colorpicker['id']}]";
30
+ $colorpicker['value'] = isset( $value[$colorpicker['id']] ) ? $value[$colorpicker['id']] : $colorpicker['default'];
31
+ $colorpicker['id'] = $name."_".$colorpicker['id'];
32
+ ?>
33
+ <div class="yith-single-colorpicker colorpicker">
34
+ <label for="<?php echo esc_attr($colorpicker['id'] )?>"><?php echo esc_html($colorpicker['title']) ?></label>
35
+ <?php echo yith_plugin_fw_get_field( $colorpicker, true, false ); ?>
36
+ </div>
37
+
38
+ <?php endforeach;?>
39
+ </div>
plugin-fw/templates/fields/onoff.php CHANGED
@@ -17,7 +17,7 @@ extract( $field );
17
 
18
  <div class="yith-plugin-fw-onoff-container">
19
  <input type="checkbox" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php checked( yith_plugin_fw_is_true( $value ) ) ?> class="on_off" <?php if ( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?> />
20
- <span class="yith-plugin-fw-onoff">&nbsp;</span>
21
  </div>
22
  <?php
23
  if ( isset( $field[ 'desc-inline' ] ) ) {
17
 
18
  <div class="yith-plugin-fw-onoff-container">
19
  <input type="checkbox" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php checked( yith_plugin_fw_is_true( $value ) ) ?> class="on_off" <?php if ( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?> />
20
+ <span class="yith-plugin-fw-onoff"></span>
21
  </div>
22
  <?php
23
  if ( isset( $field[ 'desc-inline' ] ) ) {
plugin-fw/templates/fields/select-buttons.php CHANGED
@@ -18,19 +18,20 @@ $field[ 'type' ] = 'select';
18
 
19
  if ( empty( $field[ 'class' ] ) ) unset( $field[ 'class' ] );
20
 
 
21
  $default_args = array(
22
  'multiple' => true,
23
  'class' => 'wc-enhanced-select',
24
  'buttons' => array(
25
  array(
26
- 'name' => __( 'Select All', 'yith-plugin-fw' ),
27
  'class' => 'yith-plugin-fw-select-all',
28
  'data' => array(
29
  'select-id' => $field[ 'id' ]
30
  ),
31
  ),
32
  array(
33
- 'name' => __( 'Deselect All', 'yith-plugin-fw' ),
34
  'class' => 'yith-plugin-fw-deselect-all',
35
  'data' => array(
36
  'select-id' => $field[ 'id' ]
18
 
19
  if ( empty( $field[ 'class' ] ) ) unset( $field[ 'class' ] );
20
 
21
+ $add_label = isset( $field['add_all_button_label'] ) ? $field['add_all_button_label'] : __( 'Add All', 'yith-plugin-fw' );
22
  $default_args = array(
23
  'multiple' => true,
24
  'class' => 'wc-enhanced-select',
25
  'buttons' => array(
26
  array(
27
+ 'name' => $add_label,
28
  'class' => 'yith-plugin-fw-select-all',
29
  'data' => array(
30
  'select-id' => $field[ 'id' ]
31
  ),
32
  ),
33
  array(
34
+ 'name' => __( 'Remove All', 'yith-plugin-fw' ),
35
  'class' => 'yith-plugin-fw-deselect-all',
36
  'data' => array(
37
  'select-id' => $field[ 'id' ]
plugin-fw/templates/fields/select.php CHANGED
@@ -15,17 +15,19 @@
15
  extract( $field );
16
  $multiple = isset( $multiple ) && $multiple;
17
  $multiple_html = ( $multiple ) ? ' multiple' : '';
18
-
19
  if ( $multiple && !is_array( $value ) )
20
  $value = array();
21
 
22
  $class = isset( $class ) ? $class : 'yith-plugin-fw-select';
23
  ?>
24
  <select<?php echo $multiple_html ?>
25
- id="<?php echo $id ?>"
26
  name="<?php echo $name ?><?php if ( $multiple ) echo "[]" ?>" <?php if ( isset( $std ) ) : ?>
27
  data-std="<?php echo ( $multiple ) ? implode( ' ,', $std ) : $std ?>"<?php endif ?>
 
28
  class="<?php echo $class ?>"
 
29
  <?php echo $custom_attributes ?>
30
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>>
31
  <?php foreach ( $options as $key => $item ) : ?>
15
  extract( $field );
16
  $multiple = isset( $multiple ) && $multiple;
17
  $multiple_html = ( $multiple ) ? ' multiple' : '';
18
+ $placeholder = isset( $placeholder ) ? ' data-placeholder = "' . $placeholder .'" ': '';
19
  if ( $multiple && !is_array( $value ) )
20
  $value = array();
21
 
22
  $class = isset( $class ) ? $class : 'yith-plugin-fw-select';
23
  ?>
24
  <select<?php echo $multiple_html ?>
25
+ id="<?php echo $id ?>"
26
  name="<?php echo $name ?><?php if ( $multiple ) echo "[]" ?>" <?php if ( isset( $std ) ) : ?>
27
  data-std="<?php echo ( $multiple ) ? implode( ' ,', $std ) : $std ?>"<?php endif ?>
28
+
29
  class="<?php echo $class ?>"
30
+ <?php echo $placeholder ?>
31
  <?php echo $custom_attributes ?>
32
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>>
33
  <?php foreach ( $options as $key => $item ) : ?>
plugin-fw/templates/fields/text.php CHANGED
@@ -24,3 +24,4 @@ $class = isset( $class ) ? $class : 'yith-plugin-fw-text-input';
24
  <?php echo $custom_attributes ?>
25
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
26
 
 
24
  <?php echo $custom_attributes ?>
25
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
26
 
27
+
plugin-fw/templates/fields/textarea.php CHANGED
@@ -15,10 +15,12 @@
15
  extract( $field );
16
 
17
  $class = isset( $class ) ? $class : 'yith-plugin-fw-textarea';
 
 
18
  ?>
19
  <textarea id="<?php echo $id ?>"
20
  name="<?php echo $name ?>"
21
  class="<?php echo $class ?>"
22
- rows="5" cols="50" <?php if ( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?>
23
  <?php echo $custom_attributes ?>
24
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>><?php echo $value ?></textarea>
15
  extract( $field );
16
 
17
  $class = isset( $class ) ? $class : 'yith-plugin-fw-textarea';
18
+ $rows = isset( $rows ) ? $rows : 5;
19
+ $cols = isset( $cols ) ? $cols : 50;
20
  ?>
21
  <textarea id="<?php echo $id ?>"
22
  name="<?php echo $name ?>"
23
  class="<?php echo $class ?>"
24
+ rows="<?php echo $rows ?>" cols="<?php echo $cols ?>" <?php if ( isset( $std ) ) : ?>data-std="<?php echo $std ?>"<?php endif ?>
25
  <?php echo $custom_attributes ?>
26
  <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>><?php echo $value ?></textarea>
plugin-fw/templates/fields/toggle-element.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ //delete_option('ywraq_toggle_element');
7
+ $defaults = array(
8
+ 'id' => '',
9
+ 'add_button' => '',
10
+ 'name' => '',
11
+ 'class' => '',
12
+ 'custom_attributes' => '',
13
+ 'elements' => array(),
14
+ 'title' => '',
15
+ 'subtitle' => '',
16
+ 'onoff_field' => array(),
17
+ //is an array to print a onoff field, if need to call an ajax action, add 'ajax_action' => 'myaction' in the array args,
18
+ 'sortable' => false,
19
+ 'save_button' => array(),
20
+ 'delete_button' => array()
21
+
22
+ );
23
+ $field = wp_parse_args( $field, $defaults );
24
+
25
+ extract( $field );
26
+
27
+ $show_add_button = isset( $add_button ) && $add_button;
28
+ $values = isset( $value ) ? $value : get_option( $name, array() );
29
+ $values = maybe_unserialize( $values );
30
+ $sortable = isset( $sortable ) ? $sortable : false;
31
+ $class_wrapper = $sortable ? 'ui-sortable' : '';
32
+ $onoff_id = isset( $onoff_field['id'] ) ? $onoff_field['id'] : '';
33
+
34
+ if ( empty( $values ) && ! $show_add_button && $elements ) {
35
+ //populate a toggle element with the default
36
+ foreach ( $elements as $element ) {
37
+ $values[0][ $element['id'] ] = $element['default'];
38
+ }
39
+ }
40
+ ?>
41
+ <div class="yith-toggle_wrapper <?php echo $class_wrapper ?>" id="<?php echo $id ?>">
42
+ <?php
43
+
44
+ if ( $show_add_button ):
45
+
46
+ ?>
47
+ <button class="yith-add-button yith-add-box-button"
48
+ data-box_id="<?php echo $id; ?>_add_box"><?php echo $add_button; ?></button>
49
+ <div id="<?php echo $id; ?>_add_box" class="yith-add-box">
50
+ </div>
51
+ <script type="text/template" id="tmpl-yith-toggle-element-add-box-content-<?php echo $id ?>">
52
+ <?php foreach ( $elements as $element ):
53
+ $element['title'] = $element['name'];
54
+ $element['type'] = isset( $element['yith-type'] ) ? $element['yith-type'] : $element['type'];
55
+ unset( $element['yith-type'] );
56
+ $element['value'] = isset($element['default']) ? $element['default'] : '';
57
+ $element['id'] = 'new_'.$element['id'];
58
+ $element['name'] = $name. "[{{{data.index}}}][" . $element['id'] . "]";
59
+
60
+ ?>
61
+ <div class="yith-add-box-row <?php echo '{{{data.index}}}'?>">
62
+
63
+ <label for="<?php echo $element['id']; ?>"><?php echo esc_html( $element['title'] ); ?></label>
64
+ <div class="yith-plugin-fw-option-with-description">
65
+ <?php
66
+ echo yith_plugin_fw_get_field( $element, true ); ?>
67
+ <span class="description"><?php echo ! empty( $element['desc'] ) ? $element['desc'] : ''; ?></span>
68
+ </div>
69
+ </div>
70
+ <?php endforeach; ?>
71
+
72
+ <div class="yith-add-box-buttons">
73
+ <button class="yith-save-button">
74
+ <?php echo $save_button['name'] ; ?>
75
+ </button>
76
+ </div>
77
+ </script>
78
+ <?php endif; ?>
79
+
80
+ <div class="yith-toggle-elements">
81
+ <?php
82
+ if ($values ):
83
+ //print toggle elements
84
+ foreach ( $values as $i => $value ):
85
+ $title_element = yith_format_toggle_title( $title, $value );
86
+ $title_element = apply_filters( 'yith_plugin_fw_toggle_element_title_' . $id, $title_element, $elements, $value );
87
+ $subtitle_element = yith_format_toggle_title( $subtitle, $value );
88
+ $subtitle_element = apply_filters( 'yith_plugin_fw_toggle_element_subtitle_' . $id, $subtitle_element, $elements, $value );
89
+ ?>
90
+
91
+ <div id="<?php echo $id; ?>_<?php echo $i; ?>"
92
+ class="yith-toggle-row <?php echo ! empty( $subtitle ) ? 'with-subtitle' : ''; ?> <?php echo $class; ?>" <?php echo $custom_attributes; ?>
93
+ data-item_key="<?php echo esc_attr( $i ) ?>">
94
+ <div class="yith-toggle-title">
95
+ <h3>
96
+ <span class="title"
97
+ data-title_format="<?php echo esc_attr( $title ) ?>"><?php echo $title_element ?></span>
98
+ <?php if ( ! empty( $subtitle_element ) ): ?>
99
+ <div class="subtitle"
100
+ data-subtitle_format="<?php echo esc_attr( $subtitle ) ?>"><?php echo $subtitle_element; ?></div>
101
+ <?php endif; ?>
102
+ </h3>
103
+ <span class="yith-toggle">
104
+ <span class="yith-icon icon-arrow_right ui-sortable-handle"></span>
105
+ </span>
106
+ <?php
107
+ if ( ! empty( $onoff_field ) && is_array( $onoff_field ) ):
108
+ $action = ! empty( $onoff_field['ajax_action'] ) ? 'data-ajax_action="' . $onoff_field['ajax_action'] . '"' : '';
109
+ $onoff_field['value'] = isset( $value[ $onoff_id ] ) ? $value[ $onoff_id ] : $onoff_field['default'];
110
+ $onoff_field['type'] = 'onoff';
111
+ $onoff_field['name'] = $name. "[$i][" . $onoff_id . "]";
112
+ $onoff_field['id'] = $onoff_id.'_'.$i;
113
+ unset( $onoff_field['yith-type'] );
114
+ ?>
115
+ <span class="yith-toggle-onoff" <?php echo $action; ?> >
116
+ <?php
117
+ echo yith_plugin_fw_get_field( $onoff_field, true );
118
+ ?>
119
+ </span>
120
+
121
+ <?php if ( $sortable ): ?>
122
+ <span class="yith-icon icon-drag"></span>
123
+ <?php endif ?>
124
+
125
+ <?php endif; ?>
126
+ </div>
127
+ <div class="yith-toggle-content">
128
+ <?php
129
+ if ( $elements && count( $elements ) > 0 ) {
130
+ foreach ( $elements as $element ):
131
+ $element['type'] = isset( $element['yith-type'] ) ? $element['yith-type'] : $element['type'];
132
+ unset( $element['yith-type'] );
133
+ $element['title'] = $element['name'];
134
+ $element['name'] = $name . "[$i][" . $element['id'] . "]";
135
+ $element['value'] = isset( $value[ $element['id'] ] ) ? $value[ $element['id'] ] : $element['default'];
136
+ $element['id'] = $element['id'].'_'.$i;
137
+ ?>
138
+ <div class="yith-toggle-content-row <?php echo $element['type'] ?>">
139
+ <label for="<?php echo $element['id']; ?>"><?php echo $element['title']; ?></label>
140
+ <div class="yith-plugin-fw-option-with-description">
141
+ <?php echo yith_plugin_fw_get_field( $element, true ); ?>
142
+ <span class="description"><?php echo ! empty( $element['desc'] ) ? $element['desc'] : ''; ?></span>
143
+ </div>
144
+ </div>
145
+ <?php endforeach;
146
+ }
147
+ ?>
148
+ <div class="yith-toggle-content-buttons">
149
+ <div class="spinner"></div>
150
+ <?php
151
+ if ( $save_button && ! empty( $save_button['id'] ) ):
152
+ $save_button_class = isset( $save_button['class'] ) ? $save_button['class'] : '';
153
+ $save_button_name = isset( $save_button['name'] ) ? $save_button['name'] : '';
154
+ ?>
155
+ <button id="<?php echo $save_button['id']; ?>"
156
+ class="yith-save-button <?php echo $save_button_class; ?>">
157
+ <?php echo $save_button_name; ?>
158
+ </button>
159
+ <?php endif; ?>
160
+ <?php
161
+ if ( $delete_button && ! empty( $delete_button['id'] ) ):
162
+ $delete_button_class = isset( $delete_button['class'] ) ? $delete_button['class'] : '';
163
+ $delete_button_name = isset( $delete_button['name'] ) ? $delete_button['name'] : '';
164
+ ?>
165
+ <button id="<?php echo $delete_button['id']; ?>"
166
+ class="button-secondary yith-delete-button <?php echo $delete_button_class; ?>">
167
+ <?php echo $delete_button_name; ?>
168
+ </button>
169
+ <?php endif; ?>
170
+ </div>
171
+ </div>
172
+
173
+ </div>
174
+ <?php endforeach;
175
+ endif;
176
+ ?>
177
+
178
+
179
+ </div>
180
+ <!-- Schedule Item template -->
181
+ <script type="text/template" id="tmpl-yith-toggle-element-item-<?php echo $id ?>">
182
+ <div id="<?php echo $id; ?>_{{{data.index}}}"
183
+ class="yith-toggle-row <?php echo ! empty( $subtitle ) ? 'with-subtitle' : ''; ?> <?php echo $class; ?>"
184
+ data-item_key="{{{data.index}}}" <?php echo $custom_attributes; ?>
185
+ data-item_key="{{{data.index}}}">
186
+ <div class="yith-toggle-title">
187
+ <h3>
188
+ <span class="title" data-title_format="<?php echo esc_attr( $title ) ?>"><?php echo $title ?></span>
189
+
190
+ <div class="subtitle"
191
+ data-subtitle_format="<?php echo esc_attr( $subtitle ) ?>"><?php echo $subtitle ?></div>
192
+
193
+ </h3>
194
+ <span class="yith-toggle">
195
+ <span class="yith-icon icon-arrow_right"></span>
196
+ </span>
197
+ <?php
198
+ if ( ! empty( $onoff_field ) && is_array( $onoff_field ) ):
199
+ $action = ! empty( $onoff_field['ajax_action'] ) ? 'data-ajax_action="' . $onoff_field['ajax_action'] . '"' : '';
200
+ $onoff_field['value'] = $onoff_field['default'];
201
+ $onoff_field['type'] = 'onoff';
202
+ $onoff_field['name'] = $name . "[{{{data.index}}}][" . $onoff_id . "]";
203
+ $onoff_field['id'] = $onoff_id;
204
+ unset( $onoff_field['yith-type'] );
205
+ ?>
206
+ <span class="yith-toggle-onoff" <?php echo $action; ?> >
207
+ <?php
208
+ echo yith_plugin_fw_get_field( $onoff_field, true );
209
+ ?>
210
+ </span>
211
+
212
+ <?php endif; ?>
213
+ <?php if ( $sortable ): ?>
214
+ <span class="yith-icon icon-drag ui-sortable-handle"></span>
215
+ <?php endif ?>
216
+ </div>
217
+ <div class="yith-toggle-content">
218
+ <?php
219
+ if ( $elements && count( $elements ) > 0 ) {
220
+ foreach ( $elements as $element ):
221
+ $element['type'] = isset( $element['yith-type'] ) ? $element['yith-type'] : $element['type'];
222
+ unset( $element['yith-type'] );
223
+ $element['title'] = $element['name'];
224
+ $element['name'] = $name . "[{{{data.index}}}][" . $element['id'] . "]";
225
+ $element['id'] = $element['id'].'_{{{data.index}}}';
226
+ ?>
227
+ <div class="yith-toggle-content-row <?php echo $element['type'] ?>">
228
+ <label for="<?php echo $element['id']; ?>"><?php echo $element['title']; ?></label>
229
+ <div class="yith-plugin-fw-option-with-description">
230
+ <?php echo yith_plugin_fw_get_field( $element, true ); ?>
231
+ <span class="description"><?php echo ! empty( $element['desc'] ) ? $element['desc'] : ''; ?></span>
232
+ </div>
233
+ </div>
234
+ <?php endforeach;
235
+ }
236
+ ?>
237
+ <div class="yith-toggle-content-buttons">
238
+ <div class="spinner"></div>
239
+ <?php
240
+ if ( $save_button && ! empty( $save_button['id'] ) ):
241
+ $save_button_class = isset( $save_button['class'] ) ? $save_button['class'] : '';
242
+ $save_button_name = isset( $save_button['name'] ) ? $save_button['name'] : '';
243
+ ?>
244
+ <button id="<?php echo $save_button['id']; ?>"
245
+ class="yith-save-button <?php echo $save_button_class; ?>">
246
+ <?php echo $save_button_name; ?>
247
+ </button>
248
+ <?php endif; ?>
249
+ <?php
250
+ if ( $delete_button && ! empty( $delete_button['id'] ) ):
251
+ $delete_button_class = isset( $delete_button['class'] ) ? $delete_button['class'] : '';
252
+ $delete_button_name = isset( $delete_button['name'] ) ? $delete_button['name'] : '';
253
+ ?>
254
+ <button id="<?php echo $delete_button['id']; ?>"
255
+ class="button-secondary yith-delete-button <?php echo $delete_button_class; ?>">
256
+ <?php echo $delete_button_name; ?>
257
+ </button>
258
+ <?php endif; ?>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ </script>
263
+
264
+ </div>
plugin-fw/templates/fields/upload.php CHANGED
@@ -14,15 +14,15 @@
14
 
15
  extract( $field );
16
  ?>
17
- <input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php if ( isset( $default ) ) : ?>data-std="<?php echo $default ?>"<?php endif ?> class="yith-plugin-fw-upload-img-url"/>
18
- <input type="button" class="button-secondary yith-plugin-fw-upload-button" id="<?php echo $id ?>-button" value="<?php _e( 'Upload', 'yith-plugin-fw' ) ?>"/>
19
- <input type="button" value="<?php _e( 'Reset', 'yith-plugin-fw' ) ?>" id="<?php echo $id ?>-button-reset" class="yith-plugin-fw-upload-button-reset button"
20
- data-default="<?php echo isset( $default ) ? $default : '' ?>"/>
21
  <div class="yith-plugin-fw-upload-img-preview" style="margin-top:10px;">
22
- <?php
23
- $file = $value;
24
- if ( preg_match( '/(jpg|jpeg|png|gif|ico)$/', $file ) ) {
25
- echo "<img src='$file' style='max-width:600px; max-height:300px;' />";
26
- }
27
- ?>
28
- </div>
 
 
 
 
14
 
15
  extract( $field );
16
  ?>
 
 
 
 
17
  <div class="yith-plugin-fw-upload-img-preview" style="margin-top:10px;">
18
+ <?php
19
+ $file = $value;
20
+ if ( preg_match( '/(jpg|jpeg|png|gif|ico)$/', $file ) ) {
21
+ echo "<img src='$file' style='max-width:600px; max-height:300px;' />";
22
+ }
23
+ ?>
24
+ </div>
25
+ <input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php if ( isset( $default ) ) : ?>data-std="<?php echo $default ?>"<?php endif ?> class="yith-plugin-fw-upload-img-url"/>
26
+ <button class="button-secondary yith-plugin-fw-upload-button" id="<?php echo $id ?>-button"><?php _e( 'Upload', 'yith-plugin-fw' ) ?></button>
27
+ <button type="button" id="<?php echo $id ?>-button-reset" class="yith-plugin-fw-upload-button-reset button"
28
+ data-default="<?php echo isset( $default ) ? $default : '' ?>"><?php _e( 'Reset', 'yith-plugin-fw' ) ?></button>
plugin-fw/templates/metaboxes/field-row.php CHANGED
@@ -31,6 +31,7 @@ $default_field = array(
31
  $field = wp_parse_args( $field, $default_field );
32
 
33
  $display_field_only = isset( $field[ 'display-field-only' ] ) ? $field[ 'display-field-only' ] : false;
 
34
  ?>
35
  <div id="<?php echo $field[ 'id' ] ?>-container" <?php echo yith_field_deps_data( $field ); ?> class="yith-plugin-fw-metabox-field-row">
36
  <?php if ( $display_field_only ) :
31
  $field = wp_parse_args( $field, $default_field );
32
 
33
  $display_field_only = isset( $field[ 'display-field-only' ] ) ? $field[ 'display-field-only' ] : false;
34
+
35
  ?>
36
  <div id="<?php echo $field[ 'id' ] ?>-container" <?php echo yith_field_deps_data( $field ); ?> class="yith-plugin-fw-metabox-field-row">
37
  <?php if ( $display_field_only ) :
plugin-fw/templates/metaboxes/tab.php CHANGED
@@ -13,9 +13,11 @@ if ( !defined( 'ABSPATH' ) ) {
13
  } // Exit if accessed directly
14
 
15
  global $post;
 
 
16
 
17
  do_action( 'yit_before_metaboxes_tab' ) ?>
18
- <div class="yith-plugin-fw metaboxes-tab">
19
  <?php do_action( 'yit_before_metaboxes_labels' ) ?>
20
  <ul class="metaboxes-tabs clearfix"<?php if ( count( $tabs ) <= 1 ) : ?> style="display:none;"<?php endif; ?>>
21
  <?php
@@ -81,12 +83,14 @@ do_action( 'yit_before_metaboxes_tab' ) ?>
81
  if ( $field_template_path = yith_plugin_fw_get_field_template_path( $field ) ) {
82
  $display_row = 'hidden' !== $field[ 'type' ];
83
  $display_row = isset( $field[ 'yith-display-row' ] ) ? !!$field[ 'yith-display-row' ] : $display_row;
84
- $field[ 'display-field-only' ] = in_array( $field[ 'type' ], array( 'hidden', 'html', 'sep', 'simple-text', 'title' ) );
85
 
86
  if ( $display_row ) {
 
87
  $field_row_path = apply_filters( 'yith_plugin_fw_metabox_field_row_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/metaboxes/field-row.php', $field );
88
  file_exists( $field_row_path ) && include( $field_row_path );
89
  } else {
 
90
  yith_plugin_fw_get_field( $field, true );
91
  }
92
  } else {
13
  } // Exit if accessed directly
14
 
15
  global $post;
16
+ $classes = apply_filters('yith_plugin_fw_metabox_class', '', $post );
17
+ $classes = yith_plugin_fw_remove_duplicate_classes( $classes );
18
 
19
  do_action( 'yit_before_metaboxes_tab' ) ?>
20
+ <div class="yith-plugin-fw metaboxes-tab <?php echo esc_attr($classes )?>">
21
  <?php do_action( 'yit_before_metaboxes_labels' ) ?>
22
  <ul class="metaboxes-tabs clearfix"<?php if ( count( $tabs ) <= 1 ) : ?> style="display:none;"<?php endif; ?>>
23
  <?php
83
  if ( $field_template_path = yith_plugin_fw_get_field_template_path( $field ) ) {
84
  $display_row = 'hidden' !== $field[ 'type' ];
85
  $display_row = isset( $field[ 'yith-display-row' ] ) ? !!$field[ 'yith-display-row' ] : $display_row;
86
+ $field[ 'display-field-only' ] = in_array( $field[ 'type' ], array( 'hidden', 'html', 'sep', 'simple-text', 'title') );
87
 
88
  if ( $display_row ) {
89
+
90
  $field_row_path = apply_filters( 'yith_plugin_fw_metabox_field_row_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/metaboxes/field-row.php', $field );
91
  file_exists( $field_row_path ) && include( $field_row_path );
92
  } else {
93
+
94
  yith_plugin_fw_get_field( $field, true );
95
  }
96
  } else {
plugin-fw/templates/panel/woocommerce/woocommerce-option-row.php CHANGED
@@ -10,7 +10,7 @@ $default_field = array(
10
  );
11
  $field = wp_parse_args( $field, $default_field );
12
 
13
- $display_row = !in_array( $field[ 'type' ], array( 'hidden', 'html', 'sep', 'simple-text', 'title' ) );
14
  $display_row = isset( $field[ 'yith-display-row' ] ) ? !!$field[ 'yith-display-row' ] : $display_row;
15
 
16
  $extra_row_classes = apply_filters( 'yith_plugin_fw_panel_wc_extra_row_classes', array(), $field );
10
  );
11
  $field = wp_parse_args( $field, $default_field );
12
 
13
+ $display_row = !in_array( $field[ 'type' ], array( 'hidden', 'html', 'sep', 'simple-text', 'title', 'list-table' ) );
14
  $display_row = isset( $field[ 'yith-display-row' ] ) ? !!$field[ 'yith-display-row' ] : $display_row;
15
 
16
  $extra_row_classes = apply_filters( 'yith_plugin_fw_panel_wc_extra_row_classes', array(), $field );
plugin-fw/templates/panel/woocommerce/woocommerce-panel.php CHANGED
@@ -1,10 +1,14 @@
1
  <?php add_thickbox();?>
2
- <div class="wrap">
3
  <div id="icon-users" class="icon32"><br/></div>
 
4
  <?php if( ! empty( $available_tabs ) ): ?>
5
  <h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
6
- <?php foreach( $available_tabs as $id => $label ): ?>
7
- <a href="?page=<?php echo $page ?>&tab=<?php echo $id ?>" class="nav-tab <?php echo ( $current_tab == $id ) ? 'nav-tab-active' : '' ?>"><?php echo $label ?></a>
 
 
 
8
  <?php endforeach; ?>
9
  </h2>
10
  <?php $this->print_panel_content() ?>
1
  <?php add_thickbox();?>
2
+ <div class="wrap <?php echo $wrap_class?>">
3
  <div id="icon-users" class="icon32"><br/></div>
4
+ <?php do_action('yith_plugin_fw_before_woocommerce_panel', $page )?>
5
  <?php if( ! empty( $available_tabs ) ): ?>
6
  <h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
7
+ <?php foreach( $available_tabs as $id => $label ):
8
+ $active_class = ( $current_tab == $id ) ? ' nav-tab-active' : '';
9
+ $active_class .= 'premium' == $id ? ' yith-premium ': '';
10
+ ?>
11
+ <a href="?page=<?php echo $page ?>&tab=<?php echo $id ?>" class="nav-tab <?php echo $active_class ?>"><?php echo $label ?></a>
12
  <?php endforeach; ?>
13
  </h2>
14
  <?php $this->print_panel_content() ?>
plugin-fw/yit-functions.php CHANGED
@@ -1007,6 +1007,7 @@ if ( !function_exists( 'yith_plugin_fw_get_field' ) ) {
1007
 
1008
 
1009
  $field_template = yith_plugin_fw_get_field_template_path( $field );
 
1010
  if ( $field_template ) {
1011
  if ( !$echo )
1012
  ob_start();
@@ -1035,6 +1036,7 @@ if ( !function_exists( 'yith_plugin_fw_get_field_template_path' ) ) {
1035
  return false;
1036
 
1037
  $field_template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/fields/' . sanitize_title( $field[ 'type' ] ) . '.php';
 
1038
  $field_template = apply_filters( 'yith_plugin_fw_get_field_template_path', $field_template, $field );
1039
 
1040
  return file_exists( $field_template ) ? $field_template : false;
@@ -1238,4 +1240,140 @@ if( ! function_exists( 'yith_plugin_fw_get_default_logo' ) ){
1238
  function yith_plugin_fw_get_default_logo(){
1239
  return YIT_CORE_PLUGIN_URL . '/assets/images/yith-icon.svg';
1240
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1241
  }
1007
 
1008
 
1009
  $field_template = yith_plugin_fw_get_field_template_path( $field );
1010
+
1011
  if ( $field_template ) {
1012
  if ( !$echo )
1013
  ob_start();
1036
  return false;
1037
 
1038
  $field_template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/fields/' . sanitize_title( $field[ 'type' ] ) . '.php';
1039
+
1040
  $field_template = apply_filters( 'yith_plugin_fw_get_field_template_path', $field_template, $field );
1041
 
1042
  return file_exists( $field_template ) ? $field_template : false;
1240
  function yith_plugin_fw_get_default_logo(){
1241
  return YIT_CORE_PLUGIN_URL . '/assets/images/yith-icon.svg';
1242
  }
1243
+ }
1244
+
1245
+ if ( ! function_exists( 'yith_set_wrapper_class' ) ) {
1246
+ /**
1247
+ * Return the class for the new plugin panel style.
1248
+ *
1249
+ * @param $class array|string the list of additional classes to add inside the panel wrapper.
1250
+ *
1251
+ * @return string
1252
+ *
1253
+ * @author Emanuela Castorina
1254
+ */
1255
+ function yith_set_wrapper_class( $class = '' ) {
1256
+ $new_class = 'yith-plugin-ui';
1257
+ $class = ( ! empty( $class ) && is_array( $class ) ) ? implode( ' ', $class ) : $class;
1258
+
1259
+ return $new_class . ' ' . $class;
1260
+ }
1261
+ }
1262
+
1263
+ if( ! function_exists('yith_get_date_format') ){
1264
+ /**
1265
+ * get all available date format
1266
+ * @since 3.1
1267
+ * @author Salvatore Strano
1268
+ * @return array
1269
+ */
1270
+
1271
+ function yith_get_date_format( $js = true ){
1272
+
1273
+ $date_formats = array(
1274
+ 'F j, Y' => 'F j, Y',
1275
+ 'Y-m-d' => 'Y-m-d',
1276
+ 'm/d/Y' => 'm/d/Y',
1277
+ 'd/m/Y' => 'd/m/Y',
1278
+ );
1279
+
1280
+ if( $js ){
1281
+ $date_formats = array(
1282
+ 'MM d, yy' => 'F j, Y',
1283
+ 'yy-mm-dd' => 'Y-m-d',
1284
+ 'mm/dd/yy' => 'm/d/Y',
1285
+ 'dd/mm/yy' => 'd/m/Y',
1286
+ );
1287
+ }
1288
+
1289
+ return apply_filters( 'yith_plugin_fw_date_formats', $date_formats, $js) ;
1290
+ }
1291
+ }
1292
+
1293
+
1294
+ if( ! function_exists('yith_format_toggle_title') ) {
1295
+ /**
1296
+ * replace the placeholders with the values of the element id
1297
+ * for toggle element field.
1298
+ *
1299
+ * @return array
1300
+ * @author Salvatore Strano
1301
+ * @since 3.1
1302
+ */
1303
+
1304
+ function yith_format_toggle_title( $title, $value ) {
1305
+ preg_match_all( '/(?<=\%%).+?(?=\%%)/', $title, $matches );
1306
+ if ( isset( $matches[0] ) ) {
1307
+ foreach ( $matches[0] as $element_id ) {
1308
+ if ( isset( $value[ $element_id ] ) ) {
1309
+ $title = str_replace( '%%' . $element_id . '%%', $value[ $element_id ], $title );
1310
+ }
1311
+ }
1312
+ }
1313
+
1314
+ return $title;
1315
+ }
1316
+ }
1317
+
1318
+ if( ! function_exists( 'yith_plugin_fw_load_update_and_licence_files' ) ){
1319
+ /**
1320
+ * Load premium file for license and update system
1321
+ *
1322
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
1323
+ *
1324
+ * @return void
1325
+ */
1326
+ function yith_plugin_fw_load_update_and_licence_files(){
1327
+ global $plugin_upgrade_fw_data;
1328
+
1329
+ /**
1330
+ * If the init.php was load by old plugin-fw version
1331
+ * load the upgrade and license key from local folder
1332
+ */
1333
+ if( empty( $plugin_upgrade_fw_data ) ){
1334
+ $plugin_upgrade_path = plugin_dir_path( __DIR__ ) . 'plugin-upgrade';
1335
+ if( file_exists( $plugin_upgrade_path ) ){
1336
+ $required_files = array(
1337
+ $plugin_upgrade_path . '/lib/yit-licence.php',
1338
+ $plugin_upgrade_path . '/lib/yit-plugin-licence.php',
1339
+ $plugin_upgrade_path . '/lib/yit-theme-licence.php',
1340
+ $plugin_upgrade_path . '/lib/yit-plugin-upgrade.php'
1341
+ );
1342
+
1343
+ $plugin_upgrade_fw_data = array( '1.0' => $required_files );
1344
+ }
1345
+ }
1346
+
1347
+ if( ! empty( $plugin_upgrade_fw_data ) && is_array( $plugin_upgrade_fw_data ) ){
1348
+ foreach ( $plugin_upgrade_fw_data as $fw_version=> $core_files ){
1349
+ foreach ( $core_files as $core_file ){
1350
+ if( file_exists( $core_file ) ){
1351
+ include_once $core_file;
1352
+ }
1353
+ }
1354
+ }
1355
+ }
1356
+ }
1357
+ }
1358
+
1359
+ if ( ! function_exists( 'yith_plugin_fw_remove_duplicate_classes' ) ) {
1360
+ /**
1361
+ * Remove the duplicate classes from a string.
1362
+ *
1363
+ * @param $classes string
1364
+ *
1365
+ * @return string
1366
+ *
1367
+ * @since 3.2.2
1368
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
1369
+ */
1370
+ function yith_plugin_fw_remove_duplicate_classes( $classes ) {
1371
+ $class_array = explode( ' ', $classes );
1372
+ $class_unique = array_unique( array_filter( $class_array ) );
1373
+ if ( $class_unique ) {
1374
+ $classes = implode( ' ', $class_unique );
1375
+ }
1376
+
1377
+ return $classes;
1378
+ }
1379
  }
plugin-fw/yit-plugin.php CHANGED
@@ -28,9 +28,8 @@ include_once( 'lib/yit-ajax.php' );
28
  include_once( 'lib/yit-plugin-subpanel.php' );
29
  include_once( 'lib/yit-plugin-common.php' );
30
  include_once( 'lib/yit-plugin-gradients.php');
31
- include_once( 'licence/lib/yit-licence.php');
32
- include_once( 'licence/lib/yit-plugin-licence.php');
33
- include_once( 'licence/lib/yit-theme-licence.php');
34
  include_once( 'lib/yit-video.php');
35
  include_once( 'lib/yit-upgrade.php');
36
  include_once( 'lib/yit-pointers.php');
@@ -40,6 +39,7 @@ include_once( 'lib/yit-debug.php');
40
  include_once( 'lib/yith-dashboard.php' );
41
  include_once( 'lib/privacy/yit-privacy.php' );
42
  include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
 
43
 
44
  /* === Gutenberg Support === */
45
  if( class_exists( 'WP_Block_Type_Registry' ) ){
@@ -188,7 +188,7 @@ if( ! function_exists( 'yith_add_action_links' ) ){
188
  }
189
 
190
  if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
191
- $links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence::get_license_activation_url(),__( 'License', 'yith-plugin-fw' ) );
192
  }
193
 
194
  return $links;
28
  include_once( 'lib/yit-plugin-subpanel.php' );
29
  include_once( 'lib/yit-plugin-common.php' );
30
  include_once( 'lib/yit-plugin-gradients.php');
31
+ include_once( 'lib/yit-plugin-licence.php');
32
+ include_once( 'lib/yit-theme-licence.php');
 
33
  include_once( 'lib/yit-video.php');
34
  include_once( 'lib/yit-upgrade.php');
35
  include_once( 'lib/yit-pointers.php');
39
  include_once( 'lib/yith-dashboard.php' );
40
  include_once( 'lib/privacy/yit-privacy.php' );
41
  include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
42
+ include_once( 'lib/promo/yith-promo.php' );
43
 
44
  /* === Gutenberg Support === */
45
  if( class_exists( 'WP_Block_Type_Registry' ) ){
188
  }
189
 
190
  if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
191
+ $links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence()->get_license_activation_url(),__( 'License', 'yith-plugin-fw' ) );
192
  }
193
 
194
  return $links;