Skip to content

Commit

Permalink
fixes #1623
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Nov 11, 2017
1 parent 4a65e91 commit ac79b01
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 21 deletions.
8 changes: 5 additions & 3 deletions controls/php/class-kirki-control-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function enqueue() {
$kirki_url = trailingslashit( Kirki::$url );

// Enqueue ColorPicker.
wp_enqueue_script( 'wp-color-picker-alpha', trailingslashit( Kirki::$url ) . 'assets/vendor/wp-color-picker-alpha/wp-color-picker-alpha.js', array( 'wp-color-picker' ), false, true );
wp_enqueue_script( 'wp-color-picker-alpha', trailingslashit( Kirki::$url ) . 'assets/vendor/wp-color-picker-alpha/wp-color-picker-alpha.js', array( 'wp-color-picker' ), KIRKI_VERSION, true );
wp_enqueue_style( 'wp-color-picker' );

// Enqueue selectWoo.
Expand All @@ -85,14 +85,16 @@ public function enqueue() {
'selectWoo',
'jquery-ui-button',
'jquery-ui-spinner',
)
),
KIRKI_VERSION
);

// Enqueue the style.
wp_enqueue_style(
'kirki-styles',
"{$kirki_url}controls/css/styles.css",
null
array(),
KIRKI_VERSION
);
}

Expand Down
2 changes: 1 addition & 1 deletion controls/php/class-kirki-control-dimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function to_json() {
*/
public function enqueue() {

wp_enqueue_style( 'kirki-styles', trailingslashit( Kirki::$url ) . 'controls/css/styles.css', null );
wp_enqueue_style( 'kirki-styles', trailingslashit( Kirki::$url ) . 'controls/css/styles.css', array(), KIRKI_VERSION );
wp_localize_script( 'kirki-script', 'dimensionskirkiL10n', $this->l10n() );
}

Expand Down
2 changes: 1 addition & 1 deletion controls/php/class-kirki-control-fontawesome.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Kirki_Control_FontAwesome extends Kirki_Control_Base {
public function enqueue() {
parent::enqueue();

wp_enqueue_style( 'kirki-fontawesome-font-css', trailingslashit( Kirki::$url ) . 'assets/vendor/fontawesome/css/font-awesome.min.css', null );
wp_enqueue_style( 'kirki-fontawesome-font-css', trailingslashit( Kirki::$url ) . 'assets/vendor/fontawesome/css/font-awesome.min.css', array(), KIRKI_VERSION );

ob_start();
$json_path = wp_normalize_path( Kirki::$path . '/assets/vendor/fontawesome/fontawesome.json' );
Expand Down
10 changes: 10 additions & 0 deletions kirki.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
define( 'KIRKI_PLUGIN_FILE', __FILE__ );
}

// Define the KIRKI_VERSION constant.
if ( ! defined( 'KIRKI_VERSION' ) ) {
if ( ! function_exists( 'get_plugin_data' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$data = get_plugin_data( KIRKI_PLUGIN_FILE );
$version = ( isset( $data['Version'] ) ) ? $data['Version'] : false;
define( 'KIRKI_VERSION', $version );
}

// Make sure the path is properly set.
Kirki::$path = wp_normalize_path( dirname( __FILE__ ) );
Kirki_Init::set_url();
Expand Down
4 changes: 2 additions & 2 deletions modules/collapsible/class-kirki-modules-collapsible.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public static function get_instance() {
*/
public function customize_controls_print_scripts() {

wp_enqueue_script( 'kirki-collapsible', trailingslashit( Kirki::$url ) . 'modules/collapsible/collapsible.js', array( 'customize-preview' ), false, true );
wp_enqueue_style( 'kirki-collapsible', trailingslashit( Kirki::$url ) . 'modules/collapsible/collapsible.css' );
wp_enqueue_script( 'kirki-collapsible', trailingslashit( Kirki::$url ) . 'modules/collapsible/collapsible.js', array( 'customize-preview' ), KIRKI_VERSION, true );
wp_enqueue_style( 'kirki-collapsible', trailingslashit( Kirki::$url ) . 'modules/collapsible/collapsible.css', array(), KIRKI_VERSION );

$collapsible_fields = array();
$fields = Kirki::$fields;
Expand Down
4 changes: 2 additions & 2 deletions modules/css/class-kirki-modules-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function inline_dynamic_css() {
$styles = self::loop_controls( $config_id );
$styles = apply_filters( "kirki/{$config_id}/dynamic_css", $styles );
if ( ! empty( $styles ) ) {
wp_enqueue_style( 'kirki-styles-' . $config_id, trailingslashit( Kirki::$url ) . 'assets/css/kirki-styles.css', null, null );
wp_enqueue_style( 'kirki-styles-' . $config_id, trailingslashit( Kirki::$url ) . 'assets/css/kirki-styles.css', array(), KIRKI_VERSION );
wp_add_inline_style( 'kirki-styles-' . $config_id, $styles );
}
}
Expand All @@ -216,7 +216,7 @@ public function ajax_dynamic_css() {
* @access public
*/
public function frontend_styles() {
wp_enqueue_style( 'kirki-styles-php', admin_url( 'admin-ajax.php' ) . '?action=kirki_dynamic_css', null, null );
wp_enqueue_style( 'kirki-styles-php', admin_url( 'admin-ajax.php' ) . '?action=kirki_dynamic_css', array(), KIRKI_VERSION );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public function include_sections_and_panels() {
*/
public function enqueue_scrips() {

wp_enqueue_style( 'kirki-custom-sections', trailingslashit( Kirki::$url ) . 'modules/custom-sections/sections.css' );
wp_enqueue_script( 'kirki-custom-sections', trailingslashit( Kirki::$url ) . 'modules/custom-sections/sections.js', array( 'jquery', 'customize-base', 'customize-controls' ) );
wp_enqueue_style( 'kirki-custom-sections', trailingslashit( Kirki::$url ) . 'modules/custom-sections/sections.css', array(), KIRKI_VERSION );
wp_enqueue_script( 'kirki-custom-sections', trailingslashit( Kirki::$url ) . 'modules/custom-sections/sections.js', array( 'jquery', 'customize-base', 'customize-controls' ), KIRKI_VERSION );

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function customize_controls_print_scripts() {
}

if ( ! empty( $vars['logoImage'] ) || ! empty( $vars['description'] ) ) {
wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js' );
wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js', array(), KIRKI_VERSION );
wp_localize_script( 'kirki-branding', 'kirkiBranding', $vars );
wp_enqueue_script( 'kirki-branding' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function get_instance() {
*/
public function field_dependencies() {

wp_enqueue_script( 'kirki_field_dependencies', trailingslashit( Kirki::$url ) . 'modules/field-dependencies/field-dependencies.js', array( 'jquery', 'customize-base', 'customize-controls' ), false, true );
wp_enqueue_script( 'kirki_field_dependencies', trailingslashit( Kirki::$url ) . 'modules/field-dependencies/field-dependencies.js', array( 'jquery', 'customize-base', 'customize-controls' ), KIRKI_VERSION, true );
$field_dependencies = array();
$fields = Kirki::$fields;
foreach ( $fields as $field ) {
Expand Down
2 changes: 1 addition & 1 deletion modules/icons/class-kirki-modules-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function customize_controls_enqueue_scripts() {
}
}

wp_enqueue_script( 'kirki_panel_and_section_icons', trailingslashit( Kirki::$url ) . 'modules/icons/icons.js', array( 'jquery', 'customize-base', 'customize-controls' ), false, true );
wp_enqueue_script( 'kirki_panel_and_section_icons', trailingslashit( Kirki::$url ) . 'modules/icons/icons.js', array( 'jquery', 'customize-base', 'customize-controls' ), KIRKI_VERSION, true );
wp_localize_script( 'kirki_panel_and_section_icons', 'kirkiIcons', self::$icons );

}
Expand Down
4 changes: 2 additions & 2 deletions modules/post-meta/class-kirki-modules-post-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function __construct() {
*/
public function enqueue_control_scripts() {

wp_enqueue_script( 'kirki_post_meta_previewed_controls', trailingslashit( Kirki::$url ) . 'modules/post-meta/customize-controls.js', array( 'jquery', 'customize-controls' ), false, true );
wp_enqueue_script( 'kirki_post_meta_previewed_controls', trailingslashit( Kirki::$url ) . 'modules/post-meta/customize-controls.js', array( 'jquery', 'customize-controls' ), KIRKI_VERSION, true );
}

/**
Expand All @@ -78,7 +78,7 @@ public function customize_preview_init() {
*/
public function enqueue_preview_scripts() {

wp_enqueue_script( 'kirki_post_meta_previewed_preview', trailingslashit( Kirki::$url ) . 'modules/post-meta/customize-preview.js', array( 'jquery', 'customize-preview' ), false, true );
wp_enqueue_script( 'kirki_post_meta_previewed_preview', trailingslashit( Kirki::$url ) . 'modules/post-meta/customize-preview.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true );

$wp_scripts = wp_scripts();
$queried_post = null;
Expand Down
2 changes: 1 addition & 1 deletion modules/postmessage/class-kirki-modules-postmessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static function get_instance() {
*/
public function postmessage() {

wp_enqueue_script( 'kirki_auto_postmessage', trailingslashit( Kirki::$url ) . 'modules/postmessage/postmessage.js', array( 'jquery', 'customize-preview' ), false, true );
wp_enqueue_script( 'kirki_auto_postmessage', trailingslashit( Kirki::$url ) . 'modules/postmessage/postmessage.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true );
$fields = Kirki::$fields;
foreach ( $fields as $field ) {
if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['js_vars'] ) && ! empty( $field['js_vars'] ) && is_array( $field['js_vars'] ) && isset( $field['settings'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions modules/tooltips/class-kirki-modules-tooltips.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public function customize_controls_print_footer_scripts() {

$this->parse_fields();

wp_enqueue_script( 'kirki-tooltip', trailingslashit( Kirki::$url ) . 'modules/tooltips/tooltip.js', array( 'jquery' ) );
wp_enqueue_script( 'kirki-tooltip', trailingslashit( Kirki::$url ) . 'modules/tooltips/tooltip.js', array( 'jquery' ), KIRKI_VERSION );
wp_localize_script( 'kirki-tooltip', 'kirkiTooltips', $this->tooltips_content );
wp_enqueue_style( 'kirki-tooltip', trailingslashit( Kirki::$url ) . 'modules/tooltips/tooltip.css', null );
wp_enqueue_style( 'kirki-tooltip', trailingslashit( Kirki::$url ) . 'modules/tooltips/tooltip.css', array(), KIRKI_VERSION );

}
}
2 changes: 1 addition & 1 deletion modules/webfonts/class-kirki-modules-webfonts-async.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function webfont_loader() {
}
$fonts_to_load[] = $font . ':' . join( ',', $weights );
}
wp_enqueue_script( 'webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js' );
wp_enqueue_script( 'webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array(), KIRKI_VERSION );
if ( empty( $fonts_to_load ) ) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/webfonts/class-kirki-modules-webfonts-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function enqueue() {

// If $this->link is not empty then enqueue it.
if ( '' !== $this->link ) {
wp_enqueue_style( 'kirki_google_fonts', $this->link, array(), null );
wp_enqueue_style( 'kirki_google_fonts', $this->link, array(), KIRKI_VERSION );
}
}

Expand Down

0 comments on commit ac79b01

Please sign in to comment.