Skip to content

Commit

Permalink
Merge pull request #1700 from aristath/develop
Browse files Browse the repository at this point in the history
3.0.20
  • Loading branch information
aristath authored Dec 13, 2017
2 parents 3e49534 + bf36e97 commit fe99464
Show file tree
Hide file tree
Showing 19 changed files with 136 additions and 28 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ module.exports = function( grunt ) {
grunt.task.run( 'googlefontsProcess' );
grunt.task.run( 'json2php' );
} );
grunt.registerTask( 'default', ['sass:dist', 'concat', 'uglify', 'googlefonts', 'wp_readme_to_markdown'] );
grunt.registerTask( 'default', ['sass:dist', 'concat', 'uglify'] );
grunt.registerTask( 'readme', ['wp_readme_to_markdown'] );
grunt.registerTask( 'all', ['default', 'googlefonts', 'wp_readme_to_markdown'] );
};
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
**Tags:** customizer,options framework, theme, mods, toolkit
**Donate link:** https://aristath.github.io/donate
**Requires at least:** 4.8.2
**Tested up to:** 4.9.2
**Stable tag:** 3.0.19
**Tested up to:** 4.9.1
**Stable tag:** 3.0.20
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -33,6 +33,16 @@ If you want to integrate Kirki in your theme or plugin, please read the instruct

## Changelog ##

### 3.0.20 ###

December 13 2017, dev time: 1.5 hours

* Fix: Use `repeat` instead of `repeat-all` in background controls [#1701](https://github.com/aristath/kirki/issues/1701)
* Fix: Use `set_url_scheme()` when outputing images [#1697](https://github.com/aristath/kirki/issues/1697)
* Fix: `textarea` control is broken with HTML content [#1694](https://github.com/aristath/kirki/issues/1694) props @tutv95
* Fix: Typo in `radio` controls [#1699](https://github.com/aristath/kirki/issues/1699)
* Fix: variants selection for standard font-families.

### 3.0.19 ###

December 8 2017, dev time: 20 minutes.
Expand Down
29 changes: 29 additions & 0 deletions controls/js/dist/script-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,35 @@ kirki = jQuery.extend( kirki, {
getVariants: function( family ) { // jshint ignore: line
return ['regular', 'italic', '700', '700italic'];
}
},

/**
* Figure out what this font-family is (google/standard)
*
* @since 3.0.20
* @param {string} family - The font-family.
* @returns {string|false} - Returns string if found (google|standard)
* and false in case the font-family is an arbitrary value
* not found anywhere in our font definitions.
*/
getFontType: function( family ) {
var self = this;

// Check for standard fonts first.
if (
'undefined' !== typeof self.standard.fonts[ family ] || (
'undefined' !== typeof self.standard.fonts.stack &&
'undefined' !== typeof self.standard.fonts.stack[ family ]
)
) {
return 'standard';
}

// Check in googlefonts.
if ( 'undefined' !== typeof self.google.fonts.items[ family ] ) {
return 'google';
}
return false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion controls/js/dist/script-legacy.min.js

Large diffs are not rendered by default.

39 changes: 34 additions & 5 deletions controls/js/dist/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,35 @@ kirki = jQuery.extend( kirki, {
getVariants: function( family ) { // jshint ignore: line
return ['regular', 'italic', '700', '700italic'];
}
},

/**
* Figure out what this font-family is (google/standard)
*
* @since 3.0.20
* @param {string} family - The font-family.
* @returns {string|false} - Returns string if found (google|standard)
* and false in case the font-family is an arbitrary value
* not found anywhere in our font definitions.
*/
getFontType: function( family ) {
var self = this;

// Check for standard fonts first.
if (
'undefined' !== typeof self.standard.fonts[ family ] || (
'undefined' !== typeof self.standard.fonts.stack &&
'undefined' !== typeof self.standard.fonts.stack[ family ]
)
) {
return 'standard';
}

// Check in googlefonts.
if ( 'undefined' !== typeof self.google.fonts.items[ family ] ) {
return 'google';
}
return false;
}
}
}
Expand Down Expand Up @@ -3382,7 +3411,7 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC
}

// Hide if we're not on a google-font.
if ( false === kirki.util.webfonts.google.getFont( fontFamily ) ) {
if ( 'google' !== kirki.util.webfonts.getFontType( fontFamily ) ) {
jQuery( control.selector + ' .font-backup' ).hide();
return;
}
Expand Down Expand Up @@ -3425,17 +3454,17 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC
var control = this,
value = control.setting._value,
fontFamily = value['font-family'],
variants = kirki.util.webfonts.google.getVariants( fontFamily ),
selector = control.selector + ' .variant select',
data = [],
isValid = false,
fontType = kirki.util.webfonts.getFontType( fontFamily ),
variants = ['regular', 'italic', '700', '700italic'],
fontWeight,
variantSelector,
fontStyle;

if ( false === kirki.util.webfonts.google.getFont( fontFamily ) ) {
jQuery( control.selector + ' .variant' ).hide();
return;
if ( 'google' === fontType ) {
variants = kirki.util.webfonts.google.getVariants( fontFamily );
}

jQuery( control.selector + ' .variant' ).show();
Expand Down
2 changes: 1 addition & 1 deletion controls/js/dist/script.min.js

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions controls/js/src/kirki.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,35 @@ kirki = jQuery.extend( kirki, {
getVariants: function( family ) { // jshint ignore: line
return ['regular', 'italic', '700', '700italic'];
}
},

/**
* Figure out what this font-family is (google/standard)
*
* @since 3.0.20
* @param {string} family - The font-family.
* @returns {string|false} - Returns string if found (google|standard)
* and false in case the font-family is an arbitrary value
* not found anywhere in our font definitions.
*/
getFontType: function( family ) {
var self = this;

// Check for standard fonts first.
if (
'undefined' !== typeof self.standard.fonts[ family ] || (
'undefined' !== typeof self.standard.fonts.stack &&
'undefined' !== typeof self.standard.fonts.stack[ family ]
)
) {
return 'standard';
}

// Check in googlefonts.
if ( 'undefined' !== typeof self.google.fonts.items[ family ] ) {
return 'google';
}
return false;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions controls/js/src/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC
}

// Hide if we're not on a google-font.
if ( false === kirki.util.webfonts.google.getFont( fontFamily ) ) {
if ( 'google' !== kirki.util.webfonts.getFontType( fontFamily ) ) {
jQuery( control.selector + ' .font-backup' ).hide();
return;
}
Expand Down Expand Up @@ -222,17 +222,17 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC
var control = this,
value = control.setting._value,
fontFamily = value['font-family'],
variants = kirki.util.webfonts.google.getVariants( fontFamily ),
selector = control.selector + ' .variant select',
data = [],
isValid = false,
fontType = kirki.util.webfonts.getFontType( fontFamily ),
variants = ['regular', 'italic', '700', '700italic'],
fontWeight,
variantSelector,
fontStyle;

if ( false === kirki.util.webfonts.google.getFont( fontFamily ) ) {
jQuery( control.selector + ' .variant' ).hide();
return;
if ( 'google' === fontType ) {
variants = kirki.util.webfonts.google.getVariants( fontFamily );
}

jQuery( control.selector + ' .variant' ).show();
Expand Down
2 changes: 1 addition & 1 deletion controls/php/class-kirki-control-background.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function content_template() {
<h4><?php esc_attr_e( 'Background Repeat', 'kirki' ); ?></h4>
<select {{{ data.inputAttrs }}}>
<option value="no-repeat"<# if ( 'no-repeat' === data.value['background-repeat'] ) { #> selected <# } #>><?php esc_attr_e( 'No Repeat', 'kirki' ); ?></option>
<option value="repeat-all"<# if ( 'repeat-all' === data.value['background-repeat'] ) { #> selected <# } #>><?php esc_attr_e( 'Repeat All', 'kirki' ); ?></option>
<option value="repeat"<# if ( 'repeat' === data.value['background-repeat'] ) { #> selected <# } #>><?php esc_attr_e( 'Repeat All', 'kirki' ); ?></option>
<option value="repeat-x"<# if ( 'repeat-x' === data.value['background-repeat'] ) { #> selected <# } #>><?php esc_attr_e( 'Repeat Horizontally', 'kirki' ); ?></option>
<option value="repeat-y"<# if ( 'repeat-y' === data.value['background-repeat'] ) { #> selected <# } #>><?php esc_attr_e( 'Repeat Vertically', 'kirki' ); ?></option>
</select>
Expand Down
2 changes: 1 addition & 1 deletion controls/views/radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
type="radio"
data-id="{{ data['data-id'] }}"
value="{{ key }}"
name="_customize-radio-{{ data.id }}"
name="_customize-radio-{{ data['data-id'] }}"
<# if ( data.value === key ) { #> checked<# } #>
/>
<# if ( _.isArray( val ) ) { #>
Expand Down
1 change: 0 additions & 1 deletion controls/views/textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<textarea
data-id="{{ data['data-id'] }}"
{{{ data.inputAttrs }}}
value="{{{ data.value }}}"
<# _.each( data.choices, function( val, key ) { #>
{{ key }}="{{ val }}"
<# }); #>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/controls/background.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Kirki::add_field( 'theme_config_id', array(
'default' => array(
'background-color' => 'rgba(20,20,20,.8)',
'background-image' => '',
'background-repeat' => 'repeat-all',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'cover',
'background-attachment' => 'scroll',
Expand Down
3 changes: 2 additions & 1 deletion docs/files/class-my-theme-kirki.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function get_styles() {
$output['property'] = $output['property'] . '-' . $key;
}
if ( 'background-image' === $output['property'] && false === strpos( $subvalue, 'url(' ) ) {
$subvalue = 'url("' . $subvalue . '")';
$subvalue = 'url("' . set_url_scheme( $subvalue ) . '")';
}
if ( $subvalue ) {
$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue;
Expand Down Expand Up @@ -342,6 +342,7 @@ public function get_styles() {
// Make sure background-images are properly formatted.
if ( 'background-image' === $property ) {
if ( false === strrpos( $value, 'url(' ) ) {
$value = set_url_scheme( $value );
$value = 'url("' . esc_url_raw( $value ) . '")';
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function my_config_kirki_add_field( $args ) {
'default' => array(
'background-color' => 'rgba(20,20,20,.8)',
'background-image' => '',
'background-repeat' => 'repeat-all',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'cover',
'background-attachment' => 'scroll',
Expand Down
2 changes: 1 addition & 1 deletion kirki.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: The ultimate WordPress Customizer Toolkit
* Author: Aristeides Stathopoulos
* Author URI: http://aristath.github.io
* Version: 3.0.19
* Version: 3.0.20
* Text Domain: kirki
*
* GitHub Plugin URI: aristath/kirki
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ protected function process_value() {
}

if ( preg_match( '/^\d+$/', $this->value ) ) {
$this->value = 'url("' . wp_get_attachment_url( $this->value ) . '")';
$this->value = 'url("' . set_url_scheme( wp_get_attachment_url( $this->value ) ) . '")';
} else {
$this->value = 'url("' . $this->value . '")';
$this->value = 'url("' . set_url_scheme( $this->value ) . '")';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/webfonts/webfonts.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/webfonts/webfonts.php

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: aristath, fovoc, igmoweb
Tags: customizer,options framework, theme, mods, toolkit
Donate link: https://aristath.github.io/donate
Requires at least: 4.8.2
Tested up to: 4.9.2
Stable tag: 3.0.19
Tested up to: 4.9.1
Stable tag: 3.0.20
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -33,6 +33,16 @@ If you want to integrate Kirki in your theme or plugin, please read the instruct

== Changelog ==

= 3.0.20 =

December 13 2017, dev time: 1.5 hours

* Fix: Use `repeat` instead of `repeat-all` in background controls [#1701](https://github.com/aristath/kirki/issues/1701)
* Fix: Use `set_url_scheme()` when outputing images [#1697](https://github.com/aristath/kirki/issues/1697)
* Fix: `textarea` control is broken with HTML content [#1694](https://github.com/aristath/kirki/issues/1694) props @tutv95
* Fix: Typo in `radio` controls [#1699](https://github.com/aristath/kirki/issues/1699)
* Fix: variants selection for standard font-families.

= 3.0.19 =

December 8 2017, dev time: 20 minutes.
Expand Down

0 comments on commit fe99464

Please sign in to comment.