@@ -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; |
@@ -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' ) ) { |
@@ -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 |
@@ -9,13 +9,13 @@ |
||
9 | 9 | // Add backup font |
10 | 10 | if ( Kirki_Fonts::is_google_font( $this->value ) ) { |
11 | 11 | |
12 | - if ( isset( $google_fonts_array[ $this->value ] ) && isset( $google_fonts_array[ $this->value ]['category'] ) ) { |
|
13 | - if ( isset( $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ] ) ) { |
|
12 | + if ( isset( $google_fonts_array[$this->value] ) && isset( $google_fonts_array[$this->value]['category'] ) ) { |
|
13 | + if ( isset( $backup_fonts[$google_fonts_array[$this->value]['category']] ) ) { |
|
14 | 14 | // add double quotes if needed |
15 | 15 | if ( false !== strpos( $this->value, ' ' ) && false === strpos( $this->value, '"' ) ) { |
16 | - $this->value = '"' . $this->value . '", ' . $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ]; |
|
16 | + $this->value = '"' . $this->value . '", ' . $backup_fonts[$google_fonts_array[$this->value]['category']]; |
|
17 | 17 | } else { |
18 | - $this->value .= ', ' . $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ]; |
|
18 | + $this->value .= ', ' . $backup_fonts[$google_fonts_array[$this->value]['category']]; |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | // Take care of font-families |
8 | 8 | if ( isset( $value['font-family'] ) ) { |
9 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-family'] = $this->process_property_value( 'font-family', $value['font-family'] ); |
|
9 | + $this->styles[$output['media_query']][$output['element']]['font-family'] = $this->process_property_value( 'font-family', $value['font-family'] ); |
|
10 | 10 | } |
11 | 11 | // Add support for the older font-weight parameter. |
12 | 12 | // This has been deprecated so the code below is just |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // and make changes to their typography, |
16 | 16 | // new values are saved and this one is no longer used. |
17 | 17 | if ( isset( $value['font-weight'] ) && $value['font-weight'] ) { |
18 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $value['font-weight']; |
|
18 | + $this->styles[$output['media_query']][$output['element']]['font-weight'] = $value['font-weight']; |
|
19 | 19 | } |
20 | 20 | // Take care of variants |
21 | 21 | if ( isset( $value['variant'] ) && $value['variant'] ) { |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight; |
25 | 25 | // Is this italic? |
26 | 26 | $is_italic = ( false !== strpos( $value['variant'], 'italic' ) ); |
27 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
27 | + $this->styles[$output['media_query']][$output['element']]['font-weight'] = $font_weight; |
|
28 | 28 | if ( $is_italic ) { |
29 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
29 | + $this->styles[$output['media_query']][$output['element']]['font-style'] = 'italic'; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | // Take care of font-size |
33 | 33 | if ( isset( $value['font-size'] ) ) { |
34 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-size'] = $value['font-size']; |
|
34 | + $this->styles[$output['media_query']][$output['element']]['font-size'] = $value['font-size']; |
|
35 | 35 | } |
36 | 36 | // Take care of line-height |
37 | 37 | if ( isset( $value['line-height'] ) ) { |
38 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['line-height'] = $value['line-height']; |
|
38 | + $this->styles[$output['media_query']][$output['element']]['line-height'] = $value['line-height']; |
|
39 | 39 | } |
40 | 40 | // Take care of letter-spacing |
41 | 41 | if ( isset( $value['letter-spacing'] ) ) { |
42 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['letter-spacing'] = $value['letter-spacing']; |
|
42 | + $this->styles[$output['media_query']][$output['element']]['letter-spacing'] = $value['letter-spacing']; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | // Add the requested google-font |
100 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
101 | - $this->fonts[ $value['font-family'] ] = array(); |
|
100 | + if ( ! isset( $this->fonts[$value['font-family']] ) ) { |
|
101 | + $this->fonts[$value['font-family']] = array(); |
|
102 | 102 | } |
103 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ] ) ) { |
|
104 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
103 | + if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']] ) ) { |
|
104 | + $this->fonts[$value['font-family']][] = $value['variant']; |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if ( isset( $args['output'] ) && is_array( $args['output'] ) ) { |
113 | 113 | foreach ( $args['output'] as $output ) { |
114 | 114 | // If we don't have a typography-related output argument we can skip this. |
115 | - if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset' ) ) ) { |
|
115 | + if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset' ) ) ) { |
|
116 | 116 | continue; |
117 | 117 | } |
118 | 118 | // Get the value |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | // font-family |
122 | 122 | if ( 'font-family' == $output['property'] ) { |
123 | 123 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
124 | - $this->fonts[ $value ] = array(); |
|
124 | + $this->fonts[$value] = array(); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | // font-weight |
128 | 128 | elseif ( 'font-weight' == $output['property'] ) { |
129 | 129 | foreach ( $this->fonts as $font => $variants ) { |
130 | 130 | if ( ! in_array( $value, $variants ) ) { |
131 | - $this->fonts[ $font ][] = $value; |
|
131 | + $this->fonts[$font][] = $value; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -165,27 +165,27 @@ discard block |
||
165 | 165 | // Determine if this is indeed a google font or not. |
166 | 166 | // If it's not, then just remove it from the array. |
167 | 167 | if ( ! array_key_exists( $font, $google_fonts ) ) { |
168 | - unset( $this->fonts[ $font ] ); |
|
168 | + unset( $this->fonts[$font] ); |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | // Get all valid font variants for this font |
172 | 172 | $font_variants = array(); |
173 | - if ( isset( $google_fonts[ $font ]['variants'] ) ) { |
|
174 | - $font_variants = $google_fonts[ $font ]['variants']; |
|
173 | + if ( isset( $google_fonts[$font]['variants'] ) ) { |
|
174 | + $font_variants = $google_fonts[$font]['variants']; |
|
175 | 175 | } |
176 | 176 | foreach ( $variants as $variant ) { |
177 | 177 | // If this is not a valid variant for this font-family |
178 | 178 | // then unset it and move on to the next one. |
179 | 179 | if ( ! in_array( $variant, $font_variants ) ) { |
180 | - unset( $this->fonts[ $font ][ $variant ] ); |
|
180 | + unset( $this->fonts[$font][$variant] ); |
|
181 | 181 | continue; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | // Check if the selected subsets exist, even in one of the selected fonts. |
185 | 185 | // If they don't, then they have to be removed otherwise the link will fail. |
186 | - if ( isset( $google_fonts[ $font ]['subsets'] ) ) { |
|
186 | + if ( isset( $google_fonts[$font]['subsets'] ) ) { |
|
187 | 187 | foreach ( $this->subsets as $subset ) { |
188 | - if ( in_array( $subset, $google_fonts[ $font ]['subsets'] ) ) { |
|
188 | + if ( in_array( $subset, $google_fonts[$font]['subsets'] ) ) { |
|
189 | 189 | $valid_subsets[] = $subset; |
190 | 190 | } |
191 | 191 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | } else { |
11 | 11 | $property = $output['property'] . '-' . $key; |
12 | 12 | } |
13 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value; |
|
13 | + $this->styles[$output['media_query']][$output['element']][$property] = $sub_value; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | } |
@@ -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 | } |