This commit is contained in:
Alexander Agnarson 2020-02-25 18:04:54 +01:00
parent 62def2a89b
commit 7ad333b360
167 changed files with 2955 additions and 2493 deletions

1292
functions/kirki/CHANGELOG.md Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,28 +1,36 @@
.select2-dropdown {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0; }
border-radius: 0;
}
.select2-container {
min-width: 100px;
width: 100% !important; }
.select2-container--open .select2-dropdown--above,
.select2-container--open .select2-dropdown--below {
z-index: 9999999;
min-width: 100px; }
.select2-container--default .select2-search--dropdown .select2-search__field {
border-color: rgba(0, 0, 0, 0.1); }
.select2-container--default .select2-selection--multiple, .select2-container--default .select2-selection--single {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: rgba(255, 255, 255, 0);
background-color: transparent;
border: none;
border-radius: 0; }
width: 100% !important;
}
.select2-container--open .select2-dropdown--above,
.select2-container--open .select2-dropdown--below {
z-index: 9999999;
min-width: 100px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
border-color: rgba(0, 0, 0, 0.1);
}
.select2-container--default .select2-selection--multiple, .select2-container--default .select2-selection--single {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: rgba(255, 255, 255, 0);
background-color: transparent;
border: none;
border-radius: 0;
}
.wp-customizer .select2-container {
z-index: 8 !important; }
.wp-customizer .select2-container.select2-container--open {
z-index: 999999 !important; }
z-index: 8 !important;
}
.wp-customizer .select2-container.select2-container--open {
z-index: 999999 !important;
}
/*# sourceMappingURL=kirki.css.map */

View file

@ -7,7 +7,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

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

File diff suppressed because it is too large Load diff

View file

@ -62,7 +62,6 @@ if ( _.isUndefined( window.kirkiSetSettingValue ) ) {
break;
case 'kirki-select':
case 'kirki-fontawesome':
$this.setSelectWoo( $this.findElement( setting, 'select' ), value );
break;
@ -1970,13 +1969,15 @@ wp.customize.controlConstructor['kirki-editor'] = wp.customize.kirkiDynamicContr
id = 'kirki-editor-' + control.id.replace( '[', '' ).replace( ']', '' ),
editor;
wp.editor.initialize( id, {
tinymce: {
wpautop: true
},
quicktags: true,
mediaButtons: true
} );
if ( wp.editor && wp.editor.initialize ) {
wp.editor.initialize( id, {
tinymce: {
wpautop: true
},
quicktags: true,
mediaButtons: true
} );
}
editor = tinyMCE.get( id );
@ -1992,45 +1993,6 @@ wp.customize.controlConstructor['kirki-editor'] = wp.customize.kirkiDynamicContr
}
}
} );
/* global fontAwesomeJSON */
wp.customize.controlConstructor['kirki-fontawesome'] = wp.customize.kirkiDynamicControl.extend( {
initKirkiControl: function() {
var control = this,
element = this.container.find( 'select' ),
icons = jQuery.parseJSON( fontAwesomeJSON ),
selectValue,
selectWooOptions = {
data: [],
escapeMarkup: function( markup ) {
return markup;
},
templateResult: function( val ) {
return '<i class="fa fa-lg fa-' + val.id + '" aria-hidden="true"></i>' + ' ' + val.text;
},
templateSelection: function( val ) {
return '<i class="fa fa-lg fa-' + val.id + '" aria-hidden="true"></i>' + ' ' + val.text;
}
},
select;
_.each( icons.icons, function( icon ) {
selectWooOptions.data.push( {
id: icon.id,
text: icon.name
} );
} );
select = jQuery( element ).selectWoo( selectWooOptions );
select.on( 'change', function() {
selectValue = jQuery( this ).val();
control.setting.set( selectValue );
} );
select.val( control.setting._value ).trigger( 'change' );
}
} );
wp.customize.controlConstructor['kirki-multicheck'] = wp.customize.kirkiDynamicControl.extend( {
initKirkiControl: function() {

File diff suppressed because one or more lines are too long

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,67 +0,0 @@
<?php
/**
* Customizer Control: kirki-fontawesome.
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Select control.
*/
class Kirki_Control_FontAwesome extends Kirki_Control_Base {
/**
* The control type.
*
* @access public
* @var string
*/
public $type = 'kirki-fontawesome';
/**
* Enqueue control related scripts/styles.
*
* @access public
*/
public function enqueue() {
parent::enqueue();
wp_enqueue_script( 'kirki-fontawesome-font', 'https://use.fontawesome.com/30858dc40a.js', array(), '4.0.7', false );
ob_start();
$json_path = wp_normalize_path( Kirki::$path . '/assets/vendor/fontawesome/fontawesome.json' );
include $json_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
$font_awesome_json = ob_get_clean();
wp_localize_script( 'kirki-script', 'fontAwesomeJSON', $font_awesome_json );
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*
* @access protected
*/
protected function content_template() {
?>
<label>
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
<select {{{ data.inputAttrs }}} {{{ data.link }}}></select>
</label>
<?php
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/
@ -24,7 +24,7 @@ data = _.defaults( data, {
} );
#>
<div class="kirki-input-container" data-id="{{ data['data-id'] }}">
<div class="kirki-input-container" data-id="{{ data['data-id'] }}" data-has-alpha="{{ data['data-alpha'] }}">
<label>
<# if ( data.label ) { #>
<span class="customize-control-title">{{{ data.label }}}</span>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
*/
/**

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
*/
/**

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -254,7 +254,7 @@ class Kirki_Field {
// assume that the provided argument is $args and set $config_id = 'global'.
if ( is_array( $config_id ) && empty( $args ) ) {
/* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://kirki.org/docs/getting-started/fields.html' ), '3.0.10' );
$args = $config_id;
$config_id = 'global';
}
@ -264,7 +264,7 @@ class Kirki_Field {
$this->kirki_config = $config_id;
if ( '' === $config_id ) {
/* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://kirki.org/docs/getting-started/fields.html' ), '3.0.10' );
$this->kirki_config = 'global';
}

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -24,6 +24,16 @@ class Kirki_Init {
*/
private $control_types = array();
/**
* Should we show a nag for the deprecated fontawesome field?
*
* @static
* @access private
* @since 3.0.42
* @var bool
*/
private static $show_fa_nag = false;
/**
* The class constructor.
*/
@ -37,6 +47,9 @@ class Kirki_Init {
add_action( 'customize_register', array( $this, 'remove_sections' ), 99999 );
add_action( 'customize_register', array( $this, 'remove_controls' ), 99999 );
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
add_action( 'admin_init', array( $this, 'dismiss_nag' ) );
new Kirki_Values();
new Kirki_Sections();
}
@ -89,7 +102,6 @@ class Kirki_Init {
'kirki-dimension' => 'Kirki_Control_Dimension',
'kirki-dimensions' => 'Kirki_Control_Dimensions',
'kirki-editor' => 'Kirki_Control_Editor',
'kirki-fontawesome' => 'Kirki_Control_FontAwesome',
'kirki-image' => 'Kirki_Control_Image',
'kirki-multicolor' => 'Kirki_Control_Multicolor',
'kirki-multicheck' => 'Kirki_Control_MultiCheck',
@ -316,4 +328,91 @@ class Kirki_Init {
$wp_customize->remove_control( $control );
}
}
/**
* Shows an admin notice.
*
* @access public
* @since 3.0.42
* @return void
*/
public function admin_notices() {
// No need for a nag if we don't need to recommend installing the FA plugin.
if ( ! self::$show_fa_nag ) {
return;
}
// No need for a nag if FA plugin is already installed.
if ( defined( 'FONTAWESOME_DIR_PATH' ) ) {
return;
}
// No need for a nag if current user can't install plugins.
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
// No need for a nag if user has dismissed it.
$dismissed = get_user_meta( get_current_user_id(), 'kirki_fa_nag_dismissed', true );
if ( true === $dismissed || 1 === $dismissed || '1' === $dismissed ) {
return;
}
?>
<div class="notice notice-info is-dismissible">
<p>
<?php esc_html_e( 'Your theme uses a Font Awesome field for icons. To avoid issues with missing icons on your frontend we recommend you install the official Font Awesome plugin.', 'kirki' ); ?>
</p>
<p>
<a class="button button-primary" href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=plugin-information&plugin=font-awesome&TB_iframe=true&width=600&height=550' ) ); ?>"><?php esc_html_e( 'Install Plugin', 'kirki' ); ?></a>
<a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( admin_url( '?dismiss-nag=font-awesome-kirki' ), 'kirki-dismiss-nag', 'nonce' ) ); ?>"><?php esc_html_e( 'Don\'t show this again', 'kirki' ); ?></a>
</p>
</div>
<?php
}
/**
* Dismisses the nag.
*
* @access public
* @since 3.0.42
* @return void
*/
public function dismiss_nag() {
if ( isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'kirki-dismiss-nag' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
if ( get_current_user_id() && isset( $_GET['dismiss-nag'] ) && 'font-awesome-kirki' === $_GET['dismiss-nag'] ) {
update_user_meta( get_current_user_id(), 'kirki_fa_nag_dismissed', true );
}
}
}
/**
* Handles showing a nag if the theme is using the deprecated fontawesome field
*
* @static
* @access protected
* @since 3.0.42
* @param array $args The field arguments.
* @return void
*/
protected static function maybe_show_fontawesome_nag( $args ) {
// If we already know we want it, skip check.
if ( self::$show_fa_nag ) {
return;
}
// Check if the field is fontawesome.
if ( isset( $args['type'] ) && in_array( $args['type'], array( 'fontawesome', 'kirki-fontawesome' ), true ) ) {
// Skip check if theme has disabled FA enqueueing via a filter.
if ( ! apply_filters( 'kirki_load_fontawesome', true ) ) {
return;
}
// If we got this far, we need to show the nag.
self::$show_fa_nag = true;
}
}
}

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 3.0.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -7,7 +7,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,7 +6,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 3.0.9
*/

View file

@ -1,6 +1,6 @@
<?php
/**
* Hekoers to get the values of a field.
* Helpers to get the values of a field.
* WARNING: PLEASE DO NOT USE THESE.
* we only have these for backwards-compatibility purposes.
* please use get_option() & get_theme_mod() instead.
@ -9,7 +9,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -47,7 +47,10 @@ class Kirki_Values {
// Combine font-family and font-backup.
if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) {
$value['font-family'] .= ', ' . $value['font-backup'];
$backup = trim( $value['font-backup'] );
if ( ! empty( $backup ) ) {
$value['font-family'] .= ', ' . $backup;
}
unset( $value['font-backup'] );
}
}

View file

@ -8,7 +8,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -237,16 +237,13 @@ class Kirki extends Kirki_Init {
_doing_it_wrong( __METHOD__, esc_html__( 'Kirki fields should not be added on customize_register. Please add them directly, or on init.', 'kirki' ), '3.0.10' );
}
parent::maybe_show_fontawesome_nag( $args );
// Early exit if 'type' is not defined.
if ( ! isset( $args['type'] ) ) {
return;
}
// If the field is font-awesome, enqueue the icons on the frontend.
if ( class_exists( 'Kirki_Modules_CSS' ) && ( 'fontawesome' === $args['type'] || 'kirki-fontawesome' === $args['type'] ) ) {
Kirki_Modules_CSS::add_fontawesome_script();
}
$str = str_replace( array( '-', '_' ), ' ', $args['type'] );
$classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) );
if ( class_exists( $classname ) ) {

View file

@ -8,7 +8,7 @@
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -103,10 +103,6 @@ add_filter( 'kirki_fonts_standard_fonts', function( $args ) {
return apply_filters( 'kirki/fonts/standard_fonts', $args );
}, 99 );
add_filter( 'kirki_fonts_backup_fonts', function( $args ) {
return apply_filters( 'kirki/fonts/backup_fonts', $args );
}, 99 );
add_filter( 'kirki_fonts_google_fonts', function( $args ) {
return apply_filters( 'kirki/fonts/google_fonts', $args );
}, 99 );

View file

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

View file

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

View file

@ -5,7 +5,7 @@
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 2.2.7
*/
@ -96,6 +96,17 @@ class Kirki_Field_Code extends Kirki_Field {
if ( ! isset( $this->editor_settings['codemirror']['mode'] ) ) {
$this->editor_settings['codemirror']['mode'] = $language;
}
if ( 'text/x-scss' === $this->editor_settings['codemirror']['mode'] ) {
$this->editor_settings['codemirror'] = array_merge(
$this->editor_settings['codemirror'],
array(
'lint' => false,
'autoCloseBrackets' => true,
'matchBrackets' => true,
)
);
}
}
/**

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,22 +5,37 @@
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @license https://opensource.org/licenses/MIT
* @since 3.0.0
*/
/**
* Field overrides.
*/
class Kirki_Field_FontAwesome extends Kirki_Field {
class Kirki_Field_FontAwesome extends Kirki_Field_Select {
/**
* Sets the control type.
* Set dropdown choices from the FA JSON.
*
* @access protected
* @since 3.0.42
* @return void
*/
protected function set_type() {
$this->type = 'kirki-fontawesome';
protected function set_choices() {
ob_start();
$json_path = wp_normalize_path( Kirki::$path . '/assets/vendor/fontawesome/fontawesome.json' );
include $json_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
$font_awesome_json = ob_get_clean();
$fa_array = (array) json_decode( $font_awesome_json, true );
$this->choices = array();
foreach ( $fa_array['icons'] as $icon ) {
if ( ! isset( $icon['id'] ) || ! isset( $icon['name'] ) ) {
continue;
}
$this->choices[ $icon['id'] ] = $icon['name'];
}
}
/**

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

Some files were not shown because too many files have changed in this diff Show more