kirki.php
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Kirki Customizer Framework |
| 4 | * Plugin URI: https://kirki.org |
| 5 | * Description: The Ultimate WordPress Customizer Framework |
| 6 | * Author: David Vongries |
| 7 | * Author URI: https://davidvongries.com/ |
| 8 | * Version: 4.0.22 |
| 9 | * Text Domain: kirki |
| 10 | * Requires at least: 5.2 |
| 11 | * Requires PHP: 7.0 |
| 12 | * |
| 13 | * @package Kirki |
| 14 | * @category Core |
| 15 | * @author Ari Stathopoulos (@aristath) |
| 16 | * @copyright Copyright (c) 2021, David Vongries |
| 17 | * @license https://opensource.org/licenses/MIT |
| 18 | * @since 1.0 |
| 19 | */ |
| 20 | |
| 21 | use Kirki\L10n; |
| 22 | use Kirki\Compatibility\Modules; |
| 23 | use Kirki\Compatibility\Framework; |
| 24 | use Kirki\Compatibility\Kirki; |
| 25 | |
| 26 | // Exit if accessed directly. |
| 27 | if ( ! defined( 'ABSPATH' ) ) { |
| 28 | exit; |
| 29 | } |
| 30 | |
| 31 | // No need to proceed if Kirki already exists. |
| 32 | if ( class_exists( 'Kirki' ) ) { |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) { |
| 37 | define( 'KIRKI_PLUGIN_FILE', __FILE__ ); |
| 38 | } |
| 39 | |
| 40 | require_once __DIR__ . '/lib/class-aricolor.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 41 | require_once __DIR__ . '/lib/class-kirki-color.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 42 | require_once __DIR__ . '/packages/autoload.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 43 | require_once __DIR__ . '/inc/bootstrap.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 44 | |
| 45 | // Define the KIRKI_VERSION constant. |
| 46 | if ( ! defined( 'KIRKI_VERSION' ) ) { |
| 47 | define( 'KIRKI_VERSION', '4.0.22' ); |
| 48 | } |
| 49 | |
| 50 | if ( ! function_exists( 'Kirki' ) ) { |
| 51 | /** |
| 52 | * Returns an instance of the Kirki object. |
| 53 | */ |
| 54 | function kirki() { |
| 55 | $kirki = Framework::get_instance(); |
| 56 | return $kirki; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Start Kirki. |
| 61 | global $kirki; |
| 62 | $kirki = kirki(); |
| 63 | |
| 64 | // Instantiate the modules. |
| 65 | $kirki->modules = new Modules(); |
| 66 | |
| 67 | // Instantiate classes. |
| 68 | new Kirki(); |
| 69 | new L10n( 'kirki', __DIR__ . '/languages' ); |
| 70 | |
| 71 | // ? Bagus: Do we really need to-reinclude this file? It was included above. |
| 72 | // Include the ariColor library. |
| 73 | require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 74 | |
| 75 | // Add an empty config for global fields. |
| 76 | Kirki::add_config( '' ); // ? Bagus: what is this for? Adding empty config. |
| 77 | |
| 78 | // ? Bagus: Do we really need this line? custom-config.php here is supposed to inside this plugin. Or is this just in case we need it in the future? |
| 79 | $custom_config_path = dirname( __FILE__ ) . '/custom-config.php'; |
| 80 | $custom_config_path = wp_normalize_path( $custom_config_path ); |
| 81 | if ( file_exists( $custom_config_path ) ) { |
| 82 | require_once $custom_config_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 83 | } |
| 84 | |
| 85 | // Add upgrade notifications. |
| 86 | require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 87 | |
| 88 | /** |
| 89 | * To enable tests, add this line to your wp-config.php file (or anywhere alse): |
| 90 | * define( 'KIRKI_TEST', true ); |
| 91 | * |
| 92 | * Please note that the example.php file is not included in the wordpress.org distribution |
| 93 | * and will only be included in dev versions of the plugin in the github repository. |
| 94 | */ |
| 95 | if ( defined( 'KIRKI_TEST' ) && true === KIRKI_TEST && file_exists( dirname( __FILE__ ) . '/example.php' ) ) { |
| 96 | include_once dirname( __FILE__ ) . '/example.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 97 | } |
| 98 |