@@ -40,7 +40,8 @@ discard block |
||
| 40 | 40 | public function filterBeforeInstructions() |
| 41 | 41 | { |
| 42 | 42 | return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
| 43 | - array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) { |
|
| 43 | + array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) |
|
| 44 | + { |
|
| 44 | 45 | return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL; |
| 45 | 46 | }) |
| 46 | 47 | ); |
@@ -110,7 +111,9 @@ discard block |
||
| 110 | 111 | */ |
| 111 | 112 | public function registerFeaturedImageMetaBox() |
| 112 | 113 | { |
| 113 | - if( !current_user_can( 'upload_files' ))return; |
|
| 114 | + if( !current_user_can( 'upload_files' )) { |
|
| 115 | + return; |
|
| 116 | + } |
|
| 114 | 117 | add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
| 115 | 118 | } |
| 116 | 119 | |
@@ -186,7 +189,9 @@ discard block |
||
| 186 | 189 | public function renderPage() |
| 187 | 190 | { |
| 188 | 191 | $type = $this->getPostType(); |
| 189 | - if( empty( $type ))return; |
|
| 192 | + if( empty( $type )) { |
|
| 193 | + return; |
|
| 194 | + } |
|
| 190 | 195 | $labels = get_post_type_labels( get_post_type_object( $type )); |
| 191 | 196 | $this->app->render( 'archive/index', [ |
| 192 | 197 | 'columns' => get_current_screen()->get_columns(), |
@@ -223,7 +228,8 @@ discard block |
||
| 223 | 228 | */ |
| 224 | 229 | protected function getPostTypesWithArchive() |
| 225 | 230 | { |
| 226 | - $types = array_map( function( $value ) { |
|
| 231 | + $types = array_map( function( $value ) |
|
| 232 | + { |
|
| 227 | 233 | return sprintf( 'edit.php?post_type=%s', $value ); |
| 228 | 234 | }, get_post_types( ['has_archive' => 1] )); |
| 229 | 235 | return array_merge( $types, ['post' => 'edit.php'] ); |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function init() |
| 43 | 43 | { |
| 44 | - if( empty( $this->app->config[static::ID] ))return; |
|
| 44 | + if( empty( $this->app->config[static::ID] )) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | if( is_bool( $this->app->config[static::ID] )) { |
| 46 | 48 | $this->app->config[static::ID] = []; |
| 47 | 49 | } |
@@ -126,7 +128,9 @@ discard block |
||
| 126 | 128 | */ |
| 127 | 129 | public function register() |
| 128 | 130 | { |
| 129 | - if(( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
| 131 | + if(( new Helper )->getCurrentScreen()->id != $this->hook ) { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 130 | 134 | foreach( parent::register() as $metabox ) { |
| 131 | 135 | new RWMetaBox( $metabox, static::ID, $this ); |
| 132 | 136 | } |
@@ -169,7 +173,9 @@ discard block |
||
| 169 | 173 | */ |
| 170 | 174 | public function renderFooterScript() |
| 171 | 175 | { |
| 172 | - if(( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
| 176 | + if(( new Helper )->getCurrentScreen()->id != $this->hook ) { |
|
| 177 | + return; |
|
| 178 | + } |
|
| 173 | 179 | $this->app->render( 'settings/script', [ |
| 174 | 180 | 'confirm' => __( 'Are you sure want to do this?', 'pollux' ), |
| 175 | 181 | 'hook' => $this->hook, |
@@ -217,7 +223,9 @@ discard block |
||
| 217 | 223 | { |
| 218 | 224 | if( filter_input( INPUT_GET, 'page' ) !== static::id() |
| 219 | 225 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
| 220 | - )return; |
|
| 226 | + ) { |
|
| 227 | + return; |
|
| 228 | + } |
|
| 221 | 229 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
| 222 | 230 | update_option( static::id(), $this->getDefaults() ); |
| 223 | 231 | add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' ); |
@@ -236,7 +244,8 @@ discard block |
||
| 236 | 244 | */ |
| 237 | 245 | protected function filterArrayByKey( array $array, $key ) |
| 238 | 246 | { |
| 239 | - return array_filter( $array, function( $value ) use( $key ) { |
|
| 247 | + return array_filter( $array, function( $value ) use( $key ) |
|
| 248 | + { |
|
| 240 | 249 | return !empty( $value[$key] ); |
| 241 | 250 | }); |
| 242 | 251 | } |
@@ -248,8 +257,10 @@ discard block |
||
| 248 | 257 | { |
| 249 | 258 | $metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' ); |
| 250 | 259 | |
| 251 | - array_walk( $metaboxes, function( &$metabox ) { |
|
| 252 | - $fields = array_map( function( $field ) { |
|
| 260 | + array_walk( $metaboxes, function( &$metabox ) |
|
| 261 | + { |
|
| 262 | + $fields = array_map( function( $field ) |
|
| 263 | + { |
|
| 253 | 264 | $field = wp_parse_args( $field, ['std' => ''] ); |
| 254 | 265 | return [$field['slug'] => $field['std']]; |
| 255 | 266 | }, $this->filterArrayByKey( $metabox['fields'], 'slug' )); |