This commit is contained in:
Alexander Agnarson 2019-02-17 14:28:35 +01:00
parent b14ccb1b03
commit 7e3774b663
168 changed files with 2453 additions and 2788 deletions

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/
@ -64,7 +64,7 @@ class Kirki_Controls {
foreach ( $this->templates as $template ) {
if ( file_exists( $this->views_path . $template . '.php' ) ) {
echo '<script type="text/html" id="tmpl-kirki-input-' . esc_attr( $template ) . '">';
include $this->views_path . $template . '.php';
include $this->views_path . $template . '.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
echo '</script>';
}
}

File diff suppressed because it is too large Load diff

View file

@ -830,7 +830,13 @@ kirki = jQuery.extend( kirki, {
} );
element.on( 'change keyup paste click', function() {
kirki.setting.set( control.id, jQuery( this ).val() );
var val = jQuery( this ).val();
if ( isNaN( val ) ) {
val = parseFloat( val, 10 );
val = ( isNaN( val ) ) ? 0 : val;
jQuery( this ).attr( 'value', val );
}
kirki.setting.set( control.id, val );
} );
}
@ -899,7 +905,7 @@ kirki = jQuery.extend( kirki, {
previewImage = jsonImg.url;
if ( ! _.isUndefined( jsonImg.sizes ) ) {
previewImg = jsonImg.sizes.full.url;
previewImage = jsonImg.sizes.full.url;
if ( ! _.isUndefined( jsonImg.sizes.medium ) ) {
previewImage = jsonImg.sizes.medium.url;
} else if ( ! _.isUndefined( jsonImg.sizes.thumbnail ) ) {
@ -3170,7 +3176,6 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC
control.renderFontSelector();
control.renderBackupFontSelector();
control.renderVariantSelector();
control.localFontsCheckbox();
// Font-size.
if ( 'undefined' !== typeof control.params.default['font-size'] ) {
@ -3568,22 +3573,6 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC
};
},
localFontsCheckbox: function() {
var control = this,
checkboxContainer = control.container.find( '.kirki-host-font-locally' ),
checkbox = control.container.find( '.kirki-host-font-locally input' ),
checked = jQuery( checkbox ).is( ':checked' );
if ( control.setting._value && control.setting._value.downloadFont ) {
jQuery( checkbox ).attr( 'checked', 'checked' );
}
jQuery( checkbox ).on( 'change', function() {
checked = jQuery( checkbox ).is( ':checked' );
control.saveValue( 'downloadFont', checked );
} );
},
/**
* Saves the value.
*/

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.12
*/
@ -218,9 +218,6 @@ class Kirki_Control_Base extends WP_Customize_Control {
*
* Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`.
*
* Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`.
* Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly.
*
* Control content can alternately be rendered in JS. See WP_Customize_Control::print_template().
*
* @since 3.4.0

View file

@ -7,7 +7,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.26
*/

View file

@ -5,70 +5,43 @@
* Creates a new custom control.
* Custom controls accept raw HTML/JS.
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
* @since 1.0
*/
// @codingStandardsIgnoreFile Generic.Files.OneClassPerFile.MultipleFound Generic.Classes.DuplicateClassName.Found
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Show warning if old WordPress.
* Adds a "code" control, alias of the WP_Customize_Code_Editor_Control class.
*/
if ( ! class_exists( 'WP_Customize_Code_Editor_Control' ) ) {
/**
* Adds a warning message instead of the control.
*/
class Kirki_Control_Code extends Kirki_Control_Base {
/**
* The message.
*
* @since 3.0.21
*/
protected function content_template() {
?>
<div class="notice notice-error" data-type="error"><div class="notification-message">
<?php esc_html_e( 'Please update your WordPress installation to a version newer than 4.9 to access the code control.', 'kirki' ); ?>
</div></div>
<?php
}
}
} else {
class Kirki_Control_Code extends WP_Customize_Code_Editor_Control {
/**
* Adds a "code" control, alias of the WP_Customize_Code_Editor_Control class.
* Whitelisting the "required" argument.
*
* @since 3.0.17
* @access public
* @var array
*/
class Kirki_Control_Code extends WP_Customize_Code_Editor_Control {
public $required = array();
/**
* Whitelisting the "required" argument.
*
* @since 3.0.17
* @access public
* @var array
*/
public $required = array();
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
// Get the basics from the parent class.
parent::to_json();
// Get the basics from the parent class.
parent::to_json();
// Required.
$this->json['required'] = $this->required;
}
// Required.
$this->json['required'] = $this->required;
}
}

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.2.6
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.23
*/

View file

@ -7,7 +7,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.2.4
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.2
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.0
*/
@ -35,7 +35,9 @@ class Kirki_Control_Dimension extends Kirki_Control_Base {
public function enqueue() {
parent::enqueue();
wp_localize_script(
'kirki-script', 'dimensionkirkiL10n', array(
'kirki-script',
'dimensionkirkiL10n',
array(
'invalid-value' => esc_html__( 'Invalid Value', 'kirki' ),
)
);

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.1
*/

View file

@ -6,7 +6,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -39,7 +39,7 @@ class Kirki_Control_FontAwesome extends Kirki_Control_Base {
ob_start();
$json_path = wp_normalize_path( Kirki::$path . '/assets/vendor/fontawesome/fontawesome.json' );
include $json_path;
include $json_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
$font_awesome_json = ob_get_clean();
wp_localize_script( 'kirki-script', 'fontAwesomeJSON', $font_awesome_json );

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.0
*/

View file

@ -7,7 +7,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.2.7
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.0
*/
@ -108,13 +108,11 @@ class Kirki_Control_Repeater extends Kirki_Control_Base {
case 'image':
case 'cropped_image':
case 'upload':
// We add it to the list of fields that need some extra filtering/processing.
$media_fields_to_filter[ $key ] = true;
break;
case 'dropdown-pages':
// If the field is a dropdown-pages field then add it to args.
$dropdown = wp_dropdown_pages(
array(
@ -127,7 +125,7 @@ class Kirki_Control_Repeater extends Kirki_Control_Base {
);
// Hackily add in the data link parameter.
$dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning
$dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment
$args['fields'][ $key ]['dropdown'] = $dropdown;
break;
}
@ -417,7 +415,7 @@ class Kirki_Control_Repeater extends Kirki_Control_Base {
</figure>
<div class="actions">
<button type="button" class="button remove-button<# if ( ! field.default ) { #> hidden<# } #>"></button>
<button type="button" class="button remove-button<# if ( ! field.default ) { #> hidden<# } #>"><?php esc_html_e( 'Remove', 'kirki' ); ?></button>
<button type="button" class="button upload-button" data-label="<?php esc_attr_e( 'Add File', 'kirki' ); ?>" data-alt-label="<?php esc_attr_e( 'Change File', 'kirki' ); ?>">
<# if ( field.default ) { #>
<?php esc_html_e( 'Change File', 'kirki' ); ?>

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -37,7 +37,8 @@ class Kirki_Control_Slider extends Kirki_Control_Base {
public function to_json() {
parent::to_json();
$this->json['choices'] = wp_parse_args(
$this->json['choices'], array(
$this->json['choices'],
array(
'min' => '0',
'max' => '100',
'step' => '1',

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.0
*/
@ -94,12 +94,6 @@ class Kirki_Control_Typography extends Kirki_Control_Base {
<select {{{ data.inputAttrs }}} class="variant" id="kirki-typography-variant-{{{ data.id }}}"></select>
</div>
<# } #>
<div class="kirki-host-font-locally">
<label>
<input type="checkbox">
<?php esc_html_e( 'Download font-family to server instead of using the Google CDN.', 'kirki' ); ?>
</label>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['font-size'] ) ) { #>

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.23
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 2.0
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.34
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.27
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -4,7 +4,7 @@
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/