@@ -172,9 +172,9 @@ |
||
172 | 172 | * If no callback is defined (false) then just get the value. |
173 | 173 | */ |
174 | 174 | if ( $variable_callback ) { |
175 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
175 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
176 | 176 | } else { |
177 | - $variables[ $variable_name ] = Kirki::get_option( $field['settings'] ); |
|
177 | + $variables[$variable_name] = Kirki::get_option( $field['settings'] ); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Additional sanitization methods for controls. |
|
4 | - * These are used in the field's 'sanitize_callback' argument. |
|
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 | + * Additional sanitization methods for controls. |
|
4 | + * These are used in the field's 'sanitize_callback' argument. |
|
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' ) ) { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * sortable Customizer Control. |
|
4 | - * |
|
5 | - * @package Kirki |
|
6 | - * @subpackage Controls |
|
7 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.0 |
|
10 | - */ |
|
3 | + * sortable Customizer Control. |
|
4 | + * |
|
5 | + * @package Kirki |
|
6 | + * @subpackage Controls |
|
7 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | if ( is_array( $values ) && ! empty( $values ) ) { |
56 | 56 | foreach ( $values as $key => $value ) { |
57 | 57 | if ( array_key_exists( $value, $this->choices ) ) { |
58 | - $filtered_values[ $key ] = $value; |
|
58 | + $filtered_values[$key] = $value; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -113,14 +113,14 @@ |
||
113 | 113 | $available_variants = array(); |
114 | 114 | foreach ( $variants as $variant ) { |
115 | 115 | if ( array_key_exists( $variant, $all_variants ) ) { |
116 | - $available_variants[] = array( 'id' => $variant, 'label' => $all_variants[ $variant ] ); |
|
116 | + $available_variants[] = array( 'id' => $variant, 'label' => $all_variants[$variant] ); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | 120 | $available_subsets = array(); |
121 | 121 | foreach ( $subsets as $subset ) { |
122 | 122 | if ( array_key_exists( $subset, $all_subsets ) ) { |
123 | - $available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[ $subset ] ); |
|
123 | + $available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[$subset] ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 |
@@ -98,7 +98,7 @@ |
||
98 | 98 | * |
99 | 99 | * @param string The rgba color formatted like rgba(r,g,b,a) |
100 | 100 | * |
101 | - * @return int|float The alpha value of the color. |
|
101 | + * @return integer The alpha value of the color. |
|
102 | 102 | */ |
103 | 103 | public static function get_alpha_from_rgba( $color ) { |
104 | 104 | $obj = kirki_wp_color( $color ); |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * fallback to 'global' if $config_id is not found |
34 | 34 | */ |
35 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
35 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
36 | 36 | $config_id = 'global'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( 'theme_mod' == Kirki::$config[ $config_id ]['option_type'] ) { |
|
39 | + if ( 'theme_mod' == Kirki::$config[$config_id]['option_type'] ) { |
|
40 | 40 | /** |
41 | 41 | * We're using theme_mods. |
42 | 42 | * so just get the value using get_theme_mod |
43 | 43 | */ |
44 | 44 | $default_value = null; |
45 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
46 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
45 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
46 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
47 | 47 | } |
48 | 48 | $value = get_theme_mod( $field_id, $default_value ); |
49 | 49 | |
@@ -51,51 +51,51 @@ discard block |
||
51 | 51 | * If the field is a background field, then get the sub-fields |
52 | 52 | * and return an array of the values. |
53 | 53 | */ |
54 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) && 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
54 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) && 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
55 | 55 | $value = array(); |
56 | 56 | if ( null == $default_value ) { |
57 | 57 | $default_value = array(); |
58 | 58 | } |
59 | 59 | foreach ( $default_value as $property_key => $property_default ) { |
60 | - $value[ $property_key ] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
60 | + $value[$property_key] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - } elseif ( 'option' == Kirki::$config[ $config_id ]['option_type'] ) { |
|
64 | + } elseif ( 'option' == Kirki::$config[$config_id]['option_type'] ) { |
|
65 | 65 | /** |
66 | 66 | * We're using options. |
67 | 67 | */ |
68 | - if ( '' != Kirki::$config[ $config_id ]['option_name'] ) { |
|
68 | + if ( '' != Kirki::$config[$config_id]['option_name'] ) { |
|
69 | 69 | /** |
70 | 70 | * Options are serialized as a single option in the db. |
71 | 71 | * We'll have to get the option and then get the item from the array. |
72 | 72 | */ |
73 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
73 | + $options = get_option( Kirki::$config[$config_id]['option_name'] ); |
|
74 | 74 | |
75 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
76 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
75 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
76 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
77 | 77 | } |
78 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
78 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * If this is a background field, get the individual sub-fields and return an array. |
82 | 82 | */ |
83 | - if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
83 | + if ( 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
84 | 84 | $value = array(); |
85 | 85 | |
86 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property => $property_default ) { |
|
86 | + foreach ( Kirki::$fields[$field_id]['default'] as $property => $property_default ) { |
|
87 | 87 | |
88 | - if ( isset( $options[ $setting_modified . '_' . $property ] ) ) { |
|
89 | - $value[ $property ] = $options[ $setting_modified . '_' . $property ]; |
|
88 | + if ( isset( $options[$setting_modified . '_' . $property] ) ) { |
|
89 | + $value[$property] = $options[$setting_modified . '_' . $property]; |
|
90 | 90 | } else { |
91 | - $value[ $property ] = $property_default; |
|
91 | + $value[$property] = $property_default; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } else { |
95 | 95 | /** |
96 | 96 | * This is not a background field so continue and get the value. |
97 | 97 | */ |
98 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : Kirki::$fields[ $field_id ]['default']; |
|
98 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : Kirki::$fields[$field_id]['default']; |
|
99 | 99 | $value = maybe_unserialize( $value ); |
100 | 100 | } |
101 | 101 | |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Each option separately saved in the db |
105 | 105 | */ |
106 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
106 | + $value = get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * If the field is a background field, then get the sub-fields |
110 | 110 | * and return an array of the values. |
111 | 111 | */ |
112 | - if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
112 | + if ( 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
113 | 113 | $value = array(); |
114 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property_key => $property_default ) { |
|
115 | - $value[ $property_key ] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
114 | + foreach ( Kirki::$fields[$field_id]['default'] as $property_key => $property_default ) { |
|
115 | + $value[$property_key] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | if ( isset( $field['option_name'] ) && '' != $field['option_name'] ) { |
141 | 141 | $all_values = get_option( $field['option_name'], array() ); |
142 | 142 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
143 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
144 | - $value = $all_values[ $sub_setting_id ]; |
|
143 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
144 | + $value = $all_values[$sub_setting_id]; |
|
145 | 145 | } |
146 | 146 | } else { |
147 | 147 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $google_fonts = array(); |
101 | 101 | if ( is_array( $fonts ) ) { |
102 | 102 | foreach ( $fonts['items'] as $font ) { |
103 | - $google_fonts[ $font['family'] ] = array( |
|
103 | + $google_fonts[$font['family']] = array( |
|
104 | 104 | 'label' => $font['family'], |
105 | 105 | 'variants' => $font['variants'], |
106 | 106 | 'subsets' => $font['subsets'], |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $fonts = self::get_all_fonts(); |
176 | 176 | $fonts_array = array(); |
177 | 177 | foreach ( $fonts as $key => $args ) { |
178 | - $fonts_array[ $key ] = $key; |
|
178 | + $fonts_array[$key] = $key; |
|
179 | 179 | } |
180 | 180 | return $fonts_array; |
181 | 181 | } |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | // get an md5 for this color |
83 | 83 | $color_md5 = ( is_array( $color ) ) ? md5( json_encode( $color ) . $mode ) : md5( $color . $mode ); |
84 | 84 | // Set the instance if it does not already exist. |
85 | - if ( ! isset( self::$instances[ $color_md5 ] ) ) { |
|
86 | - self::$instances[ $color_md5 ] = new self( $color, $mode ); |
|
85 | + if ( ! isset( self::$instances[$color_md5] ) ) { |
|
86 | + self::$instances[$color_md5] = new self( $color, $mode ); |
|
87 | 87 | } |
88 | - return self::$instances[ $color_md5 ]; |
|
88 | + return self::$instances[$color_md5]; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | ); |
187 | 187 | $found = false; |
188 | 188 | foreach ( $finders_keepers as $finder => $keeper ) { |
189 | - if ( isset( $color[ $finder ] ) ) { |
|
189 | + if ( isset( $color[$finder] ) ) { |
|
190 | 190 | $found = true; |
191 | - $this->$keeper = $color[ $finder ]; |
|
191 | + $this->$keeper = $color[$finder]; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | // We failed, return null. |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | // Perhaps we're using a word like "orange"? |
218 | 218 | $wordcolors = $this->get_word_colors(); |
219 | 219 | if ( array_key_exists( $color, $wordcolors ) ) { |
220 | - $this->color = '#' . $wordcolors[ $color ]; |
|
220 | + $this->color = '#' . $wordcolors[$color]; |
|
221 | 221 | return 'hex'; |
222 | 222 | } |
223 | 223 | // fallback to hex. |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // Is this perhaps a word-color? |
238 | 238 | $word_colors = $this->get_word_colors(); |
239 | 239 | if ( array_key_exists( $this->color, $word_colors ) ) { |
240 | - $this->color = '#' . $word_colors[ $this->color ]; |
|
240 | + $this->color = '#' . $word_colors[$this->color]; |
|
241 | 241 | } |
242 | 242 | // Sanitize color |
243 | 243 | $this->hex = sanitize_hex_color( maybe_hash_hex_color( $this->color ) ); |
@@ -31,9 +31,9 @@ |
||
31 | 31 | |
32 | 32 | $i = 0; |
33 | 33 | foreach ( $palettes as $palette ) { |
34 | - $palettes[ $i ] = array(); |
|
34 | + $palettes[$i] = array(); |
|
35 | 35 | foreach ( $palette as $key => $value ) { |
36 | - $palettes[ $i ][ $key ] = Kirki_Color::sanitize_hex( $value ); |
|
36 | + $palettes[$i][$key] = Kirki_Color::sanitize_hex( $value ); |
|
37 | 37 | } |
38 | 38 | $i++; |
39 | 39 | } |