YITH WooCommerce Quick View - Version 1.3.10

Version Description

Released Jun 11 - 2019

  • New: Support to WooCommerce 3.6.4
  • New: Support to WordPress 5.2.1
  • Update: Plugin Core
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Quick View
Version 1.3.10
Comparing to
See all releases

Code changes from version 1.3.9 to 1.3.10

Files changed (47) hide show
  1. README.txt +11 -4
  2. init.php +3 -3
  3. plugin-fw/assets/css/metaboxes.css +18 -1
  4. plugin-fw/assets/css/yith-fields.css +1370 -9
  5. plugin-fw/assets/fonts/yith-icon.eot +0 -0
  6. plugin-fw/assets/fonts/yith-icon.svg +26 -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 +639 -346
  15. plugin-fw/assets/js/yith-fields.min.js +1 -15
  16. plugin-fw/init.php +73 -4
  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/yit-assets.php +8 -4
  20. plugin-fw/lib/yit-metabox.php +95 -34
  21. plugin-fw/lib/yit-plugin-licence.php +116 -0
  22. plugin-fw/lib/yit-plugin-panel-wc.php +123 -4
  23. plugin-fw/lib/yit-plugin-panel.php +106 -2
  24. plugin-fw/lib/yit-theme-licence.php +94 -0
  25. plugin-fw/lib/yit-upgrade.php +5 -649
  26. plugin-fw/licence/assets/css/yit-licence.css +0 -461
  27. plugin-fw/licence/assets/images/licence-error.png +0 -0
  28. plugin-fw/licence/assets/js/yit-licence.js +0 -215
  29. plugin-fw/licence/assets/js/yit-licence.min.js +0 -8
  30. plugin-fw/licence/lib/yit-licence.php +0 -804
  31. plugin-fw/licence/lib/yit-plugin-licence.php +0 -243
  32. plugin-fw/licence/lib/yit-theme-licence.php +0 -191
  33. plugin-fw/licence/templates/panel/activation/activation-panel.php +0 -247
  34. plugin-fw/templates/fields/date-format.php +56 -0
  35. plugin-fw/templates/fields/list-table.php +59 -0
  36. plugin-fw/templates/fields/multi-colorpicker.php +39 -0
  37. plugin-fw/templates/fields/onoff.php +1 -1
  38. plugin-fw/templates/fields/text.php +1 -0
  39. plugin-fw/templates/fields/textarea.php +3 -1
  40. plugin-fw/templates/fields/toggle-element.php +264 -0
  41. plugin-fw/templates/fields/upload.php +3 -3
  42. plugin-fw/templates/metaboxes/field-row.php +1 -0
  43. plugin-fw/templates/metaboxes/tab.php +6 -2
  44. plugin-fw/templates/panel/woocommerce/woocommerce-option-row.php +1 -1
  45. plugin-fw/templates/panel/woocommerce/woocommerce-panel.php +7 -3
  46. plugin-fw/yit-functions.php +138 -0
  47. plugin-fw/yit-plugin.php +3 -4
README.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: yithemes
3
  Tags: woocommerce, quick view, woocommerce quick view, products quick view
4
  Requires at least: 4.0
5
- Tested up to: 5.1
6
- Stable tag: 1.3.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -42,6 +42,12 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woo
42
 
43
  == Changelog ==
44
 
 
 
 
 
 
 
45
  = 1.3.9 = Released Apr 23 - 2019
46
 
47
  * New: Support to WooCommerce 3.6.1
@@ -216,7 +222,8 @@ Or, if you have created your own language pack, or have an update for an existin
216
 
217
  == Upgrade notice ==
218
 
219
- = 1.3.9 = Released Apr 23 - 2019
220
 
221
- * New: Support to WooCommerce 3.6.1
 
222
  * Update: Plugin Core
2
  Contributors: yithemes
3
  Tags: woocommerce, quick view, woocommerce quick view, products quick view
4
  Requires at least: 4.0
5
+ Tested up to: 5.2
6
+ Stable tag: 1.3.10
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
42
 
43
  == Changelog ==
44
 
45
+ = 1.3.10 = Released Jun 11 - 2019
46
+
47
+ * New: Support to WooCommerce 3.6.4
48
+ * New: Support to WordPress 5.2.1
49
+ * Update: Plugin Core
50
+
51
  = 1.3.9 = Released Apr 23 - 2019
52
 
53
  * New: Support to WooCommerce 3.6.1
222
 
223
  == Upgrade notice ==
224
 
225
+ = 1.3.10 = Released Jun 11 - 2019
226
 
227
+ * New: Support to WooCommerce 3.6.4
228
+ * New: Support to WordPress 5.2.1
229
  * Update: Plugin Core
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Quick View
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-quick-view
5
  * Description: The <code><strong>YITH WooCommerce Quick View</strong></code> plugin allows your customers to have a quick look about products. <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-quick-view
@@ -13,7 +13,7 @@
13
  *
14
  * @author YITH
15
  * @package YITH WooCommerce Quick View
16
- * @version 1.3.9
17
  */
18
  /* Copyright 2015 Your Inspiration Themes (email : plugins@yithemes.com)
19
 
@@ -61,7 +61,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
61
 
62
 
63
  if ( ! defined( 'YITH_WCQV_VERSION' ) ){
64
- define( 'YITH_WCQV_VERSION', '1.3.9' );
65
  }
66
 
67
  if ( ! defined( 'YITH_WCQV_FREE_INIT' ) ) {
3
  * Plugin Name: YITH WooCommerce Quick View
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-quick-view
5
  * Description: The <code><strong>YITH WooCommerce Quick View</strong></code> plugin allows your customers to have a quick look about products. <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-quick-view
13
  *
14
  * @author YITH
15
  * @package YITH WooCommerce Quick View
16
+ * @version 1.3.10
17
  */
18
  /* Copyright 2015 Your Inspiration Themes (email : plugins@yithemes.com)
19
 
61
 
62
 
63
  if ( ! defined( 'YITH_WCQV_VERSION' ) ){
64
+ define( 'YITH_WCQV_VERSION', '1.3.10' );
65
  }
66
 
67
  if ( ! defined( 'YITH_WCQV_FREE_INIT' ) ) {
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,15 +201,15 @@ 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 {
@@ -399,4 +399,1365 @@ 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
+ 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 {
399
  display : block;
400
  max-width : 100%;
401
  margin : 0 auto;
402
+ }
403
+
404
+ /****************
405
+ YITH UI
406
+ ****************/
407
+ @font-face {
408
+ font-family: 'yith-icon';
409
+ src: url('../fonts/yith-icon.eot?7ik896');
410
+ src: url('../fonts/yith-icon.eot?7ik896#iefix') format('embedded-opentype'),
411
+ url('../fonts/yith-icon.ttf?7ik896') format('truetype'),
412
+ url('../fonts/yith-icon.woff?7ik896') format('woff'),
413
+ url('../fonts/yith-icon.svg?7ik896#yith-icon') format('svg');
414
+ font-weight: normal;
415
+ font-style: normal;
416
+ }
417
+
418
+ [class^="icon-"], [class*=" icon-"] {
419
+ /* use !important to prevent issues with browser extensions that change fonts */
420
+ font-family: 'yith-icon' !important;
421
+ speak: none;
422
+ font-style: normal;
423
+ font-weight: normal;
424
+ font-variant: normal;
425
+ text-transform: none;
426
+ line-height: 1;
427
+
428
+ /* Better Font Rendering =========== */
429
+ -webkit-font-smoothing: antialiased;
430
+ -moz-osx-font-smoothing: grayscale;
431
+ }
432
+ .icon-drag:before {
433
+ content: "\e90f";
434
+ color: #d8d8d8;
435
+ }
436
+ .icon-arrow_down:before {
437
+ content: "\e900";
438
+ color: #d8d8d8;
439
+ }
440
+ .icon-arrow_left:before {
441
+ content: "\e901";
442
+ color: #d8d8d8;
443
+ }
444
+ .icon-arrow_right:before {
445
+ content: "\e902";
446
+ color: #d8d8d8;
447
+ }
448
+ .icon-arrow_up:before {
449
+ content: "\e903";
450
+ color: #d8d8d8;
451
+ }
452
+ .icon-calendar:before {
453
+ content: "\e904";
454
+ color: #d8d8d8;
455
+ }
456
+ .icon-check:before {
457
+ content: "\e905";
458
+ color: #d8d8d8;
459
+ }
460
+ .icon-close:before {
461
+ content: "\e906";
462
+ color: #d8d8d8;
463
+ }
464
+ .icon-edit:before {
465
+ content: "\e907";
466
+ color: #d8d8d8;
467
+ }
468
+ .icon-magnifier:before {
469
+ content: "\e908";
470
+ color: #d8d8d8;
471
+ }
472
+ .icon-pencil:before {
473
+ content: "\e909";
474
+ color: #d8d8d8;
475
+ }
476
+ .icon-plus:before {
477
+ content: "\e90a";
478
+ color: #d8d8d8;
479
+ }
480
+ .icon-update:before {
481
+ content: "\e90b";
482
+ color: #d8d8d8;
483
+ }
484
+ .icon-upload:before {
485
+ content: "\e90c";
486
+ color: #d8d8d8;
487
+ }
488
+ .icon-trash:before {
489
+ content: "\e90d";
490
+ color: #d8d8d8;
491
+ }
492
+ .icon-info:before {
493
+ content: "\e90e";
494
+ color: #d8d8d8;
495
+ }
496
+
497
+ .yith-plugin-fw-banner{
498
+ width: 100%;
499
+ height: 75px;
500
+ background: url('../images/banner-premium.png');
501
+ }
502
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free{
503
+ height: 290px;
504
+ background: url('../images/banner-free.png') no-repeat;
505
+ }
506
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free h1{
507
+ max-width: auto;
508
+ text-align:left;
509
+ margin-left: 110px;
510
+ padding-top: 15px;
511
+ padding-bottom: 8px;
512
+ }
513
+
514
+ .yith-plugin-fw-banner h1{
515
+ text-transform: uppercase;
516
+ color: #0c5777;
517
+ font-size: 15px;
518
+ padding-left: 150px;
519
+ font-weight: 700;
520
+ text-align: left;
521
+ display: inline-block;
522
+ box-sizing: border-box;
523
+ }
524
+
525
+ .yith-plugin-fw-banner span{
526
+ font-style:italic;
527
+ display: block;
528
+ font-size: 15px;
529
+ color:#214249;
530
+ text-transform:none;
531
+ text-align: right;
532
+ }
533
+
534
+ .yith-plugin-fw-banner a,
535
+ .yith-plugin-fw-banner a:focus{
536
+ text-decoration: none;
537
+ outline: none;
538
+ box-shadow: none;
539
+ }
540
+
541
+ .yith-banners ul{
542
+ list-style: none;
543
+ margin-left: 10px;
544
+ }
545
+
546
+ .yith-banners ul li{
547
+ display: inline-block;
548
+ margin-left: 10px;
549
+ }
550
+ .yith-plugin-ui a{
551
+ outline: none;
552
+ box-shadow: none;
553
+ }
554
+
555
+ .yith-plugin-ui{
556
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
557
+ }
558
+
559
+ .yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper{
560
+ margin-top:10px;
561
+ }
562
+
563
+ .yith-plugin-ui .nav-tab{
564
+ margin-left: 0px;
565
+ margin-right: 2px;
566
+ background-color: #336374;
567
+ color: #fff;
568
+ font-size: 13px;
569
+ padding: 7px 20px;
570
+ border: 0;
571
+ }
572
+ .yith-plugin-ui .nav-tab:first-child{
573
+ border-left: 1px solid #d9d9d9;
574
+ }
575
+
576
+ .yith-plugin-ui .nav-tab.yith-premium{
577
+ background-color: #be421c;
578
+ }
579
+ .yith-plugin-ui .nav-tab-active{
580
+ background-color: #fff;
581
+ color: #336374;
582
+ border-bottom:1px solid #fff;
583
+ }
584
+ .yith-plugin-ui .nav-tab-active.yith-premium{
585
+ background-color: #fff;
586
+ color: #be421c;
587
+ }
588
+ .yith-plugin-ui #plugin-fw-wc{
589
+ padding-top: 0px;
590
+ }
591
+
592
+ .yith-plugin-ui .form-table td{
593
+ padding: 15px 20px;
594
+ }
595
+
596
+ .yith-plugin-ui label{
597
+ color: #33373b;
598
+ font-size: 13px;
599
+ }
600
+
601
+ .yith-plugin-ui span.description{
602
+ color: #716269;
603
+ font-size: 11px;
604
+ font-style: normal;
605
+ font-weight: 600;
606
+ margin-top: 15px;
607
+ margin-left: 0;
608
+ }
609
+ #wpwrap .yith-plugin-ui h2.nav-tab-wrapper, #wpbody-content .yith-plugin-ui h2.nav-tab-wrapper {
610
+ border: 0;
611
+ border-bottom : 1px solid #ccc;
612
+ margin-right: 15px;
613
+ background-color: transparent;
614
+ padding-left: 0;
615
+ }
616
+ .yith-plugin-ui #plugin-fw-wc table.form-table,
617
+ .yith-plugin-ui #yith-plugin-fw-panel table.form-table,
618
+ .yith-plugin-ui table.form-table{
619
+ border: 1px solid #d8d8d8;
620
+ border-top: 0;
621
+ margin-bottom: 40px;
622
+ }
623
+
624
+ .yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper{
625
+ background-color: transparent;
626
+ border: 0;
627
+ text-transform: none;
628
+ border-bottom: 1px solid #ddd;
629
+ }
630
+
631
+ .yith-plugin-ui h2 {
632
+ color: #2a8db0;
633
+ font-size: 13px;
634
+ text-transform: uppercase;
635
+ border: 1px solid #d8d8d8;
636
+ border-bottom: 0;
637
+ background-color: #fff;
638
+ padding: 35px 20px;
639
+ margin: 0px;
640
+ }
641
+ .yith-plugin-ui .yith-plugin-fw-custom-tab h2{
642
+ border: 0px solid #d8d8d8;
643
+ padding-left: 0;
644
+ }
645
+
646
+ .yith-plugin-ui #plugin-fw-wc h2 + div {
647
+ background: #fff;
648
+ border-left: 1px solid #d9d9d9;
649
+ border-right: 1px solid #d9d9d9;
650
+ margin: -20px 0 0 0;
651
+ padding-left: 20px;
652
+ padding-bottom: 5px;
653
+ }
654
+
655
+ .yith-plugin-ui #plugin-fw-wc h2 + div p, .yith-plugin-ui p.info-box{
656
+ background: #f1f1f1;
657
+ font-size: 12px;
658
+ font-weight: 700;
659
+ width: 40%;
660
+ display:block;
661
+ padding: 15px;
662
+ margin-bottom: 0;
663
+ }
664
+
665
+ .yith-plugin-ui #plugin-fw-wc h2 + div p:before, .yith-plugin-ui p.info-box:before{
666
+ content: "\e90e";
667
+ font-family: yith-icon;
668
+ font-size: 30px;
669
+ font-weight: normal;
670
+ display: block;
671
+ margin-top: -5px;
672
+ float: left;
673
+ margin-right: 15px;
674
+ }
675
+
676
+ .yith-plugin-ui h2:first-child{
677
+ border-top: 0;
678
+ }
679
+
680
+ /*** Icon ***/
681
+ .yith-plugin-ui span.yith-icon {
682
+ margin-left: -36px;
683
+ line-height: 36px;
684
+ font-size: 20px;
685
+ }
686
+
687
+ /*** General Input Style ***/
688
+
689
+ .yith-plugin-ui .yith-plugin-fw select,
690
+ .yith-plugin-ui textarea,
691
+ .yith-plugin-ui input[type=number],
692
+ .yith-plugin-ui.metaboxes-tab input[type=number],
693
+ .yith-plugin-ui input[type=text],
694
+ .yith-plugin-ui input[type=text],
695
+ .yith-plugin-ui input[type=email],
696
+ .yith-plugin-ui input[type=password],
697
+ .yith-plugin-fw.yith-plugin-ui input[type=text]:not(.select2-search__field),
698
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text]:not(.select2-search__field),
699
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table select,
700
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea,
701
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=number],
702
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text] {
703
+ border: 1px solid #d8d8d8;
704
+ border-radius: 8px;
705
+ padding: 8px 10px;
706
+ height: 38px;
707
+ min-width: 90px;
708
+ box-shadow: none;
709
+ color: #716269;
710
+ }
711
+ .yith-plugin-ui textarea,
712
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea{
713
+ height: auto;
714
+ }
715
+ .yith-plugin-ui table.form-table input[type=text].wp-color-picker,
716
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker{
717
+ border: 0;
718
+ height: 30px;
719
+ }
720
+
721
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].small-text,
722
+ .yith-plugin-ui input[type=text].small-text {
723
+ width: 100px;
724
+ height: 25px;
725
+ border: 1px solid #d9d9d9;
726
+ }
727
+
728
+ .yith-plugin-ui textarea {
729
+ height: auto;
730
+ padding: 8px;
731
+ }
732
+
733
+ .yith-plugin-ui select:focus,
734
+ .yith-plugin-ui input[type=text]:focus {
735
+ border-color: #a7d9ec;
736
+ }
737
+
738
+ .woocommerce .yith-plugin-ui table.form-table select,
739
+ .yith-plugin-ui select{
740
+ -webkit-appearance: none;
741
+ line-height: 1;
742
+ min-height: 35px;
743
+ background: url("../images/arrow_down.svg") no-repeat right center;
744
+ background-size: 35px 13px;
745
+ border-radius: 8px;
746
+ }
747
+
748
+ .yith-plugin-ui .form-table th{
749
+ width: 280px;
750
+ padding-right: 50px;
751
+ }
752
+
753
+ /** BUTTONS **/
754
+ .yith-plugin-ui .tablenav .button.action,
755
+ .wp-core-ui .yith-plugin-ui .button-primary,
756
+ .wp-core-ui .yith-plugin-ui .button-secondary,
757
+ .yith-plugin-ui .yith-add-button,
758
+ .yith-plugin-ui .yith-save-button,
759
+ .yith-plugin-ui .yith-edit-button,
760
+ .yith-plugin-ui .yith-update-button,
761
+ .yith-plugin-ui .yith-plugin-fw-select-all,
762
+ .yith-plugin-ui .yith-plugin-fw-deselect-all,
763
+ .yith-plugin-ui .yith-plugin-fw-upload-button,
764
+ .yith-plugin-ui .yith-plugin-fw-upload-button-reset {
765
+ border-radius: 3px;
766
+ text-transform: uppercase;
767
+ box-shadow: none;
768
+ border: 0;
769
+ font-weight: 700;
770
+ font-size: 11px;
771
+ padding: 0px 14px;
772
+ outline: none;
773
+ height: auto;
774
+ transition: all ease 0.3s;
775
+ background-color: #d6d6d6;
776
+ color: #656565;
777
+ text-shadow: none;
778
+ vertical-align: middle;
779
+ line-height: 26px;
780
+ display: inline-block;
781
+ text-decoration: none;
782
+ }
783
+ .wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
784
+ .wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button,
785
+ .yith-plugin-ui .yith-plugin-fw-upload-button-reset,
786
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
787
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button{
788
+ height: 38px;
789
+ }
790
+
791
+ .wp-core-ui .yith-plugin-ui .button:focus,
792
+ .wp-core-ui .yith-plugin-ui .button-primary:focus,
793
+ .yith-plugin-ui .yith-add-button:focus,
794
+ .yith-plugin-ui .yith-save-button:focus,
795
+ .yith-plugin-ui .yith-edit-button:focus,
796
+ .yith-plugin-ui .yith-update-button:focus,
797
+ .wp-core-ui .yith-plugin-ui .button-secondary:focus{
798
+ outline: none;
799
+ box-shadow: none;
800
+ }
801
+
802
+ /** button with inside a span with icon class */
803
+ .yith-plugin-ui .button-secondary span.yith-icon{
804
+ margin-left: 0px;
805
+ margin-right: 10px;
806
+ line-height: normal;
807
+ }
808
+
809
+ .yith-plugin-ui .button-secondary span.yith-icon:before{
810
+ color: #656565;
811
+ font-size: 15px;
812
+ }
813
+
814
+ .yith-plugin-ui .tablenav .button.action,
815
+ .wp-core-ui .yith-plugin-ui .button:focus,
816
+ .wp-core-ui .yith-plugin-ui .button-secondary:focus,
817
+ .yith-plugin-ui .yith-save-button:hover,
818
+ .wp-core-ui .yith-plugin-ui .button-secondary:hover,
819
+ .yith-plugin-ui .yith-plugin-fw-upload-button-reset:hover{
820
+ background-color: #cacaca;
821
+ color: #515151;
822
+ }
823
+
824
+ .wp-core-ui .yith-plugin-ui .button-primary,
825
+ .yith-plugin-ui .tablenav .button.action,
826
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-select-all,
827
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button{
828
+ background-color: #007694;
829
+ color: #fff;
830
+ }
831
+
832
+ .yith-plugin-ui .tablenav .button.action:active,
833
+ .yith-plugin-ui .tablenav .button.action:focus,
834
+ .yith-plugin-ui .tablenav .button.action:hover,
835
+ .yith-plugin-ui .yith-add-button,
836
+ .wp-core-ui .yith-plugin-ui .button-primary:focus,
837
+ .wp-core-ui .yith-plugin-ui .button-primary:hover{
838
+ background-color: #375f6b;
839
+ color: #fff;
840
+ }
841
+
842
+
843
+ .yith-plugin-ui .yith-add-button:hover,
844
+ .wp-core-ui .yith-plugin-ui .yith-plugin-fw-upload-button:focus,
845
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:hover,
846
+ .yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:focus,
847
+ .yith-plugin-ui .yith-plugin-fw-upload-button:hover{
848
+ border-color: #007694;
849
+ background: #007694;
850
+ color: #fff;
851
+ line-height: 26px;
852
+ margin-left: 0;
853
+ }
854
+
855
+ .yith-plugin-ui .button-primary:before,
856
+ .yith-plugin-ui .yith-add-button:before,
857
+ .yith-plugin-ui .yith-save-button:before,
858
+ .yith-plugin-ui .yith-edit-button:before,
859
+ .yith-plugin-ui .yith-update-button:before,
860
+ .yith-plugin-ui .button-secondary:before{
861
+ font-family: 'yith-icon';
862
+ font-size: 10px;
863
+ font-weight: 700;
864
+ margin-right: 10px;
865
+ vertical-align: bottom;
866
+ display:inline-block;
867
+ }
868
+
869
+ /** yith-edit-button **/
870
+ .yith-plugin-ui .yith-edit-button {
871
+ background-color: #7f9298;
872
+ color: #fff;
873
+ }
874
+ .yith-plugin-ui .yith-edit-button:focus,
875
+ .yith-plugin-ui .yith-edit-button:hover {
876
+ background-color: #718085;
877
+ color: #fff;
878
+ }
879
+ .yith-plugin-ui .yith-edit-button:before{
880
+ content: "\e907";
881
+ }
882
+ /** yith-update-button **/
883
+ .yith-plugin-ui .yith-update-button {
884
+ background-color: #94aa09;
885
+ color: #fff;
886
+ }
887
+ .yith-plugin-ui .yith-update-button:focus,
888
+ .yith-plugin-ui .yith-update-button:hover {
889
+ background-color: #7a9009;
890
+ color: #fff;
891
+ }
892
+ .yith-plugin-ui .yith-update-button:before{
893
+ content: "\e90b";
894
+ font-size: 15px;
895
+ }
896
+
897
+ /** yith-save-button **/
898
+
899
+ .yith-plugin-ui .yith-save-button {
900
+ background-color: #267390;
901
+ color: #fff;
902
+ }
903
+ .yith-plugin-ui .yith-save-button:focus,
904
+ .yith-plugin-ui .yith-save-button:hover {
905
+ background-color: #1c4863;
906
+ color: #fff;
907
+ }
908
+ .yith-plugin-ui .yith-save-button:before{
909
+ content: "\e905";
910
+ }
911
+
912
+ /** yith-remove-button **/
913
+
914
+ .yith-plugin-ui .button-secondary.yith-remove-button:before{
915
+ content: "\e90d";
916
+ font-size: 15px;
917
+ }
918
+
919
+
920
+ /** yith-add-button **/
921
+
922
+ .yith-plugin-ui .yith-add-button:before{
923
+ content: "\e90a";
924
+ }
925
+
926
+ /** yith-plugin-fw-upload-button **/
927
+ .yith-plugin-ui button.yith-plugin-fw-upload-button:before{
928
+ content: "\e90c";
929
+ font-family: 'yith-icon';
930
+ font-size: 19px;
931
+ font-weight: 400;
932
+ margin-right: 10px;
933
+ vertical-align: middle;
934
+ display:inline-block;
935
+ }
936
+ /** SELECT 2 **/
937
+ .yith-plugin-ui .select2-container,
938
+ .yith-plugin-ui .select2-selection--single{
939
+ height: auto;
940
+ padding: 2px;
941
+ outline: none;
942
+ }
943
+
944
+ .yith-plugin-ui .select2-selection--single{
945
+ margin: 0;
946
+ border: 0;
947
+ }
948
+
949
+ /* old panel*/
950
+
951
+ .yith-plugin-ui span.select2.select2-container.select2-container--default{
952
+ border: 1px solid #d8d8d8;
953
+ border-radius:8px;
954
+ }
955
+ .yith-plugin-ui span.select2.select2-container.select2-container--default:hover,
956
+ .yith-plugin-ui span.select2.select2-container.select2-container--default:active,
957
+ .yith-plugin-ui span.select2.select2-container.select2-container--default:focus {
958
+ border-color: #a7d9ec;
959
+ }
960
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
961
+ color: #fff;
962
+ }
963
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].select2-search__field,
964
+ .yith-plugin-ui .yith-plugin-fw table.form-table input.select2-search__field{
965
+ border: 0;
966
+ padding: 0;
967
+ height: initial;
968
+ }
969
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice,
970
+ .yith-plugin-ui .select2-selection__choice{
971
+ color: #fff;
972
+ background-color: #4e8ba2;
973
+ border-radius: 12px;
974
+ padding: 3px 11px;
975
+ border-color: #33937e;
976
+ font-size: 12px;
977
+ }
978
+
979
+ .yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before{
980
+ content: "\e900";
981
+ font-family: 'yith-icon' !important;
982
+ line-height: 36px;
983
+ color: #d9d9d9;
984
+ }
985
+
986
+ .yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow b{
987
+ display: none;
988
+ }
989
+ .yith-plugin-ui .select2-container--open .select2-dropdown--below,
990
+ .yith-plugin-ui .select2-container--open .select2-dropdown--above,
991
+ .yith-plugin-fw-panel .select2-container--open .select2-dropdown--below,
992
+ .yith-plugin-fw-panel .select2-container--open .select2-dropdown--above {
993
+ margin-top: 20px;
994
+ border-radius: 8px;
995
+ box-shadow:0 2px 4px 0 rgba(0,0,0,0.12),0 2px 10px 0 rgba(0,0,0,0.12) !important;
996
+ }
997
+ .yith-plugin-ui .select2-container--open .select2-dropdown--above,
998
+ .yith-plugin-fw-panel .select2-container--open .select2-dropdown--above{
999
+ margin-top: -10px;
1000
+ }
1001
+ .yith-plugin-ui .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
1002
+ .yith-plugin-ui .select2-container--default.select2-container--open.select2-container--above .select2-selection--single,
1003
+ .yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
1004
+ .yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--above .select2-selection--single{
1005
+ border-radius: 8px;
1006
+ }
1007
+ .yith-plugin-ui .select2-results .select2-results__group, .select2-results .select2-results__option:first-child,
1008
+ .yith-plugin-fw-panel .select2-results .select2-results__group, .select2-results .select2-results__option:first-child{
1009
+ border-top-left-radius: 8px;
1010
+ border-top-right-radius: 8px;
1011
+ }
1012
+ .yith-plugin-ui .select2-results .select2-results__group,
1013
+ .yith-plugin-ui .select2-results .select2-results__option:last-child,
1014
+ .yith-plugin-fw-panel .select2-results .select2-results__group,
1015
+ .yith-plugin-fw-panel .select2-results .select2-results__option:last-child{
1016
+ border-bottom-left-radius: 8px;
1017
+ border-bottom-right-radius: 8px;
1018
+ }
1019
+ .yith-plugin-ui .select2-container--default .select2-results__option[data-selected=true],
1020
+ .yith-plugin-ui .select2-container--default .select2-results__option[aria-selected=true],
1021
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option[data-selected=true],
1022
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option[aria-selected=true] {
1023
+ background-color: #fff;
1024
+ outline: none;
1025
+ }
1026
+ .yith-plugin-ui .select2-container--default .select2-results__option--highlighted[aria-selected],
1027
+ .yith-plugin-ui .select2-container--default .select2-results__option--highlighted[data-selected],
1028
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[aria-selected],
1029
+ .yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[data-selected]{
1030
+ background-color: #e8eff1;
1031
+ color: #4e8ba2;
1032
+ outline: none;
1033
+ }
1034
+
1035
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove,
1036
+ .yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
1037
+ float: right;
1038
+ padding-left: 15px;
1039
+ text-indent: -9999px;
1040
+ }
1041
+
1042
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
1043
+ .woocommerce .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after{
1044
+ float: right;
1045
+ color: #fff;
1046
+ content: "\e906";
1047
+ font-family: 'yith-icon' !important;
1048
+ font-size: 9px;
1049
+ line-height: 20px;
1050
+ text-indent: 0;
1051
+ }
1052
+ .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after
1053
+ .yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after{
1054
+ color: #000;
1055
+ }
1056
+ .yith-plugin-ui .select2-container .select2-selection--multiple,
1057
+ .yith-plugin-ui .select2-container--default.select2-container--focus .select2-selection--multiple{
1058
+ border: 0;
1059
+ }
1060
+
1061
+ .yith-plugin-fw .select2-search input[type=text]{
1062
+ border: 0;
1063
+ padding: 0;
1064
+ height: auto;
1065
+ }
1066
+ .yith-plugin-ui .yith-plugin-fw-select-field-wrapper span.yith-icon.icon-magnifier,
1067
+ .yith-plugin-fw-panel .yith-plugin-fw-select-field-wrapper span.yith-icon.icon-magnifier {
1068
+ position: absolute;
1069
+ padding-top: 5px;
1070
+ }
1071
+
1072
+ .yith-plugin-ui input[type=text].select2-search__field{
1073
+ border: 0;
1074
+ padding: 0;
1075
+ height: 30px;
1076
+ }
1077
+ .yith-plugin-ui .select2-container--default .select2-search--dropdown .select2-search__field,
1078
+ .yith-plugin-fw-panel .select2-container--default .select2-search--dropdown .select2-search__field {
1079
+ border: 1px solid #d9d9d9;
1080
+ border-radius: 8px;
1081
+ box-shadow: none;
1082
+ }
1083
+ .yith-plugin-ui .select2-dropdown,
1084
+ .yith-plugin-fw-panel .select2-dropdown{
1085
+ border: 1px solid #d9d9d9;
1086
+ }
1087
+ /** RADIO BUTTON **/
1088
+ .yith-plugin-ui [type="radio"]:checked,
1089
+ .yith-plugin-ui [type="radio"]:not(:checked) {
1090
+ position: absolute;
1091
+ left: -9999px;
1092
+ }
1093
+ .yith-plugin-ui [type="radio"]:checked + label,
1094
+ .yith-plugin-ui [type="radio"]:not(:checked) + label
1095
+ {
1096
+ position: relative;
1097
+ padding-left: 35px;
1098
+ cursor: pointer;
1099
+ line-height: 20px;
1100
+ display: inline-block;
1101
+ color: #716269;
1102
+ font-size: 12px;
1103
+ }
1104
+ .yith-plugin-ui [type="radio"]:checked + label:before,
1105
+ .yith-plugin-ui [type="radio"]:not(:checked) + label:before {
1106
+ content: '';
1107
+ position: absolute;
1108
+ left: 0;
1109
+ top: 0;
1110
+ width: 18px;
1111
+ height: 18px;
1112
+ border: 1px solid #d8d8d8;
1113
+ border-radius: 100%;
1114
+ background: #fff;
1115
+ }
1116
+ .yith-plugin-ui [type="radio"]:checked + label:after,
1117
+ .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
1118
+ content: '';
1119
+ width: 12px;
1120
+ height: 12px;
1121
+ background: #4e8ba2;
1122
+ position: absolute;
1123
+ top: 4px;
1124
+ left: 4px;
1125
+ border-radius: 100%;
1126
+ -webkit-transition: all 0.2s ease;
1127
+ transition: all 0.2s ease;
1128
+ }
1129
+ .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
1130
+ opacity: 0;
1131
+ -webkit-transform: scale(0);
1132
+ transform: scale(0);
1133
+ }
1134
+ .yith-plugin-ui [type="radio"]:checked + label:after {
1135
+ opacity: 1;
1136
+ -webkit-transform: scale(1);
1137
+ transform: scale(1);
1138
+ }
1139
+
1140
+ /** CHECKBOX **/
1141
+ .yith-plugin-ui input[type="checkbox"] {
1142
+ -webkit-appearance: none;
1143
+ background-color: #fff;
1144
+ border: 1px solid #d8d8d8;
1145
+ box-shadow: none;
1146
+ width: 18px;
1147
+ height: 18px;
1148
+ border-radius: 3px;
1149
+ display: inline-block;
1150
+ position: relative;
1151
+ }
1152
+ .yith-plugin-ui input[type="checkbox"]:checked{
1153
+ background-color: #4e8ba2;
1154
+ border-color: #488197;
1155
+ }
1156
+ .yith-plugin-ui .forminp-checkbox span.description.inline {
1157
+ margin-left: 10px;
1158
+ }
1159
+ .yith-plugin-ui input[type="checkbox"]:checked:before{
1160
+ display: none;
1161
+ }
1162
+
1163
+ .yith-plugin-ui input[type="checkbox"]:checked:after {
1164
+ content: "\e905";
1165
+ font-family: 'yith-icon';
1166
+ font-size: 15px;
1167
+ position: absolute;
1168
+ top: 8px;
1169
+ left: 1px;
1170
+ color: #fff;
1171
+ }
1172
+
1173
+ /** ONOFF **/
1174
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input[type="checkbox"] {
1175
+ display: none;
1176
+ }
1177
+
1178
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
1179
+ border: 1px solid #d8d8d8;
1180
+ background-color: #fff;
1181
+ width:50px;
1182
+ }
1183
+
1184
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before{
1185
+ background-color: #d8d8d8;
1186
+ }
1187
+
1188
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
1189
+ width: 14px;
1190
+ height: 14px;
1191
+ top: 3px;
1192
+ left: 4px;
1193
+ background-color: #d8d8d8;
1194
+ }
1195
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after{
1196
+ content: 'OFF';
1197
+ width: 14px;
1198
+ height: 14px;
1199
+ font-size: 10px;
1200
+ padding-left:24px;
1201
+ color: #979797;
1202
+ }
1203
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span,
1204
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input.onoffchecked + span{
1205
+ background-color: #fff;
1206
+ border-color: #98aa36;
1207
+ }
1208
+
1209
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
1210
+ .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before{
1211
+ background-color: #98aa36;
1212
+ left:32px;
1213
+ }
1214
+
1215
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
1216
+ .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after{
1217
+ content: 'ON';
1218
+ color: #98aa36;
1219
+ width: 14px;
1220
+ height: 14px;
1221
+ display: inline-block;
1222
+ font-size: 10px;
1223
+ padding: 0 10px;
1224
+ }
1225
+
1226
+ .yith-plugin-ui .yith-plugin-fw-onoff-container input + span{
1227
+ text-indent: 0;
1228
+ }
1229
+
1230
+
1231
+ /**
1232
+ DATEPICKER
1233
+ */
1234
+ .yith-plugin-ui div#ui-datepicker-div,
1235
+ .yith-plugin-fw-panel div#ui-datepicker-div {
1236
+ border: 0;
1237
+ box-shadow:0 2px 4px 0 rgba(0,0,0,0.12),0 2px 10px 0 rgba(0,0,0,0.12) !important;
1238
+ }
1239
+
1240
+ .yith-plugin-ui .ui-datepicker-header.ui-widget-header,
1241
+ .yith-plugin-fw-panel .ui-datepicker-header.ui-widget-header {
1242
+ background:#4e8ba2;
1243
+ color: #fff;
1244
+ font-size: 11px;
1245
+ line-height: 25px;
1246
+ border:0;
1247
+ min-height: 25px;
1248
+ }
1249
+ .yith-plugin-ui .ui-datepicker-title,
1250
+ .yith-plugin-fw-panel .ui-datepicker-title{
1251
+ line-height: 25px;
1252
+ }
1253
+ .yith-plugin-ui .ui-datepicker th,
1254
+ .yith-plugin-fw-panel .ui-datepicker th{
1255
+ color: #716269;
1256
+ }
1257
+ .yith-plugin-ui .ui-widget-header .ui-icon,
1258
+ .yith-plugin-ui .ui-widget-header .ui-state-hover,
1259
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
1260
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-next,
1261
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w,
1262
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e,
1263
+ .yith-plugin-fw-panel .ui-widget-header .ui-icon,
1264
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-hover,
1265
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
1266
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
1267
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w,
1268
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e{
1269
+ background: none;
1270
+ content: "";
1271
+ border: 0;
1272
+ text-indent: 0;
1273
+ width:15px;
1274
+ height: 20px;
1275
+ display:block;
1276
+ overflow:hidden;
1277
+ }
1278
+
1279
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w:before,
1280
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w:before {
1281
+ content: "\e901";
1282
+ color: #fff;
1283
+ font-family: 'yith-icon';
1284
+ font-size: 12px;
1285
+ font-weight: normal;
1286
+ width:15px;
1287
+ display:block;
1288
+ }
1289
+ .yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e:before,
1290
+ .yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e:before {
1291
+ content: "\e902";
1292
+ color: #fff;
1293
+ text-indent: 0;
1294
+ font-family: 'yith-icon';
1295
+ font-size: 12px;
1296
+ font-weight: normal;
1297
+ width:15px;
1298
+ display:block;
1299
+ }
1300
+
1301
+ /* arrow */
1302
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
1303
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-next,
1304
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
1305
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-next-hover,
1306
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
1307
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
1308
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover,
1309
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-next-hover{
1310
+ top: 1px;
1311
+ cursor: pointer;
1312
+ }
1313
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev,
1314
+ .yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
1315
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev,
1316
+ .yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover{
1317
+ left: 5px;
1318
+ }
1319
+ .yith-plugin-ui .ui-datepicker .ui-datepicker-next,
1320
+ .yith-plugin-ui .ui-datepicker-next.ui-datepicker-next-hover,
1321
+ .yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
1322
+ .yith-plugin-fw-panel .ui-datepicker-next.ui-datepicker-next-hover{
1323
+ right: 1px;
1324
+ }
1325
+
1326
+ .yith-plugin-ui .ui-datepicker table,
1327
+ .yith-plugin-fw-panel .ui-datepicker table{
1328
+ font-size: 10px;
1329
+ }
1330
+
1331
+ .yith-plugin-ui .ui-state-default,
1332
+ .yith-plugin-ui .ui-widget-content .ui-state-default,
1333
+ .yith-plugin-ui .ui-widget-header .ui-state-default,
1334
+ .yith-plugin-fw-panel .ui-state-default,
1335
+ .yith-plugin-fw-panel .ui-widget-content .ui-state-default,
1336
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-default{
1337
+ background:#fff;
1338
+ border: 1px solid #d9d9d9;
1339
+
1340
+ }
1341
+ .yith-plugin-ui .ui-state-hover,
1342
+ .yith-plugin-ui .ui-widget-content .ui-state-hover,
1343
+ .yith-plugin-ui a.ui-state-default:focus,
1344
+ .yith-plugin-ui .ui-widget-content .ui-state-focus,
1345
+ .yith-plugin-ui .ui-widget-header .ui-state-focus,
1346
+ .yith-plugin-fw-panel .ui-state-hover,
1347
+ .yith-plugin-fw-panel .ui-widget-content .ui-state-hover,
1348
+ .yith-plugin-fw-panel a.ui-state-default:focus,
1349
+ .yith-plugin-fw-panel .ui-widget-content .ui-state-focus,
1350
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-focus{
1351
+ background:#ebf1f3;
1352
+ border:1px solid #bfd5dd;
1353
+ outline: none;
1354
+ box-shadow: none;
1355
+ }
1356
+ .yith-plugin-ui .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus,
1357
+ .yith-plugin-fw-panel .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus {
1358
+ background: none;
1359
+ border: 0;
1360
+ }
1361
+
1362
+ /** colorpicker **/
1363
+ .woocommerce .yith-plugin-ui .iris-picker{
1364
+ border:0;
1365
+ margin-top: 20px;
1366
+ }
1367
+ .yith-plugin-ui .yith-plugin-fw input[type=text].wp-color-picker {
1368
+ border:0;
1369
+ padding: 2px 5px;
1370
+ height:30px;
1371
+ }
1372
+ .yith-plugin-ui .wp-color-result-text{
1373
+ display: none;
1374
+ }
1375
+
1376
+ .yith-plugin-ui .wp-picker-container .wp-color-result.button{
1377
+ width: 30px;
1378
+ height: 30px;
1379
+ border: 0;
1380
+ box-shadow: none;
1381
+ border: 1px solid #d9d9d9;
1382
+ margin-bottom: 0;
1383
+ }
1384
+ .yith-plugin-ui .wp-picker-clear{
1385
+ display: none;
1386
+ }
1387
+ .yith-plugin-ui .wp-picker-container{
1388
+ width: auto;
1389
+ display: inline-block;
1390
+ border: 1px solid #d9d9d9;
1391
+ border-radius: 8px;
1392
+ padding: 5px;
1393
+ }
1394
+
1395
+ .yith-plugin-ui .iris-picker .iris-square-inner{
1396
+ box-shadow: none;
1397
+ border: 1px solid #d9d9d9;
1398
+ }
1399
+
1400
+ .yith-plugin-ui .yith-single-colorpicker{
1401
+ display: inline-block;
1402
+ width: 220px;
1403
+ }
1404
+
1405
+ .yith-plugin-ui .yith-single-colorpicker > label{
1406
+ display: block;
1407
+ font-size: 11px;
1408
+ font-weight: 600;
1409
+ margin-bottom: 10px;
1410
+ }
1411
+
1412
+ /* RANGE SLIDER */
1413
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle{
1414
+ top: -45px!important;
1415
+ }
1416
+
1417
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle {
1418
+ position: absolute;
1419
+ top: -33px;
1420
+ left: 0;
1421
+ width: auto !important;
1422
+ height: auto !important;
1423
+ padding: 2px 8px;
1424
+ margin-left: -15px;
1425
+ font-size: 12px;
1426
+ line-height: 20px;
1427
+ color: #4e8ba2;
1428
+ text-align: center;
1429
+ background-color: #fff;
1430
+ border: 1px solid #fff;
1431
+ border-radius: 3px;
1432
+ -webkit-transition: opacity .3s ease-in-out 0s;
1433
+ transition: opacity .3s ease-in-out 0s;
1434
+ box-shadow: 0px 1px 7px 0px rgba(1, 1, 1, 0.13);
1435
+ }
1436
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:before {
1437
+ position: absolute;
1438
+ bottom: -3px;
1439
+ left: 50%;
1440
+ display: inline-block;
1441
+ width: 6px;
1442
+ height: 6px;
1443
+ margin-left: -3px;
1444
+ content: "";
1445
+ background-color: #fff;
1446
+ -webkit-transform: rotate(-45deg);
1447
+ -ms-transform: rotate(-45deg);
1448
+ transform: rotate(-45deg);
1449
+ }
1450
+ .yith-plugin-ui .ui-slider.ui-widget-content .ui-widget-header{
1451
+ background: #4e8ba2 ;
1452
+ }
1453
+ .yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:after{
1454
+ content: '';
1455
+ width: 17px;
1456
+ height: 17px;
1457
+ display: block;
1458
+ position: absolute;
1459
+ background: #fff;
1460
+ top: 37px;
1461
+ border-radius: 50%;
1462
+ box-shadow: 0px 1px 6px 0px rgba(1, 1, 1, 0.25);
1463
+ }
1464
+ .yith-plugin-ui .ui-slider.ui-widget-content{
1465
+ height: 5px !important;
1466
+ }
1467
+
1468
+ .yith-plugin-ui .ui-slider .minCaption,
1469
+ .yith-plugin-ui .ui-slider .maxCaption {
1470
+ font-weight: 700;
1471
+ font-size: 12px;
1472
+ }
1473
+
1474
+
1475
+ /* ADD_BOX AND TOGGLE */
1476
+ .yith-plugin-ui .yith-add-box,
1477
+ .yith-plugin-ui .yith-toggle-row{
1478
+ width:70%;
1479
+ border: 1px solid #d9d9d9;
1480
+ box-shadow:none;
1481
+ border-radius: 4px;
1482
+ margin: 20px 0;
1483
+ padding: 10px;
1484
+ box-sizing: border-box;
1485
+ background: white;
1486
+ }
1487
+ .yith-plugin-ui .yith-add-box{
1488
+ padding: 30px 25px;
1489
+ display: none;
1490
+ }
1491
+ .yith-plugin-ui .yith-toggle-title{
1492
+ position: relative;
1493
+ }
1494
+ .yith-plugin-ui #plugin-fw-wc .yith-toggle-title h3,
1495
+ .yith-plugin-ui .yith-toggle-title h3{
1496
+ padding: 0px 20px 0px 25px;
1497
+ margin: 0;
1498
+ display: inline-block;
1499
+ position: relative;
1500
+ min-width: 173px;
1501
+ box-sizing: border-box;
1502
+ font-weight: 600;
1503
+ font-size: 15px;
1504
+ }
1505
+
1506
+ .yith-plugin-ui .yith-toggle-title .subtitle{
1507
+ padding-left: 0;
1508
+ padding-top:8px;
1509
+ font-size: 12px;
1510
+ }
1511
+
1512
+ .yith-plugin-ui .yith-toggle{
1513
+ position: absolute;
1514
+ width: 30px;
1515
+ height: 30px;
1516
+ display: block;
1517
+ cursor: pointer;
1518
+ left: 0px;
1519
+ top: 0;
1520
+ bottom: 0;
1521
+ }
1522
+ .yith-plugin-ui .yith-toggle > span:before{
1523
+ color: #405e69;
1524
+ }
1525
+
1526
+ .yith-plugin-ui .yith-toggle > span{
1527
+ position: absolute;
1528
+ right: 50%;
1529
+ transition: transform .3s;
1530
+ line-height: 1;
1531
+ }
1532
+
1533
+
1534
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle span{
1535
+ transform: rotateZ(90deg);
1536
+ }
1537
+
1538
+ .yith-plugin-ui .yith-toggle-content{
1539
+ display: none;
1540
+ position: relative;
1541
+ padding: 30px 25px;
1542
+ }
1543
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content{
1544
+ /* display: block;*/
1545
+ }
1546
+ .yith-plugin-ui .yith-add-box-row,
1547
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row{
1548
+ display: table;
1549
+ margin-bottom: 20px;
1550
+ }
1551
+ .yith-plugin-ui .yith-add-box-row label,
1552
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row label{
1553
+ display: table-cell;
1554
+ width: 280px;
1555
+ padding-right:50px;
1556
+ color: #33373b;
1557
+ font-size: 13px;
1558
+ vertical-align: top;
1559
+ font-weight: 600;
1560
+ }
1561
+ .yith-plugin-ui .yith-add-box-row .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper),
1562
+ .yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
1563
+ /* display: table-cell;*/
1564
+ width: auto;
1565
+ float: none;
1566
+ vertical-align: middle;
1567
+ position: relative;
1568
+ }
1569
+ .yith-plugin-ui .yith-add-box-row span.yith-icon,
1570
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row span.yith-icon{
1571
+ position: absolute;
1572
+ right: 15px;
1573
+ top: 0;
1574
+ bottom: 0;
1575
+ }
1576
+ .yith-plugin-ui .yith-add-box-buttons,
1577
+ .yith-plugin-ui .yith-toggle-content-buttons{
1578
+ text-align: right;
1579
+ }
1580
+ .yith-plugin-ui .yith-toggle-onoff {
1581
+ position: absolute;
1582
+ cursor: pointer;
1583
+ right: 0;
1584
+ }
1585
+ .yith-plugin-ui .ui-sortable .yith-toggle-onoff{
1586
+ right: 30px;
1587
+ }
1588
+ .yith-plugin-ui .yith-toggle-row .icon-drag{
1589
+ position: absolute;
1590
+ right: 0;
1591
+ top: 25%;
1592
+ bottom: 0;
1593
+ line-height: 1;
1594
+ }
1595
+ .yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle{
1596
+ top: auto;
1597
+ }
1598
+ .yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle-onoff{
1599
+ top: 25%;
1600
+ }
1601
+
1602
+ /** SPINNER **/
1603
+ .yith-plugin-ui .spinner{
1604
+ vertical-align: -5px;
1605
+ float: none;
1606
+ }
1607
+
1608
+ .yith-plugin-ui .spinner.show{
1609
+ visibility: visible;
1610
+ }
1611
+
1612
+ /* LIST TABLE */
1613
+ .yith-plugin-ui .form-table .list-table td{
1614
+ padding: 15px 0px;
1615
+ }
1616
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table .bulkactions select{
1617
+ border: 1px solid #d8d8d8;
1618
+ max-width: 200px;
1619
+ max-height: 30px;
1620
+ padding: 0 10px;
1621
+ }
1622
+ .yith-plugin-ui .form-table .list-table th{
1623
+ width: initial;
1624
+ }
1625
+
1626
+ .yith-plugin-ui #plugin-fw-wc table.form-table th.check-column{
1627
+ padding-left: 3px;
1628
+ }
1629
+ .yith-plugin-ui #plugin-fw-wc table.wp-list-table tbody td{
1630
+ padding-left: 20px;
1631
+ }
1632
+ .yith-plugin-ui .yith-plugin-fw-list-table h2{
1633
+ border: 0;
1634
+ padding: 35px 0 15px;
1635
+ display: inline-block;
1636
+ margin-right: 10px;
1637
+ }
1638
+ .yith-plugin-ui .form-table .yith-plugin-fw-list-table table th{
1639
+ vertical-align: middle;
1640
+ }
1641
+ .yith-plugin-ui .yith-plugin-fw-list-table-container{
1642
+ padding: 0 20px;
1643
+ }
1644
+ .yith-plugin-ui #doaction, .yith-plugin-ui #doaction2, .yith-plugin-ui #post-query-submit{
1645
+ margin-left: 10px;
1646
+ height: 33px;
1647
+ }
1648
+ .yith-plugin-ui .bulkactions{
1649
+ margin: 10px 0;
1650
+ }
1651
+ .yith-plugin-ui .form-table td p.yith-section-description{
1652
+ color:#716269;
1653
+ margin-bottom: 20px;
1654
+ }
1655
+
1656
+ /** Time picker width*/
1657
+ .yith-plugin-ui input.ui-timepicker-input {
1658
+ width: 100px!important;
1659
+ }
1660
+ /** date format **/
1661
+ .yith-plugin-ui .yith-plugin-fw-date-format code {
1662
+ margin-left: 30px;
1663
+ }
1664
+
1665
+ .yith-plugin-ui .yith-plugin-fw-date-format input[type=text].small-text {
1666
+ margin-left: 45px;
1667
+ }
1668
+
1669
+ /** checkbox columns **/
1670
+ .yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
1671
+ width: calc(50% - 20px);
1672
+ padding-right: 20px;
1673
+ float: left;
1674
+ }
1675
+
1676
+ .yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
1677
+ width: calc(33% - 0px);
1678
+ padding-right: 0px;
1679
+ float: left;
1680
+ }
1681
+
1682
+
1683
+ .yith-plugin-fw-checkbox-field-wrapper {
1684
+ display: inline-block !important;
1685
+ width: 19px !important;
1686
+ margin-right: 10px;
1687
+ }
1688
+ .yith-plugin-fw-checkbox-field-wrapper + span.description {
1689
+ display: inline-block;
1690
+ vertical-align: middle;
1691
+ margin: 0;
1692
+ }
1693
+ .yith-plugin-ui span.description {
1694
+ margin-top: 10px;
1695
+ }
1696
+ .yith-plugin-fw-option-with-description {
1697
+ display: table-cell;
1698
+ width: auto;
1699
+ vertical-align: top;
1700
+ }
1701
+ /** YITH PANEL **/
1702
+ .yith-plugin-ui #yith-plugin-fw-panel{
1703
+ margin-top: -10px;
1704
+ }
1705
+ .yith-plugin-ui #plugin-fw-wc, .yith-plugin-ui #yith-plugin-fw-panel{
1706
+ padding-top: 0;
1707
+ }
1708
+ .yith-plugin-ui .plugin-option tr{
1709
+ border: 0;
1710
+ }
1711
+
1712
+ @media screen and (max-width: 1440px){
1713
+ .yith-plugin-ui .yith-add-box,
1714
+ .yith-plugin-ui .yith-toggle-row{
1715
+ width: 80%;
1716
+ }
1717
+ }
1718
+ @media screen and (max-width: 1024px){
1719
+ .yith-plugin-ui .yith-add-box,
1720
+ .yith-plugin-ui .yith-toggle-row{
1721
+ width: 90%;
1722
+ }
1723
+
1724
+ .yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
1725
+ width: 100%;
1726
+ padding-right: 20px;
1727
+ float: left;
1728
+ }
1729
+
1730
+ .yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
1731
+ width: calc(50% - 0px);
1732
+ padding-right: 0px;
1733
+ float: left;
1734
+ }
1735
+ }
1736
+ @media screen and (max-width: 782px){
1737
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free{
1738
+ height: auto;
1739
+ background-color: #a9c7d3;
1740
+ }
1741
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free ul{
1742
+ width: 90%;
1743
+ text-align: center;
1744
+ }
1745
+ .yith-plugin-fw-banner.yith-plugin-fw-banner-free li img{
1746
+ width: 90%;
1747
+ margin: 0 auto;
1748
+ }
1749
+ .yith-plugin-fw-banner h1{
1750
+ line-height: 1.2em;
1751
+ }
1752
+
1753
+ .yith-plugin-ui .yith-add-box,
1754
+ .yith-plugin-ui .yith-toggle-row{
1755
+ width: 100%;
1756
+ }
1757
+
1758
+ .yith-plugin-ui td.forminp-checkbox.two-cols fieldset,
1759
+ .yith-plugin-ui td.forminp-checkbox.three-cols fieldset{
1760
+ width: 100%;
1761
+ }
1762
+
1763
  }
plugin-fw/assets/fonts/yith-icon.eot ADDED
Binary file
plugin-fw/assets/fonts/yith-icon.svg ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ </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,657 @@
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
+ $colorpicker.each(function () {
44
+ var $cp = $(this).closest('.colorpicker'),
45
+ $button = $cp.find('.wp-color-result'),
46
+ $picker = $cp.find('.wp-picker-holder'),
47
+ $wrap = $cp.find('.wp-picker-input-wrap'),
48
+ $iris = $cp.find('.iris-picker');
49
+
50
+ $wrap.show();
51
+ $picker.hide();
52
+
53
+ $button.on('click', function (e) {
54
+ e.preventDefault();
55
+ $wrap.show();
56
+ if ($picker.is(':visible')) {
57
+ $picker.hide();
58
+ $iris.hide();
59
+ } else {
60
+ $picker.show();
61
+ $iris.show();
62
+ }
63
+ });
64
+
65
+ var select_label = $(this).data('variations-label');
66
+ $(this).parent().parent().find('a.wp-color-result').attr('title', select_label);
67
+ });
68
+
69
+ /* Upload */
70
+ if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
71
+ var _custom_media = true;
72
+ // preview
73
+ $upload.imgUrl.change(function () {
74
+ var url = $(this).val(),
75
+ re = new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),
76
+ preview = $(this).parent().find($upload.imgPreviewHandler).first();
77
+
78
+ if (preview.length < 1)
79
+ preview = $(this).parent().parent().find($upload.imgPreviewHandler).first();
80
+
81
+ if (re.test(url)) {
82
+ preview.html('<img src="' + url + '" style="max-width:100px; max-height:100px;" />');
83
+ } else {
84
+ preview.html('');
85
+ }
86
+ }).trigger('change');
87
+
88
+ $(document).on('click', $upload.uploadButtonHandler, function (e) {
89
+ e.preventDefault();
90
 
91
+ var t = $(this),
92
+ custom_uploader,
93
+ id = t.attr('id').replace(/-button$/, '');
94
+
95
+ //If the uploader object has already been created, reopen the dialog
96
+ if (custom_uploader) {
97
+ custom_uploader.open();
98
+ return;
99
+ }
100
 
101
+ var custom_uploader_states = [
102
+ // Main states.
103
+ new wp.media.controller.Library({
104
+ library: wp.media.query(),
105
+ multiple: false,
106
+ title: 'Choose Image',
107
+ priority: 20,
108
+ filterable: 'uploaded'
109
+ })
110
+ ];
111
+
112
+ // Create the media frame.
113
+ custom_uploader = wp.media.frames.downloadable_file = wp.media({
114
+ // Set the title of the modal.
115
+ title: 'Choose Image',
116
+ library: {
117
+ type: ''
118
+ },
119
+ button: {
120
+ text: 'Choose Image'
121
+ },
122
+ multiple: false,
123
+ states: custom_uploader_states
124
+ });
125
+
126
+ //When a file is selected, grab the URL and set it as the text field's value
127
+ custom_uploader.on('select', function () {
128
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
129
+
130
+ $("#" + id).val(attachment.url);
131
+ // Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
132
+ if ($("#" + id + "-yith-attachment-id")) {
133
+ $("#" + id + "-yith-attachment-id").val(attachment.id);
134
+ }
135
+ $upload.imgUrl.trigger('change');
136
+ });
137
 
138
+ //Open the uploader dialog
 
139
  custom_uploader.open();
140
+ });
141
+
142
+ $(document).on('click', $upload.resetButtonHandler, function (e) {
143
+ var t = $(this),
144
+ id = t.attr('id'),
145
+ input_id = t.attr('id').replace(/-button-reset$/, ''),
146
+ default_value = $('#' + id).data('default');
147
+
148
+ $("#" + input_id).val(default_value);
149
+ $upload.imgUrl.trigger('change');
150
+ });
151
+ }
152
 
153
+ $wpAddMedia.on('click', function () {
154
+ _custom_media = false;
155
+ });
156
+
157
+ /* Image Gallery */
158
+ if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
159
+ $(document).on('click', $imageGallery.buttonHandler, function (e) {
160
+ var $t = $(this),
161
+ $container = $t.closest('.image-gallery'),
162
+ $image_gallery_ids = $container.find('.image_gallery_ids'),
163
+ attachment_ids = $image_gallery_ids.val(),
164
+ $gallery_images_wrapper = $container.find('ul.slides-wrapper');
165
+
166
+ // Create the media frame.
167
+ var image_gallery_frame = wp.media.frames.image_gallery = wp.media({
168
+ // Set the title of the modal.
169
+ title: $t.data('choose'),
170
+ button: {
171
+ text: $t.data('update')
172
+ },
173
+ states: [
174
+ new wp.media.controller.Library({
175
+ title: $t.data('choose'),
176
+ filterable: 'all',
177
+ multiple: true
178
+ })
179
+ ]
180
+ });
181
+
182
+ // When an image is selected, run a callback.
183
+ image_gallery_frame.on('select', function () {
184
+ var selection = image_gallery_frame.state().get('selection');
185
+ selection.map(function (attachment) {
186
+ attachment = attachment.toJSON();
187
+
188
+ if (attachment.id) {
189
+ attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
190
+ $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>');
191
+ }
192
+ });
193
+
194
+ $image_gallery_ids.val(attachment_ids);
195
+ });
196
+
197
+ image_gallery_frame.open();
198
+
199
+ });
200
+
201
+ // Image ordering
202
+ $imageGallery.sliderWrapper.each(function () {
203
+ var $t = $(this);
204
+ $t.sortable({
205
+ items: 'li.image',
206
+ cursor: 'move',
207
+ scrollSensitivity: 40,
208
+ forcePlaceholderSize: true,
209
+ forceHelperSize: false,
210
+ helper: 'clone',
211
+ opacity: 0.65,
212
+ start: function (event, ui) {
213
+ ui.item.css('background-color', '#f6f6f6');
214
+ },
215
+ stop: function (event, ui) {
216
+ ui.item.removeAttr('style');
217
+ },
218
+ update: function (event, ui) {
219
+ var attachment_ids = '';
220
+
221
+ $t.find('li.image').css('cursor', 'default').each(function () {
222
+ var attachment_id = $(this).attr('data-attachment_id');
223
+ attachment_ids = attachment_ids + attachment_id + ',';
224
+ });
225
+
226
+ $t.closest('.image-gallery').find('.image_gallery_ids').val(attachment_ids);
227
+ }
228
+ });
229
+ });
230
+
231
+ // Remove images
232
+ $imageGallery.sliderWrapper.on('click', 'a.delete', function () {
233
+ var $wrapper = $(this).closest('.image-gallery'),
234
+ $gallery = $(this).closest('.image-gallery ul.slides-wrapper'),
235
+ $image_gallery_ids = $wrapper.find('.image_gallery_ids'),
236
+ attachment_ids = '';
237
+
238
+ $(this).closest('li.image').remove();
239
+
240
+ $gallery.find('li.image').css('cursor', 'default').each(function () {
241
+ var attachment_id = $(this).attr('data-attachment_id');
242
+ attachment_ids = attachment_ids + attachment_id + ',';
243
+ });
244
+
245
+ $image_gallery_ids.val(attachment_ids);
246
+ });
247
+ }
248
+
249
+
250
+ /* Sidebars */
251
+ $sidebars.each(function () {
252
+ var $images = $(this).find('img');
253
+ $images.on('click', function () {
254
+ var $container = $(this).closest('.yith-plugin-fw-sidebar-layout'),
255
+ $left = $container.find('.yith-plugin-fw-sidebar-layout-sidebar-left-container'),
256
+ $right = $container.find('.yith-plugin-fw-sidebar-layout-sidebar-right-container'),
257
+ type = $(this).data('type');
258
+
259
+ $(this).parent().children(':radio').attr('checked', false);
260
+ $(this).prev(':radio').attr('checked', true);
261
+
262
+ if (typeof type != 'undefined') {
263
+ switch (type) {
264
+ case 'left':
265
+ $left.show();
266
+ $right.hide();
267
+ break;
268
+ case 'right':
269
+ $right.show();
270
+ $left.hide();
271
+ break;
272
+ case 'double':
273
+ $left.show();
274
+ $right.show();
275
+ break;
276
+ default:
277
+ $left.hide();
278
+ $right.hide();
279
+ break;
280
+ }
281
  }
282
+ });
283
+ });
284
+
285
+ /* Slider */
286
+ $slider.each(function () {
287
+ var val = $(this).data('val'),
288
+ minValue = $(this).data('min'),
289
+ maxValue = $(this).data('max'),
290
+ step = $(this).data('step'),
291
+ labels = $(this).data('labels');
292
+
293
+ $(this).slider({
294
+ value: val,
295
+ min: minValue,
296
+ max: maxValue,
297
+ range: 'min',
298
+ step: step,
299
+
300
+ create: function () {
301
+ $(this).find('.ui-slider-handle').text($(this).slider("value"));
302
+ },
303
+
304
+
305
+ slide: function (event, ui) {
306
+ $(this).find('input').val(ui.value);
307
+ $(this).find('.ui-slider-handle').text(ui.value);
308
+ $(this).siblings('.feedback').find('strong').text(ui.value + labels);
309
+ }
310
+ });
311
+ });
312
+
313
+ /* codemirror */
314
+ $codemirror.each(function (i, v) {
315
+ var editor = CodeMirror.fromTextArea(v, {
316
+ lineNumbers: 1,
317
+ mode: 'javascript',
318
+ showCursorWhenSelecting: true
319
+ });
320
+
321
+ $(v).data('codemirrorInstance', editor);
322
+ });
323
+
324
+ /* Select All - Deselect All */
325
+ $(document).on('click', '.yith-plugin-fw-select-all', function () {
326
+ var $targetSelect = $('#' + $(this).data('select-id'));
327
+ $targetSelect.find('option').prop('selected', true).trigger('change');
328
+ });
329
+
330
+ $(document).on('click', '.yith-plugin-fw-deselect-all', function () {
331
+ var $targetSelect = $('#' + $(this).data('select-id'));
332
+ $targetSelect.find('option').prop('selected', false).trigger('change');
333
+ });
334
+
335
+
336
+ $icons.each(function () {
337
+ var $container = $(this),
338
+ $preview = $container.find('.yit-icons-manager-icon-preview').first(),
339
+ $text = $container.find('.yit-icons-manager-icon-text');
340
+
341
+ $container.on('click', '.yit-icons-manager-list li', function (event) {
342
+ var $target = $(event.target).closest('li'),
343
+ font = $target.data('font'),
344
+ icon = $target.data('icon'),
345
+ key = $target.data('key'),
346
+ name = $target.data('name');
347
+
348
+ $preview.attr('data-font', font);
349
+ $preview.attr('data-icon', icon);
350
+ $preview.attr('data-key', key);
351
+ $preview.attr('data-name', name);
352
+
353
+ $text.val(font + ':' + name);
354
+
355
+ $container.find('.yit-icons-manager-list li').removeClass('active');
356
+ $target.addClass('active');
357
+ });
358
+
359
+ $container.on('click', '.yit-icons-manager-action-set-default', function () {
360
+ $container.find('.yit-icons-manager-list li.default').trigger('click');
361
+ });
362
+ });
363
+
364
+ /** Select Images */
365
+ $(document).on('click', '.yith-plugin-fw-select-images__item', function () {
366
+ var item = $(this),
367
+ key = item.data('key'),
368
+ wrapper = item.closest('.yith-plugin-fw-select-images__wrapper'),
369
+ items = wrapper.find('.yith-plugin-fw-select-images__item'),
370
+ select = wrapper.find('select').first();
371
+
372
+ if (select.length) {
373
+ select.val(key);
374
+ items.removeClass('yith-plugin-fw-select-images__item--selected');
375
+ item.addClass('yith-plugin-fw-select-images__item--selected');
376
+ }
377
+ });
378
+
379
+ $(document.body).trigger('wc-enhanced-select-init');
380
+
381
+ $(document).find('.ui-sortable .yith-toggle-elements').sortable(
382
+ {
383
+ cursor: 'move',
384
+ axis: 'y',
385
+ scrollSensitivity: 40,
386
+ forcePlaceholderSize: true,
387
+ helper: 'clone',
388
+
389
+ stop: function (event, ui) {
390
+ var keys = jQuery('.ui-sortable-handle'),
391
+ i = 0,
392
+ array_keys = new Array();
393
+ for (i = 0; i < keys.length; i++) {
394
+ array_keys[i] = $(keys[i]).data('item_key');
395
+ }
396
+ if (array_keys.length > 0) {
397
+ var toggle = $(this).closest('.toggle-element');
398
+ toggle.saveToggleElement(null, array_keys);
399
  }
400
+ }
401
+ }
402
+ );
403
+
404
+ $.each($checkgroup, function () {
405
+ var children = $(this).find('fieldset');
406
+ if (children.length > 3 && children.length < 6) {
407
+ $(this).addClass('two-cols')
408
+ }
409
+ if (children.length > 6) {
410
+ $(this).addClass('three-cols')
411
+ }
412
+ });
413
+
414
+ $(document.body).trigger('yith-framework-enhanced-select-init');
415
+ };
416
+
417
+ yith_fields_init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
 
419
  /* on-off */
420
+ $(document).on('click', '.yith-plugin-fw-onoff-container span', function () {
421
+ var input = $(this).prev('input'),
422
+ checked = input.prop('checked');
423
 
424
+ if (checked) {
425
+ input.prop('checked', false).attr('value', 'no').removeClass('onoffchecked');
426
  } else {
427
+ input.prop('checked', true).attr('value', 'yes').addClass('onoffchecked');
428
  }
429
 
430
  input.change();
431
+ });
432
+
433
+
434
+ /** Toggle **/
435
+
436
+
437
+
438
+ //TOGGLE ELEMENT
439
+ $.fn.saveToggleElement = function (spinner, array_keys) {
440
+ var toggle = $(this),
441
+ action = 'yith_plugin_fw_save_toggle_element',
442
+ formdata = toggle.serializeToggleElement(),
443
+ id = toggle.find('.yith-toggle_wrapper').attr('id'),
444
+ current_tab = $.urlParam('tab');
445
+
446
+ if (typeof array_keys != 'undefined' && array_keys.length > 0) {
447
+ formdata.append('yith_toggle_elements_order_keys', array_keys);
448
+ }
449
+
450
+ if (toggle.closest('.metaboxes-tab.yith-plugin-ui').length) {
451
+ action = 'yith_plugin_fw_save_toggle_element_metabox';
452
+ post_id = $(this).closest('form#post').find('#post_ID').val();
453
+ yit_metaboxes_nonce = $(this).closest('form#post').find('#yit_metaboxes_nonce').val();
454
+ url = yith_framework_fw_fields.ajax_url + '?action=' + action + "&post_ID=" + post_id + '&yit_metaboxes_nonce=' + yit_metaboxes_nonce + "&toggle_id=" + id;
455
+ } else {
456
+ url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
457
+ }
458
+
459
+ $.ajax({
460
+ type: "POST",
461
+ url: url,
462
+ data: formdata,
463
+ contentType: false,
464
+ processData: false,
465
+ success: function (result) {
466
+ if (spinner) {
467
+ spinner.removeClass('show');
468
+ }
469
+
470
+ $(document).trigger('yith_save_toggle_element_done', [result, toggle]);
471
+ },
472
+ });
473
+ };
474
+
475
+ $.fn.serializeToggleElement = function () {
476
+ var obj = $(this);
477
+ /* ADD FILE TO PARAM AJAX */
478
+ var formData = new FormData();
479
+ var params = $(obj).find(":input").serializeArray();
480
+
481
+ $.each(params, function (i, val) {
482
+ el_name = val.name;
483
+ formData.append(val.name, val.value);
484
+ });
485
+
486
+ return formData;
487
+ };
488
+
489
+ $.fn.formatToggleTitle = function () {
490
+ var toggle_el = $(this),
491
+ fields = toggle_el.find(':input'),
492
+ title = toggle_el.find('span.title').data('title_format'),
493
+ subtitle = toggle_el.find('.subtitle').data('subtitle_format'),
494
+ regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
495
+
496
+ if (typeof title != 'undefined') {
497
+ var res = title.match( regExp );
498
+ }
499
+
500
+ if (typeof subtitle != 'undefined') {
501
+ var ressub = subtitle.match( regExp );
502
+ }
503
+
504
+ $.each(fields, function (i, field) {
505
+ if (typeof $(field).attr('id') != 'undefined') {
506
+ $field_id = $(field).attr('id');
507
+ $field_array = $field_id.split('_');
508
+ $field_array.pop();
509
+ $field_id = $field_array.join('_');
510
+ $field_val = $(field).val();
511
+
512
+ if (res != null && typeof res != 'undefined' && res.indexOf($field_id) !== -1) {
513
+ title = title.replace('%%' + $field_id + '%%', $field_val);
514
+ }
515
+ if (ressub != null && typeof ressub != 'undefined' && ressub.indexOf($field_id) !== -1) {
516
+ subtitle = subtitle.replace('%%' + $field_id + '%%', $field_val);
517
+ }
518
+ }
519
+ });
520
+
521
+ if ('' !== title) {
522
+ toggle_el.find('span.title').html(title);
523
+ }
524
+
525
+ if ('' !== subtitle) {
526
+ toggle_el.find('.subtitle').html(subtitle);
527
+ }
528
+
529
+ $(document).trigger('yith-toggle-element-item-title', [toggle_el]);
530
+ };
531
+
532
+ $.urlParam = function (name) {
533
+ var results = new RegExp('[\?&]' + name + '=([^&#]*)')
534
+ .exec(window.location.search);
535
+
536
+ return (results !== null) ? results[1] || 0 : false;
537
+ };
538
+
539
+ $(document).on('click', '.yith-toggle', function (event) {
540
+ var _toggle = $(event.target),
541
+ _section = _toggle.closest('.yith-toggle-row'),
542
+ _content = _section.find('.yith-toggle-content');
543
+
544
+ if (_section.is('.yith-toggle-row-opened')) {
545
+ _content.slideUp(400);
546
+ } else {
547
+ _content.slideDown(400);
548
+ }
549
+ _section.toggleClass('yith-toggle-row-opened');
550
+ });
551
+
552
+ /**Add new box toggle**/
553
+ $(document).on('click', '.yith-add-box-button', function (event) {
554
+ event.preventDefault();
555
+ var target_id = $(this).data('box_id'),
556
+ id = $(this).closest('.yith-toggle_wrapper').attr('id');
557
+ template = wp.template('yith-toggle-element-add-box-content-' + id);
558
+ if ('' !== target_id) {
559
+ $('#' + target_id).html(template({index: 'box_id'})).slideToggle();
560
+ yith_fields_init();
561
+ $(document).trigger('yith-add-box-button-toggle', [$(this)]);
562
+ }
563
+ });
564
+
565
+ $(document).on('click', '.yith-add-box-buttons .yith-save-button', function (event) {
566
+ event.preventDefault();
567
+ var add_box = $(this).parents('.yith-add-box'),
568
+ id = $(this).closest('.yith-toggle_wrapper').attr('id'),
569
+ spinner = add_box.find('.spinner'),
570
+ toggle_element = $(this).parents('.toggle-element'),
571
+ fields = add_box.find(':input'),
572
+ counter = toggle_element.find('.yith-toggle-row').length,
573
+ hidden_obj = $('<input type="hidden">');
574
+ hidden_obj.val(counter);
575
+ $(document).trigger('yith-toggle-change-counter', [hidden_obj, add_box]);
576
+
577
+ counter = hidden_obj.val();
578
+ var template = wp.template('yith-toggle-element-item-' + id),
579
+ toggle_el = $(template({index: counter}));
580
+
581
+ spinner.addClass('show');
582
+
583
+ $.each(fields, function (i, field) {
584
+ if (typeof $(field).attr('id') != 'undefined') {
585
+
586
+ $field_id = $(field).attr('id');
587
+ $field_val = $(field).val();
588
+
589
+ if ('radio' == $(field).attr('type')) {
590
+ $field_id = $field_id.replace('new_', '');
591
+ $field_id = $field_id.replace('-' + $field_val, '');
592
+ $field_id = $field_id + '_dataindex-' + $field_val;
593
+ } else {
594
+ $field_id = $field_id.replace('new_', '') + '_' + counter;
595
+ }
596
+
597
+ if ($(field).is(':checked')) {
598
+ $(toggle_el).find('#' + $field_id).prop('checked', true);
599
  }
600
+
601
+ if ($(field).hasClass('yith-post-search') || $(field).hasClass('yith-term-search')) {
602
+ $(toggle_el).find('#' + $field_id).html($('#' + $(field).attr('id')).html());
603
+ }
604
+
605
+ $(toggle_el).find('#' + $field_id).val($field_val);
606
+
607
  }
608
+
609
+ });
610
+
611
+ $(toggle_el).formatToggleTitle();
612
+ var form_is_valid = $('<input type="hidden">').val('yes');
613
+ $(document).trigger('yith-toggle-element-item-before-add', [add_box, toggle_el, form_is_valid]);
614
+
615
+
616
+ if (form_is_valid.val() === 'yes') {
617
+ $(toggle_element).find('.yith-toggle-elements').append(toggle_el);
618
+ $(add_box).find('.yith-plugin-fw-datepicker').datepicker('destroy');
619
+ $(add_box).html('').toggle();
620
+ toggle_element.saveToggleElement();
621
+ yith_fields_init();
622
+ }
623
+ });
624
+
625
+ $(document).on('click', '.yith-toggle-row .yith-save-button', function (event) {
626
+ event.preventDefault();
627
+ var toggle = $(this).closest('.toggle-element'),
628
+ toggle_row = $(this).closest('.yith-toggle-row'),
629
+ spinner = toggle_row.find('.spinner');
630
+ toggle_row.formatToggleTitle();
631
+
632
+ var form_is_valid = $('<input type="hidden">').val('yes');
633
+ $(document).trigger('yith-toggle-element-item-before-update', [toggle, toggle_row, form_is_valid]);
634
+ if (form_is_valid.val() === 'yes') {
635
+ spinner.addClass('show');
636
+ toggle.saveToggleElement(spinner);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  }
638
+ });
639
+
640
+ //register remove the dome and save the toggle
641
+ $(document).on('click', '.yith-toggle-row .yith-delete-button', function (event) {
642
+ event.preventDefault();
643
+ var toggle = $(this).closest('.toggle-element'),
644
+ toggle_row = $(this).closest('.yith-toggle-row');
645
+ toggle_row.remove();
646
+ toggle.saveToggleElement();
647
+ });
648
+
649
+ //register onoff status
650
+ $(document).on('click', '.yith-toggle-onoff', function (event) {
651
+ event.preventDefault();
652
+ var toggle = $(this).closest('.toggle-element');
653
+ toggle.saveToggleElement();
654
+ });
655
+
656
+
657
+ });
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 h(){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).closest(".colorpicker"),t=e.find(".wp-color-result"),i=e.find(".wp-picker-holder"),a=e.find(".wp-picker-input-wrap"),l=e.find(".iris-picker");a.show(),i.hide(),t.on("click",function(e){e.preventDefault(),a.show(),i.is(":visible")?(i.hide(),l.hide()):(i.show(),l.show())});var n=g(this).data("variations-label");g(this).parent().parent().find("a.wp-color-result").attr("title",n)}),"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")}h(),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(),h(),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(),h())}),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,7 +1,7 @@
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/
@@ -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.2.1
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
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/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,8 @@ 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 +488,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 +585,34 @@ 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
  }
140
 
141
  /**
488
  return $post_id;
489
  }*/
490
 
 
 
491
  if ( isset( $_POST[ 'yit_metaboxes' ] ) ) {
492
  $yit_metabox_data = $_POST[ 'yit_metaboxes' ];
493
 
494
  if ( is_array( $yit_metabox_data ) ) {
 
495
  foreach ( $yit_metabox_data as $field_name => $field_value ) {
 
496
  if ( !add_post_meta( $post_id, $field_name, $field_value, true ) ) {
497
  update_post_meta( $post_id, $field_name, $field_value );
498
  }
 
 
499
  }
 
500
  }
 
 
501
  }
502
 
503
+ $this->sanitize_fields( $post_id );
504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
 
506
  }
507
 
508
+ /**
509
+ * Sanitize the fields of metabox.
510
+ *
511
+ * @return void
512
+ * @since 3.2.1
513
+ * @author Emanuela Castorina
514
+ */
515
+ public function sanitize_fields( $post_id ) {
516
+
517
+ $this->reorder_tabs();
518
+
519
+ foreach ( $this->tabs as $tab ) {
520
+
521
+ foreach ( $tab['fields'] as $field ) {
522
+
523
+ if ( in_array( $field['type'], array( 'title' ) ) ) {
524
+ continue;
525
+ }
526
+
527
+ if ( isset( $_POST['yit_metaboxes'][ $field['id'] ] ) ) {
528
+ if ( in_array( $field['type'], array( 'onoff', 'checkbox' ) ) ) {
529
+ update_post_meta( $post_id, $field['id'], '1' );
530
+ }elseif( in_array( $field['type'], array( 'toggle-element' ) ) ){
531
+ if ( isset( $field['elements'] ) && $field['elements'] ) {
532
+ $elements_value = $_POST['yit_metaboxes'][ $field['id'] ];
533
+ if ( $elements_value ) {
534
+ if( isset( $elements_value['box_id'])){
535
+ unset( $elements_value['box_id']);
536
+ }
537
+
538
+ foreach ( $field['elements'] as $element ) {
539
+ foreach ( $elements_value as $key => $element_value ) {
540
+ if ( isset( $field['onoff_field'] ) ) {
541
+ $elements_value[ $key ][ $field['onoff_field']['id'] ] = ! isset( $element_value[ $field['onoff_field']['id'] ] ) ? 0 : $element_value[ $field['onoff_field']['id'] ];
542
+ }
543
+ if ( in_array( $element['type'], array( 'onoff', 'checkbox' ) ) ) {
544
+ $elements_value[ $key ][ $element['id'] ] = ! isset( $element_value[ $element['id'] ] ) ? 0 : 1;
545
+ }
546
+
547
+ if ( ! empty( $element['yith-sanitize-callback'] ) && is_callable( $element['yith-sanitize-callback'] ) ) {
548
+ $elements_value[ $key ][ $element['id'] ] = call_user_func( $element['yith-sanitize-callback'], $elements_value[ $key ][ $element['id'] ] );
549
+ }
550
+ }
551
+ }
552
+ }
553
+
554
+ update_post_meta( $post_id, $field['id'], maybe_serialize( $elements_value ) );
555
+ }
556
+ } else {
557
+ $value = $_POST['yit_metaboxes'][ $field['id'] ];
558
+ if ( ! empty( $field['yith-sanitize-callback'] ) && is_callable( $field['yith-sanitize-callback'] ) ) {
559
+ $value = call_user_func( $field['yith-sanitize-callback'], $value );
560
+ }
561
+ add_post_meta( $post_id, $field['id'], $value, true ) || update_post_meta( $post_id, $field['id'], $value );
562
+ }
563
+ } elseif ( in_array( $field['type'], array( 'onoff', 'checkbox' ) ) ) {
564
+ update_post_meta( $post_id, $field['id'], '0' );
565
+ } else {
566
+ delete_post_meta( $post_id, $field['id'] );
567
+ }
568
+ }
569
+ }
570
+ }
571
+
572
  /**
573
  * Remove Fields
574
  *
585
  $this->remove_field( $field );
586
  }
587
  }
588
+
589
+ /**
590
+ * Save the element toggle via Ajax.
591
+ *
592
+ * @return void
593
+ * @since 3.2.1
594
+ * @author Emanuela Castorina
595
+ */
596
+ public function save_toggle_element() {
597
+ if ( ! isset( $_REQUEST['post_ID'] ) ) {
598
+ return;
599
+ }
600
+
601
+ if ( !isset( $_REQUEST[ 'yit_metaboxes_nonce' ] ) || !wp_verify_nonce( $_REQUEST[ 'yit_metaboxes_nonce' ], 'metaboxes-fields-nonce' ) ) {
602
+ return;
603
+ }
604
+ $post_id = $_REQUEST['post_ID'];
605
+
606
+ if ( isset( $_REQUEST['yit_metaboxes'] ) ) {
607
+ $yit_metabox_data = $_REQUEST['yit_metaboxes'];
608
+
609
+ if ( is_array( $yit_metabox_data ) ) {
610
+ $this->sanitize_fields( $post_id );
611
+ }
612
+ } elseif ( ! isset( $_REQUEST['yit_metaboxes'] ) || ! isset( $_REQUEST['yit_metaboxes'][ $_REQUEST['toggle_id'] ] ) ) {
613
+ delete_post_meta( $post_id, $_REQUEST['toggle_id'] );
614
+ }
615
+ }
616
  }
617
  }
618
 
plugin-fw/lib/yit-plugin-licence.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ YITH_Plugin_Licence()->register( $init, $secret_key, $product_id );
62
+ }
63
+
64
+ /**
65
+ * Main plugin Instance
66
+ *
67
+ * @static
68
+ * @return object Main instance
69
+ *
70
+ * @since 1.0
71
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
72
+ */
73
+ public static function instance() {
74
+ if ( is_null( self::$_instance ) ) {
75
+ self::$_instance = new self();
76
+ }
77
+
78
+ return self::$_instance;
79
+ }
80
+
81
+ /**
82
+ * Get license activation URL
83
+ *
84
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
85
+ * @since 3.0.17
86
+ */
87
+ public static function get_license_activation_url(){
88
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_license_activation_url() : false;
89
+ }
90
+
91
+ /**
92
+ * Get protected array products
93
+ *
94
+ * @return mixed array
95
+ *
96
+ * @since 1.0
97
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
98
+ */
99
+ public function get_products() {
100
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_products() : array();
101
+ }
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Main instance
107
+ *
108
+ * @return object
109
+ * @since 1.0
110
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
111
+ */
112
+ if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
113
+ function YIT_Plugin_Licence() {
114
+ return YIT_Plugin_Licence::instance();
115
+ }
116
+ }
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,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ YITH_Theme_Licence()->register( $init, $secret_key, $product_id );
62
+ }
63
+
64
+ /**
65
+ * Main plugin Instance
66
+ *
67
+ * @static
68
+ * @return object Main instance
69
+ *
70
+ * @since 1.0
71
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
72
+ */
73
+ public static function instance() {
74
+ if ( is_null( self::$_instance ) ) {
75
+ self::$_instance = new self();
76
+ }
77
+
78
+ return self::$_instance;
79
+ }
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Main instance
85
+ *
86
+ * @return object
87
+ * @since 1.0
88
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
89
+ */
90
+ if ( !function_exists( 'YIT_Theme_Licence' ) ) {
91
+ function YIT_Theme_Licence() {
92
+ return YIT_Theme_Licence::instance();
93
+ }
94
+ }
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,12 @@ 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 +75,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
+ YITH_Plugin_Upgrade()->register( $plugin_slug, $plugin_init );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
  /**
75
 
76
  return self::$_instance;
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
  }
80
 
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/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,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = esc_url( add_query_arg( $params, $admin_url ) );
21
+ }
22
+
23
+ if ( isset( $list_table_class ) && ! class_exists( $list_table_class ) && isset( $list_table_class_dir ) ) {
24
+ include_once( $list_table_class_dir );
25
+ }
26
+
27
+ if ( class_exists( $list_table_class ) ):
28
+ $list_table = new $list_table_class();
29
+ ?>
30
+
31
+ <div id="<?php echo $id ?>" class="yith-plugin-fw-list-table <?php echo $class ?>">
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
53
+ $list_table->display();
54
+ ?>
55
+ </form>
56
+ </div>
57
+ </div>
58
+
59
+ <?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/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
@@ -15,9 +15,9 @@
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;
15
  extract( $field );
16
  ?>
17
  <input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>" <?php if ( isset( $default ) ) : ?>data-std="<?php echo $default ?>"<?php endif ?> class="yith-plugin-fw-upload-img-url"/>
18
+ <button class="button-secondary yith-plugin-fw-upload-button" id="<?php echo $id ?>-button"><?php _e( 'Upload', 'yith-plugin-fw' ) ?></button>
19
+ <button type="button" id="<?php echo $id ?>-button-reset" class="yith-plugin-fw-upload-button-reset button"
20
+ data-default="<?php echo isset( $default ) ? $default : '' ?>"><?php _e( 'Reset', 'yith-plugin-fw' ) ?></button>
21
  <div class="yith-plugin-fw-upload-img-preview" style="margin-top:10px;">
22
  <?php
23
  $file = $value;
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');
@@ -188,7 +187,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');
187
  }
188
 
189
  if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
190
+ $links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence()->get_license_activation_url(),__( 'License', 'yith-plugin-fw' ) );
191
  }
192
 
193
  return $links;