Version Description
- Fix: Resolve issues with option to reset settings. Thanks [@violacase](http://wordpress.org/support/topic/reset-with-stylestwentyfourteen] @JiveDig for the reports.
Download this release
Release Info
Developer | pdclark |
Plugin | Styles |
Version | 1.1.8 |
Comparing to | |
See all releases |
Code changes from version 1.1.7 to 1.1.8
- classes/styles-admin.php +66 -13
- readme.txt +9 -6
- styles.php +1 -1
classes/styles-admin.php
CHANGED
@@ -30,6 +30,7 @@ class Styles_Admin {
|
|
30 |
'twentyeleven',
|
31 |
'twentytwelve',
|
32 |
'twentythirteen',
|
|
|
33 |
);
|
34 |
|
35 |
function __construct( $plugin ) {
|
@@ -98,8 +99,8 @@ class Styles_Admin {
|
|
98 |
),
|
99 |
|
100 |
'delete_settings' => array(
|
101 |
-
'title' => __( 'Reset Settings', 'styles' ),
|
102 |
-
'description' => __( 'Type
|
103 |
'default' => '',
|
104 |
'type' => 'input',
|
105 |
'section' => 'general',
|
@@ -223,11 +224,38 @@ class Styles_Admin {
|
|
223 |
// Combine input with general settings
|
224 |
$input = array_merge( (array) get_option('storm-styles'), $input );
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
$input['delete_settings'] = false;
|
229 |
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
|
233 |
// Todo: Sanatize.
|
@@ -352,6 +380,15 @@ class Styles_Admin {
|
|
352 |
* Output all notices that have been added to the $this->notices array
|
353 |
*/
|
354 |
public function admin_notices() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
foreach( $this->notices as $key => $message ) {
|
356 |
echo "<div class='updated fade' id='styles-$key'>$message</div>";
|
357 |
}
|
@@ -374,7 +411,6 @@ class Styles_Admin {
|
|
374 |
global $wpdb;
|
375 |
|
376 |
if( is_multisite() ){
|
377 |
-
|
378 |
// Site network: remove options from each blog
|
379 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
380 |
if( $blog_ids ){
|
@@ -383,9 +419,7 @@ class Styles_Admin {
|
|
383 |
switch_to_blog( $id );
|
384 |
|
385 |
// $wpdb->options is new for each blog, so we're duplicating SQL in the loop
|
386 |
-
$
|
387 |
-
$sql = "DELETE from $wpdb->options WHERE option_name LIKE '\_transient%storm-styles-%'";
|
388 |
-
$wpdb->query( $sql );
|
389 |
|
390 |
restore_current_blog();
|
391 |
}
|
@@ -393,9 +427,28 @@ class Styles_Admin {
|
|
393 |
}
|
394 |
|
395 |
}else {
|
396 |
-
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
$wpdb->query( $sql );
|
400 |
}
|
401 |
|
30 |
'twentyeleven',
|
31 |
'twentytwelve',
|
32 |
'twentythirteen',
|
33 |
+
'twentyfourteen',
|
34 |
);
|
35 |
|
36 |
function __construct( $plugin ) {
|
99 |
),
|
100 |
|
101 |
'delete_settings' => array(
|
102 |
+
'title' => __( 'Reset Customizer Settings', 'styles' ),
|
103 |
+
'description' => __( 'Type RESET into this field and save to verify a reset of all Styles Customizer settings.', 'styles' ),
|
104 |
'default' => '',
|
105 |
'type' => 'input',
|
106 |
'section' => 'general',
|
224 |
// Combine input with general settings
|
225 |
$input = array_merge( (array) get_option('storm-styles'), $input );
|
226 |
|
227 |
+
// RESET settings
|
228 |
+
if ( isset( $input['delete_settings'] ) ) {
|
|
|
229 |
|
230 |
+
if ( 'RESET' == $input['delete_settings'] ) {
|
231 |
+
|
232 |
+
$this->delete_settings();
|
233 |
+
|
234 |
+
// Display of admin message after redirect
|
235 |
+
$input['delete_settings'] = 'done';
|
236 |
+
|
237 |
+
}else if ( 'done' !== $input['delete_settings'] ) {
|
238 |
+
|
239 |
+
$input['delete_settings'] = false;
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
// Debug mode: 0 or 1
|
246 |
+
if ( isset( $input['debug_mode'] ) ) {
|
247 |
+
$input['debug_mode'] = preg_replace( '[^01]', '', $input['debug_mode'] );
|
248 |
+
}
|
249 |
+
if ( empty( $input['debug_mode'] ) ) {
|
250 |
+
$input['debug_mode'] = '0';
|
251 |
+
}
|
252 |
+
|
253 |
+
// Remove keys that aren't strings.
|
254 |
+
// Unknown cause -- maybe array_merge above?
|
255 |
+
foreach( $input as $key => $value ) {
|
256 |
+
if ( is_int( $key ) ) {
|
257 |
+
unset( $input[ $key ] );
|
258 |
+
}
|
259 |
}
|
260 |
|
261 |
// Todo: Sanatize.
|
380 |
* Output all notices that have been added to the $this->notices array
|
381 |
*/
|
382 |
public function admin_notices() {
|
383 |
+
$options = get_option( 'storm-styles' );
|
384 |
+
|
385 |
+
// Add notice if settings were deleted on previous page during input validation.
|
386 |
+
if ( isset( $options['delete_settings'] ) && 'done' == $options['delete_settings'] ) {
|
387 |
+
$this->notices[] = '<p>Styles Customizer settings have been reset to defaults.</p>';
|
388 |
+
$options['delete_settings'] = false;
|
389 |
+
update_option( 'storm-styles', $options );
|
390 |
+
}
|
391 |
+
|
392 |
foreach( $this->notices as $key => $message ) {
|
393 |
echo "<div class='updated fade' id='styles-$key'>$message</div>";
|
394 |
}
|
411 |
global $wpdb;
|
412 |
|
413 |
if( is_multisite() ){
|
|
|
414 |
// Site network: remove options from each blog
|
415 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
416 |
if( $blog_ids ){
|
419 |
switch_to_blog( $id );
|
420 |
|
421 |
// $wpdb->options is new for each blog, so we're duplicating SQL in the loop
|
422 |
+
$this->delete_settings_single_site();
|
|
|
|
|
423 |
|
424 |
restore_current_blog();
|
425 |
}
|
427 |
}
|
428 |
|
429 |
}else {
|
430 |
+
$this->delete_settings_single_site();
|
431 |
+
}
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
protected function delete_settings_single_site() {
|
436 |
+
global $wpdb;
|
437 |
+
|
438 |
+
$option_values = array(
|
439 |
+
'= "_transient_styles_child_plugins"',
|
440 |
+
'= "_transient_timeout_styles_child_plugins"',
|
441 |
+
'= "_site_transient_styles_child_plugins"',
|
442 |
+
'= "_site_transient_timeout_styles_child_plugins"',
|
443 |
+
'= "_transient_styles_google_font_data"',
|
444 |
+
'= "_transient_timeout_styles_google_font_data"',
|
445 |
+
// '= "storm-styles"', // Don't delete main settings, because it stores reset status.
|
446 |
+
'LIKE "storm-styles-%"', // Must have hyphen to avoid main settings
|
447 |
+
'LIKE "\_transient%storm-styles-%"'
|
448 |
+
);
|
449 |
+
|
450 |
+
foreach ( $option_values as $value ) {
|
451 |
+
$sql = "DELETE from $wpdb->options WHERE option_name $value";
|
452 |
$wpdb->query( $sql );
|
453 |
}
|
454 |
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Styles ===
|
2 |
-
Contributors:
|
3 |
Plugin URI: http://stylesplugin.com
|
4 |
Author URI: http://pdclark.com
|
5 |
Tags: css, stylesheet, appearance, customize, customizer, colors, color picker, background, fonts, google fonts, user interface, twenty ten, twenty eleven, twenty twelve, twenty thirteen
|
6 |
Requires at least: 3.4
|
7 |
-
Tested up to: 3.
|
8 |
-
Stable tag: 1.1.
|
9 |
|
10 |
Be creative with colors and fonts. Styles changes everything.
|
11 |
|
@@ -91,6 +91,10 @@ No! Styles is very careful about only loading what is needed to get its job done
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
94 |
= 1.1.7 =
|
95 |
|
96 |
* New: Option to reset all settings.
|
@@ -267,7 +271,6 @@ No! Styles is very careful about only loading what is needed to get its job done
|
|
267 |
|
268 |
== Upgrade Notice ==
|
269 |
|
270 |
-
= 1.1.
|
271 |
|
272 |
-
*
|
273 |
-
* New: Option to enable debug mode to help when responding to support tickets.
|
1 |
=== Styles ===
|
2 |
+
Contributors: pdclark, elusivelight, 10up
|
3 |
Plugin URI: http://stylesplugin.com
|
4 |
Author URI: http://pdclark.com
|
5 |
Tags: css, stylesheet, appearance, customize, customizer, colors, color picker, background, fonts, google fonts, user interface, twenty ten, twenty eleven, twenty twelve, twenty thirteen
|
6 |
Requires at least: 3.4
|
7 |
+
Tested up to: 3.9
|
8 |
+
Stable tag: 1.1.8
|
9 |
|
10 |
Be creative with colors and fonts. Styles changes everything.
|
11 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 1.1.8 =
|
95 |
+
|
96 |
+
* Fix: Resolve issues with option to reset settings. Thanks [@violacase](http://wordpress.org/support/topic/reset-with-stylestwentyfourteen] [@JiveDig](https://github.com/JiveDig) for the reports.
|
97 |
+
|
98 |
= 1.1.7 =
|
99 |
|
100 |
* New: Option to reset all settings.
|
271 |
|
272 |
== Upgrade Notice ==
|
273 |
|
274 |
+
= 1.1.8 =
|
275 |
|
276 |
+
* Fix: Resolve issues with option to reset settings. Thanks [@violacase](http://wordpress.org/support/topic/reset-with-stylestwentyfourteen] [@JiveDig](https://github.com/JiveDig) for the reports.
|
|
styles.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Styles
|
4 |
Plugin URI: http://stylesplugin.com
|
5 |
Description: Change the appearance of your theme using the <a href="customize.php">WordPress Customizer</a>. Styles changes everything.
|
6 |
-
Version: 1.1.
|
7 |
Author: Paul Clark, 10up
|
8 |
Author URI: http://pdclark.com
|
9 |
License: GPLv2
|
3 |
Plugin Name: Styles
|
4 |
Plugin URI: http://stylesplugin.com
|
5 |
Description: Change the appearance of your theme using the <a href="customize.php">WordPress Customizer</a>. Styles changes everything.
|
6 |
+
Version: 1.1.8
|
7 |
Author: Paul Clark, 10up
|
8 |
Author URI: http://pdclark.com
|
9 |
License: GPLv2
|