WooCommerce Customizer - Version 2.0.0

Version Description

  • Added Checkout "Create Account" checkbox default customization
  • Added Placeholder image source customization
  • Moved settings to WooCommerce > Settings > Customizer
  • WooCommerce 2.2 Compatibility
  • Localization - Text domain changed from wc-customizer to woocommerce-customizer
Download this release

Release Info

Developer maxrice
Plugin Icon WooCommerce Customizer
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.2.1 to 2.0.0

i18n/languages/woocommerce-customizer.pot ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 SkyVerge
2
+ # This file is distributed under the GNU General Public License v3.0.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WooCommerce Customizer 2.0.0\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://github.com/skyverge/woocommerce-customizer/issues\n"
8
+ "POT-Creation-Date: 2014-09-05 23:18:53+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: build/includes/class-wc-customizer-settings.php:45
17
+ #: includes/class-wc-customizer-settings.php:45
18
+ msgid "Customizer"
19
+ msgstr ""
20
+
21
+ #: build/includes/class-wc-customizer-settings.php:70
22
+ #: includes/class-wc-customizer-settings.php:70
23
+ msgid "Shop Loop"
24
+ msgstr ""
25
+
26
+ #: build/includes/class-wc-customizer-settings.php:71
27
+ #: includes/class-wc-customizer-settings.php:71
28
+ msgid "Product Page"
29
+ msgstr ""
30
+
31
+ #: build/includes/class-wc-customizer-settings.php:72
32
+ #: includes/class-wc-customizer-settings.php:72
33
+ msgid "Checkout"
34
+ msgstr ""
35
+
36
+ #: build/includes/class-wc-customizer-settings.php:73
37
+ #: build/includes/class-wc-customizer-settings.php:320
38
+ #: includes/class-wc-customizer-settings.php:73
39
+ #: includes/class-wc-customizer-settings.php:320
40
+ msgid "Misc"
41
+ msgstr ""
42
+
43
+ #: build/includes/class-wc-customizer-settings.php:155
44
+ #: build/includes/class-wc-customizer-settings.php:273
45
+ #: includes/class-wc-customizer-settings.php:155
46
+ #: includes/class-wc-customizer-settings.php:273
47
+ msgid "Add to Cart Button Text"
48
+ msgstr ""
49
+
50
+ #: build/includes/class-wc-customizer-settings.php:161
51
+ #: includes/class-wc-customizer-settings.php:161
52
+ msgid "Simple Product"
53
+ msgstr ""
54
+
55
+ #: build/includes/class-wc-customizer-settings.php:162
56
+ #: includes/class-wc-customizer-settings.php:162
57
+ msgid "Changes the add to cart button text for simple products on all loop pages"
58
+ msgstr ""
59
+
60
+ #: build/includes/class-wc-customizer-settings.php:168
61
+ #: includes/class-wc-customizer-settings.php:168
62
+ msgid "Variable Product"
63
+ msgstr ""
64
+
65
+ #: build/includes/class-wc-customizer-settings.php:169
66
+ #: includes/class-wc-customizer-settings.php:169
67
+ msgid "Changes the add to cart button text for variable products on all loop pages"
68
+ msgstr ""
69
+
70
+ #: build/includes/class-wc-customizer-settings.php:175
71
+ #: includes/class-wc-customizer-settings.php:175
72
+ msgid "Grouped Product"
73
+ msgstr ""
74
+
75
+ #: build/includes/class-wc-customizer-settings.php:176
76
+ #: includes/class-wc-customizer-settings.php:176
77
+ msgid "Changes the add to cart button text for grouped products on all loop pages"
78
+ msgstr ""
79
+
80
+ #: build/includes/class-wc-customizer-settings.php:182
81
+ #: includes/class-wc-customizer-settings.php:182
82
+ msgid "External Product"
83
+ msgstr ""
84
+
85
+ #: build/includes/class-wc-customizer-settings.php:183
86
+ #: includes/class-wc-customizer-settings.php:183
87
+ msgid "Changes the add to cart button text for external products on all loop pages"
88
+ msgstr ""
89
+
90
+ #: build/includes/class-wc-customizer-settings.php:189
91
+ #: includes/class-wc-customizer-settings.php:189
92
+ msgid "Out of Stock Product"
93
+ msgstr ""
94
+
95
+ #: build/includes/class-wc-customizer-settings.php:190
96
+ #: includes/class-wc-customizer-settings.php:190
97
+ msgid ""
98
+ "Changes the add to cart button text for out of stock products on all loop "
99
+ "pages"
100
+ msgstr ""
101
+
102
+ #: build/includes/class-wc-customizer-settings.php:197
103
+ #: includes/class-wc-customizer-settings.php:197
104
+ msgid "Layout"
105
+ msgstr ""
106
+
107
+ #: build/includes/class-wc-customizer-settings.php:203
108
+ #: includes/class-wc-customizer-settings.php:203
109
+ msgid "Products displayed per page"
110
+ msgstr ""
111
+
112
+ #: build/includes/class-wc-customizer-settings.php:204
113
+ #: includes/class-wc-customizer-settings.php:204
114
+ msgid "Changes the number of products displayed per page"
115
+ msgstr ""
116
+
117
+ #: build/includes/class-wc-customizer-settings.php:210
118
+ #: includes/class-wc-customizer-settings.php:210
119
+ msgid "Product columns displayed per page"
120
+ msgstr ""
121
+
122
+ #: build/includes/class-wc-customizer-settings.php:211
123
+ #: includes/class-wc-customizer-settings.php:211
124
+ msgid "Changes the number of columns displayed per page"
125
+ msgstr ""
126
+
127
+ #: build/includes/class-wc-customizer-settings.php:217
128
+ #: includes/class-wc-customizer-settings.php:217
129
+ msgid "Product thumbnail columns displayed"
130
+ msgstr ""
131
+
132
+ #: build/includes/class-wc-customizer-settings.php:218
133
+ #: includes/class-wc-customizer-settings.php:218
134
+ msgid "Changes the number of product thumbnail columns displayed"
135
+ msgstr ""
136
+
137
+ #: build/includes/class-wc-customizer-settings.php:231
138
+ #: includes/class-wc-customizer-settings.php:231
139
+ msgid "Tab Titles"
140
+ msgstr ""
141
+
142
+ #: build/includes/class-wc-customizer-settings.php:237
143
+ #: build/includes/class-wc-customizer-settings.php:258
144
+ #: includes/class-wc-customizer-settings.php:237
145
+ #: includes/class-wc-customizer-settings.php:258
146
+ msgid "Product Description"
147
+ msgstr ""
148
+
149
+ #: build/includes/class-wc-customizer-settings.php:238
150
+ #: includes/class-wc-customizer-settings.php:238
151
+ msgid "Changes the Production Description tab title"
152
+ msgstr ""
153
+
154
+ #: build/includes/class-wc-customizer-settings.php:244
155
+ #: build/includes/class-wc-customizer-settings.php:265
156
+ #: includes/class-wc-customizer-settings.php:244
157
+ #: includes/class-wc-customizer-settings.php:265
158
+ msgid "Additional Information"
159
+ msgstr ""
160
+
161
+ #: build/includes/class-wc-customizer-settings.php:245
162
+ #: includes/class-wc-customizer-settings.php:245
163
+ msgid "Changes the Additional Information tab title"
164
+ msgstr ""
165
+
166
+ #: build/includes/class-wc-customizer-settings.php:252
167
+ #: includes/class-wc-customizer-settings.php:252
168
+ msgid "Tab Content Headings"
169
+ msgstr ""
170
+
171
+ #: build/includes/class-wc-customizer-settings.php:259
172
+ #: includes/class-wc-customizer-settings.php:259
173
+ msgid "Changes the Product Description tab heading"
174
+ msgstr ""
175
+
176
+ #: build/includes/class-wc-customizer-settings.php:266
177
+ #: includes/class-wc-customizer-settings.php:266
178
+ msgid "Changes the Additional Information tab heading"
179
+ msgstr ""
180
+
181
+ #: build/includes/class-wc-customizer-settings.php:279
182
+ #: includes/class-wc-customizer-settings.php:279
183
+ msgid "All Product Types"
184
+ msgstr ""
185
+
186
+ #: build/includes/class-wc-customizer-settings.php:280
187
+ #: includes/class-wc-customizer-settings.php:280
188
+ msgid ""
189
+ "Changes the Add to Cart button text on the single product page for all "
190
+ "product type"
191
+ msgstr ""
192
+
193
+ #: build/includes/class-wc-customizer-settings.php:292
194
+ #: includes/class-wc-customizer-settings.php:292
195
+ msgid "Messages"
196
+ msgstr ""
197
+
198
+ #: build/includes/class-wc-customizer-settings.php:298
199
+ #: includes/class-wc-customizer-settings.php:298
200
+ msgid "Must be logged in text"
201
+ msgstr ""
202
+
203
+ #: build/includes/class-wc-customizer-settings.php:299
204
+ #: includes/class-wc-customizer-settings.php:299
205
+ msgid "Changes the message displayed when a customer must be logged in to checkout"
206
+ msgstr ""
207
+
208
+ #: build/includes/class-wc-customizer-settings.php:305
209
+ #: includes/class-wc-customizer-settings.php:305
210
+ msgid "Coupon text"
211
+ msgstr ""
212
+
213
+ #: build/includes/class-wc-customizer-settings.php:306
214
+ #: includes/class-wc-customizer-settings.php:306
215
+ msgid "Changes the message displayed if the coupon form is enabled on checkout"
216
+ msgstr ""
217
+
218
+ #: build/includes/class-wc-customizer-settings.php:312
219
+ #: includes/class-wc-customizer-settings.php:312
220
+ msgid "Login text"
221
+ msgstr ""
222
+
223
+ #: build/includes/class-wc-customizer-settings.php:313
224
+ #: includes/class-wc-customizer-settings.php:313
225
+ msgid "Changes the message displayed if customers can login at checkout"
226
+ msgstr ""
227
+
228
+ #: build/includes/class-wc-customizer-settings.php:326
229
+ #: includes/class-wc-customizer-settings.php:326
230
+ msgid "Create Account checkbox default"
231
+ msgstr ""
232
+
233
+ #: build/includes/class-wc-customizer-settings.php:327
234
+ #: includes/class-wc-customizer-settings.php:327
235
+ msgid "Control the default state for the Create Account checkbox"
236
+ msgstr ""
237
+
238
+ #: build/includes/class-wc-customizer-settings.php:330
239
+ #: includes/class-wc-customizer-settings.php:330
240
+ msgid "Checked"
241
+ msgstr ""
242
+
243
+ #: build/includes/class-wc-customizer-settings.php:331
244
+ #: includes/class-wc-customizer-settings.php:331
245
+ msgid "Unchecked"
246
+ msgstr ""
247
+
248
+ #: build/includes/class-wc-customizer-settings.php:338
249
+ #: includes/class-wc-customizer-settings.php:338
250
+ msgid "Submit Order button"
251
+ msgstr ""
252
+
253
+ #: build/includes/class-wc-customizer-settings.php:339
254
+ #: includes/class-wc-customizer-settings.php:339
255
+ msgid "Changes the Place Order button text on checkout"
256
+ msgstr ""
257
+
258
+ #: build/includes/class-wc-customizer-settings.php:352
259
+ #: includes/class-wc-customizer-settings.php:352
260
+ msgid "Tax"
261
+ msgstr ""
262
+
263
+ #: build/includes/class-wc-customizer-settings.php:358
264
+ #: includes/class-wc-customizer-settings.php:358
265
+ msgid "Tax Label"
266
+ msgstr ""
267
+
268
+ #: build/includes/class-wc-customizer-settings.php:359
269
+ #: includes/class-wc-customizer-settings.php:359
270
+ msgid "Changes the Taxes label. Defaults to Tax for USA, VAT for European countries"
271
+ msgstr ""
272
+
273
+ #: build/includes/class-wc-customizer-settings.php:365
274
+ #: includes/class-wc-customizer-settings.php:365
275
+ msgid "Including Tax Label"
276
+ msgstr ""
277
+
278
+ #: build/includes/class-wc-customizer-settings.php:366
279
+ #: includes/class-wc-customizer-settings.php:366
280
+ msgid ""
281
+ "Changes the Including Taxes label. Defaults to Inc. tax for USA, Inc. VAT "
282
+ "for European countries"
283
+ msgstr ""
284
+
285
+ #: build/includes/class-wc-customizer-settings.php:372
286
+ #: includes/class-wc-customizer-settings.php:372
287
+ msgid "Excluding Tax Label"
288
+ msgstr ""
289
+
290
+ #: build/includes/class-wc-customizer-settings.php:373
291
+ #: includes/class-wc-customizer-settings.php:373
292
+ msgid ""
293
+ "Changes the Excluding Taxes label. Defaults to Exc. tax for USA, Exc. VAT "
294
+ "for European countries"
295
+ msgstr ""
296
+
297
+ #: build/includes/class-wc-customizer-settings.php:380
298
+ #: includes/class-wc-customizer-settings.php:380
299
+ msgid "Images"
300
+ msgstr ""
301
+
302
+ #: build/includes/class-wc-customizer-settings.php:386
303
+ #: includes/class-wc-customizer-settings.php:386
304
+ msgid "Placeholder Image source"
305
+ msgstr ""
306
+
307
+ #: build/includes/class-wc-customizer-settings.php:387
308
+ #: includes/class-wc-customizer-settings.php:387
309
+ msgid "Change the default placeholder image by setting this to a valid image URL"
310
+ msgstr ""
311
+
312
+ #: build/woocommerce-customizer.php:36 woocommerce-customizer.php:36
313
+ msgid ""
314
+ "%sWooCommerce Customizer is inactive.%s This version requires WooCommerce "
315
+ "2.1 or newer. Please %supdate WooCommerce to version 2.1 or newer%s"
316
+ msgstr ""
317
+
318
+ #: build/woocommerce-customizer.php:281 woocommerce-customizer.php:281
319
+ msgid "Configure"
320
+ msgstr ""
321
+
322
+ #: build/woocommerce-customizer.php:282 woocommerce-customizer.php:282
323
+ msgid "FAQ"
324
+ msgstr ""
325
+
326
+ #: build/woocommerce-customizer.php:283 woocommerce-customizer.php:283
327
+ msgid "Support"
328
+ msgstr ""
329
+
330
+ #. Plugin Name of the plugin/theme
331
+ msgid "WooCommerce Customizer"
332
+ msgstr ""
333
+
334
+ #. Plugin URI of the plugin/theme
335
+ msgid "http://www.skyverge.com/product/woocommerce-customizer/"
336
+ msgstr ""
337
+
338
+ #. Description of the plugin/theme
339
+ msgid ""
340
+ "Customize WooCommerce without code! Easily change add to cart button text "
341
+ "and more."
342
+ msgstr ""
343
+
344
+ #. Author of the plugin/theme
345
+ msgid "SkyVerge"
346
+ msgstr ""
347
+
348
+ #. Author URI of the plugin/theme
349
+ msgid "http://www.skyverge.com"
350
+ msgstr ""
includes/class-wc-customizer-admin.php DELETED
@@ -1,473 +0,0 @@
1
- <?php
2
- /**
3
- * WooCommerce Customizer
4
- *
5
- * This source file is subject to the GNU General Public License v3.0
6
- * that is bundled with this package in the file license.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.html
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@skyverge.com so we can send you a copy immediately.
12
- *
13
- * DISCLAIMER
14
- *
15
- * Do not edit or add to this file if you wish to upgrade WooCommerce Customizer to newer
16
- * versions in the future. If you wish to customize WooCommerce Customizer for your
17
- * needs please refer to http://www.skyverge.com/product/woocommerce-customizer/ for more information.
18
- *
19
- * @package WC-Customizer/Classes
20
- * @author SkyVerge
21
- * @copyright Copyright (c) 2013, SkyVerge, Inc.
22
- * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
23
- */
24
-
25
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
26
-
27
- /**
28
- * Admin class
29
- *
30
- * Adds UX for adding/modifying customizations
31
- *
32
- * @since 1.0
33
- */
34
- class WC_Customizer_Admin {
35
-
36
-
37
- /** @var array tab IDs / titles admin page */
38
- public $tabs;
39
-
40
- /** @var string sub-menu page hook suffix */
41
- public $page;
42
-
43
-
44
- /**
45
- * Setup admin class
46
- *
47
- * @since 1.0
48
- * @return \WC_Customizer_Admin
49
- */
50
- public function __construct() {
51
-
52
- $this->tabs = array(
53
- 'shop_loop' => __( 'Shop Loop', 'wc-customizer' ),
54
- 'product_page' => __( 'Product Page', 'wc-customizer' ),
55
- 'checkout' => __( 'Checkout', 'wc-customizer' ),
56
- 'misc' => __( 'Misc', 'wc-customizer' )
57
- );
58
-
59
- // Add settings page screen ID to list of pages for WC CSS/JS to load on
60
- add_filter( 'woocommerce_screen_ids', array( $this, 'load_woocommerce_styles_scripts' ) );
61
-
62
- // Add 'Customizer' link under WooCommerce menu
63
- add_action( 'admin_menu', array( $this, 'add_menu_link' ) );
64
-
65
- // save settings
66
- add_action( 'admin_init', array( $this, 'save_settings' ) );
67
- }
68
-
69
-
70
- /**
71
- * Add Customizer settings screen ID to the list of pages for WC to load CSS/JS on
72
- *
73
- * @since 1.0
74
- * @param array $screen_ids
75
- * @return array
76
- */
77
- public function load_woocommerce_styles_scripts( $screen_ids ) {
78
-
79
- $screen_ids[] = 'woocommerce_page_wc_customizer';
80
-
81
- return $screen_ids;
82
- }
83
-
84
-
85
- /**
86
- * Add 'Customizer' menu link under 'WooCommerce' top level menu
87
- *
88
- * @since 1.0
89
- */
90
- public function add_menu_link() {
91
-
92
- $this->page = add_submenu_page(
93
- 'woocommerce',
94
- __( 'WooCommerce Customizer', 'wc-customizer' ),
95
- __( 'Customizer', 'wc-customizer' ),
96
- 'manage_woocommerce',
97
- 'wc_customizer',
98
- array( $this, 'render_settings_page' )
99
- );
100
- }
101
-
102
-
103
- /**
104
- * Show Customizer settings page content for all tabs.
105
- *
106
- * @since 1.1
107
- */
108
- public function render_settings_page() {
109
-
110
- $current_tab = ( empty( $_GET['tab'] ) ) ? 'shop_loop' : urldecode( $_GET['tab'] );
111
-
112
- ?>
113
- <div class="wrap woocommerce">
114
- <form method="post" id="mainform" action="" enctype="multipart/form-data">
115
- <div id="icon-woocommerce" class="icon32-woocommerce-settings icon32"><br /></div>
116
- <h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
117
-
118
- <?php
119
-
120
- // display tabs
121
- foreach ( $this->tabs as $tab_id => $tab_title ) {
122
-
123
- $class = ( $tab_id === $current_tab ) ? 'nav-tab nav-tab-active' : 'nav-tab';
124
- $url = add_query_arg( 'tab', $tab_id, admin_url( 'admin.php?page=wc_customizer' ) );
125
-
126
- printf( '<a href="%s" class="%s">%s</a>', $url, $class, $tab_title );
127
- }
128
-
129
- ?> </h2> <?php
130
-
131
- // display success message
132
- if ( ! empty( $_GET['saved'] ) )
133
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Your customizations have been saved.', 'wc-customizer' ) . '</strong></p></div>';
134
-
135
- // display filters
136
- $this->render_settings( $this->get_settings( $current_tab ) );
137
-
138
- ?><input type="hidden" name="wc_customizer_settings" value="1" /><?php
139
-
140
- submit_button( __( 'Save Customizations', 'wc-customizer' ) );
141
-
142
- wp_nonce_field( 'wc-customizer-settings', '_wpnonce', true, true );
143
-
144
- ?></form></div> <?php
145
- }
146
-
147
-
148
- /**
149
- * Show customization fields for a given tab
150
- *
151
- * @see adapted from woocommerce_admin_fields()
152
- *
153
- * @since 1.1
154
- * @param array $fields the customization fields to show
155
- */
156
- private function render_settings( $fields ) {
157
-
158
- $customizations = get_option( 'wc_customizer_active_customizations' );
159
-
160
- foreach ( $fields as $field ) {
161
-
162
- switch ( $field['type'] ) {
163
-
164
- case 'title':
165
- echo '<h3>' . esc_html( $field['title'] ) . '</h3>';
166
- echo '<table class="form-table">';
167
- break;
168
-
169
- case 'sectionend':
170
- echo '</table>';
171
- break;
172
-
173
- case 'text':;
174
- $value = ( isset( $customizations[ $field['id'] ] ) ) ? $customizations[ $field['id'] ] : '';
175
- ?>
176
- <tr valign="top">
177
- <th scope="row" class="titledesc">
178
- <label for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['title'] ); ?></label>
179
- <img class="help_tip" data-tip="<?php echo esc_attr( $field['desc_tip'] ); ?>" src="<?php echo esc_url( $GLOBALS['woocommerce']->plugin_url() . '/assets/images/help.png' ); ?>" height="16" width="16" />
180
- </th>
181
- <td class="forminp forminp-text">
182
- <input name="<?php echo esc_attr( $field['id'] ); ?>" id="<?php echo esc_attr( $field['id'] ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" />
183
- </td>
184
- </tr>
185
- <?php
186
- break;
187
- }
188
- }
189
- }
190
-
191
-
192
- /**
193
- * Save customizations for a given tab
194
- *
195
- * @since 1.1
196
- */
197
- public function save_settings( $fields ) {
198
-
199
- // save settings
200
- if ( ! isset( $_POST['wc_customizer_settings'] ) ) {
201
- return;
202
- }
203
-
204
- // permissions check
205
- if ( ! current_user_can( 'manage_woocommerce' ) ) {
206
- return;
207
- }
208
-
209
- // security check
210
- if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'wc-customizer-settings' ) )
211
- wp_die( __( 'Action failed. Please refresh the page and retry.', 'wc-customizer' ) );
212
-
213
- $customizations = get_option( 'wc_customizer_active_customizations' );
214
-
215
- $current_tab = ( empty( $_GET['tab'] ) ) ? 'shop_loop' : urldecode( $_GET['tab'] );
216
-
217
- foreach ( $this->get_settings( $current_tab ) as $field ) {
218
-
219
- if ( ! isset( $field['id'] ) )
220
- continue;
221
-
222
- if ( ! empty( $_POST[ $field['id'] ] ) )
223
- $customizations[ $field['id'] ] = wp_kses_post( $_POST[ $field['id'] ] );
224
-
225
- elseif ( isset( $customizations[ $field['id'] ] ) )
226
- unset( $customizations[ $field['id'] ] );
227
- }
228
-
229
- update_option( 'wc_customizer_active_customizations', $customizations );
230
-
231
- wp_redirect( add_query_arg( array( 'saved' => 'true' ) ) );
232
-
233
- exit;
234
- }
235
-
236
-
237
- /**
238
- * Return admin fields in proper format for outputting / saving
239
- *
240
- * @since 1.1
241
- * @param string $tab_id the tab to get settings for
242
- * @return array
243
- */
244
- private function get_settings( $tab_id ) {
245
-
246
- $settings = array(
247
-
248
- 'shop_loop' =>
249
-
250
- array(
251
-
252
- array(
253
- 'title' => __( 'Add to Cart Button Text', 'wc-customizer' ),
254
- 'type' => 'title'
255
- ),
256
-
257
- array(
258
- 'id' => 'add_to_cart_text',
259
- 'title' => __( 'Simple Product', 'wc-customizer' ),
260
- 'desc_tip' => __( 'Changes the add to cart button text for simple products on all loop pages', 'wc-customizer' ),
261
- 'type' => 'text'
262
- ),
263
-
264
- array(
265
- 'id' => 'variable_add_to_cart_text',
266
- 'title' => __( 'Variable Product', 'wc-customizer' ),
267
- 'desc_tip' => __( 'Changes the add to cart button text for variable products on all loop pages', 'wc-customizer' ),
268
- 'type' => 'text'
269
- ),
270
-
271
- array(
272
- 'id' => 'grouped_add_to_cart_text',
273
- 'title' => __( 'Grouped Product', 'wc-customizer' ),
274
- 'desc_tip' => __( 'Changes the add to cart button text for grouped products on all loop pages', 'wc-customizer' ),
275
- 'type' => 'text'
276
- ),
277
-
278
- array(
279
- 'id' => 'external_add_to_cart_text',
280
- 'title' => __( 'External Product', 'wc-customizer' ),
281
- 'desc_tip' => __( 'Changes the add to cart button text for external products on all loop pages', 'wc-customizer' ),
282
- 'type' => 'text'
283
- ),
284
-
285
- array(
286
- 'id' => 'out_of_stock_add_to_cart_text',
287
- 'title' => __( 'Out of Stock Product', 'wc-customizer' ),
288
- 'desc_tip' => __( 'Changes the add to cart button text for out of stock products on all loop pages', 'wc-customizer' ),
289
- 'type' => 'text'
290
- ),
291
-
292
- array( 'type' => 'sectionend' ),
293
-
294
- array(
295
- 'title' => __( 'Layout', 'wc-customizer' ),
296
- 'type' => 'title'
297
- ),
298
-
299
- array(
300
- 'id' => 'loop_shop_per_page',
301
- 'title' => __( 'Products displayed per page', 'wc-customizer' ),
302
- 'desc_tip' => __( 'Changes the number of products displayed per page', 'wc-customizer' ),
303
- 'type' => 'text'
304
- ),
305
-
306
- array(
307
- 'id' => 'loop_shop_columns',
308
- 'title' => __( 'Product columns displayed per page', 'wc-customizer' ),
309
- 'desc_tip' => __( 'Changes the number of columns displayed per page', 'wc-customizer' ),
310
- 'type' => 'text'
311
- ),
312
-
313
- array(
314
- 'id' => 'woocommerce_product_thumbnails_columns',
315
- 'title' => __( 'Product thumbnail columns displayed', 'wc-customizer' ),
316
- 'desc_tip' => __( 'Changes the number of product thumbnail columns displayed', 'wc-customizer' ),
317
- 'type' => 'text'
318
- ),
319
-
320
- array( 'type' => 'sectionend' )
321
-
322
- ),
323
-
324
- 'product_page' =>
325
-
326
- array(
327
-
328
- array(
329
- 'title' => __( 'Tab Titles', 'wc-customizer' ),
330
- 'type' => 'title'
331
- ),
332
-
333
- array(
334
- 'id' => 'woocommerce_product_description_tab_title',
335
- 'title' => __( 'Product Description', 'wc-customizer' ),
336
- 'desc_tip' => __( 'Changes the Production Description tab title', 'wc-customizer' ),
337
- 'type' => 'text'
338
- ),
339
-
340
- array(
341
- 'id' => 'woocommerce_product_additional_information_tab_title',
342
- 'title' => __( 'Additional Information', 'wc-customizer' ),
343
- 'desc_tip' => __( 'Changes the Additional Information tab title', 'wc-customizer' ),
344
- 'type' => 'text'
345
- ),
346
-
347
- array( 'type' => 'sectionend' ),
348
-
349
- array(
350
- 'title' => __( 'Tab Content Headings', 'wc-customizer' ),
351
- 'type' => 'title'
352
- ),
353
-
354
- array(
355
- 'id' => 'woocommerce_product_description_heading',
356
- 'title' => __( 'Product Description', 'wc-customizer' ),
357
- 'desc_tip' => __( 'Changes the Product Description tab heading', 'wc-customizer' ),
358
- 'type' => 'text'
359
- ),
360
-
361
- array(
362
- 'id' => 'woocommerce_product_additional_information_heading',
363
- 'title' => __( 'Additional Information', 'wc-customizer' ),
364
- 'desc_tip' => __( 'Changes the Additional Information tab heading', 'wc-customizer' ),
365
- 'type' => 'text'
366
- ),
367
-
368
- array( 'type' => 'sectionend' ),
369
-
370
- array(
371
- 'title' => __( 'Add to Cart Button Text', 'wc-customizer' ),
372
- 'type' => 'title'
373
- ),
374
-
375
- array(
376
- 'id' => 'single_add_to_cart_text',
377
- 'title' => __( 'All Product Types', 'wc-customizer' ),
378
- 'desc_tip' => __( 'Changes the Add to Cart button text on the single product page for all product type', 'wc-customizer' ),
379
- 'type' => 'text'
380
- ),
381
-
382
- array( 'type' => 'sectionend' )
383
- ),
384
-
385
- 'checkout' =>
386
-
387
- array(
388
-
389
- array(
390
- 'title' => __( 'Messages', 'wc-customizer' ),
391
- 'type' => 'title'
392
- ),
393
-
394
- array(
395
- 'id' => 'woocommerce_checkout_must_be_logged_in_message',
396
- 'title' => __( 'Must be logged in text', 'wc-customizer' ),
397
- 'desc_tip' => __( 'Changes the message displayed when a customer must be logged in to checkout', 'wc-customizer' ),
398
- 'type' => 'text'
399
- ),
400
-
401
- array(
402
- 'id' => 'woocommerce_checkout_coupon_message',
403
- 'title' => __( 'Coupon text', 'wc-customizer' ),
404
- 'desc_tip' => __( 'Changes the message displayed if the coupon form is enabled on checkout', 'wc-customizer' ),
405
- 'type' => 'text'
406
- ),
407
-
408
- array(
409
- 'id' => 'woocommerce_checkout_login_message',
410
- 'title' => __( 'Login text', 'wc-customizer' ),
411
- 'desc_tip' => __( 'Changes the message displayed if customers can login at checkout', 'wc-customizer' ),
412
- 'type' => 'text'
413
- ),
414
-
415
- array( 'type' => 'sectionend' ),
416
-
417
- array(
418
- 'title' => __( 'Button Text', 'wc-customizer' ),
419
- 'type' => 'title'
420
- ),
421
-
422
- array(
423
- 'id' => 'woocommerce_order_button_text',
424
- 'title' => __( 'Submit Order button', 'wc-customizer' ),
425
- 'desc_tip' => __( 'Changes the Place Order button text on checkout', 'wc-customizer' ),
426
- 'type' => 'text'
427
- ),
428
-
429
- array( 'type' => 'sectionend' )
430
-
431
- ),
432
-
433
- 'misc' =>
434
-
435
- array(
436
-
437
- array(
438
- 'title' => __( 'Tax', 'wc-customizer' ),
439
- 'type' => 'title'
440
- ),
441
-
442
- array(
443
- 'id' => 'woocommerce_countries_tax_or_vat',
444
- 'title' => __( 'Tax Label', 'wc-customizer' ),
445
- 'desc_tip' => __( 'Changes the Taxes label. Defaults to Tax for USA, VAT for European countries', 'wc-customizer' ),
446
- 'type' => 'text'
447
- ),
448
-
449
- array(
450
- 'id' => 'woocommerce_countries_inc_tax_or_vat',
451
- 'title' => __( 'Including Tax Label', 'wc-customizer' ),
452
- 'desc_tip' => __( 'Changes the Including Taxes label. Defaults to Inc. tax for USA, Inc. VAT for European countries', 'wc-customizer' ),
453
- 'type' => 'text'
454
- ),
455
-
456
- array(
457
- 'id' => 'woocommerce_countries_ex_tax_or_vat',
458
- 'title' => __( 'Excluding Tax Label', 'wc-customizer' ),
459
- 'desc_tip' => __( 'Changes the Excluding Taxes label. Defaults to Exc. tax for USA, Exc. VAT for European countries', 'wc-customizer' ),
460
- 'type' => 'text'
461
- ),
462
-
463
- array( 'type' => 'sectionend' )
464
-
465
- ),
466
-
467
- );
468
-
469
- return ( isset( $settings[ $tab_id ] ) ) ? $settings[ $tab_id ] : array();
470
- }
471
-
472
-
473
- } // end \WC_Customizer_Admin class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-wc-customizer-compatibility.php DELETED
@@ -1,805 +0,0 @@
1
- <?php
2
- /**
3
- * WooCommerce Plugin Compatibility
4
- *
5
- * This source file is subject to the GNU General Public License v3.0
6
- * that is bundled with this package in the file license.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.html
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@skyverge.com so we can send you a copy immediately.
12
- *
13
- * DISCLAIMER
14
- *
15
- * Do not edit or add to this file if you wish to upgrade the plugin to newer
16
- * versions in the future. If you wish to customize the plugin for your
17
- * needs please refer to http://www.skyverge.com
18
- *
19
- * @author SkyVerge
20
- * @copyright Copyright (c) 2013, SkyVerge, Inc.
21
- * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
22
- */
23
-
24
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25
-
26
- if ( ! class_exists( 'WC_Customizer_Compatibility' ) ) :
27
-
28
- /**
29
- * WooCommerce Compatibility Utility Class
30
- *
31
- * The unfortunate purpose of this class is to provide a single point of
32
- * compatibility functions for dealing with supporting multiple versions
33
- * of WooCommerce.
34
- *
35
- * The recommended procedure is to rename this file/class, replacing "my plugin"
36
- * with the particular plugin name, so as to avoid clashes between plugins.
37
- * Over time we expect to remove methods from this class, using the current
38
- * ones directly, as support for older versions of WooCommerce is dropped.
39
- *
40
- * Current Compatibility: 2.0.x - 2.1
41
- *
42
- * @version 1.1
43
- */
44
- class WC_Customizer_Compatibility {
45
-
46
-
47
- /**
48
- * Compatibility function for outputting a woocommerce attribute label
49
- *
50
- * @since 1.0
51
- * @param string $label the label to display
52
- * @return string the label to display
53
- */
54
- public static function wc_attribute_label( $label ) {
55
-
56
- if ( self::is_wc_version_gte_2_1() ) {
57
- return wc_attribute_label( $label );
58
- } else {
59
- global $woocommerce;
60
- return $woocommerce->attribute_label( $label );
61
- }
62
- }
63
-
64
-
65
- /**
66
- * Compatibility function to add and store a notice
67
- *
68
- * @since 1.0
69
- * @param string $message The text to display in the notice.
70
- * @param string $notice_type The singular name of the notice type - either error, success or notice. [optional]
71
- */
72
- public static function wc_add_notice( $message, $notice_type = 'success' ) {
73
-
74
- if ( self::is_wc_version_gte_2_1() ) {
75
- wc_add_notice( $message, $notice_type );
76
- } else {
77
- global $woocommerce;
78
-
79
- if ( 'error' == $notice_type ) {
80
- $woocommerce->add_error( $message );
81
- } else {
82
- $woocommerce->add_message( $message );
83
- }
84
- }
85
- }
86
-
87
-
88
- /**
89
- * Prints messages and errors which are stored in the session, then clears them.
90
- *
91
- * @since 1.0
92
- */
93
- public static function wc_print_notices() {
94
-
95
- if ( self::is_wc_version_gte_2_1() ) {
96
- wc_print_notices();
97
- } else {
98
- global $woocommerce;
99
- $woocommerce->show_messages();
100
- }
101
- }
102
-
103
-
104
- /**
105
- * Compatibility function to queue some JavaScript code to be output in the footer.
106
- *
107
- * @since 1.0
108
- * @param string $code javascript
109
- */
110
- public static function wc_enqueue_js( $code ) {
111
-
112
- if ( self::is_wc_version_gte_2_1() ) {
113
- wc_enqueue_js( $code );
114
- } else {
115
- global $woocommerce;
116
- $woocommerce->add_inline_js( $code );
117
- }
118
- }
119
-
120
-
121
- /**
122
- * Forces the provided $content url to https protocol
123
- *
124
- * @since 1.0
125
- * @param string $content the url
126
- * @return string the url with https protocol
127
- */
128
- public static function force_https_url( $content ) {
129
-
130
- if ( self::is_wc_version_gte_2_1() ) {
131
- return WC_HTTPS::force_https_url( $content );
132
- } else {
133
- global $woocommerce;
134
- return $woocommerce->force_ssl( $content );
135
- }
136
- }
137
-
138
-
139
- /**
140
- * Returns true if on the pay page, false otherwise
141
- *
142
- * @since 1.0
143
- * @return boolean true if on the pay page, false otherwise
144
- */
145
- public static function is_checkout_pay_page() {
146
-
147
- if ( self::is_wc_version_gte_2_1() ) {
148
- return is_checkout_pay_page();
149
- } else {
150
- return is_page( woocommerce_get_page_id( 'pay' ) );
151
- }
152
- }
153
-
154
-
155
- /**
156
- * Returns the order_id if on the checkout pay page
157
- *
158
- * @since 1.0
159
- * @return int order identifier
160
- */
161
- public static function get_checkout_pay_page_order_id() {
162
-
163
- if ( self::is_wc_version_gte_2_1() ) {
164
- global $wp;
165
- return isset( $wp->query_vars['order-pay'] ) ? absint( $wp->query_vars['order-pay'] ) : 0;
166
- } else {
167
- return isset( $_GET['order'] ) ? absint( $_GET['order'] ) : 0;
168
- }
169
- }
170
-
171
-
172
- /**
173
- * Returns the total shipping cost for the given order
174
- *
175
- * @since 1.0
176
- * @param WC_Order $order
177
- * @return float the shipping total
178
- */
179
- public static function get_total_shipping( $order ) {
180
-
181
- if ( self::is_wc_version_gte_2_1() ) {
182
- return $order->get_total_shipping();
183
- } else {
184
- return $order->get_shipping();
185
- }
186
- }
187
-
188
-
189
- /**
190
- * Returns the value of the custom field named $name, if any. $name should
191
- * not have a leading underscore
192
- *
193
- * @since 1.0
194
- * @param WC_Order $order WC Order object
195
- * @param string $name meta key name without a leading underscore
196
- * @return string|mixed order custom field value for field named $name
197
- */
198
- public static function get_order_custom_field( $order, $name ) {
199
-
200
- if ( self::is_wc_version_gte_2_1() ) {
201
- return isset( $order->$name ) ? $order->$name : '';
202
- } else {
203
- return isset( $order->order_custom_fields[ '_' . $name ][0] ) ? $order->order_custom_fields[ '_' . $name ][0] : '';
204
- }
205
- }
206
-
207
-
208
- /**
209
- * Sets WooCommerce messages
210
- *
211
- * @since 1.0
212
- */
213
- public static function set_messages() {
214
-
215
- if ( self::is_wc_version_gte_2_1() ) {
216
- // no-op in WC 2.1+
217
- } else {
218
- global $woocommerce;
219
- $woocommerce->set_messages();
220
- }
221
- }
222
-
223
-
224
- /**
225
- * Returns a new instance of the woocommerce logger
226
- *
227
- * @since 1.0
228
- * @return object logger
229
- */
230
- public static function new_wc_logger() {
231
-
232
- if ( self::is_wc_version_gte_2_1() ) {
233
- return new WC_Logger();
234
- } else {
235
- global $woocommerce;
236
- return $woocommerce->logger();
237
- }
238
- }
239
-
240
-
241
- /**
242
- * Returns the admin configuration url for the gateway with class name
243
- * $gateway_class_name
244
- *
245
- * @since 1.0
246
- * @param string $gateway_class_name the gateway class name
247
- * @return string admin configuration url for the gateway
248
- */
249
- public static function get_payment_gateway_configuration_url( $gateway_class_name ) {
250
-
251
- if ( self::is_wc_version_gte_2_1() ) {
252
- return admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . strtolower( $gateway_class_name ) );
253
- } else {
254
- return admin_url( 'admin.php?page=woocommerce_settings&tab=payment_gateways&section=' . $gateway_class_name );
255
- }
256
- }
257
-
258
-
259
- /**
260
- * Returns true if the current page is the admin configuration page for the
261
- * gateway with class name $gateway_class_name
262
- *
263
- * @since 1.0
264
- * @param string $gateway_class_name the gateway class name
265
- * @return boolean true if the current page is the admin configuration page for the gateway
266
- */
267
- public static function is_payment_gateway_configuration_page( $gateway_class_name ) {
268
-
269
- if ( self::is_wc_version_gte_2_1() ) {
270
- return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] &&
271
- isset( $_GET['tab'] ) && 'checkout' == $_GET['tab'] &&
272
- isset( $_GET['section'] ) && strtolower( $gateway_class_name ) == $_GET['section'];
273
- } else {
274
- return isset( $_GET['page'] ) && 'woocommerce_settings' == $_GET['page'] &&
275
- isset( $_GET['tab'] ) && 'payment_gateways' == $_GET['tab'] &&
276
- isset( $_GET['section'] ) && $gateway_class_name == $_GET['section'];
277
- }
278
- }
279
-
280
-
281
- /**
282
- * Returns the admin configuration url for the shipping method with class name
283
- * $gateway_class_name
284
- *
285
- * @since 1.0
286
- * @param string $shipping_method_class_name the shipping method class name
287
- * @return string admin configuration url for the shipping method
288
- */
289
- public static function get_shipping_method_configuration_url( $shipping_method_class_name ) {
290
-
291
- if ( self::is_wc_version_gte_2_1() ) {
292
- return admin_url( 'admin.php?page=wc-settings&tab=shipping&section=' . strtolower( $shipping_method_class_name ) );
293
- } else {
294
- return admin_url( 'admin.php?page=woocommerce_settings&tab=shipping&section=' . $shipping_method_class_name );
295
- }
296
- }
297
-
298
-
299
- /**
300
- * Returns true if the current page is the admin configuration page for the
301
- * shipping method with class name $shipping_method_class_name
302
- *
303
- * @since 1.0
304
- * @param string $shipping_method_class_name the shipping method class name
305
- * @return boolean true if the current page is the admin configuration page for the shipping method
306
- */
307
- public static function is_shipping_method_configuration_page( $shipping_method_class_name ) {
308
-
309
- if ( self::is_wc_version_gte_2_1() ) {
310
- return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] &&
311
- isset( $_GET['tab'] ) && 'shipping' == $_GET['tab'] &&
312
- isset( $_GET['section'] ) && strtolower( $shipping_method_class_name ) == $_GET['section'];
313
- } else {
314
- return isset( $_GET['page'] ) && 'woocommerce_settings' == $_GET['page'] &&
315
- isset( $_GET['tab'] ) && 'shipping' == $_GET['tab'] &&
316
- isset( $_GET['section'] ) && $shipping_method_class_name == $_GET['section'];
317
- }
318
- }
319
-
320
-
321
- /**
322
- * Format decimal numbers ready for DB storage
323
- *
324
- * Sanitize, remove locale formatting, and optionally round + trim off zeros
325
- *
326
- * @since 1.0
327
- * @param float|string $number Expects either a float or a string with a decimal separator only (no thousands)
328
- * @param mixed $dp number of decimal points to use, blank to use woocommerce_price_num_decimals, or false to avoid all rounding.
329
- * @param boolean $trim_zeros from end of string
330
- * @return string
331
- */
332
- public static function wc_format_decimal( $number, $dp = false, $trim_zeros = false ) {
333
-
334
- if ( self::is_wc_version_gte_2_1() ) {
335
- return wc_format_decimal( $number, $dp, $trim_zeros );
336
- } else {
337
- return woocommerce_format_total( $number );
338
- }
339
- }
340
-
341
-
342
- /**
343
- * Get the count of notices added, either for all notices (default) or for one particular notice type specified
344
- * by $notice_type.
345
- *
346
- * @since 1.0
347
- * @param string $notice_type The name of the notice type - either error, success or notice. [optional]
348
- * @return int the notice count
349
- */
350
- public static function wc_notice_count( $notice_type = '' ) {
351
-
352
- if ( self::is_wc_version_gte_2_1() ) {
353
- return wc_notice_count( $notice_type );
354
- } else {
355
- global $woocommerce;
356
-
357
- if ( 'error' == $notice_type ) {
358
- return $woocommerce->error_count();
359
- } else {
360
- return $woocommerce->message_count();
361
- }
362
- }
363
- }
364
-
365
-
366
- /**
367
- * Returns the array of shipping methods chosen during checkout
368
- *
369
- * @since 1.0
370
- * @return array of chosen shipping method ids
371
- */
372
- public static function get_chosen_shipping_methods() {
373
-
374
- if ( self::is_wc_version_gte_2_1() ) {
375
- $chosen_shipping_methods = self::WC()->session->get( 'chosen_shipping_methods' );
376
- return $chosen_shipping_methods ? $chosen_shipping_methods : array();
377
- } else {
378
- return array( self::WC()->session->get( 'chosen_shipping_method' ) );
379
- }
380
- }
381
-
382
-
383
- /**
384
- * Returns an array of shipping methods used for the order. This is analogous
385
- * to but not a precise replacement for WC_Order::get_shipping_methods(), just
386
- * because there can't be a direct equivalent for pre WC 2.1
387
- *
388
- * @since 1.0
389
- * @return array of shipping method ids for $order
390
- */
391
- public static function get_shipping_method_ids( $order ) {
392
-
393
- if ( self::get_order_custom_field( $order, 'shipping_method' ) ) {
394
-
395
- // pre WC 2.1 data
396
- return array( self::get_order_custom_field( $order, 'shipping_method' ) );
397
-
398
- } elseif ( self::is_wc_version_gte_2_1() ) {
399
-
400
- $shipping_method_ids = array();
401
-
402
- foreach ( $order->get_shipping_methods() as $shipping_method ) {
403
- $shipping_method_ids[] = $shipping_method['method_id'];
404
- }
405
-
406
- return $shipping_method_ids;
407
- }
408
-
409
- return array();
410
- }
411
-
412
-
413
- /**
414
- * Returns true if the order has the given shipping method
415
- *
416
- * @since 1.0
417
- * @param WC_Order $order
418
- * @param string $method_id
419
- * @return boolean true if $order is shipped by $method_id
420
- */
421
- public static function has_shipping_method( $order, $method_id ) {
422
-
423
- if ( self::get_order_custom_field( $order, 'shipping_method' ) ) {
424
- // pre WC 2.1 data
425
- return $method_id == self::get_order_custom_field( $order, 'shipping_method' );
426
- } elseif ( self::is_wc_version_gte_2_1() ) {
427
- return $order->has_shipping_method( $method_id );
428
- }
429
-
430
- // default
431
- return false;
432
- }
433
-
434
-
435
- /**
436
- * Compatibility function to use the new WC_Admin_Meta_Boxes class for the save_errors() function
437
- *
438
- * @since 1.0
439
- */
440
- public static function save_errors() {
441
-
442
- if ( self::is_wc_version_gte_2_1() ) {
443
- WC_Admin_Meta_Boxes::save_errors();
444
- } else {
445
- woocommerce_meta_boxes_save_errors();
446
- }
447
- }
448
-
449
-
450
- /**
451
- * Get coupon types.
452
- *
453
- * @since 1.0
454
- * @return array of coupon types
455
- */
456
- public static function wc_get_coupon_types() {
457
-
458
- if ( self::is_wc_version_gte_2_1() ) {
459
- return wc_get_coupon_types();
460
- } else {
461
- global $woocommerce;
462
- return $woocommerce->get_coupon_discount_types();
463
- }
464
- }
465
-
466
-
467
- /**
468
- * Gets a product meta field value, regardless of product type
469
- *
470
- * @since 1.0
471
- * @param WC_Product $product the product
472
- * @param string $field_name the field name
473
- * @return mixed meta value
474
- */
475
- public static function get_product_meta( $product, $field_name ) {
476
-
477
- // even in WC >= 2.0 product variations still use the product_custom_fields array apparently
478
- if ( $product->variation_id && isset( $product->product_custom_fields[ '_' . $field_name ][0] ) && '' !== $product->product_custom_fields[ '_' . $field_name ][0] ) {
479
- return $product->product_custom_fields[ '_' . $field_name ][0];
480
- }
481
-
482
- // use magic __get
483
- return $product->$field_name;
484
- }
485
-
486
-
487
- /**
488
- * Format the price with a currency symbol.
489
- *
490
- * @since 1.0
491
- * @param float $price the price
492
- * @param array $args (default: array())
493
- * @return string formatted price
494
- */
495
- public static function wc_price( $price, $args = array() ) {
496
-
497
- if ( self::is_wc_version_gte_2_1() ) {
498
- return wc_price( $price, $args );
499
- } else {
500
- return woocommerce_price( $price, $args );
501
- }
502
- }
503
-
504
-
505
- /**
506
- * WooCommerce Shortcode wrapper
507
- *
508
- * @since 1.0
509
- * @param mixed $function shortcode callback
510
- * @param array $atts (default: array())
511
- * @param array $wrapper array of wrapper options (class, before, after)
512
- * @return string
513
- */
514
- public static function shortcode_wrapper(
515
- $function,
516
- $atts = array(),
517
- $wrapper = array(
518
- 'class' => 'woocommerce',
519
- 'before' => null,
520
- 'after' => null
521
- ) ) {
522
-
523
- if ( self::is_wc_version_gte_2_1() ) {
524
- return WC_Shortcodes::shortcode_wrapper( $function, $atts, $wrapper );
525
- } else {
526
- global $woocommerce;
527
- return $woocommerce->shortcode_wrapper( $function, $atts, $wrapper );
528
- }
529
- }
530
-
531
-
532
- /**
533
- * Compatibility for the woocommerce_get_template() function which is soft-deprecated in 2.1+
534
- *
535
- * @since 1.1
536
- * @param string $template_name
537
- * @param array $args
538
- * @param string $template_path
539
- * @param string $default_path
540
- */
541
- public static function wc_get_template( $template_name, $args, $template_path, $default_path ) {
542
-
543
- if ( self::is_wc_version_gte_2_1() ) {
544
-
545
- wc_get_template( $template_name, $args, $template_path, $default_path );
546
-
547
- } else {
548
-
549
- woocommerce_get_template( $template_name, $args, $template_path, $default_path );
550
- }
551
- }
552
-
553
-
554
- /**
555
- * Compatibility for the woocommerce_date_format() function which is soft-deprecated in 2.1+
556
- *
557
- * @since 1.1
558
- * @return string date format
559
- */
560
- public static function wc_date_format() {
561
-
562
- return self::is_wc_version_gte_2_1() ? wc_date_format() : woocommerce_date_format();
563
- }
564
-
565
-
566
- /**
567
- * Compatibility for the woocommerce_time_format() function which is soft-deprecated in 2.1+
568
- *
569
- * @since 1.1
570
- * @return string time format
571
- */
572
- public static function wc_time_format() {
573
-
574
- return self::is_wc_version_gte_2_1() ? wc_time_format() : woocommerce_time_format();
575
- }
576
-
577
-
578
- /**
579
- * Compatibility for the wc_timezone_string() function, which only
580
- * exists in 2.1+
581
- *
582
- * @since 1.1
583
- * @return string a valid PHP timezone string for the site
584
- */
585
- public static function wc_timezone_string() {
586
-
587
- if ( self::is_wc_version_gte_2_1() ) {
588
-
589
- return wc_timezone_string();
590
-
591
- } else {
592
-
593
- // if site timezone string exists, return it
594
- if ( $timezone = get_option( 'timezone_string' ) ) {
595
- return $timezone;
596
- }
597
-
598
- // get UTC offset, if it isn't set then return UTC
599
- if ( 0 === ( $utc_offset = get_option( 'gmt_offset', 0 ) ) ) {
600
- return 'UTC';
601
- }
602
-
603
- // adjust UTC offset from hours to seconds
604
- $utc_offset *= 3600;
605
-
606
- // attempt to guess the timezone string from the UTC offset
607
- $timezone = timezone_name_from_abbr( '', $utc_offset );
608
-
609
- // last try, guess timezone string manually
610
- if ( false === $timezone ) {
611
-
612
- $is_dst = date( 'I' );
613
-
614
- foreach ( timezone_abbreviations_list() as $abbr ) {
615
- foreach ( $abbr as $city ) {
616
-
617
- if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
618
- return $city['timezone_id'];
619
- }
620
- }
621
- }
622
- }
623
-
624
- // fallback to UTC
625
- return 'UTC';
626
- }
627
- }
628
-
629
-
630
- /**
631
- * Compatibility function to load WooCommerec admin functions in the admin,
632
- * primarily needed for woocommerce_admin_fields() and woocommerce_update_options()
633
- *
634
- * Note these functions have been refactored in the WC_Admin_Settings class in 2.1+,
635
- * so plugins targeting those versions can safely use WC_Admin_Settings::output_fields()
636
- * and WC_Admin_Settings::save_fields instead
637
- *
638
- * @since 1.0
639
- */
640
- public static function load_wc_admin_functions() {
641
-
642
- if ( ! self::is_wc_version_gte_2_1() ) {
643
-
644
- // woocommerce_admin_fields()
645
- require_once( self::WC()->plugin_path() . '/admin/woocommerce-admin-settings.php' );
646
-
647
- // woocommerce_update_options()
648
- require_once( self::WC()->plugin_path() . '/admin/settings/settings-save.php' );
649
-
650
- } else {
651
-
652
- // in 2.1+, wc-admin-functions.php lazy loads the admin settings functions
653
- }
654
- }
655
-
656
-
657
- /**
658
- * Returns true if the current page is the admin general configuration page
659
- *
660
- * @since 1.1
661
- * @return boolean true if the current page is the admin general configuration page
662
- */
663
- public static function is_general_configuration_page() {
664
-
665
- if ( self::is_wc_version_gte_2_1() ) {
666
- return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] &&
667
- ( ! isset( $_GET['tab'] ) || 'general' == $_GET['tab'] );
668
- } else {
669
- return isset( $_GET['page'] ) && 'woocommerce_settings' == $_GET['page'] &&
670
- ( ! isset( $_GET['tab'] ) || 'general' == $_GET['tab'] );
671
- }
672
- }
673
-
674
-
675
- /**
676
- * Returns the admin configuration url for the admin general configuration page
677
- *
678
- * @since 1.1
679
- * @return string admin configuration url for the admin general configuration page
680
- */
681
- public static function get_general_configuration_url() {
682
-
683
- if ( self::is_wc_version_gte_2_1() ) {
684
- return admin_url( 'admin.php?page=wc-settings&tab=general' );
685
- } else {
686
- return admin_url( 'admin.php?page=woocommerce_settings&tab=general' );
687
- }
688
- }
689
-
690
-
691
- /**
692
- * Returns the order_id if on the checkout order received page
693
- *
694
- * Note this must be used in the `wp` or later action, as earlier
695
- * actions do not yet have access to the query vars
696
- *
697
- * @since 1.1
698
- * @return int order identifier
699
- */
700
- public static function get_checkout_order_received_order_id() {
701
-
702
- if ( self::is_wc_version_gte_2_1() ) {
703
- global $wp;
704
- return isset( $wp->query_vars['order-received'] ) ? absint( $wp->query_vars['order-received'] ) : 0;
705
- } else {
706
- return isset( $_GET['order'] ) ? absint( $_GET['order'] ) : 0;
707
- }
708
- }
709
-
710
-
711
- /**
712
- * Generates a URL for the thanks page (order received)
713
- *
714
- * @since 1.1
715
- * @param WC_Order $order
716
- * @return string url to thanks page
717
- */
718
- public static function get_checkout_order_received_url( $order ) {
719
-
720
- if ( self::is_wc_version_gte_2_1() ) {
721
- return $order->get_checkout_order_received_url();
722
- } else {
723
- return get_permalink( woocommerce_get_page_id( 'thanks' ) );
724
- }
725
- }
726
-
727
-
728
- /**
729
- * Compatibility function to get the version of the currently installed WooCommerce
730
- *
731
- * @since 1.0
732
- * @return string woocommerce version number or null
733
- */
734
- public static function get_wc_version() {
735
-
736
- // WOOCOMMERCE_VERSION is now WC_VERSION, though WOOCOMMERCE_VERSION is still available for backwards compatibility, we'll disregard it on 2.1+
737
- if ( defined( 'WC_VERSION' ) && WC_VERSION ) return WC_VERSION;
738
- if ( defined( 'WOOCOMMERCE_VERSION' ) && WOOCOMMERCE_VERSION ) return WOOCOMMERCE_VERSION;
739
-
740
- return null;
741
- }
742
-
743
-
744
- /**
745
- * Returns the WooCommerce instance
746
- *
747
- * @since 1.0
748
- * @return WooCommerce woocommerce instance
749
- */
750
- public static function WC() {
751
-
752
- if ( self::is_wc_version_gte_2_1() ) {
753
- return WC();
754
- } else {
755
- global $woocommerce;
756
- return $woocommerce;
757
- }
758
- }
759
-
760
-
761
- /**
762
- * Returns true if the WooCommerce plugin is loaded
763
- *
764
- * @since 1.0
765
- * @return boolean true if WooCommerce is loaded
766
- */
767
- public static function is_wc_loaded() {
768
-
769
- if ( self::is_wc_version_gte_2_1() ) {
770
- return class_exists( 'WooCommerce' );
771
- } else {
772
- return class_exists( 'Woocommerce' );
773
- }
774
- }
775
-
776
-
777
- /**
778
- * Returns true if the installed version of WooCommerce is 2.1 or greater
779
- *
780
- * @since 1.0
781
- * @return boolean true if the installed version of WooCommerce is 2.1 or greater
782
- */
783
- public static function is_wc_version_gte_2_1() {
784
-
785
- // can't use gte 2.1 at the moment because 2.1-BETA < 2.1
786
- return self::is_wc_version_gt( '2.0.20' );
787
- }
788
-
789
-
790
- /**
791
- * Returns true if the installed version of WooCommerce is greater than $version
792
- *
793
- * @since 1.0
794
- * @param string $version the version to compare
795
- * @return boolean true if the installed version of WooCommerce is > $version
796
- */
797
- public static function is_wc_version_gt( $version ) {
798
-
799
- return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '>' );
800
- }
801
-
802
- }
803
-
804
-
805
- endif; // Class exists check
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-wc-customizer-settings.php ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Customizer
4
+ *
5
+ * This source file is subject to the GNU General Public License v3.0
6
+ * that is bundled with this package in the file license.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.html
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@skyverge.com so we can send you a copy immediately.
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade WooCommerce Customizer to newer
16
+ * versions in the future. If you wish to customize WooCommerce Customizer for your
17
+ * needs please refer to http://www.skyverge.com/product/woocommerce-customizer/ for more information.
18
+ *
19
+ * @package WC-Customizer/Classes
20
+ * @author SkyVerge
21
+ * @copyright Copyright (c) 2013-2014, SkyVerge, Inc.
22
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
23
+ */
24
+
25
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
26
+
27
+ /**
28
+ * Settings
29
+ *
30
+ * Adds UX for adding/modifying customizations
31
+ *
32
+ * @since 2.0.0
33
+ */
34
+ class WC_Customizer_Settings extends WC_Settings_Page {
35
+
36
+
37
+ /**
38
+ * Add various admin hooks/filters
39
+ *
40
+ * @since 2.0.0
41
+ */
42
+ public function __construct() {
43
+
44
+ $this->id = 'customizer';
45
+ $this->label = __( 'Customizer', 'woocommerce-customizer' );
46
+
47
+ // add tab
48
+ add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
+
50
+ // show sections
51
+ add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) );
52
+
53
+ // show settings
54
+ add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
55
+
56
+ // save settings
57
+ add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
58
+
59
+ $this->customizations = get_option( 'wc_customizer_active_customizations', array() );
60
+ }
61
+
62
+ /**
63
+ * Get sections
64
+ *
65
+ * @return array
66
+ */
67
+ public function get_sections() {
68
+
69
+ return array(
70
+ 'shop_loop' => __( 'Shop Loop', 'woocommerce-customizer' ),
71
+ 'product_page' => __( 'Product Page', 'woocommerce-customizer' ),
72
+ 'checkout' => __( 'Checkout', 'woocommerce-customizer' ),
73
+ 'misc' => __( 'Misc', 'woocommerce-customizer' )
74
+ );
75
+ }
76
+
77
+ /**
78
+ * Render the settings for the current section
79
+ *
80
+ * @since 2.0.0
81
+ */
82
+ public function output() {
83
+
84
+ $settings = $this->get_settings();
85
+
86
+ // inject the actual setting value before outputting the fields
87
+ // ::output_fields() uses get_option() but customizations are stored
88
+ // in a single option so this dynamically returns the correct value
89
+ foreach ( $this->customizations as $filter => $value ) {
90
+
91
+ add_filter( "pre_option_{$filter}", array( $this, 'get_customization' ) );
92
+ }
93
+
94
+ WC_Admin_Settings::output_fields( $settings );
95
+ }
96
+
97
+
98
+ /**
99
+ * Return the customization value for the given filter
100
+ *
101
+ * @since 2.0.0
102
+ * @return string
103
+ */
104
+ public function get_customization() {
105
+
106
+ $filter = str_replace( 'pre_option_', '', current_filter() );
107
+
108
+ return isset( $this->customizations[ $filter ] ) ? $this->customizations[ $filter ] : '';
109
+ }
110
+
111
+
112
+ /**
113
+ * Save the customizations
114
+ *
115
+ * @since 2.0.0
116
+ */
117
+ public function save() {
118
+
119
+ foreach ( $this->get_settings() as $field ) {
120
+
121
+ // skip titles, etc
122
+ if ( ! isset( $field['id'] ) ) {
123
+ continue;
124
+ }
125
+
126
+ if ( ! empty( $_POST[ $field['id'] ] ) ) {
127
+
128
+ $this->customizations[ $field['id'] ] = wp_kses_post( $_POST[ $field['id'] ] );
129
+
130
+ } elseif ( isset( $this->customizations[ $field['id'] ] ) ) {
131
+
132
+ unset( $this->customizations[ $field['id'] ] );
133
+ }
134
+ }
135
+
136
+ update_option( 'wc_customizer_active_customizations', $this->customizations );
137
+ }
138
+
139
+
140
+ /**
141
+ * Return admin fields in proper format for outputting / saving
142
+ *
143
+ * @since 1.1
144
+ * @return array
145
+ */
146
+ public function get_settings() {
147
+
148
+ $settings = array(
149
+
150
+ 'shop_loop' =>
151
+
152
+ array(
153
+
154
+ array(
155
+ 'title' => __( 'Add to Cart Button Text', 'woocommerce-customizer' ),
156
+ 'type' => 'title'
157
+ ),
158
+
159
+ array(
160
+ 'id' => 'add_to_cart_text',
161
+ 'title' => __( 'Simple Product', 'woocommerce-customizer' ),
162
+ 'desc_tip' => __( 'Changes the add to cart button text for simple products on all loop pages', 'woocommerce-customizer' ),
163
+ 'type' => 'text'
164
+ ),
165
+
166
+ array(
167
+ 'id' => 'variable_add_to_cart_text',
168
+ 'title' => __( 'Variable Product', 'woocommerce-customizer' ),
169
+ 'desc_tip' => __( 'Changes the add to cart button text for variable products on all loop pages', 'woocommerce-customizer' ),
170
+ 'type' => 'text'
171
+ ),
172
+
173
+ array(
174
+ 'id' => 'grouped_add_to_cart_text',
175
+ 'title' => __( 'Grouped Product', 'woocommerce-customizer' ),
176
+ 'desc_tip' => __( 'Changes the add to cart button text for grouped products on all loop pages', 'woocommerce-customizer' ),
177
+ 'type' => 'text'
178
+ ),
179
+
180
+ array(
181
+ 'id' => 'external_add_to_cart_text',
182
+ 'title' => __( 'External Product', 'woocommerce-customizer' ),
183
+ 'desc_tip' => __( 'Changes the add to cart button text for external products on all loop pages', 'woocommerce-customizer' ),
184
+ 'type' => 'text'
185
+ ),
186
+
187
+ array(
188
+ 'id' => 'out_of_stock_add_to_cart_text',
189
+ 'title' => __( 'Out of Stock Product', 'woocommerce-customizer' ),
190
+ 'desc_tip' => __( 'Changes the add to cart button text for out of stock products on all loop pages', 'woocommerce-customizer' ),
191
+ 'type' => 'text'
192
+ ),
193
+
194
+ array( 'type' => 'sectionend' ),
195
+
196
+ array(
197
+ 'title' => __( 'Layout', 'woocommerce-customizer' ),
198
+ 'type' => 'title'
199
+ ),
200
+
201
+ array(
202
+ 'id' => 'loop_shop_per_page',
203
+ 'title' => __( 'Products displayed per page', 'woocommerce-customizer' ),
204
+ 'desc_tip' => __( 'Changes the number of products displayed per page', 'woocommerce-customizer' ),
205
+ 'type' => 'text'
206
+ ),
207
+
208
+ array(
209
+ 'id' => 'loop_shop_columns',
210
+ 'title' => __( 'Product columns displayed per page', 'woocommerce-customizer' ),
211
+ 'desc_tip' => __( 'Changes the number of columns displayed per page', 'woocommerce-customizer' ),
212
+ 'type' => 'text'
213
+ ),
214
+
215
+ array(
216
+ 'id' => 'woocommerce_product_thumbnails_columns',
217
+ 'title' => __( 'Product thumbnail columns displayed', 'woocommerce-customizer' ),
218
+ 'desc_tip' => __( 'Changes the number of product thumbnail columns displayed', 'woocommerce-customizer' ),
219
+ 'type' => 'text'
220
+ ),
221
+
222
+ array( 'type' => 'sectionend' )
223
+
224
+ ),
225
+
226
+ 'product_page' =>
227
+
228
+ array(
229
+
230
+ array(
231
+ 'title' => __( 'Tab Titles', 'woocommerce-customizer' ),
232
+ 'type' => 'title'
233
+ ),
234
+
235
+ array(
236
+ 'id' => 'woocommerce_product_description_tab_title',
237
+ 'title' => __( 'Product Description', 'woocommerce-customizer' ),
238
+ 'desc_tip' => __( 'Changes the Production Description tab title', 'woocommerce-customizer' ),
239
+ 'type' => 'text'
240
+ ),
241
+
242
+ array(
243
+ 'id' => 'woocommerce_product_additional_information_tab_title',
244
+ 'title' => __( 'Additional Information', 'woocommerce-customizer' ),
245
+ 'desc_tip' => __( 'Changes the Additional Information tab title', 'woocommerce-customizer' ),
246
+ 'type' => 'text'
247
+ ),
248
+
249
+ array( 'type' => 'sectionend' ),
250
+
251
+ array(
252
+ 'title' => __( 'Tab Content Headings', 'woocommerce-customizer' ),
253
+ 'type' => 'title'
254
+ ),
255
+
256
+ array(
257
+ 'id' => 'woocommerce_product_description_heading',
258
+ 'title' => __( 'Product Description', 'woocommerce-customizer' ),
259
+ 'desc_tip' => __( 'Changes the Product Description tab heading', 'woocommerce-customizer' ),
260
+ 'type' => 'text'
261
+ ),
262
+
263
+ array(
264
+ 'id' => 'woocommerce_product_additional_information_heading',
265
+ 'title' => __( 'Additional Information', 'woocommerce-customizer' ),
266
+ 'desc_tip' => __( 'Changes the Additional Information tab heading', 'woocommerce-customizer' ),
267
+ 'type' => 'text'
268
+ ),
269
+
270
+ array( 'type' => 'sectionend' ),
271
+
272
+ array(
273
+ 'title' => __( 'Add to Cart Button Text', 'woocommerce-customizer' ),
274
+ 'type' => 'title'
275
+ ),
276
+
277
+ array(
278
+ 'id' => 'single_add_to_cart_text',
279
+ 'title' => __( 'All Product Types', 'woocommerce-customizer' ),
280
+ 'desc_tip' => __( 'Changes the Add to Cart button text on the single product page for all product type', 'woocommerce-customizer' ),
281
+ 'type' => 'text'
282
+ ),
283
+
284
+ array( 'type' => 'sectionend' )
285
+ ),
286
+
287
+ 'checkout' =>
288
+
289
+ array(
290
+
291
+ array(
292
+ 'title' => __( 'Messages', 'woocommerce-customizer' ),
293
+ 'type' => 'title'
294
+ ),
295
+
296
+ array(
297
+ 'id' => 'woocommerce_checkout_must_be_logged_in_message',
298
+ 'title' => __( 'Must be logged in text', 'woocommerce-customizer' ),
299
+ 'desc_tip' => __( 'Changes the message displayed when a customer must be logged in to checkout', 'woocommerce-customizer' ),
300
+ 'type' => 'text'
301
+ ),
302
+
303
+ array(
304
+ 'id' => 'woocommerce_checkout_coupon_message',
305
+ 'title' => __( 'Coupon text', 'woocommerce-customizer' ),
306
+ 'desc_tip' => __( 'Changes the message displayed if the coupon form is enabled on checkout', 'woocommerce-customizer' ),
307
+ 'type' => 'text'
308
+ ),
309
+
310
+ array(
311
+ 'id' => 'woocommerce_checkout_login_message',
312
+ 'title' => __( 'Login text', 'woocommerce-customizer' ),
313
+ 'desc_tip' => __( 'Changes the message displayed if customers can login at checkout', 'woocommerce-customizer' ),
314
+ 'type' => 'text'
315
+ ),
316
+
317
+ array( 'type' => 'sectionend' ),
318
+
319
+ array(
320
+ 'title' => __( 'Misc', 'woocommerce-customizer' ),
321
+ 'type' => 'title'
322
+ ),
323
+
324
+ array(
325
+ 'id' => 'woocommerce_create_account_default_checked',
326
+ 'title' => __( 'Create Account checkbox default' ),
327
+ 'desc_tip' => __( 'Control the default state for the Create Account checkbox', 'woocommerce-customizer' ),
328
+ 'type' => 'select',
329
+ 'options' => array(
330
+ 'customizer_true' => __( 'Checked', 'woocommerce-customizer' ),
331
+ 'customizer_false' => __( 'Unchecked', 'woocommerce-customizer' ),
332
+ ),
333
+ 'default' => 'customizer_false',
334
+ ),
335
+
336
+ array(
337
+ 'id' => 'woocommerce_order_button_text',
338
+ 'title' => __( 'Submit Order button', 'woocommerce-customizer' ),
339
+ 'desc_tip' => __( 'Changes the Place Order button text on checkout', 'woocommerce-customizer' ),
340
+ 'type' => 'text'
341
+ ),
342
+
343
+ array( 'type' => 'sectionend' )
344
+
345
+ ),
346
+
347
+ 'misc' =>
348
+
349
+ array(
350
+
351
+ array(
352
+ 'title' => __( 'Tax', 'woocommerce-customizer' ),
353
+ 'type' => 'title'
354
+ ),
355
+
356
+ array(
357
+ 'id' => 'woocommerce_countries_tax_or_vat',
358
+ 'title' => __( 'Tax Label', 'woocommerce-customizer' ),
359
+ 'desc_tip' => __( 'Changes the Taxes label. Defaults to Tax for USA, VAT for European countries', 'woocommerce-customizer' ),
360
+ 'type' => 'text'
361
+ ),
362
+
363
+ array(
364
+ 'id' => 'woocommerce_countries_inc_tax_or_vat',
365
+ 'title' => __( 'Including Tax Label', 'woocommerce-customizer' ),
366
+ 'desc_tip' => __( 'Changes the Including Taxes label. Defaults to Inc. tax for USA, Inc. VAT for European countries', 'woocommerce-customizer' ),
367
+ 'type' => 'text'
368
+ ),
369
+
370
+ array(
371
+ 'id' => 'woocommerce_countries_ex_tax_or_vat',
372
+ 'title' => __( 'Excluding Tax Label', 'woocommerce-customizer' ),
373
+ 'desc_tip' => __( 'Changes the Excluding Taxes label. Defaults to Exc. tax for USA, Exc. VAT for European countries', 'woocommerce-customizer' ),
374
+ 'type' => 'text'
375
+ ),
376
+
377
+ array( 'type' => 'sectionend' ),
378
+
379
+ array(
380
+ 'title' => __( 'Images', 'woocommerce-customizer' ),
381
+ 'type' => 'title'
382
+ ),
383
+
384
+ array(
385
+ 'id' => 'woocommerce_placeholder_img_src',
386
+ 'title' => __( 'Placeholder Image source', 'woocommerce-customizer' ),
387
+ 'desc_tip' => __( 'Change the default placeholder image by setting this to a valid image URL', 'woocommerce-customizer' ),
388
+ 'type' => 'text'
389
+ ),
390
+
391
+ array( 'type' => 'sectionend' ),
392
+
393
+ ),
394
+ );
395
+
396
+ return isset( $settings[ $GLOBALS['current_section' ] ] ) ? $settings[ $GLOBALS['current_section' ] ] : $settings['shop_loop'];
397
+ }
398
+
399
+
400
+ }
401
+
402
+ // setup settings
403
+ $GLOBALS['wc_customizer']->settings = new WC_Customizer_Settings();
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Customizer ===
2
- Contributors: maxrice, justinstern, skyverge
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@skyverge.com&item_name=Donation+for+WooCommerce+Customizer
4
  Tags: woocommerce
5
- Requires at least: 3.5
6
- Tested up to: 3.8.1
7
- Stable tag: 1.2.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -22,8 +22,10 @@ Here's the list of customizations you can make:
22
  * The number of products displayed per page
23
  * Heading text for the 'Product Description' and 'Additional Information' tab.
24
  * Checkout page coupon / login text
 
25
  * Checkout page 'Submit Order' button text
26
  * Tax Label text
 
27
 
28
  == Installation ==
29
 
@@ -53,8 +55,15 @@ Yes! Fork the plugin on [Github](https://github.com/skyverge/woocommerce-customi
53
 
54
  == Changelog ==
55
 
 
 
 
 
 
 
 
56
  = 1.2.1 =
57
- * Fix missing compatibility class error
58
 
59
  = 1.2 =
60
  * Fix issues with add to cart button text customizations in WooCommerce 2.1
1
  === WooCommerce Customizer ===
2
+ Contributors: maxrice, justinstern, tamarazuk, skyverge
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@skyverge.com&item_name=Donation+for+WooCommerce+Customizer
4
  Tags: woocommerce
5
+ Requires at least: 3.8
6
+ Tested up to: 4.0
7
+ Stable tag: 2.0.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
22
  * The number of products displayed per page
23
  * Heading text for the 'Product Description' and 'Additional Information' tab.
24
  * Checkout page coupon / login text
25
+ * Checkout page "Create Account" checkbox default
26
  * Checkout page 'Submit Order' button text
27
  * Tax Label text
28
+ * Placeholder image source
29
 
30
  == Installation ==
31
 
55
 
56
  == Changelog ==
57
 
58
+ = 2.0.0 =
59
+ * Added Checkout "Create Account" checkbox default customization
60
+ * Added Placeholder image source customization
61
+ * Moved settings to WooCommerce > Settings > Customizer
62
+ * WooCommerce 2.2 Compatibility
63
+ * Localization - Text domain changed from `wc-customizer` to `woocommerce-customizer`
64
+
65
  = 1.2.1 =
66
+ * Fix missing compatibility class error
67
 
68
  = 1.2 =
69
  * Fix issues with add to cart button text customizations in WooCommerce 2.1
woocommerce-customizer.php CHANGED
@@ -5,11 +5,11 @@
5
  * Description: Customize WooCommerce without code! Easily change add to cart button text and more.
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
- * Version: 1.2.1
9
  * Text Domain: wc-customizer
10
  * Domain Path: /languages/
11
  *
12
- * Copyright: (c) 2013 SkyVerge, Inc. (info@skyverge.com)
13
  *
14
  * License: GNU General Public License v3.0
15
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -17,7 +17,7 @@
17
  * @package WC-Customizer
18
  * @author SkyVerge
19
  * @category Utility
20
- * @copyright Copyright (c) 2013, SkyVerge, Inc.
21
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
22
  */
23
 
@@ -27,15 +27,27 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
27
  if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
28
  return;
29
 
30
- // required compatibility class
31
- require_once( 'includes/class-wc-customizer-compatibility.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- /**
34
- * The WC_Customizer global object
35
- * @name $wc_customizer
36
- * @global WC_Customizer $GLOBALS['wc_customizer']
37
- */
38
- $GLOBALS['wc_customizer'] = new WC_Customizer();
39
 
40
  /**
41
  * # WooCommerce Customizer Main Plugin Class
@@ -72,7 +84,10 @@ class WC_Customizer {
72
 
73
 
74
  /** plugin version number */
75
- const VERSION = '1.2.1';
 
 
 
76
 
77
  /** var array the active filters */
78
  public $filters;
@@ -81,7 +96,7 @@ class WC_Customizer {
81
  /**
82
  * Initializes the plugin
83
  *
84
- * @since 1.0
85
  */
86
  public function __construct() {
87
 
@@ -91,8 +106,8 @@ class WC_Customizer {
91
  // admin
92
  if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
93
 
94
- // include required files
95
- $this->admin_includes();
96
 
97
  // add a 'Configure' link to the plugin action links
98
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_plugin_action_links' ) );
@@ -105,10 +120,24 @@ class WC_Customizer {
105
  }
106
 
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  /**
109
  * Load customizations after WC is loaded so the version can be checked
110
  *
111
- * @since 1.2
112
  */
113
  public function load_customizations() {
114
 
@@ -121,7 +150,7 @@ class WC_Customizer {
121
  foreach ( $this->filters as $filter_name => $filter_value ) {
122
 
123
  // WC 2.1 changed the add to cart text filter signatures so conditionally add the new filters
124
- if ( false !== strpos( $filter_name, 'add_to_cart_text' ) && WC_Customizer_Compatibility::is_wc_version_gte_2_1() ) {
125
 
126
  if ( $filter_name == 'single_add_to_cart_text' ) {
127
 
@@ -137,35 +166,19 @@ class WC_Customizer {
137
  add_filter( $filter_name, array( $this, 'customize' ) );
138
  }
139
  }
140
-
141
- // for use some day, in a galaxy far, far away, when WP has greater 5.3 adoption
142
- // add_filter( $filter_name, function() use ( $filter_value ) { return $filter_value; } );
143
  }
144
  }
145
 
146
 
147
- /**
148
- * Include required admin files
149
- *
150
- * @since 1.1
151
- */
152
- private function admin_includes() {
153
-
154
- // admin UI
155
- require( 'includes/class-wc-customizer-admin.php' );
156
- $this->admin = new WC_Customizer_Admin();
157
- }
158
-
159
-
160
  /**
161
  * Handle localization, WPML compatible
162
  *
163
- * @since 1.1
164
  */
165
  public function load_translation() {
166
 
167
  // localization in the init action for WPML support
168
- load_plugin_textdomain( 'wc-customizer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
169
  }
170
 
171
 
@@ -175,7 +188,7 @@ class WC_Customizer {
175
  /**
176
  * Add hook to selected filters
177
  *
178
- * @since 1.0
179
  * @return string $filter_value value to use for selected hook
180
  */
181
  public function customize() {
@@ -183,7 +196,16 @@ class WC_Customizer {
183
  $current_filter = current_filter();
184
 
185
  if ( isset( $this->filters[ $current_filter ] ) ) {
186
- return $this->filters[ $current_filter ];
 
 
 
 
 
 
 
 
 
187
  }
188
 
189
  // no need to return a value passed in, because if a filter is set, it's designed to only return that value
@@ -191,11 +213,9 @@ class WC_Customizer {
191
 
192
 
193
  /**
194
- * Apply the single add to cart button text customization in WC 2.1+
195
  *
196
- * The filter signature changed from `single_add_to_cart_text` to `woocommerce_product_single_add_to_cart_text`
197
- *
198
- * @since 1.2
199
  */
200
  public function customize_single_add_to_cart_text() {
201
 
@@ -204,14 +224,9 @@ class WC_Customizer {
204
 
205
 
206
  /**
207
- * Apply the shop loop add to cart button text customization in WC 2.1+
208
- *
209
- * The filter signature changed from `add_to_cart_text|{type}_add_to_cart_text` to `woocommerce_product_add_to_cart_text`
210
- *
211
- * This is sort of a hack but prevents a major refactoring and maintains backwards compatibility until WC 2.1+ can
212
- * be required
213
  *
214
- * @since 1.2
215
  * @param string $text add to cart text
216
  * @param WC_Product $product product object
217
  * @return string modified add to cart text
@@ -256,16 +271,16 @@ class WC_Customizer {
256
  * Return the plugin action links. This will only be called if the plugin
257
  * is active.
258
  *
259
- * @since 1.0
260
  * @param array $actions associative array of action names to anchor tags
261
  * @return array associative array of plugin action links
262
  */
263
  public function add_plugin_action_links( $actions ) {
264
 
265
  $custom_actions = array(
266
- 'configure' => sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=wc_customizer' ), __( 'Configure', 'wc-customizer' ) ),
267
- 'faq' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/plugins/woocommerce-customizer/faq/', __( 'FAQ', 'wc-customizer' ) ),
268
- 'support' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/support/plugin/woocommerce-customizer', __( 'Support', 'wc-customizer' ) ),
269
  );
270
 
271
  // add the links to the front of the actions list
@@ -279,7 +294,7 @@ class WC_Customizer {
279
  /**
280
  * Run every time. Used since the activation hook is not executed when updating a plugin
281
  *
282
- * @since 1.1
283
  */
284
  private function install() {
285
 
@@ -302,7 +317,7 @@ class WC_Customizer {
302
  /**
303
  * Perform any version-related changes.
304
  *
305
- * @since 1.1
306
  * @param int $installed_version the currently installed version of the plugin
307
  */
308
  private function upgrade( $installed_version ) {
@@ -312,4 +327,12 @@ class WC_Customizer {
312
  }
313
 
314
 
315
- } // end \WC_Customizer
 
 
 
 
 
 
 
 
5
  * Description: Customize WooCommerce without code! Easily change add to cart button text and more.
6
  * Author: SkyVerge
7
  * Author URI: http://www.skyverge.com
8
+ * Version: 2.0.0
9
  * Text Domain: wc-customizer
10
  * Domain Path: /languages/
11
  *
12
+ * Copyright: (c) 2013-2014 SkyVerge, Inc. (info@skyverge.com)
13
  *
14
  * License: GNU General Public License v3.0
15
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
17
  * @package WC-Customizer
18
  * @author SkyVerge
19
  * @category Utility
20
+ * @copyright Copyright (c) 2013-2014, SkyVerge, Inc.
21
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
22
  */
23
 
27
  if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
28
  return;
29
 
30
+ // WC version check
31
+ if ( version_compare( get_option( 'woocommerce_db_version' ), '2.1', '<' ) ) {
32
+
33
+ function woocommerce_customizer_outdated_version_notice() {
34
+
35
+ $message = sprintf(
36
+ __( '%sWooCommerce Customizer is inactive.%s This version requires WooCommerce 2.1 or newer. Please %supdate WooCommerce to version 2.1 or newer%s', 'woocommerce-customizer' ),
37
+ '<strong>',
38
+ '</strong>',
39
+ '<a href="' . admin_url( 'plugins.php' ) . '">',
40
+ '&nbsp;&raquo;</a>'
41
+ );
42
+
43
+ echo sprintf( '<div class="error"><p>%s</p></div>', $message );
44
+ }
45
+
46
+ add_action( 'admin_notices', 'woocommerce_customizer_outdated_version_notice' );
47
+
48
+ return;
49
+ }
50
 
 
 
 
 
 
 
51
 
52
  /**
53
  * # WooCommerce Customizer Main Plugin Class
84
 
85
 
86
  /** plugin version number */
87
+ const VERSION = '1.2.0.1';
88
+
89
+ /** @var \WC_Customizer_Settings instance */
90
+ public $settings;
91
 
92
  /** var array the active filters */
93
  public $filters;
96
  /**
97
  * Initializes the plugin
98
  *
99
+ * @since 1.0.0
100
  */
101
  public function __construct() {
102
 
106
  // admin
107
  if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
108
 
109
+ // load settings page
110
+ add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_settings_page' ) );
111
 
112
  // add a 'Configure' link to the plugin action links
113
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_plugin_action_links' ) );
120
  }
121
 
122
 
123
+ /**
124
+ * Add settings page
125
+ *
126
+ * @since 2.0.0
127
+ * @param array $settings
128
+ * @return array
129
+ */
130
+ public function add_settings_page( $settings ) {
131
+
132
+ $settings[] = require_once( 'includes/class-wc-customizer-settings.php' );
133
+ return $settings;
134
+ }
135
+
136
+
137
  /**
138
  * Load customizations after WC is loaded so the version can be checked
139
  *
140
+ * @since 1.2.0
141
  */
142
  public function load_customizations() {
143
 
150
  foreach ( $this->filters as $filter_name => $filter_value ) {
151
 
152
  // WC 2.1 changed the add to cart text filter signatures so conditionally add the new filters
153
+ if ( false !== strpos( $filter_name, 'add_to_cart_text' ) ) {
154
 
155
  if ( $filter_name == 'single_add_to_cart_text' ) {
156
 
166
  add_filter( $filter_name, array( $this, 'customize' ) );
167
  }
168
  }
 
 
 
169
  }
170
  }
171
 
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  /**
174
  * Handle localization, WPML compatible
175
  *
176
+ * @since 1.1.0
177
  */
178
  public function load_translation() {
179
 
180
  // localization in the init action for WPML support
181
+ load_plugin_textdomain( 'woocommerce-customizer', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n/languages' );
182
  }
183
 
184
 
188
  /**
189
  * Add hook to selected filters
190
  *
191
+ * @since 1.0.0
192
  * @return string $filter_value value to use for selected hook
193
  */
194
  public function customize() {
196
  $current_filter = current_filter();
197
 
198
  if ( isset( $this->filters[ $current_filter ] ) ) {
199
+
200
+ if ( 'customizer_true' === $this->filters[ $current_filter] || 'customizer_true' === $this->filters[ $current_filter] ) {
201
+
202
+ // helper to return a pure boolean value
203
+ return 'customizer_true' === $this->filters[ $current_filter ];
204
+
205
+ } else {
206
+
207
+ return $this->filters[ $current_filter ];
208
+ }
209
  }
210
 
211
  // no need to return a value passed in, because if a filter is set, it's designed to only return that value
213
 
214
 
215
  /**
216
+ * Apply the single add to cart button text customization
217
  *
218
+ * @since 1.2.0
 
 
219
  */
220
  public function customize_single_add_to_cart_text() {
221
 
224
 
225
 
226
  /**
227
+ * Apply the shop loop add to cart button text customization
 
 
 
 
 
228
  *
229
+ * @since 1.2.0
230
  * @param string $text add to cart text
231
  * @param WC_Product $product product object
232
  * @return string modified add to cart text
271
  * Return the plugin action links. This will only be called if the plugin
272
  * is active.
273
  *
274
+ * @since 1.0.0
275
  * @param array $actions associative array of action names to anchor tags
276
  * @return array associative array of plugin action links
277
  */
278
  public function add_plugin_action_links( $actions ) {
279
 
280
  $custom_actions = array(
281
+ 'configure' => sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=wc-settings&tab=customizer&section=shop_loop' ), __( 'Configure', 'woocommerce-customizer' ) ),
282
+ 'faq' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/plugins/woocommerce-customizer/faq/', __( 'FAQ', 'woocommerce-customizer' ) ),
283
+ 'support' => sprintf( '<a href="%s">%s</a>', 'http://wordpress.org/support/plugin/woocommerce-customizer', __( 'Support', 'woocommerce-customizer' ) ),
284
  );
285
 
286
  // add the links to the front of the actions list
294
  /**
295
  * Run every time. Used since the activation hook is not executed when updating a plugin
296
  *
297
+ * @since 1.1.0
298
  */
299
  private function install() {
300
 
317
  /**
318
  * Perform any version-related changes.
319
  *
320
+ * @since 1.1.0
321
  * @param int $installed_version the currently installed version of the plugin
322
  */
323
  private function upgrade( $installed_version ) {
327
  }
328
 
329
 
330
+ }
331
+
332
+
333
+ /**
334
+ * The WC_Customizer global object
335
+ * @name $wc_customizer
336
+ * @global WC_Customizer $GLOBALS['wc_customizer']
337
+ */
338
+ $GLOBALS['wc_customizer'] = new WC_Customizer();