Completed
Push — develop ( 691768...c5c7b0 )
by Aristeides
03:22
created

kirki.php ➔ kirki_show_upgrade_notification()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 8
nc 2
nop 2
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
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.0-beta.2
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 . 'autoloader.php' );
34
35
if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) {
36
	define( 'KIRKI_PLUGIN_FILE', __FILE__ );
37
}
38
39
if ( ! function_exists( 'Kirki' ) ) {
40
	// @codingStandardsIgnoreStart
41
	/**
42
	 * Returns an instance of the Kirki object.
43
	 */
44
	function Kirki() {
45
		$kirki = Kirki_Toolkit::get_instance();
46
		return $kirki;
47
	}
48
	// @codingStandardsIgnoreEnd
49
50
}
51
// Start Kirki.
52
global $kirki;
53
$kirki = Kirki();
54
// Instamtiate the modules.
55
$kirki->modules = new Kirki_Modules();
56
57
// Make sure the path is properly set.
58
Kirki::$path = wp_normalize_path( dirname( __FILE__ ) );
59
60
// If Kirki is installed as a plugin, use plugin_dir_url().
61
$kirki_is_plugin = Kirki_Init::is_plugin();
62
if ( $kirki_is_plugin ) {
63
	Kirki::$url = plugin_dir_url( __FILE__ );
64
} elseif ( function_exists( 'is_link' ) && is_link( dirname( __FILE__ ) ) && function_exists( 'readlink' ) ) {
65
	// If the path is a symlink, get the target.
66
	Kirki::$path = readlink( Kirki::$path );
67
}
68
69
// Instantiate 2ndary classes.
70
new Kirki_L10n();
71
new Kirki();
72
73
// Include deprecated functions & methods.
74
include_once wp_normalize_path( dirname( __FILE__ ) . '/core/deprecated.php' );
75
76
// Include the ariColor library.
77
include_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' );
78
79
// Add an empty config for global fields.
80
Kirki::add_config( '' );
81
82
$custom_config_path = dirname( __FILE__ ) . '/custom-config.php';
83
$custom_config_path = wp_normalize_path( $custom_config_path );
84
if ( file_exists( $custom_config_path ) ) {
85
	include_once( $custom_config_path );
86
}
87
88
// Add upgrade notifications.
89
include_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' );
90
91
// Handle localization when kirki is included in a theme.
92
include_once wp_normalize_path( dirname( __FILE__ ) . '/l10n.php' );
93