@@ -25,7 +25,7 @@ |
||
25 | 25 | if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->section_types ) ) { |
26 | 26 | $args['type'] = 'default'; |
27 | 27 | } |
28 | - $section_classname = $this->section_types[ $args['type'] ]; |
|
28 | + $section_classname = $this->section_types[$args['type']]; |
|
29 | 29 | |
30 | 30 | $this->wp_customize->add_section( new $section_classname( $this->wp_customize, sanitize_key( $args['id'] ), array( |
31 | 31 | 'title' => $args['title'], // already escaped in WP Core |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->panel_types ) ) { |
36 | 36 | $args['type'] = 'default'; |
37 | 37 | } |
38 | - $panel_classname = $this->panel_types[ $args['type'] ]; |
|
38 | + $panel_classname = $this->panel_types[$args['type']]; |
|
39 | 39 | |
40 | 40 | $this->wp_customize->add_panel( new $panel_classname( $this->wp_customize, sanitize_key( $args['id'] ), array( |
41 | 41 | 'title' => $args['title'], // already escaped in WP Core |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $class_name = 'WP_Customize_Control'; |
54 | 54 | // Get the classname from the array of control classnames |
55 | 55 | if ( array_key_exists( $args['type'], $this->control_types ) ) { |
56 | - $class_name = $this->control_types[ $args['type'] ]; |
|
56 | + $class_name = $this->control_types[$args['type']]; |
|
57 | 57 | } |
58 | 58 | return $class_name; |
59 | 59 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | foreach ( $this->control_types as $key => $classname ) { |
116 | 116 | |
117 | 117 | if ( ! class_exists( $classname ) ) { |
118 | - unset( $this->control_types[ $key ] ); |
|
118 | + unset( $this->control_types[$key] ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) { |
55 | 55 | $args['type'] = 'default'; |
56 | 56 | } |
57 | - $classname = $this->setting_types[ $args['type'] ]; |
|
57 | + $classname = $this->setting_types[$args['type']]; |
|
58 | 58 | |
59 | 59 | // If settings are defined as an array, then we need to go through them |
60 | 60 | // and call add_setting for each one of them separately. |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $args['default'] = array(); |
65 | 65 | } |
66 | 66 | foreach ( $args['settings'] as $key => $value ) { |
67 | - $default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : ''; |
|
67 | + $default = ( isset( $defaults[$key] ) ) ? $defaults[$key] : ''; |
|
68 | 68 | $this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
69 | 69 | } |
70 | 70 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | foreach ( $this->setting_types as $key => $classname ) { |
116 | 116 | |
117 | 117 | if ( ! class_exists( $classname ) ) { |
118 | - unset( $this->setting_types[ $key ] ); |
|
118 | + unset( $this->setting_types[$key] ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | foreach ( $args as $key => $value ) { |
85 | 85 | // Is this property whitelisted? |
86 | 86 | if ( property_exists( $this, $key ) ) { |
87 | - $args[ $key ] = $value; |
|
87 | + $args[$key] = $value; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | $id = ( '' == $id ) ? 'global' : $id; |
123 | 123 | |
124 | 124 | $id_md5 = md5( $id ); |
125 | - if ( ! isset( self::$instances[ $id_md5 ] ) ) { |
|
126 | - self::$instances[ $id_md5 ] = new self( $id, $args ); |
|
125 | + if ( ! isset( self::$instances[$id_md5] ) ) { |
|
126 | + self::$instances[$id_md5] = new self( $id, $args ); |
|
127 | 127 | } |
128 | - return self::$instances[ $id_md5 ]; |
|
128 | + return self::$instances[$id_md5]; |
|
129 | 129 | |
130 | 130 | } |
131 | 131 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public static function add_config( $config_id, $args = array() ) { |
52 | 52 | $config = Kirki_Config::get_instance( $config_id, $args ); |
53 | 53 | $config_args = $config->get_config(); |
54 | - self::$config[ $config_args['id'] ] = $config_args; |
|
54 | + self::$config[$config_args['id']] = $config_args; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
71 | 71 | } |
72 | 72 | |
73 | - self::$panels[ $args['id'] ] = $args; |
|
73 | + self::$panels[$args['id']] = $args; |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
93 | 93 | } |
94 | 94 | |
95 | - self::$sections[ $args['id'] ] = $args; |
|
95 | + self::$sections[$args['id']] = $args; |
|
96 | 96 | |
97 | 97 | } |
98 | 98 |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Plugin Name: ariColor |
|
4 | - * Plugin URI: http://aristath.github.io/ariColor/ |
|
5 | - * Description: A PHP library for color manipulation in WordPress themes and plugins |
|
6 | - * Author: Aristeides Stathopoulos |
|
7 | - * Author URI: http://aristeides.com |
|
8 | - * Version: 1.0 |
|
9 | - * Text Domain: aricolor |
|
10 | - * |
|
11 | - * GitHub Plugin URI: aristath/ariColor |
|
12 | - * GitHub Plugin URI: https://github.com/aristath/ariColor |
|
13 | - * |
|
14 | - * |
|
15 | - * @package ariColor |
|
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: ariColor |
|
4 | + * Plugin URI: http://aristath.github.io/ariColor/ |
|
5 | + * Description: A PHP library for color manipulation in WordPress themes and plugins |
|
6 | + * Author: Aristeides Stathopoulos |
|
7 | + * Author URI: http://aristeides.com |
|
8 | + * Version: 1.0 |
|
9 | + * Text Domain: aricolor |
|
10 | + * |
|
11 | + * GitHub Plugin URI: aristath/ariColor |
|
12 | + * GitHub Plugin URI: https://github.com/aristath/ariColor |
|
13 | + * |
|
14 | + * |
|
15 | + * @package ariColor |
|
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' ) ) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @access public |
78 | 78 | * @var int|double |
79 | 79 | */ |
80 | - public $red = 0; |
|
80 | + public $red = 0; |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * @access public |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @access public |
90 | 90 | * @var int|double |
91 | 91 | */ |
92 | - public $blue = 0; |
|
92 | + public $blue = 0; |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @access public |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | // get an md5 for this color |
169 | 169 | $color_md5 = ( is_array( $color ) ) ? md5( json_encode( $color ) . $mode ) : md5( $color . $mode ); |
170 | 170 | // Set the instance if it does not already exist. |
171 | - if ( ! isset( self::$instances[ $color_md5 ] ) ) { |
|
172 | - self::$instances[ $color_md5 ] = new self( $color, $mode ); |
|
171 | + if ( ! isset( self::$instances[$color_md5] ) ) { |
|
172 | + self::$instances[$color_md5] = new self( $color, $mode ); |
|
173 | 173 | } |
174 | - return self::$instances[ $color_md5 ]; |
|
174 | + return self::$instances[$color_md5]; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | ); |
273 | 273 | $found = false; |
274 | 274 | foreach ( $finders_keepers as $finder => $keeper ) { |
275 | - if ( isset( $color[ $finder ] ) ) { |
|
275 | + if ( isset( $color[$finder] ) ) { |
|
276 | 276 | $found = true; |
277 | - $this->$keeper = $color[ $finder ]; |
|
277 | + $this->$keeper = $color[$finder]; |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | // We failed, return null. |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // Perhaps we're using a word like "orange"? |
304 | 304 | $wordcolors = $this->get_word_colors(); |
305 | 305 | if ( array_key_exists( $color, $wordcolors ) ) { |
306 | - $this->color = '#' . $wordcolors[ $color ]; |
|
306 | + $this->color = '#' . $wordcolors[$color]; |
|
307 | 307 | return 'hex'; |
308 | 308 | } |
309 | 309 | // fallback to hex. |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | // Is this perhaps a word-color? |
324 | 324 | $word_colors = $this->get_word_colors(); |
325 | 325 | if ( array_key_exists( $this->color, $word_colors ) ) { |
326 | - $this->color = '#' . $word_colors[ $this->color ]; |
|
326 | + $this->color = '#' . $word_colors[$this->color]; |
|
327 | 327 | } |
328 | 328 | // Sanitize color |
329 | 329 | $this->hex = sanitize_hex_color( maybe_hash_hex_color( $this->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 | } |