YITH WooCommerce Catalog Mode - Version 1.1.5

Version Description

  • Updated: plugin core framework
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Catalog Mode
Version 1.1.5
Comparing to
See all releases

Code changes from version 1.1.4 to 1.1.5

class.yith-woocommerce-catalog-mode.php CHANGED
@@ -15,7 +15,11 @@ if ( !defined( 'ABSPATH' ) ) {
15
  class YITH_WC_Catalog_Mode {
16
 
17
  /**
18
- * @var $_panel Panel Object
 
 
 
 
19
  */
20
  protected $_panel;
21
 
@@ -44,8 +48,9 @@ class YITH_WC_Catalog_Mode {
44
  *
45
  * Initialize plugin and registers actions and filters to be used
46
  *
47
- * @since 1.0
48
- * @author Alberto Ruggiero
 
49
  */
50
  public function __construct() {
51
  if ( !function_exists( 'WC' ) ) {
@@ -53,14 +58,10 @@ class YITH_WC_Catalog_Mode {
53
  }
54
 
55
  // Load Plugin Framework
56
- add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
57
 
58
  //Add action links
59
- add_filter( 'plugin_action_links_' . plugin_basename( YWCTM_DIR . '/' . basename( YWCTM_FILE ) ), array(
60
- $this,
61
- 'action_links'
62
- ) );
63
-
64
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
65
 
66
  // Add stylesheets and scripts files
@@ -95,12 +96,64 @@ class YITH_WC_Catalog_Mode {
95
 
96
  }
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  /**
99
  * Check if catalog mode is enabled for administrator
100
  *
101
  * @since 1.0.2
102
- * @author Alberto Ruggiero
103
  * @return bool
 
104
  */
105
  public function check_user_admin_enable() {
106
 
@@ -112,8 +165,8 @@ class YITH_WC_Catalog_Mode {
112
  * Checks if "Cart & Checkout pages" needs to be hidden
113
  *
114
  * @since 1.0.2
115
- * @author Alberto Ruggiero
116
  * @return bool
 
117
  */
118
  public function check_hide_cart_checkout_pages() {
119
 
@@ -128,8 +181,8 @@ class YITH_WC_Catalog_Mode {
128
  *
129
  * @param $action
130
  *
131
- * @author Alberto Ruggiero
132
  * @return void
 
133
  */
134
  public function hide_add_to_cart_single( $action = '' ) {
135
 
@@ -147,10 +200,12 @@ class YITH_WC_Catalog_Mode {
147
 
148
  }
149
 
150
-
151
  /**
152
  * Hide add to cart button in quick view
153
  *
 
 
 
154
  */
155
  public function hide_add_to_cart_quick_view() {
156
 
@@ -182,8 +237,8 @@ class YITH_WC_Catalog_Mode {
182
  *
183
  * @param $post_id
184
  *
185
- * @author Alberto Ruggiero
186
  * @return bool
 
187
  */
188
  public function check_price_hidden( $post_id ) {
189
 
@@ -234,12 +289,12 @@ class YITH_WC_Catalog_Mode {
234
  * Checks if "Add to cart" needs to be hidden
235
  *
236
  * @since 1.0.2
237
- * @author Alberto Ruggiero
238
  *
239
  * @param $priority
240
  * @param $product_id
241
  *
242
  * @return bool
 
243
  */
244
  public function check_add_to_cart_single( $priority = true, $product_id = false ) {
245
 
@@ -290,15 +345,16 @@ class YITH_WC_Catalog_Mode {
290
  }
291
 
292
  }
293
- }
294
 
295
- }
296
 
297
- $reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
298
 
299
- if ( $reverse_criteria == 'yes' ) {
300
 
301
- $hide = !$hide;
 
 
302
 
303
  }
304
 
@@ -319,12 +375,12 @@ class YITH_WC_Catalog_Mode {
319
  * Checks if "Add to cart" needs to be avoided
320
  *
321
  * @since 1.0.5
322
- * @author Alberto Ruggiero
323
  *
324
  * @param $passed
325
  * @param $product_id
326
  *
327
  * @return bool
 
328
  */
329
  public function avoid_add_to_cart( $passed, $product_id ) {
330
 
@@ -362,15 +418,15 @@ class YITH_WC_Catalog_Mode {
362
 
363
  }
364
 
365
- }
366
 
367
- }
368
 
369
- $reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
370
 
371
- if ( $reverse_criteria == 'yes' ) {
372
 
373
- $passed = !$passed;
374
 
375
  }
376
 
@@ -391,8 +447,8 @@ class YITH_WC_Catalog_Mode {
391
  * Checks if "Add to cart" needs to be hidden from loop page
392
  *
393
  * @since 1.0.6
394
- * @author Alberto Ruggiero
395
  * @return bool
 
396
  */
397
  public function check_hide_add_cart_loop() {
398
 
@@ -437,15 +493,15 @@ class YITH_WC_Catalog_Mode {
437
 
438
  }
439
 
440
- }
441
 
442
- }
443
 
444
- $reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
445
 
446
- if ( $reverse_criteria == 'yes' ) {
447
 
448
- $remove = !$remove;
449
 
450
  }
451
 
@@ -472,8 +528,8 @@ class YITH_WC_Catalog_Mode {
472
  * Hides "Add to cart" button, if not excluded, from loop page
473
  *
474
  * @since 1.0.0
475
- * @author Alberto Ruggiero
476
  * @return void
 
477
  */
478
  public function hide_add_to_cart_loop() {
479
 
@@ -496,8 +552,8 @@ class YITH_WC_Catalog_Mode {
496
  * Enqueue css file
497
  *
498
  * @since 1.0.0
499
- * @author Alberto Ruggiero
500
  * @return void
 
501
  */
502
  public function enqueue_styles() {
503
  if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
@@ -510,8 +566,8 @@ class YITH_WC_Catalog_Mode {
510
  * Avoid Cart and Checkout Pages to be visited
511
  *
512
  * @since 1.0.4
513
- * @author Alberto Ruggiero
514
  * @return void
 
515
  */
516
  public function check_pages_redirect() {
517
 
@@ -533,7 +589,6 @@ class YITH_WC_Catalog_Mode {
533
 
534
  }
535
 
536
-
537
  /**
538
  * Removes Cart and checkout pages from menu
539
  *
@@ -541,8 +596,8 @@ class YITH_WC_Catalog_Mode {
541
  *
542
  * @param $pages
543
  *
544
- * @author Alberto Ruggiero
545
  * @return mixed
 
546
  */
547
  public function hide_cart_checkout_pages( $pages ) {
548
 
@@ -571,59 +626,35 @@ class YITH_WC_Catalog_Mode {
571
  }
572
 
573
  /**
574
- * Enqueue css file
575
  *
576
- * @since 1.0
577
- * @access public
578
- * @return void
579
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
580
  */
581
- public function plugin_fw_loader() {
582
- if ( !defined( 'YIT' ) || !defined( 'YIT_CORE_PLUGIN' ) ) {
583
- require_once( 'plugin-fw/yit-plugin.php' );
584
- }
585
  }
586
 
587
  /**
588
- * Add a panel under YITH Plugins tab
589
- *
590
- * @return void
591
- * @since 1.0
592
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
593
- * @use /Yit_Plugin_Panel class
594
- * @see plugin-fw/lib/yit-plugin-panel.php
595
  */
596
- public function add_menu_page() {
597
- if ( !empty( $this->_panel ) ) {
598
- return;
599
- }
600
-
601
- $admin_tabs = array(
602
- 'settings' => __( 'Settings', 'yith-woocommerce-catalog-mode' ),
603
- );
604
 
605
- if ( defined( 'YWCTM_PREMIUM' ) ) {
606
- $admin_tabs['premium'] = __( 'Premium Settings', 'yith-woocommerce-catalog-mode' );
607
- $admin_tabs['exclusions'] = __( 'Exclusion List', 'yith-woocommerce-catalog-mode' );
608
- }
609
- else {
610
- $admin_tabs['premium-landing'] = __( 'Premium Version', 'yith-woocommerce-catalog-mode' );
 
 
 
 
 
 
 
 
611
  }
612
-
613
- $args = array(
614
- 'create_menu_page' => true,
615
- 'parent_slug' => '',
616
- 'page_title' => __( 'Catalog Mode', 'yith-woocommerce-catalog-mode' ),
617
- 'menu_title' => __( 'Catalog Mode', 'yith-woocommerce-catalog-mode' ),
618
- 'capability' => 'manage_options',
619
- 'parent' => '',
620
- 'parent_page' => 'yit_plugin_panel',
621
- 'page' => $this->_panel_page,
622
- 'admin-tabs' => $admin_tabs,
623
- 'options-path' => YWCTM_DIR . '/plugin-options'
624
- );
625
-
626
- $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
627
  }
628
 
629
  /**
@@ -632,8 +663,8 @@ class YITH_WC_Catalog_Mode {
632
  * Load the premium tab template on admin page
633
  *
634
  * @since 1.0.0
635
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
636
  * @return void
 
637
  */
638
  public function premium_tab() {
639
  $premium_tab_template = YWCTM_TEMPLATE_PATH . '/admin/' . $this->_premium;
@@ -646,25 +677,24 @@ class YITH_WC_Catalog_Mode {
646
  * Get the premium landing uri
647
  *
648
  * @since 1.0.0
649
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
650
  * @return string The premium landing link
 
651
  */
652
  public function get_premium_landing_uri() {
653
- return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
654
  }
655
 
656
  /**
657
  * Action Links
658
  *
659
  * add the action links to plugin admin page
 
660
  *
661
- * @param $links | links plugin array
662
  *
663
- * @return mixed Array
664
- * @since 1.0
665
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
666
- * @return mixed
667
- * @use plugin_action_links_{$plugin_file_name}
668
  */
669
  public function action_links( $links ) {
670
 
@@ -678,19 +708,20 @@ class YITH_WC_Catalog_Mode {
678
  }
679
 
680
  /**
681
- * plugin_row_meta
682
  *
683
  * add the action links to plugin admin page
684
  *
685
- * @param $plugin_meta
686
- * @param $plugin_file
687
- * @param $plugin_data
688
- * @param $status
 
 
689
  *
690
- * @return Array
691
- * @since 1.0
692
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
693
- * @use plugin_row_meta
694
  */
695
  public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
696
  if ( ( defined( 'YWCTM_INIT' ) && ( YWCTM_INIT == $plugin_file ) ) ||
@@ -703,16 +734,4 @@ class YITH_WC_Catalog_Mode {
703
  return $plugin_meta;
704
  }
705
 
706
- /**
707
- *
708
- * say if the code is execute by quick view
709
- *
710
- * @return bool
711
- * @since 1.0.7
712
- * @author Andrea Frascaspata <andrea.frascaspata@yithemes.com>
713
- */
714
- public function is_quick_view() {
715
- return defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['action'] ) && ( $_REQUEST['action'] == 'yith_load_product_quick_view' || $_REQUEST['action'] == 'yit_load_product_quick_view' );
716
- }
717
-
718
  }
15
  class YITH_WC_Catalog_Mode {
16
 
17
  /**
18
+ * Panel object
19
+ *
20
+ * @var /Yit_Plugin_Panel object
21
+ * @since 1.0.0
22
+ * @see plugin-fw/lib/yit-plugin-panel.php
23
  */
24
  protected $_panel;
25
 
48
  *
49
  * Initialize plugin and registers actions and filters to be used
50
  *
51
+ * @since 1.0.0
52
+ * @return mixed
53
+ * @author Alberto Ruggiero
54
  */
55
  public function __construct() {
56
  if ( !function_exists( 'WC' ) ) {
58
  }
59
 
60
  // Load Plugin Framework
61
+ add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 12 );
62
 
63
  //Add action links
64
+ add_filter( 'plugin_action_links_' . plugin_basename( YWCTM_DIR . '/' . basename( YWCTM_FILE ) ), array( $this, 'action_links' ) );
 
 
 
 
65
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
66
 
67
  // Add stylesheets and scripts files
96
 
97
  }
98
 
99
+ /**
100
+ * ADMIN FUNCTIONS
101
+ */
102
+
103
+ /**
104
+ * Add a panel under YITH Plugins tab
105
+ *
106
+ * @since 1.0.0
107
+ * @return void
108
+ * @author Alberto Ruggiero
109
+ * @use /Yit_Plugin_Panel class
110
+ * @see plugin-fw/lib/yit-plugin-panel.php
111
+ */
112
+ public function add_menu_page() {
113
+
114
+ if ( !empty( $this->_panel ) ) {
115
+ return;
116
+ }
117
+
118
+ $admin_tabs = array(
119
+ 'settings' => __( 'Settings', 'yith-woocommerce-catalog-mode' ),
120
+ );
121
+
122
+ if ( defined( 'YWCTM_PREMIUM' ) ) {
123
+ $admin_tabs['premium'] = __( 'Premium Settings', 'yith-woocommerce-catalog-mode' );
124
+ $admin_tabs['exclusions'] = __( 'Exclusion List', 'yith-woocommerce-catalog-mode' );
125
+ $admin_tabs['custom-url'] = __( 'Custom Button Url List', 'yith-woocommerce-catalog-mode' );
126
+ }
127
+ else {
128
+ $admin_tabs['premium-landing'] = __( 'Premium Version', 'yith-woocommerce-catalog-mode' );
129
+ }
130
+
131
+ $args = array(
132
+ 'create_menu_page' => true,
133
+ 'parent_slug' => '',
134
+ 'page_title' => __( 'Catalog Mode', 'yith-woocommerce-catalog-mode' ),
135
+ 'menu_title' => __( 'Catalog Mode', 'yith-woocommerce-catalog-mode' ),
136
+ 'capability' => 'manage_options',
137
+ 'parent' => '',
138
+ 'parent_page' => 'yit_plugin_panel',
139
+ 'page' => $this->_panel_page,
140
+ 'admin-tabs' => $admin_tabs,
141
+ 'options-path' => YWCTM_DIR . '/plugin-options'
142
+ );
143
+
144
+ $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
145
+ }
146
+
147
+ /**
148
+ * FRONTEND FUNCTIONS
149
+ */
150
+
151
  /**
152
  * Check if catalog mode is enabled for administrator
153
  *
154
  * @since 1.0.2
 
155
  * @return bool
156
+ * @author Alberto Ruggiero
157
  */
158
  public function check_user_admin_enable() {
159
 
165
  * Checks if "Cart & Checkout pages" needs to be hidden
166
  *
167
  * @since 1.0.2
 
168
  * @return bool
169
+ * @author Alberto Ruggiero
170
  */
171
  public function check_hide_cart_checkout_pages() {
172
 
181
  *
182
  * @param $action
183
  *
 
184
  * @return void
185
+ * @author Alberto Ruggiero
186
  */
187
  public function hide_add_to_cart_single( $action = '' ) {
188
 
200
 
201
  }
202
 
 
203
  /**
204
  * Hide add to cart button in quick view
205
  *
206
+ * @since 1.0.7
207
+ * @return mixed
208
+ * @author Francesco Licandro
209
  */
210
  public function hide_add_to_cart_quick_view() {
211
 
237
  *
238
  * @param $post_id
239
  *
 
240
  * @return bool
241
+ * @author Alberto Ruggiero
242
  */
243
  public function check_price_hidden( $post_id ) {
244
 
289
  * Checks if "Add to cart" needs to be hidden
290
  *
291
  * @since 1.0.2
 
292
  *
293
  * @param $priority
294
  * @param $product_id
295
  *
296
  * @return bool
297
+ * @author Alberto Ruggiero
298
  */
299
  public function check_add_to_cart_single( $priority = true, $product_id = false ) {
300
 
345
  }
346
 
347
  }
 
348
 
349
+ $reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
350
 
351
+ if ( $reverse_criteria == 'yes' ) {
352
 
353
+ $hide = !$hide;
354
 
355
+ }
356
+
357
+ }
358
 
359
  }
360
 
375
  * Checks if "Add to cart" needs to be avoided
376
  *
377
  * @since 1.0.5
 
378
  *
379
  * @param $passed
380
  * @param $product_id
381
  *
382
  * @return bool
383
+ * @author Alberto Ruggiero
384
  */
385
  public function avoid_add_to_cart( $passed, $product_id ) {
386
 
418
 
419
  }
420
 
421
+ $reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
422
 
423
+ if ( $reverse_criteria == 'yes' ) {
424
 
425
+ $passed = !$passed;
426
 
427
+ }
428
 
429
+ }
430
 
431
  }
432
 
447
  * Checks if "Add to cart" needs to be hidden from loop page
448
  *
449
  * @since 1.0.6
 
450
  * @return bool
451
+ * @author Alberto Ruggiero
452
  */
453
  public function check_hide_add_cart_loop() {
454
 
493
 
494
  }
495
 
496
+ $reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
497
 
498
+ if ( $reverse_criteria == 'yes' ) {
499
 
500
+ $remove = !$remove;
501
 
502
+ }
503
 
504
+ }
505
 
506
  }
507
 
528
  * Hides "Add to cart" button, if not excluded, from loop page
529
  *
530
  * @since 1.0.0
 
531
  * @return void
532
+ * @author Alberto Ruggiero
533
  */
534
  public function hide_add_to_cart_loop() {
535
 
552
  * Enqueue css file
553
  *
554
  * @since 1.0.0
 
555
  * @return void
556
+ * @author Alberto Ruggiero
557
  */
558
  public function enqueue_styles() {
559
  if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
566
  * Avoid Cart and Checkout Pages to be visited
567
  *
568
  * @since 1.0.4
 
569
  * @return void
570
+ * @author Alberto Ruggiero
571
  */
572
  public function check_pages_redirect() {
573
 
589
 
590
  }
591
 
 
592
  /**
593
  * Removes Cart and checkout pages from menu
594
  *
596
  *
597
  * @param $pages
598
  *
 
599
  * @return mixed
600
+ * @author Alberto Ruggiero
601
  */
602
  public function hide_cart_checkout_pages( $pages ) {
603
 
626
  }
627
 
628
  /**
629
+ * Say if the code is execute by quick view
630
  *
631
+ * @since 1.0.7
632
+ * @return bool
633
+ * @author Andrea Frascaspata <andrea.frascaspata@yithemes.com>
 
634
  */
635
+ public function is_quick_view() {
636
+ return defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['action'] ) && ( $_REQUEST['action'] == 'yith_load_product_quick_view' || $_REQUEST['action'] == 'yit_load_product_quick_view' );
 
 
637
  }
638
 
639
  /**
640
+ * YITH FRAMEWORK
 
 
 
 
 
 
641
  */
 
 
 
 
 
 
 
 
642
 
643
+ /**
644
+ * Load plugin framework
645
+ *
646
+ * @since 1.0.0
647
+ * @return void
648
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
649
+ */
650
+ public function plugin_fw_loader() {
651
+ if ( !defined( 'YIT_CORE_PLUGIN' ) ) {
652
+ global $plugin_fw_data;
653
+ if ( !empty( $plugin_fw_data ) ) {
654
+ $plugin_fw_file = array_shift( $plugin_fw_data );
655
+ require_once( $plugin_fw_file );
656
+ }
657
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  }
659
 
660
  /**
663
  * Load the premium tab template on admin page
664
  *
665
  * @since 1.0.0
 
666
  * @return void
667
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
668
  */
669
  public function premium_tab() {
670
  $premium_tab_template = YWCTM_TEMPLATE_PATH . '/admin/' . $this->_premium;
677
  * Get the premium landing uri
678
  *
679
  * @since 1.0.0
 
680
  * @return string The premium landing link
681
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
682
  */
683
  public function get_premium_landing_uri() {
684
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing;
685
  }
686
 
687
  /**
688
  * Action Links
689
  *
690
  * add the action links to plugin admin page
691
+ * @since 1.0.0
692
  *
693
+ * @param $links | links plugin array
694
  *
695
+ * @return mixed
696
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
697
+ * @use plugin_action_links_{$plugin_file_name}
 
 
698
  */
699
  public function action_links( $links ) {
700
 
708
  }
709
 
710
  /**
711
+ * Plugin row meta
712
  *
713
  * add the action links to plugin admin page
714
  *
715
+ * @since 1.0.0
716
+ *
717
+ * @param $plugin_meta
718
+ * @param $plugin_file
719
+ * @param $plugin_data
720
+ * @param $status
721
  *
722
+ * @return Array
723
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
724
+ * @use plugin_row_meta
 
725
  */
726
  public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
727
  if ( ( defined( 'YWCTM_INIT' ) && ( YWCTM_INIT == $plugin_file ) ) ||
734
  return $plugin_meta;
735
  }
736
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  }
init.php CHANGED
@@ -5,15 +5,15 @@ Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-catalog-mode/
5
  Description: YITH Woocommerce Catalog Mode allows you to disable shop functions.
6
  Author: Yithemes
7
  Text Domain: yith-woocommerce-catalog-mode
8
- Version: 1.1.4
9
  Author URI: http://yithemes.com/
10
  */
11
 
12
- if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  } // Exit if accessed directly
15
 
16
- if ( ! function_exists( 'is_plugin_active' ) ) {
17
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
18
  }
19
 
@@ -22,7 +22,7 @@ function ywctm_install_woocommerce_admin_notice() {
22
  <div class="error">
23
  <p><?php _e( 'YITH WooCommerce Catalog Mode is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-catalog-mode' ); ?></p>
24
  </div>
25
- <?php
26
  }
27
 
28
  function ywctm_install_free_admin_notice() {
@@ -30,37 +30,43 @@ function ywctm_install_free_admin_notice() {
30
  <div class="error">
31
  <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Catalog Mode while you are using the premium one.', 'yith-woocommerce-catalog-mode' ); ?></p>
32
  </div>
33
- <?php
34
  }
35
 
36
- if ( ! defined( 'YWCTM_VERSION' ) ) {
37
- define( 'YWCTM_VERSION', '1.1.4' );
38
  }
39
 
40
- if ( ! defined( 'YWCTM_FREE_INIT' ) ) {
41
  define( 'YWCTM_FREE_INIT', plugin_basename( __FILE__ ) );
42
  }
43
 
44
- if ( ! defined( 'YWCTM_FILE' ) ) {
45
  define( 'YWCTM_FILE', __FILE__ );
46
  }
47
 
48
- if ( ! defined( 'YWCTM_DIR' ) ) {
49
  define( 'YWCTM_DIR', plugin_dir_path( __FILE__ ) );
50
  }
51
 
52
- if ( ! defined( 'YWCTM_URL' ) ) {
53
  define( 'YWCTM_URL', plugins_url( '/', __FILE__ ) );
54
  }
55
 
56
- if ( ! defined( 'YWCTM_ASSETS_URL' ) ) {
57
  define( 'YWCTM_ASSETS_URL', YWCTM_URL . 'assets/' );
58
  }
59
 
60
- if ( ! defined( 'YWCTM_TEMPLATE_PATH' ) ) {
61
  define( 'YWCTM_TEMPLATE_PATH', YWCTM_DIR . 'templates/' );
62
  }
63
 
 
 
 
 
 
 
64
  function ywctm_init() {
65
 
66
  /* Load YWCTM text domain */
@@ -69,13 +75,14 @@ function ywctm_init() {
69
  global $YITH_WC_Catalog_Mode;
70
  $YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode();
71
  }
 
72
  add_action( 'ywctm_init', 'ywctm_init' );
73
 
74
  function ywctm_install() {
75
 
76
  require_once( YWCTM_DIR . 'class.yith-woocommerce-catalog-mode.php' );
77
 
78
- if ( ! function_exists( 'WC' ) ) {
79
  add_action( 'admin_notices', 'ywctm_install_woocommerce_admin_notice' );
80
  }
81
  elseif ( defined( 'YWCTM_PREMIUM' ) ) {
@@ -86,6 +93,7 @@ function ywctm_install() {
86
  do_action( 'ywctm_init' );
87
  }
88
  }
 
89
  add_action( 'plugins_loaded', 'ywctm_install', 11 );
90
 
91
  /**
@@ -98,7 +106,7 @@ if ( !function_exists( 'yith_plugin_registration_hook' ) ) {
98
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
99
  register_activation_hook( __FILE__, 'ywctm_plugin_activation' );
100
 
101
- function ywctm_plugin_activation () {
102
 
103
  $pages_to_check = array(
104
  get_option( 'woocommerce_cart_page_id' ),
@@ -106,10 +114,10 @@ function ywctm_plugin_activation () {
106
  );
107
 
108
  foreach ( $pages_to_check as $page_id ) {
109
- if ( get_post_status ( $page_id ) != 'publish' ) {
110
  $page = array(
111
- 'ID' => $page_id,
112
- 'post_status' => 'publish'
113
  );
114
 
115
  wp_update_post( $page );
5
  Description: YITH Woocommerce Catalog Mode allows you to disable shop functions.
6
  Author: Yithemes
7
  Text Domain: yith-woocommerce-catalog-mode
8
+ Version: 1.1.5
9
  Author URI: http://yithemes.com/
10
  */
11
 
12
+ if ( !defined( 'ABSPATH' ) ) {
13
  exit;
14
  } // Exit if accessed directly
15
 
16
+ if ( !function_exists( 'is_plugin_active' ) ) {
17
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
18
  }
19
 
22
  <div class="error">
23
  <p><?php _e( 'YITH WooCommerce Catalog Mode is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-catalog-mode' ); ?></p>
24
  </div>
25
+ <?php
26
  }
27
 
28
  function ywctm_install_free_admin_notice() {
30
  <div class="error">
31
  <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Catalog Mode while you are using the premium one.', 'yith-woocommerce-catalog-mode' ); ?></p>
32
  </div>
33
+ <?php
34
  }
35
 
36
+ if ( !defined( 'YWCTM_VERSION' ) ) {
37
+ define( 'YWCTM_VERSION', '1.1.5' );
38
  }
39
 
40
+ if ( !defined( 'YWCTM_FREE_INIT' ) ) {
41
  define( 'YWCTM_FREE_INIT', plugin_basename( __FILE__ ) );
42
  }
43
 
44
+ if ( !defined( 'YWCTM_FILE' ) ) {
45
  define( 'YWCTM_FILE', __FILE__ );
46
  }
47
 
48
+ if ( !defined( 'YWCTM_DIR' ) ) {
49
  define( 'YWCTM_DIR', plugin_dir_path( __FILE__ ) );
50
  }
51
 
52
+ if ( !defined( 'YWCTM_URL' ) ) {
53
  define( 'YWCTM_URL', plugins_url( '/', __FILE__ ) );
54
  }
55
 
56
+ if ( !defined( 'YWCTM_ASSETS_URL' ) ) {
57
  define( 'YWCTM_ASSETS_URL', YWCTM_URL . 'assets/' );
58
  }
59
 
60
+ if ( !defined( 'YWCTM_TEMPLATE_PATH' ) ) {
61
  define( 'YWCTM_TEMPLATE_PATH', YWCTM_DIR . 'templates/' );
62
  }
63
 
64
+ /* Plugin Framework Version Check */
65
+ if ( !function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YWCTM_DIR . 'plugin-fw/init.php' ) ) {
66
+ require_once( YWCTM_DIR . 'plugin-fw/init.php' );
67
+ }
68
+ yit_maybe_plugin_fw_loader( YWCTM_DIR );
69
+
70
  function ywctm_init() {
71
 
72
  /* Load YWCTM text domain */
75
  global $YITH_WC_Catalog_Mode;
76
  $YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode();
77
  }
78
+
79
  add_action( 'ywctm_init', 'ywctm_init' );
80
 
81
  function ywctm_install() {
82
 
83
  require_once( YWCTM_DIR . 'class.yith-woocommerce-catalog-mode.php' );
84
 
85
+ if ( !function_exists( 'WC' ) ) {
86
  add_action( 'admin_notices', 'ywctm_install_woocommerce_admin_notice' );
87
  }
88
  elseif ( defined( 'YWCTM_PREMIUM' ) ) {
93
  do_action( 'ywctm_init' );
94
  }
95
  }
96
+
97
  add_action( 'plugins_loaded', 'ywctm_install', 11 );
98
 
99
  /**
106
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
107
  register_activation_hook( __FILE__, 'ywctm_plugin_activation' );
108
 
109
+ function ywctm_plugin_activation() {
110
 
111
  $pages_to_check = array(
112
  get_option( 'woocommerce_cart_page_id' ),
114
  );
115
 
116
  foreach ( $pages_to_check as $page_id ) {
117
+ if ( get_post_status( $page_id ) != 'publish' ) {
118
  $page = array(
119
+ 'ID' => $page_id,
120
+ 'post_status' => 'publish'
121
  );
122
 
123
  wp_update_post( $page );
plugin-fw/assets/css/yit-plugin-panel.css CHANGED
@@ -631,6 +631,13 @@
631
  width: 6em;
632
  }
633
 
 
 
 
 
 
 
 
634
  /* === Responsive === */
635
 
636
  @media (max-width: 767px) {}
631
  width: 6em;
632
  }
633
 
634
+ /* === YIT FRAMEWORK === */
635
+ .plugin-card .plugin-icon img {
636
+ max-width: 100%;
637
+ width: auto;
638
+ height: auto;
639
+ }
640
+
641
  /* === Responsive === */
642
 
643
  @media (max-width: 767px) {}
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -165,6 +165,12 @@
165
  var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
166
 
167
  $("#" + id).val( attachment.url );
 
 
 
 
 
 
168
  $('.plugin-option .upload_img_url').trigger('change');
169
  });
170
 
165
  var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
166
 
167
  $("#" + id).val( attachment.url );
168
+ // Save the id of the selected element to an element which name is the same with
169
+ // a suffix "-yith-attachment-id"
170
+ if ($("#" + id + "-yith-attachment-id")) {
171
+ $("#" + id + "-yith-attachment-id").val(attachment.id);
172
+ }
173
+
174
  $('.plugin-option .upload_img_url').trigger('change');
175
  });
176
 
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1,10 +1 @@
1
- (function(a){var l=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+
2
- "</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(l).change(l);a(".plugin-option .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()});a(".plugin-option .chosen .select_wrapper select").chosen();a(".plugin-option .on_off_container span").on("click",
3
- function(){var b=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()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);
4
- a(this).siblings(".feedback").find("strong").text(c.value+f)}})});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(".plugin-option .upload_img_url").change(function(){var b=a(this).val(),c=a(this).parents().siblings(".upload_img_preview");/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?c.html('<img src="'+b+'" style="max-width:600px; max-height:300px;" />'):c.html("")}).trigger("change"),a(document).on("click",".plugin-option .upload_button",function(b){b.preventDefault();
5
- var c,d=a(this).attr("id").replace(/-button$/,"");c||(b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})],c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b}),c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+d).val(b.url);a(".plugin-option .upload_img_url").trigger("change")}));c.open()}));a(".plugin-option .add_media").on("click",
6
- function(){});a("[data-field]").each(function(){var b=a(this),c="#"+b.data("field"),d="#"+b.data("dep"),e=b.data("value");a(d).on("change",function(){var b=d,g=e.toString(),h=!0;if("string"==typeof b){":radio"==b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),k=0;k<g.length;k++)if(a(b).val()!=g[k])h=!1;else{h=!0;break}}h?a(c+"-container").closest("tr").show():a(c+"-container").closest("tr").hide()}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");
7
- b.sortable({connectWith:b,update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",
8
- resizable:!1,draggable:!1,create:function(b,d){a(this).css("maxWidth","853px")},open:function(b,d){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=
9
- a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename"),e;e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";e+="ga('create', '"+c+"', '"+d+"');\n";e+="ga('send', 'pageview');\n";
10
- b.replaceRange(e,b.getCursor("start"),b.getCursor("end"))})})})(jQuery);
1
+ !function(e){function t(t,i,n){var a=!0;if("string"==typeof i){":radio"==i.substr(0,6)&&(i+=":checked");for(var n=n.split(","),o=0;o<n.length;o++){if(e(i).val()==n[o]){a=!0;break}a=!1}}a?e(t+"-container").closest("tr").show():e(t+"-container").closest("tr").hide()}var i=function(){var t="";e(this).attr("multiple")?(e(this).children("option:selected").each(function(i,n){0!=i&&(t+=", "),t+=e(n).text()}),""==t&&e(this).children().children("option:selected").each(function(i,n){0!=i&&(t+=", "),t+=e(n).text()})):(t=e(this).children("option:selected").text(),""==t&&(t=e(this).children().children("option:selected").text())),e(this).parent().find("span").length<=0&&e(this).before("<span></span>"),e(this).parent().children("span").replaceWith("<span>"+t+"</span>")};if(e(".plugin-option .select_wrapper select").not(".chosen").each(i).change(i),e(".plugin-option .select_wrapper").click(function(t){t.stopPropagation(),e(this).find("select[multiple]").not(".chosen").toggle()}),e(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(e){e.stopPropagation()}),e(window).click(function(){e(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()}),e(".plugin-option .chosen .select_wrapper select").chosen(),e(".plugin-option .on_off_container span").on("click",function(){var t=e(this).prev("input"),i=t.prop("checked");i?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var t=e(this).data("val"),i=e(this).data("min"),n=e(this).data("max"),a=e(this).data("step"),o=e(this).data("labels");e(this).slider({value:t,min:i,max:n,range:"min",step:a,slide:function(t,i){e(this).find("input").val(i.value),e(this).siblings(".feedback").find("strong").text(i.value+o)}})}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media){{var n=!0;wp.media.editor.send.attachment}e(".plugin-option .upload_img_url").change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),n=e(this).parents().siblings(".upload_img_preview");n.html(i.test(t)?'<img src="'+t+'" style="max-width:600px; max-height:300px;" />':"")}).trigger("change"),e(document).on("click",".plugin-option .upload_button",function(t){t.preventDefault();var i,n=e(this),a=n.attr("id").replace(/-button$/,"");if(i)return void i.open();var o=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:o}),i.on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+a).val(t.url),e("#"+a+"-yith-attachment-id")&&e("#"+a+"-yith-attachment-id").val(t.id),e(".plugin-option .upload_img_url").trigger("change")}),i.open()})}e(".plugin-option .add_media").on("click",function(){n=!1}),e("[data-field]").each(function(){var i=e(this),n="#"+i.data("field"),a="#"+i.data("dep"),o=i.data("value");e(a).on("change",function(){t(n,a,o.toString())}).change()}),e(".rm_connectedlist").each(function(){{var t=e(this).find("ul"),i=e(this).find(":hidden");t.sortable({connectWith:t,update:function(){var n={};t.each(function(){var t={};e(this).children().each(function(){t[e(this).data("option")]=e(this).text()}),n[e(this).data("list")]=t}),i.val(JSON.stringify(n).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()}}),e(document).ready(function(){e(".yith-video-link").click(function(t){t.preventDefault();var i=e(this).data("video-id");e("."+i).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(){e(this).css("maxWidth","853px")},open:function(){e(".ui-widget-overlay").bind("click",function(){e(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}}),e(".ui-dialog :button").blur()})}),e(document).ready(function(){e(".codemirror").each(function(t,i){var n=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",n)})}),e(document).ready(function(){e(".google-analytic-generate").click(function(){var t=e("#"+e(this).data("textarea")).data("codemirrorInstance"),i=e("#"+e(this).data("input")).val(),n=e(this).data("basename"),a="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";a+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",a+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",a+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",a+="ga('create', '"+i+"', '"+n+"');\n",a+="ga('send', 'pageview');\n",t.replaceRange(a,t.getCursor("start"),t.getCursor("end"))})})}(jQuery);
 
 
 
 
 
 
 
 
 
plugin-fw/init.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Framework Name: YIT Plugin Framework
4
+ * Version: 2.1
5
+ * Author: Yithemes
6
+ * Text Domain: yith-plugin-fw
7
+ * Domain Path: /languages/
8
+ *
9
+ * @author Your Inspiration Themes
10
+ * @package YITH WooCommerce Ajax Navigation
11
+ * @version 2.0
12
+ */
13
+ /**
14
+ * This file belongs to the YIT Plugin Framework.
15
+ *
16
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
17
+ * that is bundled with this package in the file LICENSE.txt.
18
+ * It is also available through the world-wide-web at this URL:
19
+ * http://www.gnu.org/licenses/gpl-3.0.txt
20
+ */
21
+
22
+
23
+ if ( ! defined( 'ABSPATH' ) ) {
24
+ exit;
25
+ } // Exit if accessed directly
26
+
27
+ if ( ! function_exists( 'yit_maybe_plugin_fw_loader' ) ) {
28
+ /**
29
+ * YITH WooCommerce Ajax Navigation
30
+ *
31
+ * @since 1.0.0
32
+ */
33
+ function yit_maybe_plugin_fw_loader( $plugin_path ) {
34
+ global $plugin_fw_data;
35
+
36
+ $default_headers = array(
37
+ 'Name' => 'Framework Name',
38
+ 'Version' => 'Version',
39
+ 'Author' => 'Author',
40
+ 'TextDomain' => 'Text Domain',
41
+ 'DomainPath' => 'Domain Path',
42
+ );
43
+
44
+ $framework_data = get_file_data( trailingslashit( $plugin_path ) .'plugin-fw/init.php', $default_headers );
45
+ $plugin_fw_main_file = trailingslashit( $plugin_path ) . 'plugin-fw/yit-plugin.php';
46
+
47
+ if( ! empty( $plugin_fw_data ) ){
48
+ foreach( $plugin_fw_data as $version => $path ){
49
+ if( version_compare( $version, $framework_data['Version'], '<' ) ){
50
+ $plugin_fw_data = array( $framework_data['Version'] => $plugin_fw_main_file );
51
+ }
52
+ }
53
+ }
54
+
55
+ else {
56
+ $plugin_fw_data = array( $framework_data['Version'] => $plugin_fw_main_file );
57
+ }
58
+ }
59
+ }
plugin-fw/lib/yit-metabox.php CHANGED
@@ -161,8 +161,6 @@ if (!class_exists('YIT_Metabox')) {
161
  wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
  wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
  wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
-
165
-
166
  }
167
 
168
  /**
161
  wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
  wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
  wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
 
 
164
  }
165
 
166
  /**
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -278,6 +278,20 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
278
  }
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  woocommerce_update_options( $yit_options[ $current_tab ] );
282
 
283
  do_action( 'yit_panel_wc_after_update' );
@@ -314,7 +328,6 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
314
  wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
315
  wp_enqueue_style ( 'wp-jquery-ui-dialog' );
316
 
317
-
318
  wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
319
  wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
320
  wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
@@ -365,7 +378,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
365
  * @return array Filtered body classes
366
  */
367
  public function admin_body_class( $admin_body_classes ){
368
- return substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
 
369
  }
370
 
371
  /**
278
  }
279
  }
280
 
281
+ foreach($_POST as $name => $value) {
282
+
283
+ // Check if current POST var which name ends with a specific needle
284
+ $attachment_id_needle = "-yith-attachment-id";
285
+ $is_hidden_input = (($temp = strlen($name) - strlen($attachment_id_needle)) >= 0 && strpos($name, $attachment_id_needle, $temp) !== FALSE);
286
+ if ($is_hidden_input){
287
+ // Is an input element of type "hidden" coupled with an input element for selecting an element from the media gallery
288
+ $yit_options[ $current_tab ][$name] = array(
289
+ "type" => "text",
290
+ "id" => $name
291
+ );
292
+ }
293
+ }
294
+
295
  woocommerce_update_options( $yit_options[ $current_tab ] );
296
 
297
  do_action( 'yit_panel_wc_after_update' );
328
  wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
329
  wp_enqueue_style ( 'wp-jquery-ui-dialog' );
330
 
 
331
  wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
332
  wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
333
  wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
378
  * @return array Filtered body classes
379
  */
380
  public function admin_body_class( $admin_body_classes ){
381
+ global $pagenow;
382
+ return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
383
  }
384
 
385
  /**
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -121,32 +121,27 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
121
  */
122
  public function admin_enqueue_scripts() {
123
 
124
- global $wp_scripts;
125
 
126
  //scripts
127
- wp_enqueue_media();
128
- wp_enqueue_script( 'jquery-ui' );
129
- wp_enqueue_script( 'jquery-ui-core' );
130
- wp_enqueue_script( 'jquery-ui-slider' );
131
- wp_enqueue_script( 'jquery-ui-dialog' );
132
- wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
133
- wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
134
- wp_enqueue_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
135
- wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
136
- wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
137
-
138
-
139
- wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
140
 
141
  //styles
142
-
143
  $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
144
-
145
  wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
146
  wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $this->version );
147
  wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
148
-
149
- wp_enqueue_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
150
  }
151
 
152
  /**
121
  */
122
  public function admin_enqueue_scripts() {
123
 
124
+ global $wp_scripts, $pagenow;
125
 
126
  //scripts
127
+ wp_enqueue_media();
128
+ wp_enqueue_script( 'jquery-ui' );
129
+ wp_enqueue_script( 'jquery-ui-core' );
130
+ wp_enqueue_script( 'jquery-ui-slider' );
131
+ wp_enqueue_script( 'jquery-ui-dialog' );
132
+ wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
133
+ wp_enqueue_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
134
+ wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
135
+ wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
 
 
 
 
136
 
137
  //styles
 
138
  $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
139
+ wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
140
  wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
141
  wp_enqueue_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $this->version );
142
  wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
143
+ wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
144
+ wp_enqueue_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
145
  }
146
 
147
  /**
plugin-fw/licence/lib/yit-licence.php CHANGED
@@ -48,7 +48,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
48
  * @var string The yithemes api uri
49
  * @since 1.0
50
  */
51
- protected $_api_uri = 'http://www.yithemes.com';
52
 
53
  /**
54
  * @var string The yithemes api uri query args
@@ -159,7 +159,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
159
  public function localize_script() {
160
  wp_localize_script( 'yit-licence', 'licence_message', array(
161
  'error' => sprintf( _x( '%s field cannot be empty', '%s = field name', 'yith-plugin-fw' ), '%field%' ), // sprintf must be used to avoid errors with '%field%' string in translation in .po file
162
- 'errors' => sprintf( __( '%s and %s fields cannot be empty', 'yith-plugin-fw' ), '%field_1%', '%field_2' ),
163
  'server' => __( 'Unable to contact the remote server, please try again later. Thanks!', 'yith-plugin-fw' )
164
  )
165
  );
48
  * @var string The yithemes api uri
49
  * @since 1.0
50
  */
51
+ protected $_api_uri = 'http://yithemes.com';
52
 
53
  /**
54
  * @var string The yithemes api uri query args
159
  public function localize_script() {
160
  wp_localize_script( 'yit-licence', 'licence_message', array(
161
  'error' => sprintf( _x( '%s field cannot be empty', '%s = field name', 'yith-plugin-fw' ), '%field%' ), // sprintf must be used to avoid errors with '%field%' string in translation in .po file
162
+ 'errors' => sprintf( __( '%s and %s fields cannot be empty', 'yith-plugin-fw' ), '%field_1%', '%field_2%' ),
163
  'server' => __( 'Unable to contact the remote server, please try again later. Thanks!', 'yith-plugin-fw' )
164
  )
165
  );
plugin-fw/licence/lib/yit-plugin-licence.php CHANGED
@@ -75,9 +75,7 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
75
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
76
  add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
77
  add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
78
- add_action( "wp_ajax_nopriv_activate-{$this->_product_type}", array( $this, 'activate' ) );
79
  add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
80
- add_action( "wp_ajax_nopriv_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
81
  add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
82
  }
83
 
75
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
76
  add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
77
  add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
 
78
  add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
 
79
  add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
80
  }
81
 
plugin-fw/licence/lib/yit-theme-licence.php CHANGED
@@ -71,9 +71,7 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
71
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
72
  add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
73
  add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
74
- add_action( "wp_ajax_nopriv_activate-{$this->_product_type}", array( $this, 'activate' ) );
75
  add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
76
- add_action( "wp_ajax_nopriv_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
77
  }
78
 
79
  /**
71
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
72
  add_action( 'admin_enqueue_scripts', array( $this, 'localize_script' ), 15 );
73
  add_action( "wp_ajax_activate-{$this->_product_type}", array( $this, 'activate' ) );
 
74
  add_action( "wp_ajax_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
 
75
  }
76
 
77
  /**
plugin-fw/templates/panel/woocommerce/woocommerce-upload.php CHANGED
@@ -16,10 +16,10 @@
16
  * @since 1.0.0
17
  */
18
 
19
- if ( ! defined( 'ABSPATH' ) ) {
20
  exit;
21
  } // Exit if accessed directly
22
-
23
 
24
  ?>
25
 
@@ -29,18 +29,25 @@ if ( ! defined( 'ABSPATH' ) ) {
29
  </th>
30
  <td class="forminp forminp-color plugin-option">
31
 
32
- <div id="<?php echo $id ?>-container" class="yit_options rm_option rm_input rm_text rm_upload" <?php if ( isset( $option['deps'] ) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $this->get_id_field( $option['deps']['ids'] ) ?>" data-value="<?php echo $option['deps']['values'] ?>" <?php endif ?>>
 
 
 
33
  <div class="option">
34
- <input type="text" name="<?php echo $id ?>" id="<?php echo $id ?>" value="<?php echo $value == '1' ? '' : esc_attr( $value ) ?>" class="upload_img_url" />
35
- <input type="button" value="<?php _e( 'Upload', 'yith-plugin-fw' ) ?>" id="<?php echo $id ?>-button" class="upload_button button" />
 
 
 
36
  </div>
37
  <div class="clear"></div>
38
  <span class="description"><?php echo $desc ?></span>
 
39
  <div class="upload_img_preview" style="margin-top:10px;">
40
  <?php
41
  $file = $value;
42
- if ( preg_match( '/(jpg|jpeg|png|gif|ico)$/', $file ) ) {
43
- echo "<img src=\"" . YIT_CORE_PLUGIN_URL. "/assets/images/sleep.png\" data-src=\"$file\" />";
44
  }
45
  ?>
46
  </div>
16
  * @since 1.0.0
17
  */
18
 
19
+ if (!defined('ABSPATH')) {
20
  exit;
21
  } // Exit if accessed directly
22
+ $hidden_val = get_option($id . "-yith-attachment-id", 0);
23
 
24
  ?>
25
 
29
  </th>
30
  <td class="forminp forminp-color plugin-option">
31
 
32
+ <div id="<?php echo $id ?>-container" class="yit_options rm_option rm_input rm_text rm_upload"
33
+ <?php if (isset($option['deps'])): ?>data-field="<?php echo $id ?>"
34
+ data-dep="<?php echo $this->get_id_field($option['deps']['ids']) ?>"
35
+ data-value="<?php echo $option['deps']['values'] ?>" <?php endif ?>>
36
  <div class="option">
37
+ <input type="text" name="<?php echo $id ?>" id="<?php echo $id ?>"
38
+ value="<?php echo $value == '1' ? '' : esc_attr($value) ?>" class="upload_img_url"/>
39
+ <input type="hidden" name="<?php echo $id ?>-yith-attachment-id" id="<?php echo $id ?>-yith-attachment-id" value="<?php echo $hidden_val; ?>" />
40
+ <input type="button" value="<?php _e('Upload', 'yith-plugin-fw') ?>" id="<?php echo $id ?>-button"
41
+ class="upload_button button"/>
42
  </div>
43
  <div class="clear"></div>
44
  <span class="description"><?php echo $desc ?></span>
45
+
46
  <div class="upload_img_preview" style="margin-top:10px;">
47
  <?php
48
  $file = $value;
49
+ if (preg_match('/(jpg|jpeg|png|gif|ico)$/', $file)) {
50
+ echo "<img src=\"" . YIT_CORE_PLUGIN_URL . "/assets/images/sleep.png\" data-src=\"$file\" />";
51
  }
52
  ?>
53
  </div>
plugin-fw/yit-plugin.php CHANGED
@@ -13,22 +13,10 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  } // Exit if accessed directly
14
 
15
 
16
- if( !defined('YIT_CORE_PLUGIN')) {
17
- define( 'YIT_CORE_PLUGIN', true);
18
- }
19
-
20
- if( !defined('YIT_CORE_PLUGIN_PATH')) {
21
- define( 'YIT_CORE_PLUGIN_PATH', dirname(__FILE__));
22
- }
23
-
24
- if( !defined('YIT_CORE_PLUGIN_URL')) {
25
- define( 'YIT_CORE_PLUGIN_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ));
26
- }
27
-
28
- if( ! defined( 'YIT_CORE_PLUGIN_TEMPLATE_PATH' ) ){
29
- define ( 'YIT_CORE_PLUGIN_TEMPLATE_PATH', YIT_CORE_PLUGIN_PATH . '/templates' );
30
- }
31
-
32
 
33
  include_once( 'yit-functions.php' );
34
  include_once( 'yit-plugin-registration-hook.php' );
13
  } // Exit if accessed directly
14
 
15
 
16
+ ! defined( 'YIT_CORE_PLUGIN' ) && define( 'YIT_CORE_PLUGIN', true);
17
+ ! defined( 'YIT_CORE_PLUGIN_PATH' ) && define( 'YIT_CORE_PLUGIN_PATH', dirname(__FILE__) );
18
+ ! defined( 'YIT_CORE_PLUGIN_URL' ) && define( 'YIT_CORE_PLUGIN_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ) );
19
+ ! defined( 'YIT_CORE_PLUGIN_TEMPLATE_PATH' ) && define( 'YIT_CORE_PLUGIN_TEMPLATE_PATH', YIT_CORE_PLUGIN_PATH . '/templates' );
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  include_once( 'yit-functions.php' );
22
  include_once( 'yit-plugin-registration-hook.php' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: woocommerce catalog mode plugin, woocommerce catalog only, woocommerce, products, themes, yit, yith, yithemes, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
5
  Requires at least: 4.0
6
  Tested up to: 4.3.1
7
- Stable tag: 1.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -113,6 +113,10 @@ yith-woocommerce-catalog-mode-<WORDPRESS LOCALE >.mo
113
 
114
  == Changelog ==
115
 
 
 
 
 
116
  = 1.1.4 =
117
 
118
  * Updated: changed text domain from ywctm to yith-woocommerce-catalog-mode
@@ -180,7 +184,7 @@ yith-woocommerce-catalog-mode-<WORDPRESS LOCALE >.mo
180
 
181
  == Upgrade Notice ==
182
 
183
- Last Stable Tag 1.1.4
184
 
185
  == Suggestions ==
186
 
4
  Tags: woocommerce catalog mode plugin, woocommerce catalog only, woocommerce, products, themes, yit, yith, yithemes, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
5
  Requires at least: 4.0
6
  Tested up to: 4.3.1
7
+ Stable tag: 1.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
113
 
114
  == Changelog ==
115
 
116
+ = 1.1.5 =
117
+
118
+ * Updated: plugin core framework
119
+
120
  = 1.1.4 =
121
 
122
  * Updated: changed text domain from ywctm to yith-woocommerce-catalog-mode
184
 
185
  == Upgrade Notice ==
186
 
187
+ Last Stable Tag 1.1.5
188
 
189
  == Suggestions ==
190