Initial commit

This commit is contained in:
Alexander Agnarson 2020-03-11 14:44:42 +01:00
commit b0607606ae
369 changed files with 85494 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
// phpcs:ignoreFile
if ( ! class_exists( 'Kirki_Active_Callback' ) ) {
// Removed in https://github.com/aristath/kirki/pull/1682/files
class Kirki_Active_Callback {
public static function evaluate() {
_deprecated_function( __METHOD__, '3.0.17', null );
return true;
}
private static function evaluate_requirement() {
_deprecated_function( __METHOD__, '3.0.17', null );
return true;
}
public static function compare( $value1, $value2, $operator ) {
_deprecated_function( __METHOD__, '3.0.17', 'Kirki_Helper::compare_values' );
return Kirki_Helper::compare_values( $value1, $value2, $operator );
}
}
}
/**
* Deprecated in v3.0.36
*
* keeping it here in case a theme or plugin was using one of its public methods.
* This is just to avoid fatal errors, it does not do anything.
*/
if ( ! class_exists( 'Kirki_CSS_To_File' ) ) {
class Kirki_CSS_To_File {
public function __construct() {}
public function get_url() {}
public function get_timestamp() {}
public function write_file() {}
}
}

View file

@ -0,0 +1,23 @@
<?php
/**
* This file contains all the deprecated functions.
*
* We could easily delete all these but they are kept for backwards-compatibility purposes.
*
* @package Kirki
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
// phpcs:ignoreFile
require_once wp_normalize_path( dirname( __FILE__ ) . '/functions.php' );
require_once wp_normalize_path( dirname( __FILE__ ) . '/classes.php' );
// Filters require PHP 5.3.
if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0 ) {
require_once wp_normalize_path( dirname( __FILE__ ) . '/filters.php' );
}

View file

@ -0,0 +1,112 @@
<?php
// phpcs:ignoreFile
add_filter( 'kirki_config', function( $args ) {
return apply_filters( 'kirki/config', $args );
}, 99 );
add_filter( 'kirki_control_types', function( $args ) {
return apply_filters( 'kirki/control_types', $args );
}, 99 );
add_filter( 'kirki_section_types', function( $args ) {
return apply_filters( 'kirki/section_types', $args );
}, 99 );
add_filter( 'kirki_section_types_exclude', function( $args ) {
return apply_filters( 'kirki/section_types/exclude', $args );
}, 99 );
add_filter( 'kirki_control_types_exclude', function( $args ) {
return apply_filters( 'kirki/control_types/exclude', $args );
}, 99 );
add_filter( 'kirki_controls', function( $args ) {
return apply_filters( 'kirki/controls', $args );
}, 99 );
add_filter( 'kirki_fields', function( $args ) {
return apply_filters( 'kirki/fields', $args );
}, 99 );
add_filter( 'kirki_modules', function( $args ) {
return apply_filters( 'kirki/modules', $args );
}, 99 );
add_filter( 'kirki_panel_types', function( $args ) {
return apply_filters( 'kirki/panel_types', $args );
}, 99 );
add_filter( 'kirki_setting_types', function( $args ) {
return apply_filters( 'kirki/setting_types', $args );
}, 99 );
add_filter( 'kirki_variable', function( $args ) {
return apply_filters( 'kirki/variable', $args );
}, 99 );
add_filter( 'kirki_values_get_value', function( $arg1, $arg2 ) {
return apply_filters( 'kirki/values/get_value', $arg1, $arg2 );
}, 99, 2 );
add_action( 'init', function() {
$config_ids = Kirki_Config::get_config_ids();
global $kirki_deprecated_filters_iteration;
foreach ( $config_ids as $config_id ) {
foreach( array(
'/dynamic_css',
'/output/control-classnames',
'/css/skip_hidden',
'/styles',
'/output/property-classnames',
'/webfonts/skip_hidden',
) as $filter_suffix ) {
$kirki_deprecated_filters_iteration = array( $config_id, $filter_suffix );
add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) {
global $kirki_deprecated_filters_iteration;
$kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] );
return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args );
}, 99 );
if ( false !== strpos( $kirki_deprecated_filters_iteration[1], '-' ) ) {
$kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] );
add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) {
global $kirki_deprecated_filters_iteration;
$kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] );
return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args );
}, 99 );
}
}
}
}, 99 );
add_filter( 'kirki_enqueue_google_fonts', function( $args ) {
return apply_filters( 'kirki/enqueue_google_fonts', $args );
}, 99 );
add_filter( 'kirki_styles_array', function( $args ) {
return apply_filters( 'kirki/styles_array', $args );
}, 99 );
add_filter( 'kirki_dynamic_css_method', function( $args ) {
return apply_filters( 'kirki/dynamic_css/method', $args );
}, 99 );
add_filter( 'kirki_postmessage_script', function( $args ) {
return apply_filters( 'kirki/postmessage/script', $args );
}, 99 );
add_filter( 'kirki_fonts_all', function( $args ) {
return apply_filters( 'kirki/fonts/all', $args );
}, 99 );
add_filter( 'kirki_fonts_standard_fonts', function( $args ) {
return apply_filters( 'kirki/fonts/standard_fonts', $args );
}, 99 );
add_filter( 'kirki_fonts_google_fonts', function( $args ) {
return apply_filters( 'kirki/fonts/google_fonts', $args );
}, 99 );
add_filter( 'kirki_googlefonts_load_method', function( $args ) {
return apply_filters( 'kirki/googlefonts_load_method', $args );
}, 99 );

View file

@ -0,0 +1,56 @@
<?php
// phpcs:ignoreFile
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'kirki_get_option' ) ) {
/**
* Get the value of a field.
* This is a deprecated function that we used when there was no API.
* Please use the Kirki::get_option() method instead.
* Documentation is available for the new method on https://github.com/aristath/kirki/wiki/Getting-the-values
*
* @return mixed
*/
function kirki_get_option( $option = '' ) {
_deprecated_function( __FUNCTION__, '1.0.0', sprintf( esc_html__( '%1$s or %2$s', 'kirki' ), 'get_theme_mod', 'get_option' ) );
return Kirki::get_option( '', $option );
}
}
if ( ! function_exists( 'kirki_sanitize_hex' ) ) {
function kirki_sanitize_hex( $color ) {
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'hex\' )' );
return Kirki_Color::sanitize_hex( $color );
}
}
if ( ! function_exists( 'kirki_get_rgb' ) ) {
function kirki_get_rgb( $hex, $implode = false ) {
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgb\' )' );
return Kirki_Color::get_rgb( $hex, $implode );
}
}
if ( ! function_exists( 'kirki_get_rgba' ) ) {
function kirki_get_rgba( $hex = '#fff', $opacity = 100 ) {
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgba\' )' );
return Kirki_Color::get_rgba( $hex, $opacity );
}
}
if ( ! function_exists( 'kirki_get_brightness' ) ) {
function kirki_get_brightness( $hex ) {
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->lightness' );
return Kirki_Color::get_brightness( $hex );
}
}
if ( ! function_exists( 'Kirki' ) ) {
function Kirki() {
return kirki();
}
}