Version Description
- 2014-03-15, dev time 2 hours ==
- Removed: Remove the
kirki_get_optionfunction that was introduced in 0.7 as it's not working properly yet. - Fix: Undefined index notice when a default value for the control was not defined
- Tweak:
logo_imagenow injects animgelement instead of adivwith custom background - New: Added
descriptionargument in the kirki configuration (replaces the theme description)
=
Download this release
Release Info
| Developer | aristath |
| Plugin | |
| Version | 0.7.1 |
| Comparing to | |
| See all releases | |
Code changes from version 0.7 to 0.7.1
- includes/class-kirki-controls.php +7 -0
- includes/class-kirki-fonts-script.php +3 -1
- includes/class-kirki-scripts.php +12 -15
- includes/class-kirki-settings.php +10 -8
- includes/class-kirki-style.php +10 -8
- includes/controls/class-kirki-customize-radio-buttonset-control.php +1 -1
- includes/required.php +8 -6
- kirki.php +61 -44
- readme.txt +8 -1
includes/class-kirki-controls.php
CHANGED
|
@@ -5,6 +5,13 @@ class Kirki_Controls {
|
|
| 5 |
|
| 6 |
public static function control_clean( $control ) {
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
/**
|
| 9 |
* Compatibility tweak
|
| 10 |
*
|
| 5 |
|
| 6 |
public static function control_clean( $control ) {
|
| 7 |
|
| 8 |
+
/**
|
| 9 |
+
* If ['default'] is not set, set an empty value
|
| 10 |
+
*/
|
| 11 |
+
if ( ! isset( $control['default'] ) ) {
|
| 12 |
+
$control['default'] = '';
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
/**
|
| 16 |
* Compatibility tweak
|
| 17 |
*
|
includes/class-kirki-fonts-script.php
CHANGED
|
@@ -27,8 +27,10 @@ class Kirki_Fonts_Script extends Kirki_Style {
|
|
| 27 |
$fonts = array();
|
| 28 |
foreach ( $controls as $control ) {
|
| 29 |
|
|
|
|
|
|
|
| 30 |
// The value of this control
|
| 31 |
-
$value = get_theme_mod( $control['
|
| 32 |
|
| 33 |
if ( isset( $control['output'] ) ) {
|
| 34 |
|
| 27 |
$fonts = array();
|
| 28 |
foreach ( $controls as $control ) {
|
| 29 |
|
| 30 |
+
$control = Kirki_Controls::control_clean( $control );
|
| 31 |
+
|
| 32 |
// The value of this control
|
| 33 |
+
$value = get_theme_mod( $control['settings'], $control['default'] );
|
| 34 |
|
| 35 |
if ( isset( $control['output'] ) ) {
|
| 36 |
|
includes/class-kirki-scripts.php
CHANGED
|
@@ -103,14 +103,15 @@ class Kirki_Scripts {
|
|
| 103 |
|
| 104 |
$options = apply_filters( 'kirki/config', array() ); ?>
|
| 105 |
|
| 106 |
-
<?php if ( isset( $options['logo_image'] ) ) : ?>
|
| 107 |
-
<script>
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
| 114 |
<?php endif;
|
| 115 |
|
| 116 |
}
|
|
@@ -304,12 +305,6 @@ class Kirki_Scripts {
|
|
| 304 |
.press-this a.preview:hover {
|
| 305 |
background-color: <?php echo $color_accent; ?>;
|
| 306 |
}
|
| 307 |
-
|
| 308 |
-
<?php if ( isset( $options['logo_image'] ) ) : ?>
|
| 309 |
-
div.kirki-customizer {
|
| 310 |
-
background: url("<?php echo $options['logo_image']; ?>") no-repeat left center;
|
| 311 |
-
}
|
| 312 |
-
<?php endif; ?>
|
| 313 |
</style>
|
| 314 |
<?php
|
| 315 |
}
|
|
@@ -372,10 +367,12 @@ class Kirki_Scripts {
|
|
| 372 |
|
| 373 |
foreach ( $controls as $control ) {
|
| 374 |
|
|
|
|
|
|
|
| 375 |
if ( isset( $control['transport'] ) && isset( $control['js_vars'] ) && 'postMessage' == $control['transport'] ) {
|
| 376 |
|
| 377 |
$script .= '<script type="text/javascript">jQuery(document).ready(function( $ ) {';
|
| 378 |
-
$script .= 'wp.customize("' . $control['
|
| 379 |
|
| 380 |
if ( isset( $control['js_vars']['type'] ) && 'css' == $control['js_vars']['type'] ) {
|
| 381 |
$script .= 'value.bind(function(to) {';
|
| 103 |
|
| 104 |
$options = apply_filters( 'kirki/config', array() ); ?>
|
| 105 |
|
| 106 |
+
<?php if ( isset( $options['logo_image'] ) || isset( $options['description'] ) ) : ?>
|
| 107 |
+
<script>jQuery(document).ready(function($) { "use strict";
|
| 108 |
+
<?php if ( isset( $options['logo_image'] ) ) : ?>
|
| 109 |
+
$( 'div#customize-info .preview-notice' ).replaceWith( '<img src="<?php echo $options['logo_image']; ?>">' );
|
| 110 |
+
<?php endif; ?>
|
| 111 |
+
<?php if ( isset( $options['description'] ) ) : ?>
|
| 112 |
+
$( 'div#customize-info .accordion-section-content' ).replaceWith( '<div class="accordion-section-content"><div class="theme-description"><?php echo $options['description']; ?></div></div>' );
|
| 113 |
+
<?php endif; ?>
|
| 114 |
+
});</script>
|
| 115 |
<?php endif;
|
| 116 |
|
| 117 |
}
|
| 305 |
.press-this a.preview:hover {
|
| 306 |
background-color: <?php echo $color_accent; ?>;
|
| 307 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
</style>
|
| 309 |
<?php
|
| 310 |
}
|
| 367 |
|
| 368 |
foreach ( $controls as $control ) {
|
| 369 |
|
| 370 |
+
$control = Kirki_Controls::control_clean( $control );
|
| 371 |
+
|
| 372 |
if ( isset( $control['transport'] ) && isset( $control['js_vars'] ) && 'postMessage' == $control['transport'] ) {
|
| 373 |
|
| 374 |
$script .= '<script type="text/javascript">jQuery(document).ready(function( $ ) {';
|
| 375 |
+
$script .= 'wp.customize("' . $control['settings'] . '",function( value ) {';
|
| 376 |
|
| 377 |
if ( isset( $control['js_vars']['type'] ) && 'css' == $control['js_vars']['type'] ) {
|
| 378 |
$script .= 'value.bind(function(to) {';
|
includes/class-kirki-settings.php
CHANGED
|
@@ -8,10 +8,12 @@ class Kirki_Settings extends Kirki {
|
|
| 8 |
*/
|
| 9 |
function add_setting( $wp_customize, $control ) {
|
| 10 |
|
|
|
|
|
|
|
| 11 |
if ( 'background' == $control['type'] ) {
|
| 12 |
|
| 13 |
if ( isset( $control['default']['color'] ) ) {
|
| 14 |
-
$wp_customize->add_setting( $control['
|
| 15 |
'default' => $control['default']['color'],
|
| 16 |
'type' => 'theme_mod',
|
| 17 |
'capability' => 'edit_theme_options',
|
|
@@ -21,7 +23,7 @@ class Kirki_Settings extends Kirki {
|
|
| 21 |
}
|
| 22 |
|
| 23 |
if ( isset( $control['default']['image'] ) ) {
|
| 24 |
-
$wp_customize->add_setting( $control['
|
| 25 |
'default' => $control['default']['image'],
|
| 26 |
'type' => 'theme_mod',
|
| 27 |
'capability' => 'edit_theme_options',
|
|
@@ -31,7 +33,7 @@ class Kirki_Settings extends Kirki {
|
|
| 31 |
}
|
| 32 |
|
| 33 |
if ( isset( $control['default']['repeat'] ) ) {
|
| 34 |
-
$wp_customize->add_setting( $control['
|
| 35 |
'default' => $control['default']['repeat'],
|
| 36 |
'type' => 'theme_mod',
|
| 37 |
'capability' => 'edit_theme_options',
|
|
@@ -41,7 +43,7 @@ class Kirki_Settings extends Kirki {
|
|
| 41 |
}
|
| 42 |
|
| 43 |
if ( isset( $control['default']['size'] ) ) {
|
| 44 |
-
$wp_customize->add_setting( $control['
|
| 45 |
'default' => $control['default']['size'],
|
| 46 |
'type' => 'theme_mod',
|
| 47 |
'capability' => 'edit_theme_options',
|
|
@@ -51,7 +53,7 @@ class Kirki_Settings extends Kirki {
|
|
| 51 |
}
|
| 52 |
|
| 53 |
if ( isset( $control['default']['attach'] ) ) {
|
| 54 |
-
$wp_customize->add_setting( $control['
|
| 55 |
'default' => $control['default']['attach'],
|
| 56 |
'type' => 'theme_mod',
|
| 57 |
'capability' => 'edit_theme_options',
|
|
@@ -61,7 +63,7 @@ class Kirki_Settings extends Kirki {
|
|
| 61 |
}
|
| 62 |
|
| 63 |
if ( isset( $control['default']['position'] ) ) {
|
| 64 |
-
$wp_customize->add_setting( $control['
|
| 65 |
'default' => $control['default']['position'],
|
| 66 |
'type' => 'theme_mod',
|
| 67 |
'capability' => 'edit_theme_options',
|
|
@@ -71,7 +73,7 @@ class Kirki_Settings extends Kirki {
|
|
| 71 |
}
|
| 72 |
|
| 73 |
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
| 74 |
-
$wp_customize->add_setting( $control['
|
| 75 |
'default' => $control['default']['opacity'],
|
| 76 |
'type' => 'theme_mod',
|
| 77 |
'capability' => 'edit_theme_options',
|
|
@@ -113,7 +115,7 @@ class Kirki_Settings extends Kirki {
|
|
| 113 |
}
|
| 114 |
|
| 115 |
// Add settings
|
| 116 |
-
$wp_customize->add_setting( $control['
|
| 117 |
'default' => isset( $control['default'] ) ? $control['default'] : '',
|
| 118 |
'type' => 'theme_mod',
|
| 119 |
'capability' => 'edit_theme_options',
|
| 8 |
*/
|
| 9 |
function add_setting( $wp_customize, $control ) {
|
| 10 |
|
| 11 |
+
$control = Kirki_Controls::control_clean( $control );
|
| 12 |
+
|
| 13 |
if ( 'background' == $control['type'] ) {
|
| 14 |
|
| 15 |
if ( isset( $control['default']['color'] ) ) {
|
| 16 |
+
$wp_customize->add_setting( $control['settings'] . '_color', array(
|
| 17 |
'default' => $control['default']['color'],
|
| 18 |
'type' => 'theme_mod',
|
| 19 |
'capability' => 'edit_theme_options',
|
| 23 |
}
|
| 24 |
|
| 25 |
if ( isset( $control['default']['image'] ) ) {
|
| 26 |
+
$wp_customize->add_setting( $control['settings'] . '_image', array(
|
| 27 |
'default' => $control['default']['image'],
|
| 28 |
'type' => 'theme_mod',
|
| 29 |
'capability' => 'edit_theme_options',
|
| 33 |
}
|
| 34 |
|
| 35 |
if ( isset( $control['default']['repeat'] ) ) {
|
| 36 |
+
$wp_customize->add_setting( $control['settings'] . '_repeat', array(
|
| 37 |
'default' => $control['default']['repeat'],
|
| 38 |
'type' => 'theme_mod',
|
| 39 |
'capability' => 'edit_theme_options',
|
| 43 |
}
|
| 44 |
|
| 45 |
if ( isset( $control['default']['size'] ) ) {
|
| 46 |
+
$wp_customize->add_setting( $control['settings'] . '_size', array(
|
| 47 |
'default' => $control['default']['size'],
|
| 48 |
'type' => 'theme_mod',
|
| 49 |
'capability' => 'edit_theme_options',
|
| 53 |
}
|
| 54 |
|
| 55 |
if ( isset( $control['default']['attach'] ) ) {
|
| 56 |
+
$wp_customize->add_setting( $control['settings'] . '_attach', array(
|
| 57 |
'default' => $control['default']['attach'],
|
| 58 |
'type' => 'theme_mod',
|
| 59 |
'capability' => 'edit_theme_options',
|
| 63 |
}
|
| 64 |
|
| 65 |
if ( isset( $control['default']['position'] ) ) {
|
| 66 |
+
$wp_customize->add_setting( $control['settings'] . '_position', array(
|
| 67 |
'default' => $control['default']['position'],
|
| 68 |
'type' => 'theme_mod',
|
| 69 |
'capability' => 'edit_theme_options',
|
| 73 |
}
|
| 74 |
|
| 75 |
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
| 76 |
+
$wp_customize->add_setting( $control['settings'] . '_opacity', array(
|
| 77 |
'default' => $control['default']['opacity'],
|
| 78 |
'type' => 'theme_mod',
|
| 79 |
'capability' => 'edit_theme_options',
|
| 115 |
}
|
| 116 |
|
| 117 |
// Add settings
|
| 118 |
+
$wp_customize->add_setting( $control['settings'], array(
|
| 119 |
'default' => isset( $control['default'] ) ? $control['default'] : '',
|
| 120 |
'type' => 'theme_mod',
|
| 121 |
'capability' => 'edit_theme_options',
|
includes/class-kirki-style.php
CHANGED
|
@@ -69,7 +69,9 @@ class Kirki_Style {
|
|
| 69 |
|
| 70 |
function styles( $control, $styles, $element, $property, $units ) {
|
| 71 |
|
| 72 |
-
$
|
|
|
|
|
|
|
| 73 |
|
| 74 |
// Color controls
|
| 75 |
if ( 'color' == $control['type'] ) {
|
|
@@ -83,25 +85,25 @@ class Kirki_Style {
|
|
| 83 |
elseif ( 'background' == $control['type'] ) {
|
| 84 |
|
| 85 |
if ( isset( $control['default']['color'] ) ) {
|
| 86 |
-
$bg_color = Kirki_Color::sanitize_hex( get_theme_mod( $control['
|
| 87 |
}
|
| 88 |
if ( isset( $control['default']['image'] ) ) {
|
| 89 |
-
$bg_image = get_theme_mod( $control['
|
| 90 |
}
|
| 91 |
if ( isset( $control['default']['repeat'] ) ) {
|
| 92 |
-
$bg_repeat = get_theme_mod( $control['
|
| 93 |
}
|
| 94 |
if ( isset( $control['default']['size'] ) ) {
|
| 95 |
-
$bg_size = get_theme_mod( $control['
|
| 96 |
}
|
| 97 |
if ( isset( $control['default']['attach'] ) ) {
|
| 98 |
-
$bg_attach = get_theme_mod( $control['
|
| 99 |
}
|
| 100 |
if ( isset( $control['default']['position'] ) ) {
|
| 101 |
-
$bg_position = get_theme_mod( $control['
|
| 102 |
}
|
| 103 |
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
| 104 |
-
$bg_opacity = get_theme_mod( $control['
|
| 105 |
if ( isset( $bg_color ) ) {
|
| 106 |
// If we're using an opacity other than 100, then convert the color to RGBA.
|
| 107 |
$bg_color = ( 100 != $bg_opacity ) ? Kirki_Color::get_rgba( $bg_color, $bg_opacity ) : $bg_color;
|
| 69 |
|
| 70 |
function styles( $control, $styles, $element, $property, $units ) {
|
| 71 |
|
| 72 |
+
$control = Kirki_Controls::control_clean( $control );
|
| 73 |
+
|
| 74 |
+
$value = get_theme_mod( $control['settings'], $control['default'] );
|
| 75 |
|
| 76 |
// Color controls
|
| 77 |
if ( 'color' == $control['type'] ) {
|
| 85 |
elseif ( 'background' == $control['type'] ) {
|
| 86 |
|
| 87 |
if ( isset( $control['default']['color'] ) ) {
|
| 88 |
+
$bg_color = Kirki_Color::sanitize_hex( get_theme_mod( $control['settings'] . '_color', $control['default']['color'] ) );
|
| 89 |
}
|
| 90 |
if ( isset( $control['default']['image'] ) ) {
|
| 91 |
+
$bg_image = get_theme_mod( $control['settings'] . '_image', $control['default']['image'] );
|
| 92 |
}
|
| 93 |
if ( isset( $control['default']['repeat'] ) ) {
|
| 94 |
+
$bg_repeat = get_theme_mod( $control['settings'] . '_repeat', $control['default']['repeat'] );
|
| 95 |
}
|
| 96 |
if ( isset( $control['default']['size'] ) ) {
|
| 97 |
+
$bg_size = get_theme_mod( $control['settings'] . '_size', $control['default']['size'] );
|
| 98 |
}
|
| 99 |
if ( isset( $control['default']['attach'] ) ) {
|
| 100 |
+
$bg_attach = get_theme_mod( $control['settings'] . '_attach', $control['default']['attach'] );
|
| 101 |
}
|
| 102 |
if ( isset( $control['default']['position'] ) ) {
|
| 103 |
+
$bg_position = get_theme_mod( $control['settings'] . '_position', $control['default']['position'] );
|
| 104 |
}
|
| 105 |
if ( isset( $control['default']['opacity'] ) && $control['default']['opacity'] ) {
|
| 106 |
+
$bg_opacity = get_theme_mod( $control['settings'] . '_opacity', $control['default']['opacity'] );
|
| 107 |
if ( isset( $bg_color ) ) {
|
| 108 |
// If we're using an opacity other than 100, then convert the color to RGBA.
|
| 109 |
$bg_color = ( 100 != $bg_opacity ) ? Kirki_Color::get_rgba( $bg_color, $bg_opacity ) : $bg_color;
|
includes/controls/class-kirki-customize-radio-buttonset-control.php
CHANGED
|
@@ -24,7 +24,7 @@ class Kirki_Customize_Radio_Buttonset_Control extends WP_Customize_Control {
|
|
| 24 |
<?php endif; ?>
|
| 25 |
</span>
|
| 26 |
|
| 27 |
-
<div id="input_<?php echo $this->id; ?>" class="
|
| 28 |
<?php foreach ( $this->choices as $value => $label ) : ?>
|
| 29 |
<input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" id="<?php echo $this->id . $value; ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
|
| 30 |
<label for="<?php echo $this->id . $value; ?>">
|
| 24 |
<?php endif; ?>
|
| 25 |
</span>
|
| 26 |
|
| 27 |
+
<div id="input_<?php echo $this->id; ?>" class="buttonset">
|
| 28 |
<?php foreach ( $this->choices as $value => $label ) : ?>
|
| 29 |
<input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" id="<?php echo $this->id . $value; ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
|
| 30 |
<label for="<?php echo $this->id . $value; ?>">
|
includes/required.php
CHANGED
|
@@ -11,6 +11,8 @@ function kirki_required_script() {
|
|
| 11 |
|
| 12 |
foreach ( $controls as $control ) {
|
| 13 |
|
|
|
|
|
|
|
| 14 |
if ( isset( $control['required'] ) && ! is_null( $control['required'] && is_array( $control['required'] ) ) ) {
|
| 15 |
|
| 16 |
foreach ( $control['required'] as $id => $value ) : ?>
|
|
@@ -19,24 +21,24 @@ function kirki_required_script() {
|
|
| 19 |
jQuery(document).ready(function($) {
|
| 20 |
<?php if ( isset( $id ) && isset( $value ) ) : ?>
|
| 21 |
<?php if ( $value == get_theme_mod( $id ) ) : ?>
|
| 22 |
-
$( '[id="customize-control-<?php echo $control['
|
| 23 |
<?php else : ?>
|
| 24 |
-
$( '[id="customize-control-<?php echo $control['
|
| 25 |
<?php endif; ?>
|
| 26 |
<?php endif; ?>
|
| 27 |
|
| 28 |
$( "#input_<?php echo $id; ?> input" ).each(function(){
|
| 29 |
$(this).click(function(){
|
| 30 |
if ( $(this).val() == "<?php echo $value; ?>" ) {
|
| 31 |
-
$( '[id="customize-control-<?php echo $control['
|
| 32 |
} else {
|
| 33 |
-
$( '[id="customize-control-<?php echo $control['
|
| 34 |
}
|
| 35 |
});
|
| 36 |
if ( $(this).val() == "<?php echo $value; ?>" ) {
|
| 37 |
-
$( '[id="customize-control-<?php echo $control['
|
| 38 |
} else {
|
| 39 |
-
$( '[id="customize-control-<?php echo $control['
|
| 40 |
}
|
| 41 |
});
|
| 42 |
});
|
| 11 |
|
| 12 |
foreach ( $controls as $control ) {
|
| 13 |
|
| 14 |
+
$control = Kirki_Controls::control_clean( $control );
|
| 15 |
+
|
| 16 |
if ( isset( $control['required'] ) && ! is_null( $control['required'] && is_array( $control['required'] ) ) ) {
|
| 17 |
|
| 18 |
foreach ( $control['required'] as $id => $value ) : ?>
|
| 21 |
jQuery(document).ready(function($) {
|
| 22 |
<?php if ( isset( $id ) && isset( $value ) ) : ?>
|
| 23 |
<?php if ( $value == get_theme_mod( $id ) ) : ?>
|
| 24 |
+
$( '[id="customize-control-<?php echo $control['settings']; ?>"]' ).fadeIn(300);
|
| 25 |
<?php else : ?>
|
| 26 |
+
$( '[id="customize-control-<?php echo $control['settings']; ?>"]' ).fadeOut(300);
|
| 27 |
<?php endif; ?>
|
| 28 |
<?php endif; ?>
|
| 29 |
|
| 30 |
$( "#input_<?php echo $id; ?> input" ).each(function(){
|
| 31 |
$(this).click(function(){
|
| 32 |
if ( $(this).val() == "<?php echo $value; ?>" ) {
|
| 33 |
+
$( '[id="customize-control-<?php echo $control['settings']; ?>"]' ).fadeIn(300);
|
| 34 |
} else {
|
| 35 |
+
$( '[id="customize-control-<?php echo $control['settings']; ?>"]' ).fadeOut(300);
|
| 36 |
}
|
| 37 |
});
|
| 38 |
if ( $(this).val() == "<?php echo $value; ?>" ) {
|
| 39 |
+
$( '[id="customize-control-<?php echo $control['settings']; ?>"]' ).fadeIn(300);
|
| 40 |
} else {
|
| 41 |
+
$( '[id="customize-control-<?php echo $control['settings']; ?>"]' ).fadeOut(300);
|
| 42 |
}
|
| 43 |
});
|
| 44 |
});
|
kirki.php
CHANGED
|
@@ -5,7 +5,7 @@ Plugin URI: http://kirki.org
|
|
| 5 |
Description: An options framework using and extending the WordPress Customizer
|
| 6 |
Author: Aristeides Stathopoulos
|
| 7 |
Author URI: http://press.codes
|
| 8 |
-
Version: 0.7
|
| 9 |
*/
|
| 10 |
|
| 11 |
// Load Kirki_Fonts before everything else
|
|
@@ -17,6 +17,8 @@ include_once( dirname( __FILE__ ) . '/includes/class-kirki-fonts.php' );
|
|
| 17 |
if ( ! class_exists( 'Kirki' ) ) :
|
| 18 |
class Kirki {
|
| 19 |
|
|
|
|
|
|
|
| 20 |
public $scripts;
|
| 21 |
public $styles;
|
| 22 |
public $controls;
|
|
@@ -141,14 +143,21 @@ class Kirki {
|
|
| 141 |
|
| 142 |
function update() {
|
| 143 |
|
|
|
|
|
|
|
| 144 |
// < 0.6.1 -> 0.6.2
|
| 145 |
if ( ! get_option( 'kirki_version' ) ) {
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
| 147 |
$control_ids = array();
|
| 148 |
$controls = $this->get_controls();
|
| 149 |
foreach ( $controls as $control ) {
|
|
|
|
|
|
|
| 150 |
if ( 'background' != $control['type'] ) {
|
| 151 |
-
$control_ids[] = $control['
|
| 152 |
}
|
| 153 |
}
|
| 154 |
foreach ( $control_ids as $control_id ) {
|
|
@@ -157,8 +166,10 @@ class Kirki {
|
|
| 157 |
}
|
| 158 |
}
|
| 159 |
|
| 160 |
-
|
| 161 |
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
}
|
|
@@ -175,43 +186,49 @@ endif;
|
|
| 175 |
$GLOBALS['kirki'] = Kirki();
|
| 176 |
global $kirki;
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
Description: An options framework using and extending the WordPress Customizer
|
| 6 |
Author: Aristeides Stathopoulos
|
| 7 |
Author URI: http://press.codes
|
| 8 |
+
Version: 0.7.1
|
| 9 |
*/
|
| 10 |
|
| 11 |
// Load Kirki_Fonts before everything else
|
| 17 |
if ( ! class_exists( 'Kirki' ) ) :
|
| 18 |
class Kirki {
|
| 19 |
|
| 20 |
+
public $version = '0.7.1';
|
| 21 |
+
|
| 22 |
public $scripts;
|
| 23 |
public $styles;
|
| 24 |
public $controls;
|
| 143 |
|
| 144 |
function update() {
|
| 145 |
|
| 146 |
+
$version = get_option( 'kirki_version' );
|
| 147 |
+
$version = ( ! $version ) ? '0' : $version;
|
| 148 |
// < 0.6.1 -> 0.6.2
|
| 149 |
if ( ! get_option( 'kirki_version' ) ) {
|
| 150 |
+
/**
|
| 151 |
+
* In versions 0.6.0 & 0.6.1 there was a bug and some fields were saved as ID_opacity istead if ID
|
| 152 |
+
* This will fix the wrong settings naming and save new settings.
|
| 153 |
+
*/
|
| 154 |
$control_ids = array();
|
| 155 |
$controls = $this->get_controls();
|
| 156 |
foreach ( $controls as $control ) {
|
| 157 |
+
$control = Kirki_Controls::control_clean( $control );
|
| 158 |
+
|
| 159 |
if ( 'background' != $control['type'] ) {
|
| 160 |
+
$control_ids[] = $control['settings'];
|
| 161 |
}
|
| 162 |
}
|
| 163 |
foreach ( $control_ids as $control_id ) {
|
| 166 |
}
|
| 167 |
}
|
| 168 |
|
| 169 |
+
}
|
| 170 |
|
| 171 |
+
if ( version_compare( $this->version, $version ) ) {
|
| 172 |
+
update_option( 'kirki_version', $this->version );
|
| 173 |
}
|
| 174 |
|
| 175 |
}
|
| 186 |
$GLOBALS['kirki'] = Kirki();
|
| 187 |
global $kirki;
|
| 188 |
|
| 189 |
+
// TODO: The following is commented out because so far it just doesn't work.
|
| 190 |
+
// I can't figure out why, if anyone has any ideas then please do let me know
|
| 191 |
+
//
|
| 192 |
+
// /**
|
| 193 |
+
// * A wrapper function for get_theme_mod.
|
| 194 |
+
// *
|
| 195 |
+
// * This will be a bit more generic and will future-proof the plugin
|
| 196 |
+
// * in case we ever decide to switch to using options instead of theme mods.
|
| 197 |
+
// *
|
| 198 |
+
// * An additional benefit is that it also gets the default values
|
| 199 |
+
// * without the need to manually define them like in get_theme_mod();
|
| 200 |
+
// *
|
| 201 |
+
// * It's recommended that you add the following to your theme/plugin before using this function:
|
| 202 |
+
// *
|
| 203 |
+
|
| 204 |
+
// if ( ! function_exists( 'kirki_get_option' ) ) :
|
| 205 |
+
// function kirki_get_option( $option ) {
|
| 206 |
+
// get_theme_mod( $option, '' );
|
| 207 |
+
// }
|
| 208 |
+
// endif;
|
| 209 |
+
|
| 210 |
+
// *
|
| 211 |
+
// * This will NOT get the right value, but at least no fatal errors will occur in case the plugin is not installed.
|
| 212 |
+
// */
|
| 213 |
+
// function kirki_get_option( $option ) {
|
| 214 |
+
|
| 215 |
+
// // Get the array of controls
|
| 216 |
+
// $controls = Kirki()->get_controls();
|
| 217 |
+
|
| 218 |
+
// foreach ( $controls as $control ) {
|
| 219 |
+
// // Sanitize out control array and make sure we're using the right syntax
|
| 220 |
+
// $control = Kirki_Controls::control_clean( $control );
|
| 221 |
+
// $setting = $control['settings'];
|
| 222 |
+
// // Get the theme_mod and pass the default value as well
|
| 223 |
+
// if ( $option == $setting ) {
|
| 224 |
+
// $value = get_theme_mod( $option, $control['default'] );
|
| 225 |
+
// }
|
| 226 |
+
|
| 227 |
+
// }
|
| 228 |
+
|
| 229 |
+
// // If no value has been set, use get_theme_mod with an empty default.
|
| 230 |
+
// $value = ( isset( $value ) ) ? $value : get_theme_mod( $option, '' );
|
| 231 |
+
|
| 232 |
+
// return $value;
|
| 233 |
+
|
| 234 |
+
// }
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Tags: customizer, options famework, theme mods
|
|
| 4 |
Donate link: http://kirki.org/
|
| 5 |
Requires at least: 4.0
|
| 6 |
Tested up to: 4.1.1
|
| 7 |
-
Stable tag: 0.7
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -50,6 +50,13 @@ For configuration instructions please visit http://kirki.org/#configuration
|
|
| 50 |
|
| 51 |
|
| 52 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
== 0.7 - 2014-03-14, dev time: 10 hours ==
|
| 54 |
* Fix: Array to string conversion that happened conditionally when used with googlefonts. (props @groucho75)
|
| 55 |
* Fix: Background opacity affects background-position of bg image
|
| 4 |
Donate link: http://kirki.org/
|
| 5 |
Requires at least: 4.0
|
| 6 |
Tested up to: 4.1.1
|
| 7 |
+
Stable tag: 0.7.1
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 50 |
|
| 51 |
|
| 52 |
== Changelog ==
|
| 53 |
+
|
| 54 |
+
== 0.7.1 - 2014-03-15, dev time 2 hours ==
|
| 55 |
+
* Removed: Remove the `kirki_get_option` function that was introduced in 0.7 as it's not working properly yet.
|
| 56 |
+
* Fix: Undefined index notice when a default value for the control was not defined
|
| 57 |
+
* Tweak: `logo_image` now injects an `img` element instead of a `div` with custom background
|
| 58 |
+
* New: Added `description` argument in the kirki configuration (replaces the theme description)
|
| 59 |
+
|
| 60 |
== 0.7 - 2014-03-14, dev time: 10 hours ==
|
| 61 |
* Fix: Array to string conversion that happened conditionally when used with googlefonts. (props @groucho75)
|
| 62 |
* Fix: Background opacity affects background-position of bg image
|
