mirror of
https://ghproxy.net/https://github.com/AlxMedia/curver.git
synced 2025-08-28 06:37:49 +08:00
1.0.7
This commit is contained in:
parent
62def2a89b
commit
7ad333b360
167 changed files with 2955 additions and 2493 deletions
|
@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
@ -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'] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ) ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue