@@ -67,9 +67,9 @@ |
||
| 67 | 67 | |
| 68 | 68 | // Make sure that every row is an array, not an object. |
| 69 | 69 | foreach ( $sanitized as $key => $_value ) { |
| 70 | - $sanitized[ $key ] = (array) $_value; |
|
| 70 | + $sanitized[$key] = (array) $_value; |
|
| 71 | 71 | if ( empty( $_value ) ) { |
| 72 | - unset( $sanitized[ $key ] ); |
|
| 72 | + unset( $sanitized[$key] ); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | foreach ( $args['fields'] as $key => $value ) { |
| 113 | 113 | if ( ! isset( $value['default'] ) ) { |
| 114 | - $args['fields'][ $key ]['default'] = ''; |
|
| 114 | + $args['fields'][$key]['default'] = ''; |
|
| 115 | 115 | } |
| 116 | 116 | if ( ! isset( $value['label'] ) ) { |
| 117 | - $args['fields'][ $key ]['label'] = ''; |
|
| 117 | + $args['fields'][$key]['label'] = ''; |
|
| 118 | 118 | } |
| 119 | - $args['fields'][ $key ]['id'] = $key; |
|
| 119 | + $args['fields'][$key]['id'] = $key; |
|
| 120 | 120 | |
| 121 | 121 | // We check if the filed is an uploaded media ( image , file, video, etc.. ). |
| 122 | 122 | if ( isset( $value['type'] ) ) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | case 'cropped_image': |
| 126 | 126 | case 'upload': |
| 127 | 127 | // We add it to the list of fields that need some extra filtering/processing. |
| 128 | - $media_fields_to_filter[ $key ] = true; |
|
| 128 | + $media_fields_to_filter[$key] = true; |
|
| 129 | 129 | break; |
| 130 | 130 | |
| 131 | 131 | case 'dropdown-pages': |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | ) |
| 141 | 141 | ); |
| 142 | 142 | // Hackily add in the data link parameter. |
| 143 | - $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); |
|
| 144 | - $args['fields'][ $key ]['dropdown'] = $dropdown; |
|
| 143 | + $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][$key]['id'] ) . '"' . $this->get_link(), $dropdown ); |
|
| 144 | + $args['fields'][$key]['dropdown'] = $dropdown; |
|
| 145 | 145 | break; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | // Validating row label field. |
| 584 | - if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) { |
|
| 584 | + if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][esc_attr( $args['row_label']['field'] )] ) ) { |
|
| 585 | 585 | $this->row_label['field'] = esc_attr( $args['row_label']['field'] ); |
| 586 | 586 | } else { |
| 587 | 587 | // If from field is not set correctly, making sure standard is set as the type. |
@@ -79,14 +79,14 @@ |
||
| 79 | 79 | if ( is_array( $this->choices ) ) { |
| 80 | 80 | foreach ( $this->choices as $choice => $value ) { |
| 81 | 81 | if ( 'labels' !== $choice && true === $value ) { |
| 82 | - $this->json['choices'][ $choice ] = true; |
|
| 82 | + $this->json['choices'][$choice] = true; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | if ( is_array( $this->json['default'] ) ) { |
| 87 | 87 | foreach ( $this->json['default'] as $key => $value ) { |
| 88 | - if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) { |
|
| 89 | - $this->json['value'][ $key ] = $value; |
|
| 88 | + if ( isset( $this->json['choices'][$key] ) && ! isset( $this->json['value'][$key] ) ) { |
|
| 89 | + $this->json['value'][$key] = $value; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
| 48 | 48 | |
| 49 | 49 | // Create the styles. |
| 50 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value . $output['suffix']; |
|
| 50 | + $this->styles[$output['media_query']][$output['element']][$property] = $sub_value . $output['suffix']; |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -117,9 +117,9 @@ |
||
| 117 | 117 | public function override_load_textdomain( $override, $domain, $mofile ) { |
| 118 | 118 | |
| 119 | 119 | global $l10n; |
| 120 | - if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
|
| 120 | + if ( isset( $l10n[$this->get_theme_textdomain()] ) ) { |
|
| 121 | 121 | // @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited |
| 122 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; |
|
| 122 | + $l10n['kirki'] = $l10n[$this->get_theme_textdomain()]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Check if the domain is "kirki". |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Check if we've got it cached and ready. |
| 57 | - if ( isset( $this->cached_paths[ $class_name ] ) && file_exists( $this->cached_paths[ $class_name ] ) ) { |
|
| 58 | - include_once $this->cached_paths[ $class_name ]; |
|
| 57 | + if ( isset( $this->cached_paths[$class_name] ) && file_exists( $this->cached_paths[$class_name] ) ) { |
|
| 58 | + include_once $this->cached_paths[$class_name]; |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | foreach ( $paths as $path ) { |
| 65 | 65 | $path = wp_normalize_path( $path ); |
| 66 | 66 | if ( file_exists( $path ) ) { |
| 67 | - $this->cached_paths[ $class_name ] = $path; |
|
| 67 | + $this->cached_paths[$class_name] = $path; |
|
| 68 | 68 | include_once $path; |
| 69 | 69 | return; |
| 70 | 70 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Handle controls loading. |
| 101 | 101 | if ( 'Control' === $name_parts[0] || 'Settings' === $name_parts[0] ) { |
| 102 | - $path = dirname( __FILE__ ) . '/controls/php/'; |
|
| 102 | + $path = dirname( __FILE__ ) . '/controls/php/'; |
|
| 103 | 103 | $paths[] = $path . $filename; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $previous_path = ''; |
| 115 | 115 | for ( $i = 0; $i < $levels; $i++ ) { |
| 116 | - $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
| 117 | - $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
|
| 116 | + $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename; |
|
| 117 | + $previous_path .= strtolower( $exploded[$i] ) . '/'; |
|
| 118 | 118 | } |
| 119 | 119 | return $paths; |
| 120 | 120 | } |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | parent::to_json(); |
| 52 | 52 | |
| 53 | 53 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
| 54 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
| 55 | - unset( $this->json['value'][ $key ] ); |
|
| 54 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][$key] ) ) { |
|
| 55 | + unset( $this->json['value'][$key] ); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Fix for https://github.com/aristath/kirki/issues/1405. |
| 60 | 60 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
| 61 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
| 62 | - unset( $this->json['value'][ $key ] ); |
|
| 61 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
| 62 | + unset( $this->json['value'][$key] ); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | if ( is_string( $variant ) ) { |
| 258 | 258 | $final_variants[] = array( |
| 259 | 259 | 'id' => $variant, |
| 260 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
| 260 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
| 261 | 261 | ); |
| 262 | 262 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
| 263 | 263 | $final_variants[] = $variant; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | if ( array_key_exists( $variant, $all_variants ) ) { |
| 339 | 339 | $available_variants[] = array( |
| 340 | 340 | 'id' => $variant, |
| 341 | - 'label' => $all_variants[ $variant ], |
|
| 341 | + 'label' => $all_variants[$variant], |
|
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | if ( array_key_exists( $subset, $all_subsets ) ) { |
| 351 | 351 | $available_subsets[] = array( |
| 352 | 352 | 'id' => $subset, |
| 353 | - 'label' => $all_subsets[ $subset ], |
|
| 353 | + 'label' => $all_subsets[$subset], |
|
| 354 | 354 | ); |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | // Kirki does not exist, continue with our custom implementation. |
| 70 | 70 | // Get the default value of the field. |
| 71 | 71 | $default = ''; |
| 72 | - if ( isset( self::$fields[ $field_id ] ) && isset( self::$fields[ $field_id ]['default'] ) ) { |
|
| 73 | - $default = self::$fields[ $field_id ]['default']; |
|
| 72 | + if ( isset( self::$fields[$field_id] ) && isset( self::$fields[$field_id]['default'] ) ) { |
|
| 73 | + $default = self::$fields[$field_id]['default']; |
|
| 74 | 74 | } |
| 75 | 75 | // Make sure the config is defined. |
| 76 | - if ( isset( self::$config[ $config_id ] ) ) { |
|
| 77 | - if ( 'option' == self::$config[ $config_id ]['option_type'] ) { |
|
| 76 | + if ( isset( self::$config[$config_id] ) ) { |
|
| 77 | + if ( 'option' == self::$config[$config_id]['option_type'] ) { |
|
| 78 | 78 | // check if we're using serialized options. |
| 79 | - if ( isset( self::$config[ $config_id ]['option_name'] ) && ! empty( self::$config[ $config_id ]['option_name'] ) ) { |
|
| 79 | + if ( isset( self::$config[$config_id]['option_name'] ) && ! empty( self::$config[$config_id]['option_name'] ) ) { |
|
| 80 | 80 | // Get all our options. |
| 81 | - $all_options = get_option( self::$config[ $config_id ]['option_name'], array() ); |
|
| 81 | + $all_options = get_option( self::$config[$config_id]['option_name'], array() ); |
|
| 82 | 82 | // If our option is not saved, return the default value. |
| 83 | - if ( ! isset( $all_options[ $field_id ] ) ) { |
|
| 83 | + if ( ! isset( $all_options[$field_id] ) ) { |
|
| 84 | 84 | return $default; |
| 85 | 85 | } |
| 86 | 86 | // Option was set, return its value unserialized. |
| 87 | - return maybe_unserialize( $all_options[ $field_id ] ); |
|
| 87 | + return maybe_unserialize( $all_options[$field_id] ); |
|
| 88 | 88 | } |
| 89 | 89 | // If we're not using serialized options, get the value and return it. |
| 90 | 90 | // We'll be using a dummy default here to check if the option has been set or not. |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | // Kirki does not exist, set the config arguments |
| 145 | - $config[ $config_id ] = $args; |
|
| 145 | + $config[$config_id] = $args; |
|
| 146 | 146 | // Make sure an option_type is defined |
| 147 | - if ( ! isset( self::$config[ $config_id ]['option_type'] ) ) { |
|
| 148 | - self::$config[ $config_id ]['option_type'] = 'theme_mod'; |
|
| 147 | + if ( ! isset( self::$config[$config_id]['option_type'] ) ) { |
|
| 148 | + self::$config[$config_id]['option_type'] = 'theme_mod'; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if ( ! isset( $args['kirki_config'] ) ) { |
| 170 | 170 | $args['kirki_config'] = $config_id; |
| 171 | 171 | } |
| 172 | - self::$fields[ $args['settings'] ] = $args; |
|
| 172 | + self::$fields[$args['settings']] = $args; |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | if ( ! is_array( $value ) ) { |
| 238 | 238 | $value = str_replace( '$', $value, $output['value_pattern'] ); |
| 239 | 239 | if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) ) { |
| 240 | - $css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 240 | + $css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 241 | 241 | } |
| 242 | 242 | } else { |
| 243 | 243 | if ( 'typography' == $field['type'] ) { |
@@ -248,25 +248,25 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | // add double quotes if needed to font-families |
| 250 | 250 | if ( 'font-family' == $key && false !== strpos( $subvalue, ' ' ) && false === strpos( $subvalue, '"' ) ) { |
| 251 | - $css[ $output['media_query'] ][ $output['element'] ]['font-family'] = '"' . $subvalue . '"'; |
|
| 251 | + $css[$output['media_query']][$output['element']]['font-family'] = '"' . $subvalue . '"'; |
|
| 252 | 252 | } |
| 253 | 253 | // variants contain both font-weight & italics |
| 254 | 254 | if ( 'variant' == $key ) { |
| 255 | 255 | $font_weight = str_replace( 'italic', '', $subvalue ); |
| 256 | 256 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight; |
| 257 | - $css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
| 257 | + $css[$output['media_query']][$output['element']]['font-weight'] = $font_weight; |
|
| 258 | 258 | // Is this italic? |
| 259 | 259 | $is_italic = ( false !== strpos( $subvalue, 'italic' ) ); |
| 260 | 260 | if ( $is_italic ) { |
| 261 | - $css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
| 261 | + $css[$output['media_query']][$output['element']]['font-style'] = 'italic'; |
|
| 262 | 262 | } |
| 263 | 263 | } else { |
| 264 | - $css[ $output['media_query'] ][ $output['element'] ][ $key ] = $subvalue; |
|
| 264 | + $css[$output['media_query']][$output['element']][$key] = $subvalue; |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | } elseif ( 'multicolor' == $field['type'] ) { |
| 268 | 268 | if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) { |
| 269 | - $css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix']; |
|
| 269 | + $css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value[$output['choice']] . $output['units'] . $output['suffix']; |
|
| 270 | 270 | } |
| 271 | 271 | } else { |
| 272 | 272 | foreach ( $value as $key => $subvalue ) { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $subvalue = 'url("' . $subvalue . '")'; |
| 281 | 281 | } |
| 282 | 282 | if ( $subvalue ) { |
| 283 | - $css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue; |
|
| 283 | + $css[$output['media_query']][$output['element']][$property] = $subvalue; |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |