This commit is contained in:
Alexander Agnarson 2019-02-17 14:28:35 +01:00
parent b14ccb1b03
commit 7e3774b663
168 changed files with 2453 additions and 2788 deletions

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -34,8 +34,16 @@ class Kirki_Helper {
return array_replace_recursive( $array, $array1 );
}
// Handle the arguments, merge one by one.
$args = func_get_args();
/**
* Handle the arguments, merge one by one.
*
* In PHP 7 func_get_args() changed the way it behaves but this doesn't mean anything in this case
* sinc ethis method is only used when the array_replace_recursive() function doesn't exist
* and that was introduced in PHP v5.3.
*
* Once WordPress-Core raises its minimum requirements we''' be able to remove this fallback completely.
*/
$args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue
$array = $args[0];
if ( ! is_array( $array ) ) {
return $array;
@ -121,7 +129,7 @@ class Kirki_Helper {
global $wp_filesystem;
if ( empty( $wp_filesystem ) ) {
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
WP_Filesystem( $credentials );
}
@ -247,7 +255,8 @@ class Kirki_Helper {
$post_types = get_post_types(
array(
'public' => true,
), 'objects'
),
'objects'
);
// Build the array.
@ -411,7 +420,7 @@ class Kirki_Helper {
return $value1 !== $value2;
}
if ( ( '!=' === $operator || 'not equal' === $operator ) ) {
return $value1 != $value2; // WPCS: loose comparison ok.
return $value1 != $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
}
if ( ( '>=' === $operator || 'greater or equal' === $operator || 'equal or greater' === $operator ) ) {
return $value2 >= $value1;
@ -428,20 +437,20 @@ class Kirki_Helper {
if ( 'contains' === $operator || 'in' === $operator ) {
if ( is_array( $value1 ) && is_array( $value2 ) ) {
foreach ( $value2 as $val ) {
if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray
return true;
}
}
return false;
}
if ( is_array( $value1 ) && ! is_array( $value2 ) ) {
return in_array( $value2, $value1 ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return in_array( $value2, $value1 ); // phpcs:ignore WordPress.PHP.StrictInArray
}
if ( is_array( $value2 ) && ! is_array( $value1 ) ) {
return in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray
}
return ( false !== strrpos( $value1, $value2 ) || false !== strpos( $value2, $value1 ) );
}
return $value1 == $value2; // WPCS: loose comparison ok.
return $value1 == $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
}
}

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -147,7 +147,8 @@ class Kirki_Init {
}
$skip_control_types = apply_filters(
'kirki_control_types_exclude', array(
'kirki_control_types_exclude',
array(
'Kirki_Control_Repeater',
'WP_Customize_Control',
)

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -110,7 +110,7 @@ class Kirki_L10n {
public function override_load_textdomain( $override, $domain, $mofile ) {
global $l10n;
if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) {
$l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
}
// Check if the domain is "kirki".

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.0
*/
@ -56,7 +56,8 @@ class Kirki_Modules {
*/
public function setup_default_modules() {
self::$modules = apply_filters(
'kirki_modules', array(
'kirki_modules',
array(
'css' => 'Kirki_Modules_CSS',
'css-vars' => 'Kirki_Modules_CSS_Vars',
'customizer-styling' => 'Kirki_Modules_Customizer_Styling',
@ -72,6 +73,7 @@ class Kirki_Modules {
'webfont-loader' => 'Kirki_Modules_Webfont_Loader',
'preset' => 'Kirki_Modules_Preset',
'gutenberg' => 'Kirki_Modules_Gutenberg',
'telemetry' => 'Kirki_Modules_Telemetry',
)
);
}

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -5,8 +5,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
@ -110,7 +110,9 @@ class Kirki_Settings {
$this->wp_customize->add_setting(
new $classname(
$this->wp_customize, $setting, array(
$this->wp_customize,
$setting,
array(
'default' => $default,
'type' => $type,
'capability' => $capability,
@ -132,7 +134,8 @@ class Kirki_Settings {
// Apply the kirki_setting_types filter.
$this->setting_types = apply_filters(
'kirki_setting_types', array(
'kirki_setting_types',
array(
'default' => 'WP_Customize_Setting',
'repeater' => 'Kirki_Settings_Repeater_Setting',
'user_meta' => 'Kirki_Setting_User_Meta',

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -4,8 +4,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.9
*/
@ -36,7 +36,7 @@ class Kirki_Util {
public static function is_plugin() {
$is_plugin = false;
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
require_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
}
// Get all plugins.
@ -55,7 +55,7 @@ class Kirki_Util {
}
// Make sure the is_plugins_loaded function is loaded.
include_once ABSPATH . 'wp-admin/includes/plugin.php';
include_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
// Extra logic in case the plugin is installed but not activated.
if ( $_plugin && is_plugin_inactive( $_plugin ) ) {

View file

@ -7,8 +7,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -6,8 +6,8 @@
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/

View file

@ -1,39 +0,0 @@
<?php
/**
* Generates & echo the styles when using the AJAx method.
*
* @package Kirki
* @category Core
* @author Aristeides Stathopoulos
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @license https://opensource.org/licenses/MIT
*/
// Do not allow directly accessing this file.
if ( ! class_exists( 'Kirki' ) ) {
die( 'File can\'t be accessed directly' );
}
// Make sure we set the correct MIME type.
header( 'Content-Type: text/css' );
// Echo the styles.
$configs = Kirki::$config;
foreach ( $configs as $config_id => $args ) {
if ( true === $args['disable_output'] ) {
continue;
}
$styles = Kirki_Modules_CSS::loop_controls( $config_id );
$styles = apply_filters( "kirki_{$config_id}_dynamic_css", $styles );
// Some people put weird stuff in their CSS, KSES tends to be greedy.
$styles = str_replace( '<=', '&lt;=', $styles );
$styles = wp_kses_post( $styles );
// Why both KSES and strip_tags? Because we just added some '>'.
// kses replaces lone '>' with &gt;.
// @codingStandardsIgnoreLine WordPress.WP.AlternativeFunctions.strip_tags_strip_tags WordPress.Security.EscapeOutput.OutputNotEscaped
echo strip_tags( str_replace( '&gt;', '>', $styles ) );
}