@@ -65,7 +65,9 @@ |
||
65 | 65 | trailingslashit( dirname( ABSPATH )), |
66 | 66 | ]); |
67 | 67 | foreach( (array) $configLocations as $location ) { |
68 | - if( !file_exists( $location . $configYaml ))continue; |
|
68 | + if( !file_exists( $location . $configYaml )) { |
|
69 | + continue; |
|
70 | + } |
|
69 | 71 | return $location . $configYaml; |
70 | 72 | } |
71 | 73 | return $this->app->path( 'defaults.yml' ); |
@@ -105,7 +105,9 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function register( $metaboxes = [] ) |
107 | 107 | { |
108 | - if( get_current_screen()->id != $this->hook )return; |
|
108 | + if( get_current_screen()->id != $this->hook ) { |
|
109 | + return; |
|
110 | + } |
|
109 | 111 | foreach( parent::register() as $metabox ) { |
110 | 112 | new SettingsMetaBox( $metabox ); |
111 | 113 | } |
@@ -172,7 +174,9 @@ discard block |
||
172 | 174 | { |
173 | 175 | if( filter_input( INPUT_GET, 'page' ) !== static::ID |
174 | 176 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
175 | - )return; |
|
177 | + ) { |
|
178 | + return; |
|
179 | + } |
|
176 | 180 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
177 | 181 | update_option( static::ID, $this->getDefaults() ); |
178 | 182 | return add_settings_error( static::ID, 'reset', __( 'Settings reset to defaults.', 'pollux' ), 'updated' ); |
@@ -186,7 +190,8 @@ discard block |
||
186 | 190 | */ |
187 | 191 | protected function filterArrayByKey( array $array, $key ) |
188 | 192 | { |
189 | - return array_filter( $array, function( $value ) use( $key ) { |
|
193 | + return array_filter( $array, function( $value ) use( $key ) |
|
194 | + { |
|
190 | 195 | return !empty( $value[$key] ); |
191 | 196 | }); |
192 | 197 | } |
@@ -198,8 +203,10 @@ discard block |
||
198 | 203 | { |
199 | 204 | $metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' ); |
200 | 205 | |
201 | - array_walk( $metaboxes, function( &$metabox ) { |
|
202 | - $fields = array_map( function( $field ) { |
|
206 | + array_walk( $metaboxes, function( &$metabox ) |
|
207 | + { |
|
208 | + $fields = array_map( function( $field ) |
|
209 | + { |
|
203 | 210 | $field = wp_parse_args( $field, ['std' => ''] ); |
204 | 211 | return [$field['slug'] => $field['std']]; |
205 | 212 | }, $this->filterArrayByKey( $metabox['fields'], 'slug' )); |