@@ -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'] ); |
@@ -172,9 +172,9 @@ |
||
| 172 | 172 | * If no callback is defined (false) then just get the value. |
| 173 | 173 | */ |
| 174 | 174 | if ( $variable_callback ) { |
| 175 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
| 175 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
| 176 | 176 | } else { |
| 177 | - $variables[ $variable_name ] = Kirki::get_option( $field['settings'] ); |
|
| 177 | + $variables[$variable_name] = Kirki::get_option( $field['settings'] ); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // Check if the color is a standard word-color. |
| 186 | 186 | // If it is, then convert to hex. |
| 187 | 187 | if ( array_key_exists( $color, $word_colors ) ) { |
| 188 | - $color = $word_colors[ $color ]; |
|
| 188 | + $color = $word_colors[$color]; |
|
| 189 | 189 | } |
| 190 | 190 | // Remove any trailing '#' symbols from the color value |
| 191 | 191 | $color = str_replace( '#', '', $color ); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | $substr = array(); |
| 197 | 197 | for ( $i = 0; $i <= 5; $i++ ) { |
| 198 | - $default = ( 0 == $i ) ? 'F' : ( $substr[$i-1] ); |
|
| 198 | + $default = ( 0 == $i ) ? 'F' : ( $substr[$i - 1] ); |
|
| 199 | 199 | $substr[$i] = substr( $color, $i, 1 ); |
| 200 | 200 | $substr[$i] = ( false === $substr[$i] || ! ctype_xdigit( $substr[$i] ) ) ? $default : $substr[$i]; |
| 201 | 201 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | 'left' => esc_attr__( 'Left', 'kirki' ), |
| 103 | 103 | 'right' => esc_attr__( 'Right', 'kirki' ), |
| 104 | 104 | 'color' => esc_attr__( 'Color', 'kirki' ), |
| 105 | - 'add-image' => esc_attr__( 'Add Image' , 'kirki' ), |
|
| 106 | - 'change-image' => esc_attr__( 'Change Image' , 'kirki' ), |
|
| 107 | - 'remove' => esc_attr__( 'Remove' , 'kirki' ), |
|
| 105 | + 'add-image' => esc_attr__( 'Add Image', 'kirki' ), |
|
| 106 | + 'change-image' => esc_attr__( 'Change Image', 'kirki' ), |
|
| 107 | + 'remove' => esc_attr__( 'Remove', 'kirki' ), |
|
| 108 | 108 | 'no-image-selected' => esc_attr__( 'No Image Selected', 'kirki' ), |
| 109 | 109 | ); |
| 110 | 110 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public static function clean_file_path( $path ) { |
| 148 | 148 | $path = str_replace( '', '', str_replace( array( "\\", "\\\\" ), '/', $path ) ); |
| 149 | - if ( '/' === $path[ strlen( $path ) - 1 ] ) { |
|
| 149 | + if ( '/' === $path[strlen( $path ) - 1] ) { |
|
| 150 | 150 | $path = rtrim( $path, '/' ); |
| 151 | 151 | } |
| 152 | 152 | return $path; |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The main Kirki object |
|
| 4 | - * |
|
| 5 | - * @package Kirki |
|
| 6 | - * @category Core |
|
| 7 | - * @author Aristeides Stathopoulos |
|
| 8 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 9 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | - * @since 1.0 |
|
| 11 | - */ |
|
| 3 | + * The main Kirki object |
|
| 4 | + * |
|
| 5 | + * @package Kirki |
|
| 6 | + * @category Core |
|
| 7 | + * @author Aristeides Stathopoulos |
|
| 8 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 9 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | + * @since 1.0 |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Kirki |
|
| 4 | - * @subpackage Controls |
|
| 5 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 6 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 7 | - * @since 1.0 |
|
| 8 | - */ |
|
| 3 | + * @package Kirki |
|
| 4 | + * @subpackage Controls |
|
| 5 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 6 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 7 | + * @since 1.0 |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | // Exit if accessed directly |
| 11 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Enqueue the scripts that are required by the customizer. |
|
| 4 | - * Any additional scripts that are required by individual controls |
|
| 5 | - * are enqueued in the control classes themselves. |
|
| 6 | - * |
|
| 7 | - * @package Kirki |
|
| 8 | - * @category Core |
|
| 9 | - * @author Aristeides Stathopoulos |
|
| 10 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 11 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 12 | - * @since 1.0 |
|
| 13 | - */ |
|
| 3 | + * Enqueue the scripts that are required by the customizer. |
|
| 4 | + * Any additional scripts that are required by individual controls |
|
| 5 | + * are enqueued in the control classes themselves. |
|
| 6 | + * |
|
| 7 | + * @package Kirki |
|
| 8 | + * @category Core |
|
| 9 | + * @author Aristeides Stathopoulos |
|
| 10 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 11 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 12 | + * @since 1.0 |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly |
| 16 | 16 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Additional sanitization methods for controls. |
|
| 4 | - * These are used in the field's 'sanitize_callback' argument. |
|
| 5 | - * |
|
| 6 | - * @package Kirki |
|
| 7 | - * @category Core |
|
| 8 | - * @author Aristeides Stathopoulos |
|
| 9 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 10 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | - * @since 1.0 |
|
| 12 | - */ |
|
| 3 | + * Additional sanitization methods for controls. |
|
| 4 | + * These are used in the field's 'sanitize_callback' argument. |
|
| 5 | + * |
|
| 6 | + * @package Kirki |
|
| 7 | + * @category Core |
|
| 8 | + * @author Aristeides Stathopoulos |
|
| 9 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 10 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 11 | + * @since 1.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Instantiates all other needed scripts. |
|
| 4 | - * |
|
| 5 | - * @package Kirki |
|
| 6 | - * @category Core |
|
| 7 | - * @author Aristeides Stathopoulos |
|
| 8 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 9 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | - * @since 1.0 |
|
| 11 | - */ |
|
| 3 | + * Instantiates all other needed scripts. |
|
| 4 | + * |
|
| 5 | + * @package Kirki |
|
| 6 | + * @category Core |
|
| 7 | + * @author Aristeides Stathopoulos |
|
| 8 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 9 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 10 | + * @since 1.0 |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Checkbox Customizer Control. |
|
| 4 | - * |
|
| 5 | - * @package Kirki |
|
| 6 | - * @subpackage Controls |
|
| 7 | - * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * Checkbox Customizer Control. |
|
| 4 | + * |
|
| 5 | + * @package Kirki |
|
| 6 | + * @subpackage Controls |
|
| 7 | + * @copyright Copyright (c) 2016, Aristeides Stathopoulos |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.0 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |