Completed
Pull Request — master (#1653)
by Aristeides
05:59 queued 03:54
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:       3.0.16
9
 * Text Domain:   kirki
10
 *
11
 * GitHub Plugin URI: aristath/kirki
12
 * GitHub Plugin URI: https://github.com/aristath/kirki
13
 *
14
 * @package     Kirki
15
 * @category    Core
16
 * @author      Aristeides Stathopoulos
17
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
18
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
19
 * @since       1.0
20
 */
21
22
// Exit if accessed directly.
23
if ( ! defined( 'ABSPATH' ) ) {
24
	exit;
25
}
26
27
// No need to proceed if Kirki already exists.
28
if ( class_exists( 'Kirki' ) ) {
29
	return;
30
}
31
32
// Include the autoloader.
33
include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'class-kirki-autoload.php';
34
new Kirki_Autoload();
35
36
if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) {
37
	define( 'KIRKI_PLUGIN_FILE', __FILE__ );
38
}
39
40
// Define the KIRKI_VERSION constant.
41
if ( ! defined( 'KIRKI_VERSION' ) ) {
42
	if ( ! function_exists( 'get_plugin_data' ) ) {
43
		include_once ABSPATH . 'wp-admin/includes/plugin.php';
44
	}
45
	$data = get_plugin_data( KIRKI_PLUGIN_FILE );
46
	$version = ( isset( $data['Version'] ) ) ? $data['Version'] : false;
47
	define( 'KIRKI_VERSION', $version );
48
}
49
50
// Make sure the path is properly set.
51
Kirki::$path = wp_normalize_path( dirname( __FILE__ ) );
52
Kirki_Init::set_url();
53
54
if ( ! function_exists( 'Kirki' ) ) {
55
	/**
56
	 * Returns an instance of the Kirki object.
57
	 */
58
	function kirki() {
0 ignored issues
show
The function kirki() has been defined more than once; this definition is ignored, only the first definition in core/deprecated.php (L65-67) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
59
		$kirki = Kirki_Toolkit::get_instance();
60
		return $kirki;
61
	}
62
}
63
64
// Start Kirki.
65
global $kirki;
66
$kirki = kirki();
67
68
// Instantiate the modules.
69
$kirki->modules = new Kirki_Modules();
70
71
Kirki::$url = plugins_url( '', __FILE__ );
72
73
// Instantiate classes.
74
new Kirki();
75
new Kirki_L10n();
76
77
// Include deprecated functions & methods.
78
include_once wp_normalize_path( dirname( __FILE__ ) . '/core/deprecated.php' );
79
80
// Include the ariColor library.
81
include_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' );
82
83
// Add an empty config for global fields.
84
Kirki::add_config( '' );
85
86
$custom_config_path = dirname( __FILE__ ) . '/custom-config.php';
87
$custom_config_path = wp_normalize_path( $custom_config_path );
88
if ( file_exists( $custom_config_path ) ) {
89
	include_once $custom_config_path;
90
}
91
92
// Add upgrade notifications.
93
include_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' );
94
95
// Uncomment this line to see the demo controls in the customizer.
96
/* include_once dirname( __FILE__ ) . '/example.php'; */
97