Passed
Push — hotfix/fix-counts ( bd8a94 )
by Paul
05:00
created
plugin/Filters.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,32 +41,32 @@
 block discarded – undo
41 41
 	 */
42 42
 	public function run()
43 43
 	{
44
-		add_filter( 'mce_external_plugins',                                    [$this->admin, 'filterTinymcePlugins'], 15 );
45
-		add_filter( 'plugin_action_links_'.$this->basename,                    [$this->admin, 'filterActionLinks'] );
46
-		add_filter( 'dashboard_glance_items',                                  [$this->admin, 'filterDashboardGlanceItems'] );
47
-		add_filter( 'block_categories',                                        [$this->blocks, 'filterBlockCategories'] );
48
-		add_filter( 'classic_editor_enabled_editors_for_post_type',            [$this->blocks, 'filterEnabledEditors'], 10, 2 );
49
-		add_filter( 'use_block_editor_for_post_type',                          [$this->blocks, 'filterUseBlockEditor'], 10, 2 );
50
-		add_filter( 'wp_editor_settings',                                      [$this->editor, 'filterEditorSettings'] );
51
-		add_filter( 'the_editor',                                              [$this->editor, 'filterEditorTextarea'] );
52
-		add_filter( 'gettext',                                                 [$this->editor, 'filterPostStatusLabels'], 10, 3 );
53
-		add_filter( 'gettext_with_context',                                    [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
54
-		add_filter( 'post_updated_messages',                                   [$this->editor, 'filterUpdateMessages'] );
55
-		add_filter( 'bulk_post_updated_messages',                              [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
56
-		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns',         [$this->listtable, 'filterColumnsForPostType'] );
57
-		add_filter( 'post_date_column_status',                                 [$this->listtable, 'filterDateColumnStatus'], 10, 2 );
58
-		add_filter( 'default_hidden_columns',                                  [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
59
-		add_filter( 'display_post_states',                                     [$this->listtable, 'filterPostStates'], 10, 2 );
60
-		add_filter( 'post_row_actions',                                        [$this->listtable, 'filterRowActions'], 10, 2 );
44
+		add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 );
45
+		add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] );
46
+		add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] );
47
+		add_filter( 'block_categories', [$this->blocks, 'filterBlockCategories'] );
48
+		add_filter( 'classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2 );
49
+		add_filter( 'use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2 );
50
+		add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] );
51
+		add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] );
52
+		add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 );
53
+		add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
54
+		add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] );
55
+		add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
56
+		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] );
57
+		add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 );
58
+		add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
59
+		add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 );
60
+		add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 );
61 61
 		add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] );
62
-		add_filter( 'ngettext',                                                [$this->listtable, 'filterStatusText'], 10, 5 );
63
-		add_filter( 'script_loader_tag',                                       [$this->public, 'filterEnqueuedScripts'], 10, 2 );
64
-		add_filter( 'site-reviews/config/forms/submission-form',               [$this->public, 'filterFieldOrder'], 11 );
65
-		add_filter( 'query_vars',                                              [$this->public, 'filterQueryVars'] );
66
-		add_filter( 'site-reviews/render/view',                                [$this->public, 'filterRenderView'] );
67
-		add_filter( 'gettext',                                                 [$this->translator, 'filterGettext'], 10, 3 );
68
-		add_filter( 'gettext_with_context',                                    [$this->translator, 'filterGettextWithContext'], 10, 4 );
69
-		add_filter( 'ngettext',                                                [$this->translator, 'filterNgettext'], 10, 5 );
70
-		add_filter( 'ngettext_with_context',                                   [$this->translator, 'filterNgettextWithContext'], 10, 6 );
62
+		add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 );
63
+		add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 );
64
+		add_filter( 'site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11 );
65
+		add_filter( 'query_vars', [$this->public, 'filterQueryVars'] );
66
+		add_filter( 'site-reviews/render/view', [$this->public, 'filterRenderView'] );
67
+		add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 );
68
+		add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 );
69
+		add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 );
70
+		add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 );
71 71
 	}
72 72
 }
Please login to merge, or discard this patch.
plugin/Controllers/BlocksController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@
 block discarded – undo
79 79
 		foreach( $blocks as $block ) {
80 80
 			$id = str_replace( '_reviews', '', Application::ID.'_'.$block );
81 81
 			$blockClass = glsr( Helper::class )->buildClassName( $id.'-block', 'Blocks' );
82
-			if( !class_exists( $blockClass )) {
83
-				glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ));
82
+			if( !class_exists( $blockClass ) ) {
83
+				glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ) );
84 84
 				continue;
85 85
 			}
86 86
 			glsr( $blockClass )->register( $block );
Please login to merge, or discard this patch.
plugin/Controllers/MainController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
plugin/Controllers/RestReviewController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
plugin/Controllers/RestCategoryController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
views/pages/addons/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Labels.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' ),
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
39 39
 			'aria-label' => '&#8220;'.esc_attr( $title ).'&#8221; ('.__( '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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 			$className = str_replace( '.php', '', $file );
25 25
 			$version = str_replace( ['Upgrade_', '_'], ['', '.'], $className );
26 26
 			$versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions
27
-			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return;
27
+			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return;
28 28
 			glsr( 'Modules\\Upgrader\\'.$className );
29 29
 			glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix );
30 30
 		});
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$this->setReviewCounts();
42 42
 			$this->updateVersionFrom( $version );
43 43
 		}
44
-		else if( !glsr( OptionManager::class )->get( 'last_review_count', false )) {
44
+		else if( !glsr( OptionManager::class )->get( 'last_review_count', false ) ) {
45 45
 			$this->setReviewCounts();
46 46
 		}
47 47
 	}
Please login to merge, or discard this patch.