Updated Kirki from 3.0.34.1 to 3.0.35.3

This commit is contained in:
LebCit
2019-04-30 02:23:07 +03:00
parent e4771048aa
commit 14d3666080
113 changed files with 978 additions and 783 deletions
@@ -74,7 +74,6 @@ class Kirki_Modules_CSS {
* @access protected
*/
protected function __construct() {
$class_files = array(
'Kirki_CSS_To_File' => '/class-kirki-css-to-file.php',
'Kirki_Modules_CSS_Generator' => '/class-kirki-modules-css-generator.php',
@@ -95,9 +94,7 @@ class Kirki_Modules_CSS {
include_once wp_normalize_path( dirname( __FILE__ ) . $file );
}
}
add_action( 'init', array( $this, 'init' ) );
}
/**
@@ -122,11 +119,10 @@ class Kirki_Modules_CSS {
* @access public
*/
public function init() {
global $wp_customize;
Kirki_Modules_Webfonts::get_instance();
global $wp_customize;
$config = apply_filters( 'kirki_config', array() );
$priority = 999;
if ( isset( $config['styles_priority'] ) ) {
@@ -140,8 +136,10 @@ class Kirki_Modules_CSS {
$method = apply_filters( 'kirki_dynamic_css_method', 'inline' );
if ( $wp_customize ) {
// If we're in the customizer, load inline no matter what.
add_action( 'wp_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority );
add_action( 'enqueue_block_editor_assets', array( $this, 'inline_dynamic_css' ), $priority );
// If we're using file method, on save write the new styles.
if ( 'file' === $method ) {
@@ -152,10 +150,13 @@ class Kirki_Modules_CSS {
}
if ( 'file' === $method ) {
// Attempt to write the CSS to file.
$this->css_to_file = new Kirki_CSS_To_File();
// If we succesd, load this file.
$failed = get_transient( 'kirki_css_write_to_file_failed' );
// If writing CSS to file hasn't failed, just enqueue this file.
if ( ! $failed ) {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_compiled_file' ), $priority );
@@ -174,6 +175,9 @@ class Kirki_Modules_CSS {
// If we got this far then add styles inline.
add_action( 'wp_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority );
// Admin styles, adds Gutenberg compatibility.
add_action( 'admin_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority );
}
/**
@@ -183,9 +187,7 @@ class Kirki_Modules_CSS {
* @since 3.0.0
*/
public function enqueue_compiled_file() {
wp_enqueue_style( 'kirki-styles', $this->css_to_file->get_url(), array(), $this->css_to_file->get_timestamp() );
}
/**
* Adds inline styles.
@@ -267,6 +269,7 @@ class Kirki_Modules_CSS {
}
if ( true === apply_filters( "kirki_{$config_id}_css_skip_hidden", true ) ) {
// Only continue if field dependencies are met.
if ( ! empty( $field['required'] ) ) {
$valid = true;
@@ -316,4 +319,16 @@ class Kirki_Modules_CSS {
public static function add_fontawesome_script() {
self::$enqueue_fa = true;
}
/**
* Check if FontAwesome should be loaded.
*
* @static
* @since 3.0.35
* @access public
* @return void
*/
public static function get_enqueue_fa() {
return self::$enqueue_fa;
}
}