@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Try to automatically generate the script necessary for postMessage to work. |
|
| 4 | - * for documentation see https://github.com/aristath/kirki/wiki/required |
|
| 5 | - * |
|
| 6 | - * @package Kirki |
|
| 7 | - * @category Core |
|
| 8 | - * @author Aristeides Stathopoulos |
|
| 9 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 10 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | - * @since 1.0 |
|
| 12 | - */ |
|
| 3 | + * Try to automatically generate the script necessary for postMessage to work. |
|
| 4 | + * for documentation see https://github.com/aristath/kirki/wiki/required |
|
| 5 | + * |
|
| 6 | + * @package Kirki |
|
| 7 | + * @category Core |
|
| 8 | + * @author Aristeides Stathopoulos |
|
| 9 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 10 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | + * @since 1.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | * then use the 'output' argument to auto-generate the js_vars |
| 54 | 54 | */ |
| 55 | 55 | $config_id = ( isset( $args['kirki_config'] ) ) ? $args['kirki_config'] : 'global'; |
| 56 | - if ( isset( Kirki::$config[ $config_id ]['postMessage'] ) && 'auto' == Kirki::$config[ $config_id ]['postMessage'] ) { |
|
| 56 | + if ( isset( Kirki::$config[$config_id]['postMessage'] ) && 'auto' == Kirki::$config[$config_id]['postMessage'] ) { |
|
| 57 | 57 | if ( ! isset( $args['js_vars'] ) || empty( $args['js_vars'] ) ) { |
| 58 | 58 | if ( isset( $args['output'] ) ) { |
| 59 | 59 | $args['js_vars'] = $args['output']; |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Injects tooltips to controls when the 'tooltip' argument is used. |
|
| 4 | - * |
|
| 5 | - * @package Kirki |
|
| 6 | - * @category Core |
|
| 7 | - * @author Aristeides Stathopoulos |
|
| 8 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 9 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | - * @since 1.0 |
|
| 11 | - */ |
|
| 3 | + * Injects tooltips to controls when the 'tooltip' argument is used. |
|
| 4 | + * |
|
| 5 | + * @package Kirki |
|
| 6 | + * @category Core |
|
| 7 | + * @author Aristeides Stathopoulos |
|
| 8 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 9 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | + * @since 1.0 |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | |
| 22 | 22 | $previous_path = ''; |
| 23 | 23 | for ( $i = 0; $i < $levels; $i++ ) { |
| 24 | - $paths[] = $path . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
| 25 | - $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
|
| 24 | + $paths[] = $path . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename; |
|
| 25 | + $previous_path .= strtolower( $exploded[$i] ) . '/'; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | foreach ( $paths as $path ) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $google_fonts = array(); |
| 96 | 96 | if ( is_array( $fonts ) ) { |
| 97 | 97 | foreach ( $fonts['items'] as $font ) { |
| 98 | - $google_fonts[ $font['family'] ] = array( |
|
| 98 | + $google_fonts[$font['family']] = array( |
|
| 99 | 99 | 'label' => $font['family'], |
| 100 | 100 | 'variants' => $font['variants'], |
| 101 | 101 | 'subsets' => $font['subsets'], |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $fonts = self::get_all_fonts(); |
| 147 | 147 | $fonts_array = array(); |
| 148 | 148 | foreach ( $fonts as $key => $args ) { |
| 149 | - $fonts_array[ $key ] = $key; |
|
| 149 | + $fonts_array[$key] = $key; |
|
| 150 | 150 | } |
| 151 | 151 | return $fonts_array; |
| 152 | 152 | } |
@@ -156,6 +156,9 @@ |
||
| 156 | 156 | ); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | + /** |
|
| 160 | + * @param string $fontname |
|
| 161 | + */ |
|
| 159 | 162 | public static function is_google_font( $fontname ) { |
| 160 | 163 | if ( array_key_exists( $fontname, self::$google_fonts ) ) { |
| 161 | 164 | return true; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $defaults = isset( $args['default'] ) ? $args['default'] : array(); |
| 18 | 18 | $sanitize_callback = $args['sanitize_callback']; |
| 19 | 19 | foreach ( $settings as $setting_key => $setting_value ) { |
| 20 | - $default = ( isset( $defaults[ $setting_key ] ) ) ? $defaults[ $setting_key ] : ''; |
|
| 20 | + $default = ( isset( $defaults[$setting_key] ) ) ? $defaults[$setting_key] : ''; |
|
| 21 | 21 | $transport = isset( $args['transport'] ) ? $args['transport'] : 'refresh'; |
| 22 | 22 | |
| 23 | 23 | $this->wp_customize->add_setting( $setting_value, array( |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | if ( isset( $args['type'] ) && array_key_exists( $args['type'], Kirki_Control::$setting_types ) ) { |
| 34 | 34 | // We must instantiate a custom class for the setting |
| 35 | - $setting_classname = Kirki_Control::$setting_types[ $args['type'] ]; |
|
| 35 | + $setting_classname = Kirki_Control::$setting_types[$args['type']]; |
|
| 36 | 36 | $this->wp_customize->add_setting( new $setting_classname( $this->wp_customize, $args['settings'], array( |
| 37 | 37 | 'default' => isset( $args['default'] ) ? $args['default'] : '', |
| 38 | 38 | 'type' => $args['option_type'], |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Color Calculations class for Kirki |
|
| 4 | - * Initially built for the Shoestrap-3 theme and then tweaked for Kirki. |
|
| 5 | - * |
|
| 6 | - * @package Kirki |
|
| 7 | - * @category Core |
|
| 8 | - * @author Aristeides Stathopoulos |
|
| 9 | - * @copyright Copyright (c) 2015, Aristeides Stathopoulos |
|
| 10 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | - * @since 1.0 |
|
| 12 | - */ |
|
| 3 | + * Color Calculations class for Kirki |
|
| 4 | + * Initially built for the Shoestrap-3 theme and then tweaked for Kirki. |
|
| 5 | + * |
|
| 6 | + * @package Kirki |
|
| 7 | + * @category Core |
|
| 8 | + * @author Aristeides Stathopoulos |
|
| 9 | + * @copyright Copyright (c) 2015, Aristeides Stathopoulos |
|
| 10 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | + * @since 1.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | // get an md5 for this color |
| 78 | 78 | $color_md5 = ( is_array( $color ) ) ? md5( json_encode( $color ) . $mode ) : md5( $color . $mode ); |
| 79 | 79 | // Set the instance if it does not already exist. |
| 80 | - if ( ! isset( self::$instances[ $color_md5 ] ) ) { |
|
| 81 | - self::$instances[ $color_md5 ] = new self( $color, $mode ); |
|
| 80 | + if ( ! isset( self::$instances[$color_md5] ) ) { |
|
| 81 | + self::$instances[$color_md5] = new self( $color, $mode ); |
|
| 82 | 82 | } |
| 83 | - return self::$instances[ $color_md5 ]; |
|
| 83 | + return self::$instances[$color_md5]; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | 'opacity' => 'alpha', |
| 173 | 173 | ); |
| 174 | 174 | $found = false; |
| 175 | - foreach( $finders_keepers as $finder => $keeper ) { |
|
| 176 | - if ( isset( $color[ $finder ] ) ) { |
|
| 175 | + foreach ( $finders_keepers as $finder => $keeper ) { |
|
| 176 | + if ( isset( $color[$finder] ) ) { |
|
| 177 | 177 | $found = true; |
| 178 | - $this->$keeper = $color[ $finder ]; |
|
| 178 | + $this->$keeper = $color[$finder]; |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | // We failed, return null. |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | // Perhaps we're using a word like "orange"? |
| 205 | 205 | $wordcolors = $this->get_word_colors(); |
| 206 | 206 | if ( array_key_exists( $color, $wordcolors ) ) { |
| 207 | - $this->color = '#' . $wordcolors[ $color ]; |
|
| 207 | + $this->color = '#' . $wordcolors[$color]; |
|
| 208 | 208 | return 'hex'; |
| 209 | 209 | } |
| 210 | 210 | // fallback to hex. |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // Is this perhaps a word-color? |
| 225 | 225 | $word_colors = $this->get_word_colors(); |
| 226 | 226 | if ( array_key_exists( $this->color, $word_colors ) ) { |
| 227 | - $this->color = '#' . $word_colors[ $this->color ]; |
|
| 227 | + $this->color = '#' . $word_colors[$this->color]; |
|
| 228 | 228 | } |
| 229 | 229 | // Sanitize color |
| 230 | 230 | $this->hex = sanitize_hex_color( maybe_hash_hex_color( $this->color ) ); |
@@ -356,9 +356,9 @@ discard block |
||
| 356 | 356 | * @see https://gist.github.com/brandonheyer/5254516 |
| 357 | 357 | */ |
| 358 | 358 | public function from_hsl_array() { |
| 359 | - $h = $this->hue /360; |
|
| 359 | + $h = $this->hue / 360; |
|
| 360 | 360 | $s = $this->saturation / 100; |
| 361 | - $l = $this->lightness /100; |
|
| 361 | + $l = $this->lightness / 100; |
|
| 362 | 362 | |
| 363 | 363 | $r = $l; |
| 364 | 364 | $g = $l; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * brightness |
| 94 | 94 | * @param $value int|float|string the new value |
| 95 | 95 | * |
| 96 | - * @return object|null |
|
| 96 | + * @return ariColor|null |
|
| 97 | 97 | */ |
| 98 | 98 | public function getNew( $property = '', $value = '' ) { |
| 99 | 99 | // Check if we're changing any of the rgba values |
@@ -129,6 +129,7 @@ discard block |
||
| 129 | 129 | * Figure out what mode we're using. |
| 130 | 130 | * |
| 131 | 131 | * @param string|array |
| 132 | + * @param string $color |
|
| 132 | 133 | * |
| 133 | 134 | * @return string |
| 134 | 135 | */ |
@@ -205,6 +205,9 @@ |
||
| 205 | 205 | return $raw_value . $unit_used; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | + /** |
|
| 209 | + * @param string $value |
|
| 210 | + */ |
|
| 208 | 211 | public static function filter_number( $value ) { |
| 209 | 212 | return filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
| 210 | 213 | } |
@@ -189,7 +189,7 @@ |
||
| 189 | 189 | return 'auto'; |
| 190 | 190 | } |
| 191 | 191 | // Return empty if there are no numbers in the value. |
| 192 | - if ( ! preg_match( '#[0-9]#' , $value ) ) { |
|
| 192 | + if ( ! preg_match( '#[0-9]#', $value ) ) { |
|
| 193 | 193 | return ''; |
| 194 | 194 | } |
| 195 | 195 | // The raw value without the units |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | '800' => esc_attr__( 'Extra-Bold 800', 'kirki' ), |
| 131 | 131 | '800italic' => esc_attr__( 'Extra-Bold 800 Italic', 'kirki' ), |
| 132 | 132 | '600italic' => esc_attr__( 'Semi-Bold 600 Italic', 'kirki' ), |
| 133 | - '200italic' => esc_attr__( 'Light 200 Italic', 'kirki' ), ); |
|
| 133 | + '200italic' => esc_attr__( 'Light 200 Italic', 'kirki' ),); |
|
| 134 | 134 | |
| 135 | 135 | $config = apply_filters( 'kirki/config', array() ); |
| 136 | 136 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public static function clean_file_path( $path ) { |
| 173 | 173 | $path = str_replace( '', '', str_replace( array( "\\", "\\\\" ), '/', $path ) ); |
| 174 | - if ( '/' === $path[ strlen( $path ) - 1 ] ) { |
|
| 174 | + if ( '/' === $path[strlen( $path ) - 1] ) { |
|
| 175 | 175 | $path = rtrim( $path, '/' ); |
| 176 | 176 | } |
| 177 | 177 | return $path; |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Plugin Name: Kirki Toolkit |
|
| 4 | - * Plugin URI: http://kirki.org |
|
| 5 | - * Description: The ultimate WordPress Customizer Toolkit |
|
| 6 | - * Author: Aristeides Stathopoulos |
|
| 7 | - * Author URI: http://aristeides.com |
|
| 8 | - * Version: 2.2.0.beta.1 |
|
| 9 | - * Text Domain: kirki |
|
| 10 | - * |
|
| 11 | - * GitHub Plugin URI: aristath/kirki |
|
| 12 | - * GitHub Plugin URI: https://github.com/aristath/kirki |
|
| 13 | - * |
|
| 14 | - * |
|
| 15 | - * @package Kirki |
|
| 16 | - * @category Core |
|
| 17 | - * @author Aristeides Stathopoulos |
|
| 18 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 19 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 20 | - * @since 1.0 |
|
| 21 | - */ |
|
| 3 | + * Plugin Name: Kirki Toolkit |
|
| 4 | + * Plugin URI: http://kirki.org |
|
| 5 | + * Description: The ultimate WordPress Customizer Toolkit |
|
| 6 | + * Author: Aristeides Stathopoulos |
|
| 7 | + * Author URI: http://aristeides.com |
|
| 8 | + * Version: 2.2.0.beta.1 |
|
| 9 | + * Text Domain: kirki |
|
| 10 | + * |
|
| 11 | + * GitHub Plugin URI: aristath/kirki |
|
| 12 | + * GitHub Plugin URI: https://github.com/aristath/kirki |
|
| 13 | + * |
|
| 14 | + * |
|
| 15 | + * @package Kirki |
|
| 16 | + * @category Core |
|
| 17 | + * @author Aristeides Stathopoulos |
|
| 18 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 19 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 20 | + * @since 1.0 |
|
| 21 | + */ |
|
| 22 | 22 | |
| 23 | 23 | // Exit if accessed directly |
| 24 | 24 | if ( ! defined( 'ABSPATH' ) ) { |