|
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
|
|
|
/** |
|
89
|
|
|
* Fires at the end of the update message container in each |
|
90
|
|
|
* row of the plugins list table. |
|
91
|
|
|
* Allows us to add important notices about updates should they be needed. |
|
92
|
|
|
* |
|
93
|
|
|
* @since 2.3.8 |
|
94
|
|
|
* @param array $plugin_data An array of plugin metadata. |
|
95
|
|
|
* @param array $response An array of metadata about the available plugin update. |
|
96
|
|
|
*/ |
|
97
|
|
|
function kirki_show_upgrade_notification( $plugin_data, $response ) { |
|
|
|
|
|
|
98
|
|
|
|
|
99
|
|
|
// Check "upgrade_notice". |
|
100
|
|
|
if ( isset( $response->upgrade_notice ) && strlen( trim( $response->upgrade_notice ) ) > 0 ) : ?> |
|
101
|
|
|
<style> |
|
102
|
|
|
.kirki-upgrade-notification { |
|
103
|
|
|
background-color: #d54e21; |
|
104
|
|
|
padding: 10px; |
|
105
|
|
|
color: #f9f9f9; |
|
106
|
|
|
margin-top: 10px; |
|
107
|
|
|
} |
|
108
|
|
|
.kirki-upgrade-notification + p { |
|
109
|
|
|
display: none; |
|
110
|
|
|
} |
|
111
|
|
|
</style> |
|
112
|
|
|
<div class="kirki-upgrade-notification"> |
|
113
|
|
|
<strong><?php esc_attr_e( 'Important Upgrade Notice:', 'kirki' ); ?></strong> |
|
114
|
|
|
<?php echo wp_strip_all_tags( $response->upgrade_notice ); ?> |
|
|
|
|
|
|
115
|
|
|
</div> |
|
116
|
|
|
<?php endif; |
|
117
|
|
|
} |
|
118
|
|
|
add_action( 'in_plugin_update_message-' . plugin_basename( __FILE__ ), 'kirki_show_upgrade_notification', 10, 2 ); |
|
119
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.