@@ -99,7 +99,7 @@ |
||
| 99 | 99 | */ |
| 100 | 100 | public static function add_module( $module ) { |
| 101 | 101 | if ( ! in_array( $module, self::$modules, true ) ) { |
| 102 | - self::$modules[] = $module; |
|
| 102 | + self::$modules[ ] = $module; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | $class_name = 'WP_Customize_Control'; |
| 69 | 69 | |
| 70 | 70 | // Get the classname from the array of control classnames. |
| 71 | - if ( array_key_exists( $args['type'], self::$control_types ) ) { |
|
| 72 | - $class_name = self::$control_types[ $args['type'] ]; |
|
| 71 | + if ( array_key_exists( $args[ 'type' ], self::$control_types ) ) { |
|
| 72 | + $class_name = self::$control_types[ $args[ 'type' ] ]; |
|
| 73 | 73 | } |
| 74 | 74 | return $class_name; |
| 75 | 75 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $class_name = $this->get_control_class_name( $args ); |
| 87 | 87 | |
| 88 | 88 | // Add the control. |
| 89 | - $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) ); |
|
| 89 | + $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args[ 'settings' ], $args ) ); |
|
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $plugins = get_plugins(); |
| 44 | 44 | $_plugin = ''; |
| 45 | 45 | foreach ( $plugins as $plugin => $args ) { |
| 46 | - if ( ! $is_plugin && isset( $args['Name'] ) && ( 'Kirki' === $args['Name'] || 'Kirki Toolkit' === $args['Name'] ) ) { |
|
| 46 | + if ( ! $is_plugin && isset( $args[ 'Name' ] ) && ( 'Kirki' === $args[ 'Name' ] || 'Kirki Toolkit' === $args[ 'Name' ] ) ) { |
|
| 47 | 47 | $is_plugin = true; |
| 48 | 48 | $_plugin = $plugin; |
| 49 | 49 | } |
@@ -80,23 +80,23 @@ discard block |
||
| 80 | 80 | foreach ( Kirki::$fields as $field ) { |
| 81 | 81 | |
| 82 | 82 | // Check if we have variables for this field. |
| 83 | - if ( isset( $field['variables'] ) && $field['variables'] && ! empty( $field['variables'] ) ) { |
|
| 83 | + if ( isset( $field[ 'variables' ] ) && $field[ 'variables' ] && ! empty( $field[ 'variables' ] ) ) { |
|
| 84 | 84 | |
| 85 | 85 | // Loop through the array of variables. |
| 86 | - foreach ( $field['variables'] as $field_variable ) { |
|
| 86 | + foreach ( $field[ 'variables' ] as $field_variable ) { |
|
| 87 | 87 | |
| 88 | 88 | // Is the variable ['name'] defined? If yes, then we can proceed. |
| 89 | - if ( isset( $field_variable['name'] ) ) { |
|
| 89 | + if ( isset( $field_variable[ 'name' ] ) ) { |
|
| 90 | 90 | |
| 91 | 91 | // Do we have a callback function defined? If not then set $variable_callback to false. |
| 92 | - $variable_callback = ( isset( $field_variable['callback'] ) && is_callable( $field_variable['callback'] ) ) ? $field_variable['callback'] : false; |
|
| 92 | + $variable_callback = ( isset( $field_variable[ 'callback' ] ) && is_callable( $field_variable[ 'callback' ] ) ) ? $field_variable[ 'callback' ] : false; |
|
| 93 | 93 | |
| 94 | 94 | // If we have a variable_callback defined then get the value of the option |
| 95 | 95 | // and run it through the callback function. |
| 96 | 96 | // If no callback is defined (false) then just get the value. |
| 97 | - $variables[ $field_variable['name'] ] = Kirki_Values::get_value( $field['settings'] ); |
|
| 97 | + $variables[ $field_variable[ 'name' ] ] = Kirki_Values::get_value( $field[ 'settings' ] ); |
|
| 98 | 98 | if ( $variable_callback ) { |
| 99 | - $variables[ $field_variable['name'] ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
| 99 | + $variables[ $field_variable[ 'name' ] ] = call_user_func( $field_variable[ 'callback' ], Kirki_Values::get_value( $field[ 'settings' ] ) ); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -123,31 +123,31 @@ discard block |
||
| 123 | 123 | if ( |
| 124 | 124 | self::is_plugin() || |
| 125 | 125 | false === strpos( $url, 'wordpress.org' ) || ( |
| 126 | - ! isset( $request['body'] ) || |
|
| 127 | - ! isset( $request['body']['plugins'] ) || |
|
| 128 | - ! isset( $request['body']['translations'] ) || |
|
| 129 | - ! isset( $request['body']['locale'] ) || |
|
| 130 | - ! isset( $request['body']['all'] ) |
|
| 126 | + ! isset( $request[ 'body' ] ) || |
|
| 127 | + ! isset( $request[ 'body' ][ 'plugins' ] ) || |
|
| 128 | + ! isset( $request[ 'body' ][ 'translations' ] ) || |
|
| 129 | + ! isset( $request[ 'body' ][ 'locale' ] ) || |
|
| 130 | + ! isset( $request[ 'body' ][ 'all' ] ) |
|
| 131 | 131 | ) |
| 132 | 132 | ) { |
| 133 | 133 | return $request; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $plugins = json_decode( $request['body']['plugins'], true ); |
|
| 137 | - if ( ! isset( $plugins['plugins'] ) ) { |
|
| 136 | + $plugins = json_decode( $request[ 'body' ][ 'plugins' ], true ); |
|
| 137 | + if ( ! isset( $plugins[ 'plugins' ] ) ) { |
|
| 138 | 138 | return $request; |
| 139 | 139 | } |
| 140 | 140 | $exists = false; |
| 141 | - foreach ( $plugins['plugins'] as $plugin ) { |
|
| 142 | - if ( isset( $plugin['Name'] ) && 'Kirki Toolkit' === $plugin['Name'] ) { |
|
| 141 | + foreach ( $plugins[ 'plugins' ] as $plugin ) { |
|
| 142 | + if ( isset( $plugin[ 'Name' ] ) && 'Kirki Toolkit' === $plugin[ 'Name' ] ) { |
|
| 143 | 143 | $exists = true; |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | // Inject data. |
| 147 | 147 | if ( ! $exists && defined( 'KIRKI_PLUGIN_FILE' ) ) { |
| 148 | - $plugins['plugins']['kirki/kirki.php'] = get_plugin_data( KIRKI_PLUGIN_FILE ); |
|
| 148 | + $plugins[ 'plugins' ][ 'kirki/kirki.php' ] = get_plugin_data( KIRKI_PLUGIN_FILE ); |
|
| 149 | 149 | } |
| 150 | - $request['body']['plugins'] = wp_json_encode( $plugins ); |
|
| 150 | + $request[ 'body' ][ 'plugins' ] = wp_json_encode( $plugins ); |
|
| 151 | 151 | return $request; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | // We only need the major version. |
| 168 | 168 | if ( 'major' === $context ) { |
| 169 | 169 | $version_parts = explode( '.', $wp_version ); |
| 170 | - return $version_parts[0]; |
|
| 170 | + return $version_parts[ 0 ]; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $wp_version; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | // We only need the major version. |
| 191 | 191 | if ( 'major' === $context ) { |
| 192 | 192 | $version_parts = explode( '.', $wp_version ); |
| 193 | - return absint( $version_parts[0] ); |
|
| 193 | + return absint( $version_parts[ 0 ] ); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // If we got this far, we want the full monty. |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | if ( false !== strpos( $wp_version, '-' ) ) { |
| 199 | 199 | // We're on a dev version. |
| 200 | 200 | $version_parts = explode( '-', $wp_version ); |
| 201 | - return floatval( $version_parts[0] ); |
|
| 201 | + return floatval( $version_parts[ 0 ] ); |
|
| 202 | 202 | } |
| 203 | 203 | return floatval( $wp_version ); |
| 204 | 204 | } |
@@ -23,8 +23,8 @@ |
||
| 23 | 23 | if ( ! is_array( $this->choices ) ) { |
| 24 | 24 | $this->choices = array(); |
| 25 | 25 | } |
| 26 | - $this->choices['element'] = 'input'; |
|
| 27 | - $this->choices['type'] = 'text'; |
|
| 26 | + $this->choices[ 'element' ] = 'input'; |
|
| 27 | + $this->choices[ 'type' ] = 'text'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $styles = $this->get_styles(); |
| 169 | 169 | |
| 170 | 170 | if ( ! empty( $styles ) ) { |
| 171 | - $settings['styles'][] = array( 'css' => $styles ); |
|
| 171 | + $settings[ 'styles' ][ ] = array( 'css' => $styles ); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return $settings; |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if ( ! empty( $args ) ) { |
| 223 | - if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) { |
|
| 223 | + if ( isset( $args[ 'disable_output' ] ) && true === $args[ 'disable_output' ] ) { |
|
| 224 | 224 | return true; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if ( ! isset( $args['gutenberg_support'] ) || true !== $args['gutenberg_support'] ) { |
|
| 227 | + if ( ! isset( $args[ 'gutenberg_support' ] ) || true !== $args[ 'gutenberg_support' ] ) { |
|
| 228 | 228 | return true; |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | * @return string|array |
| 82 | 82 | */ |
| 83 | 83 | protected function apply_sanitize_callback( $output, $value ) { |
| 84 | - if ( isset( $output['sanitize_callback'] ) && null !== $output['sanitize_callback'] ) { |
|
| 84 | + if ( isset( $output[ 'sanitize_callback' ] ) && null !== $output[ 'sanitize_callback' ] ) { |
|
| 85 | 85 | |
| 86 | 86 | // If the sanitize_callback is invalid, return the value. |
| 87 | - if ( ! is_callable( $output['sanitize_callback'] ) ) { |
|
| 87 | + if ( ! is_callable( $output[ 'sanitize_callback' ] ) ) { |
|
| 88 | 88 | return $value; |
| 89 | 89 | } |
| 90 | - return call_user_func( $output['sanitize_callback'], $this->value ); |
|
| 90 | + return call_user_func( $output[ 'sanitize_callback' ], $this->value ); |
|
| 91 | 91 | } |
| 92 | 92 | return $value; |
| 93 | 93 | } |
@@ -100,22 +100,22 @@ discard block |
||
| 100 | 100 | * @return string|array |
| 101 | 101 | */ |
| 102 | 102 | protected function apply_value_pattern( $output, $value ) { |
| 103 | - if ( isset( $output['value_pattern'] ) && ! empty( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) { |
|
| 103 | + if ( isset( $output[ 'value_pattern' ] ) && ! empty( $output[ 'value_pattern' ] ) && is_string( $output[ 'value_pattern' ] ) ) { |
|
| 104 | 104 | if ( ! is_array( $value ) ) { |
| 105 | - $value = str_replace( '$', $value, $output['value_pattern'] ); |
|
| 105 | + $value = str_replace( '$', $value, $output[ 'value_pattern' ] ); |
|
| 106 | 106 | } |
| 107 | 107 | if ( is_array( $value ) ) { |
| 108 | 108 | foreach ( array_keys( $value ) as $value_k ) { |
| 109 | 109 | if ( ! is_string( $value[ $value_k ] ) ) { |
| 110 | 110 | continue; |
| 111 | 111 | } |
| 112 | - if ( isset( $output['choice'] ) ) { |
|
| 113 | - if ( $output['choice'] === $value_k ) { |
|
| 114 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
| 112 | + if ( isset( $output[ 'choice' ] ) ) { |
|
| 113 | + if ( $output[ 'choice' ] === $value_k ) { |
|
| 114 | + $value[ $output[ 'choice' ] ] = str_replace( '$', $value[ $output[ 'choice' ] ], $output[ 'value_pattern' ] ); |
|
| 115 | 115 | } |
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
| 118 | + $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output[ 'value_pattern' ] ); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | $value = $this->apply_pattern_replace( $output, $value ); |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | * @return string|array |
| 132 | 132 | */ |
| 133 | 133 | protected function apply_pattern_replace( $output, $value ) { |
| 134 | - if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) { |
|
| 134 | + if ( isset( $output[ 'pattern_replace' ] ) && is_array( $output[ 'pattern_replace' ] ) ) { |
|
| 135 | 135 | $option_type = ( '' !== Kirki::get_config_param( $this->config_id, 'option_type' ) ) ? Kirki::get_config_param( $this->config_id, 'option_type' ) : 'theme_mod'; |
| 136 | 136 | $option_name = Kirki::get_config_param( $this->config_id, 'option_name' ); |
| 137 | 137 | $options = array(); |
| 138 | 138 | if ( $option_name ) { |
| 139 | 139 | $options = ( 'site_option' === $option_type ) ? get_site_option( $option_name ) : get_option( $option_name ); |
| 140 | 140 | } |
| 141 | - foreach ( $output['pattern_replace'] as $search => $replace ) { |
|
| 141 | + foreach ( $output[ 'pattern_replace' ] as $search => $replace ) { |
|
| 142 | 142 | $replacement = ''; |
| 143 | 143 | switch ( $option_type ) { |
| 144 | 144 | case 'option': |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // No need to proceed this if the current value is the same as in the "exclude" value. |
| 201 | - if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) { |
|
| 202 | - foreach ( $output['exclude'] as $exclude ) { |
|
| 201 | + if ( isset( $output[ 'exclude' ] ) && is_array( $output[ 'exclude' ] ) ) { |
|
| 202 | + foreach ( $output[ 'exclude' ] as $exclude ) { |
|
| 203 | 203 | if ( is_array( $value ) ) { |
| 204 | 204 | if ( is_array( $exclude ) ) { |
| 205 | 205 | $diff1 = array_diff( $value, $exclude ); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | // If 'choice' is defined check for sub-values too. |
| 213 | 213 | // Fixes https://github.com/aristath/kirki/issues/1416. |
| 214 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison |
|
| 214 | + if ( isset( $output[ 'choice' ] ) && isset( $value[ $output[ 'choice' ] ] ) && $exclude == $value[ $output[ 'choice' ] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison |
|
| 215 | 215 | $skip = true; |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | // Apply any value patterns defined. |
| 233 | 233 | $value = $this->apply_value_pattern( $output, $value ); |
| 234 | 234 | |
| 235 | - if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
|
| 236 | - $output['element'] = array_unique( $output['element'] ); |
|
| 237 | - sort( $output['element'] ); |
|
| 238 | - $output['element'] = implode( ',', $output['element'] ); |
|
| 235 | + if ( isset( $output[ 'element' ] ) && is_array( $output[ 'element' ] ) ) { |
|
| 236 | + $output[ 'element' ] = array_unique( $output[ 'element' ] ); |
|
| 237 | + sort( $output[ 'element' ] ); |
|
| 238 | + $output[ 'element' ] = implode( ',', $output[ 'element' ] ); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $value = $this->process_value( $value, $output ); |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | if ( is_admin() && ! is_customize_preview() ) { |
| 244 | 244 | |
| 245 | 245 | // Check if this is an admin style. |
| 246 | - if ( ! isset( $output['context'] ) || ! in_array( 'editor', $output['context'] ) ) { |
|
| 246 | + if ( ! isset( $output[ 'context' ] ) || ! in_array( 'editor', $output[ 'context' ] ) ) { |
|
| 247 | 247 | continue; |
| 248 | 248 | } |
| 249 | - } elseif ( isset( $output['context'] ) && ! in_array( 'front', $output['context'] ) ) { |
|
| 249 | + } elseif ( isset( $output[ 'context' ] ) && ! in_array( 'front', $output[ 'context' ] ) ) { |
|
| 250 | 250 | |
| 251 | 251 | // Check if this is a frontend style. |
| 252 | 252 | continue; |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | * @return null |
| 266 | 266 | */ |
| 267 | 267 | protected function process_output( $output, $value ) { |
| 268 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
| 268 | + if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) { |
|
| 269 | 269 | return; |
| 270 | 270 | } |
| 271 | - $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
|
| 272 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
| 273 | - $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; |
|
| 274 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
| 271 | + $output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global'; |
|
| 272 | + $output[ 'prefix' ] = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : ''; |
|
| 273 | + $output[ 'units' ] = ( isset( $output[ 'units' ] ) ) ? $output[ 'units' ] : ''; |
|
| 274 | + $output[ 'suffix' ] = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : ''; |
|
| 275 | 275 | |
| 276 | 276 | // Properties that can accept multiple values. |
| 277 | 277 | // Useful for example for gradients where all browsers use the "background-image" property |
@@ -280,15 +280,15 @@ discard block |
||
| 280 | 280 | 'background-image', |
| 281 | 281 | 'background', |
| 282 | 282 | ); |
| 283 | - if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
|
| 284 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
| 285 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
| 283 | + if ( in_array( $output[ 'property' ], $accepts_multiple, true ) ) { |
|
| 284 | + if ( isset( $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] ) && ! is_array( $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] ) ) { |
|
| 285 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = (array) $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ]; |
|
| 286 | 286 | } |
| 287 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 287 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ][ ] = $output[ 'prefix' ] . $value . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | if ( is_string( $value ) || is_numeric( $value ) ) { |
| 291 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
| 291 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | * @return string|array |
| 328 | 328 | */ |
| 329 | 329 | protected function process_value( $value, $output ) { |
| 330 | - if ( isset( $output['property'] ) ) { |
|
| 331 | - return $this->process_property_value( $output['property'], $value ); |
|
| 330 | + if ( isset( $output[ 'property' ] ) ) { |
|
| 331 | + return $this->process_property_value( $output[ 'property' ], $value ); |
|
| 332 | 332 | } |
| 333 | 333 | return $value; |
| 334 | 334 | } |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | // Get an array of all fields. |
| 87 | 87 | $fields = Kirki::$fields; |
| 88 | 88 | foreach ( $fields as $id => $args ) { |
| 89 | - if ( ! isset( $args['css_vars'] ) || empty( $args['css_vars'] ) ) { |
|
| 89 | + if ( ! isset( $args[ 'css_vars' ] ) || empty( $args[ 'css_vars' ] ) ) { |
|
| 90 | 90 | continue; |
| 91 | 91 | } |
| 92 | - $val = Kirki_Values::get_value( $args['kirki_config'], $id ); |
|
| 93 | - foreach ( $args['css_vars'] as $css_var ) { |
|
| 94 | - if ( isset( $css_var[2] ) && is_array( $val ) && isset( $val[ $css_var[2] ] ) ) { |
|
| 95 | - $this->vars[ $css_var[0] ] = str_replace( '$', $val[ $css_var[2] ], $css_var[1] ); |
|
| 92 | + $val = Kirki_Values::get_value( $args[ 'kirki_config' ], $id ); |
|
| 93 | + foreach ( $args[ 'css_vars' ] as $css_var ) { |
|
| 94 | + if ( isset( $css_var[ 2 ] ) && is_array( $val ) && isset( $val[ $css_var[ 2 ] ] ) ) { |
|
| 95 | + $this->vars[ $css_var[ 0 ] ] = str_replace( '$', $val[ $css_var[ 2 ] ], $css_var[ 1 ] ); |
|
| 96 | 96 | } else { |
| 97 | - $this->vars[ $css_var[0] ] = str_replace( '$', $val, $css_var[1] ); |
|
| 97 | + $this->vars[ $css_var[ 0 ] ] = str_replace( '$', $val, $css_var[ 1 ] ); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | $fields = Kirki::$fields; |
| 148 | 148 | $data = array(); |
| 149 | 149 | foreach ( $fields as $field ) { |
| 150 | - if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['css_vars'] ) && ! empty( $field['css_vars'] ) ) { |
|
| 151 | - $data[] = $field; |
|
| 150 | + if ( isset( $field[ 'transport' ] ) && 'postMessage' === $field[ 'transport' ] && isset( $field[ 'css_vars' ] ) && ! empty( $field[ 'css_vars' ] ) ) { |
|
| 151 | + $data[ ] = $field; |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | wp_localize_script( 'kirki_auto_css_vars', 'kirkiCssVarFields', $data ); |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | parent::to_json(); |
| 69 | 69 | |
| 70 | 70 | // Required. |
| 71 | - $this->json['required'] = $this->required; |
|
| 71 | + $this->json[ 'required' ] = $this->required; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -89,25 +89,25 @@ discard block |
||
| 89 | 89 | $name_parts = explode( '_', str_replace( 'Kirki_', '', $class_name ) ); |
| 90 | 90 | |
| 91 | 91 | // Handle modules loading. |
| 92 | - if ( isset( $name_parts[0] ) && 'Modules' === $name_parts[0] ) { |
|
| 92 | + if ( isset( $name_parts[ 0 ] ) && 'Modules' === $name_parts[ 0 ] ) { |
|
| 93 | 93 | $path = dirname( __FILE__ ) . '/modules/'; |
| 94 | 94 | $path .= strtolower( str_replace( '_', '-', str_replace( 'Kirki_Modules_', '', $class_name ) ) ) . '/'; |
| 95 | - $paths[] = $path . $filename; |
|
| 95 | + $paths[ ] = $path . $filename; |
|
| 96 | 96 | } elseif ( 'Kirki_Fonts' === $class_name ) { |
| 97 | - $paths[] = dirname( __FILE__ ) . '/modules/webfonts/class-kirki-fonts.php'; |
|
| 97 | + $paths[ ] = dirname( __FILE__ ) . '/modules/webfonts/class-kirki-fonts.php'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if ( isset( $name_parts[0] ) ) { |
|
| 100 | + if ( isset( $name_parts[ 0 ] ) ) { |
|
| 101 | 101 | |
| 102 | 102 | // Handle controls loading. |
| 103 | - if ( 'Control' === $name_parts[0] || 'Settings' === $name_parts[0] ) { |
|
| 103 | + if ( 'Control' === $name_parts[ 0 ] || 'Settings' === $name_parts[ 0 ] ) { |
|
| 104 | 104 | $path = dirname( __FILE__ ) . '/controls/php/'; |
| 105 | - $paths[] = $path . $filename; |
|
| 105 | + $paths[ ] = $path . $filename; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $paths[] = dirname( __FILE__ ) . '/core/' . $filename; |
|
| 110 | - $paths[] = dirname( __FILE__ ) . '/lib/' . $filename; |
|
| 109 | + $paths[ ] = dirname( __FILE__ ) . '/core/' . $filename; |
|
| 110 | + $paths[ ] = dirname( __FILE__ ) . '/lib/' . $filename; |
|
| 111 | 111 | |
| 112 | 112 | $substr = str_replace( 'Kirki_', '', $class_name ); |
| 113 | 113 | $exploded = explode( '_', $substr ); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $previous_path = ''; |
| 117 | 117 | for ( $i = 0; $i < $levels; $i++ ) { |
| 118 | - $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
| 118 | + $paths[ ] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
| 119 | 119 | $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
| 120 | 120 | } |
| 121 | 121 | return $paths; |