Version Description
- Better handle legacy font values upon upgrade.
Download this release
Release Info
Developer | pixelgrade |
Plugin | Customify – A Theme Customizer Booster |
Version | 2.7.2 |
Comparing to | |
See all releases |
Code changes from version 2.7.1 to 2.7.2
customify.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Customify
|
4 |
* Plugin URI: https://wordpress.org/plugins/customify/
|
5 |
* Description: A Theme Customizer Booster to easily and consistently customize Fonts, Colors, and other options for your site.
|
6 |
-
* Version: 2.7.
|
7 |
* Author: Pixelgrade
|
8 |
* Author URI: https://pixelgrade.com
|
9 |
* Author Email: contact@pixelgrade.com
|
@@ -33,7 +33,7 @@ require_once 'includes/extras.php';
|
|
33 |
function PixCustomifyPlugin() {
|
34 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-pixcustomify.php';
|
35 |
|
36 |
-
return PixCustomifyPlugin::instance( __FILE__, '2.7.
|
37 |
}
|
38 |
|
39 |
// Now get the party started.
|
3 |
* Plugin Name: Customify
|
4 |
* Plugin URI: https://wordpress.org/plugins/customify/
|
5 |
* Description: A Theme Customizer Booster to easily and consistently customize Fonts, Colors, and other options for your site.
|
6 |
+
* Version: 2.7.2
|
7 |
* Author: Pixelgrade
|
8 |
* Author URI: https://pixelgrade.com
|
9 |
* Author Email: contact@pixelgrade.com
|
33 |
function PixCustomifyPlugin() {
|
34 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-pixcustomify.php';
|
35 |
|
36 |
+
return PixCustomifyPlugin::instance( __FILE__, '2.7.2' );
|
37 |
}
|
38 |
|
39 |
// Now get the party started.
|
features/customizer/controls/class-Pix_Customize_Font_Control.php
CHANGED
@@ -99,7 +99,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
99 |
* @param mixed $value
|
100 |
* @param WP_Customize_Setting $setting
|
101 |
*
|
102 |
-
* @return
|
103 |
*/
|
104 |
public function standardizeSettingValue( $value ) {
|
105 |
$value = Customify_Fonts_Global::maybeDecodeValue( $value );
|
99 |
* @param mixed $value
|
100 |
* @param WP_Customize_Setting $setting
|
101 |
*
|
102 |
+
* @return array
|
103 |
*/
|
104 |
public function standardizeSettingValue( $value ) {
|
105 |
$value = Customify_Fonts_Global::maybeDecodeValue( $value );
|
includes/class-customify-fonts-global.php
CHANGED
@@ -187,16 +187,6 @@ class Customify_Fonts_Global {
|
|
187 |
|
188 |
// If we have a `font` field configuration, we have work to do.
|
189 |
if ( isset( $item['type'] ) && 'font' === $item['type'] ) {
|
190 |
-
// We want to standardize the default value, if present.
|
191 |
-
if ( ! empty( $item['default'] ) ) {
|
192 |
-
$item['default'] = self::standardizeFontValue( $item['default'] );
|
193 |
-
}
|
194 |
-
|
195 |
-
// We want to standardize the selector(s), if present.
|
196 |
-
if ( ! empty( $item['selector'] ) ) {
|
197 |
-
$item['selector'] = self::standardizeFontSelector( $item['selector'] );
|
198 |
-
}
|
199 |
-
|
200 |
// Standardize the subfields config.
|
201 |
if ( empty( $item['fields'] ) ) {
|
202 |
$item['fields'] = array();
|
@@ -243,8 +233,19 @@ class Customify_Fonts_Global {
|
|
243 |
}
|
244 |
}
|
245 |
|
|
|
246 |
$item['fields'] = $subfieldsConfig;
|
247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
// We have no reason to go recursively further when we have come across a `font` field configuration.
|
249 |
return;
|
250 |
}
|
@@ -527,7 +528,7 @@ class Customify_Fonts_Global {
|
|
527 |
continue;
|
528 |
}
|
529 |
|
530 |
-
$value = $this->standardizeFontValue( self::maybeDecodeValue( $font['value'] ) );
|
531 |
|
532 |
// In case the value is empty, try a default value if the $font['value'] is actually the font family.
|
533 |
if ( empty( $value ) && is_string( $font['value'] ) ) {
|
@@ -690,7 +691,7 @@ class Customify_Fonts_Global {
|
|
690 |
return '';
|
691 |
}
|
692 |
|
693 |
-
$value = $this->standardizeFontValue( self::maybeDecodeValue( $fontConfig['value'] ) );
|
694 |
|
695 |
// In case the value is empty, try a default value if the $font['value'] is actually the font family.
|
696 |
if ( empty( $value ) && is_string( $fontConfig['value'] ) ) {
|
@@ -1223,10 +1224,11 @@ if (typeof WebFont !== 'undefined') {
|
|
1223 |
* Handle legacy entries.
|
1224 |
*
|
1225 |
* @param array $value
|
|
|
1226 |
*
|
1227 |
* @return array
|
1228 |
*/
|
1229 |
-
public static function standardizeFontValue( $value ) {
|
1230 |
if ( empty( $value ) ) {
|
1231 |
return array();
|
1232 |
}
|
@@ -1299,7 +1301,27 @@ if (typeof WebFont !== 'undefined') {
|
|
1299 |
unset( $value['subsets'] );
|
1300 |
}
|
1301 |
|
1302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1303 |
}
|
1304 |
|
1305 |
/**
|
187 |
|
188 |
// If we have a `font` field configuration, we have work to do.
|
189 |
if ( isset( $item['type'] ) && 'font' === $item['type'] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
// Standardize the subfields config.
|
191 |
if ( empty( $item['fields'] ) ) {
|
192 |
$item['fields'] = array();
|
233 |
}
|
234 |
}
|
235 |
|
236 |
+
// Finally save the new subfields config.
|
237 |
$item['fields'] = $subfieldsConfig;
|
238 |
|
239 |
+
// We want to standardize the selector(s), if present.
|
240 |
+
if ( ! empty( $item['selector'] ) ) {
|
241 |
+
$item['selector'] = self::standardizeFontSelector( $item['selector'] );
|
242 |
+
}
|
243 |
+
|
244 |
+
// We want to standardize the default value, if present.
|
245 |
+
if ( ! empty( $item['default'] ) ) {
|
246 |
+
$item['default'] = self::standardizeFontValue( $item['default'], $item );
|
247 |
+
}
|
248 |
+
|
249 |
// We have no reason to go recursively further when we have come across a `font` field configuration.
|
250 |
return;
|
251 |
}
|
528 |
continue;
|
529 |
}
|
530 |
|
531 |
+
$value = $this->standardizeFontValue( self::maybeDecodeValue( $font['value'] ), $font );
|
532 |
|
533 |
// In case the value is empty, try a default value if the $font['value'] is actually the font family.
|
534 |
if ( empty( $value ) && is_string( $font['value'] ) ) {
|
691 |
return '';
|
692 |
}
|
693 |
|
694 |
+
$value = $this->standardizeFontValue( self::maybeDecodeValue( $fontConfig['value'] ), $fontConfig );
|
695 |
|
696 |
// In case the value is empty, try a default value if the $font['value'] is actually the font family.
|
697 |
if ( empty( $value ) && is_string( $fontConfig['value'] ) ) {
|
1224 |
* Handle legacy entries.
|
1225 |
*
|
1226 |
* @param array $value
|
1227 |
+
* @param array $fontConfig Optional.
|
1228 |
*
|
1229 |
* @return array
|
1230 |
*/
|
1231 |
+
public static function standardizeFontValue( $value, $fontConfig = array() ) {
|
1232 |
if ( empty( $value ) ) {
|
1233 |
return array();
|
1234 |
}
|
1301 |
unset( $value['subsets'] );
|
1302 |
}
|
1303 |
|
1304 |
+
// Finally, we need to correlate the subfields values with the fact that they are allowed or not, just to be safe.
|
1305 |
+
if ( ! empty( $fontConfig['fields'] ) && is_array( $fontConfig['fields'] ) ) {
|
1306 |
+
foreach ( $fontConfig['fields'] as $field => $fieldDetails ) {
|
1307 |
+
if ( false === $fieldDetails ) {
|
1308 |
+
// Need to make sure that there is no entry in the value for this field, since it's disabled.
|
1309 |
+
// Fields configs use dashes, while the value uses underscores.
|
1310 |
+
$fieldValueKey = str_replace( '-', '_', $field );
|
1311 |
+
// We have a special case for the font-weight field; it corresponds to the font_variant value entry.
|
1312 |
+
if ( 'font_weight' === $fieldValueKey ) {
|
1313 |
+
$fieldValueKey = 'font_variant';
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
// Now remove the value entry, if present.
|
1317 |
+
if ( isset( $value[ $fieldValueKey ] ) ) {
|
1318 |
+
unset( $value[ $fieldValueKey ] );
|
1319 |
+
}
|
1320 |
+
}
|
1321 |
+
}
|
1322 |
+
}
|
1323 |
+
|
1324 |
+
return apply_filters( 'customify_standardized_font_value', $value, $fontConfig );
|
1325 |
}
|
1326 |
|
1327 |
/**
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: pixelgrade, vlad.olaru, babbardel, razvanonofrei, gorby31
|
|
3 |
Tags: customizer, css, editor, gutenberg, live, preview, customizer
|
4 |
Requires at least: 4.9.9
|
5 |
Tested up to: 5.4.1
|
6 |
-
Stable tag: 2.7.
|
7 |
Requires PHP: 5.4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -28,6 +28,9 @@ This plugin is **primarily intended** to be used together with [Pixelgrade theme
|
|
28 |
|
29 |
== Changelog ==
|
30 |
|
|
|
|
|
|
|
31 |
= 2.7.1 =
|
32 |
* Fixed a couple of inconsistencies related to cache invalidation
|
33 |
* Added integrations for the main caching plugins to prevent them minifying or moving the Web Font Loader script
|
3 |
Tags: customizer, css, editor, gutenberg, live, preview, customizer
|
4 |
Requires at least: 4.9.9
|
5 |
Tested up to: 5.4.1
|
6 |
+
Stable tag: 2.7.2
|
7 |
Requires PHP: 5.4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
28 |
|
29 |
== Changelog ==
|
30 |
|
31 |
+
= 2.7.2 =
|
32 |
+
* Better handle legacy font values upon upgrade.
|
33 |
+
|
34 |
= 2.7.1 =
|
35 |
* Fixed a couple of inconsistencies related to cache invalidation
|
36 |
* Added integrations for the main caching plugins to prevent them minifying or moving the Web Font Loader script
|