halftype/functions/kirki/kirki.php

107 lines
3.4 KiB
PHP
Raw Permalink Normal View History

2021-03-08 18:40:20 +01:00
<?php
/**
2022-03-15 14:27:23 +01:00
* Plugin Name: Kirki Customizer Framework
* Plugin URI: https://kirki.org
* Description: The Ultimate WordPress Customizer Framework
2023-08-04 15:45:41 +02:00
* Author: Themeum
* Author URI: https://themeum.com
* Version: 4.2.0
2022-03-15 14:27:23 +01:00
* Text Domain: kirki
* Requires at least: 5.2
2023-08-04 15:45:41 +02:00
* Requires PHP: 7.1
2021-03-08 18:40:20 +01:00
*
2022-03-15 14:27:23 +01:00
* @package Kirki
* @category Core
2023-08-04 15:45:41 +02:00
* @author Themeum
* @copyright Copyright (c) 2023, Themeum
2022-03-15 14:27:23 +01:00
* @license https://opensource.org/licenses/MIT
* @since 1.0
2021-03-08 18:40:20 +01:00
*/
2022-03-15 14:27:23 +01:00
use Kirki\L10n;
use Kirki\Compatibility\Modules;
use Kirki\Compatibility\Framework;
use Kirki\Compatibility\Kirki;
2023-08-04 15:45:41 +02:00
use Kirki\URL;
2022-03-15 14:27:23 +01:00
2021-03-08 18:40:20 +01:00
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// No need to proceed if Kirki already exists.
if ( class_exists( 'Kirki' ) ) {
return;
}
if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) {
define( 'KIRKI_PLUGIN_FILE', __FILE__ );
}
2022-03-15 14:27:23 +01:00
require_once __DIR__ . '/lib/class-aricolor.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
require_once __DIR__ . '/lib/class-kirki-color.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
2023-08-04 15:45:41 +02:00
require_once __DIR__ . '/kirki-composer/autoload.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
2022-03-15 14:27:23 +01:00
require_once __DIR__ . '/inc/bootstrap.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
2021-03-08 18:40:20 +01:00
if ( ! defined( 'KIRKI_VERSION' ) ) {
2023-08-04 15:45:41 +02:00
define( 'KIRKI_VERSION', '4.2.0' );
}
if ( ! defined( 'KIRKI_PLUGIN_DIR' ) ) {
define( 'KIRKI_PLUGIN_DIR', __DIR__ );
}
if ( ! defined( 'KIRKI_PLUGIN_URL' ) ) {
define( 'KIRKI_PLUGIN_URL', URL::get_from_path( __DIR__ ) );
2021-03-08 18:40:20 +01:00
}
if ( ! function_exists( 'Kirki' ) ) {
/**
* Returns an instance of the Kirki object.
*/
function kirki() {
2022-03-15 14:27:23 +01:00
$kirki = Framework::get_instance();
2021-03-08 18:40:20 +01:00
return $kirki;
}
}
// Start Kirki.
global $kirki;
$kirki = kirki();
// Instantiate the modules.
2022-03-15 14:27:23 +01:00
$kirki->modules = new Modules();
2021-03-08 18:40:20 +01:00
// Instantiate classes.
new Kirki();
2022-03-15 14:27:23 +01:00
new L10n( 'kirki', __DIR__ . '/languages' );
2023-08-04 15:45:41 +02:00
new \Kirki\Settings\SetupSettings();
2021-03-08 18:40:20 +01:00
2022-03-15 14:27:23 +01:00
// ? Bagus: Do we really need to-reinclude this file? It was included above.
2021-03-08 18:40:20 +01:00
// Include the ariColor library.
require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
// Add an empty config for global fields.
2022-03-15 14:27:23 +01:00
Kirki::add_config( '' ); // ? Bagus: what is this for? Adding empty config.
2021-03-08 18:40:20 +01:00
2022-03-15 14:27:23 +01:00
// ? 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?
2021-03-08 18:40:20 +01:00
$custom_config_path = dirname( __FILE__ ) . '/custom-config.php';
$custom_config_path = wp_normalize_path( $custom_config_path );
if ( file_exists( $custom_config_path ) ) {
require_once $custom_config_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
}
// Add upgrade notifications.
require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
/**
* To enable tests, add this line to your wp-config.php file (or anywhere alse):
* define( 'KIRKI_TEST', true );
*
* Please note that the example.php file is not included in the wordpress.org distribution
* and will only be included in dev versions of the plugin in the github repository.
*/
if ( defined( 'KIRKI_TEST' ) && true === KIRKI_TEST && file_exists( dirname( __FILE__ ) . '/example.php' ) ) {
include_once dirname( __FILE__ ) . '/example.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
}