Completed
Branch develop (288e61)
by Aristeides
02:45
created
includes/class-kirki-values.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'] );
Please login to merge, or discard this patch.
includes/class-kirki-init.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,9 +172,9 @@
 block discarded – undo
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
 						}
Please login to merge, or discard this patch.
includes/class-kirki-customize-control.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
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' ) ) {
Please login to merge, or discard this patch.
includes/class-kirki-enqueue.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
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' ) ) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 					'family'       => $value['stack'],
75 75
 					'label'        => $value['label'],
76 76
 					'variants'     => array(
77
-						array( 'id' => 'regular',   'label' => $all_variants['regular'] ),
78
-						array( 'id' => 'italic',    'label' => $all_variants['italic'] ),
79
-						array( 'id' => '700',       'label' => $all_variants['700'] ),
77
+						array( 'id' => 'regular', 'label' => $all_variants['regular'] ),
78
+						array( 'id' => 'italic', 'label' => $all_variants['italic'] ),
79
+						array( 'id' => '700', 'label' => $all_variants['700'] ),
80 80
 						array( 'id' => '700italic', 'label' => $all_variants['700italic'] ),
81 81
 					),
82 82
 					'subsets'      => array(),
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 				$available_variants = array();
94 94
 				foreach ( $variants as $variant ) {
95 95
 					if ( array_key_exists( $variant, $all_variants ) ) {
96
-						$available_variants[] = array( 'id' => $variant, 'label' => $all_variants[ $variant ] );
96
+						$available_variants[] = array( 'id' => $variant, 'label' => $all_variants[$variant] );
97 97
 					}
98 98
 				}
99 99
 
100 100
 				$available_subsets = array();
101 101
 				foreach ( $subsets as $subset ) {
102 102
 					if ( array_key_exists( $subset, $all_subsets ) ) {
103
-						$available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[ $subset ] );
103
+						$available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[$subset] );
104 104
 					}
105 105
 				}
106 106
 
Please login to merge, or discard this patch.
includes/class-kirki-helper.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Helper methods
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
+	 * Helper methods
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' ) ) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 			}
28 28
 			$count = count( $args );
29 29
 			for ( $i = 1; $i < $count; $i++ ) {
30
-				if ( is_array( $args[ $i ] ) ) {
31
-					$array = self::recurse( $array, $args[ $i ] );
30
+				if ( is_array( $args[$i] ) ) {
31
+					$array = self::recurse( $array, $args[$i] );
32 32
 				}
33 33
 			}
34 34
 			return $array;
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 		public static function recurse( $array, $array1 ) {
38 38
 			foreach ( $array1 as $key => $value ) {
39 39
 				// create new key in $array, if it is empty or not an array
40
-				if ( ! isset( $array[ $key ] ) || ( isset( $array[ $key ] ) && ! is_array( $array[ $key ] ) ) ) {
41
-					$array[ $key ] = array();
40
+				if ( ! isset( $array[$key] ) || ( isset( $array[$key] ) && ! is_array( $array[$key] ) ) ) {
41
+					$array[$key] = array();
42 42
 				}
43 43
 
44 44
 				// overwrite the value in the base array
45 45
 				if ( is_array( $value ) ) {
46
-					$value = self::recurse( $array[ $key ], $value );
46
+					$value = self::recurse( $array[$key], $value );
47 47
 				}
48
-				$array[ $key ] = $value;
48
+				$array[$key] = $value;
49 49
 			}
50 50
 			return $array;
51 51
 		}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			// properly format the array.
103 103
 			$items = array();
104 104
 			foreach ( $posts as $post ) {
105
-				$items[ $post->ID ] = $post->post_title;
105
+				$items[$post->ID] = $post->post_title;
106 106
 			}
107 107
 
108 108
 			return $items;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			foreach ( $taxonomies as $taxonomy ) {
120 120
 				$id           = $taxonomy;
121 121
 				$taxonomy     = get_taxonomy( $taxonomy );
122
-				$items[ $id ] = $taxonomy->labels->name;
122
+				$items[$id] = $taxonomy->labels->name;
123 123
 			}
124 124
 
125 125
 			return $items;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 			$post_types = get_post_types( array( 'public' => true ), 'objects' );
135 135
 			// Build the array
136 136
 			foreach ( $post_types as $post_type ) {
137
-				$items[ $post_type->name ] = $post_type->labels->name;
137
+				$items[$post_type->name] = $post_type->labels->name;
138 138
 			}
139 139
 
140 140
 			return $items;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 			$terms = get_terms( $taxonomies );
150 150
 			// Build the array
151 151
 			foreach ( $terms as $term ) {
152
-				$items[ $term->term_id ] = $term->name;
152
+				$items[$term->term_id] = $term->name;
153 153
 			}
154 154
 
155 155
 			return $items;
Please login to merge, or discard this patch.
includes/class-kirki-scripts-registry.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
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' ) ) {
Please login to merge, or discard this patch.
includes/controls/class-kirki-controls-checkbox-control.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
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' ) ) {
Please login to merge, or discard this patch.
includes/controls/class-kirki-controls-code-control.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * code Customizer Control.
4
- *
5
- * Creates a new custom control.
6
- * Custom controls accept raw HTML/JS.
7
- *
8
- * @package     Kirki
9
- * @subpackage  Controls
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
+	 * code Customizer Control.
4
+	 *
5
+	 * Creates a new custom control.
6
+	 * Custom controls accept raw HTML/JS.
7
+	 *
8
+	 * @package     Kirki
9
+	 * @subpackage  Controls
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' ) ) {
Please login to merge, or discard this patch.
includes/controls/class-kirki-controls-color-alpha-control.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * color-alpha 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
+	 * color-alpha 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' ) ) {
Please login to merge, or discard this patch.