@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * Build the field. |
| 88 | 88 | * We're merging with the original field here, so any extra properties are inherited. |
| 89 | 89 | */ |
| 90 | - $fields[ $property_setting ] = array_merge( $field, array( |
|
| 90 | + $fields[$property_setting] = array_merge( $field, array( |
|
| 91 | 91 | 'type' => $type, |
| 92 | 92 | 'label' => $label, |
| 93 | 93 | 'settings' => $property_setting, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 'description' => $description, |
| 99 | 99 | 'default' => $value, |
| 100 | 100 | 'id' => Kirki_Field_Sanitize::sanitize_id( array( 'settings' => Kirki_Field_Sanitize::sanitize_settings( array( 'settings' => $field['settings'] . '_' . $setting ) ) ) ), |
| 101 | - 'choices' => isset( $choices[ $key ] ) ? $choices[ $key ] : array(), |
|
| 101 | + 'choices' => isset( $choices[$key] ) ? $choices[$key] : array(), |
|
| 102 | 102 | 'output' => ( '' != $field['output'] ) ? array( |
| 103 | 103 | array( |
| 104 | 104 | 'element' => $field['output'], |
@@ -50,9 +50,9 @@ |
||
| 50 | 50 | // Make sure that every row is an array, not an object |
| 51 | 51 | foreach ( $sanitized as $key => $_value ) { |
| 52 | 52 | if ( empty( $_value ) ) { |
| 53 | - unset( $sanitized[ $key ] ); |
|
| 53 | + unset( $sanitized[$key] ); |
|
| 54 | 54 | } else { |
| 55 | - $sanitized[ $key ] = (array) $_value; |
|
| 55 | + $sanitized[$key] = (array) $_value; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | $fields = Kirki::$fields; |
| 16 | 16 | |
| 17 | 17 | // Make sure the current object matches a registered field. |
| 18 | - if ( ! isset( $object->setting->id ) || ! isset( $fields[ $object->setting->id ] ) ) { |
|
| 18 | + if ( ! isset( $object->setting->id ) || ! isset( $fields[$object->setting->id] ) ) { |
|
| 19 | 19 | return true; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - $current_object = $fields[ $object->setting->id ]; |
|
| 22 | + $current_object = $fields[$object->setting->id]; |
|
| 23 | 23 | |
| 24 | 24 | if ( isset( $current_object['required'] ) ) { |
| 25 | 25 | |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * fallback to 'global' if $config_id is not found |
| 28 | 28 | */ |
| 29 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
| 29 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
| 30 | 30 | $config_id = 'global'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if ( 'theme_mod' == Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 33 | + if ( 'theme_mod' == Kirki::$config[$config_id]['option_type'] ) { |
|
| 34 | 34 | /** |
| 35 | 35 | * We're using theme_mods. |
| 36 | 36 | * so just get the value using get_theme_mod |
| 37 | 37 | */ |
| 38 | 38 | $default_value = null; |
| 39 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
| 40 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
| 39 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
| 40 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
| 41 | 41 | } |
| 42 | 42 | $value = get_theme_mod( $field_id, $default_value ); |
| 43 | 43 | |
@@ -45,51 +45,51 @@ discard block |
||
| 45 | 45 | * If the field is a background field, then get the sub-fields |
| 46 | 46 | * and return an array of the values. |
| 47 | 47 | */ |
| 48 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) && 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
| 48 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) && 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
| 49 | 49 | $value = array(); |
| 50 | 50 | if ( null == $default_value ) { |
| 51 | 51 | $default_value = array(); |
| 52 | 52 | } |
| 53 | 53 | foreach ( $default_value as $property_key => $property_default ) { |
| 54 | - $value[ $property_key ] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
| 54 | + $value[$property_key] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - } elseif ( 'option' == Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 58 | + } elseif ( 'option' == Kirki::$config[$config_id]['option_type'] ) { |
|
| 59 | 59 | /** |
| 60 | 60 | * We're using options. |
| 61 | 61 | */ |
| 62 | - if ( '' != Kirki::$config[ $config_id ]['option_name'] ) { |
|
| 62 | + if ( '' != Kirki::$config[$config_id]['option_name'] ) { |
|
| 63 | 63 | /** |
| 64 | 64 | * Options are serialized as a single option in the db. |
| 65 | 65 | * We'll have to get the option and then get the item from the array. |
| 66 | 66 | */ |
| 67 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
| 67 | + $options = get_option( Kirki::$config[$config_id]['option_name'] ); |
|
| 68 | 68 | |
| 69 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
| 70 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
| 69 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
| 70 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
| 71 | 71 | } |
| 72 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
| 72 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * If this is a background field, get the individual sub-fields and return an array. |
| 76 | 76 | */ |
| 77 | - if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
| 77 | + if ( 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
| 78 | 78 | $value = array(); |
| 79 | 79 | |
| 80 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property => $property_default ) { |
|
| 80 | + foreach ( Kirki::$fields[$field_id]['default'] as $property => $property_default ) { |
|
| 81 | 81 | |
| 82 | - if ( isset( $options[ $setting_modified . '_' . $property ] ) ) { |
|
| 83 | - $value[ $property ] = $options[ $setting_modified . '_' . $property ]; |
|
| 82 | + if ( isset( $options[$setting_modified . '_' . $property] ) ) { |
|
| 83 | + $value[$property] = $options[$setting_modified . '_' . $property]; |
|
| 84 | 84 | } else { |
| 85 | - $value[ $property ] = $property_default; |
|
| 85 | + $value[$property] = $property_default; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } else { |
| 89 | 89 | /** |
| 90 | 90 | * This is not a background field so continue and get the value. |
| 91 | 91 | */ |
| 92 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : Kirki::$fields[ $field_id ]['default']; |
|
| 92 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : Kirki::$fields[$field_id]['default']; |
|
| 93 | 93 | $value = maybe_unserialize( $value ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * Each option separately saved in the db |
| 99 | 99 | */ |
| 100 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
| 100 | + $value = get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * If the field is a background field, then get the sub-fields |
| 104 | 104 | * and return an array of the values. |
| 105 | 105 | */ |
| 106 | - if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
| 106 | + if ( 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
| 107 | 107 | $value = array(); |
| 108 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property_key => $property_default ) { |
|
| 109 | - $value[ $property_key ] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
| 108 | + foreach ( Kirki::$fields[$field_id]['default'] as $property_key => $property_default ) { |
|
| 109 | + $value[$property_key] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | if ( isset( $field['option_name'] ) && '' != $field['option_name'] ) { |
| 130 | 130 | $all_values = get_option( $field['option_name'], array() ); |
| 131 | 131 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
| 132 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
| 133 | - $value = $all_values[ $sub_setting_id ]; |
|
| 132 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
| 133 | + $value = $all_values[$sub_setting_id]; |
|
| 134 | 134 | } |
| 135 | 135 | } else { |
| 136 | 136 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -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 | } |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | foreach ( $args['fields'] as $key => $value ) { |
| 36 | 36 | if ( ! isset( $value['default'] ) ) { |
| 37 | - $args['fields'][ $key ]['default'] = ''; |
|
| 37 | + $args['fields'][$key]['default'] = ''; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ( ! isset( $value['label'] ) ) { |
| 41 | - $args['fields'][ $key ]['label'] = ''; |
|
| 41 | + $args['fields'][$key]['label'] = ''; |
|
| 42 | 42 | } |
| 43 | - $args['fields'][ $key ]['id'] = $key; |
|
| 43 | + $args['fields'][$key]['id'] = $key; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $this->fields = $args['fields']; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | continue; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $fields[ $key ]['buttonLabels'] = $default_image_button_labels; |
|
| 66 | + $fields[$key]['buttonLabels'] = $default_image_button_labels; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $this->json['fields'] = $fields; |
@@ -26,15 +26,15 @@ |
||
| 26 | 26 | if ( is_array( $this->choices ) ) { |
| 27 | 27 | foreach ( $this->choices as $choice => $value ) { |
| 28 | 28 | if ( true === $value ) { |
| 29 | - $this->json['choices'][ $choice ] = true; |
|
| 29 | + $this->json['choices'][$choice] = true; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | if ( is_array( $this->json['default'] ) ) { |
| 35 | 35 | foreach ( $this->json['default'] as $key => $value ) { |
| 36 | - if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) { |
|
| 37 | - $this->json['value'][ $key ] = $value; |
|
| 36 | + if ( isset( $this->json['choices'][$key] ) && ! isset( $this->json['value'][$key] ) ) { |
|
| 37 | + $this->json['value'][$key] = $value; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -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; |