Completed
Pull Request — master (#1653)
by Aristeides
04:16 queued 02:02
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.17-dev
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
new Kirki_Controls();
55
56
if ( ! function_exists( 'Kirki' ) ) {
57
	/**
58
	 * Returns an instance of the Kirki object.
59
	 */
60
	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...
61
		$kirki = Kirki_Toolkit::get_instance();
62
		return $kirki;
63
	}
64
}
65
66
// Start Kirki.
67
global $kirki;
68
$kirki = kirki();
69
70
// Instantiate the modules.
71
$kirki->modules = new Kirki_Modules();
72
73
Kirki::$url = plugins_url( '', __FILE__ );
74
75
// Instantiate classes.
76
new Kirki();
77
new Kirki_L10n();
78
79
// Include deprecated functions & methods.
80
include_once wp_normalize_path( dirname( __FILE__ ) . '/core/deprecated.php' );
81
82
// Include the ariColor library.
83
include_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' );
84
85
// Add an empty config for global fields.
86
Kirki::add_config( '' );
87
88
$custom_config_path = dirname( __FILE__ ) . '/custom-config.php';
89
$custom_config_path = wp_normalize_path( $custom_config_path );
90
if ( file_exists( $custom_config_path ) ) {
91
	include_once $custom_config_path;
92
}
93
94
// Add upgrade notifications.
95
include_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' );
96
97
/**
98
 * To enable tests, add this line to your wp-config.php file (or anywhere alse):
99
 * define( 'KIRKI_TEST', true );
100
 *
101
 * Please note that the example.php file is not included in the wordpress.org distribution
102
 * and will only be included in dev versions of the plugin in the github repository.
103
 */
104
if ( defined( 'KIRKI_TEST' ) && true === KIRKI_TEST && file_exists( dirname( __FILE__ ) . '/example.php' ) ) {
105
	include_once dirname( __FILE__ ) . '/example.php';
106
}
107