Version Description
- Fix: Error when attempting to upgrade when no fonts were used.
- Fix: Issue that would cause saved CSS and previews to not completely apply when a Standard Font with a space in the name was selected.
- Fix: Some translations would cause CSS to not output completely.
- Fix: Issue with IIS servers that would cause Google Fonts to not appear. Thanks @Rivanni for the error report.
Download this release
Release Info
Developer | pdclark |
Plugin | Styles |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- classes/styles-css.php +11 -0
- classes/styles-font-menu/classes/sfm-group-standard.php +1 -1
- classes/styles-font-menu/classes/sfm-plugin.php +3 -3
- classes/styles-upgrade.php +10 -2
- classes/upgrade/1.1.0.php +12 -5
- classes/upgrade/1.1.3.php +147 -0
- readme.txt +15 -5
- styles.php +1 -1
classes/styles-css.php
CHANGED
@@ -57,6 +57,14 @@ class Styles_CSS {
|
|
57 |
public function get_css() {
|
58 |
global $wp_customize;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$css = '';
|
61 |
|
62 |
$this->plugin->customize_register( $wp_customize );
|
@@ -81,6 +89,9 @@ class Styles_CSS {
|
|
81 |
|
82 |
update_option( Styles_Helpers::get_option_key( 'css' ), $css );
|
83 |
|
|
|
|
|
|
|
84 |
return $css;
|
85 |
|
86 |
}
|
57 |
public function get_css() {
|
58 |
global $wp_customize;
|
59 |
|
60 |
+
/**
|
61 |
+
* Make sure not PHP output occurs during CSS output.
|
62 |
+
* Related to unknown translation warning.
|
63 |
+
* @link https://github.com/stylesplugin/styles/issues/42
|
64 |
+
*/
|
65 |
+
$display_errors = ini_get( 'display_errors' );
|
66 |
+
ini_set( 'display_errors', '0' );
|
67 |
+
|
68 |
$css = '';
|
69 |
|
70 |
$this->plugin->customize_register( $wp_customize );
|
89 |
|
90 |
update_option( Styles_Helpers::get_option_key( 'css' ), $css );
|
91 |
|
92 |
+
// Restore default error display setting.
|
93 |
+
ini_set( 'display_errors', $display_errors );
|
94 |
+
|
95 |
return $css;
|
96 |
|
97 |
}
|
classes/styles-font-menu/classes/sfm-group-standard.php
CHANGED
@@ -5,7 +5,7 @@ class SFM_Group_Standard extends SFM_Group {
|
|
5 |
/**
|
6 |
* @var array Font name (key) => font-family stack (value)
|
7 |
*/
|
8 |
-
protected $font_data = array( 'Arial' => 'Arial, Helvetica, sans-serif', 'Bookman' => 'Bookman, Palatino, Georgia, serif', 'Century Gothic' => '
|
9 |
|
10 |
/**
|
11 |
* @var string|bool If @imports are needed, this holds the template. Else, false.
|
5 |
/**
|
6 |
* @var array Font name (key) => font-family stack (value)
|
7 |
*/
|
8 |
+
protected $font_data = array( 'Arial' => 'Arial, Helvetica, sans-serif', 'Bookman' => 'Bookman, Palatino, Georgia, serif', 'Century Gothic' => '\'Century Gothic\', Helvetica, Arial, sans-serif', 'Comic Sans MS' => '\'Comic Sans MS\', Arial, sans-serif', 'Courier' => 'Courier, monospace', 'Garamond' => 'Garamond, Palatino, Georgia, serif', 'Georgia' => 'Georgia, Times, serif', 'Helvetica' => 'Helvetica, Arial, sans-serif', 'Lucida Grande' => '\'Lucida Grande\',\'Lucida Sans Unicode\',Tahoma,Verdana,sans-serif', 'Palatino' => 'Palatino, Georgia, serif', 'Tahoma' => 'Tahoma, Verdana, Helvetica, sans-serif', 'Times' => 'Times, Georgia, serif', 'Trebuchet MS' => '\'Trebuchet MS\', Tahoma, Helvetica, sans-serif', 'Verdana' => 'Verdana, Tahoma, sans-serif', );
|
9 |
|
10 |
/**
|
11 |
* @var string|bool If @imports are needed, this holds the template. Else, false.
|
classes/styles-font-menu/classes/sfm-plugin.php
CHANGED
@@ -105,10 +105,10 @@ class SFM_Plugin {
|
|
105 |
* Initial setup. Called by get_instance.
|
106 |
*/
|
107 |
protected function init() {
|
108 |
-
// Fix for IIS
|
109 |
-
$normalized_abspath = str_replace(array('/', '\\'),
|
110 |
|
111 |
-
$this->plugin_directory = str_replace(array('/', '\\'),
|
112 |
$this->plugin_url = site_url( str_replace( $normalized_abspath, '', $this->plugin_directory ) );
|
113 |
$this->plugin_basename = plugin_basename( $this->plugin_directory . '/plugin.php' );
|
114 |
|
105 |
* Initial setup. Called by get_instance.
|
106 |
*/
|
107 |
protected function init() {
|
108 |
+
// Fix for IIS paths
|
109 |
+
$normalized_abspath = str_replace(array('/', '\\'), '/', ABSPATH );
|
110 |
|
111 |
+
$this->plugin_directory = str_replace(array('/', '\\'), '/', dirname( dirname( __FILE__ ) ) );
|
112 |
$this->plugin_url = site_url( str_replace( $normalized_abspath, '', $this->plugin_directory ) );
|
113 |
$this->plugin_basename = plugin_basename( $this->plugin_directory . '/plugin.php' );
|
114 |
|
classes/styles-upgrade.php
CHANGED
@@ -15,7 +15,7 @@ class Styles_Upgrade {
|
|
15 |
*
|
16 |
* @var string
|
17 |
**/
|
18 |
-
var $db_version = '1.1';
|
19 |
|
20 |
public function __construct() {
|
21 |
$this->plugin = Styles_Plugin::get_instance();
|
@@ -42,7 +42,15 @@ class Styles_Upgrade {
|
|
42 |
// Check for additional upgrade
|
43 |
$this->check_upgrade();
|
44 |
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
}
|
48 |
|
15 |
*
|
16 |
* @var string
|
17 |
**/
|
18 |
+
var $db_version = '1.1.3';
|
19 |
|
20 |
public function __construct() {
|
21 |
$this->plugin = Styles_Plugin::get_instance();
|
42 |
// Check for additional upgrade
|
43 |
$this->check_upgrade();
|
44 |
|
45 |
+
}else if ( $this->version_compare ( array( '1.1.0' => '>', '1.1.3' => '<' ) ) ) {
|
46 |
+
|
47 |
+
// Upgrades for versions below 1.1.3
|
48 |
+
require_once dirname(__FILE__) . '/upgrade/1.1.3.php';
|
49 |
+
|
50 |
+
// Check for additional upgrade
|
51 |
+
$this->check_upgrade();
|
52 |
+
|
53 |
+
}
|
54 |
|
55 |
}
|
56 |
|
classes/upgrade/1.1.0.php
CHANGED
@@ -3,8 +3,6 @@
|
|
3 |
* Upgrades from versions below 1.1.0
|
4 |
*/
|
5 |
|
6 |
-
new Styles_Upgrade_1_1_0();
|
7 |
-
|
8 |
class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
9 |
|
10 |
/**
|
@@ -65,7 +63,7 @@ class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
|
65 |
|
66 |
$option_keys = $wpdb->get_col( $query );
|
67 |
|
68 |
-
foreach( $option_keys as $option_key ) {
|
69 |
|
70 |
$this->old_options = $this->backup_before_upgrade( $option_key, '1.1.0' );
|
71 |
|
@@ -85,8 +83,15 @@ class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
|
85 |
|
86 |
$groups = get_option( $option_key );
|
87 |
|
|
|
|
|
|
|
|
|
88 |
foreach( $groups as $group_id => &$fields ) {
|
89 |
foreach( $fields as $field_id => &$values ) {
|
|
|
|
|
|
|
90 |
|
91 |
if(
|
92 |
'_text' !== substr( $field_id, -5 ) // Only process text fields
|
@@ -119,7 +124,7 @@ class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
|
119 |
|
120 |
public function upgrade_standard_fonts( $values ) {
|
121 |
$standard_fonts = $this->font_menu->standard_fonts->get_fonts();
|
122 |
-
foreach( $standard_fonts as $font ) {
|
123 |
if ( $values['font_family'] == $font->name ) {
|
124 |
|
125 |
return $font->__tostring();
|
@@ -133,7 +138,7 @@ class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
|
133 |
public function upgrade_google_fonts( $values ) {
|
134 |
$google_fonts = $this->font_menu->google_fonts->get_fonts();
|
135 |
|
136 |
-
foreach( $google_fonts as $font ) {
|
137 |
if ( $values['font_family'] == $font->name ) {
|
138 |
|
139 |
return $font->__tostring();
|
@@ -163,3 +168,5 @@ class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
|
163 |
}
|
164 |
|
165 |
}
|
|
|
|
3 |
* Upgrades from versions below 1.1.0
|
4 |
*/
|
5 |
|
|
|
|
|
6 |
class Styles_Upgrade_1_1_0 extends Styles_Upgrade {
|
7 |
|
8 |
/**
|
63 |
|
64 |
$option_keys = $wpdb->get_col( $query );
|
65 |
|
66 |
+
foreach( (array) $option_keys as $option_key ) {
|
67 |
|
68 |
$this->old_options = $this->backup_before_upgrade( $option_key, '1.1.0' );
|
69 |
|
83 |
|
84 |
$groups = get_option( $option_key );
|
85 |
|
86 |
+
if ( !is_array( $groups ) ) {
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
foreach( $groups as $group_id => &$fields ) {
|
91 |
foreach( $fields as $field_id => &$values ) {
|
92 |
+
if ( !is_array( $fields ) ) {
|
93 |
+
continue;
|
94 |
+
}
|
95 |
|
96 |
if(
|
97 |
'_text' !== substr( $field_id, -5 ) // Only process text fields
|
124 |
|
125 |
public function upgrade_standard_fonts( $values ) {
|
126 |
$standard_fonts = $this->font_menu->standard_fonts->get_fonts();
|
127 |
+
foreach( (array) $standard_fonts as $font ) {
|
128 |
if ( $values['font_family'] == $font->name ) {
|
129 |
|
130 |
return $font->__tostring();
|
138 |
public function upgrade_google_fonts( $values ) {
|
139 |
$google_fonts = $this->font_menu->google_fonts->get_fonts();
|
140 |
|
141 |
+
foreach( (array) $google_fonts as $font ) {
|
142 |
if ( $values['font_family'] == $font->name ) {
|
143 |
|
144 |
return $font->__tostring();
|
168 |
}
|
169 |
|
170 |
}
|
171 |
+
|
172 |
+
new Styles_Upgrade_1_1_0();
|
classes/upgrade/1.1.3.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Upgrades from versions below 1.1.3
|
4 |
+
*
|
5 |
+
* Rebuilds CSS.
|
6 |
+
* Standard font-families with spaces have been fixed.
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Styles_Upgrade_1_1_3 extends Styles_Upgrade {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* New version number to set when this upgrade is over.
|
13 |
+
* This must be correct, or the updater will run in an infinite loop.
|
14 |
+
*
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
const NEW_DB_VERSION = '1.1.3';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var array Options before the upgrade scripts.
|
21 |
+
*/
|
22 |
+
var $old_options;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var SFM_Plugin Instance of Styles Font Menu
|
26 |
+
*/
|
27 |
+
var $font_menu;
|
28 |
+
|
29 |
+
function __construct() {
|
30 |
+
parent::__construct();
|
31 |
+
|
32 |
+
require_once dirname( dirname( __FILE__ ) ) . '/styles-font-menu/plugin.php';
|
33 |
+
$this->font_menu = SFM_Plugin::get_instance();
|
34 |
+
|
35 |
+
// Defined in parent class.
|
36 |
+
// Runs $this->upgrade_site() on single site or all sites in network.
|
37 |
+
$this->upgrade_network();
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Find all theme options in this site and run updates
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function upgrade_site() {
|
46 |
+
global $wpdb;
|
47 |
+
|
48 |
+
$plugin = Styles_Plugin::get_instance();
|
49 |
+
|
50 |
+
// Get option keys for all Styles theme settings
|
51 |
+
$query = "SELECT option_name
|
52 |
+
FROM $wpdb->options
|
53 |
+
WHERE option_name LIKE 'storm-styles-%'
|
54 |
+
AND option_name NOT LIKE 'storm-styles-%-css'
|
55 |
+
";
|
56 |
+
|
57 |
+
$option_keys = $wpdb->get_col( $query );
|
58 |
+
|
59 |
+
foreach( (array) $option_keys as $option_key ) {
|
60 |
+
|
61 |
+
$this->old_options = $this->backup_before_upgrade( $option_key, self::NEW_DB_VERSION );
|
62 |
+
|
63 |
+
$this->upgrade_font_families( $option_key );
|
64 |
+
}
|
65 |
+
|
66 |
+
// Rebuild CSS
|
67 |
+
add_filter( 'styles_force_rebuild', '__return_true' );
|
68 |
+
$plugin->get_css();
|
69 |
+
|
70 |
+
// This must be updated to avoid the updater running in an infinite loop
|
71 |
+
$plugin->set_option( 'db_version', self::NEW_DB_VERSION );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Upgrade standard fonts to fix font-family quote output.
|
76 |
+
* @param string $option_key Option key in wp_options
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
public function upgrade_font_families( $option_key ) {
|
80 |
+
|
81 |
+
$groups = get_option( $option_key );
|
82 |
+
|
83 |
+
if ( !is_array( $groups ) ) {
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
|
87 |
+
foreach( $groups as $group_id => &$fields ) {
|
88 |
+
foreach( $fields as $field_id => &$values ) {
|
89 |
+
if ( !is_array( $fields ) ) {
|
90 |
+
continue;
|
91 |
+
}
|
92 |
+
|
93 |
+
if(
|
94 |
+
'_text' !== substr( $field_id, -5 ) // Only process text fields
|
95 |
+
|| !isset( $values['font_family'] ) // Avoid notice that should never happen
|
96 |
+
|| empty( $values['font_family'] ) // Skip empty fields
|
97 |
+
) {
|
98 |
+
continue;
|
99 |
+
}
|
100 |
+
|
101 |
+
$new_font_family = $this->upgrade_standard_fonts( $values );
|
102 |
+
|
103 |
+
if ( $new_font_family ) {
|
104 |
+
$values['font_family'] = $new_font_family;
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
update_option( $option_key, $groups );
|
111 |
+
}
|
112 |
+
|
113 |
+
public function upgrade_standard_fonts( $values ) {
|
114 |
+
$standard_fonts = $this->font_menu->standard_fonts->get_fonts();
|
115 |
+
|
116 |
+
$fonts_to_upgrade = array(
|
117 |
+
'Century Gothic',
|
118 |
+
'Comic Sans MS',
|
119 |
+
'Lucida Grande',
|
120 |
+
'Trebuchet MS',
|
121 |
+
);
|
122 |
+
|
123 |
+
$upgrade_font = false;
|
124 |
+
|
125 |
+
foreach( $fonts_to_upgrade as $font ) {
|
126 |
+
// These fonts have incorrect double-quotes
|
127 |
+
if ( false !== strpos( $values['font_family'], '""' . $font . '"' ) ) {
|
128 |
+
$upgrade_font = $font;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( !empty( $upgrade_font ) ) {
|
133 |
+
foreach( (array) $standard_fonts as $font ) {
|
134 |
+
if ( $upgrade_font == $font->name ) {
|
135 |
+
|
136 |
+
return $font->__tostring();
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
new Styles_Upgrade_1_1_3();
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Plugin URI: http://stylesplugin.com
|
|
4 |
Author URI: http://brainstormmedia.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,9 +91,16 @@ No! Styles is very careful about only loading what is needed to get its job done
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
= 1.1.2 =
|
95 |
|
96 |
-
* Fix:
|
97 |
|
98 |
= 1.1.1 =
|
99 |
|
@@ -241,6 +248,9 @@ No! Styles is very careful about only loading what is needed to get its job done
|
|
241 |
|
242 |
== Upgrade Notice ==
|
243 |
|
244 |
-
= 1.1.
|
245 |
|
246 |
-
* Fix:
|
|
|
|
|
|
4 |
Author URI: http://brainstormmedia.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.7.1
|
8 |
+
Stable tag: 1.1.3
|
9 |
|
10 |
Be creative with colors and fonts. Styles changes everything.
|
11 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 1.1.3 =
|
95 |
+
|
96 |
+
* Fix: Error when attempting to upgrade when no fonts were used.
|
97 |
+
* Fix: Issue that would cause saved CSS and previews to not completely apply when a Standard Font with a space in the name was selected.
|
98 |
+
* Fix: Some translations would cause CSS to not output completely.
|
99 |
+
* Fix: Issue with IIS servers that would cause Google Fonts to not appear. Thanks [@Rivanni](http://wordpress.org/support/topic/version-111-appears-as-version-105-still-no-google-fonts) for the error report.
|
100 |
+
|
101 |
= 1.1.2 =
|
102 |
|
103 |
+
* Fix: Attempted fix for IIS servers.
|
104 |
|
105 |
= 1.1.1 =
|
106 |
|
248 |
|
249 |
== Upgrade Notice ==
|
250 |
|
251 |
+
= 1.1.3 =
|
252 |
|
253 |
+
* Fix: Error when attempting to upgrade when no fonts were used.
|
254 |
+
* Fix: Issue that would cause saved CSS and previews to not completely apply when a Standard Font with a space in the name was selected.
|
255 |
+
* Fix: Some translations would cause CSS to not output completely.
|
256 |
+
* Fix: Issue with IIS servers that would cause Google Fonts to not appear. Thanks [@Rivanni](http://wordpress.org/support/topic/version-111-appears-as-version-105-still-no-google-fonts) for the error report.
|
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: Brainstorm Media
|
8 |
Author URI: http://brainstormmedia.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.3
|
7 |
Author: Brainstorm Media
|
8 |
Author URI: http://brainstormmedia.com
|
9 |
License: GPLv2
|