/** * Format the script in a way that will be compatible with WordPress. */ public function enqueue_script() { if (!self::$script_added && '' !== self::$icons_script) { self::$script_added = true; // @codingStandardsIgnoreStart echo '<script>jQuery(document).ready(function($) { "use strict"; ' . self::$icons_script . '});</script>'; // @codingStandardsIgnoreEnd } }
/** * Add the panel using the Customizer API. * * @param array $args The panel arguments. */ public function add_panel($args) { global $wp_customize; if (!isset($args['type']) || !array_key_exists($args['type'], $this->panel_types)) { $args['type'] = 'kirki-default'; } $panel_classname = $this->panel_types[$args['type']]; // If we've got an icon then call the object to create its script. if (isset($args['icon'])) { Kirki_Scripts_Icons::generate_script($args); } $wp_customize->add_panel(new $panel_classname($wp_customize, sanitize_key($args['id']), $args)); }
/** * Adds the section using the WordPress Customizer API. * * @access public * @param array $args The section parameters. */ public function add_section($args) { global $wp_customize; if (!isset($args['type']) || !array_key_exists($args['type'], $this->section_types)) { $args['type'] = 'default'; } $section_classname = $this->section_types[$args['type']]; $wp_customize->add_section(new $section_classname($wp_customize, sanitize_key($args['id']), array('title' => $args['title'], 'priority' => absint($args['priority']), 'panel' => sanitize_key($args['panel']), 'description' => $args['description'], 'active_callback' => $args['active_callback']))); if (isset($args['icon'])) { $args['context'] = 'section'; Kirki_Scripts_Icons::generate_script($args); } }
/** * Add the panel using the Customizer API. * * @param array $args The panel arguments. */ public function add_panel($args) { global $wp_customize; if (!isset($args['type']) || !array_key_exists($args['type'], $this->panel_types)) { $args['type'] = 'default'; } $panel_classname = $this->panel_types[$args['type']]; $wp_customize->add_panel(new $panel_classname($wp_customize, sanitize_key($args['id']), array('title' => $args['title'], 'priority' => absint($args['priority']), 'description' => $args['description'], 'active_callback' => $args['active_callback']))); // If we've got an icon then call the object to create its script. if (isset($args['icon'])) { $args['context'] = 'panel'; Kirki_Scripts_Icons::generate_script($args); } }
/** * Format the script in a way that will be compatible with WordPress. */ public function enqueue_script() { if (!self::$script_added && '' != self::$icons_script) { self::$script_added = true; echo '<script>jQuery(document).ready(function($) { "use strict"; ' . wp_kses_post(self::$icons_script) . '});</script>'; } }