Completed
Branch master (3e1132)
by Aristeides
03:12
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Plugin Name:   Kirki Toolkit
4
 * Plugin URI:    http://kirki.org
5
 * Description:   The ultimate WordPress Customizer Toolkit
6
 * Author:        Aristeides Stathopoulos
7
 * Author URI:    http://aristeides.com
8
 * Version:       2.1.0.1
9
 * Text Domain:   kirki
10
 *
11
 * GitHub Plugin URI: aristath/kirki
12
 * GitHub Plugin URI: https://github.com/aristath/kirki
13
 *
14
 *
15
 * @package     Kirki
16
 * @category    Core
17
 * @author      Aristeides Stathopoulos
18
 * @copyright   Copyright (c) 2016, Aristeides Stathopoulos
19
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
20
 * @since       1.0
21
 */
22
23
// Exit if accessed directly
24
if ( ! defined( 'ABSPATH' ) ) {
25
	exit;
26
}
27
28
// Include the autoloader
29
include_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'autoloader.php' );
30
31
if ( ! function_exists( 'Kirki' ) ) {
32
	/**
33
	 * Returns the Kirki object
34
	 */
35
	function Kirki() {
1 ignored issue
show
The function name Kirki is in camel caps, but expected _kirki instead as per the coding standard.
Loading history...
36
		// Make sure the class is instanciated
37
		$kirki = Kirki_Toolkit::get_instance();
38
		// The path of the current Kirki instance
39
		Kirki::$path = dirname( __FILE__ );
40
41
		return $kirki;
42
	}
43
44
}
45
global $kirki;
46
$kirki = Kirki();
47
48
/**
49
 * Apply the filters to the Kirki::$url
50
 */
51
if ( ! function_exists( 'kirki_filtered_url' ) ) {
52
	function kirki_filtered_url() {
53
		$config = apply_filters( 'kirki/config', array() );
54
		if ( isset( $config['url_path'] ) ) {
55
			Kirki::$url = esc_url_raw( $config['url_path'] );
56
		}
57
	}
58
	add_action( 'after_setup_theme', 'kirki_filtered_url' );
59
}
60
61
include_once( Kirki::$path . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'deprecated.php' );
62
// Include the API class
63
include_once( Kirki::$path . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'class-kirki.php' );
64
65
if ( ! function_exists( 'kirki_load_textdomain' ) ) {
66
	/**
67
	 * Load plugin textdomain.
68
	 *
69
	 * @since 0.8.0
70
	 */
71
	function kirki_load_textdomain() {
72
		$textdomain = 'kirki';
73
74
		// Look for WP_LANG_DIR/{$domain}-{$locale}.mo
75
		if ( file_exists( WP_LANG_DIR . '/' . $textdomain . '-' . get_locale() . '.mo' ) ) {
76
			$file = WP_LANG_DIR . '/' . $textdomain . '-' . get_locale() . '.mo';
77
		}
78
		// Look for Kirki::$path/languages/{$domain}-{$locale}.mo
79
		if ( ! isset( $file ) && file_exists( Kirki::$path . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . $textdomain . '-' . get_locale() . '.mo' ) ) {
80
			$file = Kirki::$path . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . $textdomain . '-' . get_locale() . '.mo';
81
		}
82
83
		if ( isset( $file ) ) {
84
			load_textdomain( $textdomain, $file );
85
		}
86
87
		load_plugin_textdomain( $textdomain, false, Kirki::$path . DIRECTORY_SEPARATOR . 'languages' );
88
	}
89
	add_action( 'plugins_loaded', 'kirki_load_textdomain' );
90
}
91
92
// Add an empty config for global fields
93
Kirki::add_config( '' );
94