Version Description
- Fixes related to cache invalidation.
- Improvements to Font Palettes.
- Fixes for missing Customizer theme controls.
Download this release
Release Info
Developer | pixelgrade |
Plugin | Customify – A Theme Customizer Booster |
Version | 2.6.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.9 to 2.6.0
- customify.php +7 -4
- features/customizer/controls/class-Pix_Customize_Background_Control.php +7 -7
- features/customizer/controls/class-Pix_Customize_Font_Control.php +49 -47
- features/customizer/controls/class-Pix_Customize_Preset_Control.php +14 -9
- features/customizer/controls/class-Pix_Customize_Typography_Control.php +7 -7
- includes/class-customify-customizer.php +276 -258
- includes/class-customify-style-manager.php +27 -10
- includes/class-pixcustomify.php +48 -36
- includes/integrations.php +15 -0
- includes/integrations/pixelgrade-assistant.php +16 -0
- includes/integrations/pixelgrade-care.php +16 -0
- includes/lib/class-customify-design-assets.php +3 -6
- readme.txt +360 -355
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 |
* Author: Pixelgrade
|
8 |
* Author URI: https://pixelgrade.com
|
9 |
* Author Email: contact@pixelgrade.com
|
@@ -33,9 +33,12 @@ 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.
|
37 |
}
|
38 |
|
39 |
-
// Now get the party started
|
40 |
-
// We will keep this global variable for legacy
|
41 |
$pixcustomify_plugin = PixCustomifyPlugin();
|
|
|
|
|
|
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.6.0
|
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.6.0' );
|
37 |
}
|
38 |
|
39 |
+
// Now get the party started.
|
40 |
+
// We will keep this global variable for legacy reasons.
|
41 |
$pixcustomify_plugin = PixCustomifyPlugin();
|
42 |
+
|
43 |
+
// Load all third-party plugins integrations.
|
44 |
+
require_once 'includes/integrations.php';
|
features/customizer/controls/class-Pix_Customize_Background_Control.php
CHANGED
@@ -103,11 +103,11 @@ class Pix_Customize_Background_Control extends Pix_Customize_Control {
|
|
103 |
$this->value['background-image'] = '';
|
104 |
}
|
105 |
|
106 |
-
echo '<input placeholder="' . $placeholder . '" type="text" class="customify_background_input background-image ' . $hide . 'upload ' . $this->field['class'] . '" name="' . $this->label . '[background-image]" id="' . $this->manager->options_key . '[' . $this->id . '][background-image]" value="' . $this->value['background-image'] . '" data-select_name="background-image" data-customize-setting-link="' . esc_attr( $this->setting->id ) . '[background-image]"/>';
|
107 |
-
echo '<input type="hidden" class="upload-id ' . $this->field['class'] . '" name="' . $this->manager->options_key . '[media][id]" id="' . $this->manager->options_key . '[' . $this->id . '][media][id]" value="' . $this->value['media']['id'] . '" />';
|
108 |
-
echo '<input type="hidden" class="upload-height" name="' . $this->manager->options_key . '[media][height]" id="' . $this->manager->options_key . '[' . $this->id . '][media][height]" value="' . $this->value['media']['height'] . '" />';
|
109 |
-
echo '<input type="hidden" class="upload-width" name="' . $this->manager->options_key . '[media][width]" id="' . $this->manager->options_key . '[' . $this->id . '][media][width]" value="' . $this->value['media']['width'] . '" />';
|
110 |
-
echo '<input type="hidden" class="upload-thumbnail" name="' . $this->manager->options_key . '[media][thumbnail]" id="' . $this->manager->options_key . '[media][thumbnail]" value="' . $this->value['media']['thumbnail'] . '" />';
|
111 |
|
112 |
//Preview
|
113 |
$hide = '';
|
@@ -135,14 +135,14 @@ class Pix_Customize_Background_Control extends Pix_Customize_Control {
|
|
135 |
echo '<div class="upload_button_div">';
|
136 |
|
137 |
//If the user has WP3.5+ show upload/remove button
|
138 |
-
echo '<span class="button background_upload_button" id="' . $this->id . '-media" data-setting_id="' . $this->setting->id . '" >' .
|
139 |
|
140 |
$hide = '';
|
141 |
if ( empty( $this->value['background-image'] ) || $this->value['background-image'] == '' ) {
|
142 |
$hide = ' hide';
|
143 |
}
|
144 |
|
145 |
-
echo '<span class="button remove-image' . $hide . '" id="reset_' . $this->id . '" rel="' . $this->id . '">' .
|
146 |
|
147 |
echo '</div>';
|
148 |
}
|
103 |
$this->value['background-image'] = '';
|
104 |
}
|
105 |
|
106 |
+
echo '<input placeholder="' . esc_attr( $placeholder ) . '" type="text" class="customify_background_input background-image ' . $hide . 'upload ' . $this->field['class'] . '" name="' . $this->label . '[background-image]" id="' . $this->manager->options_key . '[' . $this->id . '][background-image]" value="' . $this->value['background-image'] . '" data-select_name="background-image" data-customize-setting-link="' . esc_attr( $this->setting->id ) . '[background-image]"/>';
|
107 |
+
echo '<input type="hidden" class="upload-id ' . esc_attr( $this->field['class'] ) . '" name="' . esc_attr( $this->manager->options_key ) . '[media][id]" id="' . $this->manager->options_key . '[' . $this->id . '][media][id]" value="' . esc_attr( $this->value['media']['id'] ) . '" />';
|
108 |
+
echo '<input type="hidden" class="upload-height" name="' . esc_attr( $this->manager->options_key ) . '[media][height]" id="' . esc_attr( $this->manager->options_key ) . '[' . $this->id . '][media][height]" value="' . esc_attr( $this->value['media']['height'] ) . '" />';
|
109 |
+
echo '<input type="hidden" class="upload-width" name="' . esc_attr( $this->manager->options_key ) . '[media][width]" id="' . esc_attr( $this->manager->options_key ) . '[' . $this->id . '][media][width]" value="' . esc_attr( $this->value['media']['width'] ) . '" />';
|
110 |
+
echo '<input type="hidden" class="upload-thumbnail" name="' . esc_attr( $this->manager->options_key ) . '[media][thumbnail]" id="' . esc_attr( $this->manager->options_key ) . '[media][thumbnail]" value="' . esc_attr( $this->value['media']['thumbnail'] ) . '" />';
|
111 |
|
112 |
//Preview
|
113 |
$hide = '';
|
135 |
echo '<div class="upload_button_div">';
|
136 |
|
137 |
//If the user has WP3.5+ show upload/remove button
|
138 |
+
echo '<span class="button background_upload_button" id="' . esc_attr( $this->id ) . '-media" data-setting_id="' . esc_attr( $this->setting->id ) . '" >' . esc_html__( 'Upload', 'customify' ) . '</span>';
|
139 |
|
140 |
$hide = '';
|
141 |
if ( empty( $this->value['background-image'] ) || $this->value['background-image'] == '' ) {
|
142 |
$hide = ' hide';
|
143 |
}
|
144 |
|
145 |
+
echo '<span class="button remove-image' . $hide . '" id="reset_' . esc_attr( $this->id ) . '" rel="' . esc_attr( $this->id ) . '">' . esc_html__( 'Remove', 'customify' ) . '</span>';
|
146 |
|
147 |
echo '</div>';
|
148 |
}
|
features/customizer/controls/class-Pix_Customize_Font_Control.php
CHANGED
@@ -162,7 +162,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
162 |
|
163 |
if ( PixCustomifyPlugin()->settings->get_plugin_setting( 'typography_google_fonts' ) ) {
|
164 |
|
165 |
-
echo '<optgroup class="google-fonts-opts-placeholder" label="' .
|
166 |
} ?>
|
167 |
</select>
|
168 |
</li>
|
@@ -216,7 +216,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
216 |
}
|
217 |
|
218 |
foreach ( $grouped_google_fonts as $group_name => $group ) {
|
219 |
-
echo '<optgroup label="' .
|
220 |
foreach ( $group as $key => $font ) {
|
221 |
self::output_font_option( $font );
|
222 |
}
|
@@ -224,7 +224,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
224 |
}
|
225 |
|
226 |
} else {
|
227 |
-
echo '<optgroup label="' .
|
228 |
foreach ( self::$google_fonts as $key => $font ) {
|
229 |
self::output_font_option( $font );
|
230 |
}
|
@@ -285,7 +285,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
285 |
|
286 |
if ( ! empty( $this->recommended ) ) {
|
287 |
|
288 |
-
echo '<optgroup label="' .
|
289 |
|
290 |
foreach ( $this->recommended as $key => $font ) {
|
291 |
$font_type = 'std';
|
@@ -308,7 +308,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
308 |
|
309 |
if ( PixCustomifyPlugin()->settings->get_plugin_setting( 'typography_standard_fonts' ) ) {
|
310 |
|
311 |
-
echo '<optgroup label="' .
|
312 |
foreach ( self::$std_fonts as $key => $font ) {
|
313 |
self::output_font_option( $font, $font_family, 'std' );
|
314 |
}
|
@@ -335,7 +335,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
335 |
}
|
336 |
?>
|
337 |
<li class="customify_weights_wrapper customize-control font-options__option" style="display: <?php echo $display; ?>;">
|
338 |
-
<label><?php
|
339 |
<?php
|
340 |
$data_default = ! empty( $selected ) ? 'data-default="' . $selected . '"' : '';
|
341 |
$data_disabled = isset( $this->fields['font-weight'] ) && false === $this->fields['font-weight'] ? 'data-disabled' : '';
|
@@ -349,10 +349,10 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
349 |
$attrs = ' selected="selected"';
|
350 |
}
|
351 |
|
352 |
-
echo '<option value="' . $weight . '" ' . $attrs . '> ' . $weight . '</option>';
|
353 |
}
|
354 |
} else if ( ! empty( $current_value->variants ) && is_string( $current_value->variants ) ) {
|
355 |
-
echo '<option value="' . $current_value->variants . '" selected="selected"> ' . $current_value->variants . '</option>';
|
356 |
} ?>
|
357 |
</select>
|
358 |
</li>
|
@@ -365,7 +365,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
365 |
$display = 'inline-block';
|
366 |
} ?>
|
367 |
<li class="customify_subsets_wrapper customize-control font-options__option" style="display: <?php echo $display; ?>;">
|
368 |
-
<label><?php
|
369 |
<select multiple class="customify_font_subsets" data-field="selected_subsets" <?php echo ( isset( $this->fields['subsets'] ) && false === $this->fields['subsets'] ) ? 'data-disabled' : ''; ?>>
|
370 |
<?php
|
371 |
$selected = array();
|
@@ -385,7 +385,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
385 |
$attrs .= ' selected="selected"';
|
386 |
}
|
387 |
|
388 |
-
echo '<option value="' . $subset . '"' . $attrs . '> ' . $subset . '</option>';
|
389 |
}
|
390 |
} ?>
|
391 |
</select>
|
@@ -466,8 +466,8 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
466 |
<li class="customify_line_height_wrapper customize-control customize-control-range font-options__option">
|
467 |
<label><?php esc_html_e( 'Line height', 'customify' ); ?></label>
|
468 |
<input type="range"
|
469 |
-
data-field="line_height" <?php $this->input_field_atts( $this->fields['line-height'] ) ?>
|
470 |
-
value="<?php echo $lh_val ?>">
|
471 |
</li>
|
472 |
<?php }
|
473 |
}
|
@@ -507,7 +507,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
507 |
<label><?php esc_html_e( 'Letter Spacing', 'customify' ); ?></label>
|
508 |
<input type="range"
|
509 |
data-field="letter_spacing" <?php $this->input_field_atts( $this->fields['letter-spacing'] ) ?>
|
510 |
-
value="<?php echo $ls_val ?>">
|
511 |
</li>
|
512 |
<?php }
|
513 |
}
|
@@ -559,7 +559,7 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
559 |
|
560 |
function display_option_value( $value, $current_value ) {
|
561 |
|
562 |
-
$return = 'value="' . $value . '"';
|
563 |
|
564 |
if ( $value === $current_value ) {
|
565 |
$return .= ' selected="selected"';
|
@@ -574,10 +574,10 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
574 |
* @param string|array $font
|
575 |
* @param string|false $active_font_family Optional. The active font family to add the selected attribute to the appropriate opt.
|
576 |
* False to not mark any opt as selected.
|
577 |
-
* @param string $type
|
578 |
*/
|
579 |
public static function output_font_option( $font, $active_font_family = false, $type = 'google' ) {
|
580 |
-
echo self::
|
581 |
}
|
582 |
|
583 |
/**
|
@@ -586,74 +586,76 @@ class Pix_Customize_Font_Control extends Pix_Customize_Control {
|
|
586 |
* @param string|array $font
|
587 |
* @param string|false $active_font_family Optional. The active font family to add the selected attribute to the appropriate opt.
|
588 |
* False to not mark any opt as selected.
|
589 |
-
* @param string $type
|
590 |
* @return string
|
591 |
*/
|
592 |
-
public static function
|
593 |
|
594 |
$html = '';
|
|
|
595 |
|
|
|
|
|
|
|
596 |
$data_attrs = ' data-type="' . esc_attr( $type ) . '"';
|
597 |
|
598 |
// We will handle Google Fonts separately
|
599 |
if ( $type === 'google' ) {
|
|
|
|
|
600 |
// Handle the font variants markup, if available
|
601 |
if ( isset( $font['variants'] ) && ! empty( $font['variants'] ) ) {
|
602 |
-
$data_attrs .= ' data-variants="' . PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['variants'] ) ) . '"';
|
603 |
}
|
604 |
|
605 |
if ( isset( $font['subsets'] ) && ! empty( $font['subsets'] ) ) {
|
606 |
-
$data_attrs .= ' data-subsets="' . PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['subsets'] ) ) . '"';
|
607 |
}
|
608 |
|
609 |
-
//determine if it's selected
|
610 |
-
$selected = ( false !== $active_font_family && $active_font_family === $font['family'] ) ? ' selected="selected" ' : '';
|
611 |
|
612 |
-
$html .= '<option value="' . $font['family'] . '"' . $selected . $data_attrs . '>' . $font['family'] . '</option>';
|
613 |
} elseif ( $type === 'theme_font' ) {
|
614 |
-
$
|
615 |
|
616 |
// Handle the font variants markup, if available
|
617 |
if ( isset( $font['variants'] ) && ! empty( $font['variants'] ) ) {
|
618 |
-
$data_attrs .= ' data-variants="' . PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['variants'] ) ) . '"';
|
619 |
}
|
620 |
|
621 |
-
$
|
622 |
-
$data_attrs .= ' data-src="' . $font['src'] . '" data-type="theme_font"';
|
623 |
-
|
624 |
-
$html .= '<option value="' . $font['family'] . '"' . $selected . $data_attrs . '>' . $font['family'] . '</option>';
|
625 |
} else {
|
626 |
// Handle the font variants markup, if available
|
627 |
-
if ( is_array( $font ) &&
|
628 |
-
$data_attrs .= ' data-variants="' . PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['variants'] ) ) . '"';
|
629 |
}
|
630 |
|
631 |
-
//
|
632 |
$font_family = $font;
|
633 |
// when we get an array we expect to get a font_family entry
|
634 |
if ( is_array( $font ) && isset( $font['font_family'] ) ) {
|
635 |
$font_family = $font['font_family'];
|
636 |
}
|
|
|
637 |
|
638 |
-
|
639 |
-
|
|
|
|
|
|
|
640 |
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
}
|
646 |
|
647 |
-
|
648 |
-
|
649 |
-
$type = 'std';
|
650 |
-
}
|
651 |
-
$option_class = $type . '_font';
|
652 |
|
653 |
-
|
654 |
-
|
655 |
|
656 |
-
|
|
|
|
|
657 |
}
|
658 |
|
659 |
/** ==== Helpers ==== */
|
162 |
|
163 |
if ( PixCustomifyPlugin()->settings->get_plugin_setting( 'typography_google_fonts' ) ) {
|
164 |
|
165 |
+
echo '<optgroup class="google-fonts-opts-placeholder" label="' . esc_attr__( 'Google fonts', 'customify' ) . '"></optgroup>';
|
166 |
} ?>
|
167 |
</select>
|
168 |
</li>
|
216 |
}
|
217 |
|
218 |
foreach ( $grouped_google_fonts as $group_name => $group ) {
|
219 |
+
echo '<optgroup label="' . esc_attr__( 'Google fonts', 'customify' ) . ' ' . $group_name . '">';
|
220 |
foreach ( $group as $key => $font ) {
|
221 |
self::output_font_option( $font );
|
222 |
}
|
224 |
}
|
225 |
|
226 |
} else {
|
227 |
+
echo '<optgroup label="' . esc_attr__( 'Google fonts', 'customify' ) . '">';
|
228 |
foreach ( self::$google_fonts as $key => $font ) {
|
229 |
self::output_font_option( $font );
|
230 |
}
|
285 |
|
286 |
if ( ! empty( $this->recommended ) ) {
|
287 |
|
288 |
+
echo '<optgroup label="' . esc_attr__( 'Recommended', 'customify' ) . '">';
|
289 |
|
290 |
foreach ( $this->recommended as $key => $font ) {
|
291 |
$font_type = 'std';
|
308 |
|
309 |
if ( PixCustomifyPlugin()->settings->get_plugin_setting( 'typography_standard_fonts' ) ) {
|
310 |
|
311 |
+
echo '<optgroup label="' . esc_attr__( 'Standard fonts', 'customify' ) . '">';
|
312 |
foreach ( self::$std_fonts as $key => $font ) {
|
313 |
self::output_font_option( $font, $font_family, 'std' );
|
314 |
}
|
335 |
}
|
336 |
?>
|
337 |
<li class="customify_weights_wrapper customize-control font-options__option" style="display: <?php echo $display; ?>;">
|
338 |
+
<label><?php esc_html_e( 'Font Weight', 'customify' ); ?></label>
|
339 |
<?php
|
340 |
$data_default = ! empty( $selected ) ? 'data-default="' . $selected . '"' : '';
|
341 |
$data_disabled = isset( $this->fields['font-weight'] ) && false === $this->fields['font-weight'] ? 'data-disabled' : '';
|
349 |
$attrs = ' selected="selected"';
|
350 |
}
|
351 |
|
352 |
+
echo '<option value="' . esc_attr( $weight ) . '" ' . $attrs . '> ' . $weight . '</option>';
|
353 |
}
|
354 |
} else if ( ! empty( $current_value->variants ) && is_string( $current_value->variants ) ) {
|
355 |
+
echo '<option value="' . esc_attr( $current_value->variants ) . '" selected="selected"> ' . $current_value->variants . '</option>';
|
356 |
} ?>
|
357 |
</select>
|
358 |
</li>
|
365 |
$display = 'inline-block';
|
366 |
} ?>
|
367 |
<li class="customify_subsets_wrapper customize-control font-options__option" style="display: <?php echo $display; ?>;">
|
368 |
+
<label><?php esc_html_e( 'Languages', 'customify' ); ?></label>
|
369 |
<select multiple class="customify_font_subsets" data-field="selected_subsets" <?php echo ( isset( $this->fields['subsets'] ) && false === $this->fields['subsets'] ) ? 'data-disabled' : ''; ?>>
|
370 |
<?php
|
371 |
$selected = array();
|
385 |
$attrs .= ' selected="selected"';
|
386 |
}
|
387 |
|
388 |
+
echo '<option value="' . esc_attr( $subset ) . '"' . $attrs . '> ' . $subset . '</option>';
|
389 |
}
|
390 |
} ?>
|
391 |
</select>
|
466 |
<li class="customify_line_height_wrapper customize-control customize-control-range font-options__option">
|
467 |
<label><?php esc_html_e( 'Line height', 'customify' ); ?></label>
|
468 |
<input type="range"
|
469 |
+
data-field="line_height" <?php $this->input_field_atts( $this->fields['line-height'] ); ?>
|
470 |
+
value="<?php echo esc_attr( $lh_val ); ?>">
|
471 |
</li>
|
472 |
<?php }
|
473 |
}
|
507 |
<label><?php esc_html_e( 'Letter Spacing', 'customify' ); ?></label>
|
508 |
<input type="range"
|
509 |
data-field="letter_spacing" <?php $this->input_field_atts( $this->fields['letter-spacing'] ) ?>
|
510 |
+
value="<?php echo esc_attr( $ls_val ); ?>">
|
511 |
</li>
|
512 |
<?php }
|
513 |
}
|
559 |
|
560 |
function display_option_value( $value, $current_value ) {
|
561 |
|
562 |
+
$return = 'value="' . esc_attr( $value ) . '"';
|
563 |
|
564 |
if ( $value === $current_value ) {
|
565 |
$return .= ' selected="selected"';
|
574 |
* @param string|array $font
|
575 |
* @param string|false $active_font_family Optional. The active font family to add the selected attribute to the appropriate opt.
|
576 |
* False to not mark any opt as selected.
|
577 |
+
* @param string $type Optional.
|
578 |
*/
|
579 |
public static function output_font_option( $font, $active_font_family = false, $type = 'google' ) {
|
580 |
+
echo self::get_font_option_markup( $font, $active_font_family, $type );
|
581 |
}
|
582 |
|
583 |
/**
|
586 |
* @param string|array $font
|
587 |
* @param string|false $active_font_family Optional. The active font family to add the selected attribute to the appropriate opt.
|
588 |
* False to not mark any opt as selected.
|
589 |
+
* @param string $type Optional.
|
590 |
* @return string
|
591 |
*/
|
592 |
+
public static function get_font_option_markup( $font, $active_font_family = false, $type = 'google' ) {
|
593 |
|
594 |
$html = '';
|
595 |
+
$font_family = false;
|
596 |
|
597 |
+
if ( empty( $type ) ) {
|
598 |
+
$type = 'std';
|
599 |
+
}
|
600 |
$data_attrs = ' data-type="' . esc_attr( $type ) . '"';
|
601 |
|
602 |
// We will handle Google Fonts separately
|
603 |
if ( $type === 'google' ) {
|
604 |
+
$font_family = $font['family'];
|
605 |
+
|
606 |
// Handle the font variants markup, if available
|
607 |
if ( isset( $font['variants'] ) && ! empty( $font['variants'] ) ) {
|
608 |
+
$data_attrs .= ' data-variants="' . esc_attr( PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['variants'] ) ) ) . '"';
|
609 |
}
|
610 |
|
611 |
if ( isset( $font['subsets'] ) && ! empty( $font['subsets'] ) ) {
|
612 |
+
$data_attrs .= ' data-subsets="' . esc_attr( PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['subsets'] ) ) ) . '"';
|
613 |
}
|
614 |
|
|
|
|
|
615 |
|
|
|
616 |
} elseif ( $type === 'theme_font' ) {
|
617 |
+
$font_family = $font['family'];
|
618 |
|
619 |
// Handle the font variants markup, if available
|
620 |
if ( isset( $font['variants'] ) && ! empty( $font['variants'] ) ) {
|
621 |
+
$data_attrs .= ' data-variants="' . esc_attr( PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['variants'] ) ) ) . '"';
|
622 |
}
|
623 |
|
624 |
+
$data_attrs .= ' data-src="' . esc_attr( $font['src'] ) . '"';
|
|
|
|
|
|
|
625 |
} else {
|
626 |
// Handle the font variants markup, if available
|
627 |
+
if ( is_array( $font ) && ! empty( $font['variants'] ) ) {
|
628 |
+
$data_attrs .= ' data-variants="' . esc_attr( PixCustomifyPlugin::encodeURIComponent( json_encode( (object) $font['variants'] ) ) ) . '"';
|
629 |
}
|
630 |
|
631 |
+
// By default, we assume we only get a font family string
|
632 |
$font_family = $font;
|
633 |
// when we get an array we expect to get a font_family entry
|
634 |
if ( is_array( $font ) && isset( $font['font_family'] ) ) {
|
635 |
$font_family = $font['font_family'];
|
636 |
}
|
637 |
+
}
|
638 |
|
639 |
+
// Now determine if we have a "pretty" display for this font family
|
640 |
+
$font_family_display = $font_family;
|
641 |
+
if ( is_array( $font ) && isset( $font['font_family_display'] ) ) {
|
642 |
+
$font_family_display = $font['font_family_display'];
|
643 |
+
}
|
644 |
|
645 |
+
// Bail if we don't have a font family value.
|
646 |
+
if ( empty( $font_family ) ) {
|
647 |
+
return apply_filters( 'customify_filter_font_option_markup_no_family', $html, $font, $active_font_family, $type );
|
648 |
+
}
|
|
|
649 |
|
650 |
+
// Determine if the font is selected
|
651 |
+
$selected = ( false !== $active_font_family && $active_font_family === $font_family ) ? ' selected="selected" ' : '';
|
|
|
|
|
|
|
652 |
|
653 |
+
// Determine the option class
|
654 |
+
$option_class = ( false !== strpos( $type, '_font' ) ) ? $type : $type . '_font';
|
655 |
|
656 |
+
$html .= '<option class="' . esc_attr( $option_class ) . '" value="' . esc_attr( $font_family ) . '" ' . $selected . $data_attrs . '>' . $font_family_display . '</option>';
|
657 |
+
|
658 |
+
return apply_filters( 'customify_filter_font_option_markup', $html, $font, $active_font_family, $type );
|
659 |
}
|
660 |
|
661 |
/** ==== Helpers ==== */
|
features/customizer/controls/class-Pix_Customize_Preset_Control.php
CHANGED
@@ -386,11 +386,15 @@ class Pix_Customize_Preset_Control extends Pix_Customize_Control {
|
|
386 |
return false;
|
387 |
}
|
388 |
|
389 |
-
//
|
390 |
-
$
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
394 |
}
|
395 |
|
396 |
/**
|
@@ -408,11 +412,12 @@ class Pix_Customize_Preset_Control extends Pix_Customize_Control {
|
|
408 |
*/
|
409 |
function lightOrDark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
|
410 |
|
411 |
-
|
|
|
412 |
|
413 |
-
$c_r = hexdec( substr( $
|
414 |
-
$c_g = hexdec( substr( $
|
415 |
-
$c_b = hexdec( substr( $
|
416 |
|
417 |
$brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
|
418 |
|
386 |
return false;
|
387 |
}
|
388 |
|
389 |
+
// Make sure that the hex color string is free from whitespace and #
|
390 |
+
$color = trim( $color, ' \t\n\r #' );
|
391 |
+
|
392 |
+
// Extract the rbg values.
|
393 |
+
$c_r = hexdec( substr( $color, 0, 2 ) );
|
394 |
+
$c_g = hexdec( substr( $color, 2, 2 ) );
|
395 |
+
$c_b = hexdec( substr( $color, 4, 2 ) );
|
396 |
+
|
397 |
+
return ( ( $c_r * 299 + $c_g * 587 + $c_b * 114 ) / 1000 > 130 );
|
398 |
}
|
399 |
|
400 |
/**
|
412 |
*/
|
413 |
function lightOrDark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
|
414 |
|
415 |
+
// Make sure that the hex color string is free from whitespace and #
|
416 |
+
$color = trim( $color, ' \t\n\r #' );
|
417 |
|
418 |
+
$c_r = hexdec( substr( $color, 0, 2 ) );
|
419 |
+
$c_g = hexdec( substr( $color, 2, 2 ) );
|
420 |
+
$c_b = hexdec( substr( $color, 4, 2 ) );
|
421 |
|
422 |
$brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
|
423 |
|
features/customizer/controls/class-Pix_Customize_Typography_Control.php
CHANGED
@@ -159,7 +159,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
159 |
|
160 |
<?php
|
161 |
if ( ! empty( $this->typekit_fonts ) ) {
|
162 |
-
echo '<optgroup label="' .
|
163 |
foreach ( $this->typekit_fonts as $key => $font ) {
|
164 |
self::output_font_option( $font['css_names'][0], $font_family, $font, 'typekit' );
|
165 |
}
|
@@ -171,7 +171,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
171 |
|
172 |
if ( ! empty( $this->recommended ) ) {
|
173 |
|
174 |
-
echo '<optgroup label="' .
|
175 |
|
176 |
foreach ( $this->recommended as $key => $font ) {
|
177 |
$font_type = 'std';
|
@@ -195,7 +195,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
195 |
|
196 |
if ( PixCustomifyPlugin()->settings->get_plugin_setting( 'typography_standard_fonts' ) ) {
|
197 |
|
198 |
-
echo '<optgroup label="' .
|
199 |
foreach ( self::$std_fonts as $key => $font ) {
|
200 |
self::output_font_option( $key, $font_family, $font, 'std' );
|
201 |
}
|
@@ -217,7 +217,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
217 |
}
|
218 |
|
219 |
foreach ( $grouped_google_fonts as $group_name => $group ) {
|
220 |
-
echo '<optgroup label="' .
|
221 |
foreach ( $group as $key => $font ) {
|
222 |
self::output_font_option( $key, $font_family, $font );
|
223 |
}
|
@@ -225,7 +225,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
225 |
}
|
226 |
|
227 |
} else {
|
228 |
-
echo '<optgroup label="' .
|
229 |
foreach ( self::$google_fonts as $key => $font ) {
|
230 |
self::output_font_option( $key, $font_family, $font );
|
231 |
}
|
@@ -256,7 +256,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
256 |
$attrs = ' selected="selected"';
|
257 |
}
|
258 |
|
259 |
-
echo '<option value="' . $weight . '" ' . $attrs . '> ' . $weight . '</option>';
|
260 |
}
|
261 |
} ?>
|
262 |
</select>
|
@@ -281,7 +281,7 @@ class Pix_Customize_Typography_Control extends Pix_Customize_Control {
|
|
281 |
$attrs .= ' selected="selected"';
|
282 |
}
|
283 |
|
284 |
-
echo '<option value="' . $subset . '"' . $attrs . '> ' . $subset . '</option>';
|
285 |
}
|
286 |
} ?>
|
287 |
</select>
|
159 |
|
160 |
<?php
|
161 |
if ( ! empty( $this->typekit_fonts ) ) {
|
162 |
+
echo '<optgroup label="' . esc_attr__( 'Typekit', 'customify' ) . '">';
|
163 |
foreach ( $this->typekit_fonts as $key => $font ) {
|
164 |
self::output_font_option( $font['css_names'][0], $font_family, $font, 'typekit' );
|
165 |
}
|
171 |
|
172 |
if ( ! empty( $this->recommended ) ) {
|
173 |
|
174 |
+
echo '<optgroup label="' . esc_attr__( 'Recommended', 'customify' ) . '">';
|
175 |
|
176 |
foreach ( $this->recommended as $key => $font ) {
|
177 |
$font_type = 'std';
|
195 |
|
196 |
if ( PixCustomifyPlugin()->settings->get_plugin_setting( 'typography_standard_fonts' ) ) {
|
197 |
|
198 |
+
echo '<optgroup label="' . esc_attr__( 'Standard fonts', 'customify' ) . '">';
|
199 |
foreach ( self::$std_fonts as $key => $font ) {
|
200 |
self::output_font_option( $key, $font_family, $font, 'std' );
|
201 |
}
|
217 |
}
|
218 |
|
219 |
foreach ( $grouped_google_fonts as $group_name => $group ) {
|
220 |
+
echo '<optgroup label="' . esc_attr__( 'Google fonts', 'customify' ) . ' ' . $group_name . '">';
|
221 |
foreach ( $group as $key => $font ) {
|
222 |
self::output_font_option( $key, $font_family, $font );
|
223 |
}
|
225 |
}
|
226 |
|
227 |
} else {
|
228 |
+
echo '<optgroup label="' . esc_attr__( 'Google fonts', 'customify' ) . '">';
|
229 |
foreach ( self::$google_fonts as $key => $font ) {
|
230 |
self::output_font_option( $key, $font_family, $font );
|
231 |
}
|
256 |
$attrs = ' selected="selected"';
|
257 |
}
|
258 |
|
259 |
+
echo '<option value="' . esc_attr( $weight ) . '" ' . $attrs . '> ' . $weight . '</option>';
|
260 |
}
|
261 |
} ?>
|
262 |
</select>
|
281 |
$attrs .= ' selected="selected"';
|
282 |
}
|
283 |
|
284 |
+
echo '<option value="' . esc_attr( $subset ) . '" ' . $attrs . '> ' . $subset . '</option>';
|
285 |
}
|
286 |
} ?>
|
287 |
</select>
|
includes/class-customify-customizer.php
CHANGED
@@ -130,7 +130,7 @@ if ( ! class_exists( 'PixCustomify_Customizer' ) ) :
|
|
130 |
add_action( 'wp_head', array( $this, 'output_typography_dynamic_style' ), 10 );
|
131 |
|
132 |
add_action( 'customize_register', array( $this, 'remove_default_sections' ), 11 );
|
133 |
-
add_action( 'customize_register', array( $this, '
|
134 |
// Maybe the theme has instructed us to do things like removing sections or controls.
|
135 |
add_action( 'customize_register', array( $this, 'maybe_process_config_extras' ), 13 );
|
136 |
|
@@ -943,304 +943,146 @@ if ( ! class_exists( 'PixCustomify_Customizer' ) ) :
|
|
943 |
|
944 |
}
|
945 |
|
946 |
-
protected function
|
947 |
|
948 |
-
//
|
949 |
require_once( PixCustomifyPlugin()->get_base_path() . 'features/customizer/class-Pix_Customize_Control.php' );
|
950 |
|
951 |
-
//
|
952 |
-
$path = PixCustomifyPlugin()->get_base_path() . 'features/customizer/controls/';
|
953 |
pixcustomify::require_all( $path );
|
|
|
|
|
954 |
}
|
955 |
|
956 |
/**
|
957 |
-
*
|
958 |
-
*
|
959 |
-
* Mainly things like removing sections, controls, etc.
|
960 |
-
*
|
961 |
-
* @since 1.9.0
|
962 |
*
|
963 |
* @param WP_Customize_Manager $wp_customize
|
964 |
*/
|
965 |
-
|
966 |
-
$customizer_config = PixCustomifyPlugin()->get_customizer_config();
|
967 |
-
|
968 |
-
// Bail if we have no external theme config data.
|
969 |
-
if ( empty( $customizer_config ) || ! is_array( $customizer_config ) ) {
|
970 |
-
return;
|
971 |
-
}
|
972 |
-
|
973 |
-
// Maybe remove panels
|
974 |
-
if ( ! empty( $customizer_config['remove_panels'] ) ) {
|
975 |
-
// Standardize it.
|
976 |
-
if ( is_string( $customizer_config['remove_panels'] ) ) {
|
977 |
-
$customizer_config['remove_panels'] = array( $customizer_config['remove_panels'] );
|
978 |
-
}
|
979 |
-
|
980 |
-
foreach ( $customizer_config['remove_panels'] as $panel_id ) {
|
981 |
-
$wp_customize->remove_panel( $panel_id );
|
982 |
-
}
|
983 |
-
}
|
984 |
|
985 |
-
|
986 |
-
if ( ! empty( $customizer_config['change_panel_props'] ) ) {
|
987 |
-
foreach ( $customizer_config['change_panel_props'] as $panel_id => $panel_props ) {
|
988 |
-
if ( ! is_array( $panel_props ) ) {
|
989 |
-
continue;
|
990 |
-
}
|
991 |
|
992 |
-
|
993 |
-
|
994 |
-
continue;
|
995 |
-
}
|
996 |
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1001 |
-
continue;
|
1002 |
-
}
|
1003 |
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
|
|
1007 |
}
|
1008 |
|
1009 |
-
|
1010 |
-
|
1011 |
-
// Standardize it.
|
1012 |
-
if ( is_string( $customizer_config['remove_sections'] ) ) {
|
1013 |
-
$customizer_config['remove_sections'] = array( $customizer_config['remove_sections'] );
|
1014 |
-
}
|
1015 |
|
1016 |
-
|
|
|
1017 |
|
1018 |
-
|
1019 |
-
global $wp_registered_sidebars;
|
1020 |
|
1021 |
-
|
1022 |
-
$wp_customize->remove_section( 'sidebar-widgets-' . $widget );
|
1023 |
-
}
|
1024 |
-
continue;
|
1025 |
-
}
|
1026 |
-
|
1027 |
-
$wp_customize->remove_section( $section_id );
|
1028 |
-
}
|
1029 |
-
}
|
1030 |
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
}
|
1037 |
-
|
1038 |
-
$section = $wp_customize->get_section( $section_id );
|
1039 |
-
if ( empty( $section ) || ! $section instanceof WP_Customize_Section ) {
|
1040 |
-
continue;
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
$public_props = get_class_vars( get_class( $section ) );
|
1044 |
-
foreach ( $section_props as $prop_name => $prop_value ) {
|
1045 |
-
|
1046 |
-
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1047 |
-
continue;
|
1048 |
}
|
1049 |
|
1050 |
-
$
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
// Standardize it.
|
1058 |
-
if ( is_string( $customizer_config['remove_settings'] ) ) {
|
1059 |
-
$customizer_config['remove_settings'] = array( $customizer_config['remove_settings'] );
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
foreach ( $customizer_config['remove_settings'] as $setting_id ) {
|
1063 |
-
$wp_customize->remove_setting( $setting_id );
|
1064 |
-
}
|
1065 |
-
}
|
1066 |
|
1067 |
-
|
1068 |
-
|
1069 |
-
foreach ( $customizer_config['change_setting_props'] as $setting_id => $setting_props ) {
|
1070 |
-
if ( ! is_array( $setting_props ) ) {
|
1071 |
-
continue;
|
1072 |
-
}
|
1073 |
-
|
1074 |
-
$setting = $wp_customize->get_setting( $setting_id );
|
1075 |
-
if ( empty( $setting ) || ! $setting instanceof WP_Customize_Setting ) {
|
1076 |
-
continue;
|
1077 |
-
}
|
1078 |
-
|
1079 |
-
$public_props = get_class_vars( get_class( $setting ) );
|
1080 |
-
foreach ( $setting_props as $prop_name => $prop_value ) {
|
1081 |
-
|
1082 |
-
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1083 |
-
continue;
|
1084 |
}
|
1085 |
|
1086 |
-
$
|
1087 |
-
|
1088 |
-
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
// Maybe remove controls
|
1092 |
-
if ( ! empty( $customizer_config['remove_controls'] ) ) {
|
1093 |
-
// Standardize it.
|
1094 |
-
if ( is_string( $customizer_config['remove_controls'] ) ) {
|
1095 |
-
$customizer_config['remove_controls'] = array( $customizer_config['remove_controls'] );
|
1096 |
-
}
|
1097 |
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
}
|
1102 |
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
if ( ! is_array( $control_props ) ) {
|
1107 |
-
continue;
|
1108 |
-
}
|
1109 |
|
1110 |
-
$control = $wp_customize->get_control( $control_id );
|
1111 |
-
if ( empty( $control ) || ! $control instanceof WP_Customize_Control ) {
|
1112 |
-
continue;
|
1113 |
-
}
|
1114 |
|
1115 |
-
|
1116 |
-
|
|
|
1117 |
|
1118 |
-
|
1119 |
-
|
|
|
|
|
1120 |
}
|
1121 |
|
1122 |
-
|
|
|
1123 |
}
|
1124 |
}
|
1125 |
}
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
/**
|
1129 |
-
* @param WP_Customize_Manager $wp_customize
|
1130 |
-
*/
|
1131 |
-
function register_customizer( $wp_customize ) {
|
1132 |
-
|
1133 |
-
$this->register_customizer_controls();
|
1134 |
-
|
1135 |
-
$customizer_settings = PixCustomifyPlugin()->get_customizer_config();
|
1136 |
-
|
1137 |
-
if ( ! empty ( $customizer_settings ) ) {
|
1138 |
-
|
1139 |
-
// first check the very needed options name
|
1140 |
-
if ( empty( $customizer_settings['opt-name'] ) ) {
|
1141 |
-
return;
|
1142 |
-
}
|
1143 |
-
$options_name = $customizer_settings['opt-name'];
|
1144 |
-
$wp_customize->options_key = $options_name;
|
1145 |
-
|
1146 |
-
// let's check if we have sections or panels
|
1147 |
-
if ( isset( $customizer_settings['panels'] ) && ! empty( $customizer_settings['panels'] ) ) {
|
1148 |
|
1149 |
-
|
|
|
1150 |
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
if ( ! empty( $panel_config['panel_id'] ) ) {
|
1155 |
-
$panel_id = $panel_config['panel_id'];
|
1156 |
-
} else {
|
1157 |
-
$panel_id = $options_name . '[' . $panel_id . ']';
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
$panel_args = array(
|
1161 |
-
'priority' => 10,
|
1162 |
-
'capability' => 'edit_theme_options',
|
1163 |
-
'title' => __( 'Panel title is required', 'customify' ),
|
1164 |
-
'description' => __( 'Description of what this panel does.', 'customify' ),
|
1165 |
-
'auto_expand_sole_section' => false,
|
1166 |
-
);
|
1167 |
-
|
1168 |
-
if ( isset( $panel_config['priority'] ) && ! empty( $panel_config['priority'] ) ) {
|
1169 |
-
$panel_args['priority'] = $panel_config['priority'];
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
if ( isset( $panel_config['title'] ) && ! empty( $panel_config['title'] ) ) {
|
1173 |
-
$panel_args['title'] = $panel_config['title'];
|
1174 |
-
}
|
1175 |
-
|
1176 |
-
if ( isset( $panel_config['description'] ) && ! empty( $panel_config['description'] ) ) {
|
1177 |
-
$panel_args['description'] = $panel_config['description'];
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
if ( isset( $panel_config['auto_expand_sole_section'] ) ) {
|
1181 |
-
$panel_args['auto_expand_sole_section'] = $panel_config['auto_expand_sole_section'];
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
|
1185 |
-
$wp_customize->add_panel( $panel_id, $panel_args );
|
1186 |
-
|
1187 |
-
foreach ( $panel_config['sections'] as $section_id => $section_config ) {
|
1188 |
-
if ( ! empty( $section_id ) && isset( $section_config['options'] ) && ! empty( $section_config['options'] ) ) {
|
1189 |
-
$this->register_section( $panel_id, $section_id, $options_name, $section_config, $wp_customize );
|
1190 |
-
}
|
1191 |
-
}
|
1192 |
-
}
|
1193 |
}
|
1194 |
}
|
|
|
1195 |
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
'
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
'reset_customify',
|
1233 |
-
array(
|
1234 |
-
'label' => __( 'Reset All Customify Options to Default', 'customify' ),
|
1235 |
-
'section' => 'customify_toolbar',
|
1236 |
-
'settings' => 'reset_customify',
|
1237 |
-
'action' => 'reset_customify',
|
1238 |
-
)
|
1239 |
-
) );
|
1240 |
-
}
|
1241 |
}
|
1242 |
|
1243 |
-
do_action( '
|
1244 |
}
|
1245 |
|
1246 |
/**
|
@@ -1275,7 +1117,9 @@ if ( ! class_exists( 'PixCustomify_Customizer' ) ) :
|
|
1275 |
|
1276 |
// Only add the section if it is not of type `hidden`
|
1277 |
if ( 'hidden' !== $section_args['type'] ) {
|
1278 |
-
$wp_customize->add_section( $section_id, $section_args );
|
|
|
|
|
1279 |
}
|
1280 |
}
|
1281 |
|
@@ -1303,6 +1147,8 @@ if ( ! class_exists( 'PixCustomify_Customizer' ) ) :
|
|
1303 |
$this->register_field( $section_id, $setting_id, $option_config, $wp_customize );
|
1304 |
}
|
1305 |
|
|
|
|
|
1306 |
}
|
1307 |
|
1308 |
/**
|
@@ -1854,6 +1700,178 @@ if ( ! class_exists( 'PixCustomify_Customizer' ) ) :
|
|
1854 |
}
|
1855 |
}
|
1856 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1857 |
/**
|
1858 |
* Sanitize functions
|
1859 |
*/
|
130 |
add_action( 'wp_head', array( $this, 'output_typography_dynamic_style' ), 10 );
|
131 |
|
132 |
add_action( 'customize_register', array( $this, 'remove_default_sections' ), 11 );
|
133 |
+
add_action( 'customize_register', array( $this, 'process_customizer_config' ), 12 );
|
134 |
// Maybe the theme has instructed us to do things like removing sections or controls.
|
135 |
add_action( 'customize_register', array( $this, 'maybe_process_config_extras' ), 13 );
|
136 |
|
943 |
|
944 |
}
|
945 |
|
946 |
+
protected function load_customizer_controls() {
|
947 |
|
948 |
+
// First require the base customizer extend class.
|
949 |
require_once( PixCustomifyPlugin()->get_base_path() . 'features/customizer/class-Pix_Customize_Control.php' );
|
950 |
|
951 |
+
// Now load all the controls' files.
|
952 |
+
$path = apply_filters( 'customify_customizer_controls_path', PixCustomifyPlugin()->get_base_path() . 'features/customizer/controls/' );
|
953 |
pixcustomify::require_all( $path );
|
954 |
+
|
955 |
+
do_action( 'customify_loaded_customizer_controls' );
|
956 |
}
|
957 |
|
958 |
/**
|
959 |
+
* Register all the panels, sections and controls we receive through the plugin's config.
|
|
|
|
|
|
|
|
|
960 |
*
|
961 |
* @param WP_Customize_Manager $wp_customize
|
962 |
*/
|
963 |
+
function process_customizer_config( $wp_customize ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
964 |
|
965 |
+
do_action( 'customify_before_process_customizer_config', $wp_customize );
|
|
|
|
|
|
|
|
|
|
|
966 |
|
967 |
+
// Require all the control classes available.
|
968 |
+
$this->load_customizer_controls();
|
|
|
|
|
969 |
|
970 |
+
// Load the customizer config.
|
971 |
+
$customizer_config = apply_filters( 'customify_customizer_config_pre_processing', PixCustomifyPlugin()->get_customizer_config(), $wp_customize );
|
|
|
|
|
|
|
|
|
972 |
|
973 |
+
// Bail if we don't have a config, or we are missing the 'opt-name' entry.
|
974 |
+
if ( empty( $customizer_config ) || empty( $customizer_config['opt-name'] ) ) {
|
975 |
+
do_action( 'customify_skip_process_customizer_config', $customizer_config, $wp_customize );
|
976 |
+
return;
|
977 |
}
|
978 |
|
979 |
+
$options_name = $customizer_config['opt-name'];
|
980 |
+
$wp_customize->options_key = $options_name;
|
|
|
|
|
|
|
|
|
981 |
|
982 |
+
// Handle panels.
|
983 |
+
if ( isset( $customizer_config['panels'] ) && ! empty( $customizer_config['panels'] ) ) {
|
984 |
|
985 |
+
foreach ( $customizer_config['panels'] as $panel_id => $panel_config ) {
|
|
|
986 |
|
987 |
+
if ( ! empty( $panel_id ) && isset( $panel_config['sections'] ) && ! empty( $panel_config['sections'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
988 |
|
989 |
+
// If we have been explicitly given a panel ID we will use that
|
990 |
+
if ( ! empty( $panel_config['panel_id'] ) ) {
|
991 |
+
$panel_id = $panel_config['panel_id'];
|
992 |
+
} else {
|
993 |
+
$panel_id = $options_name . '[' . $panel_id . ']';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
994 |
}
|
995 |
|
996 |
+
$panel_args = array(
|
997 |
+
'priority' => 10,
|
998 |
+
'capability' => 'edit_theme_options',
|
999 |
+
'title' => esc_html__( 'Panel title is required', 'customify' ),
|
1000 |
+
'description' => esc_html__( 'Description of what this panel does.', 'customify' ),
|
1001 |
+
'auto_expand_sole_section' => false,
|
1002 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1003 |
|
1004 |
+
if ( isset( $panel_config['priority'] ) && ! empty( $panel_config['priority'] ) ) {
|
1005 |
+
$panel_args['priority'] = $panel_config['priority'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1006 |
}
|
1007 |
|
1008 |
+
if ( isset( $panel_config['title'] ) && ! empty( $panel_config['title'] ) ) {
|
1009 |
+
$panel_args['title'] = $panel_config['title'];
|
1010 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1011 |
|
1012 |
+
if ( isset( $panel_config['description'] ) && ! empty( $panel_config['description'] ) ) {
|
1013 |
+
$panel_args['description'] = $panel_config['description'];
|
1014 |
+
}
|
|
|
1015 |
|
1016 |
+
if ( isset( $panel_config['auto_expand_sole_section'] ) ) {
|
1017 |
+
$panel_args['auto_expand_sole_section'] = $panel_config['auto_expand_sole_section'];
|
1018 |
+
}
|
|
|
|
|
|
|
1019 |
|
|
|
|
|
|
|
|
|
1020 |
|
1021 |
+
$panel = $wp_customize->add_panel( $panel_id, $panel_args );
|
1022 |
+
// Fire a general added panel hook
|
1023 |
+
do_action( 'customify_process_customizer_config_added_panel', $panel, $panel_args, $wp_customize );
|
1024 |
|
1025 |
+
foreach ( $panel_config['sections'] as $section_id => $section_config ) {
|
1026 |
+
if ( ! empty( $section_id ) && isset( $section_config['options'] ) && ! empty( $section_config['options'] ) ) {
|
1027 |
+
$this->register_section( $panel_id, $section_id, $options_name, $section_config, $wp_customize );
|
1028 |
+
}
|
1029 |
}
|
1030 |
|
1031 |
+
// Fire a general finished panel hook
|
1032 |
+
do_action( 'customify_process_customizer_config_finished_panel', $panel, $panel_args, $wp_customize );
|
1033 |
}
|
1034 |
}
|
1035 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1036 |
|
1037 |
+
// Handle sections.
|
1038 |
+
if ( isset( $customizer_config['sections'] ) && ! empty( $customizer_config['sections'] ) ) {
|
1039 |
|
1040 |
+
foreach ( $customizer_config['sections'] as $section_id => $section_config ) {
|
1041 |
+
if ( ! empty( $section_id ) && isset( $section_config['options'] ) && ! empty( $section_config['options'] ) ) {
|
1042 |
+
$this->register_section( $panel_id = false, $section_id, $options_name, $section_config, $wp_customize );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1043 |
}
|
1044 |
}
|
1045 |
+
}
|
1046 |
|
1047 |
+
// Handle development helper buttons.
|
1048 |
+
if ( PixCustomifyPlugin()->settings->get_plugin_setting('enable_reset_buttons') ) {
|
1049 |
+
// create a toolbar section which will be present all the time
|
1050 |
+
$reset_section_settings = array(
|
1051 |
+
'title' => esc_html__( 'Customify Toolbox', 'customify' ),
|
1052 |
+
'capability' => 'manage_options',
|
1053 |
+
'priority' => 999999999,
|
1054 |
+
'options' => array(
|
1055 |
+
'reset_all_button' => array(
|
1056 |
+
'type' => 'button',
|
1057 |
+
'label' => esc_html__( 'Reset Customify', 'customify' ),
|
1058 |
+
'action' => 'reset_customify',
|
1059 |
+
'value' => 'Reset',
|
1060 |
+
),
|
1061 |
+
)
|
1062 |
+
);
|
1063 |
+
|
1064 |
+
$wp_customize->add_section(
|
1065 |
+
'customify_toolbar',
|
1066 |
+
$reset_section_settings
|
1067 |
+
);
|
1068 |
+
|
1069 |
+
$wp_customize->add_setting(
|
1070 |
+
'reset_customify',
|
1071 |
+
array()
|
1072 |
+
);
|
1073 |
+
$wp_customize->add_control( new Pix_Customize_Button_Control(
|
1074 |
+
$wp_customize,
|
1075 |
+
'reset_customify',
|
1076 |
+
array(
|
1077 |
+
'label' => esc_html__( 'Reset All Customify Options to Default', 'customify' ),
|
1078 |
+
'section' => 'customify_toolbar',
|
1079 |
+
'settings' => 'reset_customify',
|
1080 |
+
'action' => 'reset_customify',
|
1081 |
+
)
|
1082 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1083 |
}
|
1084 |
|
1085 |
+
do_action( 'customify_after_process_customizer_config', $wp_customize );
|
1086 |
}
|
1087 |
|
1088 |
/**
|
1117 |
|
1118 |
// Only add the section if it is not of type `hidden`
|
1119 |
if ( 'hidden' !== $section_args['type'] ) {
|
1120 |
+
$section = $wp_customize->add_section( $section_id, $section_args );
|
1121 |
+
// Fire a general added section hook
|
1122 |
+
do_action( 'customify_process_customizer_config_added_section', $section, $section_args, $wp_customize );
|
1123 |
}
|
1124 |
}
|
1125 |
|
1147 |
$this->register_field( $section_id, $setting_id, $option_config, $wp_customize );
|
1148 |
}
|
1149 |
|
1150 |
+
// Fire a general finished section hook
|
1151 |
+
do_action( 'customify_process_customizer_config_finished_section', $section_id, $wp_customize );
|
1152 |
}
|
1153 |
|
1154 |
/**
|
1700 |
}
|
1701 |
}
|
1702 |
|
1703 |
+
/**
|
1704 |
+
* Maybe process certain "commands" from the config.
|
1705 |
+
*
|
1706 |
+
* Mainly things like removing sections, controls, etc.
|
1707 |
+
*
|
1708 |
+
* @since 1.9.0
|
1709 |
+
*
|
1710 |
+
* @param WP_Customize_Manager $wp_customize
|
1711 |
+
*/
|
1712 |
+
public function maybe_process_config_extras( $wp_customize ) {
|
1713 |
+
$customizer_config = PixCustomifyPlugin()->get_customizer_config();
|
1714 |
+
|
1715 |
+
// Bail if we have no external theme config data.
|
1716 |
+
if ( empty( $customizer_config ) || ! is_array( $customizer_config ) ) {
|
1717 |
+
return;
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
// Maybe remove panels
|
1721 |
+
if ( ! empty( $customizer_config['remove_panels'] ) ) {
|
1722 |
+
// Standardize it.
|
1723 |
+
if ( is_string( $customizer_config['remove_panels'] ) ) {
|
1724 |
+
$customizer_config['remove_panels'] = array( $customizer_config['remove_panels'] );
|
1725 |
+
}
|
1726 |
+
|
1727 |
+
foreach ( $customizer_config['remove_panels'] as $panel_id ) {
|
1728 |
+
$wp_customize->remove_panel( $panel_id );
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
|
1732 |
+
// Maybe change panel props.
|
1733 |
+
if ( ! empty( $customizer_config['change_panel_props'] ) ) {
|
1734 |
+
foreach ( $customizer_config['change_panel_props'] as $panel_id => $panel_props ) {
|
1735 |
+
if ( ! is_array( $panel_props ) ) {
|
1736 |
+
continue;
|
1737 |
+
}
|
1738 |
+
|
1739 |
+
$panel = $wp_customize->get_panel( $panel_id );
|
1740 |
+
if ( empty( $panel ) || ! $panel instanceof WP_Customize_Panel ) {
|
1741 |
+
continue;
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
$public_props = get_class_vars( get_class( $panel ) );
|
1745 |
+
foreach ( $panel_props as $prop_name => $prop_value ) {
|
1746 |
+
|
1747 |
+
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1748 |
+
continue;
|
1749 |
+
}
|
1750 |
+
|
1751 |
+
$panel->$prop_name = $prop_value;
|
1752 |
+
}
|
1753 |
+
}
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
// Maybe remove sections
|
1757 |
+
if ( ! empty( $customizer_config['remove_sections'] ) ) {
|
1758 |
+
// Standardize it.
|
1759 |
+
if ( is_string( $customizer_config['remove_sections'] ) ) {
|
1760 |
+
$customizer_config['remove_sections'] = array( $customizer_config['remove_sections'] );
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
foreach ( $customizer_config['remove_sections'] as $section_id ) {
|
1764 |
+
|
1765 |
+
if ( 'widgets' === $section_id ) {
|
1766 |
+
global $wp_registered_sidebars;
|
1767 |
+
|
1768 |
+
foreach ( $wp_registered_sidebars as $widget => $settings ) {
|
1769 |
+
$wp_customize->remove_section( 'sidebar-widgets-' . $widget );
|
1770 |
+
}
|
1771 |
+
continue;
|
1772 |
+
}
|
1773 |
+
|
1774 |
+
$wp_customize->remove_section( $section_id );
|
1775 |
+
}
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
// Maybe change section props.
|
1779 |
+
if ( ! empty( $customizer_config['change_section_props'] ) ) {
|
1780 |
+
foreach ( $customizer_config['change_section_props'] as $section_id => $section_props ) {
|
1781 |
+
if ( ! is_array( $section_props ) ) {
|
1782 |
+
continue;
|
1783 |
+
}
|
1784 |
+
|
1785 |
+
$section = $wp_customize->get_section( $section_id );
|
1786 |
+
if ( empty( $section ) || ! $section instanceof WP_Customize_Section ) {
|
1787 |
+
continue;
|
1788 |
+
}
|
1789 |
+
|
1790 |
+
$public_props = get_class_vars( get_class( $section ) );
|
1791 |
+
foreach ( $section_props as $prop_name => $prop_value ) {
|
1792 |
+
|
1793 |
+
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1794 |
+
continue;
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
$section->$prop_name = $prop_value;
|
1798 |
+
}
|
1799 |
+
}
|
1800 |
+
}
|
1801 |
+
|
1802 |
+
// Maybe remove settings
|
1803 |
+
if ( ! empty( $customizer_config['remove_settings'] ) ) {
|
1804 |
+
// Standardize it.
|
1805 |
+
if ( is_string( $customizer_config['remove_settings'] ) ) {
|
1806 |
+
$customizer_config['remove_settings'] = array( $customizer_config['remove_settings'] );
|
1807 |
+
}
|
1808 |
+
|
1809 |
+
foreach ( $customizer_config['remove_settings'] as $setting_id ) {
|
1810 |
+
$wp_customize->remove_setting( $setting_id );
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
// Maybe change setting props.
|
1815 |
+
if ( ! empty( $customizer_config['change_setting_props'] ) ) {
|
1816 |
+
foreach ( $customizer_config['change_setting_props'] as $setting_id => $setting_props ) {
|
1817 |
+
if ( ! is_array( $setting_props ) ) {
|
1818 |
+
continue;
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
$setting = $wp_customize->get_setting( $setting_id );
|
1822 |
+
if ( empty( $setting ) || ! $setting instanceof WP_Customize_Setting ) {
|
1823 |
+
continue;
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
$public_props = get_class_vars( get_class( $setting ) );
|
1827 |
+
foreach ( $setting_props as $prop_name => $prop_value ) {
|
1828 |
+
|
1829 |
+
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1830 |
+
continue;
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
$setting->$prop_name = $prop_value;
|
1834 |
+
}
|
1835 |
+
}
|
1836 |
+
}
|
1837 |
+
|
1838 |
+
// Maybe remove controls
|
1839 |
+
if ( ! empty( $customizer_config['remove_controls'] ) ) {
|
1840 |
+
// Standardize it.
|
1841 |
+
if ( is_string( $customizer_config['remove_controls'] ) ) {
|
1842 |
+
$customizer_config['remove_controls'] = array( $customizer_config['remove_controls'] );
|
1843 |
+
}
|
1844 |
+
|
1845 |
+
foreach ( $customizer_config['remove_controls'] as $control_id ) {
|
1846 |
+
$wp_customize->remove_control( $control_id );
|
1847 |
+
}
|
1848 |
+
}
|
1849 |
+
|
1850 |
+
// Maybe change control props.
|
1851 |
+
if ( ! empty( $customizer_config['change_control_props'] ) ) {
|
1852 |
+
foreach ( $customizer_config['change_control_props'] as $control_id => $control_props ) {
|
1853 |
+
if ( ! is_array( $control_props ) ) {
|
1854 |
+
continue;
|
1855 |
+
}
|
1856 |
+
|
1857 |
+
$control = $wp_customize->get_control( $control_id );
|
1858 |
+
if ( empty( $control ) || ! $control instanceof WP_Customize_Control ) {
|
1859 |
+
continue;
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
$public_props = get_class_vars( get_class( $control ) );
|
1863 |
+
foreach ( $control_props as $prop_name => $prop_value ) {
|
1864 |
+
|
1865 |
+
if ( ! in_array( $prop_name, array_keys( $public_props ) ) ) {
|
1866 |
+
continue;
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
$control->$prop_name = $prop_value;
|
1870 |
+
}
|
1871 |
+
}
|
1872 |
+
}
|
1873 |
+
}
|
1874 |
+
|
1875 |
/**
|
1876 |
* Sanitize functions
|
1877 |
*/
|
includes/class-customify-style-manager.php
CHANGED
@@ -128,9 +128,17 @@ if ( ! class_exists( 'Customify_Style_Manager' ) ) {
|
|
128 |
add_filter( 'customify_filter_fields', array( $this, 'style_manager_section_base_config' ), 12, 1 );
|
129 |
|
130 |
/*
|
131 |
-
* Handle the grouping and reorganization of the Customizer theme sections when
|
132 |
*/
|
133 |
add_filter( 'customify_final_config', array( $this, 'reorganize_customify_sections' ), 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
add_action( 'customize_register', array( $this, 'general_reorganization_of_customize_sections' ), 999, 1 );
|
135 |
|
136 |
/*
|
@@ -451,12 +459,6 @@ if ( ! class_exists( 'Customify_Style_Manager' ) ) {
|
|
451 |
$config['panels']['theme_options_panel'] = array_merge( $config['panels']['theme_options_panel'], $theme_options_panel_config );
|
452 |
}
|
453 |
|
454 |
-
// Add the logic that handles sections and controls added directly to WP_Customizer, not through the config.
|
455 |
-
add_action( 'customize_register', array( $this, 'reorganize_direct_sections_and_controls' ), 100 );
|
456 |
-
|
457 |
-
// Remove the switch theme panel from the Customizer.
|
458 |
-
add_action( 'customize_register', array( $this, 'remove_switch_theme_panel' ), 12 );
|
459 |
-
|
460 |
return $config;
|
461 |
}
|
462 |
|
@@ -606,13 +608,23 @@ if ( ! class_exists( 'Customify_Style_Manager' ) ) {
|
|
606 |
*
|
607 |
*/
|
608 |
public function reorganize_direct_sections_and_controls( $wp_customize ) {
|
609 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
/** @var WP_Customize_Section $section */
|
611 |
foreach ( $wp_customize->sections() as $section ) {
|
612 |
// These are general theme options sections that need to have their controls moved to the Theme Options > General section.
|
613 |
if ( false !== strpos( $section->id, 'theme_options' ) ) {
|
614 |
-
|
615 |
-
$general_section
|
616 |
foreach ( $theme_options_panel->sections as $theme_options_section ) {
|
617 |
if ( false !== strpos( $theme_options_section->id, 'general' ) ) {
|
618 |
$general_section = $section;
|
@@ -655,6 +667,11 @@ if ( ! class_exists( 'Customify_Style_Manager' ) ) {
|
|
655 |
*
|
656 |
*/
|
657 |
public function remove_switch_theme_panel( $wp_customize ) {
|
|
|
|
|
|
|
|
|
|
|
658 |
$wp_customize->remove_panel( 'themes' );
|
659 |
}
|
660 |
|
128 |
add_filter( 'customify_filter_fields', array( $this, 'style_manager_section_base_config' ), 12, 1 );
|
129 |
|
130 |
/*
|
131 |
+
* Handle the grouping and reorganization of the Customizer theme sections when Style Manager is active.
|
132 |
*/
|
133 |
add_filter( 'customify_final_config', array( $this, 'reorganize_customify_sections' ), 10, 1 );
|
134 |
+
// Remove the switch theme panel from the Customizer.
|
135 |
+
add_action( 'customize_register', array( $this, 'remove_switch_theme_panel' ), 12 );
|
136 |
+
// Add the logic that handles sections and controls registered directly to WP_Customizer, not through the Customify config.
|
137 |
+
add_action( 'customize_register', array( $this, 'reorganize_direct_sections_and_controls' ), 998 );
|
138 |
+
|
139 |
+
/*
|
140 |
+
* Handle other, more general reorganization in the Customizer, independent of Style Manager.
|
141 |
+
*/
|
142 |
add_action( 'customize_register', array( $this, 'general_reorganization_of_customize_sections' ), 999, 1 );
|
143 |
|
144 |
/*
|
459 |
$config['panels']['theme_options_panel'] = array_merge( $config['panels']['theme_options_panel'], $theme_options_panel_config );
|
460 |
}
|
461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
return $config;
|
463 |
}
|
464 |
|
608 |
*
|
609 |
*/
|
610 |
public function reorganize_direct_sections_and_controls( $wp_customize ) {
|
611 |
+
// If there is no style manager support, bail.
|
612 |
+
if ( ! $this->is_supported() ) {
|
613 |
+
return;
|
614 |
+
}
|
615 |
+
|
616 |
+
$theme_options_panel = $wp_customize->get_panel( 'theme_options_panel' );
|
617 |
+
// Bail if we don't have a Theme Options panel since all that we do at the moment is related to it.
|
618 |
+
if ( empty( $theme_options_panel ) ) {
|
619 |
+
return;
|
620 |
+
}
|
621 |
+
|
622 |
/** @var WP_Customize_Section $section */
|
623 |
foreach ( $wp_customize->sections() as $section ) {
|
624 |
// These are general theme options sections that need to have their controls moved to the Theme Options > General section.
|
625 |
if ( false !== strpos( $section->id, 'theme_options' ) ) {
|
626 |
+
// Find the General theme options section, if any.
|
627 |
+
$general_section = false;
|
628 |
foreach ( $theme_options_panel->sections as $theme_options_section ) {
|
629 |
if ( false !== strpos( $theme_options_section->id, 'general' ) ) {
|
630 |
$general_section = $section;
|
667 |
*
|
668 |
*/
|
669 |
public function remove_switch_theme_panel( $wp_customize ) {
|
670 |
+
// If there is no style manager support, bail.
|
671 |
+
if ( ! $this->is_supported() ) {
|
672 |
+
return;
|
673 |
+
}
|
674 |
+
|
675 |
$wp_customize->remove_panel( 'themes' );
|
676 |
}
|
677 |
|
includes/class-pixcustomify.php
CHANGED
@@ -162,30 +162,13 @@ class PixCustomifyPlugin {
|
|
162 |
/*
|
163 |
* Handle the force clearing of the caches. We clear in a proactive manner.
|
164 |
*/
|
165 |
-
add_action( 'activated_plugin', array( $this, '
|
166 |
-
add_action( '
|
167 |
-
add_action( '
|
168 |
-
|
169 |
-
add_action( 'deactivated_plugin', array( $this, 'invalidate_customizer_config_cache' ), 1 );
|
170 |
-
add_action( 'deactivated_plugin', array( $this, 'invalidate_options_details_cache' ), 1 );
|
171 |
-
add_action( 'deactivated_plugin', array( $this, 'invalidate_customizer_opt_name_cache' ), 1 );
|
172 |
-
|
173 |
-
add_action( 'after_switch_theme', array( $this, 'invalidate_customizer_config_cache' ), 1 );
|
174 |
-
add_action( 'after_switch_theme', array( $this, 'invalidate_options_details_cache' ), 1 );
|
175 |
-
add_action( 'after_switch_theme', array( $this, 'invalidate_customizer_opt_name_cache' ), 1 );
|
176 |
-
|
177 |
-
add_action( 'upgrader_process_complete', array( $this, 'invalidate_customizer_config_cache' ), 1 );
|
178 |
-
add_action( 'upgrader_process_complete', array( $this, 'invalidate_options_details_cache' ), 1 );
|
179 |
-
add_action( 'upgrader_process_complete', array( $this, 'invalidate_customizer_opt_name_cache' ), 1 );
|
180 |
|
181 |
// Whenever we update data from the Customizer, we will invalidate the options details (that include the value).
|
182 |
add_filter( 'customize_changeset_save_data', array( $this, 'filter_invalidate_options_details_cache' ), 50, 1 );
|
183 |
-
|
184 |
-
// We also want to invalidate the cache whenever the Pixelgrade Care license is updated since it may unlock new features
|
185 |
-
// and so unlock new Customify options.
|
186 |
-
add_filter( 'pre_set_theme_mod_pixcare_license', array( $this, 'filter_invalidate_customizer_config_cache' ), 10, 1 );
|
187 |
-
add_filter( 'pre_set_theme_mod_pixcare_license', array( $this, 'filter_invalidate_options_details_cache' ), 10, 1 );
|
188 |
-
add_filter( 'pre_set_theme_mod_pixcare_license', array( $this, 'filter_invalidate_customizer_opt_name_cache' ), 10, 1 );
|
189 |
}
|
190 |
|
191 |
/**
|
@@ -207,6 +190,49 @@ class PixCustomifyPlugin {
|
|
207 |
update_option( 'customify_dbversion', $this->get_version(), true );
|
208 |
}
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
public function get_options_key( $skip_cache = false ) {
|
211 |
if ( ! empty( $this->opt_name ) ) {
|
212 |
return $this->opt_name;
|
@@ -415,21 +441,6 @@ class PixCustomifyPlugin {
|
|
415 |
return false;
|
416 |
}
|
417 |
|
418 |
-
/**
|
419 |
-
* This will clear any instance properties that are used as local cache during a request to avoid
|
420 |
-
* fetching the data from DB on each method call.
|
421 |
-
*
|
422 |
-
* This may be called during a request when something happens that (potentially) invalidates our data mid-request.
|
423 |
-
*/
|
424 |
-
public function clear_locally_cached_data() {
|
425 |
-
$this->opt_name = null;
|
426 |
-
|
427 |
-
$this->customizer_config = null;
|
428 |
-
|
429 |
-
$this->options_minimal_details = null;
|
430 |
-
$this->options_details = null;
|
431 |
-
}
|
432 |
-
|
433 |
private function get_options_minimal_details_cache_key() {
|
434 |
return 'customify_options_minimal_details';
|
435 |
}
|
@@ -528,6 +539,7 @@ class PixCustomifyPlugin {
|
|
528 |
}
|
529 |
|
530 |
$this->customizer_config = $data;
|
|
|
531 |
return $data;
|
532 |
}
|
533 |
|
162 |
/*
|
163 |
* Handle the force clearing of the caches. We clear in a proactive manner.
|
164 |
*/
|
165 |
+
add_action( 'activated_plugin', array( $this, 'invalidate_all_caches' ), 1 );
|
166 |
+
add_action( 'deactivated_plugin', array( $this, 'invalidate_all_caches' ), 1 );
|
167 |
+
add_action( 'after_switch_theme', array( $this, 'invalidate_all_caches' ), 1 );
|
168 |
+
add_action( 'upgrader_process_complete', array( $this, 'invalidate_all_caches' ), 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
// Whenever we update data from the Customizer, we will invalidate the options details (that include the value).
|
171 |
add_filter( 'customize_changeset_save_data', array( $this, 'filter_invalidate_options_details_cache' ), 50, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
/**
|
190 |
update_option( 'customify_dbversion', $this->get_version(), true );
|
191 |
}
|
192 |
|
193 |
+
/**
|
194 |
+
* Invalidate all caches.
|
195 |
+
*
|
196 |
+
* @since 2.6.0
|
197 |
+
*/
|
198 |
+
public function invalidate_all_caches() {
|
199 |
+
$this->invalidate_customizer_config_cache();
|
200 |
+
$this->invalidate_options_details_cache();
|
201 |
+
$this->invalidate_customizer_opt_name_cache();
|
202 |
+
$this->invalidate_options_details_cache();
|
203 |
+
|
204 |
+
do_action( 'customify_invalidate_all_caches' );
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Invalidate all caches, when hooked via a filter (just pass through the value).
|
209 |
+
*
|
210 |
+
* @since 2.6.0
|
211 |
+
*
|
212 |
+
* @param mixed $value
|
213 |
+
* @return mixed
|
214 |
+
*/
|
215 |
+
public function filter_invalidate_all_caches( $value ) {
|
216 |
+
$this->invalidate_all_caches();
|
217 |
+
|
218 |
+
return $value;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* This will clear any instance properties that are used as local cache during a request to avoid
|
223 |
+
* fetching the data from DB on each method call.
|
224 |
+
*
|
225 |
+
* This may be called during a request when something happens that (potentially) invalidates our data mid-request.
|
226 |
+
*/
|
227 |
+
public function clear_locally_cached_data() {
|
228 |
+
$this->opt_name = null;
|
229 |
+
|
230 |
+
$this->customizer_config = null;
|
231 |
+
|
232 |
+
$this->options_minimal_details = null;
|
233 |
+
$this->options_details = null;
|
234 |
+
}
|
235 |
+
|
236 |
public function get_options_key( $skip_cache = false ) {
|
237 |
if ( ! empty( $this->opt_name ) ) {
|
238 |
return $this->opt_name;
|
441 |
return false;
|
442 |
}
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
private function get_options_minimal_details_cache_key() {
|
445 |
return 'customify_options_minimal_details';
|
446 |
}
|
539 |
}
|
540 |
|
541 |
$this->customizer_config = $data;
|
542 |
+
|
543 |
return $data;
|
544 |
}
|
545 |
|
includes/integrations.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Load all integrations.
|
4 |
+
*
|
5 |
+
* @see https://pixelgrade.com
|
6 |
+
* @author Pixelgrade
|
7 |
+
* @since 2.6.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit; // Exit if accessed directly
|
12 |
+
}
|
13 |
+
|
14 |
+
require_once 'integrations/pixelgrade-care.php';
|
15 |
+
require_once 'integrations/pixelgrade-assistant.php';
|
includes/integrations/pixelgrade-assistant.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This is logic for integrating with the Pixelgrade Assistant plugin.
|
4 |
+
*
|
5 |
+
* @see https://pixelgrade.com
|
6 |
+
* @author Pixelgrade
|
7 |
+
* @since 2.6.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit; // Exit if accessed directly
|
12 |
+
}
|
13 |
+
|
14 |
+
// We want to invalidate caches whenever the Pixelgrade Assistant license is updated since it may unlock new features
|
15 |
+
// and so unlock new Customify options.
|
16 |
+
add_filter( 'pre_set_theme_mod_pixassist_license', array( PixCustomifyPlugin(), 'filter_invalidate_all_caches' ), 10, 1 );
|
includes/integrations/pixelgrade-care.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This is logic for integrating with the Pixelgrade Care plugin.
|
4 |
+
*
|
5 |
+
* @see https://pixelgrade.com
|
6 |
+
* @author Pixelgrade
|
7 |
+
* @since 2.6.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit; // Exit if accessed directly
|
12 |
+
}
|
13 |
+
|
14 |
+
// We want to invalidate caches whenever the Pixelgrade Care license is updated since it may unlock new features
|
15 |
+
// and so unlock new Customify options.
|
16 |
+
add_filter( 'pre_set_theme_mod_pixcare_license', array( PixCustomifyPlugin(), 'filter_invalidate_all_caches' ), 10, 1 );
|
includes/lib/class-customify-design-assets.php
CHANGED
@@ -248,11 +248,8 @@ class Customify_Design_Assets {
|
|
248 |
}
|
249 |
}
|
250 |
|
251 |
-
// Handle various cache invalidations, in a proactive manner
|
252 |
-
// We need to do the hooking here
|
253 |
-
add_action( '
|
254 |
-
add_action( 'deactivated_plugin', array( 'Customify_Design_Assets', 'invalidate_cache' ), 1 );
|
255 |
-
add_action( 'after_switch_theme', array( 'Customify_Design_Assets', 'invalidate_cache' ), 1 );
|
256 |
-
add_action( 'upgrader_process_complete', array( 'Customify_Design_Assets', 'invalidate_cache' ), 1 );
|
257 |
|
258 |
}
|
248 |
}
|
249 |
}
|
250 |
|
251 |
+
// Handle various cache invalidations, in a proactive manner.
|
252 |
+
// We need to do the hooking here because by the time the class might be instantiated it might be too late.
|
253 |
+
add_action( 'customify_invalidate_all_caches', array( 'Customify_Design_Assets', 'invalidate_cache' ), 1 );
|
|
|
|
|
|
|
254 |
|
255 |
}
|
readme.txt
CHANGED
@@ -1,355 +1,360 @@
|
|
1 |
-
=== Customify - A Theme Customizer Booster ===
|
2 |
-
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.3.2
|
6 |
-
Stable tag: 2.
|
7 |
-
Requires PHP: 5.3.0
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
Customify is a Theme Customizer Booster to easily customize Fonts, Colors, and other options for your site.
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
With [Customify](https://github.com/pixelgrade/customify), developers can easily create **advanced theme-specific options** inside the WordPress Customizer. Using those options, a user can make presentational changes without having to know or edit the theme code.
|
16 |
-
|
17 |
-
**[Types of Fields](https://github.com/pixelgrade/customify#list_of_fields)**
|
18 |
-
|
19 |
-
* **Color.** A color picker used to control any text or background color of an element.
|
20 |
-
|
21 |
-
* **Font.** A real font selector which includes a flexible library of fonts(Fonto, google fonts or added via fliter) and allows you to customize, with live preview, properties like font-weight, size, letter spacing, text align, text decoration etc.
|
22 |
-
|
23 |
-
* **Typography.** (Deprecated) A series of typographic options that allow you to access the massive **Google Fonts library** and make them available inside your theme customizer.
|
24 |
-
|
25 |
-
* **CSS Editor.** A powerful **Live CSS Editor** directly into your customizer! Useful for better control over the appearance of your theme without the need to create a child theme or worry about theme updates overwriting your customizations.
|
26 |
-
|
27 |
-
* **Text Field.** A simple text field that allows you to customize elements like Site Title or Footer Credits.
|
28 |
-
|
29 |
-
* **Select Dropdown.** A drop-down menu selector to be used when you have to choose from multiple options.
|
30 |
-
|
31 |
-
* **Range.** The html5 range element can be used to select number values.
|
32 |
-
|
33 |
-
* **[Preset](https://github.com/pixelgrade/customify/blob/master/README.md#presets_title).** A field which allows you to change a group of Customify fields.
|
34 |
-
|
35 |
-
* **And more others [this is the full list](https://github.com/pixelgrade/customify#list_of_fields)
|
36 |
-
|
37 |
-
**Made with love by Pixelgrade**
|
38 |
-
|
39 |
-
== Credits ==
|
40 |
-
|
41 |
-
* [Select2](https://select2.github.io) JavaScript library - License: MIT
|
42 |
-
* [CSSOM.js](https://github.com/NV/CSSOM) JavaScript library - License: MIT
|
43 |
-
* [Ace Editor](https://ace.c9.io/) JavaScript editor - License: BSD
|
44 |
-
* [jQuery React](https://github.com/natedavisolds/jquery-react) JavaScript jQuery plugin - License: MIT
|
45 |
-
* Default [image](https://unsplash.com/photos/OgM4RKdr2kY) for Style Manager Color Palette control - License: (Unsplash)[https://unsplash.com/license]
|
46 |
-
|
47 |
-
== Changelog ==
|
48 |
-
|
49 |
-
= 2.
|
50 |
-
* Fixes
|
51 |
-
*
|
52 |
-
*
|
53 |
-
|
54 |
-
= 2.5.
|
55 |
-
*
|
56 |
-
*
|
57 |
-
*
|
58 |
-
|
59 |
-
= 2.5.
|
60 |
-
* Styling fixes for
|
61 |
-
*
|
62 |
-
*
|
63 |
-
|
64 |
-
= 2.5.
|
65 |
-
*
|
66 |
-
*
|
67 |
-
*
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
*
|
73 |
-
*
|
74 |
-
*
|
75 |
-
|
76 |
-
= 2.5.
|
77 |
-
*
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
*
|
83 |
-
|
84 |
-
= 2.5.
|
85 |
-
*
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
*
|
94 |
-
* Fixed
|
95 |
-
|
96 |
-
= 2.
|
97 |
-
*
|
98 |
-
* Fixed
|
99 |
-
*
|
100 |
-
|
101 |
-
= 2.
|
102 |
-
*
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
*
|
124 |
-
|
125 |
-
= 2.
|
126 |
-
*
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
*
|
159 |
-
|
160 |
-
= 1.
|
161 |
-
* Added
|
162 |
-
* Added
|
163 |
-
*
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
*
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
*
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
*
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
*
|
188 |
-
*
|
189 |
-
|
190 |
-
|
191 |
-
*
|
192 |
-
*
|
193 |
-
|
194 |
-
|
195 |
-
*
|
196 |
-
*
|
197 |
-
* Fixed a
|
198 |
-
|
199 |
-
= 1.
|
200 |
-
*
|
201 |
-
*
|
202 |
-
* Fixed a couple of styling inconsistencies regarding the Customizer
|
203 |
-
|
204 |
-
= 1.5.
|
205 |
-
*
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
*
|
214 |
-
|
215 |
-
= 1.5.
|
216 |
-
*
|
217 |
-
*
|
218 |
-
* Fixed
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
*
|
223 |
-
* Fixed
|
224 |
-
*
|
225 |
-
|
226 |
-
= 1.5.
|
227 |
-
*
|
228 |
-
*
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
*
|
233 |
-
*
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
*
|
238 |
-
*
|
239 |
-
*
|
240 |
-
|
241 |
-
|
242 |
-
*
|
243 |
-
|
244 |
-
|
245 |
-
* Fixed
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
*
|
251 |
-
|
252 |
-
|
253 |
-
*
|
254 |
-
*
|
255 |
-
|
256 |
-
|
257 |
-
*
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
*
|
263 |
-
|
264 |
-
= 1.
|
265 |
-
* Added
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
* Fixed
|
277 |
-
|
278 |
-
= 1.2.
|
279 |
-
* Added: Support for
|
280 |
-
*
|
281 |
-
* Fixed
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
*
|
286 |
-
* Fixed
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
*
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
*
|
295 |
-
*
|
296 |
-
|
297 |
-
|
298 |
-
*
|
299 |
-
|
300 |
-
|
301 |
-
*
|
302 |
-
*
|
303 |
-
*
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
*
|
309 |
-
*
|
310 |
-
*
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
*
|
318 |
-
*
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
*
|
323 |
-
|
324 |
-
|
325 |
-
*
|
326 |
-
*
|
327 |
-
*
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
* Added:
|
332 |
-
* Added:
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
* Added:
|
337 |
-
*
|
338 |
-
|
339 |
-
= 1.1.
|
340 |
-
* Added:
|
341 |
-
* Added:
|
342 |
-
*
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Customify - A Theme Customizer Booster ===
|
2 |
+
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.3.2
|
6 |
+
Stable tag: 2.6.0
|
7 |
+
Requires PHP: 5.3.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Customify is a Theme Customizer Booster to easily customize Fonts, Colors, and other options for your site.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
With [Customify](https://github.com/pixelgrade/customify), developers can easily create **advanced theme-specific options** inside the WordPress Customizer. Using those options, a user can make presentational changes without having to know or edit the theme code.
|
16 |
+
|
17 |
+
**[Types of Fields](https://github.com/pixelgrade/customify#list_of_fields)**
|
18 |
+
|
19 |
+
* **Color.** A color picker used to control any text or background color of an element.
|
20 |
+
|
21 |
+
* **Font.** A real font selector which includes a flexible library of fonts(Fonto, google fonts or added via fliter) and allows you to customize, with live preview, properties like font-weight, size, letter spacing, text align, text decoration etc.
|
22 |
+
|
23 |
+
* **Typography.** (Deprecated) A series of typographic options that allow you to access the massive **Google Fonts library** and make them available inside your theme customizer.
|
24 |
+
|
25 |
+
* **CSS Editor.** A powerful **Live CSS Editor** directly into your customizer! Useful for better control over the appearance of your theme without the need to create a child theme or worry about theme updates overwriting your customizations.
|
26 |
+
|
27 |
+
* **Text Field.** A simple text field that allows you to customize elements like Site Title or Footer Credits.
|
28 |
+
|
29 |
+
* **Select Dropdown.** A drop-down menu selector to be used when you have to choose from multiple options.
|
30 |
+
|
31 |
+
* **Range.** The html5 range element can be used to select number values.
|
32 |
+
|
33 |
+
* **[Preset](https://github.com/pixelgrade/customify/blob/master/README.md#presets_title).** A field which allows you to change a group of Customify fields.
|
34 |
+
|
35 |
+
* **And more others [this is the full list](https://github.com/pixelgrade/customify#list_of_fields)
|
36 |
+
|
37 |
+
**Made with love by Pixelgrade**
|
38 |
+
|
39 |
+
== Credits ==
|
40 |
+
|
41 |
+
* [Select2](https://select2.github.io) JavaScript library - License: MIT
|
42 |
+
* [CSSOM.js](https://github.com/NV/CSSOM) JavaScript library - License: MIT
|
43 |
+
* [Ace Editor](https://ace.c9.io/) JavaScript editor - License: BSD
|
44 |
+
* [jQuery React](https://github.com/natedavisolds/jquery-react) JavaScript jQuery plugin - License: MIT
|
45 |
+
* Default [image](https://unsplash.com/photos/OgM4RKdr2kY) for Style Manager Color Palette control - License: (Unsplash)[https://unsplash.com/license]
|
46 |
+
|
47 |
+
== Changelog ==
|
48 |
+
|
49 |
+
= 2.6.0 =
|
50 |
+
* Fixes related to cache invalidation.
|
51 |
+
* Improvements to Font Palettes.
|
52 |
+
* Fixes for missing Customizer theme controls.
|
53 |
+
|
54 |
+
= 2.5.9 =
|
55 |
+
* Fixes Style Presets preview display
|
56 |
+
* Fixes Color Palettes integration with Gutenberg
|
57 |
+
* Improve display of radio and range controls in Customizer
|
58 |
+
|
59 |
+
= 2.5.8 =
|
60 |
+
* Styling fixes for Color Palettes.
|
61 |
+
* Added reset font logic for better default font palettes.
|
62 |
+
* Fixes for Font Palettes font weights.
|
63 |
+
|
64 |
+
= 2.5.7 =
|
65 |
+
* Styling fixes for the Font control.
|
66 |
+
* Bug fixes for the Font control.
|
67 |
+
* Added RTL stylesheets.
|
68 |
+
|
69 |
+
= 2.5.6 =
|
70 |
+
* Improved styling for the Font control.
|
71 |
+
* Improved handling of minimal required PHP version.
|
72 |
+
* Cleanup stylesheets and scripts for better performance and easier maintenance.
|
73 |
+
* Updated Google Fonts list to include the latest additions.
|
74 |
+
* Compatibility with WordPress 5.3.0.
|
75 |
+
|
76 |
+
= 2.5.5 =
|
77 |
+
* Fixed an issue with the default font weight for the Typography field.
|
78 |
+
* Improved range field behavior when writing directly in the numerical field.
|
79 |
+
* Fixed inconsistency on switch theme with the Style Manager coloration level, diversity and shuffle controls.
|
80 |
+
|
81 |
+
= 2.5.4 =
|
82 |
+
* Improved default font palettes configuration.
|
83 |
+
|
84 |
+
= 2.5.3 =
|
85 |
+
* Fixed as series of issues with Font Palettes in Style Manager.
|
86 |
+
* Improved the Color Palettes.
|
87 |
+
* Fixes a series of edge-cases in the Customizer.
|
88 |
+
|
89 |
+
= 2.5.2 =
|
90 |
+
* Improved the predictability and resilience of the Style Manager controls.
|
91 |
+
|
92 |
+
= 2.5.1 =
|
93 |
+
* Styling improvements to the Style Manager controls.
|
94 |
+
* Fixed a strange bug that would result in a fatal error upon activation.
|
95 |
+
|
96 |
+
= 2.5.0 =
|
97 |
+
* JavaScript cleanup and performance enhancements
|
98 |
+
* Fixed some bugs with the Style Manager.
|
99 |
+
* Fixed some rare bugs with the plugin config merge.
|
100 |
+
|
101 |
+
= 2.4.0 =
|
102 |
+
* Big performance enhancements related to how customization settings and configurations get loaded.
|
103 |
+
* Fixed a nasty regression that caused customization settings saved in a option to not be loaded, causing styles to be missing.
|
104 |
+
* Pretty important code refactoring and cleanup to make things more predictable and stable.
|
105 |
+
|
106 |
+
= 2.3.5.1 =
|
107 |
+
* Minor configuration fix.
|
108 |
+
|
109 |
+
= 2.3.5 =
|
110 |
+
* Minor refactoring.
|
111 |
+
* Fixed issues where customization values were not stored properly.
|
112 |
+
|
113 |
+
= 2.3.4 =
|
114 |
+
* Fixed warnings that were appearing when PHP has version 7.2.0+.
|
115 |
+
|
116 |
+
= 2.3.3 =
|
117 |
+
* Fixed Google Fonts not working in the new block editor (Gutenberg).
|
118 |
+
|
119 |
+
= 2.3.2 =
|
120 |
+
* Fixed the fact that Customizer style changes were not reflected in the live preview. A problem introduced in the previous update.
|
121 |
+
|
122 |
+
= 2.3.1 =
|
123 |
+
* Fixed some warnings that appeared in certain situations.
|
124 |
+
|
125 |
+
= 2.3.0 =
|
126 |
+
* Improved support for the new **Gutenberg block editor.** Compatible with the latest WordPress 5.0 beta version.
|
127 |
+
* Big **performance improvements** both in the frontend and also in the Customizer.
|
128 |
+
* Cleanup regarding old and deprecated features.
|
129 |
+
|
130 |
+
= 2.2.0 =
|
131 |
+
* Added support for the new **Gutenberg block editor.**
|
132 |
+
|
133 |
+
= 2.1.3 =
|
134 |
+
* Improve Customizer section grouping in the Theme Options Panel
|
135 |
+
* Fix Font Palettes giving huge sizes to font options set in ems
|
136 |
+
|
137 |
+
= 2.1.2 =
|
138 |
+
* Avoid short array syntax to ensure PHP 5.2 compatibility
|
139 |
+
|
140 |
+
= 2.1.1 =
|
141 |
+
* Hide the Fonts section for themes that do not declare support for Font Palettes
|
142 |
+
|
143 |
+
= 2.1.0 =
|
144 |
+
* This new version of Customify lets you conveniently change the design of your site with font palettes. Easy as pie.
|
145 |
+
* Added previews for color palette filters.
|
146 |
+
|
147 |
+
= 2.0.2 =
|
148 |
+
* Fixed bug where no CSS was output for some settings with default value.
|
149 |
+
|
150 |
+
= 2.0.1 =
|
151 |
+
* Minor fix for the color pickers.
|
152 |
+
|
153 |
+
= 2.0.0 =
|
154 |
+
* Added the much improved and overall awesome **Color Palettes v2.0 styling system** (all modesty aside).
|
155 |
+
* Minor improvements that are secondary to the one above. Enjoy.
|
156 |
+
|
157 |
+
= 1.9.1 =
|
158 |
+
* Fixed the Customizer JS crash due to wrong merge.
|
159 |
+
|
160 |
+
= 1.9.0 =
|
161 |
+
* Added ability to modify existing Customizer panels, sections, controls
|
162 |
+
* Added system for admin notifications
|
163 |
+
* Overall enhancements for more performance and stability
|
164 |
+
|
165 |
+
= 1.8.0 =
|
166 |
+
* Added altered state for colors in the current color palette when any of the controls connected to the color has been modified
|
167 |
+
* Added the colors from the current palette to all the color pickers in the Theme Options section
|
168 |
+
* Fixed bug where default values were being forced in Customizer Preview at first load
|
169 |
+
* Fixed bug preventing CSS output for color controls in the Style Manager section of the Customizer
|
170 |
+
|
171 |
+
= 1.7.4 =
|
172 |
+
* Reorganized Customizer custom sections and grouped them into Theme Options, thus making the Style Manager panel stand out.
|
173 |
+
* Refactored parts for more performance and clarity.
|
174 |
+
|
175 |
+
= 1.7.3 =
|
176 |
+
* Added HEX field for colors in the current Color Palette
|
177 |
+
* Updated Google Webfonts list
|
178 |
+
|
179 |
+
= 1.7.2 =
|
180 |
+
* Fixed issue with **Color Palettes** working only after choosing one variation
|
181 |
+
* Fixed bug preventing some options to live update the Customizer preview
|
182 |
+
|
183 |
+
= 1.7.1 =
|
184 |
+
* Fixed issue with **Color Palettes** overwriting custom colors in Live Preview
|
185 |
+
|
186 |
+
= 1.7.0 =
|
187 |
+
* Added **Dynamic Color Palettes** for a smoother experience
|
188 |
+
* Fixed issue with the Style Manager crashing the Customizer when not using a theme with support for it.
|
189 |
+
|
190 |
+
= 1.6.5 =
|
191 |
+
* Added **Color Palettes Variations** to the Style Manager Customizer section
|
192 |
+
* Improved Color Palettes logic to better handle differences between various color palettes
|
193 |
+
* Improved master color connected fields logic to allow for a smoother experience
|
194 |
+
* Updated Google Fonts list
|
195 |
+
* Fixed some issues with the connected fields logic
|
196 |
+
* Fixed some Customizer preview scaling issues
|
197 |
+
* Fixed a potential bug with the options' CSS config (multiple configs with the same property but with different selectors)
|
198 |
+
|
199 |
+
= 1.6.0 =
|
200 |
+
* Added **Style Manager** Customizer section with theme supports logic
|
201 |
+
* Added connected fields logic for easy chaining of Customizer controls
|
202 |
+
* Fixed a couple of styling inconsistencies regarding the Customizer
|
203 |
+
|
204 |
+
= 1.5.7 =
|
205 |
+
* Improved development logic for easier testing
|
206 |
+
* Improved and fixed reset settings buttons
|
207 |
+
* Fixed a couple of styling inconsistencies regarding the Customizer
|
208 |
+
|
209 |
+
= 1.5.6 =
|
210 |
+
* New Fields Styling Improvements
|
211 |
+
|
212 |
+
= 1.5.5 =
|
213 |
+
* Added Compatibility with WordPress 4.9
|
214 |
+
|
215 |
+
= 1.5.4 =
|
216 |
+
* Allow 0 values for fonts line-height and letter-spacing
|
217 |
+
* Improved the plugin loading process and the CSS inline output
|
218 |
+
* Fixed small style issues for the Customizer bar
|
219 |
+
|
220 |
+
= 1.5.3 =
|
221 |
+
* Update Style for WordPress 4.8
|
222 |
+
* Updated Google Fonts list
|
223 |
+
* Fixed the double output of the custom CSS
|
224 |
+
* Fixed Menu Add Button overlap
|
225 |
+
|
226 |
+
= 1.5.2 =
|
227 |
+
* Fixed Background field output
|
228 |
+
* Fixed Font's preview in wp-editor
|
229 |
+
* Added Reset Theme Mods tool
|
230 |
+
|
231 |
+
= 1.5.1 =
|
232 |
+
* Added support for `active_callback` argument for customizer controls
|
233 |
+
* Customizer assets refactor
|
234 |
+
|
235 |
+
= 1.5.0 =
|
236 |
+
* Plugin core refactored for a better performance
|
237 |
+
* Fixed Font Weight saving
|
238 |
+
* Fixed Font Subset saving
|
239 |
+
* Fix Select2 enqueue_script
|
240 |
+
|
241 |
+
= 1.4.2 =
|
242 |
+
* Improved Font style output in front-end. Now is just one style element with all the fonts inside.
|
243 |
+
* Improved Fonts panels, now only one can be opened to avoid confusion
|
244 |
+
* Fixed Presets with fonts
|
245 |
+
* Fixed Google Fonts with italic weights
|
246 |
+
* Fixed Range input field
|
247 |
+
* Small Fixes
|
248 |
+
|
249 |
+
= 1.4.1 =
|
250 |
+
* Fixed Multiple local fonts
|
251 |
+
|
252 |
+
= 1.4.0 =
|
253 |
+
* Make Customify compatible with the [4.7 customizer changes](https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions)
|
254 |
+
* Add `show_if` [config option](https://github.com/pixelgrade/customify#conditional-fields)
|
255 |
+
* Fix Conflict with Jetpack - Related posts
|
256 |
+
* Fix Javascript callbacks loss
|
257 |
+
* Switch de default storage from option to theme_mod
|
258 |
+
* Fixed Incorrect Color Panel Height
|
259 |
+
* Fixed Font field weight in customizer preview
|
260 |
+
|
261 |
+
= 1.3.1 =
|
262 |
+
* Fixed compatibility with PHP <= 5.3.x
|
263 |
+
|
264 |
+
= 1.3.0 =
|
265 |
+
* Added the new and awesome `font` selector
|
266 |
+
* The live CSS editor is now removed for 4.7, but don't worry, your style will be imported into the new [CSS Editor](https://make.wordpress.org/core/2016/11/26/extending-the-custom-css-editor/)
|
267 |
+
* Added compatibility with 4.7
|
268 |
+
|
269 |
+
= 1.2.7 =
|
270 |
+
* Added capability to control the Jetpack Sharing default options
|
271 |
+
|
272 |
+
= 1.2.6 =
|
273 |
+
* Added capability to define Jetpack default and hidden modules
|
274 |
+
|
275 |
+
= 1.2.5 =
|
276 |
+
* Fixed WordPress 4.7 incompatibilities
|
277 |
+
|
278 |
+
= 1.2.4 =
|
279 |
+
* Added: Support for Fonto plugin
|
280 |
+
* Improved the font selector
|
281 |
+
* Fixed presets on ssl
|
282 |
+
|
283 |
+
= 1.2.3 =
|
284 |
+
* Added: Support for conditional fields display
|
285 |
+
* Fixed weights for local fonts
|
286 |
+
* Fixed Ace editor warnings
|
287 |
+
* Fixed some rare PHP warnings
|
288 |
+
|
289 |
+
= 1.2.2 =
|
290 |
+
* Added: Customizer styling
|
291 |
+
* Fixed some rare warnings with google fonts
|
292 |
+
|
293 |
+
= 1.2.1 =
|
294 |
+
* Improve default fonts parse, and fix some legacy cases
|
295 |
+
* Remove google api code when google fonts is disabled
|
296 |
+
|
297 |
+
= 1.2.0 =
|
298 |
+
* Added: Compatibility with WordPress 4.4.0
|
299 |
+
* Added: Presets can now set fonts and font weights
|
300 |
+
* Fixed: Now range fields can have `0` as default
|
301 |
+
* Fixed: Font subsets style
|
302 |
+
* Fixed: Fixed some PHP and javascript warnings
|
303 |
+
* Updated: Font field style
|
304 |
+
|
305 |
+
= 1.1.7 =
|
306 |
+
* Added: Compatibility with WordPress 4.3.1
|
307 |
+
* Added: Custom fonts can be used now as defaults
|
308 |
+
* Fixed: Fonts preview
|
309 |
+
* Fixed: Some rare errors with PHP 5.2.x
|
310 |
+
* Fixed: Some font variants warnings with PHP 5.2.x
|
311 |
+
|
312 |
+
= 1.1.6 =
|
313 |
+
* Added: Custom background field with bacgkround-* css properties selects
|
314 |
+
* Added: Compatibility with WordPress 4.3.x
|
315 |
+
* Added: Compatibility with PHP 5.2.x
|
316 |
+
* Improved: Live CSS Editor is now live...for real
|
317 |
+
* Updated: ACE Editor
|
318 |
+
* Updated: The list of google fonts is now up to date
|
319 |
+
|
320 |
+
|
321 |
+
= 1.1.5 =
|
322 |
+
* Added: Live-preview support for `text` and `textarea` fields.
|
323 |
+
* Added: **Unit** parameter for css values(now we can use all the css units like em, rem, vh, all of them :D).
|
324 |
+
* Fixed: Editor style for Typekit fonts.
|
325 |
+
* Fixed: Editor style with default values.
|
326 |
+
* Fixed: Live Preview small fixes
|
327 |
+
* Updated: The list of google fonts is now up to date
|
328 |
+
|
329 |
+
= 1.1.4 =
|
330 |
+
* Added: Ace Editor field.
|
331 |
+
* Added: HTML field.
|
332 |
+
* Added: Sanitize callbacks parameter and a default sanitizer for the checkbox field.
|
333 |
+
* Fixed: Slight styling issues.
|
334 |
+
|
335 |
+
= 1.1.2 =
|
336 |
+
* Added: Option to add Customify's changes in the editor.
|
337 |
+
* Added: Possibility to load Typekit fonts through config.
|
338 |
+
|
339 |
+
= 1.1.1 =
|
340 |
+
* Added: Radio input with image label.
|
341 |
+
* Added: Javascript callback for css properties.
|
342 |
+
* Update: Updated Ace editor.
|
343 |
+
|
344 |
+
= 1.1.0 =
|
345 |
+
* Added: [Preset](https://github.com/pixelgrade/customify/blob/master/README.md#presets_title) field type.
|
346 |
+
* Added: Reset buttons (disabled by default).
|
347 |
+
* Added: Button field.
|
348 |
+
|
349 |
+
== Installation ==
|
350 |
+
|
351 |
+
1. Install Customify either via the WordPress.org plugin directory, or by uploading the files to your `/wp-content/plugins/` directory
|
352 |
+
2. After activating Customify go to `Appearance → Customize` and have fun with the new felds
|
353 |
+
3. For further instructions and how to setup your own fields, read our [detailed documentation](http://github.com/pixelgrade/customify/blob/dev/README.md)
|
354 |
+
|
355 |
+
== Frequently Asked Questions ==
|
356 |
+
|
357 |
+
= Is there a way to reset Customify to defaults? =
|
358 |
+
Reset buttons are available for all the options or for individual sections or panels.
|
359 |
+
They are disabled by default to avoid useless/accidental resets.
|
360 |
+
To enable them simply go to Dashboard -> Settings -> Customify and check "Enable Reset Buttons"
|