kirki.php
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Kirki Customizer Framework |
| 4 | * Plugin URI: https://themeum.com |
| 5 | * Description: The Ultimate WordPress Customizer Framework |
| 6 | * Author: Themeum |
| 7 | * Author URI: https://themeum.com |
| 8 | * Version: 5.0.0 |
| 9 | * Text Domain: kirki |
| 10 | * Requires at least: 5.2 |
| 11 | * Requires PHP: 7.1 |
| 12 | * |
| 13 | * @package Kirki |
| 14 | * @category Core |
| 15 | * @author Themeum |
| 16 | * @copyright Copyright (c) 2023, Themeum |
| 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 | use Kirki\URL; |
| 26 | |
| 27 | // Exit if accessed directly. |
| 28 | if ( ! defined( 'ABSPATH' ) ) { |
| 29 | exit; |
| 30 | } |
| 31 | |
| 32 | // No need to proceed if Kirki already exists. |
| 33 | if ( class_exists( 'Kirki' ) ) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) { |
| 38 | define( 'KIRKI_PLUGIN_FILE', __FILE__ ); |
| 39 | } |
| 40 | |
| 41 | require_once __DIR__ . '/lib/class-aricolor.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 42 | require_once __DIR__ . '/lib/class-kirki-color.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 43 | require_once __DIR__ . '/kirki-composer/autoload.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 44 | require_once __DIR__ . '/inc/bootstrap.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 45 | |
| 46 | if ( ! defined( 'KIRKI_VERSION' ) ) { |
| 47 | define( 'KIRKI_VERSION', '5.0.0' ); |
| 48 | } |
| 49 | |
| 50 | if ( ! defined( 'KIRKI_PLUGIN_DIR' ) ) { |
| 51 | define( 'KIRKI_PLUGIN_DIR', __DIR__ ); |
| 52 | } |
| 53 | |
| 54 | if ( ! defined( 'KIRKI_PLUGIN_URL' ) ) { |
| 55 | define( 'KIRKI_PLUGIN_URL', URL::get_from_path( __DIR__ ) ); |
| 56 | } |
| 57 | |
| 58 | if ( ! function_exists( 'Kirki' ) ) { |
| 59 | /** |
| 60 | * Returns an instance of the Kirki object. |
| 61 | */ |
| 62 | function kirki() { |
| 63 | $kirki = Framework::get_instance(); |
| 64 | return $kirki; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // Start Kirki. |
| 69 | global $kirki; |
| 70 | $kirki = kirki(); |
| 71 | |
| 72 | // Instantiate the modules. |
| 73 | $kirki->modules = new Modules(); |
| 74 | |
| 75 | // Instantiate classes. |
| 76 | new Kirki(); |
| 77 | new L10n( 'kirki', __DIR__ . '/languages' ); |
| 78 | new \Kirki\Settings\SetupSettings(); |
| 79 | |
| 80 | // ? Bagus: Do we really need to-reinclude this file? It was included above. |
| 81 | // Include the ariColor library. |
| 82 | require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 83 | |
| 84 | // Add an empty config for global fields. |
| 85 | Kirki::add_config( '' ); // ? Bagus: what is this for? Adding empty config. |
| 86 | |
| 87 | // ? 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? |
| 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 | require_once $custom_config_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 92 | } |
| 93 | |
| 94 | // Add upgrade notifications. |
| 95 | require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 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'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 106 | } |
| 107 | |
| 108 | require_once __DIR__ . '/pro-src/pro-index.php'; |