@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function registerPostType() |
| 22 | 22 | { |
| 23 | 23 | if( !glsr()->hasPermission() )return; |
| 24 | - $command = new RegisterPostType([ |
|
| 24 | + $command = new RegisterPostType( [ |
|
| 25 | 25 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], |
| 26 | 26 | 'columns' => [ |
| 27 | 27 | 'title' => '', |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'rest_controller_class' => RestReviewController::class, |
| 42 | 42 | 'show_in_rest' => true, |
| 43 | 43 | 'single' => __( 'Review', 'site-reviews' ), |
| 44 | - ]); |
|
| 44 | + ] ); |
|
| 45 | 45 | $this->execute( $command ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function registerShortcodes() |
| 53 | 53 | { |
| 54 | - $command = new RegisterShortcodes([ |
|
| 54 | + $command = new RegisterShortcodes( [ |
|
| 55 | 55 | 'site_reviews', |
| 56 | 56 | 'site_reviews_form', |
| 57 | 57 | 'site_reviews_summary', |
| 58 | - ]); |
|
| 58 | + ] ); |
|
| 59 | 59 | $this->execute( $command ); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function registerTaxonomy() |
| 67 | 67 | { |
| 68 | - $command = new RegisterTaxonomy([ |
|
| 68 | + $command = new RegisterTaxonomy( [ |
|
| 69 | 69 | 'hierarchical' => true, |
| 70 | 70 | 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], |
| 71 | 71 | 'public' => false, |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 'show_admin_column' => true, |
| 74 | 74 | 'show_in_rest' => true, |
| 75 | 75 | 'show_ui' => true, |
| 76 | - ]); |
|
| 76 | + ] ); |
|
| 77 | 77 | $this->execute( $command ); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function registerWidgets() |
| 85 | 85 | { |
| 86 | - $command = new RegisterWidgets([ |
|
| 86 | + $command = new RegisterWidgets( [ |
|
| 87 | 87 | 'site-reviews' => [ |
| 88 | 88 | 'class' => 'glsr-widget glsr-widget-site-reviews', |
| 89 | 89 | 'description' => __( 'Your site’s most recent reviews.', 'site-reviews' ), |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | 'description' => __( 'A summary of your site’s reviews.', 'site-reviews' ), |
| 100 | 100 | 'title' => __( 'Summary of Reviews', 'site-reviews' ), |
| 101 | 101 | ], |
| 102 | - ]); |
|
| 102 | + ] ); |
|
| 103 | 103 | $this->execute( $command ); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | register_rest_route( $this->namespace, '/types', [ |
| 29 | 29 | 'callback' => [$this, 'get_types'], |
| 30 | 30 | 'methods' => Server::READABLE, |
| 31 | - ]); |
|
| 31 | + ] ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | 'permission_callback' => [$this, 'get_items_permissions_check'], |
| 34 | 34 | ], |
| 35 | 35 | 'schema' => [$this, 'get_public_item_schema'], |
| 36 | - ]); |
|
| 36 | + ] ); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | 'title' => 'Images', |
| 18 | 18 | ], |
| 19 | 19 | 'plugin' => 'site-reviews-images/site-reviews-images.php', |
| 20 | - ]); |
|
| 20 | + ] ); |
|
| 21 | 21 | $template->render( 'partials/addons/addon', [ |
| 22 | 22 | 'context' => [ |
| 23 | 23 | 'description' => __( 'Sync your Tripadvisor reviews to your website and manage them with Site Reviews.', 'site-reviews' ), |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'title' => 'Tripadvisor Reviews', |
| 27 | 27 | ], |
| 28 | 28 | 'plugin' => 'site-reviews-tripadvisor/site-reviews-tripadvisor.php', |
| 29 | - ]); |
|
| 29 | + ] ); |
|
| 30 | 30 | ?> |
| 31 | 31 | </div> |
| 32 | 32 | </div> |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function renderTaxonomyFilter() |
| 37 | 37 | { |
| 38 | - if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return; |
|
| 38 | + if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) )return; |
|
| 39 | 39 | echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [ |
| 40 | 40 | 'class' => 'screen-reader-text', |
| 41 | 41 | 'for' => Application::TAXONOMY, |
| 42 | - ]); |
|
| 43 | - wp_dropdown_categories([ |
|
| 42 | + ] ); |
|
| 43 | + wp_dropdown_categories( [ |
|
| 44 | 44 | 'depth' => 3, |
| 45 | 45 | 'hide_empty' => true, |
| 46 | 46 | 'hide_if_empty' => true, |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'show_option_all' => $this->getShowOptionAll(), |
| 53 | 53 | 'taxonomy' => Application::TAXONOMY, |
| 54 | 54 | 'value_field' => 'slug', |
| 55 | - ]); |
|
| 55 | + ] ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | protected function getSelected() |
| 62 | 62 | { |
| 63 | 63 | global $wp_query; |
| 64 | - return isset( $wp_query->query[Application::TAXONOMY] ) |
|
| 64 | + return isset($wp_query->query[Application::TAXONOMY]) |
|
| 65 | 65 | ? $wp_query->query[Application::TAXONOMY] |
| 66 | 66 | : ''; |
| 67 | 67 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $taxonomy = get_taxonomy( Application::TAXONOMY ); |
| 75 | 75 | return $taxonomy |
| 76 | - ? ucfirst( strtolower( $taxonomy->labels->all_items )) |
|
| 76 | + ? ucfirst( strtolower( $taxonomy->labels->all_items ) ) |
|
| 77 | 77 | : ''; |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | 'savePending' => __( 'Save as Unapproved', 'site-reviews' ), |
| 18 | 18 | 'published' => __( 'Approved', 'site-reviews' ), |
| 19 | 19 | ]; |
| 20 | - if( $this->canModifyTranslation() && isset( $wp_scripts->registered['post']->extra['data'] )) { |
|
| 20 | + if( $this->canModifyTranslation() && isset($wp_scripts->registered['post']->extra['data']) ) { |
|
| 21 | 21 | $l10n = &$wp_scripts->registered['post']->extra['data']; |
| 22 | 22 | foreach( $strings as $search => $replace ) { |
| 23 | 23 | $l10n = preg_replace( '/("'.$search.'":")([^"]+)/', "$1".$replace, $l10n ); |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function filterPostStatusLabels( $translation, $text, $domain ) |
| 35 | 35 | { |
| 36 | - if( $this->canModifyTranslation( $domain )) { |
|
| 36 | + if( $this->canModifyTranslation( $domain ) ) { |
|
| 37 | 37 | $replacements = $this->getStatusLabels(); |
| 38 | - if( array_key_exists( $text, $replacements )) { |
|
| 38 | + if( array_key_exists( $text, $replacements ) ) { |
|
| 39 | 39 | $translation = $replacements[$text]; |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | public function filterUpdateMessages( array $messages ) |
| 49 | 49 | { |
| 50 | 50 | $post = get_post(); |
| 51 | - if( !( $post instanceof WP_Post ))return; |
|
| 51 | + if( !($post instanceof WP_Post) )return; |
|
| 52 | 52 | $strings = $this->getReviewLabels(); |
| 53 | 53 | $restored = filter_input( INPUT_GET, 'revision' ); |
| 54 | - if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) { |
|
| 54 | + if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) { |
|
| 55 | 55 | $restored = sprintf( $strings['restored'], $revisionTitle ); |
| 56 | 56 | } |
| 57 | - $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date )); |
|
| 58 | - $messages[ Application::POST_TYPE ] = [ |
|
| 57 | + $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) ); |
|
| 58 | + $messages[Application::POST_TYPE] = [ |
|
| 59 | 59 | 1 => $strings['updated'], |
| 60 | 60 | 4 => $strings['updated'], |
| 61 | 61 | 5 => $restored, |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function canModifyTranslation( $domain = 'default' ) |
| 79 | 79 | { |
| 80 | - if( $domain != 'default' || empty( glsr_current_screen()->base )) { |
|
| 80 | + if( $domain != 'default' || empty(glsr_current_screen()->base) ) { |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | return glsr_current_screen()->post_type == Application::POST_TYPE |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | protected function getStatusLabels() |
| 113 | 113 | { |
| 114 | 114 | static $labels; |
| 115 | - if( empty( $labels )) { |
|
| 115 | + if( empty($labels) ) { |
|
| 116 | 116 | $labels = [ |
| 117 | 117 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
| 118 | 118 | 'Pending Review' => __( 'Unapproved', 'site-reviews' ), |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 28 | 'class' => 'pending-count', |
| 29 | - ]); |
|
| 29 | + ] ); |
|
| 30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
| 31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
| 32 | - ]); |
|
| 32 | + ] ); |
|
| 33 | 33 | $menu[$key][0] .= ' '.$awaitingModeration; |
| 34 | 34 | if( $typenow === Application::POST_TYPE ) { |
| 35 | - $menu[$key][4].= ' current'; |
|
| 35 | + $menu[$key][4] .= ' current'; |
|
| 36 | 36 | } |
| 37 | 37 | break; |
| 38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 50 | 50 | 'addons' => __( 'Add-ons', 'site-reviews' ), |
| 51 | 51 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
| 52 | - ]); |
|
| 52 | + ] ); |
|
| 53 | 53 | foreach( $pages as $slug => $title ) { |
| 54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 56 | + if( !is_callable( $callback ) )continue; |
|
| 57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $this->renderPage( 'addons', [ |
| 69 | 69 | 'template' => glsr( Template::class ), |
| 70 | - ]); |
|
| 70 | + ] ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 86 | 86 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 87 | - ]); |
|
| 87 | + ] ); |
|
| 88 | 88 | $addons = apply_filters( 'site-reviews/addon/documentation', [] ); |
| 89 | 89 | ksort( $addons ); |
| 90 | - if( empty( $addons )) { |
|
| 91 | - unset( $tabs['addons'] ); |
|
| 90 | + if( empty($addons) ) { |
|
| 91 | + unset($tabs['addons']); |
|
| 92 | 92 | } |
| 93 | 93 | $this->renderPage( 'documentation', [ |
| 94 | 94 | 'addons' => $addons, |
| 95 | 95 | 'tabs' => $tabs, |
| 96 | - ]); |
|
| 96 | + ] ); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 112 | 112 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 113 | 113 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 114 | - ]); |
|
| 115 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
| 116 | - unset( $tabs['addons'] ); |
|
| 114 | + ] ); |
|
| 115 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
| 116 | + unset($tabs['addons']); |
|
| 117 | 117 | } |
| 118 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
| 119 | - unset( $tabs['licenses'] ); |
|
| 118 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
| 119 | + unset($tabs['licenses']); |
|
| 120 | 120 | } |
| 121 | 121 | $this->renderPage( 'settings', [ |
| 122 | 122 | 'notices' => $this->getNotices(), |
| 123 | 123 | 'settings' => glsr( Settings::class ), |
| 124 | 124 | 'tabs' => $tabs, |
| 125 | - ]); |
|
| 125 | + ] ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -137,24 +137,24 @@ discard block |
||
| 137 | 137 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
| 138 | 138 | 'console' => __( 'Console', 'site-reviews' ), |
| 139 | 139 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 140 | - ]); |
|
| 141 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
| 142 | - unset( $tabs['sync'] ); |
|
| 140 | + ] ); |
|
| 141 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
| 142 | + unset($tabs['sync']); |
|
| 143 | 143 | } |
| 144 | 144 | $this->renderPage( 'tools', [ |
| 145 | 145 | 'data' => [ |
| 146 | 146 | 'context' => [ |
| 147 | 147 | 'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ), |
| 148 | - 'console' => strval( glsr( Console::class )), |
|
| 148 | + 'console' => strval( glsr( Console::class ) ), |
|
| 149 | 149 | 'id' => Application::ID, |
| 150 | - 'system' => strval( glsr( System::class )), |
|
| 150 | + 'system' => strval( glsr( System::class ) ), |
|
| 151 | 151 | ], |
| 152 | 152 | 'services' => apply_filters( 'site-reviews/addon/sync/services', [] ), |
| 153 | 153 | ], |
| 154 | 154 | 'notices' => $this->getNotices(), |
| 155 | 155 | 'tabs' => $tabs, |
| 156 | 156 | 'template' => glsr( Template::class ), |
| 157 | - ]); |
|
| 157 | + ] ); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
| 177 | 177 | 'id' => 'glsr-notices', |
| 178 | - ]); |
|
| 178 | + ] ); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function handle( Command $command ) |
| 15 | 15 | { |
| 16 | - $postId = wp_update_post([ |
|
| 16 | + $postId = wp_update_post( [ |
|
| 17 | 17 | 'ID' => $command->id, |
| 18 | 18 | 'post_status' => $command->status, |
| 19 | - ]); |
|
| 20 | - if( is_wp_error( $postId )) { |
|
| 19 | + ] ); |
|
| 20 | + if( is_wp_error( $postId ) ) { |
|
| 21 | 21 | glsr_log()->error( $postId->get_error_message() ); |
| 22 | 22 | return []; |
| 23 | 23 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')', |
| 40 | 40 | 'class' => 'row-title', |
| 41 | 41 | 'href' => get_edit_post_link( $postId ), |
| 42 | - ]); |
|
| 42 | + ] ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | protected function getPostState( $postId ) |
| 50 | 50 | { |
| 51 | 51 | ob_start(); |
| 52 | - _post_states( get_post( $postId )); |
|
| 52 | + _post_states( get_post( $postId ) ); |
|
| 53 | 53 | return ob_get_clean(); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | protected function getStatusLinks() |
| 60 | 60 | { |
| 61 | 61 | global $avail_post_stati; |
| 62 | - require_once( ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php' ); |
|
| 62 | + require_once(ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php'); |
|
| 63 | 63 | $hookName = 'edit-'.Application::POST_TYPE; |
| 64 | 64 | set_current_screen( $hookName ); |
| 65 | 65 | $avail_post_stati = get_available_post_statuses( Application::POST_TYPE ); |
| 66 | 66 | $table = new \WP_Posts_List_Table( ['screen' => $hookName] ); |
| 67 | 67 | $views = apply_filters( 'views_'.$hookName, $table->get_views() ); // uses compat get_views() |
| 68 | - if( empty( $views ))return; |
|
| 68 | + if( empty($views) )return; |
|
| 69 | 69 | foreach( $views as $class => $view ) { |
| 70 | 70 | $views[$class] = "\t<li class='$class'>$view"; |
| 71 | 71 | } |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | * @see https://wordpress.org/plugins/wp-super-cache/ |
| 21 | 21 | */ |
| 22 | 22 | add_action( 'site-reviews/review/created', function( $review, $request ) { |
| 23 | - if( !function_exists( 'wp_cache_post_change' ))return; |
|
| 23 | + if( !function_exists( 'wp_cache_post_change' ) )return; |
|
| 24 | 24 | wp_cache_post_change( $request->post_id ); |
| 25 | - if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id )return; |
|
| 25 | + if( empty($review->assigned_to) || $review->assigned_to == $request->post_id )return; |
|
| 26 | 26 | wp_cache_post_change( $review->assigned_to ); |
| 27 | 27 | }, 10, 2 ); |
| 28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) { |
| 35 | 35 | $scriptHandles[] = 'site-reviews/google-recaptcha'; |
| 36 | - return array_keys( array_flip( $scriptHandles )); |
|
| 36 | + return array_keys( array_flip( $scriptHandles ) ); |
|
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @see https://searchandfilter.com/ |
| 44 | 44 | */ |
| 45 | 45 | add_filter( 'sf_edit_query_args', function( $query ) { |
| 46 | - if( !empty( $query['meta_key'] ) && $query['meta_key'] == '_glsr_ranking' ) { |
|
| 47 | - unset( $query['meta_key'] ); |
|
| 46 | + if( !empty($query['meta_key']) && $query['meta_key'] == '_glsr_ranking' ) { |
|
| 47 | + unset($query['meta_key']); |
|
| 48 | 48 | $query['meta_query'] = [ |
| 49 | 49 | 'relation' => 'OR', |
| 50 | 50 | ['key' => '_glsr_ranking', 'compare' => 'EXISTS'], |