@@ -55,8 +55,11 @@ |
||
| 55 | 55 | <a class="install-now button-primary button" data-slug="kirki" href="<?php echo esc_url_raw( $plugin_install_url ); ?>" aria-label="<?php esc_attr_e( 'Install Kirki Toolkit now', 'textdomain' ); ?>" data-name="Kirki Toolkit"> |
| 56 | 56 | <?php esc_html_e( 'Install Now', 'textdomain' ); ?> |
| 57 | 57 | </a> |
| 58 | - <?php else : ?> |
|
| 59 | - <p style="text-align:left;margin-top:0;"><?php esc_attr_e( 'You have installed Kirki. Activate it to take advantage of this theme\'s features in the customizer.', 'textdomain' ); ?></p> |
|
| 58 | + <?php else { |
|
| 59 | + : ?> |
|
| 60 | + <p style="text-align:left;margin-top:0;"><?php esc_attr_e( 'You have installed Kirki. Activate it to take advantage of this theme\'s features in the customizer.', 'textdomain' ); |
|
| 61 | +} |
|
| 62 | +?></p> |
|
| 60 | 63 | <a class="install-now button-secondary button change-theme" data-slug="kirki" href="<?php echo esc_url_raw( self_admin_url( 'plugins.php' ) ); ?>" aria-label="<?php esc_attr_e( 'Activate Kirki Toolkit now', 'textdomain' ); ?>" data-name="Kirki Toolkit"> |
| 61 | 64 | <?php esc_html_e( 'Activate Now', 'textdomain' ); ?> |
| 62 | 65 | </a> |
@@ -59,22 +59,22 @@ discard block |
||
| 59 | 59 | // Kirki does not exist, continue with our custom implementation. |
| 60 | 60 | // Get the default value of the field |
| 61 | 61 | $default = ''; |
| 62 | - if ( isset( self::$fields[ $field_id ] ) && isset( self::$fields[ $field_id ]['default'] ) ) { |
|
| 63 | - $default = self::$fields[ $field_id ]['default']; |
|
| 62 | + if ( isset( self::$fields[$field_id] ) && isset( self::$fields[$field_id]['default'] ) ) { |
|
| 63 | + $default = self::$fields[$field_id]['default']; |
|
| 64 | 64 | } |
| 65 | 65 | // Make sure the config is defined |
| 66 | - if ( isset( self::$config[ $config_id ] ) ) { |
|
| 67 | - if ( 'option' == self::$config[ $config_id ]['option_type'] ) { |
|
| 66 | + if ( isset( self::$config[$config_id] ) ) { |
|
| 67 | + if ( 'option' == self::$config[$config_id]['option_type'] ) { |
|
| 68 | 68 | // check if we're using serialized options |
| 69 | - if ( isset( self::$config[ $config_id ]['option_name'] ) && ! empty( self::$config[ $config_id ]['option_name'] ) ) { |
|
| 69 | + if ( isset( self::$config[$config_id]['option_name'] ) && ! empty( self::$config[$config_id]['option_name'] ) ) { |
|
| 70 | 70 | // Get all our options |
| 71 | - $all_options = get_option( self::$config[ $config_id ]['option_name'], array() ); |
|
| 71 | + $all_options = get_option( self::$config[$config_id]['option_name'], array() ); |
|
| 72 | 72 | // If our option is not saved, return the default value. |
| 73 | - if ( ! isset( $all_options[ $field_id ] ) ) { |
|
| 73 | + if ( ! isset( $all_options[$field_id] ) ) { |
|
| 74 | 74 | return $default; |
| 75 | 75 | } |
| 76 | 76 | // Option was set, return its value unserialized. |
| 77 | - return maybe_unserialize( $all_options[ $field_id ] ); |
|
| 77 | + return maybe_unserialize( $all_options[$field_id] ); |
|
| 78 | 78 | } |
| 79 | 79 | // If we're not using serialized options, get the value and return it. |
| 80 | 80 | // We'll be using a dummy default here to check if the option has been set or not. |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | // Kirki does not exist, set the config arguments |
| 135 | - $config[ $config_id ] = $args; |
|
| 135 | + $config[$config_id] = $args; |
|
| 136 | 136 | // Make sure an option_type is defined |
| 137 | - if ( ! isset( self::$config[ $config_id ]['option_type'] ) ) { |
|
| 138 | - self::$config[ $config_id ]['option_type'] = 'theme_mod'; |
|
| 137 | + if ( ! isset( self::$config[$config_id]['option_type'] ) ) { |
|
| 138 | + self::$config[$config_id]['option_type'] = 'theme_mod'; |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | if ( ! isset( $args['kirki_config'] ) ) { |
| 160 | 160 | $args['kirki_config'] = $config_id; |
| 161 | 161 | } |
| 162 | - self::$fields[ $args['settings'] ] = $args; |
|
| 162 | + self::$fields[$args['settings']] = $args; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | if ( ! is_array( $value ) ) { |
| 228 | 228 | $value = str_replace( '$', $value, $output['value_pattern'] ); |
| 229 | 229 | if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) ) { |
| 230 | - $css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 230 | + $css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 231 | 231 | } |
| 232 | 232 | } else { |
| 233 | 233 | if ( 'typography' == $field['type'] ) { |
@@ -238,25 +238,25 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | // add double quotes if needed to font-families |
| 240 | 240 | if ( 'font-family' == $key && false !== strpos( $subvalue, ' ' ) && false === strpos( $subvalue, '"' ) ) { |
| 241 | - $css[ $output['media_query'] ][ $output['element'] ]['font-family'] = '"' . $subvalue . '"'; |
|
| 241 | + $css[$output['media_query']][$output['element']]['font-family'] = '"' . $subvalue . '"'; |
|
| 242 | 242 | } |
| 243 | 243 | // variants contain both font-weight & italics |
| 244 | 244 | if ( 'variant' == $key ) { |
| 245 | 245 | $font_weight = str_replace( 'italic', '', $subvalue ); |
| 246 | 246 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight; |
| 247 | - $css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
| 247 | + $css[$output['media_query']][$output['element']]['font-weight'] = $font_weight; |
|
| 248 | 248 | // Is this italic? |
| 249 | 249 | $is_italic = ( false !== strpos( $subvalue, 'italic' ) ); |
| 250 | 250 | if ( $is_italic ) { |
| 251 | - $css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
| 251 | + $css[$output['media_query']][$output['element']]['font-style'] = 'italic'; |
|
| 252 | 252 | } |
| 253 | 253 | } else { |
| 254 | - $css[ $output['media_query'] ][ $output['element'] ][ $key ] = $subvalue; |
|
| 254 | + $css[$output['media_query']][$output['element']][$key] = $subvalue; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | } elseif ( 'multicolor' == $field['type'] ) { |
| 258 | 258 | if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) { |
| 259 | - $css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix']; |
|
| 259 | + $css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value[$output['choice']] . $output['units'] . $output['suffix']; |
|
| 260 | 260 | } |
| 261 | 261 | } else { |
| 262 | 262 | foreach ( $value as $key => $subvalue ) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $subvalue = 'url("' . $subvalue . '")'; |
| 271 | 271 | } |
| 272 | 272 | if ( $subvalue ) { |
| 273 | - $css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue; |
|
| 273 | + $css[$output['media_query']][$output['element']][$property] = $subvalue; |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -340,7 +340,8 @@ |
||
| 340 | 340 | $key = md5( $value['font-family'] . $value['variant'] . $value['subset'] ); |
| 341 | 341 | // check that the URL is valid. we're going to use transients to make this faster. |
| 342 | 342 | $url_is_valid = get_transient( $key ); |
| 343 | - if ( false === $url_is_valid ) { // transient does not exist |
|
| 343 | + if ( false === $url_is_valid ) { |
|
| 344 | +// transient does not exist |
|
| 344 | 345 | $response = wp_remote_get( 'https:' . $url ); |
| 345 | 346 | if ( ! is_array( $response ) ) { |
| 346 | 347 | // the url was not properly formatted, |