@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | namespace Kirki\Compatibility; |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly. |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if (!defined('ABSPATH')) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @return Kirki\Compatibility\Framework |
| 40 | 40 | */ |
| 41 | 41 | public static function get_instance() { |
| 42 | - if ( null === self::$instance ) { |
|
| 42 | + if (null === self::$instance) { |
|
| 43 | 43 | self::$instance = new self(); |
| 44 | 44 | } |
| 45 | 45 | return self::$instance; |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | // phpcs:ignoreFile |
| 3 | 3 | |
| 4 | 4 | // Exit if accessed directly. |
| 5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 5 | +if (!defined('ABSPATH')) { |
|
| 6 | 6 | exit; |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if ( ! function_exists( 'kirki_get_option' ) ) { |
|
| 9 | +if (!function_exists('kirki_get_option')) { |
|
| 10 | 10 | /** |
| 11 | 11 | * Get the value of a field. |
| 12 | 12 | * This is a deprecated function that we used when there was no API. |
@@ -16,41 +16,41 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return mixed |
| 18 | 18 | */ |
| 19 | - function kirki_get_option( $option = '' ) { |
|
| 20 | - _deprecated_function( __FUNCTION__, '1.0.0', sprintf( esc_html__( '%1$s or %2$s', 'kirki' ), 'get_theme_mod', 'get_option' ) ); |
|
| 21 | - return Kirki::get_option( '', $option ); |
|
| 19 | + function kirki_get_option($option = '') { |
|
| 20 | + _deprecated_function(__FUNCTION__, '1.0.0', sprintf(esc_html__('%1$s or %2$s', 'kirki'), 'get_theme_mod', 'get_option')); |
|
| 21 | + return Kirki::get_option('', $option); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if ( ! function_exists( 'kirki_sanitize_hex' ) ) { |
|
| 26 | - function kirki_sanitize_hex( $color ) { |
|
| 27 | - _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'hex\' )' ); |
|
| 28 | - return Kirki_Color::sanitize_hex( $color ); |
|
| 25 | +if (!function_exists('kirki_sanitize_hex')) { |
|
| 26 | + function kirki_sanitize_hex($color) { |
|
| 27 | + _deprecated_function(__FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'hex\' )'); |
|
| 28 | + return Kirki_Color::sanitize_hex($color); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if ( ! function_exists( 'kirki_get_rgb' ) ) { |
|
| 33 | - function kirki_get_rgb( $hex, $implode = false ) { |
|
| 34 | - _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgb\' )' ); |
|
| 35 | - return Kirki_Color::get_rgb( $hex, $implode ); |
|
| 32 | +if (!function_exists('kirki_get_rgb')) { |
|
| 33 | + function kirki_get_rgb($hex, $implode = false) { |
|
| 34 | + _deprecated_function(__FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgb\' )'); |
|
| 35 | + return Kirki_Color::get_rgb($hex, $implode); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -if ( ! function_exists( 'kirki_get_rgba' ) ) { |
|
| 40 | - function kirki_get_rgba( $hex = '#fff', $opacity = 100 ) { |
|
| 41 | - _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgba\' )' ); |
|
| 42 | - return Kirki_Color::get_rgba( $hex, $opacity ); |
|
| 39 | +if (!function_exists('kirki_get_rgba')) { |
|
| 40 | + function kirki_get_rgba($hex = '#fff', $opacity = 100) { |
|
| 41 | + _deprecated_function(__FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgba\' )'); |
|
| 42 | + return Kirki_Color::get_rgba($hex, $opacity); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -if ( ! function_exists( 'kirki_get_brightness' ) ) { |
|
| 47 | - function kirki_get_brightness( $hex ) { |
|
| 48 | - _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->lightness' ); |
|
| 49 | - return Kirki_Color::get_brightness( $hex ); |
|
| 46 | +if (!function_exists('kirki_get_brightness')) { |
|
| 47 | + function kirki_get_brightness($hex) { |
|
| 48 | + _deprecated_function(__FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->lightness'); |
|
| 49 | + return Kirki_Color::get_brightness($hex); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -if ( ! function_exists( 'Kirki' ) ) { |
|
| 53 | +if (!function_exists('Kirki')) { |
|
| 54 | 54 | function Kirki() { |
| 55 | 55 | return \Kirki\Compatibility\Framework::get_instance(); |
| 56 | 56 | } |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // phpcs:ignoreFile |
| 3 | 3 | |
| 4 | -if ( ! class_exists( 'Kirki_Active_Callback' ) ) { |
|
| 4 | +if (!class_exists('Kirki_Active_Callback')) { |
|
| 5 | 5 | // Removed in https://github.com/aristath/kirki/pull/1682/files |
| 6 | 6 | class Kirki_Active_Callback { |
| 7 | 7 | public static function evaluate() { |
| 8 | - _deprecated_function( __METHOD__, '3.0.17', null ); |
|
| 8 | + _deprecated_function(__METHOD__, '3.0.17', null); |
|
| 9 | 9 | return true; |
| 10 | 10 | } |
| 11 | 11 | private static function evaluate_requirement() { |
| 12 | - _deprecated_function( __METHOD__, '3.0.17', null ); |
|
| 12 | + _deprecated_function(__METHOD__, '3.0.17', null); |
|
| 13 | 13 | return true; |
| 14 | 14 | } |
| 15 | - public static function compare( $value1, $value2, $operator ) { |
|
| 16 | - _deprecated_function( __METHOD__, '3.0.17', 'Kirki_Helper::compare_values' ); |
|
| 17 | - return Kirki_Helper::compare_values( $value1, $value2, $operator ); |
|
| 15 | + public static function compare($value1, $value2, $operator) { |
|
| 16 | + _deprecated_function(__METHOD__, '3.0.17', 'Kirki_Helper::compare_values'); |
|
| 17 | + return Kirki_Helper::compare_values($value1, $value2, $operator); |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Keeping it here in case a theme or plugin was using one of its public methods. |
| 26 | 26 | * This is just to avoid fatal errors, it does not do anything. |
| 27 | 27 | */ |
| 28 | -if ( ! class_exists( 'Kirki_CSS_To_File' ) ) { |
|
| 28 | +if (!class_exists('Kirki_CSS_To_File')) { |
|
| 29 | 29 | class Kirki_CSS_To_File { |
| 30 | 30 | public function __construct() {} |
| 31 | 31 | public function get_url() {} |
@@ -1,112 +1,112 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // phpcs:ignoreFile |
| 3 | 3 | |
| 4 | -add_filter( 'kirki_config', function( $args ) { |
|
| 5 | - return apply_filters( 'kirki/config', $args ); |
|
| 6 | -}, 99 ); |
|
| 4 | +add_filter('kirki_config', function($args) { |
|
| 5 | + return apply_filters('kirki/config', $args); |
|
| 6 | +}, 99); |
|
| 7 | 7 | |
| 8 | -add_filter( 'kirki_control_types', function( $args ) { |
|
| 9 | - return apply_filters( 'kirki/control_types', $args ); |
|
| 10 | -}, 99 ); |
|
| 8 | +add_filter('kirki_control_types', function($args) { |
|
| 9 | + return apply_filters('kirki/control_types', $args); |
|
| 10 | +}, 99); |
|
| 11 | 11 | |
| 12 | -add_filter( 'kirki_section_types', function( $args ) { |
|
| 13 | - return apply_filters( 'kirki/section_types', $args ); |
|
| 14 | -}, 99 ); |
|
| 12 | +add_filter('kirki_section_types', function($args) { |
|
| 13 | + return apply_filters('kirki/section_types', $args); |
|
| 14 | +}, 99); |
|
| 15 | 15 | |
| 16 | -add_filter( 'kirki_section_types_exclude', function( $args ) { |
|
| 17 | - return apply_filters( 'kirki/section_types/exclude', $args ); |
|
| 18 | -}, 99 ); |
|
| 16 | +add_filter('kirki_section_types_exclude', function($args) { |
|
| 17 | + return apply_filters('kirki/section_types/exclude', $args); |
|
| 18 | +}, 99); |
|
| 19 | 19 | |
| 20 | -add_filter( 'kirki_control_types_exclude', function( $args ) { |
|
| 21 | - return apply_filters( 'kirki/control_types/exclude', $args ); |
|
| 22 | -}, 99 ); |
|
| 20 | +add_filter('kirki_control_types_exclude', function($args) { |
|
| 21 | + return apply_filters('kirki/control_types/exclude', $args); |
|
| 22 | +}, 99); |
|
| 23 | 23 | |
| 24 | -add_filter( 'kirki_controls', function( $args ) { |
|
| 25 | - return apply_filters( 'kirki/controls', $args ); |
|
| 26 | -}, 99 ); |
|
| 24 | +add_filter('kirki_controls', function($args) { |
|
| 25 | + return apply_filters('kirki/controls', $args); |
|
| 26 | +}, 99); |
|
| 27 | 27 | |
| 28 | -add_filter( 'kirki_fields', function( $args ) { |
|
| 29 | - return apply_filters( 'kirki/fields', $args ); |
|
| 30 | -}, 99 ); |
|
| 28 | +add_filter('kirki_fields', function($args) { |
|
| 29 | + return apply_filters('kirki/fields', $args); |
|
| 30 | +}, 99); |
|
| 31 | 31 | |
| 32 | -add_filter( 'kirki_modules', function( $args ) { |
|
| 33 | - return apply_filters( 'kirki/modules', $args ); |
|
| 34 | -}, 99 ); |
|
| 32 | +add_filter('kirki_modules', function($args) { |
|
| 33 | + return apply_filters('kirki/modules', $args); |
|
| 34 | +}, 99); |
|
| 35 | 35 | |
| 36 | -add_filter( 'kirki_panel_types', function( $args ) { |
|
| 37 | - return apply_filters( 'kirki/panel_types', $args ); |
|
| 38 | -}, 99 ); |
|
| 36 | +add_filter('kirki_panel_types', function($args) { |
|
| 37 | + return apply_filters('kirki/panel_types', $args); |
|
| 38 | +}, 99); |
|
| 39 | 39 | |
| 40 | -add_filter( 'kirki_setting_types', function( $args ) { |
|
| 41 | - return apply_filters( 'kirki/setting_types', $args ); |
|
| 42 | -}, 99 ); |
|
| 40 | +add_filter('kirki_setting_types', function($args) { |
|
| 41 | + return apply_filters('kirki/setting_types', $args); |
|
| 42 | +}, 99); |
|
| 43 | 43 | |
| 44 | -add_filter( 'kirki_variable', function( $args ) { |
|
| 45 | - return apply_filters( 'kirki/variable', $args ); |
|
| 46 | -}, 99 ); |
|
| 44 | +add_filter('kirki_variable', function($args) { |
|
| 45 | + return apply_filters('kirki/variable', $args); |
|
| 46 | +}, 99); |
|
| 47 | 47 | |
| 48 | -add_filter( 'kirki_values_get_value', function( $arg1, $arg2 ) { |
|
| 49 | - return apply_filters( 'kirki/values/get_value', $arg1, $arg2 ); |
|
| 50 | -}, 99, 2 ); |
|
| 48 | +add_filter('kirki_values_get_value', function($arg1, $arg2) { |
|
| 49 | + return apply_filters('kirki/values/get_value', $arg1, $arg2); |
|
| 50 | +}, 99, 2); |
|
| 51 | 51 | |
| 52 | -add_action( 'init', function() { |
|
| 52 | +add_action('init', function() { |
|
| 53 | 53 | $config_ids = \Kirki\Compatibility\Config::get_config_ids(); |
| 54 | 54 | global $kirki_deprecated_filters_iteration; |
| 55 | - foreach ( $config_ids as $config_id ) { |
|
| 56 | - foreach( array( |
|
| 55 | + foreach ($config_ids as $config_id) { |
|
| 56 | + foreach (array( |
|
| 57 | 57 | '/dynamic_css', |
| 58 | 58 | '/output/control-classnames', |
| 59 | 59 | '/css/skip_hidden', |
| 60 | 60 | '/styles', |
| 61 | 61 | '/output/property-classnames', |
| 62 | 62 | '/webfonts/skip_hidden', |
| 63 | - ) as $filter_suffix ) { |
|
| 64 | - $kirki_deprecated_filters_iteration = array( $config_id, $filter_suffix ); |
|
| 65 | - add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) { |
|
| 63 | + ) as $filter_suffix) { |
|
| 64 | + $kirki_deprecated_filters_iteration = array($config_id, $filter_suffix); |
|
| 65 | + add_filter("kirki_{$config_id}_{$filter_suffix}", function($args) { |
|
| 66 | 66 | global $kirki_deprecated_filters_iteration; |
| 67 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
| 68 | - return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args ); |
|
| 69 | - }, 99 ); |
|
| 70 | - if ( false !== strpos( $kirki_deprecated_filters_iteration[1], '-' ) ) { |
|
| 71 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
| 72 | - add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) { |
|
| 67 | + $kirki_deprecated_filters_iteration[1] = str_replace('-', '_', $kirki_deprecated_filters_iteration[1]); |
|
| 68 | + return apply_filters("kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args); |
|
| 69 | + }, 99); |
|
| 70 | + if (false !== strpos($kirki_deprecated_filters_iteration[1], '-')) { |
|
| 71 | + $kirki_deprecated_filters_iteration[1] = str_replace('-', '_', $kirki_deprecated_filters_iteration[1]); |
|
| 72 | + add_filter("kirki_{$config_id}_{$filter_suffix}", function($args) { |
|
| 73 | 73 | global $kirki_deprecated_filters_iteration; |
| 74 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
| 75 | - return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args ); |
|
| 76 | - }, 99 ); |
|
| 74 | + $kirki_deprecated_filters_iteration[1] = str_replace('-', '_', $kirki_deprecated_filters_iteration[1]); |
|
| 75 | + return apply_filters("kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args); |
|
| 76 | + }, 99); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | -}, 99 ); |
|
| 80 | +}, 99); |
|
| 81 | 81 | |
| 82 | -add_filter( 'kirki_enqueue_google_fonts', function( $args ) { |
|
| 83 | - return apply_filters( 'kirki/enqueue_google_fonts', $args ); |
|
| 84 | -}, 99 ); |
|
| 82 | +add_filter('kirki_enqueue_google_fonts', function($args) { |
|
| 83 | + return apply_filters('kirki/enqueue_google_fonts', $args); |
|
| 84 | +}, 99); |
|
| 85 | 85 | |
| 86 | -add_filter( 'kirki_styles_array', function( $args ) { |
|
| 87 | - return apply_filters( 'kirki/styles_array', $args ); |
|
| 88 | -}, 99 ); |
|
| 86 | +add_filter('kirki_styles_array', function($args) { |
|
| 87 | + return apply_filters('kirki/styles_array', $args); |
|
| 88 | +}, 99); |
|
| 89 | 89 | |
| 90 | -add_filter( 'kirki_dynamic_css_method', function( $args ) { |
|
| 91 | - return apply_filters( 'kirki/dynamic_css/method', $args ); |
|
| 92 | -}, 99 ); |
|
| 90 | +add_filter('kirki_dynamic_css_method', function($args) { |
|
| 91 | + return apply_filters('kirki/dynamic_css/method', $args); |
|
| 92 | +}, 99); |
|
| 93 | 93 | |
| 94 | -add_filter( 'kirki_postmessage_script', function( $args ) { |
|
| 95 | - return apply_filters( 'kirki/postmessage/script', $args ); |
|
| 96 | -}, 99 ); |
|
| 94 | +add_filter('kirki_postmessage_script', function($args) { |
|
| 95 | + return apply_filters('kirki/postmessage/script', $args); |
|
| 96 | +}, 99); |
|
| 97 | 97 | |
| 98 | -add_filter( 'kirki_fonts_all', function( $args ) { |
|
| 99 | - return apply_filters( 'kirki/fonts/all', $args ); |
|
| 100 | -}, 99 ); |
|
| 98 | +add_filter('kirki_fonts_all', function($args) { |
|
| 99 | + return apply_filters('kirki/fonts/all', $args); |
|
| 100 | +}, 99); |
|
| 101 | 101 | |
| 102 | -add_filter( 'kirki_fonts_standard_fonts', function( $args ) { |
|
| 103 | - return apply_filters( 'kirki/fonts/standard_fonts', $args ); |
|
| 104 | -}, 99 ); |
|
| 102 | +add_filter('kirki_fonts_standard_fonts', function($args) { |
|
| 103 | + return apply_filters('kirki/fonts/standard_fonts', $args); |
|
| 104 | +}, 99); |
|
| 105 | 105 | |
| 106 | -add_filter( 'kirki_fonts_google_fonts', function( $args ) { |
|
| 107 | - return apply_filters( 'kirki/fonts/google_fonts', $args ); |
|
| 108 | -}, 99 ); |
|
| 106 | +add_filter('kirki_fonts_google_fonts', function($args) { |
|
| 107 | + return apply_filters('kirki/fonts/google_fonts', $args); |
|
| 108 | +}, 99); |
|
| 109 | 109 | |
| 110 | -add_filter( 'kirki_googlefonts_load_method', function( $args ) { |
|
| 111 | - return apply_filters( 'kirki/googlefonts_load_method', $args ); |
|
| 112 | -}, 99 ); |
|
| 110 | +add_filter('kirki_googlefonts_load_method', function($args) { |
|
| 111 | + return apply_filters('kirki/googlefonts_load_method', $args); |
|
| 112 | +}, 99); |
|
@@ -89,23 +89,23 @@ discard block |
||
| 89 | 89 | * @param string $config_id @see Kirki\Compatibility\Config::get_instance(). |
| 90 | 90 | * @param array $args @see Kirki\Compatibility\Config::get_instance(). |
| 91 | 91 | */ |
| 92 | - private function __construct( $config_id = 'global', $args = [] ) { |
|
| 92 | + private function __construct($config_id = 'global', $args = []) { |
|
| 93 | 93 | |
| 94 | 94 | // Get defaults from the class. |
| 95 | - $defaults = get_class_vars( __CLASS__ ); |
|
| 95 | + $defaults = get_class_vars(__CLASS__); |
|
| 96 | 96 | // Skip what we don't need in this context. |
| 97 | - unset( $defaults['config_final'] ); |
|
| 98 | - unset( $defaults['instances'] ); |
|
| 97 | + unset($defaults['config_final']); |
|
| 98 | + unset($defaults['instances']); |
|
| 99 | 99 | // Apply any kirki_config global filters. |
| 100 | - $defaults = apply_filters( 'kirki_config', $defaults ); |
|
| 100 | + $defaults = apply_filters('kirki_config', $defaults); |
|
| 101 | 101 | // Merge our args with the defaults. |
| 102 | - $args = wp_parse_args( $args, $defaults ); |
|
| 102 | + $args = wp_parse_args($args, $defaults); |
|
| 103 | 103 | |
| 104 | 104 | // Modify default values with the defined ones. |
| 105 | - foreach ( $args as $key => $value ) { |
|
| 105 | + foreach ($args as $key => $value) { |
|
| 106 | 106 | // Is this property whitelisted? |
| 107 | - if ( property_exists( $this, $key ) ) { |
|
| 108 | - $args[ $key ] = $value; |
|
| 107 | + if (property_exists($this, $key)) { |
|
| 108 | + $args[$key] = $value; |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | $this->id = $config_id; |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return Kirki\Compatibility\Config |
| 142 | 142 | */ |
| 143 | - public static function get_instance( $id = 'global', $args = [] ) { |
|
| 144 | - if ( empty( $id ) ) { |
|
| 143 | + public static function get_instance($id = 'global', $args = []) { |
|
| 144 | + if (empty($id)) { |
|
| 145 | 145 | $id = 'global'; |
| 146 | 146 | } |
| 147 | - $id_md5 = md5( $id ); |
|
| 148 | - if ( ! isset( self::$instances[ $id_md5 ] ) ) { |
|
| 149 | - self::$instances[ $id_md5 ] = new self( $id, $args ); |
|
| 147 | + $id_md5 = md5($id); |
|
| 148 | + if (!isset(self::$instances[$id_md5])) { |
|
| 149 | + self::$instances[$id_md5] = new self($id, $args); |
|
| 150 | 150 | } |
| 151 | - return self::$instances[ $id_md5 ]; |
|
| 151 | + return self::$instances[$id_md5]; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public static function get_config_ids() { |
| 163 | 163 | $configs = []; |
| 164 | - foreach ( self::$instances as $instance ) { |
|
| 164 | + foreach (self::$instances as $instance) { |
|
| 165 | 165 | $configs[] = $instance->id; |
| 166 | 166 | } |
| 167 | - return array_unique( $configs ); |
|
| 167 | + return array_unique($configs); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | * @access public |
| 41 | 41 | * @param array $args The field definition as sanitized in Kirki\Compatibility\Field. |
| 42 | 42 | */ |
| 43 | - public function __construct( $args = [] ) { |
|
| 43 | + public function __construct($args = []) { |
|
| 44 | 44 | |
| 45 | 45 | // Set the $wp_customize property. |
| 46 | 46 | global $wp_customize; |
| 47 | - if ( ! $wp_customize ) { |
|
| 47 | + if (!$wp_customize) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | $this->wp_customize = $wp_customize; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->set_setting_types(); |
| 54 | 54 | |
| 55 | 55 | // Add the settings. |
| 56 | - $this->add_settings( $args ); |
|
| 56 | + $this->add_settings($args); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,33 +66,33 @@ discard block |
||
| 66 | 66 | * @access private |
| 67 | 67 | * @param array $args The field definition as sanitized in Kirki\Compatibility\Field. |
| 68 | 68 | */ |
| 69 | - final function add_settings( $args = [] ) { |
|
| 69 | + final function add_settings($args = []) { |
|
| 70 | 70 | |
| 71 | 71 | // Get the classname we'll be using to create our setting(s). |
| 72 | 72 | $classname = false; |
| 73 | - if ( isset( $args['option_type'] ) && array_key_exists( $args['option_type'], $this->setting_types ) ) { |
|
| 74 | - $classname = $this->setting_types[ $args['option_type'] ]; |
|
| 73 | + if (isset($args['option_type']) && array_key_exists($args['option_type'], $this->setting_types)) { |
|
| 74 | + $classname = $this->setting_types[$args['option_type']]; |
|
| 75 | 75 | } |
| 76 | - if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) { |
|
| 76 | + if (!isset($args['type']) || !array_key_exists($args['type'], $this->setting_types)) { |
|
| 77 | 77 | $args['type'] = 'default'; |
| 78 | 78 | } |
| 79 | - $classname = ! $classname ? $this->setting_types[ $args['type'] ] : $classname; |
|
| 79 | + $classname = !$classname ? $this->setting_types[$args['type']] : $classname; |
|
| 80 | 80 | |
| 81 | 81 | // If settings are defined as an array, then we need to go through them |
| 82 | 82 | // and call add_setting for each one of them separately. |
| 83 | - if ( isset( $args['settings'] ) && is_array( $args['settings'] ) ) { |
|
| 83 | + if (isset($args['settings']) && is_array($args['settings'])) { |
|
| 84 | 84 | |
| 85 | 85 | // Make sure defaults have been defined. |
| 86 | - if ( ! isset( $args['default'] ) || ! is_array( $args['default'] ) ) { |
|
| 86 | + if (!isset($args['default']) || !is_array($args['default'])) { |
|
| 87 | 87 | $args['default'] = []; |
| 88 | 88 | } |
| 89 | - foreach ( $args['settings'] as $key => $value ) { |
|
| 89 | + foreach ($args['settings'] as $key => $value) { |
|
| 90 | 90 | // ? Bagus: this $defaults var is not defined anywhere inside this function, so is this a mistake? |
| 91 | - $default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : ''; |
|
| 92 | - $this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
|
| 91 | + $default = (isset($defaults[$key])) ? $defaults[$key] : ''; |
|
| 92 | + $this->add_setting($classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback']); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - $this->add_setting( $classname, $args['settings'], $args['default'], $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
|
| 95 | + $this->add_setting($classname, $args['settings'], $args['default'], $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback']); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param string $transport Use refresh|postMessage. |
| 110 | 110 | * @param string|array $sanitize_callback A callable sanitization function or method. |
| 111 | 111 | */ |
| 112 | - final function add_setting( $classname, $setting, $default, $type, $capability, $transport, $sanitize_callback ) { |
|
| 112 | + final function add_setting($classname, $setting, $default, $type, $capability, $transport, $sanitize_callback) { |
|
| 113 | 113 | |
| 114 | 114 | $this->wp_customize->add_setting( |
| 115 | 115 | new $classname( |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | 149 | // Make sure the defined classes actually exist. |
| 150 | - foreach ( $this->setting_types as $key => $classname ) { |
|
| 150 | + foreach ($this->setting_types as $key => $classname) { |
|
| 151 | 151 | |
| 152 | - if ( ! class_exists( $classname ) ) { |
|
| 153 | - unset( $this->setting_types[ $key ] ); |
|
| 152 | + if (!class_exists($classname)) { |
|
| 153 | + unset($this->setting_types[$key]); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -245,57 +245,57 @@ discard block |
||
| 245 | 245 | * Configs are handled by the Kirki\Compatibility\Config class. |
| 246 | 246 | * @param array $args The arguments of the field. |
| 247 | 247 | */ |
| 248 | - public function __construct( $config_id = 'global', $args = [] ) { |
|
| 248 | + public function __construct($config_id = 'global', $args = []) { |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * In case the user only provides 1 argument, |
| 252 | 252 | * assume that the provided argument is $args and set $config_id = 'global'. |
| 253 | 253 | */ |
| 254 | - if ( is_array( $config_id ) && empty( $args ) ) { |
|
| 254 | + if (is_array($config_id) && empty($args)) { |
|
| 255 | 255 | $args = $config_id; |
| 256 | - $config_id = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; |
|
| 256 | + $config_id = isset($args['kirki_config']) ? $args['kirki_config'] : 'global'; |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( isset( $args['setting'] ) && ! empty( $args['setting'] ) && ( ! isset( $args['settings'] ) || empty( $args['settings'] ) ) ) { |
|
| 259 | + if (isset($args['setting']) && !empty($args['setting']) && (!isset($args['settings']) || empty($args['settings']))) { |
|
| 260 | 260 | /* translators: %s represents the field ID where the error occurs. */ |
| 261 | - _doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Typo found in field %s - setting instead of settings.', 'kirki' ), esc_html( $args['settings'] ) ), '3.0.10' ); |
|
| 261 | + _doing_it_wrong(__METHOD__, sprintf(esc_html__('Typo found in field %s - setting instead of settings.', 'kirki'), esc_html($args['settings'])), '3.0.10'); |
|
| 262 | 262 | $args['settings'] = $args['setting']; |
| 263 | - unset( $args['setting'] ); |
|
| 263 | + unset($args['setting']); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $args['kirki_config'] = $config_id; |
| 267 | 267 | |
| 268 | 268 | $this->kirki_config = $config_id; |
| 269 | 269 | |
| 270 | - if ( '' === $config_id ) { |
|
| 270 | + if ('' === $config_id) { |
|
| 271 | 271 | /* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */ |
| 272 | - _doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' ); |
|
| 272 | + _doing_it_wrong(__METHOD__, sprintf(esc_html__('Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki'), esc_html($args['settings']), 'https://aristath.github.io/kirki/docs/getting-started/fields.html'), '3.0.10'); |
|
| 273 | 273 | $this->kirki_config = 'global'; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Get defaults from the class. |
| 277 | - $defaults = get_class_vars( __CLASS__ ); |
|
| 277 | + $defaults = get_class_vars(__CLASS__); |
|
| 278 | 278 | |
| 279 | 279 | // Get the config arguments, and merge them with the defaults. |
| 280 | - $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : []; |
|
| 280 | + $config_defaults = (isset(Kirki::$config['global'])) ? Kirki::$config['global'] : []; |
|
| 281 | 281 | |
| 282 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
| 283 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
| 282 | + if ('global' !== $this->kirki_config && isset(Kirki::$config[$this->kirki_config])) { |
|
| 283 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : []; |
|
| 286 | + $config_defaults = (is_array($config_defaults)) ? $config_defaults : []; |
|
| 287 | 287 | |
| 288 | - foreach ( $config_defaults as $key => $value ) { |
|
| 289 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) { |
|
| 290 | - $defaults[ $key ] = $value; |
|
| 288 | + foreach ($config_defaults as $key => $value) { |
|
| 289 | + if (isset($defaults[$key]) && !empty($value) && $value !== $defaults[$key]) { |
|
| 290 | + $defaults[$key] = $value; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Merge our args with the defaults. |
| 295 | - $args = wp_parse_args( $args, $defaults ); |
|
| 295 | + $args = wp_parse_args($args, $defaults); |
|
| 296 | 296 | |
| 297 | 297 | // Set the class properties using the parsed args. |
| 298 | - foreach ( $args as $key => $value ) { |
|
| 298 | + foreach ($args as $key => $value) { |
|
| 299 | 299 | $this->$key = $value; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $this->set_field(); |
| 305 | 305 | |
| 306 | 306 | // Instantiate the \Kirki\Field to apply hooks. |
| 307 | - new \Kirki\Field\None( $this->args ); |
|
| 307 | + new \Kirki\Field\None($this->args); |
|
| 308 | 308 | |
| 309 | 309 | } |
| 310 | 310 | |
@@ -315,32 +315,32 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | protected function set_field() { |
| 317 | 317 | |
| 318 | - $properties = get_class_vars( __CLASS__ ); |
|
| 318 | + $properties = get_class_vars(__CLASS__); |
|
| 319 | 319 | |
| 320 | 320 | // Some things must run before the others. |
| 321 | 321 | $this->set_option_type(); |
| 322 | 322 | $this->set_settings(); |
| 323 | 323 | |
| 324 | 324 | // Sanitize the properties, skipping the ones that have already run above. |
| 325 | - foreach ( array_keys( $properties ) as $property ) { |
|
| 326 | - if ( in_array( $property, [ 'option_name', 'option_type', 'settings' ], true ) ) { |
|
| 325 | + foreach (array_keys($properties) as $property) { |
|
| 326 | + if (in_array($property, ['option_name', 'option_type', 'settings'], true)) { |
|
| 327 | 327 | continue; |
| 328 | 328 | } |
| 329 | - if ( method_exists( $this, 'set_' . $property ) ) { |
|
| 329 | + if (method_exists($this, 'set_' . $property)) { |
|
| 330 | 330 | $method_name = 'set_' . $property; |
| 331 | 331 | $this->$method_name(); |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | // Get all arguments with their values. |
| 336 | - $args = get_object_vars( $this ); |
|
| 336 | + $args = get_object_vars($this); |
|
| 337 | 337 | |
| 338 | - foreach ( array_keys( $args ) as $key ) { |
|
| 339 | - $args[ $key ] = $this->$key; |
|
| 338 | + foreach (array_keys($args) as $key) { |
|
| 339 | + $args[$key] = $this->$key; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // Add the field to the static $fields variable properly indexed. |
| 343 | - Kirki::$fields[ $this->settings ] = $args; |
|
| 343 | + Kirki::$fields[$this->settings] = $args; |
|
| 344 | 344 | |
| 345 | 345 | } |
| 346 | 346 | |
@@ -361,14 +361,14 @@ discard block |
||
| 361 | 361 | protected function set_option_type() { |
| 362 | 362 | |
| 363 | 363 | // Take care of common typos. |
| 364 | - if ( 'options' === $this->option_type ) { |
|
| 364 | + if ('options' === $this->option_type) { |
|
| 365 | 365 | $this->option_type = 'option'; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | // Take care of common typos. |
| 369 | - if ( 'theme_mods' === $this->option_type ) { |
|
| 369 | + if ('theme_mods' === $this->option_type) { |
|
| 370 | 370 | /* translators: %1$s represents the field ID where the error occurs. */ |
| 371 | - _doing_it_wrong( __METHOD__, sprintf( esc_html( 'Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' ); |
|
| 371 | + _doing_it_wrong(__METHOD__, sprintf(esc_html('Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki'), esc_html($this->settings)), '3.0.10'); |
|
| 372 | 372 | $this->option_type = 'theme_mod'; |
| 373 | 373 | } |
| 374 | 374 | } |
@@ -379,18 +379,18 @@ discard block |
||
| 379 | 379 | * @access protected |
| 380 | 380 | */ |
| 381 | 381 | protected function set_partial_refresh() { |
| 382 | - if ( ! is_array( $this->partial_refresh ) ) { |
|
| 382 | + if (!is_array($this->partial_refresh)) { |
|
| 383 | 383 | $this->partial_refresh = []; |
| 384 | 384 | } |
| 385 | - foreach ( $this->partial_refresh as $id => $args ) { |
|
| 386 | - if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
|
| 385 | + foreach ($this->partial_refresh as $id => $args) { |
|
| 386 | + if (!is_array($args) || !isset($args['selector']) || !isset($args['render_callback']) || !is_callable($args['render_callback'])) { |
|
| 387 | 387 | /* translators: %1$s represents the field ID where the error occurs. */ |
| 388 | - _doing_it_wrong( __METHOD__, sprintf( esc_html__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' ); |
|
| 389 | - unset( $this->partial_refresh[ $id ] ); |
|
| 388 | + _doing_it_wrong(__METHOD__, sprintf(esc_html__('"partial_refresh" invalid entry in field %s', 'kirki'), esc_html($this->settings)), '3.0.10'); |
|
| 389 | + unset($this->partial_refresh[$id]); |
|
| 390 | 390 | continue; |
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | - if ( ! empty( $this->partial_refresh ) ) { |
|
| 393 | + if (!empty($this->partial_refresh)) { |
|
| 394 | 394 | $this->transport = 'postMessage'; |
| 395 | 395 | } |
| 396 | 396 | } |
@@ -407,22 +407,22 @@ discard block |
||
| 407 | 407 | // If settings is not an array, temporarily convert it to an array. |
| 408 | 408 | // This is just to allow us to process everything the same way and avoid code duplication. |
| 409 | 409 | // if settings is not an array then it will not be set as an array in the end. |
| 410 | - if ( ! is_array( $this->settings ) ) { |
|
| 410 | + if (!is_array($this->settings)) { |
|
| 411 | 411 | $this->settings = [ |
| 412 | 412 | 'kirki_placeholder_setting' => $this->settings, |
| 413 | 413 | ]; |
| 414 | 414 | } |
| 415 | 415 | $settings = []; |
| 416 | - foreach ( $this->settings as $setting_key => $setting_value ) { |
|
| 417 | - $settings[ $setting_key ] = $setting_value; |
|
| 416 | + foreach ($this->settings as $setting_key => $setting_value) { |
|
| 417 | + $settings[$setting_key] = $setting_value; |
|
| 418 | 418 | |
| 419 | 419 | // If we're using serialized options then we need to spice this up. |
| 420 | - if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
|
| 421 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
| 420 | + if ('option' === $this->option_type && '' !== $this->option_name && (false === strpos($setting_key, '['))) { |
|
| 421 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | $this->settings = $settings; |
| 425 | - if ( isset( $this->settings['kirki_placeholder_setting'] ) ) { |
|
| 425 | + if (isset($this->settings['kirki_placeholder_setting'])) { |
|
| 426 | 426 | $this->settings = $this->settings['kirki_placeholder_setting']; |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -436,33 +436,33 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | protected function set_active_callback() { |
| 438 | 438 | |
| 439 | - if ( is_array( $this->active_callback ) ) { |
|
| 439 | + if (is_array($this->active_callback)) { |
|
| 440 | 440 | |
| 441 | - if ( ! is_callable( $this->active_callback ) ) { |
|
| 441 | + if (!is_callable($this->active_callback)) { |
|
| 442 | 442 | |
| 443 | 443 | // Bugfix for https://github.com/aristath/kirki/issues/1961. |
| 444 | - foreach ( $this->active_callback as $key => $val ) { |
|
| 445 | - if ( is_callable( $val ) ) { |
|
| 446 | - unset( $this->active_callback[ $key ] ); |
|
| 444 | + foreach ($this->active_callback as $key => $val) { |
|
| 445 | + if (is_callable($val)) { |
|
| 446 | + unset($this->active_callback[$key]); |
|
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | - if ( isset( $this->active_callback[0] ) ) { |
|
| 449 | + if (isset($this->active_callback[0])) { |
|
| 450 | 450 | $this->required = $this->active_callback; |
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if ( ! empty( $this->required ) ) { |
|
| 455 | + if (!empty($this->required)) { |
|
| 456 | 456 | $this->active_callback = '__return_true'; |
| 457 | 457 | return; |
| 458 | 458 | } |
| 459 | 459 | // No need to proceed any further if we're using the default value. |
| 460 | - if ( '__return_true' === $this->active_callback ) { |
|
| 460 | + if ('__return_true' === $this->active_callback) { |
|
| 461 | 461 | return; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | // Make sure the function is callable, otherwise fallback to __return_true. |
| 465 | - if ( ! is_callable( $this->active_callback ) ) { |
|
| 465 | + if (!is_callable($this->active_callback)) { |
|
| 466 | 466 | $this->active_callback = '__return_true'; |
| 467 | 467 | } |
| 468 | 468 | |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | * @access protected |
| 478 | 478 | */ |
| 479 | 479 | protected function set_id() { |
| 480 | - $this->id = sanitize_key( str_replace( '[', '-', str_replace( ']', '', $this->settings ) ) ); |
|
| 480 | + $this->id = sanitize_key(str_replace('[', '-', str_replace(']', '', $this->settings))); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * @access protected |
| 487 | 487 | */ |
| 488 | 488 | protected function set_choices() { |
| 489 | - if ( ! is_array( $this->choices ) ) { |
|
| 489 | + if (!is_array($this->choices)) { |
|
| 490 | 490 | $this->choices = []; |
| 491 | 491 | } |
| 492 | 492 | } |
@@ -506,12 +506,12 @@ discard block |
||
| 506 | 506 | * @access protected |
| 507 | 507 | */ |
| 508 | 508 | protected function set_output() { |
| 509 | - if ( empty( $this->output ) ) { |
|
| 509 | + if (empty($this->output)) { |
|
| 510 | 510 | return; |
| 511 | 511 | } |
| 512 | - if ( ! is_array( $this->output ) ) { |
|
| 512 | + if (!is_array($this->output)) { |
|
| 513 | 513 | /* translators: The field ID where the error occurs. */ |
| 514 | - _doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' ); |
|
| 514 | + _doing_it_wrong(__METHOD__, sprintf(esc_html__('"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki'), esc_html($this->settings)), '3.0.10'); |
|
| 515 | 515 | $this->output = [ |
| 516 | 516 | [ |
| 517 | 517 | 'element' => $this->output, |
@@ -520,36 +520,36 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Convert to array of arrays if needed. |
| 523 | - if ( isset( $this->output['element'] ) ) { |
|
| 523 | + if (isset($this->output['element'])) { |
|
| 524 | 524 | /* translators: The field ID where the error occurs. */ |
| 525 | - _doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' ); |
|
| 526 | - $this->output = [ $this->output ]; |
|
| 525 | + _doing_it_wrong(__METHOD__, sprintf(esc_html__('"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki'), esc_html($this->settings)), '3.0.10'); |
|
| 526 | + $this->output = [$this->output]; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - foreach ( $this->output as $key => $output ) { |
|
| 530 | - if ( empty( $output ) || ! isset( $output['element'] ) ) { |
|
| 531 | - unset( $this->output[ $key ] ); |
|
| 529 | + foreach ($this->output as $key => $output) { |
|
| 530 | + if (empty($output) || !isset($output['element'])) { |
|
| 531 | + unset($this->output[$key]); |
|
| 532 | 532 | continue; |
| 533 | 533 | } |
| 534 | - if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
|
| 535 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
| 534 | + if (!isset($output['sanitize_callback']) && isset($output['callback'])) { |
|
| 535 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | // Convert element arrays to strings. |
| 539 | - if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
|
| 540 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
| 541 | - sort( $this->output[ $key ]['element'] ); |
|
| 539 | + if (isset($output['element']) && is_array($output['element'])) { |
|
| 540 | + $this->output[$key]['element'] = array_unique($this->output[$key]['element']); |
|
| 541 | + sort($this->output[$key]['element']); |
|
| 542 | 542 | |
| 543 | 543 | // Trim each element in the array. |
| 544 | - foreach ( $this->output[ $key ]['element'] as $index => $element ) { |
|
| 545 | - $this->output[ $key ]['element'][ $index ] = trim( $element ); |
|
| 544 | + foreach ($this->output[$key]['element'] as $index => $element) { |
|
| 545 | + $this->output[$key]['element'][$index] = trim($element); |
|
| 546 | 546 | } |
| 547 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
| 547 | + $this->output[$key]['element'] = implode(',', $this->output[$key]['element']); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | // Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751. |
| 551 | - $this->output[ $key ]['element'] = str_replace( [ "\t", "\n", "\r", "\0", "\x0B" ], ' ', $this->output[ $key ]['element'] ); |
|
| 552 | - $this->output[ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ]['element'] ) ); |
|
| 551 | + $this->output[$key]['element'] = str_replace(["\t", "\n", "\r", "\0", "\x0B"], ' ', $this->output[$key]['element']); |
|
| 552 | + $this->output[$key]['element'] = trim(preg_replace('/\s+/', ' ', $this->output[$key]['element'])); |
|
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | |
@@ -559,13 +559,13 @@ discard block |
||
| 559 | 559 | * @access protected |
| 560 | 560 | */ |
| 561 | 561 | protected function set_js_vars() { |
| 562 | - if ( ! is_array( $this->js_vars ) ) { |
|
| 562 | + if (!is_array($this->js_vars)) { |
|
| 563 | 563 | $this->js_vars = []; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | // Check if transport is set to auto. |
| 567 | 567 | // If not, then skip the auto-calculations and exit early. |
| 568 | - if ( 'auto' !== $this->transport ) { |
|
| 568 | + if ('auto' !== $this->transport) { |
|
| 569 | 569 | return; |
| 570 | 570 | } |
| 571 | 571 | |
@@ -577,22 +577,22 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | // Try to auto-generate js_vars. |
| 579 | 579 | // First we need to check if js_vars are empty, and that output is not empty. |
| 580 | - if ( empty( $this->js_vars ) && ! empty( $this->output ) ) { |
|
| 580 | + if (empty($this->js_vars) && !empty($this->output)) { |
|
| 581 | 581 | |
| 582 | 582 | // Start going through each item in the $output array. |
| 583 | - foreach ( $this->output as $output ) { |
|
| 584 | - $output['function'] = ( isset( $output['function'] ) ) ? $output['function'] : 'style'; |
|
| 583 | + foreach ($this->output as $output) { |
|
| 584 | + $output['function'] = (isset($output['function'])) ? $output['function'] : 'style'; |
|
| 585 | 585 | |
| 586 | 586 | // If 'element' is not defined, skip this. |
| 587 | - if ( ! isset( $output['element'] ) ) { |
|
| 587 | + if (!isset($output['element'])) { |
|
| 588 | 588 | continue; |
| 589 | 589 | } |
| 590 | - if ( is_array( $output['element'] ) ) { |
|
| 591 | - $output['element'] = implode( ',', $output['element'] ); |
|
| 590 | + if (is_array($output['element'])) { |
|
| 591 | + $output['element'] = implode(',', $output['element']); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // If there's a sanitize_callback defined skip this, unless we also have a js_callback defined. |
| 595 | - if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) && ! isset( $output['js_callback'] ) ) { |
|
| 595 | + if (isset($output['sanitize_callback']) && !empty($output['sanitize_callback']) && !isset($output['js_callback'])) { |
|
| 596 | 596 | continue; |
| 597 | 597 | } |
| 598 | 598 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | // Did we manage to get all the items from 'output'? |
| 604 | 604 | // If not, then we're missing something so don't add this. |
| 605 | - if ( count( $js_vars ) !== count( $this->output ) ) { |
|
| 605 | + if (count($js_vars) !== count($this->output)) { |
|
| 606 | 606 | return; |
| 607 | 607 | } |
| 608 | 608 | $this->js_vars = $js_vars; |
@@ -616,10 +616,10 @@ discard block |
||
| 616 | 616 | * @access protected |
| 617 | 617 | */ |
| 618 | 618 | protected function set_variables() { |
| 619 | - if ( ! is_array( $this->variables ) ) { |
|
| 620 | - $variable = ( is_string( $this->variables ) && ! empty( $this->variables ) ) ? $this->variables : false; |
|
| 619 | + if (!is_array($this->variables)) { |
|
| 620 | + $variable = (is_string($this->variables) && !empty($this->variables)) ? $this->variables : false; |
|
| 621 | 621 | $this->variables = []; |
| 622 | - if ( $variable && empty( $this->variables ) ) { |
|
| 622 | + if ($variable && empty($this->variables)) { |
|
| 623 | 623 | $this->variables[0]['name'] = $variable; |
| 624 | 624 | } |
| 625 | 625 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | * @access protected |
| 632 | 632 | */ |
| 633 | 633 | protected function set_transport() { |
| 634 | - if ( 'postmessage' === trim( strtolower( $this->transport ) ) ) { |
|
| 634 | + if ('postmessage' === trim(strtolower($this->transport))) { |
|
| 635 | 635 | $this->transport = 'postMessage'; |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * @access protected |
| 643 | 643 | */ |
| 644 | 644 | protected function set_required() { |
| 645 | - if ( ! is_array( $this->required ) ) { |
|
| 645 | + if (!is_array($this->required)) { |
|
| 646 | 646 | $this->required = []; |
| 647 | 647 | } |
| 648 | 648 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @access protected |
| 654 | 654 | */ |
| 655 | 655 | protected function set_priority() { |
| 656 | - $this->priority = absint( $this->priority ); |
|
| 656 | + $this->priority = absint($this->priority); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -662,15 +662,15 @@ discard block |
||
| 662 | 662 | * @access protected |
| 663 | 663 | */ |
| 664 | 664 | protected function set_css_vars() { |
| 665 | - if ( is_string( $this->css_vars ) ) { |
|
| 666 | - $this->css_vars = [ $this->css_vars ]; |
|
| 665 | + if (is_string($this->css_vars)) { |
|
| 666 | + $this->css_vars = [$this->css_vars]; |
|
| 667 | 667 | } |
| 668 | - if ( isset( $this->css_vars[0] ) && is_string( $this->css_vars[0] ) ) { |
|
| 669 | - $this->css_vars = [ $this->css_vars ]; |
|
| 668 | + if (isset($this->css_vars[0]) && is_string($this->css_vars[0])) { |
|
| 669 | + $this->css_vars = [$this->css_vars]; |
|
| 670 | 670 | } |
| 671 | - foreach ( $this->css_vars as $key => $val ) { |
|
| 672 | - if ( ! isset( $val[1] ) ) { |
|
| 673 | - $this->css_vars[ $key ][1] = '$'; |
|
| 671 | + foreach ($this->css_vars as $key => $val) { |
|
| 672 | + if (!isset($val[1])) { |
|
| 673 | + $this->css_vars[$key][1] = '$'; |
|
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | } |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | * @access public |
| 40 | 40 | * @param array $args The field definition as sanitized in Kirki\Field. |
| 41 | 41 | */ |
| 42 | - public function __construct( $args ) { |
|
| 42 | + public function __construct($args) { |
|
| 43 | 43 | |
| 44 | 44 | // Set the $wp_customize property. |
| 45 | 45 | global $wp_customize; |
| 46 | - if ( ! $wp_customize ) { |
|
| 46 | + if (!$wp_customize) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | $this->wp_customize = $wp_customize; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->set_control_types(); |
| 53 | 53 | |
| 54 | 54 | // Add the control. |
| 55 | - $this->add_control( $args ); |
|
| 55 | + $this->add_control($args); |
|
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string the name of the class that will be used to create this control. |
| 66 | 66 | */ |
| 67 | - final function get_control_class_name( $args ) { |
|
| 67 | + final function get_control_class_name($args) { |
|
| 68 | 68 | |
| 69 | 69 | // Set a default class name. |
| 70 | 70 | $class_name = 'WP_Customize_Control'; |
| 71 | 71 | |
| 72 | 72 | // Get the classname from the array of control classnames. |
| 73 | - if ( array_key_exists( $args['type'], self::$control_types ) ) { |
|
| 74 | - $class_name = self::$control_types[ $args['type'] ]; |
|
| 73 | + if (array_key_exists($args['type'], self::$control_types)) { |
|
| 74 | + $class_name = self::$control_types[$args['type']]; |
|
| 75 | 75 | } |
| 76 | 76 | return $class_name; |
| 77 | 77 | } |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | * @access protected |
| 83 | 83 | * @param array $args The field definition as sanitized in Kirki\Field. |
| 84 | 84 | */ |
| 85 | - final protected function add_control( $args ) { |
|
| 85 | + final protected function add_control($args) { |
|
| 86 | 86 | |
| 87 | 87 | // Get the name of the class we're going to use. |
| 88 | - $class_name = $this->get_control_class_name( $args ); |
|
| 88 | + $class_name = $this->get_control_class_name($args); |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Allow filtering the arguments. |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
| 96 | 96 | * @return array Return the arguments. |
| 97 | 97 | */ |
| 98 | - $args = apply_filters( 'kirki_field_add_control_args', $args, $this->wp_customize ); |
|
| 98 | + $args = apply_filters('kirki_field_add_control_args', $args, $this->wp_customize); |
|
| 99 | 99 | |
| 100 | 100 | // Add the control. |
| 101 | - $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) ); |
|
| 101 | + $this->wp_customize->add_control(new $class_name($this->wp_customize, $args['settings'], $args)); |
|
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | |
@@ -113,16 +113,16 @@ discard block |
||
| 113 | 113 | final function set_control_types() { |
| 114 | 114 | |
| 115 | 115 | // Early exit if this has already run. |
| 116 | - if ( ! empty( self::$control_types ) ) { |
|
| 116 | + if (!empty(self::$control_types)) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - self::$control_types = apply_filters( 'kirki_control_types', [] ); |
|
| 120 | + self::$control_types = apply_filters('kirki_control_types', []); |
|
| 121 | 121 | |
| 122 | 122 | // Make sure the defined classes actually exist. |
| 123 | - foreach ( self::$control_types as $key => $classname ) { |
|
| 124 | - if ( ! class_exists( $classname ) ) { |
|
| 125 | - unset( self::$control_types[ $key ] ); |
|
| 123 | + foreach (self::$control_types as $key => $classname) { |
|
| 124 | + if (!class_exists($classname)) { |
|
| 125 | + unset(self::$control_types[$key]); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -28,116 +28,116 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $aliases = [ |
| 30 | 30 | 'generic' => [ |
| 31 | - [ 'Kirki\Compatibility\Kirki', 'Kirki' ], |
|
| 32 | - [ 'Kirki\Compatibility\Config', 'Kirki_Config' ], |
|
| 33 | - [ 'Kirki\Compatibility\Control', 'Kirki_Control' ], |
|
| 34 | - [ 'Kirki\Compatibility\Field', 'Kirki_Field' ], |
|
| 35 | - [ 'Kirki\Util\Helper', 'Kirki_Helper' ], |
|
| 36 | - [ 'Kirki\Compatibility\Init', 'Kirki_Init' ], |
|
| 37 | - [ 'Kirki\L10n', 'Kirki_L10n' ], |
|
| 38 | - [ 'Kirki\Compatibility\Modules', 'Kirki_Modules' ], |
|
| 39 | - [ 'Kirki\Compatibility\Sanitize_Values', 'Kirki_Sanitize_Values' ], |
|
| 40 | - [ 'Kirki\Compatibility\Section', 'Kirki_Section' ], |
|
| 41 | - [ 'Kirki\Compatibility\Values', 'Kirki_Values' ], |
|
| 42 | - [ 'Kirki\Util\Util', 'Kirki_Util' ], |
|
| 43 | - [ 'Kirki\Compatibility\Framework', 'Kirki_Toolkit' ], |
|
| 44 | - [ 'Kirki\Module\CSS', 'Kirki_Modules_CSS' ], |
|
| 45 | - [ 'Kirki\Module\CSS\Output', 'Kirki_Output' ], |
|
| 46 | - [ 'Kirki\Module\CSS\Generator', 'Kirki_Modules_CSS_Generator' ], |
|
| 47 | - [ 'Kirki\Module\CSS\Property', 'Kirki_Output_Property' ], |
|
| 48 | - [ 'Kirki\Module\CSS\Property\Font_Family', 'Kirki_Output_Property_Font_Family' ], |
|
| 49 | - [ 'Kirki\Module\Preset', 'Kirki_Modules_Preset' ], |
|
| 50 | - [ 'Kirki\Module\Tooltips', 'Kirki_Modules_Tooltips' ], |
|
| 51 | - [ 'Kirki\Module\Webfonts', 'Kirki_Modules_Webfonts' ], |
|
| 52 | - [ 'Kirki\Module\Webfonts\Google', 'Kirki_Fonts_Google' ], |
|
| 53 | - [ 'Kirki\Module\Webfonts\Fonts', 'Kirki_Fonts' ], |
|
| 54 | - [ 'Kirki\Module\Webfonts\Embed', 'Kirki_Modules_Webfonts_Embed' ], |
|
| 55 | - [ 'Kirki\Module\Webfonts\Async', 'Kirki_Modules_Webfonts_Async' ], |
|
| 56 | - [ 'Kirki\Module\Field_Dependencies', 'Kirki_Modules_Field_Dependencies' ], |
|
| 57 | - [ 'Kirki\Module\Editor_Styles', 'Kirki_Modules_Gutenberg' ], |
|
| 58 | - [ 'Kirki\Module\Selective_Refresh', 'Kirki_Modules_Selective_Refresh' ], |
|
| 59 | - [ 'Kirki\Module\Postmessage', 'Kirki_Modules_Postmessage' ], |
|
| 60 | - [ 'Kirki\Field\Background', 'Kirki_Field_Background' ], |
|
| 61 | - [ 'Kirki\Field\CSS\Background', 'Kirki_Output_Field_Background' ], |
|
| 62 | - [ 'Kirki\Field\Checkbox', 'Kirki_Field_Checkbox' ], |
|
| 63 | - [ 'Kirki\Field\Checkbox_Switch', 'Kirki_Field_Switch' ], |
|
| 64 | - [ 'Kirki\Field\Checkbox_Switch', 'Kirki\Field\Switch' ], // Preventing typo. |
|
| 65 | - [ 'Kirki\Field\Checkbox_Toggle', 'Kirki_Field_Toggle' ], |
|
| 66 | - [ 'Kirki\Field\Checkbox_Toggle', 'Kirki\Field\Toggle' ], // Preventing typo. |
|
| 67 | - [ 'Kirki\Field\Code', 'Kirki_Field_Code' ], |
|
| 68 | - [ 'Kirki\Field\Color', 'Kirki_Field_Color' ], |
|
| 69 | - [ 'Kirki\Field\Color', 'Kirki_Field_Color_Alpha' ], |
|
| 70 | - [ 'Kirki\Field\Color_Palette', 'Kirki_Field_Color_Palette' ], |
|
| 71 | - [ 'Kirki\Field\Custom', 'Kirki_Field_Custom' ], |
|
| 72 | - [ 'Kirki\Field\Dashicons', 'Kirki_Field_Dashicons' ], |
|
| 73 | - [ 'Kirki\Field\Date', 'Kirki_Field_Date' ], |
|
| 74 | - [ 'Kirki\Field\Dimension', 'Kirki_Field_Dimension' ], |
|
| 75 | - [ 'Kirki\Field\Dimensions', 'Kirki_Field_Dimensions' ], |
|
| 76 | - [ 'Kirki\Field\CSS\Dimensions', 'Kirki_Output_Field_Dimensions' ], |
|
| 77 | - [ 'Kirki\Field\Dimensions', 'Kirki_Field_Spacing' ], |
|
| 78 | - [ 'Kirki\Field\Dimensions', 'Kirki\Field\Spacing' ], |
|
| 79 | - [ 'Kirki\Field\Editor', 'Kirki_Field_Editor' ], |
|
| 80 | - [ 'Kirki\Field\FontAwesome', 'Kirki_Field_FontAwesome' ], |
|
| 81 | - [ 'Kirki\Field\Generic', 'Kirki_Field_Kirki_Generic' ], |
|
| 82 | - [ 'Kirki\Field\Generic', 'Kirki_Field_Generic' ], |
|
| 83 | - [ 'Kirki\Field\Text', 'Kirki_Field_Text' ], |
|
| 84 | - [ 'Kirki\Field\Textarea', 'Kirki_Field_Textarea' ], |
|
| 85 | - [ 'Kirki\Field\URL', 'Kirki_Field_URL' ], |
|
| 86 | - [ 'Kirki\Field\URL', 'Kirki_Field_Link' ], |
|
| 87 | - [ 'Kirki\Field\URL', 'Kirki\Field\Link' ], |
|
| 88 | - [ 'Kirki\Field\Image', 'Kirki_Field_Image' ], |
|
| 89 | - [ 'Kirki\Field\CSS\Image', 'Kirki_Output_Field_Image' ], |
|
| 90 | - [ 'Kirki\Field\Multicheck', 'Kirki_Field_Multicheck' ], |
|
| 91 | - [ 'Kirki\Field\Multicolor', 'Kirki_Field_Multicolor' ], |
|
| 92 | - [ 'Kirki\Field\CSS\Multicolor', 'Kirki_Output_Field_Multicolor' ], |
|
| 93 | - [ 'Kirki\Field\Number', 'Kirki_Field_Number' ], |
|
| 94 | - [ 'Kirki\Field\Palette', 'Kirki_Field_Palette' ], |
|
| 95 | - [ 'Kirki\Field\Repeater', 'Kirki_Field_Repeater' ], |
|
| 96 | - [ 'Kirki\Field\Dropdown_Pages', 'Kirki_Field_Dropdown_Pages' ], |
|
| 97 | - [ 'Kirki\Field\Preset', 'Kirki_Field_Preset' ], |
|
| 98 | - [ 'Kirki\Field\Select', 'Kirki_Field_Select' ], |
|
| 99 | - [ 'Kirki\Field\Slider', 'Kirki_Field_Slider' ], |
|
| 100 | - [ 'Kirki\Field\Sortable', 'Kirki_Field_Sortable' ], |
|
| 101 | - [ 'Kirki\Field\Typography', 'Kirki_Field_Typography' ], |
|
| 102 | - [ 'Kirki\Field\CSS\Typography', 'Kirki_Output_Field_Typography' ], |
|
| 103 | - [ 'Kirki\Field\Upload', 'Kirki_Field_Upload' ], |
|
| 31 | + ['Kirki\Compatibility\Kirki', 'Kirki'], |
|
| 32 | + ['Kirki\Compatibility\Config', 'Kirki_Config'], |
|
| 33 | + ['Kirki\Compatibility\Control', 'Kirki_Control'], |
|
| 34 | + ['Kirki\Compatibility\Field', 'Kirki_Field'], |
|
| 35 | + ['Kirki\Util\Helper', 'Kirki_Helper'], |
|
| 36 | + ['Kirki\Compatibility\Init', 'Kirki_Init'], |
|
| 37 | + ['Kirki\L10n', 'Kirki_L10n'], |
|
| 38 | + ['Kirki\Compatibility\Modules', 'Kirki_Modules'], |
|
| 39 | + ['Kirki\Compatibility\Sanitize_Values', 'Kirki_Sanitize_Values'], |
|
| 40 | + ['Kirki\Compatibility\Section', 'Kirki_Section'], |
|
| 41 | + ['Kirki\Compatibility\Values', 'Kirki_Values'], |
|
| 42 | + ['Kirki\Util\Util', 'Kirki_Util'], |
|
| 43 | + ['Kirki\Compatibility\Framework', 'Kirki_Toolkit'], |
|
| 44 | + ['Kirki\Module\CSS', 'Kirki_Modules_CSS'], |
|
| 45 | + ['Kirki\Module\CSS\Output', 'Kirki_Output'], |
|
| 46 | + ['Kirki\Module\CSS\Generator', 'Kirki_Modules_CSS_Generator'], |
|
| 47 | + ['Kirki\Module\CSS\Property', 'Kirki_Output_Property'], |
|
| 48 | + ['Kirki\Module\CSS\Property\Font_Family', 'Kirki_Output_Property_Font_Family'], |
|
| 49 | + ['Kirki\Module\Preset', 'Kirki_Modules_Preset'], |
|
| 50 | + ['Kirki\Module\Tooltips', 'Kirki_Modules_Tooltips'], |
|
| 51 | + ['Kirki\Module\Webfonts', 'Kirki_Modules_Webfonts'], |
|
| 52 | + ['Kirki\Module\Webfonts\Google', 'Kirki_Fonts_Google'], |
|
| 53 | + ['Kirki\Module\Webfonts\Fonts', 'Kirki_Fonts'], |
|
| 54 | + ['Kirki\Module\Webfonts\Embed', 'Kirki_Modules_Webfonts_Embed'], |
|
| 55 | + ['Kirki\Module\Webfonts\Async', 'Kirki_Modules_Webfonts_Async'], |
|
| 56 | + ['Kirki\Module\Field_Dependencies', 'Kirki_Modules_Field_Dependencies'], |
|
| 57 | + ['Kirki\Module\Editor_Styles', 'Kirki_Modules_Gutenberg'], |
|
| 58 | + ['Kirki\Module\Selective_Refresh', 'Kirki_Modules_Selective_Refresh'], |
|
| 59 | + ['Kirki\Module\Postmessage', 'Kirki_Modules_Postmessage'], |
|
| 60 | + ['Kirki\Field\Background', 'Kirki_Field_Background'], |
|
| 61 | + ['Kirki\Field\CSS\Background', 'Kirki_Output_Field_Background'], |
|
| 62 | + ['Kirki\Field\Checkbox', 'Kirki_Field_Checkbox'], |
|
| 63 | + ['Kirki\Field\Checkbox_Switch', 'Kirki_Field_Switch'], |
|
| 64 | + ['Kirki\Field\Checkbox_Switch', 'Kirki\Field\Switch'], // Preventing typo. |
|
| 65 | + ['Kirki\Field\Checkbox_Toggle', 'Kirki_Field_Toggle'], |
|
| 66 | + ['Kirki\Field\Checkbox_Toggle', 'Kirki\Field\Toggle'], // Preventing typo. |
|
| 67 | + ['Kirki\Field\Code', 'Kirki_Field_Code'], |
|
| 68 | + ['Kirki\Field\Color', 'Kirki_Field_Color'], |
|
| 69 | + ['Kirki\Field\Color', 'Kirki_Field_Color_Alpha'], |
|
| 70 | + ['Kirki\Field\Color_Palette', 'Kirki_Field_Color_Palette'], |
|
| 71 | + ['Kirki\Field\Custom', 'Kirki_Field_Custom'], |
|
| 72 | + ['Kirki\Field\Dashicons', 'Kirki_Field_Dashicons'], |
|
| 73 | + ['Kirki\Field\Date', 'Kirki_Field_Date'], |
|
| 74 | + ['Kirki\Field\Dimension', 'Kirki_Field_Dimension'], |
|
| 75 | + ['Kirki\Field\Dimensions', 'Kirki_Field_Dimensions'], |
|
| 76 | + ['Kirki\Field\CSS\Dimensions', 'Kirki_Output_Field_Dimensions'], |
|
| 77 | + ['Kirki\Field\Dimensions', 'Kirki_Field_Spacing'], |
|
| 78 | + ['Kirki\Field\Dimensions', 'Kirki\Field\Spacing'], |
|
| 79 | + ['Kirki\Field\Editor', 'Kirki_Field_Editor'], |
|
| 80 | + ['Kirki\Field\FontAwesome', 'Kirki_Field_FontAwesome'], |
|
| 81 | + ['Kirki\Field\Generic', 'Kirki_Field_Kirki_Generic'], |
|
| 82 | + ['Kirki\Field\Generic', 'Kirki_Field_Generic'], |
|
| 83 | + ['Kirki\Field\Text', 'Kirki_Field_Text'], |
|
| 84 | + ['Kirki\Field\Textarea', 'Kirki_Field_Textarea'], |
|
| 85 | + ['Kirki\Field\URL', 'Kirki_Field_URL'], |
|
| 86 | + ['Kirki\Field\URL', 'Kirki_Field_Link'], |
|
| 87 | + ['Kirki\Field\URL', 'Kirki\Field\Link'], |
|
| 88 | + ['Kirki\Field\Image', 'Kirki_Field_Image'], |
|
| 89 | + ['Kirki\Field\CSS\Image', 'Kirki_Output_Field_Image'], |
|
| 90 | + ['Kirki\Field\Multicheck', 'Kirki_Field_Multicheck'], |
|
| 91 | + ['Kirki\Field\Multicolor', 'Kirki_Field_Multicolor'], |
|
| 92 | + ['Kirki\Field\CSS\Multicolor', 'Kirki_Output_Field_Multicolor'], |
|
| 93 | + ['Kirki\Field\Number', 'Kirki_Field_Number'], |
|
| 94 | + ['Kirki\Field\Palette', 'Kirki_Field_Palette'], |
|
| 95 | + ['Kirki\Field\Repeater', 'Kirki_Field_Repeater'], |
|
| 96 | + ['Kirki\Field\Dropdown_Pages', 'Kirki_Field_Dropdown_Pages'], |
|
| 97 | + ['Kirki\Field\Preset', 'Kirki_Field_Preset'], |
|
| 98 | + ['Kirki\Field\Select', 'Kirki_Field_Select'], |
|
| 99 | + ['Kirki\Field\Slider', 'Kirki_Field_Slider'], |
|
| 100 | + ['Kirki\Field\Sortable', 'Kirki_Field_Sortable'], |
|
| 101 | + ['Kirki\Field\Typography', 'Kirki_Field_Typography'], |
|
| 102 | + ['Kirki\Field\CSS\Typography', 'Kirki_Output_Field_Typography'], |
|
| 103 | + ['Kirki\Field\Upload', 'Kirki_Field_Upload'], |
|
| 104 | 104 | ], |
| 105 | 105 | 'customizer' => [ |
| 106 | - [ 'Kirki\Control\Base', 'Kirki_Control_Base' ], |
|
| 107 | - [ 'Kirki\Control\Base', 'Kirki_Customize_Control' ], |
|
| 108 | - [ 'Kirki\Control\Checkbox', 'Kirki_Control_Checkbox' ], |
|
| 109 | - [ 'Kirki\Control\Checkbox_Switch', 'Kirki_Control_Switch' ], |
|
| 110 | - [ 'Kirki\Control\Checkbox_Toggle', 'Kirki_Control_Toggle' ], |
|
| 111 | - [ 'WP_Customize_Code_Editor_Control', 'Kirki_Control_Code' ], |
|
| 112 | - [ 'Kirki\Control\Color', 'Kirki_Control_Color' ], |
|
| 113 | - [ 'Kirki\Control\Color_Palette', 'Kirki_Control_Color_Palette' ], |
|
| 114 | - [ 'WP_Customize_Cropped_Image_Control', 'Kirki_Control_Cropped_Image' ], |
|
| 115 | - [ 'Kirki\Control\Custom', 'Kirki_Control_Custom' ], |
|
| 116 | - [ 'Kirki\Control\Dashicons', 'Kirki_Control_Dashicons' ], |
|
| 117 | - [ 'Kirki\Control\Date', 'Kirki_Control_Date' ], |
|
| 118 | - [ 'Kirki\Control\Dimension', 'Kirki_Control_Dimension' ], |
|
| 119 | - [ 'Kirki\Control\Editor', 'Kirki_Control_Editor' ], |
|
| 120 | - [ 'Kirki\Control\Generic', 'Kirki_Control_Generic' ], |
|
| 121 | - [ 'Kirki\Control\Image', 'Kirki_Control_Image' ], |
|
| 122 | - [ 'Kirki\Control\Multicheck', 'Kirki_Control_Multicheck' ], |
|
| 123 | - [ 'Kirki\Control\Generic', 'Kirki_Control_Number' ], |
|
| 124 | - [ 'Kirki\Control\Palette', 'Kirki_Control_Palette' ], |
|
| 125 | - [ 'Kirki\Control\Radio', 'Kirki_Control_Radio' ], |
|
| 126 | - [ 'Kirki\Control\Radio_Buttonset', 'Kirki_Control_Radio_Buttonset' ], |
|
| 127 | - [ 'Kirki\Control\Radio_Image', 'Kirki_Control_Radio_Image' ], |
|
| 128 | - [ 'Kirki\Control\Radio_Image', 'Kirki_Controls_Radio_Image_Control' ], |
|
| 129 | - [ 'Kirki\Control\Repeater', 'Kirki_Control_Repeater' ], |
|
| 130 | - [ 'Kirki\Control\Select', 'Kirki_Control_Select' ], |
|
| 131 | - [ 'Kirki\Control\Slider', 'Kirki_Control_Slider' ], |
|
| 132 | - [ 'Kirki\Control\Sortable', 'Kirki_Control_Sortable' ], |
|
| 133 | - [ 'Kirki\Control\Upload', 'Kirki_Control_Upload' ], |
|
| 134 | - [ 'Kirki\Settings\Repeater', 'Kirki\Settings\Repeater_Setting' ], |
|
| 135 | - [ 'Kirki\Settings\Repeater', 'Kirki_Settings_Repeater_Setting' ], |
|
| 136 | - [ 'WP_Customize_Section', 'Kirki_Sections_Default_Section' ], |
|
| 137 | - [ 'Kirki\Section_Types\Expanded', 'Kirki_Sections_Expanded_Section' ], |
|
| 138 | - [ 'Kirki\Section_Types\Nested', 'Kirki_Sections_Nested_Section' ], |
|
| 139 | - [ 'Kirki\Section_Types\Link', 'Kirki_Sections_Link_Section' ], |
|
| 140 | - [ 'Kirki\Panel_Types\Nested', 'Kirki_Panels_Nested_Panel' ], |
|
| 106 | + ['Kirki\Control\Base', 'Kirki_Control_Base'], |
|
| 107 | + ['Kirki\Control\Base', 'Kirki_Customize_Control'], |
|
| 108 | + ['Kirki\Control\Checkbox', 'Kirki_Control_Checkbox'], |
|
| 109 | + ['Kirki\Control\Checkbox_Switch', 'Kirki_Control_Switch'], |
|
| 110 | + ['Kirki\Control\Checkbox_Toggle', 'Kirki_Control_Toggle'], |
|
| 111 | + ['WP_Customize_Code_Editor_Control', 'Kirki_Control_Code'], |
|
| 112 | + ['Kirki\Control\Color', 'Kirki_Control_Color'], |
|
| 113 | + ['Kirki\Control\Color_Palette', 'Kirki_Control_Color_Palette'], |
|
| 114 | + ['WP_Customize_Cropped_Image_Control', 'Kirki_Control_Cropped_Image'], |
|
| 115 | + ['Kirki\Control\Custom', 'Kirki_Control_Custom'], |
|
| 116 | + ['Kirki\Control\Dashicons', 'Kirki_Control_Dashicons'], |
|
| 117 | + ['Kirki\Control\Date', 'Kirki_Control_Date'], |
|
| 118 | + ['Kirki\Control\Dimension', 'Kirki_Control_Dimension'], |
|
| 119 | + ['Kirki\Control\Editor', 'Kirki_Control_Editor'], |
|
| 120 | + ['Kirki\Control\Generic', 'Kirki_Control_Generic'], |
|
| 121 | + ['Kirki\Control\Image', 'Kirki_Control_Image'], |
|
| 122 | + ['Kirki\Control\Multicheck', 'Kirki_Control_Multicheck'], |
|
| 123 | + ['Kirki\Control\Generic', 'Kirki_Control_Number'], |
|
| 124 | + ['Kirki\Control\Palette', 'Kirki_Control_Palette'], |
|
| 125 | + ['Kirki\Control\Radio', 'Kirki_Control_Radio'], |
|
| 126 | + ['Kirki\Control\Radio_Buttonset', 'Kirki_Control_Radio_Buttonset'], |
|
| 127 | + ['Kirki\Control\Radio_Image', 'Kirki_Control_Radio_Image'], |
|
| 128 | + ['Kirki\Control\Radio_Image', 'Kirki_Controls_Radio_Image_Control'], |
|
| 129 | + ['Kirki\Control\Repeater', 'Kirki_Control_Repeater'], |
|
| 130 | + ['Kirki\Control\Select', 'Kirki_Control_Select'], |
|
| 131 | + ['Kirki\Control\Slider', 'Kirki_Control_Slider'], |
|
| 132 | + ['Kirki\Control\Sortable', 'Kirki_Control_Sortable'], |
|
| 133 | + ['Kirki\Control\Upload', 'Kirki_Control_Upload'], |
|
| 134 | + ['Kirki\Settings\Repeater', 'Kirki\Settings\Repeater_Setting'], |
|
| 135 | + ['Kirki\Settings\Repeater', 'Kirki_Settings_Repeater_Setting'], |
|
| 136 | + ['WP_Customize_Section', 'Kirki_Sections_Default_Section'], |
|
| 137 | + ['Kirki\Section_Types\Expanded', 'Kirki_Sections_Expanded_Section'], |
|
| 138 | + ['Kirki\Section_Types\Nested', 'Kirki_Sections_Nested_Section'], |
|
| 139 | + ['Kirki\Section_Types\Link', 'Kirki_Sections_Link_Section'], |
|
| 140 | + ['Kirki\Panel_Types\Nested', 'Kirki_Panels_Nested_Panel'], |
|
| 141 | 141 | ], |
| 142 | 142 | ]; |
| 143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function __construct() { |
| 151 | 151 | $this->add_aliases(); |
| 152 | - add_action( 'customize_register', [ $this, 'add_customizer_aliases' ] ); |
|
| 152 | + add_action('customize_register', [$this, 'add_customizer_aliases']); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | * @return void |
| 161 | 161 | */ |
| 162 | 162 | public function add_aliases() { |
| 163 | - foreach ( $this->aliases['generic'] as $item ) { |
|
| 164 | - if ( class_exists( $item[0] ) ) { |
|
| 165 | - class_alias( $item[0], $item[1] ); |
|
| 163 | + foreach ($this->aliases['generic'] as $item) { |
|
| 164 | + if (class_exists($item[0])) { |
|
| 165 | + class_alias($item[0], $item[1]); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | * @return void |
| 176 | 176 | */ |
| 177 | 177 | public function add_customizer_aliases() { |
| 178 | - foreach ( $this->aliases['customizer'] as $item ) { |
|
| 179 | - if ( class_exists( $item[0] ) ) { |
|
| 180 | - class_alias( $item[0], $item[1] ); |
|
| 178 | + foreach ($this->aliases['customizer'] as $item) { |
|
| 179 | + if (class_exists($item[0])) { |
|
| 180 | + class_alias($item[0], $item[1]); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } |