示例#1
0
 function kirki_filtered_url()
 {
     $config = apply_filters('kirki/config', array());
     if (isset($config['url_path'])) {
         Kirki::$url = esc_url_raw($config['url_path']);
     }
 }
示例#2
0
 /**
  * Properly set the Kirki URL for assets.
  * Determines if Kirki is installed as a plugin, in a child theme, or a parent theme
  * and then does some calculations to get the proper URL for its CSS & JS assets.
  */
 public function set_url()
 {
     // The path of the Kirki's parent-folder.
     $path = wp_normalize_path(dirname(Kirki::$path));
     // Get parent-theme path.
     $parent_theme_path = get_template_directory();
     $parent_theme_path = wp_normalize_path($parent_theme_path);
     // Get child-theme path.
     $child_theme_path = get_stylesheet_directory_uri();
     $child_theme_path = wp_normalize_path($child_theme_path);
     Kirki::$url = plugin_dir_url(dirname(__FILE__) . 'kirki.php');
     // Is Kirki included in a parent theme?
     if (false !== strpos(Kirki::$path, $parent_theme_path)) {
         Kirki::$url = get_template_directory_uri() . str_replace($parent_theme_path, '', Kirki::$path);
     }
     // Is there a child-theme?
     if ($child_theme_path !== $parent_theme_path) {
         // Is Kirki included in a child theme?
         if (false !== strpos(Kirki::$path, $child_theme_path)) {
             Kirki::$url = get_template_directory_uri() . str_replace($child_theme_path, '', Kirki::$path);
         }
     }
     // Apply the kirki/config filter.
     $config = apply_filters('kirki/config', array());
     if (isset($config['url_path'])) {
         Kirki::$url = esc_url_raw($config['url_path']);
     }
 }
示例#3
0
 /**
  * Properly set the Kirki URL for assets
  * Determines if Kirki is installed as a plugin, in a child theme, or a parent theme
  * and then does some calculations to get the proper URL for its CSS & JS assets
  *
  * @return string
  */
 public function set_url()
 {
     /**
      * Are we on a parent theme?
      */
     if (Kirki_Toolkit::is_parent_theme(__FILE__)) {
         $relative_url = str_replace(Kirki_Toolkit::clean_file_path(get_template_directory()), '', dirname(dirname(__FILE__)));
         Kirki::$url = trailingslashit(get_template_directory_uri() . $relative_url);
     } elseif (Kirki_Toolkit::is_child_theme(__FILE__)) {
         $relative_url = str_replace(Kirki_Toolkit::clean_file_path(get_stylesheet_directory()), '', dirname(dirname(__FILE__)));
         Kirki::$url = trailingslashit(get_stylesheet_directory_uri() . $relative_url);
     } else {
         Kirki::$url = plugin_dir_url(dirname(__FILE__) . 'kirki.php');
     }
 }
示例#4
0
文件: kirki.php 项目: ZmagoD/kirki
 /**
  * Returns the Kirki object
  */
 function Kirki()
 {
     // Make sure the class is instanciated
     $kirki = Kirki_Toolkit::get_instance();
     $kirki->font_registry = new Kirki_Fonts_Font_Registry();
     $kirki->api = new Kirki();
     $kirki->scripts = new Kirki_Scripts_Registry();
     $kirki->styles = array('back' => new Kirki_Styles_Customizer(), 'front' => new Kirki_Styles_Frontend());
     /**
      * The path of the current Kirki instance
      */
     Kirki::$path = dirname(__FILE__);
     /**
      * The URL of the current Kirki instance
      */
     if (false !== strpos(dirname(__FILE__), WP_PLUGIN_DIR)) {
         /**
          * Kirki is activated as a plugin.
          */
         Kirki::$url = plugin_dir_url(__FILE__);
     } else {
         if (false !== strpos(dirname(__FILE__), get_template_directory())) {
             /**
              * Kirki is embedded in a theme
              */
             Kirki::$url = get_template_directory_uri() . str_replace(get_template_directory(), '', dirname(__FILE__));
         }
     }
     /**
      * Apply the filters to the Kirki::$url
      */
     $config = apply_filters('kirki/config', array());
     if (isset($config['url_path'])) {
         Kirki::$url = esc_url_raw($config['url_path']);
     }
     return $kirki;
 }