YITH WooCommerce Catalog Mode - Version 1.1.3

Version Description

  • Various code improvements
  • Updated language file
Download this release

Release Info

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

Code changes from version 1.1.2 to 1.1.3

assets/images/07-bg.png ADDED
Binary file
class.yith-woocommerce-catalog-mode.php CHANGED
@@ -517,12 +517,12 @@ class YITH_WC_Catalog_Mode {
517
518
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
519
520
- $cart = get_option( 'woocommerce_cart_page_id' );
521
- $checkout = get_option( 'woocommerce_checkout_page_id' );
522
523
wp_reset_query();
524
525
- if ( is_page( $cart ) || is_page( $checkout ) ) {
526
527
wp_redirect( home_url() );
528
exit;
@@ -549,8 +549,8 @@ class YITH_WC_Catalog_Mode {
549
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
550
551
$excluded_pages = array(
552
- get_option( 'woocommerce_cart_page_id' ),
553
- get_option( 'woocommerce_checkout_page_id' )
554
);
555
556
for ( $i = 0; $i < count( $pages ); $i ++ ) {
@@ -650,7 +650,7 @@ class YITH_WC_Catalog_Mode {
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;
654
}
655
656
/**
517
518
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
519
520
+ $cart = is_page( wc_get_page_id( 'cart' ) );
521
+ $checkout = is_page( wc_get_page_id( 'checkout' ) );
522
523
wp_reset_query();
524
525
+ if ( $cart || $checkout ) {
526
527
wp_redirect( home_url() );
528
exit;
549
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
550
551
$excluded_pages = array(
552
+ wc_get_page_id( 'cart' ),
553
+ wc_get_page_id( 'checkout' )
554
);
555
556
for ( $i = 0; $i < count( $pages ); $i ++ ) {
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
/**
init.php CHANGED
@@ -5,7 +5,7 @@ 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: ywctm
8
- Version: 1.1.2
9
Author URI: http://yithemes.com/
10
*/
11
@@ -34,7 +34,7 @@ function ywctm_install_free_admin_notice() {
34
}
35
36
if ( ! defined( 'YWCTM_VERSION' ) ) {
37
- define( 'YWCTM_VERSION', '1.1.2' );
38
}
39
40
if ( ! defined( 'YWCTM_FREE_INIT' ) ) {
5
Description: YITH Woocommerce Catalog Mode allows you to disable shop functions.
6
Author: Yithemes
7
Text Domain: ywctm
8
+ Version: 1.1.3
9
Author URI: http://yithemes.com/
10
*/
11
34
}
35
36
if ( ! defined( 'YWCTM_VERSION' ) ) {
37
+ define( 'YWCTM_VERSION', '1.1.3' );
38
}
39
40
if ( ! defined( 'YWCTM_FREE_INIT' ) ) {
languages/ywctm.pot CHANGED
@@ -1,8 +1,8 @@
1
msgid ""
2
msgstr ""
3
"Project-Id-Version: YITH WooCommerce Catalog Mode\n"
4
- "POT-Creation-Date: 2015-07-09 12:20+0100\n"
5
- "PO-Revision-Date: 2015-07-09 12:20+0100\n"
6
"Last-Translator: \n"
7
"Language-Team: Your Inspiration Themes <plugins@yithemes.com>\n"
8
"Language: en\n"
@@ -19,30 +19,30 @@ msgstr ""
19
"X-Poedit-SearchPath-0: ..\n"
20
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
21
22
- #: ../class.yith-woocommerce-catalog-mode.php:598
23
- #: ../class.yith-woocommerce-catalog-mode.php:666
24
msgid "Settings"
25
msgstr ""
26
27
- #: ../class.yith-woocommerce-catalog-mode.php:602
28
msgid "Premium Settings"
29
msgstr ""
30
31
- #: ../class.yith-woocommerce-catalog-mode.php:603
32
msgid "Exclusion List"
33
msgstr ""
34
35
- #: ../class.yith-woocommerce-catalog-mode.php:605
36
- #: ../class.yith-woocommerce-catalog-mode.php:669
37
msgid "Premium Version"
38
msgstr ""
39
40
- #: ../class.yith-woocommerce-catalog-mode.php:611
41
- #: ../class.yith-woocommerce-catalog-mode.php:612
42
msgid "Catalog Mode"
43
msgstr ""
44
45
- #: ../class.yith-woocommerce-catalog-mode.php:695
46
msgid "Plugin Documentation"
47
msgstr ""
48
@@ -58,76 +58,76 @@ msgid ""
58
"you are using the premium one."
59
msgstr ""
60
61
- #: ../plugin-options/settings-options.php:17
62
msgid "Upgrade to the PREMIUM VERSION"
63
msgstr ""
64
65
- #: ../plugin-options/settings-options.php:20
66
- #: ../plugin-options/settings-options.php:26
67
msgid "YITH WooCommerce Catalog Mode"
68
msgstr ""
69
70
- #: ../plugin-options/settings-options.php:21
71
msgid "Discover the Advanced Features"
72
msgstr ""
73
74
- #: ../plugin-options/settings-options.php:22
75
msgid ""
76
"Upgrade to the PREMIUM VERSION of YITH WooCommerce Catalog Mode to benefit "
77
"from all features!"
78
msgstr ""
79
80
- #: ../plugin-options/settings-options.php:28
81
msgid "Get Support and Pro Features"
82
msgstr ""
83
84
- #: ../plugin-options/settings-options.php:29
85
msgid ""
86
"By purchasing the premium version of the plugin, you will take advantage of "
87
"the advanced features of the product and you will get one year of free "
88
"updates and support through our platform available 24h/24."
89
msgstr ""
90
91
- #: ../plugin-options/settings-options.php:39
92
- #: ../plugin-options/settings-options.php:48
93
#: ../plugin-options/settings-options.php:99
94
#: ../plugin-options/settings-options.php:107
95
msgid "\"Add to cart\" button"
96
msgstr ""
97
98
- #: ../plugin-options/settings-options.php:41
99
msgid "Exclude selected products (See \"Exclusions\" tab)"
100
msgstr ""
101
102
- #: ../plugin-options/settings-options.php:50
103
msgid "Reverse Exclusion List (Restrict Catalog Mode to selected items only)"
104
msgstr ""
105
106
- #: ../plugin-options/settings-options.php:57
107
msgid "Variable products"
108
msgstr ""
109
110
- #: ../plugin-options/settings-options.php:59
111
msgid "Hide product variations"
112
msgstr ""
113
114
- #: ../plugin-options/settings-options.php:69
115
msgid "General Settings"
116
msgstr ""
117
118
- #: ../plugin-options/settings-options.php:75
119
msgid "Enable YITH Woocommerce Catalog Mode"
120
msgstr ""
121
122
- #: ../plugin-options/settings-options.php:82
123
msgid "Admin View"
124
msgstr ""
125
126
- #: ../plugin-options/settings-options.php:84
127
msgid "Enable Catalog Mode also for administrators"
128
msgstr ""
129
130
- #: ../plugin-options/settings-options.php:93
131
msgid "Catalog Mode Settings"
132
msgstr ""
133
@@ -146,3 +146,105 @@ msgstr ""
146
#: ../plugin-options/settings-options.php:120
147
msgid "Hide and disable all shop features"
148
msgstr ""
1
msgid ""
2
msgstr ""
3
"Project-Id-Version: YITH WooCommerce Catalog Mode\n"
4
+ "POT-Creation-Date: 2015-09-25 10:53+0100\n"
5
+ "PO-Revision-Date: 2015-09-25 10:53+0100\n"
6
"Last-Translator: \n"
7
"Language-Team: Your Inspiration Themes <plugins@yithemes.com>\n"
8
"Language: en\n"
19
"X-Poedit-SearchPath-0: ..\n"
20
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
21
22
+ #: ../class.yith-woocommerce-catalog-mode.php:602
23
+ #: ../class.yith-woocommerce-catalog-mode.php:671
24
msgid "Settings"
25
msgstr ""
26
27
+ #: ../class.yith-woocommerce-catalog-mode.php:606
28
msgid "Premium Settings"
29
msgstr ""
30
31
+ #: ../class.yith-woocommerce-catalog-mode.php:607
32
msgid "Exclusion List"
33
msgstr ""
34
35
+ #: ../class.yith-woocommerce-catalog-mode.php:610
36
+ #: ../class.yith-woocommerce-catalog-mode.php:674
37
msgid "Premium Version"
38
msgstr ""
39
40
+ #: ../class.yith-woocommerce-catalog-mode.php:616
41
+ #: ../class.yith-woocommerce-catalog-mode.php:617
42
msgid "Catalog Mode"
43
msgstr ""
44
45
+ #: ../class.yith-woocommerce-catalog-mode.php:700
46
msgid "Plugin Documentation"
47
msgstr ""
48
58
"you are using the premium one."
59
msgstr ""
60
61
+ #: ../plugin-options/settings-options.php:18
62
msgid "Upgrade to the PREMIUM VERSION"
63
msgstr ""
64
65
+ #: ../plugin-options/settings-options.php:21
66
+ #: ../plugin-options/settings-options.php:27
67
msgid "YITH WooCommerce Catalog Mode"
68
msgstr ""
69
70
+ #: ../plugin-options/settings-options.php:22
71
msgid "Discover the Advanced Features"
72
msgstr ""
73
74
+ #: ../plugin-options/settings-options.php:23
75
msgid ""
76
"Upgrade to the PREMIUM VERSION of YITH WooCommerce Catalog Mode to benefit "
77
"from all features!"
78
msgstr ""
79
80
+ #: ../plugin-options/settings-options.php:29
81
msgid "Get Support and Pro Features"
82
msgstr ""
83
84
+ #: ../plugin-options/settings-options.php:30
85
msgid ""
86
"By purchasing the premium version of the plugin, you will take advantage of "
87
"the advanced features of the product and you will get one year of free "
88
"updates and support through our platform available 24h/24."
89
msgstr ""
90
91
+ #: ../plugin-options/settings-options.php:40
92
+ #: ../plugin-options/settings-options.php:49
93
#: ../plugin-options/settings-options.php:99
94
#: ../plugin-options/settings-options.php:107
95
msgid "\"Add to cart\" button"
96
msgstr ""
97
98
+ #: ../plugin-options/settings-options.php:42
99
msgid "Exclude selected products (See \"Exclusions\" tab)"
100
msgstr ""
101
102
+ #: ../plugin-options/settings-options.php:51
103
msgid "Reverse Exclusion List (Restrict Catalog Mode to selected items only)"
104
msgstr ""
105
106
+ #: ../plugin-options/settings-options.php:58
107
msgid "Variable products"
108
msgstr ""
109
110
+ #: ../plugin-options/settings-options.php:60
111
msgid "Hide product variations"
112
msgstr ""
113
114
+ #: ../plugin-options/settings-options.php:71
115
msgid "General Settings"
116
msgstr ""
117
118
+ #: ../plugin-options/settings-options.php:76
119
msgid "Enable YITH Woocommerce Catalog Mode"
120
msgstr ""
121
122
+ #: ../plugin-options/settings-options.php:83
123
msgid "Admin View"
124
msgstr ""
125
126
+ #: ../plugin-options/settings-options.php:85
127
msgid "Enable Catalog Mode also for administrators"
128
msgstr ""
129
130
+ #: ../plugin-options/settings-options.php:94
131
msgid "Catalog Mode Settings"
132
msgstr ""
133
146
#: ../plugin-options/settings-options.php:120
147
msgid "Hide and disable all shop features"
148
msgstr ""
149
+
150
+ #: ../templates/admin/premium.php:226 ../templates/admin/premium.php:352
151
+ #, php-format
152
+ msgid ""
153
+ "Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Catalog Mode%2$s "
154
+ "to benefit from all features!"
155
+ msgstr ""
156
+
157
+ #: ../templates/admin/premium.php:229 ../templates/admin/premium.php:355
158
+ msgid "UPGRADE"
159
+ msgstr ""
160
+
161
+ #: ../templates/admin/premium.php:230 ../templates/admin/premium.php:356
162
+ msgid "to the premium version"
163
+ msgstr ""
164
+
165
+ #: ../templates/admin/premium.php:236
166
+ msgid "Premium Features"
167
+ msgstr ""
168
+
169
+ #: ../templates/admin/premium.php:244
170
+ msgid "Hide price"
171
+ msgstr ""
172
+
173
+ #: ../templates/admin/premium.php:247
174
+ #, php-format
175
+ msgid ""
176
+ "Hide the price of products in your shop and replace it with a text. Decide "
177
+ "if some of the products have to be excluded and if %1$shiding price%2$s has "
178
+ "to be applied to all or restricted only to unlogged users."
179
+ msgstr ""
180
+
181
+ #: ../templates/admin/premium.php:257
182
+ msgid "Inquiry form"
183
+ msgstr ""
184
+
185
+ #: ../templates/admin/premium.php:260
186
+ #, php-format
187
+ msgid ""
188
+ "Improve single product page by adding a tab with an %1$sinquiry form%2$s "
189
+ "explicitly thought to let them send messages to site administrator."
190
+ msgstr ""
191
+
192
+ #: ../templates/admin/premium.php:276
193
+ msgid "Custom button"
194
+ msgstr ""
195
+
196
+ #: ../templates/admin/premium.php:279
197
+ #, php-format
198
+ msgid ""
199
+ "Add a button in single product page to call users to a specific %1$saction"
200
+ "%2$s, depending on the specified %1$slink%2$s (email sending, skype call, "
201
+ "telephone call)."
202
+ msgstr ""
203
+
204
+ #: ../templates/admin/premium.php:289
205
+ msgid "Product reviews"
206
+ msgstr ""
207
+
208
+ #: ../templates/admin/premium.php:292
209
+ #, php-format
210
+ msgid ""
211
+ "You can disable product %1$sreviewing system%2$s of your shop and decide if "
212
+ "applying it to all users or just to unlogged ones."
213
+ msgstr ""
214
+
215
+ #: ../templates/admin/premium.php:308
216
+ msgid "Exclusion list"
217
+ msgstr ""
218
+
219
+ #: ../templates/admin/premium.php:311
220
+ #, php-format
221
+ msgid ""
222
+ "Set plugin options, but if you want that options concerning price visibility "
223
+ "and ‘Add to cart’ do not apply to specific products, add them to "
224
+ "%1$sexclusion list%2$s and, voilà, problem solved."
225
+ msgstr ""
226
+
227
+ #: ../templates/admin/premium.php:321
228
+ msgid "REVERSE EXCLUSION LIST"
229
+ msgstr ""
230
+
231
+ #: ../templates/admin/premium.php:324
232
+ #, php-format
233
+ msgid ""
234
+ "Apply Catalog Mode to some items only: add them to the \"Exclusion List\" "
235
+ "and %1$smake it work in the opposite way as usual%2$s. All items in the shop "
236
+ "show price and “Add to Cart” button, while items in the list don’t."
237
+ msgstr ""
238
+
239
+ #: ../templates/admin/premium.php:340
240
+ msgid "Source page of the request"
241
+ msgstr ""
242
+
243
+ #: ../templates/admin/premium.php:343
244
+ #, php-format
245
+ msgid ""
246
+ "Thanks to the %1$s\"Product Permalink\"%2$s option you will be able to know "
247
+ "from which page your users have generated the request.%3$sThe email "
248
+ "generated from the request form will include the address of the page: "
249
+ "another important information that can be really useful for you."
250
+ msgstr ""
plugin-fw/assets/js/yit-cpt-unlimited.js CHANGED
@@ -12,7 +12,7 @@
12
// Author code here
13
14
// open media box
15
- $('.wrap h2').on( 'click', 'a.multi-uploader', function(event){
16
event.preventDefault();
17
18
var file_frame,
12
// Author code here
13
14
// open media box
15
+ $('.wrap h1, .wrap h2').on( 'click', 'a.multi-uploader', function(event){
16
event.preventDefault();
17
18
var file_frame,
plugin-fw/assets/js/yit-cpt-unlimited.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(c){c(".wrap h2").on("click","a.multi-uploader",function(f){f.preventDefault();var a,b=c(this),d=!1;b.next("span.spinner").css("display","inline-block");a||(a=wp.media.frames.file_frame=wp.media({title:b.data("uploader_title"),button:{text:b.data("uploader_button_text")},library:{type:"image"},multiple:!0}),a.on("select",function(){var e=[];a.state().get("selection").map(function(a){a=a.toJSON();e.push({id:a.id,url:a.url,title:a.title})});c.post(ajaxurl,{images:e,post_type:typenow,action:"yit_cptu_multiuploader"},
2
function(a){location.reload()});b.next("span.spinner").css("display","inline-block");d=!0}),a.on("close",function(){d||b.next("span.spinner").hide()}));a.open()})})(jQuery);
1
+ (function(c){c(".wrap h1, .wrap h2").on("click","a.multi-uploader",function(f){f.preventDefault();var a,b=c(this),d=!1;b.next("span.spinner").css("display","inline-block");a||(a=wp.media.frames.file_frame=wp.media({title:b.data("uploader_title"),button:{text:b.data("uploader_button_text")},library:{type:"image"},multiple:!0}),a.on("select",function(){var e=[];a.state().get("selection").map(function(a){a=a.toJSON();e.push({id:a.id,url:a.url,title:a.title})});c.post(ajaxurl,{images:e,post_type:typenow,action:"yit_cptu_multiuploader"},
2
function(a){location.reload()});b.next("span.spinner").css("display","inline-block");d=!0}),a.on("close",function(){d||b.next("span.spinner").hide()}));a.open()})})(jQuery);
plugin-fw/lib/yit-cpt-unlimited.php CHANGED
@@ -1049,7 +1049,7 @@ class YIT_CPT_Unlimited {
1049
'fields' => apply_filters( 'yit_cptu_fields', array(
1050
'type' => array(
1051
'label' => __( 'Type', 'yith-plugin-fw' ),
1052
- 'desc' => __( 'Layout for this '.strtolower( $this->_labels['singular'] ) , 'yith-plugin-fw' ),
1053
'type' => 'select',
1054
'options' => isset( $layouts ) ? $layouts : array(),
1055
'std' => '' ),
@@ -1637,7 +1637,7 @@ class YIT_CPT_Unlimited {
1637
style: 'float: none;'
1638
});
1639
1640
- button.appendTo('.wrap h2').after(spinner);
1641
1642
})(jQuery);
1643
</script>
1049
'fields' => apply_filters( 'yit_cptu_fields', array(
1050
'type' => array(
1051
'label' => __( 'Type', 'yith-plugin-fw' ),
1052
+ 'desc' => sprintf( __( 'Layout for this %s' , 'yith-plugin-fw' ), strtolower( $this->_labels['singular'] ) ),
1053
'type' => 'select',
1054
'options' => isset( $layouts ) ? $layouts : array(),
1055
'std' => '' ),
1637
style: 'float: none;'
1638
});
1639
1640
+ button.appendTo('.wrap h2, .wrap h1').after(spinner);
1641
1642
})(jQuery);
1643
</script>
plugin-fw/lib/yit-metabox.php CHANGED
@@ -9,11 +9,11 @@
9
*/
10
11
12
- if ( ! defined( 'ABSPATH' ) ) {
13
exit;
14
} // Exit if accessed directly
15
16
- if ( ! class_exists( 'YIT_Metabox' ) ) {
17
/**
18
* YIT Metabox
19
*
@@ -48,8 +48,8 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
48
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
49
*
50
*/
51
-
52
- class YIT_Metabox {
53
54
/**
55
* @var string the id of metabox
@@ -91,9 +91,10 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
91
* @since 1.0
92
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
93
*/
94
- public static function instance( $id ) {
95
- if ( ! isset( self::$_instance[$id] ) ) {
96
- self::$_instance[$id] = new self( $id );
97
}
98
return self::$_instance[$id];
99
}
@@ -107,7 +108,8 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
107
* @since 1.0
108
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
109
*/
110
- function __construct( $id = '' ) {
111
$this->id = $id;
112
113
}
@@ -124,15 +126,16 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
124
* @since 1.0
125
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
126
*/
127
- public function init( $options = array() ) {
128
129
- $this->set_options( $options );
130
$this->set_tabs();
131
132
133
- add_action( 'add_meta_boxes', array( $this, 'register_metabox' ) );
134
- add_action( 'save_post', array( $this, 'save_postdata' ) );
135
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 15 );
136
137
}
138
@@ -145,18 +148,19 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
145
* @since 1.0
146
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
147
*/
148
- public function enqueue() {
149
150
wp_enqueue_media();
151
- wp_enqueue_style( 'wp-color-picker' );
152
- wp_enqueue_style( 'yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css' );
153
- wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
154
- wp_enqueue_script( 'jquery-ui-datepicker' );
155
- wp_enqueue_script( 'yit-spinner', YIT_CORE_PLUGIN_URL . '/assets/js/panel.spinner.js', array( 'jquery' ), '0.0.1', true );
156
- wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
157
- 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 );
158
- wp_enqueue_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array( 'jquery', 'wp-color-picker' ), '1.0.0', true );
159
- 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' );
160
161
162
}
@@ -172,7 +176,8 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
172
* @since 1.0
173
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
174
*/
175
- public function set_options( $options = array() ) {
176
$this->options = $options;
177
178
}
@@ -188,13 +193,14 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
188
* @since 1.0
189
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
190
*/
191
- public function set_tabs() {
192
- if ( ! isset( $this->options['tabs'] ) ) {
193
return;
194
}
195
- $this->tabs = $this->options['tabs'] ;
196
- if( isset($this->tabs['settings']['fields']) ){
197
- $this->tabs['settings']['fields'] = array_filter( $this->tabs['settings']['fields'] );
198
}
199
}
200
@@ -206,32 +212,31 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
206
*
207
* @internal param array $tabs
208
*
209
- * @param array $tab the new tab to add to the metabox
210
- * @param string $where tell where insert the tab if after or before a $refer
211
- * @param null $refer an existent tab inside metabox
212
*
213
* @return void
214
* @since 1.0
215
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
216
*/
217
- public function add_tab( $tab, $where = 'after', $refer = null ) {
218
- if ( ! is_null( $refer ) ) {
219
- $ref_pos = array_search( $refer, array_keys( $this->tabs ) );
220
- if ( $ref_pos !== false ) {
221
- if ( $where == 'after' ) {
222
- $this->tabs = array_slice( $this->tabs, 0, $ref_pos + 1, true ) +
223
$tab +
224
- array_slice( $this->tabs, $ref_pos + 1, count( $this->tabs ) - 1, true );
225
- }
226
- else {
227
- $this->tabs = array_slice( $this->tabs, 0, $ref_pos, true ) +
228
$tab +
229
- array_slice( $this->tabs, $ref_pos, count( $this->tabs ), true );
230
}
231
}
232
- }
233
- else {
234
- $this->tabs = array_merge( $tab, $this->tabs );
235
}
236
237
}
@@ -249,9 +254,10 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
249
* @since 1.0
250
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
251
*/
252
- public function remove_tab( $id_tab ) {
253
- if ( isset( $this->tabs[$id_tab] ) ) {
254
- unset ( $this->tabs[$id_tab] );
255
}
256
}
257
@@ -264,40 +270,40 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
264
* @internal param array $tabs
265
*
266
* @param string $tab_id the id of the tabs where add the field
267
- * @param array $args the field to add
268
- * @param string $where tell where insert the field if after or before a $refer
269
- * @param null $refer an existent field inside tab
270
*
271
* @return void
272
* @since 1.0
273
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
274
*/
275
- public function add_field( $tab_id, $args, $where = 'after', $refer = null ) {
276
- if ( isset( $this->tabs[$tab_id] ) ) {
277
278
$cf = $this->tabs[$tab_id]['fields'];
279
- if ( ! is_null( $refer ) ) {
280
- $ref_pos = array_search( $refer, array_keys( $cf ) );
281
- if ( $ref_pos !== false ) {
282
- if ( $where == 'after' ) {
283
- $this->tabs[$tab_id]['fields'] = array_slice( $cf, 0, $ref_pos + 1, true ) +
284
$args +
285
- array_slice( $cf, $ref_pos, count( $cf ) - 1, true );
286
287
- } elseif ( $where == 'before' ) {
288
- $this->tabs[$tab_id]['fields'] = array_slice( $cf, 0, $ref_pos, true ) +
289
$args +
290
- array_slice( $cf, $ref_pos, count( $cf ), true );
291
292
}
293
}
294
- }
295
- else {
296
- if ( $where == 'first' ) {
297
$this->tabs[$tab_id]['fields'] = $args + $cf;
298
299
} else {
300
- $this->tabs[$tab_id]['fields'] = array_merge( $this->tabs[$tab_id]['fields'], $args );
301
}
302
}
303
@@ -317,10 +323,11 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
317
* @since 1.0
318
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
319
*/
320
- public function remove_field( $id_field ) {
321
- foreach ( $this->tabs as $tab_name => $tab ) {
322
- if ( isset( $tab['fields'][$id_field] ) ) {
323
- unset ( $this->tabs[$tab_name]['fields'][$id_field] );
324
}
325
}
326
}
@@ -336,12 +343,13 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
336
* @since 1.0
337
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
338
*/
339
- public function reorder_tabs() {
340
- foreach ( $this->tabs as $tab_name => $tab ) {
341
- foreach ( $tab['fields'] as $id_field => $field ) {
342
- $this->tabs[$tab_name]['fields'][$id_field]['private'] = ( isset( $field['private'] ) ) ? $field['private'] : true;
343
- $this->tabs[$tab_name]['fields'][$id_field]['id'] = $this->get_option_metabox_id( $id_field, $this->tabs[$tab_name]['fields'][$id_field]['private'] );
344
- $this->tabs[$tab_name]['fields'][$id_field]['name'] = $this->get_option_metabox_name( $this->tabs[$tab_name]['fields'][$id_field]['id'] );
345
}
346
}
347
@@ -360,11 +368,11 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
360
* @since 1.0
361
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
362
*/
363
- public function get_option_metabox_id( $id_field, $private = true ) {
364
- if ( $private ) {
365
return '_' . $id_field;
366
- }
367
- else {
368
return $id_field;
369
}
370
}
@@ -381,16 +389,17 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
381
* @since 1.0
382
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
383
*/
384
- public function get_option_metabox_name( $id_field, $private = true ) {
385
- $db_name = apply_filters( 'yit_metaboxes_option_main_name', 'yit_metaboxes' );
386
- $return = $db_name . '[';
387
388
- if ( ! strpos( $id_field, '[' ) ) {
389
return $return . $id_field . ']';
390
}
391
- $return .= substr( $id_field, 0, strpos( $id_field, '[' ) );
392
$return .= ']';
393
- $return .= substr( $id_field, strpos( $id_field, '[' ) );
394
395
return $return;
396
}
@@ -405,9 +414,10 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
405
* @since 1.0
406
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
407
*/
408
- public function register_metabox( $post_type ) {
409
- if( in_array( $post_type, (array) $this->options['pages'] ) ){
410
- add_meta_box( $this->id, $this->options['label'], array( $this, 'show' ), $post_type, $this->options['context'], $this->options['priority'] );
411
}
412
}
413
@@ -421,10 +431,11 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
421
* @since 1.0
422
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
423
*/
424
- public function show() {
425
$this->reorder_tabs();
426
427
- yit_plugin_get_template( YIT_CORE_PLUGIN_PATH, 'metaboxes/tab.php', array( 'tabs' => $this->tabs ) );
428
}
429
430
/**
@@ -438,61 +449,62 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
438
* @since 1.0
439
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
440
*/
441
- public function save_postdata( $post_id ) {
442
443
444
-
445
- if ( ! isset( $_POST['yit_metaboxes_nonce'] ) || ! wp_verify_nonce( $_POST['yit_metaboxes_nonce'], 'metaboxes-fields-nonce' ) ) {
446
return $post_id;
447
}
448
449
450
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
451
return $post_id;
452
}
453
454
- if ( isset( $_POST['post_type'] ) ) {
455
$post_type = $_POST['post_type'];
456
- }
457
- else {
458
return $post_id;
459
}
460
461
- if ( 'page' == $post_type ) {
462
- if ( ! current_user_can( 'edit_page', $post_id ) ) {
463
return $post_id;
464
}
465
- }
466
- else {
467
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
468
return $post_id;
469
}
470
}
471
472
$this->reorder_tabs();
473
474
475
- foreach ( $this->tabs as $tab ) {
476
477
- foreach ( $tab['fields'] as $field ) {
478
479
- if ( in_array( $field['type'], array( 'title' ) ) ) {
480
continue;
481
}
482
483
- if ( isset( $_POST['yit_metaboxes'][$field['id']] ) ) {
484
485
- add_post_meta( $post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']], true ) || update_post_meta( $post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']] );
486
- }
487
- elseif ( in_array( $field['type'], array( 'onoff', 'checkbox' ) ) ) {
488
- add_post_meta( $post_id, $field['id'], '0', true ) || update_post_meta( $post_id, $field['id'], '0' );
489
- }
490
- else {
491
- delete_post_meta( $post_id, $field['id'] );
492
}
493
}
494
}
495
496
}
497
498
/**
@@ -506,15 +518,16 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
506
* @since 2.0.0
507
* @author Andrea Grillo <andrea.grillo@yithemes.com>
508
*/
509
- public function remove_fields( $id_fields ) {
510
- foreach ( $id_fields as $k => $field ) {
511
- $this->remove_field( $field );
512
}
513
}
514
}
515
}
516
517
- if ( ! function_exists( 'YIT_Metabox' ) ) {
518
519
/**
520
* Main instance of plugin
@@ -527,8 +540,9 @@ if ( ! function_exists( 'YIT_Metabox' ) ) {
527
*/
528
529
530
- function YIT_Metabox( $id ) {
531
- return YIT_Metabox::instance( $id );
532
}
533
}
534
9
*/
10
11
12
+ if (!defined('ABSPATH')) {
13
exit;
14
} // Exit if accessed directly
15
16
+ if (!class_exists('YIT_Metabox')) {
17
/**
18
* YIT Metabox
19
*
48
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
49
*
50
*/
51
+ class YIT_Metabox
52
+ {
53
54
/**
55
* @var string the id of metabox
91
* @since 1.0
92
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
93
*/
94
+ public static function instance($id)
95
+ {
96
+ if (!isset(self::$_instance[$id])) {
97
+ self::$_instance[$id] = new self($id);
98
}
99
return self::$_instance[$id];
100
}
108
* @since 1.0
109
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
110
*/
111
+ function __construct($id = '')
112
+ {
113
$this->id = $id;
114
115
}
126
* @since 1.0
127
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
128
*/
129
+ public function init($options = array())
130
+ {
131
132
+ $this->set_options($options);
133
$this->set_tabs();
134
135
136
+ add_action('add_meta_boxes', array($this, 'register_metabox'));
137
+ add_action('save_post', array($this, 'save_postdata'));
138
+ add_action('admin_enqueue_scripts', array($this, 'enqueue'), 15);
139
140
}
141
148
* @since 1.0
149
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
150
*/
151
+ public function enqueue()
152
+ {
153
154
wp_enqueue_media();
155
+ wp_enqueue_style('wp-color-picker');
156
+ wp_enqueue_style('yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css');
157
+ wp_enqueue_style('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css');
158
+ wp_enqueue_script('jquery-ui-datepicker');
159
+ wp_enqueue_script('yit-spinner', YIT_CORE_PLUGIN_URL . '/assets/js/panel.spinner.js', array('jquery'), '0.0.1', true);
160
+ wp_enqueue_script('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array('jquery'), '1.1.0', true);
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
}
176
* @since 1.0
177
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
178
*/
179
+ public function set_options($options = array())
180
+ {
181
$this->options = $options;
182
183
}
193
* @since 1.0
194
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
195
*/
196
+ public function set_tabs()
197
+ {
198
+ if (!isset($this->options['tabs'])) {
199
return;
200
}
201
+ $this->tabs = $this->options['tabs'];
202
+ if (isset($this->tabs['settings']['fields'])) {
203
+ $this->tabs['settings']['fields'] = array_filter($this->tabs['settings']['fields']);
204
}
205
}
206
212
*
213
* @internal param array $tabs
214
*
215
+ * @param array $tab the new tab to add to the metabox
216
+ * @param string $where tell where insert the tab if after or before a $refer
217
+ * @param null $refer an existent tab inside metabox
218
*
219
* @return void
220
* @since 1.0
221
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
222
*/
223
+ public function add_tab($tab, $where = 'after', $refer = null)
224
+ {
225
+ if (!is_null($refer)) {
226
+ $ref_pos = array_search($refer, array_keys($this->tabs));
227
+ if ($ref_pos !== false) {
228
+ if ($where == 'after') {
229
+ $this->tabs = array_slice($this->tabs, 0, $ref_pos + 1, true) +
230
$tab +
231
+ array_slice($this->tabs, $ref_pos + 1, count($this->tabs) - 1, true);
232
+ } else {
233
+ $this->tabs = array_slice($this->tabs, 0, $ref_pos, true) +
234
$tab +
235
+ array_slice($this->tabs, $ref_pos, count($this->tabs), true);
236
}
237
}
238
+ } else {
239
+ $this->tabs = array_merge($tab, $this->tabs);
240
}
241
242
}
254
* @since 1.0
255
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
256
*/
257
+ public function remove_tab($id_tab)
258
+ {
259
+ if (isset($this->tabs[$id_tab])) {
260
+ unset ($this->tabs[$id_tab]);
261
}
262
}
263
270
* @internal param array $tabs
271
*
272
* @param string $tab_id the id of the tabs where add the field
273
+ * @param array $args the field to add
274
+ * @param string $where tell where insert the field if after or before a $refer
275
+ * @param null $refer an existent field inside tab
276
*
277
* @return void
278
* @since 1.0
279
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
280
*/
281
+ public function add_field($tab_id, $args, $where = 'after', $refer = null)
282
+ {
283
+ if (isset($this->tabs[$tab_id])) {
284
285
$cf = $this->tabs[$tab_id]['fields'];
286
+ if (!is_null($refer)) {
287
+ $ref_pos = array_search($refer, array_keys($cf));
288
+ if ($ref_pos !== false) {
289
+ if ($where == 'after') {
290
+ $this->tabs[$tab_id]['fields'] = array_slice($cf, 0, $ref_pos + 1, true) +
291
$args +
292
+ array_slice($cf, $ref_pos, count($cf) - 1, true);
293
294
+ } elseif ($where == 'before') {
295
+ $this->tabs[$tab_id]['fields'] = array_slice($cf, 0, $ref_pos, true) +
296
$args +
297
+ array_slice($cf, $ref_pos, count($cf), true);
298
299
}
300
}
301
+ } else {
302
+ if ($where == 'first') {
303
$this->tabs[$tab_id]['fields'] = $args + $cf;
304
305
} else {
306
+ $this->tabs[$tab_id]['fields'] = array_merge($this->tabs[$tab_id]['fields'], $args);
307
}
308
}
309
323
* @since 1.0
324
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
325
*/
326
+ public function remove_field($id_field)
327
+ {
328
+ foreach ($this->tabs as $tab_name => $tab) {
329
+ if (isset($tab['fields'][$id_field])) {
330
+ unset ($this->tabs[$tab_name]['fields'][$id_field]);
331
}
332
}
333
}
343
* @since 1.0
344
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
345
*/
346
+ public function reorder_tabs()
347
+ {
348
+ foreach ($this->tabs as $tab_name => $tab) {
349
+ foreach ($tab['fields'] as $id_field => $field) {
350
+ $this->tabs[$tab_name]['fields'][$id_field]['private'] = (isset($field['private'])) ? $field['private'] : true;
351
+ $this->tabs[$tab_name]['fields'][$id_field]['id'] = $this->get_option_metabox_id($id_field, $this->tabs[$tab_name]['fields'][$id_field]['private']);
352
+ $this->tabs[$tab_name]['fields'][$id_field]['name'] = $this->get_option_metabox_name($this->tabs[$tab_name]['fields'][$id_field]['id']);
353
}
354
}
355
368
* @since 1.0
369
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
370
*/
371
+ public function get_option_metabox_id($id_field, $private = true)
372
+ {
373
+ if ($private) {
374
return '_' . $id_field;
375
+ } else {
376
return $id_field;
377
}
378
}
389
* @since 1.0
390
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
391
*/
392
+ public function get_option_metabox_name($id_field, $private = true)
393
+ {
394
+ $db_name = apply_filters('yit_metaboxes_option_main_name', 'yit_metaboxes');
395
+ $return = $db_name . '[';
396
397
+ if (!strpos($id_field, '[')) {
398
return $return . $id_field . ']';
399
}
400
+ $return .= substr($id_field, 0, strpos($id_field, '['));
401
$return .= ']';
402
+ $return .= substr($id_field, strpos($id_field, '['));
403
404
return $return;
405
}
414
* @since 1.0
415
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
416
*/
417
+ public function register_metabox($post_type)
418
+ {
419
+ if (in_array($post_type, (array)$this->options['pages'])) {
420
+ add_meta_box($this->id, $this->options['label'], array($this, 'show'), $post_type, $this->options['context'], $this->options['priority']);
421
}
422
}
423
431
* @since 1.0
432
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
433
*/
434
+ public function show()
435
+ {
436
$this->reorder_tabs();
437
438
+ yit_plugin_get_template(YIT_CORE_PLUGIN_PATH, 'metaboxes/tab.php', array('tabs' => $this->tabs));
439
}
440
441
/**
449
* @since 1.0
450
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
451
*/
452
+ public function save_postdata($post_id)
453
+ {
454
455
456
+ if (!isset($_POST['yit_metaboxes_nonce']) || !wp_verify_nonce($_POST['yit_metaboxes_nonce'], 'metaboxes-fields-nonce')) {
457
return $post_id;
458
}
459
460
461
+ if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX)) {
462
return $post_id;
463
}
464
465
+ if (isset($_POST['post_type'])) {
466
$post_type = $_POST['post_type'];
467
+ } else {
468
return $post_id;
469
}
470
471
+ if ('page' == $post_type) {
472
+ if (!current_user_can('edit_page', $post_id)) {
473
return $post_id;
474
}
475
+ } else {
476
+ if (!current_user_can('edit_post', $post_id)) {
477
return $post_id;
478
}
479
}
480
481
+ if (!in_array($post_type, (array)$this->options['pages'])) {
482
+ return $post_id;
483
+ }
484
+
485
$this->reorder_tabs();
486
487
488
+ foreach ($this->tabs as $tab) {
489
490
+ foreach ($tab['fields'] as $field) {
491
492
+ if (in_array($field['type'], array('title'))) {
493
continue;
494
}
495
496
+ if (isset($_POST['yit_metaboxes'][$field['id']])) {
497
498
+ add_post_meta($post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']], true) || update_post_meta($post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']]);
499
+ } elseif (in_array($field['type'], array('onoff', 'checkbox'))) {
500
+ update_post_meta($post_id, $field['id'], '0');
501
+ } else {
502
+ delete_post_meta($post_id, $field['id']);
503
}
504
}
505
}
506
507
+
508
}
509
510
/**
518
* @since 2.0.0
519
* @author Andrea Grillo <andrea.grillo@yithemes.com>
520
*/
521
+ public function remove_fields($id_fields)
522
+ {
523
+ foreach ($id_fields as $k => $field) {
524
+ $this->remove_field($field);
525
}
526
}
527
}
528
}
529
530
+ if (!function_exists('YIT_Metabox')) {
531
532
/**
533
* Main instance of plugin
540
*/
541
542
543
+ function YIT_Metabox($id)
544
+ {
545
+ return YIT_Metabox::instance($id);
546
}
547
}
548
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -282,7 +282,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
282
283
do_action( 'yit_panel_wc_after_update' );
284
285
- } elseif( isset( $_REQUEST['yit-action'] ) && $_REQUEST['yit-action'] == 'wc-options-reset' ){
286
287
$yit_options = $this->get_main_array_options();
288
$current_tab = $this->get_current_tab();
@@ -364,8 +365,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
364
* @return array Filtered body classes
365
*/
366
public function admin_body_class( $admin_body_classes ){
367
- $admin_body_classes .= ' woocommerce ';
368
- return $admin_body_classes;
369
}
370
371
/**
282
283
do_action( 'yit_panel_wc_after_update' );
284
285
+ } elseif( isset( $_REQUEST['yit-action'] ) && $_REQUEST['yit-action'] == 'wc-options-reset'
286
+ && isset( $_POST['yith_wc_reset_options_nonce'] ) && wp_verify_nonce( $_POST['yith_wc_reset_options_nonce'], 'yith_wc_reset_options_'.$this->settings['page'] )){
287
288
$yit_options = $this->get_main_array_options();
289
$current_tab = $this->get_current_tab();
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
/**
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -708,8 +708,9 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
708
}
709
710
$custom_attributes = implode( ' ', $custom_attributes );
711
712
- $db_value = ( isset( $db_options[$option['id']] ) ) ? $db_options[$option['id']] : '';
713
if ( isset( $option['deps'] ) ) {
714
$deps = $option['deps'];
715
}
708
}
709
710
$custom_attributes = implode( ' ', $custom_attributes );
711
+ $std = isset( $option['std'] ) ? $option['std'] : '';
712
+ $db_value = ( isset( $db_options[$option['id']] ) ) ? $db_options[$option['id']] : $std;
713
714
if ( isset( $option['deps'] ) ) {
715
$deps = $option['deps'];
716
}
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -134,7 +134,8 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
134
$update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
135
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
136
$details_url[ $init ] = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
137
- $changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $this->_plugins[ $init ]['info']['changelog'], $changelog_id, false );
138
}
139
140
$localize_script_args = array(
@@ -261,7 +262,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
261
262
//WARNING: The file is not automatically deleted, The script must unlink() the file.
263
if ( ! $url ) {
264
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) );
265
}
266
267
$tmpfname = wp_tempnam( $url );
@@ -274,7 +275,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
274
);
275
276
if ( ! $tmpfname ) {
277
- return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.' ) );
278
}
279
280
$response = wp_safe_remote_post( $url, $args );
@@ -506,7 +507,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
506
507
check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
508
509
- $title = __( 'Update Plugin' );
510
$parent_file = 'plugins.php';
511
$submenu_file = 'plugins.php';
512
134
$update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
135
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
136
$details_url[ $init ] = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
137
+ $plugin_changelog = isset( $this->_plugins[ $init ]['info']['changelog'] ) ? $this->_plugins[ $init ]['info']['changelog'] : '';
138
+ $changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $plugin_changelog, $changelog_id, false );
139
}
140
141
$localize_script_args = array(
262
263
//WARNING: The file is not automatically deleted, The script must unlink() the file.
264
if ( ! $url ) {
265
+ return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
266
}
267
268
$tmpfname = wp_tempnam( $url );
275
);
276
277
if ( ! $tmpfname ) {
278
+ return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
279
}
280
281
$response = wp_safe_remote_post( $url, $args );
507
508
check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
509
510
+ $title = __( 'Update Plugin', 'yith-plugin-fw' );
511
$parent_file = 'plugins.php';
512
$submenu_file = 'plugins.php';
513
plugin-fw/lib/yit-video.php CHANGED
@@ -57,7 +57,7 @@ if ( ! class_exists( 'YIT_Video' ) ) {
57
return;
58
}
59
60
- if( ! $echo ) ob_start();
61
62
$id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
63
$id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
@@ -67,7 +67,11 @@ if ( ! class_exists( 'YIT_Video' ) ) {
67
</div>
68
69
<?php
70
- if( ! $echo ) return ob_get_clean();
71
}
72
73
/**
@@ -97,7 +101,7 @@ if ( ! class_exists( 'YIT_Video' ) ) {
97
$id = self::video_id_by_url( $url );
98
}
99
100
- if( ! $echo ) ob_start();
101
102
$id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
103
$id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
@@ -107,7 +111,11 @@ if ( ! class_exists( 'YIT_Video' ) ) {
107
</div>
108
109
<?php
110
- if( ! $echo ) return ob_get_clean();
111
}
112
113
/**
57
return;
58
}
59
60
+ ob_start();
61
62
$id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
63
$id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
67
</div>
68
69
<?php
70
+ $html = apply_filters( 'yit_video_youtube', ob_get_clean() );
71
+
72
+ if( $echo ) echo $html;
73
+
74
+ return $html;
75
}
76
77
/**
101
$id = self::video_id_by_url( $url );
102
}
103
104
+ ob_start();
105
106
$id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
107
$id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
111
</div>
112
113
<?php
114
+ $html = apply_filters( 'yit_video_vimeo', ob_get_clean() );
115
+
116
+ if( $echo ) echo $html;
117
+
118
+ return $html;
119
}
120
121
/**
plugin-fw/templates/metaboxes/types/categories.php CHANGED
@@ -43,7 +43,7 @@ $categories = yit_get_model('cpt_unlimited')->get_setting( 'categories', $post->
43
</h4>
44
<p class="category-add-field" id="<?php echo $id ?>-category-field">
45
<input type="text" class="newcategory" name="newcategory" style="width:100%;" id="<?php echo $id ?>-new-category" />
46
- <input type="button" value="<?php esc_attr_e( 'Add' ); ?>" class="add:categorychecklist:category-add button category-add-submit" id="<?php echo $id ?>-category-add-submit" />
47
</p>
48
</div>
49
</div>
43
</h4>
44
<p class="category-add-field" id="<?php echo $id ?>-category-field">
45
<input type="text" class="newcategory" name="newcategory" style="width:100%;" id="<?php echo $id ?>-new-category" />
46
+ <input type="button" value="<?php esc_attr_e( 'Add', 'yit' ); ?>" class="add:categorychecklist:category-add button category-add-submit" id="<?php echo $id ?>-category-add-submit" />
47
</p>
48
</div>
49
</div>
plugin-fw/templates/panel/woocommerce/woocommerce-form.php CHANGED
@@ -7,6 +7,7 @@
7
<form id="plugin-fw-wc-reset" method="post">
8
<?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
9
<input type="hidden" name="yit-action" value="wc-options-reset" />
10
<input type="submit" name="yit-reset" class="button-secondary" value="<?php _e( 'Reset Defaults', 'yith-plugin-fw' ) ?>" onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');" />
11
</form>
12
</div>
7
<form id="plugin-fw-wc-reset" method="post">
8
<?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
9
<input type="hidden" name="yit-action" value="wc-options-reset" />
10
+ <?php wp_nonce_field( 'yith_wc_reset_options_'.$this->settings['page'], 'yith_wc_reset_options_nonce' ); ?>
11
<input type="submit" name="yit-reset" class="button-secondary" value="<?php _e( 'Reset Defaults', 'yith-plugin-fw' ) ?>" onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');" />
12
</form>
13
</div>
plugin-fw/yit-functions.php CHANGED
@@ -634,9 +634,14 @@ if ( ! function_exists( 'yit_check_plugin_support' ) ) {
634
* @author Andrea Grillo <andrea.grillo@yithemes.com>
635
*/
636
function yit_check_plugin_support() {
637
$headers['core'] = wp_get_theme()->get( 'Core Framework Version' );
638
$headers['author'] = wp_get_theme()->get( 'Author' );
639
640
if ( ( ! empty( $headers['core'] ) && version_compare( $headers['core'], '2.0.0', '<=' ) ) || $headers['author'] != 'Your Inspiration Themes' ) {
641
return true;
642
}
634
* @author Andrea Grillo <andrea.grillo@yithemes.com>
635
*/
636
function yit_check_plugin_support() {
637
+
638
$headers['core'] = wp_get_theme()->get( 'Core Framework Version' );
639
$headers['author'] = wp_get_theme()->get( 'Author' );
640
641
+ if( ! $headers['core'] && defined( 'YIT_CORE_VERSION' ) ) {
642
+ $headers['core'] = YIT_CORE_VERSION;
643
+ }
644
+
645
if ( ( ! empty( $headers['core'] ) && version_compare( $headers['core'], '2.0.0', '<=' ) ) || $headers['author'] != 'Your Inspiration Themes' ) {
646
return true;
647
}
plugin-options/premium-landing-options.php CHANGED
@@ -8,7 +8,7 @@
8
* http://www.gnu.org/licenses/gpl-3.0.txt
9
*/
10
11
- if ( ! defined( 'ABSPATH' ) ) {
12
exit;
13
} // Exit if accessed directly
14
8
* http://www.gnu.org/licenses/gpl-3.0.txt
9
*/
10
11
+ if ( !defined( 'ABSPATH' ) ) {
12
exit;
13
} // Exit if accessed directly
14
plugin-options/settings-options.php CHANGED
@@ -8,21 +8,22 @@
8
* http://www.gnu.org/licenses/gpl-3.0.txt
9
*/
10
11
- if ( ! defined( 'ABSPATH' ) ) {
12
exit;
13
} // Exit if accessed directly
14
global $YITH_WC_Catalog_Mode;
15
16
$videobox = defined( 'YWCTM_PREMIUM' ) ? '' : array(
17
- 'name' => __( 'Upgrade to the PREMIUM VERSION', 'ywctm' ),
18
- 'type' => 'videobox',
19
- 'default' => array(
20
'plugin_name' => __( 'YITH WooCommerce Catalog Mode', 'ywctm' ),
21
'title_first_column' => __( 'Discover the Advanced Features', 'ywctm' ),
22
'description_first_column' => __( 'Upgrade to the PREMIUM VERSION of YITH WooCommerce Catalog Mode to benefit from all features!', 'ywctm' ),
23
'video' => array(
24
'video_id' => '120697979',
25
- 'video_image_url' => YWCTM_ASSETS_URL.'/images/yith-woocommerce-catalog-mode.jpg',
26
'video_description' => __( 'YITH WooCommerce Catalog Mode', 'ywctm' ),
27
),
28
'title_second_column' => __( 'Get Support and Pro Features', 'ywctm' ),
@@ -32,98 +33,96 @@ $videobox = defined( 'YWCTM_PREMIUM' ) ? '' : array(
32
'title' => 'Get Support and Pro Features'
33
)
34
),
35
- 'id' => 'ywctm_general_videobox'
36
);
37
38
- $exclusion = ! defined( 'YWCTM_PREMIUM' ) ? '' : array (
39
- 'name' => __( '"Add to cart" button', 'ywctm' ),
40
- 'type' => 'checkbox',
41
- 'desc' => __( 'Exclude selected products (See "Exclusions" tab)', 'ywctm' ),
42
- 'id' => 'ywctm_exclude_hide_add_to_cart',
43
- 'default' => 'no',
44
- 'checkboxgroup' => ''
45
);
46
47
- $reverse_exclusion = ! defined( 'YWCTM_PREMIUM' ) ? '' : array (
48
- 'name' => __( '"Add to cart" button', 'ywctm' ),
49
- 'type' => 'checkbox',
50
- 'desc' => __( 'Reverse Exclusion List (Restrict Catalog Mode to selected items only)', 'ywctm' ),
51
- 'id' => 'ywctm_exclude_hide_add_to_cart_reverse',
52
- 'default' => 'no',
53
- 'checkboxgroup' => ''
54
);
55
56
- $product_variations = ! defined( 'YWCTM_PREMIUM' ) ? '' : array(
57
- 'name' => __( 'Variable products', 'ywctm' ),
58
- 'type' => 'checkbox',
59
- 'desc' => __( 'Hide product variations', 'ywctm' ),
60
- 'id' => 'ywctm_hide_variations',
61
- 'default' => 'no',
62
- 'checkboxgroup' => 'end'
63
);
64
65
return array(
66
'settings' => array(
67
- 'section_general_settings_videobox' => $videobox,
68
- 'catalog_mode_general_title' => array(
69
- 'name' => __( 'General Settings', 'ywctm' ),
70
- 'type' => 'title',
71
- 'desc' => '',
72
- 'id' => 'ywctm_general_title',
73
),
74
- 'catalog_mode_general_enable_plugin' => array(
75
- 'name' => __( 'Enable YITH Woocommerce Catalog Mode', 'ywctm' ),
76
- 'type' => 'checkbox',
77
- 'desc' => '',
78
- 'id' => 'ywctm_enable_plugin',
79
- 'default' => 'yes',
80
),
81
- 'catalog_mode_general_admin_view' => array(
82
- 'name' => __( 'Admin View', 'ywctm' ),
83
- 'type' => 'checkbox',
84
- 'desc' => __( 'Enable Catalog Mode also for administrators', 'ywctm'),
85
- 'id' => 'ywctm_admin_view',
86
- 'default' => 'yes',
87
),
88
- 'catalog_mode_general_end' => array(
89
- 'type' => 'sectionend',
90
- 'id' => 'ywctm_general_end'
91
),
92
- 'catalog_mode_section_title' => array(
93
- 'name' => __( 'Catalog Mode Settings', 'ywctm' ),
94
- 'type' => 'title',
95
- 'desc' => '',
96
- 'id' => 'ywctm_settings_title',
97
),
98
- 'catalog_mode_settings_disable_add_to_cart_single' => array(
99
- 'name' => __( '"Add to cart" button', 'ywctm' ),
100
- 'type' => 'checkbox',
101
- 'desc' => __( 'Hide in product details page', 'ywctm' ),
102
- 'id' => 'ywctm_hide_add_to_cart_single',
103
- 'default' => 'no',
104
- 'checkboxgroup' => 'start'
105
),
106
- 'catalog_mode_settings_disable_add_to_cart_loop' => array(
107
- 'name' => __( '"Add to cart" button', 'ywctm' ),
108
- 'type' => 'checkbox',
109
- 'desc' => __( 'Hide in other pages', 'ywctm' ),
110
- 'id' => 'ywctm_hide_add_to_cart_loop',
111
- 'default' => 'no',
112
- 'checkboxgroup' => ! defined( 'YWCTM_PREMIUM' ) ? 'end' : ''
113
),
114
- 'catalog_mode_settings_exclude_products' => $exclusion,
115
- 'catalog_mode_settings_exclude_products_reverse' => $reverse_exclusion,
116
- 'catalog_mode_settings_variable_products' => $product_variations,
117
- 'catalog_mode_settings_disable_cart_in_header' => array(
118
- 'name' => __( '"Cart" and "Checkout" pages', 'ywctm' ),
119
- 'type' => 'checkbox',
120
- 'desc' => __( 'Hide and disable all shop features', 'ywctm' ),
121
- 'id' => 'ywctm_hide_cart_header',
122
- 'default' => 'no',
123
),
124
- 'catalog_mode_section_end' => array(
125
- 'type' => 'sectionend',
126
- 'id' => 'ywctm_settings_end'
127
)
128
)
129
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
global $YITH_WC_Catalog_Mode;
16
17
$videobox = defined( 'YWCTM_PREMIUM' ) ? '' : array(
18
+ 'name' => __( 'Upgrade to the PREMIUM VERSION', 'ywctm' ),
19
+ 'type' => 'videobox',
20
+ 'default' => array(
21
'plugin_name' => __( 'YITH WooCommerce Catalog Mode', 'ywctm' ),
22
'title_first_column' => __( 'Discover the Advanced Features', 'ywctm' ),
23
'description_first_column' => __( 'Upgrade to the PREMIUM VERSION of YITH WooCommerce Catalog Mode to benefit from all features!', 'ywctm' ),
24
'video' => array(
25
'video_id' => '120697979',
26
+ 'video_image_url' => YWCTM_ASSETS_URL . '/images/yith-woocommerce-catalog-mode.jpg',
27
'video_description' => __( 'YITH WooCommerce Catalog Mode', 'ywctm' ),
28
),
29
'title_second_column' => __( 'Get Support and Pro Features', 'ywctm' ),
33
'title' => 'Get Support and Pro Features'
34
)
35
),
36
+ 'id' => 'ywctm_general_videobox'
37
);
38
39
+ $exclusion = !defined( 'YWCTM_PREMIUM' ) ? '' : array(
40
+ 'name' => __( '"Add to cart" button', 'ywctm' ),
41
+ 'type' => 'checkbox',
42
+ 'desc' => __( 'Exclude selected products (See "Exclusions" tab)', 'ywctm' ),
43
+ 'id' => 'ywctm_exclude_hide_add_to_cart',
44
+ 'default' => 'no',
45
+ 'checkboxgroup' => ''
46
);
47
48
+ $reverse_exclusion = !defined( 'YWCTM_PREMIUM' ) ? '' : array(
49
+ 'name' => __( '"Add to cart" button', 'ywctm' ),
50
+ 'type' => 'checkbox',
51
+ 'desc' => __( 'Reverse Exclusion List (Restrict Catalog Mode to selected items only)', 'ywctm' ),
52
+ 'id' => 'ywctm_exclude_hide_add_to_cart_reverse',
53
+ 'default' => 'no',
54
+ 'checkboxgroup' => ''
55
);
56
57
+ $product_variations = !defined( 'YWCTM_PREMIUM' ) ? '' : array(
58
+ 'name' => __( 'Variable products', 'ywctm' ),
59
+ 'type' => 'checkbox',
60
+ 'desc' => __( 'Hide product variations', 'ywctm' ),
61
+ 'id' => 'ywctm_hide_variations',
62
+ 'default' => 'no',
63
+ 'checkboxgroup' => 'end'
64
);
65
66
return array(
67
'settings' => array(
68
+ 'section_general_settings_videobox' => $videobox,
69
+
70
+ 'catalog_mode_general_title' => array(
71
+ 'name' => __( 'General Settings', 'ywctm' ),
72
+ 'type' => 'title',
73
+ 'desc' => '',
74
),
75
+ 'catalog_mode_general_enable_plugin' => array(
76
+ 'name' => __( 'Enable YITH Woocommerce Catalog Mode', 'ywctm' ),
77
+ 'type' => 'checkbox',
78
+ 'desc' => '',
79
+ 'id' => 'ywctm_enable_plugin',
80
+ 'default' => 'yes',
81
),
82
+ 'catalog_mode_general_admin_view' => array(
83
+ 'name' => __( 'Admin View', 'ywctm' ),
84
+ 'type' => 'checkbox',
85
+ 'desc' => __( 'Enable Catalog Mode also for administrators', 'ywctm' ),
86
+ 'id' => 'ywctm_admin_view',
87
+ 'default' => 'yes',
88
),
89
+ 'catalog_mode_general_end' => array(
90
+ 'type' => 'sectionend',
91
),
92
+
93
+ 'catalog_mode_section_title' => array(
94
+ 'name' => __( 'Catalog Mode Settings', 'ywctm' ),
95
+ 'type' => 'title',
96
+ 'desc' => '',
97
),
98
+ 'catalog_mode_settings_disable_add_to_cart_single' => array(
99
+ 'name' => __( '"Add to cart" button', 'ywctm' ),
100
+ 'type' => 'checkbox',
101
+ 'desc' => __( 'Hide in product details page', 'ywctm' ),
102
+ 'id' => 'ywctm_hide_add_to_cart_single',
103
+ 'default' => 'no',
104
+ 'checkboxgroup' => 'start'
105
),
106
+ 'catalog_mode_settings_disable_add_to_cart_loop' => array(
107
+ 'name' => __( '"Add to cart" button', 'ywctm' ),
108
+ 'type' => 'checkbox',
109
+ 'desc' => __( 'Hide in other pages', 'ywctm' ),
110
+ 'id' => 'ywctm_hide_add_to_cart_loop',
111
+ 'default' => 'no',
112
+ 'checkboxgroup' => !defined( 'YWCTM_PREMIUM' ) ? 'end' : ''
113
),
114
+ 'catalog_mode_settings_exclude_products' => $exclusion,
115
+ 'catalog_mode_settings_exclude_products_reverse' => $reverse_exclusion,
116
+ 'catalog_mode_settings_variable_products' => $product_variations,
117
+ 'catalog_mode_settings_disable_cart_in_header' => array(
118
+ 'name' => __( '"Cart" and "Checkout" pages', 'ywctm' ),
119
+ 'type' => 'checkbox',
120
+ 'desc' => __( 'Hide and disable all shop features', 'ywctm' ),
121
+ 'id' => 'ywctm_hide_cart_header',
122
+ 'default' => 'no',
123
),
124
+ 'catalog_mode_section_end' => array(
125
+ 'type' => 'sectionend',
126
)
127
)
128
readme.txt CHANGED
@@ -3,8 +3,8 @@
3
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.2.4
7
- Stable tag: 1.1.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -106,6 +106,11 @@ If you want to see a demonstration version of the premium plugin, you can see th
106
107
== Changelog ==
108
109
= 1.1.2 =
110
111
* Added: compatibility with YITH Essential Kit for WooCommerce #1
@@ -163,7 +168,7 @@ If you want to see a demonstration version of the premium plugin, you can see th
163
164
== Upgrade Notice ==
165
166
- Last Stable Tag 1.1.2
167
168
== Suggestions ==
169
3
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.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
106
107
== Changelog ==
108
109
+ = 1.1.3 =
110
+
111
+ * Various code improvements
112
+ * Updated language file
113
+
114
= 1.1.2 =
115
116
* Added: compatibility with YITH Essential Kit for WooCommerce #1
168
169
== Upgrade Notice ==
170
171
+ Last Stable Tag 1.1.3
172
173
== Suggestions ==
174