@@ -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'] ); |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function filterWordPressFooter( $text ) |
| 42 | 42 | { |
| 43 | - if( $this->app->config->remove_wordpress_footer )return; |
|
| 43 | + if( $this->app->config->remove_wordpress_footer ) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 44 | 46 | return $text; |
| 45 | 47 | } |
| 46 | 48 | |
@@ -79,7 +81,9 @@ discard block |
||
| 79 | 81 | */ |
| 80 | 82 | public function removeDashboardWidgets() |
| 81 | 83 | { |
| 82 | - if( !$this->app->config->remove_dashboard_widgets )return; |
|
| 84 | + if( !$this->app->config->remove_dashboard_widgets ) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 83 | 87 | $widgets = apply_filters( 'pollux/dashoard/widgets', [ |
| 84 | 88 | 'dashboard_quick_press', |
| 85 | 89 | ]); |
@@ -94,7 +98,9 @@ discard block |
||
| 94 | 98 | */ |
| 95 | 99 | public function removeWordPressMenu() |
| 96 | 100 | { |
| 97 | - if( !$this->app->config->remove_wordpress_menu )return; |
|
| 101 | + if( !$this->app->config->remove_wordpress_menu ) { |
|
| 102 | + return; |
|
| 103 | + } |
|
| 98 | 104 | global $wp_admin_bar; |
| 99 | 105 | $wp_admin_bar->remove_menu( 'wp-logo' ); |
| 100 | 106 | } |
@@ -144,7 +150,8 @@ discard block |
||
| 144 | 150 | && $screen->pagenow == 'options-general.php' |
| 145 | 151 | && $this->app->gatekeeper->hasPendingDependencies() ) { |
| 146 | 152 | wp_enqueue_script( 'updates' ); |
| 147 | - add_filter( 'pollux/enqueue/js/localize/variables', function( $vars ) { |
|
| 153 | + add_filter( 'pollux/enqueue/js/localize/variables', function( $vars ) |
|
| 154 | + { |
|
| 148 | 155 | $vars['l10n'] = [ |
| 149 | 156 | 'pluginActivatingLabel' => __( 'Activating %s...', 'pollux' ), |
| 150 | 157 | 'pluginActivatedLabel' => __( '%s activated!', 'pollux' ), |
@@ -38,7 +38,9 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function init() |
| 40 | 40 | { |
| 41 | - if( !$this->canProceed() )return; |
|
| 41 | + if( !$this->canProceed() ) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | $this->normalize( $this->app->config->{static::ID} ); |
| 44 | 46 | |
@@ -123,7 +125,9 @@ discard block |
||
| 123 | 125 | */ |
| 124 | 126 | public function register() |
| 125 | 127 | { |
| 126 | - if(( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
| 128 | + if(( new Helper )->getCurrentScreen()->id != $this->hook ) { |
|
| 129 | + return; |
|
| 130 | + } |
|
| 127 | 131 | if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY )) { |
| 128 | 132 | foreach( parent::register() as $metabox ) { |
| 129 | 133 | new RWMetaBox( $metabox, static::ID, $this ); |
@@ -168,7 +172,9 @@ discard block |
||
| 168 | 172 | */ |
| 169 | 173 | public function renderFooterScript() |
| 170 | 174 | { |
| 171 | - if(( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
| 175 | + if(( new Helper )->getCurrentScreen()->id != $this->hook ) { |
|
| 176 | + return; |
|
| 177 | + } |
|
| 172 | 178 | $this->app->render( 'settings/script', [ |
| 173 | 179 | 'confirm' => __( 'Are you sure want to do this?', 'pollux' ), |
| 174 | 180 | 'hook' => $this->hook, |
@@ -216,7 +222,9 @@ discard block |
||
| 216 | 222 | { |
| 217 | 223 | if( filter_input( INPUT_GET, 'page' ) !== static::id() |
| 218 | 224 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
| 219 | - )return; |
|
| 225 | + ) { |
|
| 226 | + return; |
|
| 227 | + } |
|
| 220 | 228 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
| 221 | 229 | update_option( static::id(), $this->getDefaults() ); |
| 222 | 230 | add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' ); |
@@ -235,7 +243,8 @@ discard block |
||
| 235 | 243 | */ |
| 236 | 244 | protected function filterArrayByKey( array $array, $key ) |
| 237 | 245 | { |
| 238 | - return array_filter( $array, function( $value ) use( $key ) { |
|
| 246 | + return array_filter( $array, function( $value ) use( $key ) |
|
| 247 | + { |
|
| 239 | 248 | return !empty( $value[$key] ); |
| 240 | 249 | }); |
| 241 | 250 | } |
@@ -247,8 +256,10 @@ discard block |
||
| 247 | 256 | { |
| 248 | 257 | $metaboxes = $this->filterArrayByKey( $this->metaboxes, 'slug' ); |
| 249 | 258 | |
| 250 | - array_walk( $metaboxes, function( &$metabox ) { |
|
| 251 | - $fields = array_map( function( $field ) { |
|
| 259 | + array_walk( $metaboxes, function( &$metabox ) |
|
| 260 | + { |
|
| 261 | + $fields = array_map( function( $field ) |
|
| 262 | + { |
|
| 252 | 263 | $field = wp_parse_args( $field, ['std' => ''] ); |
| 253 | 264 | return [$field['slug'] => $field['std']]; |
| 254 | 265 | }, $this->filterArrayByKey( $metabox['fields'], 'slug' )); |
@@ -72,7 +72,8 @@ discard block |
||
| 72 | 72 | 'href' => '', |
| 73 | 73 | ]); |
| 74 | 74 | $atts['class'] = trim( $atts['class'] . ' button button-small' ); |
| 75 | - $attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use( $atts ) { |
|
| 75 | + $attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use( $atts ) |
|
| 76 | + { |
|
| 76 | 77 | return $carry . sprintf( ' %s="%s"', $key, $atts[$key] ); |
| 77 | 78 | }); |
| 78 | 79 | return sprintf( '<a%s>%s</a>', $attributes, $title ); |
@@ -151,7 +152,9 @@ discard block |
||
| 151 | 152 | protected function buildMessage( array $messages ) |
| 152 | 153 | { |
| 153 | 154 | foreach( $messages as $key => &$message ) { |
| 154 | - if( !is_wp_error( $message ))continue; |
|
| 155 | + if( !is_wp_error( $message )) { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 155 | 158 | $message = $message->get_error_message(); |
| 156 | 159 | } |
| 157 | 160 | return wpautop( implode( PHP_EOL . PHP_EOL, $messages )); |
@@ -126,7 +126,9 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function getDependencyAction() |
| 128 | 128 | { |
| 129 | - if( get_current_screen()->id != 'settings_page_pollux' )return; |
|
| 129 | + if( get_current_screen()->id != 'settings_page_pollux' ) { |
|
| 130 | + return; |
|
| 131 | + } |
|
| 130 | 132 | |
| 131 | 133 | $action = filter_input( INPUT_GET, 'action' ); |
| 132 | 134 | $plugin = filter_input( INPUT_GET, 'plugin' ); |
@@ -241,7 +243,9 @@ discard block |
||
| 241 | 243 | public function hasPendingDependencies() |
| 242 | 244 | { |
| 243 | 245 | foreach( static::DEPENDENCIES as $plugin => $data ) { |
| 244 | - if( !$this->isPluginDependency( $plugin ))continue; |
|
| 246 | + if( !$this->isPluginDependency( $plugin )) { |
|
| 247 | + continue; |
|
| 248 | + } |
|
| 245 | 249 | $this->isPluginActive( $plugin ); |
| 246 | 250 | $this->isPluginVersionValid( $plugin ); |
| 247 | 251 | } |
@@ -256,7 +260,9 @@ discard block |
||
| 256 | 260 | if( get_current_screen()->id != 'settings_page_pollux' |
| 257 | 261 | || $this->app->config->disable_config |
| 258 | 262 | || !$this->hasPendingDependencies() |
| 259 | - )return; |
|
| 263 | + ) { |
|
| 264 | + return; |
|
| 265 | + } |
|
| 260 | 266 | |
| 261 | 267 | $plugins = ''; |
| 262 | 268 | $actions = ''; |