@@ -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 | } |
@@ -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; |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | public static function css( $field ) { |
147 | 147 | |
148 | 148 | // Set class vars. |
149 | - self::$settings = $field['settings']; |
|
150 | - self::$callback = $field['sanitize_callback']; |
|
151 | - self::$field_type = $field['type']; |
|
152 | - self::$output = $field['output']; |
|
149 | + self::$settings = $field[ 'settings' ]; |
|
150 | + self::$callback = $field[ 'sanitize_callback' ]; |
|
151 | + self::$field_type = $field[ 'type' ]; |
|
152 | + self::$output = $field[ 'output' ]; |
|
153 | 153 | if ( ! is_array( self::$output ) ) { |
154 | 154 | self::$output = array( |
155 | 155 | array( |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | 'kirki-multicolor' => 'Kirki_Output_Field_Multicolor', |
173 | 173 | ); |
174 | 174 | $field_output_classes = apply_filters( 'kirki_output_control_classnames', $default_classnames ); |
175 | - $field_output_classes = apply_filters( "kirki_{$field['kirki_config']}_output_control_classnames", $field_output_classes ); |
|
175 | + $field_output_classes = apply_filters( "kirki_{$field[ 'kirki_config' ]}_output_control_classnames", $field_output_classes ); |
|
176 | 176 | if ( array_key_exists( self::$field_type, $field_output_classes ) ) { |
177 | 177 | $classname = $field_output_classes[ self::$field_type ]; |
178 | 178 | } |
179 | - $obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field ); |
|
179 | + $obj = new $classname( $field[ 'kirki_config' ], self::$output, self::$value, $field ); |
|
180 | 180 | return $obj->get_styles(); |
181 | 181 | } |
182 | 182 |