@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function init() |
| 46 | 46 | { |
| 47 | - if( empty( $this->app->config->post_types ))return; |
|
| 47 | + if( empty($this->app->config->post_types) )return; |
|
| 48 | 48 | |
| 49 | 49 | $this->setColumns(); |
| 50 | 50 | $this->normalize(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | get_post_types( ['_builtin' => true] ) |
| 65 | 65 | ); |
| 66 | 66 | array_walk( $types, function( $args, $type ) { |
| 67 | - register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
|
| 67 | + register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ) ) ); |
|
| 68 | 68 | }); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function normalizeLabels( $labels, array $args ) |
| 89 | 89 | { |
| 90 | - return wp_parse_args( $labels, $this->setLabels( $args )); |
|
| 90 | + return wp_parse_args( $labels, $this->setLabels( $args ) ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected function normalizeMenuName( $menuname, array $args ) |
| 98 | 98 | { |
| 99 | - return empty( $menuname ) |
|
| 99 | + return empty($menuname) |
|
| 100 | 100 | ? $args['plural'] |
| 101 | 101 | : $menuname; |
| 102 | 102 | } |
@@ -102,11 +102,11 @@ |
||
| 102 | 102 | */ |
| 103 | 103 | protected static function resolveFacadeInstance( $name ) |
| 104 | 104 | { |
| 105 | - if( is_object( $name )) { |
|
| 105 | + if( is_object( $name ) ) { |
|
| 106 | 106 | return $name; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if( isset( static::$resolvedInstance[$name] )) { |
|
| 109 | + if( isset(static::$resolvedInstance[$name]) ) { |
|
| 110 | 110 | return static::$resolvedInstance[$name]; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function getInstance() |
| 39 | 39 | { |
| 40 | - if( is_null( static::$instance )) { |
|
| 40 | + if( is_null( static::$instance ) ) { |
|
| 41 | 41 | static::$instance = new static; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function make( $abstract ) |
| 70 | 70 | { |
| 71 | - $service = isset( $this->services[$abstract] ) |
|
| 71 | + $service = isset($this->services[$abstract]) |
|
| 72 | 72 | ? $this->services[$abstract] |
| 73 | 73 | : $this->addNamespace( $abstract ); |
| 74 | 74 | |
| 75 | - if( is_callable( $service )) { |
|
| 75 | + if( is_callable( $service ) ) { |
|
| 76 | 76 | return call_user_func_array( $service, [$this] ); |
| 77 | 77 | } |
| 78 | - if( is_object( $service )) { |
|
| 78 | + if( is_object( $service ) ) { |
|
| 79 | 79 | return $service; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function singleton( $abstract, $concrete ) |
| 94 | 94 | { |
| 95 | - $this->bind( $abstract, $this->make( $concrete )); |
|
| 95 | + $this->bind( $abstract, $this->make( $concrete ) ); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function __get( $item ) |
| 106 | 106 | { |
| 107 | - return isset( $this->bucket[$item] ) |
|
| 107 | + return isset($this->bucket[$item]) |
|
| 108 | 108 | ? $this->bucket[$item] |
| 109 | 109 | : null; |
| 110 | 110 | } |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function addNamespace( $abstract ) |
| 143 | 143 | { |
| 144 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
| 145 | - $abstract = __NAMESPACE__ . "\\$abstract"; |
|
| 144 | + if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { |
|
| 145 | + $abstract = __NAMESPACE__."\\$abstract"; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $abstract; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | return $this->notInstantiable( $concrete ); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if( is_null(( $constructor = $reflector->getConstructor() ))) { |
|
| 186 | + if( is_null( ($constructor = $reflector->getConstructor()) ) ) { |
|
| 187 | 187 | return new $concrete; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | spl_autoload_register( function( $class ) |
| 9 | 9 | { |
| 10 | 10 | $namespaces = [ |
| 11 | - 'GeminiLabs\\Pollux\\' => __DIR__ . '/src/', |
|
| 12 | - 'GeminiLabs\\Pollux\\Tests\\' => __DIR__ . '/tests/', |
|
| 13 | - 'Symfony\\Component\\Yaml\\' => __DIR__ . '/vendor/symfony/yaml/', |
|
| 11 | + 'GeminiLabs\\Pollux\\' => __DIR__.'/src/', |
|
| 12 | + 'GeminiLabs\\Pollux\\Tests\\' => __DIR__.'/tests/', |
|
| 13 | + 'Symfony\\Component\\Yaml\\' => __DIR__.'/vendor/symfony/yaml/', |
|
| 14 | 14 | ]; |
| 15 | 15 | foreach( $namespaces as $prefix => $base_dir ) { |
| 16 | 16 | $len = strlen( $prefix ); |
| 17 | 17 | if( strncmp( $prefix, $class, $len ) !== 0 )continue; |
| 18 | - $file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php'; |
|
| 18 | + $file = $base_dir.str_replace( '\\', '/', substr( $class, $len ) ).'.php'; |
|
| 19 | 19 | if( !file_exists( $file ) )continue; |
| 20 | 20 | require $file; |
| 21 | 21 | break; |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function filterPluginLinks( array $links ) |
| 29 | 29 | { |
| 30 | - $settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id )); |
|
| 30 | + $settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ) ); |
|
| 31 | 31 | $links[] = $this->app->config->disable_config |
| 32 | - ? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' )) |
|
| 33 | - : sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' )); |
|
| 32 | + ? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ) ) |
|
| 33 | + : sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ) ); |
|
| 34 | 34 | return $links; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $widgets = apply_filters( 'pollux/dashoard/widgets', [ |
| 84 | 84 | 'dashboard_primary', |
| 85 | 85 | 'dashboard_quick_press', |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | foreach( $widgets as $widget ) { |
| 88 | 88 | remove_meta_box( $widget, 'dashboard', 'normal' ); |
| 89 | 89 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function registerSettingsAssets( WP_Screen $screen ) |
| 154 | 154 | { |
| 155 | - if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() )) { |
|
| 155 | + if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() ) ) { |
|
| 156 | 156 | wp_enqueue_script( 'common' ); |
| 157 | 157 | wp_enqueue_script( 'postbox' ); |
| 158 | 158 | wp_enqueue_script( 'wp-lists' ); |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | parent::init(); |
| 27 | 27 | |
| 28 | 28 | add_action( 'wp_ajax_pollux/archives/featured/html', [$this, 'getFeaturedImageHtml'] ); |
| 29 | - add_action( 'pollux/archives/init', [$this, 'registerFeaturedImageMetaBox'] ); |
|
| 30 | - add_action( 'pollux/archives/editor', [$this, 'renderEditor'], 10, 2 ); |
|
| 31 | - add_action( 'wp_ajax_pollux/archives/featured', [$this, 'setFeaturedImage'] ); |
|
| 32 | - add_filter( 'pollux/archives/metabox/submit', [$this, 'filterSubmitMetaBox'] ); |
|
| 33 | - add_filter( 'pollux/archives/show/instructions', '__return_true' ); |
|
| 29 | + add_action( 'pollux/archives/init', [$this, 'registerFeaturedImageMetaBox'] ); |
|
| 30 | + add_action( 'pollux/archives/editor', [$this, 'renderEditor'], 10, 2 ); |
|
| 31 | + add_action( 'wp_ajax_pollux/archives/featured', [$this, 'setFeaturedImage'] ); |
|
| 32 | + add_filter( 'pollux/archives/metabox/submit', [$this, 'filterSubmitMetaBox'] ); |
|
| 33 | + add_filter( 'pollux/archives/show/instructions', '__return_true' ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function canProceed() |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
| 49 | 49 | array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) { |
| 50 | - return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL; |
|
| 50 | + return $instructions.$this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ).PHP_EOL; |
|
| 51 | 51 | }) |
| 52 | 52 | ); |
| 53 | 53 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | public function filterSavedSettings( $settings ) |
| 71 | 71 | { |
| 72 | 72 | return $this->filter( 'save', array_intersect_key( |
| 73 | - array_merge( $this->getSettings(), Helper::toArray( $settings )), |
|
| 73 | + array_merge( $this->getSettings(), Helper::toArray( $settings ) ), |
|
| 74 | 74 | $this->getPostTypesWithArchive() |
| 75 | - )); |
|
| 75 | + ) ); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getFeaturedImageHtml() |
| 94 | 94 | { |
| 95 | - check_ajax_referer( sprintf( '%s-options', static::id() )); |
|
| 95 | + check_ajax_referer( sprintf( '%s-options', static::id() ) ); |
|
| 96 | 96 | static::$current = filter_input( INPUT_POST, 'post_type' ); |
| 97 | 97 | ob_start(); |
| 98 | - $this->renderFeaturedImageMetaBox( intval( filter_input( INPUT_POST, 'thumbnail_id' ))); |
|
| 98 | + $this->renderFeaturedImageMetaBox( intval( filter_input( INPUT_POST, 'thumbnail_id' ) ) ); |
|
| 99 | 99 | wp_send_json_success( ob_get_clean() ); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function register() |
| 118 | 118 | { |
| 119 | 119 | $screenId = Helper::getCurrentScreen()->id; |
| 120 | - if( in_array( $screenId, $this->hooks )) { |
|
| 120 | + if( in_array( $screenId, $this->hooks ) ) { |
|
| 121 | 121 | $this->hook = $screenId; |
| 122 | 122 | } |
| 123 | 123 | parent::register(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function registerFeaturedImageMetaBox() |
| 131 | 131 | { |
| 132 | - if( !current_user_can( 'upload_files' ))return; |
|
| 132 | + if( !current_user_can( 'upload_files' ) )return; |
|
| 133 | 133 | add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function registerPage() |
| 141 | 141 | { |
| 142 | 142 | foreach( $this->getPostTypesWithArchive() as $type => $page ) { |
| 143 | - $labels = get_post_type_labels( get_post_type_object( $type )); |
|
| 143 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
| 144 | 144 | $this->hooks[$type] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [ |
| 145 | 145 | $page, |
| 146 | 146 | sprintf( _x( '%s Archive', 'post archive', 'pollux' ), $labels->singular_name ), |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | static::CAPABILITY, |
| 149 | 149 | sprintf( '%s_archive', $type ), |
| 150 | 150 | [$this, 'renderPage'], |
| 151 | - ])); |
|
| 151 | + ] ) ); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | 'resize' => false, |
| 170 | 170 | 'wp_autoresize_on' => true, |
| 171 | 171 | ], |
| 172 | - ]); |
|
| 172 | + ] ); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function renderFeaturedImageMetaBox( $imageId = null ) |
| 180 | 180 | { |
| 181 | - if( !is_numeric( $imageId )) { |
|
| 181 | + if( !is_numeric( $imageId ) ) { |
|
| 182 | 182 | $imageId = ArchiveMeta::get( $this->getPostType(), 'featured', -1 ); |
| 183 | 183 | } |
| 184 | - $imageSize = isset( wp_get_additional_image_sizes()['post-thumbnail'] ) |
|
| 184 | + $imageSize = isset(wp_get_additional_image_sizes()['post-thumbnail']) |
|
| 185 | 185 | ? 'post-thumbnail' |
| 186 | 186 | : [266, 266]; |
| 187 | 187 | $thumbnail = get_post( $imageId ) |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | 'post_type' => $this->getPostType(), |
| 196 | 196 | 'remove_image' => __( 'Remove featured image', 'pollux' ), |
| 197 | 197 | 'thumbnail' => $thumbnail, |
| 198 | - ]); |
|
| 198 | + ] ); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | public function renderPage() |
| 206 | 206 | { |
| 207 | 207 | $type = $this->getPostType(); |
| 208 | - if( empty( $type ))return; |
|
| 209 | - $labels = get_post_type_labels( get_post_type_object( $type )); |
|
| 208 | + if( empty($type) )return; |
|
| 209 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
| 210 | 210 | $this->app->render( 'archive/index', [ |
| 211 | 211 | 'columns' => get_current_screen()->get_columns(), |
| 212 | 212 | 'content' => ArchiveMeta::get( $type, 'content', '' ), |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | 'id' => static::id(), |
| 215 | 215 | 'post_type' => $type, |
| 216 | 216 | 'title' => ArchiveMeta::get( $type, 'title', '' ), |
| 217 | - ]); |
|
| 217 | + ] ); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | protected function getPostType() |
| 232 | 232 | { |
| 233 | 233 | $type = array_search( $this->hook, $this->hooks ); |
| 234 | - if( !empty( $type ) && is_string( $type )) { |
|
| 234 | + if( !empty($type) && is_string( $type ) ) { |
|
| 235 | 235 | static::$current = $type; |
| 236 | 236 | } |
| 237 | 237 | return static::$current; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | $types = array_map( function( $value ) { |
| 246 | 246 | return sprintf( 'edit.php?post_type=%s', $value ); |
| 247 | - }, get_post_types( ['has_archive' => 1] )); |
|
| 247 | + }, get_post_types( ['has_archive' => 1] ) ); |
|
| 248 | 248 | return array_merge( $types, ['post' => 'edit.php'] ); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -253,6 +253,6 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | protected function getSettings() |
| 255 | 255 | { |
| 256 | - return (array) ArchiveMeta::all(); |
|
| 256 | + return (array)ArchiveMeta::all(); |
|
| 257 | 257 | } |
| 258 | 258 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | foreach( $this->types as $type => $args ) { |
| 25 | 25 | add_action( "manage_{$type}_posts_custom_column", [$this, 'printColumnValue'], 10, 2 ); |
| 26 | - add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) { |
|
| 26 | + add_filter( "manage_{$type}_posts_columns", function( $columns ) use($args) { |
|
| 27 | 27 | return count( $args['columns'] ) > 1 |
| 28 | 28 | ? $args['columns'] |
| 29 | 29 | : $columns; |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | protected function getColumnThumbnail( $postId ) |
| 53 | 53 | { |
| 54 | 54 | if( has_post_thumbnail( $postId ) ) { |
| 55 | - list( $src, $width, $height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), 'thumbnail' ); |
|
| 55 | + list($src, $width, $height) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), 'thumbnail' ); |
|
| 56 | 56 | $thumbnail = sprintf( '<img src="%s" alt="%s" width="%s" height="%s">', |
| 57 | - esc_url( set_url_scheme( $src )), |
|
| 58 | - esc_attr( get_the_title( $postId )), |
|
| 57 | + esc_url( set_url_scheme( $src ) ), |
|
| 58 | + esc_attr( get_the_title( $postId ) ), |
|
| 59 | 59 | $width, |
| 60 | 60 | $height |
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | - return empty( $thumbnail ) |
|
| 63 | + return empty($thumbnail) |
|
| 64 | 64 | ? '—' |
| 65 | 65 | : $thumbnail; |
| 66 | 66 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | return count( PostMeta::get( 'media', [ |
| 74 | 74 | 'fallback' => [], |
| 75 | 75 | 'single' => false, |
| 76 | - ])); |
|
| 76 | + ] ) ); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | protected function normalizeColumns( array $columns ) |
| 92 | 92 | { |
| 93 | 93 | $columns = array_flip( $columns ); |
| 94 | - $columns = array_merge( $columns, array_intersect_key( $this->columns, $columns )); |
|
| 94 | + $columns = array_merge( $columns, array_intersect_key( $this->columns, $columns ) ); |
|
| 95 | 95 | return ['cb' => '<input type="checkbox">'] + $columns; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $defaults = [ |
| 104 | 104 | 'author' => __( 'Author', 'pollux' ), |
| 105 | 105 | 'categories' => __( 'Categories', 'pollux' ), |
| 106 | - 'comments' => sprintf( '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%1$s</span></span>', __( 'Comments', 'pollux' )), |
|
| 106 | + 'comments' => sprintf( '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%1$s</span></span>', __( 'Comments', 'pollux' ) ), |
|
| 107 | 107 | 'date' => __( 'Date', 'pollux' ), |
| 108 | 108 | 'media' => __( 'Media', 'pollux' ), |
| 109 | 109 | 'slug' => __( 'Slug', 'pollux' ), |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | remove_action( 'welcome_panel', 'wp_welcome_panel' ); |
| 29 | 29 | |
| 30 | - add_action( 'init', [$this, 'disable'] ); |
|
| 30 | + add_action( 'init', [$this, 'disable'] ); |
|
| 31 | 31 | add_action( 'wp_dashboard_setup', [$this, 'modifyDashboardWidgets'] ); |
| 32 | - add_action( 'welcome_panel', [$this, 'modifyWelcomePanel'] ); |
|
| 33 | - add_action( 'admin_bar_menu', [$this, 'removeFromAdminBar'], 999 ); |
|
| 34 | - add_action( 'admin_menu', [$this, 'removeFromAdminMenu'] ); |
|
| 35 | - add_action( 'admin_init', [$this, 'unregisterDashboardWidgets'] ); |
|
| 36 | - add_action( 'widgets_init', [$this, 'unregisterWidgets'], 1 ); |
|
| 37 | - add_filter( 'posts_results', [$this, 'filterPostQuery'] ); |
|
| 38 | - add_filter( 'pre_get_posts', [$this, 'filterSearchQuery'] ); |
|
| 32 | + add_action( 'welcome_panel', [$this, 'modifyWelcomePanel'] ); |
|
| 33 | + add_action( 'admin_bar_menu', [$this, 'removeFromAdminBar'], 999 ); |
|
| 34 | + add_action( 'admin_menu', [$this, 'removeFromAdminMenu'] ); |
|
| 35 | + add_action( 'admin_init', [$this, 'unregisterDashboardWidgets'] ); |
|
| 36 | + add_action( 'widgets_init', [$this, 'unregisterWidgets'], 1 ); |
|
| 37 | + add_filter( 'posts_results', [$this, 'filterPostQuery'] ); |
|
| 38 | + add_filter( 'pre_get_posts', [$this, 'filterSearchQuery'] ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | if( !in_array( Helper::getCurrentScreen()->pagenow, [ |
| 48 | 48 | 'edit.php', 'edit-tags.php', 'post-new.php', |
| 49 | - ]))return; |
|
| 49 | + ] ) )return; |
|
| 50 | 50 | |
| 51 | 51 | if( !filter_input_array( INPUT_GET, [ |
| 52 | 52 | 'post_type' => FILTER_DEFAULT, |
| 53 | 53 | 'taxonomy' => FILTER_DEFAULT, |
| 54 | - ])) { |
|
| 54 | + ] ) ) { |
|
| 55 | 55 | wp_safe_redirect( get_admin_url(), 301 ); |
| 56 | 56 | exit; |
| 57 | 57 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | if( $this->isAdmin() || !$query->is_main_query() || !is_search() ) { |
| 87 | 87 | return $query; |
| 88 | 88 | } |
| 89 | - $post_types = get_post_types( ['exclude_from_search' => false ] ); |
|
| 90 | - unset( $post_types['post'] ); |
|
| 89 | + $post_types = get_post_types( ['exclude_from_search' => false] ); |
|
| 90 | + unset($post_types['post']); |
|
| 91 | 91 | $query->set( 'post_type', array_values( $post_types ) ); |
| 92 | 92 | return $query; |
| 93 | 93 | } |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function modifyDashboardWidgets() |
| 100 | 100 | { |
| 101 | - if( !is_blog_admin() || !current_user_can( 'edit_posts' ))return; |
|
| 101 | + if( !is_blog_admin() || !current_user_can( 'edit_posts' ) )return; |
|
| 102 | 102 | |
| 103 | 103 | global $wp_meta_boxes; |
| 104 | 104 | $widgets = &$wp_meta_boxes['dashboard']['normal']['core']; |
| 105 | - if( !isset( $widgets['dashboard_right_now']['callback'] ))return; |
|
| 105 | + if( !isset($widgets['dashboard_right_now']['callback']) )return; |
|
| 106 | 106 | $widgets['dashboard_right_now']['callback'] = function() { |
| 107 | 107 | ob_start(); |
| 108 | 108 | wp_dashboard_right_now(); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $data = wp_parse_args( $data, $defaults ); |
| 40 | 40 | foreach( $defaults as $key => $value ) { |
| 41 | 41 | $method = Helper::buildMethodName( $key, 'normalize' ); |
| 42 | - if( method_exists( $this, $method )) { |
|
| 42 | + if( method_exists( $this, $method ) ) { |
|
| 43 | 43 | $data[$key] = $this->$method( $data[$key], $data, $id ); |
| 44 | 44 | } |
| 45 | 45 | } |