WooCommerce Customizer - Version 1.1.1

Version Description

  • WooCommerce 2.1 Compatibility
Download this release

Release Info

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

Code changes from version 1.1 to 1.1.1

includes/class-wc-customizer-admin.php CHANGED
@@ -61,6 +61,9 @@ class WC_Customizer_Admin {
61
 
62
  // Add 'Customizer' link under WooCommerce menu
63
  add_action( 'admin_menu', array( $this, 'add_menu_link' ) );
 
 
 
64
  }
65
 
66
 
@@ -125,20 +128,6 @@ class WC_Customizer_Admin {
125
 
126
  ?> </h2> <?php
127
 
128
- // save settings
129
- if ( ! empty( $_POST ) ) {
130
-
131
- if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'wc-customizer-settings' ) )
132
- wp_die( __( 'Action failed. Please refresh the page and retry.', 'wc-customizer' ) );
133
-
134
-
135
- $this->save_settings( $this->get_settings( $current_tab ) );
136
-
137
- wp_redirect( add_query_arg( array( 'saved' => 'true' ) ) );
138
-
139
- exit;
140
- }
141
-
142
  // display success message
143
  if ( ! empty( $_GET['saved'] ) )
144
  echo '<div id="message" class="updated fade"><p><strong>' . __( 'Your customizations have been saved.', 'wc-customizer' ) . '</strong></p></div>';
@@ -146,6 +135,8 @@ class WC_Customizer_Admin {
146
  // display filters
147
  $this->render_settings( $this->get_settings( $current_tab ) );
148
 
 
 
149
  submit_button( __( 'Save Customizations', 'wc-customizer' ) );
150
 
151
  wp_nonce_field( 'wc-customizer-settings', '_wpnonce', true, true );
@@ -205,9 +196,25 @@ class WC_Customizer_Admin {
205
  */
206
  public function save_settings( $fields ) {
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  $customizations = get_option( 'wc_customizer_active_customizations' );
209
 
210
- foreach ( $fields as $field ) {
 
 
211
 
212
  if ( ! isset( $field['id'] ) )
213
  continue;
@@ -220,6 +227,10 @@ class WC_Customizer_Admin {
220
  }
221
 
222
  update_option( 'wc_customizer_active_customizations', $customizations );
 
 
 
 
223
  }
224
 
225
 
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
 
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>';
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 );
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;
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
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.6
7
- Stable tag: 1.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -53,6 +53,9 @@ Yes! Fork the plugin on [Github](https://github.com/skyverge/woocommerce-customi
53
 
54
  == Changelog ==
55
 
 
 
 
56
  = 1.1 =
57
  * Refactor to support the upcoming WooCommerce 2.1 beta
58
  * Localization - Text domain changed from `wc_customizer` to `wc-customizer` and loaded properly on `init` hook
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
7
+ Stable tag: 1.1.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
53
 
54
  == Changelog ==
55
 
56
+ = 1.1.1 =
57
+ * WooCommerce 2.1 Compatibility
58
+
59
  = 1.1 =
60
  * Refactor to support the upcoming WooCommerce 2.1 beta
61
  * Localization - Text domain changed from `wc_customizer` to `wc-customizer` and loaded properly on `init` hook
woocommerce-customizer.php CHANGED
@@ -5,7 +5,7 @@
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.1
9
  * Text Domain: wc-customizer
10
  * Domain Path: /languages/
11
  *
@@ -70,7 +70,7 @@ class WC_Customizer {
70
 
71
 
72
  /** plugin version number */
73
- const VERSION = '1.1';
74
 
75
  /** var array the active filters */
76
  public $filters;
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.1.1
9
  * Text Domain: wc-customizer
10
  * Domain Path: /languages/
11
  *
70
 
71
 
72
  /** plugin version number */
73
+ const VERSION = '1.1.1';
74
 
75
  /** var array the active filters */
76
  public $filters;