Test Failed
Push — hotfix/fix-counts ( 216f0e...509562 )
by Paul
05:23
created
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function saveAssignedToMetabox( $postId )
14 14
 	{
15
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
16
-		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ));
15
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return;
16
+		$assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) );
17 17
 		update_post_meta( $postId, 'assigned_to', $assignedTo );
18 18
 	}
19 19
 
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function saveResponseMetabox( $postId )
25 25
 	{
26
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
27
-		$response = strval( glsr( Helper::class )->filterInput( 'response' ));
26
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return;
27
+		$response = strval( glsr( Helper::class )->filterInput( 'response' ) );
28 28
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
29 29
 			'a' => ['href' => [], 'title' => []],
30 30
 			'em' => [],
31 31
 			'strong' => [],
32
-		])));
32
+		] ) ) );
33 33
 	}
34 34
 }
Please login to merge, or discard this patch.
compatibility.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' => 'NOT EXISTS'], // this comes first!
Please login to merge, or discard this patch.
plugin/Application.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		static::$instance = $this;
36
-		$this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' );
36
+		$this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = $className.'::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function file( $view )
105 105
 	{
106
-		$view.= '.php';
106
+		$view .= '.php';
107 107
 		$filePaths = [];
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110 110
 		}
111 111
 		$filePaths[] = $this->path( $view );
112 112
 		$filePaths[] = $this->path( 'views/'.$view );
113 113
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
114
+			if( !file_exists( $file ) )continue;
115 115
 			return $file;
116 116
 		}
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getDefaults()
123 123
 	{
124
-		if( empty( $this->defaults )) {
124
+		if( empty($this->defaults) ) {
125 125
 			$this->defaults = $this->make( DefaultsManager::class )->get();
126 126
 			$this->upgrade();
127 127
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			'addons' => 'install_plugins',
138 138
 			'settings' => 'manage_options',
139 139
 		];
140
-		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ));
140
+		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function hasPermission( $page = '' )
147 147
 	{
148 148
 		$isAdmin = $this->isAdmin();
149
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->getPermission( $page )));
149
+		return !$isAdmin || ($isAdmin && current_user_can( $this->getPermission( $page ) ));
150 150
 	}
151 151
 
152 152
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		$path = plugin_dir_path( $this->file );
176 176
 		if( !$realpath ) {
177
-			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ));
177
+			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) );
178 178
 		}
179 179
 		$path = trailingslashit( $path ).ltrim( trim( $file ), '/' );
180 180
 		return apply_filters( 'site-reviews/path', $path, $file );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$types = apply_filters( 'site-reviews/addon/types', [] );
207 207
 		$this->reviewTypes = wp_parse_args( $types, [
208 208
 			'local' => __( 'Local', 'site-reviews' ),
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	{
218 218
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
219 219
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
220
-		if( !file_exists( $file )) {
220
+		if( !file_exists( $file ) ) {
221 221
 			glsr_log()->error( 'File not found: '.$file );
222 222
 			return;
223 223
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function scheduleCronJob()
233 233
 	{
234
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
234
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
235 235
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
236 236
 	}
237 237
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function unscheduleCronJob()
251 251
 	{
252
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
252
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
253 253
 	}
254 254
 
255 255
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function url( $path = '' )
283 283
 	{
284
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
284
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
285 285
 		return apply_filters( 'site-reviews/url', $url, $path );
286 286
 	}
287 287
 }
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()->getPermission( $slug ), $slug, $callback );
58 58
 		}
59 59
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 )->dataGet( glsr()->defaults, 'settings.addons' ))) {
116
-			unset( $tabs['addons'] );
114
+		] );
115
+		if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' )) ) {
116
+			unset($tabs['addons']);
117 117
 		}
118
-		if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' ))) {
119
-			unset( $tabs['licenses'] );
118
+		if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' )) ) {
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
views/pages/tools/general.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if( glsr()->hasPermission( 'settings' )) : ?>
3
+<?php if( glsr()->hasPermission( 'settings' ) ) : ?>
4 4
 <div class="glsr-card card">
5 5
 	<h3>Export Settings</h3>
6 6
 	<p>Export the Site Reviews settings for this site to a <code>*.json</code> file. This allows you to easily import the plugin settings into another site.</p>
Please login to merge, or discard this patch.
plugin/Handlers/EnqueuePublicAssets.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function enqueueAssets()
29 29
 	{
30
-		if( apply_filters( 'site-reviews/assets/css', true )) {
30
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
31 31
 			wp_enqueue_style(
32 32
 				Application::ID,
33 33
 				$this->getStylesheet(),
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 				glsr()->version
36 36
 			);
37 37
 		}
38
-		if( apply_filters( 'site-reviews/assets/js', true )) {
38
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
39 39
 			$dependencies = apply_filters( 'site-reviews/assets/polyfill', true )
40 40
 				? [Application::ID.'/polyfill']
41 41
 				: [];
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function enqueuePolyfillService()
57 57
 	{
58
-		if( !apply_filters( 'site-reviews/assets/polyfill', true ))return;
59
-		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([
58
+		if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return;
59
+		wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [
60 60
 			'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,XMLHttpRequest,MutationObserver',
61 61
 			'flags' => 'gated',
62
-		], 'https://polyfill.io/v3/polyfill.min.js' ));
62
+		], 'https://polyfill.io/v3/polyfill.min.js' ) );
63 63
 	}
64 64
 
65 65
 	/**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 		// nf-google-recaptcha
73 73
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
74 74
 		$language = apply_filters( 'site-reviews/recaptcha/language', get_locale() );
75
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
75
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
76 76
 			'hl' => $language,
77 77
 			'render' => 'explicit',
78
-		], 'https://www.google.com/recaptcha/api.js' ));
78
+		], 'https://www.google.com/recaptcha/api.js' ) );
79 79
 	}
80 80
 
81 81
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	public function inlineStyles()
102 102
 	{
103 103
 		$inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' );
104
-		if( !apply_filters( 'site-reviews/assets/css', true ))return;
105
-		if( !file_exists( $inlineStylesheetPath )) {
104
+		if( !apply_filters( 'site-reviews/assets/css', true ) )return;
105
+		if( !file_exists( $inlineStylesheetPath ) ) {
106 106
 			glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath );
107 107
 			return;
108 108
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	{
123 123
 		$script = 'window.hasOwnProperty("GLSR")||(window.GLSR={});';
124 124
 		foreach( $variables as $key => $value ) {
125
-			$script.= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ));
125
+			$script .= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) );
126 126
 		}
127 127
 		$pattern = '/\"([^ \-\"]+)\"(:[{\[\"])/'; // removes unnecessary quotes surrounding object keys
128 128
 		$optimizedScript = preg_replace( $pattern, '$1$2', $script );
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function getFixedSelectorsForPagination()
136 136
 	{
137
-		$selectors = ['#wpadminbar','.site-navigation-fixed'];
137
+		$selectors = ['#wpadminbar', '.site-navigation-fixed'];
138 138
 		return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors );
139 139
 	}
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	protected function getStylesheet()
145 145
 	{
146 146
 		$currentStyle = glsr( Style::class )->style;
147
-		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ))
147
+		return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) )
148 148
 			? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' )
149 149
 			: glsr()->url( 'assets/styles/'.Application::ID.'.css' );
150 150
 	}
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 			'post_type' => Application::POST_TYPE,
40 40
 		];
41 41
 		$postId = wp_insert_post( $postValues, true );
42
-		if( is_wp_error( $postId )) {
42
+		if( is_wp_error( $postId ) ) {
43 43
 			glsr_log()->error( $postId->get_error_message() )->debug( $postValues );
44 44
 			return false;
45 45
 		}
46 46
 		$this->setTerms( $postId, $command->category );
47
-		$review = $this->single( get_post( $postId ));
47
+		$review = $this->single( get_post( $postId ) );
48 48
 		do_action( 'site-reviews/review/created', $review, $command );
49 49
 		return $review;
50 50
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function delete( $metaReviewId )
57 57
 	{
58
-		if( $postId = $this->getPostId( $metaReviewId )) {
58
+		if( $postId = $this->getPostId( $metaReviewId ) ) {
59 59
 			wp_delete_post( $postId, true );
60 60
 		}
61 61
 	}
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 	public function getRatingCounts( array $args = [] )
114 114
 	{
115 115
 		$args = glsr( SiteReviewsSummaryDefaults::class )->filter( $args );
116
-		$counts = glsr( CountsManager::class )->get([
116
+		$counts = glsr( CountsManager::class )->get( [
117 117
 			'post_ids' => glsr( Helper::class )->convertStringToArray( $args['assigned_to'] ),
118 118
 			'term_ids' => $this->normalizeTermIds( $args['category'] ),
119 119
 			'type' => $args['type'],
120
-		]);
120
+		] );
121 121
 		return glsr( CountsManager::class )->flatten( $counts, [
122 122
 			'min' => $args['rating'],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public function normalizeTermIds( $commaSeparatedTermIds )
131 131
 	{
132 132
 		$termIds = glsr_array_column( $this->normalizeTerms( $commaSeparatedTermIds ), 'term_id' );
133
-		return array_unique( array_map( 'intval', $termIds ));
133
+		return array_unique( array_map( 'intval', $termIds ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		$terms = [];
143 143
 		$termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds );
144 144
 		foreach( $termIds as $termId ) {
145
-			if( is_numeric( $termId )) {
145
+			if( is_numeric( $termId ) ) {
146 146
 				$termId = intval( $termId );
147 147
 			}
148 148
 			$term = term_exists( $termId, Application::TAXONOMY );
149
-			if( !isset( $term['term_id'] ))continue;
149
+			if( !isset($term['term_id']) )continue;
150 150
 			$terms[] = $term;
151 151
 		}
152 152
 		return $terms;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
162 162
 		delete_post_meta( $postId, '_edit_last' );
163
-		$result = wp_update_post([
163
+		$result = wp_update_post( [
164 164
 			'ID' => $postId,
165 165
 			'post_content' => get_post_meta( $postId, 'content', true ),
166 166
 			'post_date' => get_post_meta( $postId, 'date', true ),
167 167
 			'post_title' => get_post_meta( $postId, 'title', true ),
168
-		]);
169
-		if( is_wp_error( $result )) {
168
+		] );
169
+		if( is_wp_error( $result ) ) {
170 170
 			glsr_log()->error( $result->get_error_message() );
171 171
 		}
172 172
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	protected function getNewPostStatus( array $review, $isBlacklisted )
191 191
 	{
192 192
 		$requireApproval = glsr( OptionManager::class )->getBool( 'settings.general.require.approval' );
193
-		return $review['review_type'] == 'local' && ( $requireApproval || $isBlacklisted )
193
+		return $review['review_type'] == 'local' && ($requireApproval || $isBlacklisted)
194 194
 			? 'pending'
195 195
 			: 'publish';
196 196
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	protected function setTerms( $postId, $termIds )
204 204
 	{
205 205
 		$termIds = $this->normalizeTermIds( $termIds );
206
-		if( empty( $termIds ))return;
206
+		if( empty($termIds) )return;
207 207
 		$termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
208
-		if( is_wp_error( $termTaxonomyIds )) {
208
+		if( is_wp_error( $termTaxonomyIds ) ) {
209 209
 			glsr_log()->error( $termTaxonomyIds->get_error_message() );
210 210
 		}
211 211
 	}
Please login to merge, or discard this patch.
plugin/Helper.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$className = $this->camelCase( $name );
18 18
 		$path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' );
19
-		return !empty( $path )
19
+		return !empty($path)
20 20
 			? __NAMESPACE__.'\\'.$path.'\\'.$className
21 21
 			: $className;
22 22
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function buildMethodName( $name, $prefix = '' )
30 30
 	{
31
-		return lcfirst( $prefix.$this->buildClassName( $name ));
31
+		return lcfirst( $prefix.$this->buildClassName( $name ) );
32 32
 	}
33 33
 
34 34
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function buildPropertyName( $name )
39 39
 	{
40
-		return lcfirst( $this->buildClassName( $name ));
40
+		return lcfirst( $this->buildClassName( $name ) );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function camelCase( $string )
48 48
 	{
49
-		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string )));
49
+		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) );
50 50
 		return str_replace( ' ', '', $string );
51 51
 	}
52 52
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function convertPathToId( $path, $prefix = '' )
91 91
 	{
92
-		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ));
92
+		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) );
93 93
 	}
94 94
 
95 95
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$levels = explode( '.', $path );
102 102
 		return array_reduce( $levels, function( $result, $value ) {
103
-			return $result.= '['.$value.']';
103
+			return $result .= '['.$value.']';
104 104
 		}, $prefix );
105 105
 	}
106 106
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function convertStringToArray( $string, $callback = null )
113 113
 	{
114
-		$array = array_map( 'trim', explode( ',', $string ));
114
+		$array = array_map( 'trim', explode( ',', $string ) );
115 115
 		return $callback
116 116
 			? array_filter( $array, $callback )
117 117
 			: array_filter( $array );
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function dashCase( $string )
125 125
 	{
126
-		return str_replace( '_', '-', $this->snakeCase( $string ));
126
+		return str_replace( '_', '-', $this->snakeCase( $string ) );
127 127
 	}
128 128
 
129 129
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		$data = $this->consolidateArray( $data );
139 139
 		$keys = explode( '.', $path );
140 140
 		foreach( $keys as $key ) {
141
-			if( !isset( $data[$key] )) {
141
+			if( !isset($data[$key]) ) {
142 142
 				return $fallback;
143 143
 			}
144 144
 			$data = $data[$key];
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function filterInput( $key, array $request = [] )
186 186
 	{
187
-		if( isset( $request[$key] )) {
187
+		if( isset($request[$key]) ) {
188 188
 			return $request[$key];
189 189
 		}
190 190
 		$variable = filter_input( INPUT_POST, $key );
191
-		if( is_null( $variable ) && isset( $_POST[$key] )) {
191
+		if( is_null( $variable ) && isset($_POST[$key]) ) {
192 192
 			$variable = $_POST[$key];
193 193
 		}
194 194
 		return $variable;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	public function filterInputArray( $key )
202 202
 	{
203 203
 		$variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
204
-		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) {
204
+		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) {
205 205
 			$variable = $_POST[$key];
206 206
 		}
207 207
 		return (array)$variable;
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 		$result = [];
218 218
 		foreach( $array as $key => $value ) {
219 219
 			$newKey = ltrim( $prefix.'.'.$key, '.' );
220
-			if( $this->isIndexedFlatArray( $value )) {
220
+			if( $this->isIndexedFlatArray( $value ) ) {
221 221
 				if( $flattenValue ) {
222 222
 					$value = '['.implode( ', ', $value ).']';
223 223
 				}
224 224
 			}
225
-			else if( is_array( $value )) {
226
-				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ));
225
+			else if( is_array( $value ) ) {
226
+				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) );
227 227
 				continue;
228 228
 			}
229 229
 			$result[$newKey] = $value;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				Whip::IPV4 => $cloudflareIps['v4'],
246 246
 				Whip::IPV6 => $ipv6,
247 247
 			],
248
-		]);
248
+		] );
249 249
 		$whip = new Whip( Whip::ALL_METHODS, $whitelist );
250 250
 		do_action_ref_array( 'site-reviews/whip', [&$whip] );
251 251
 		return (string)$whip->getValidIpAddress();
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function insertInArray( array $array, array $insert, $key, $position = 'before' )
260 260
 	{
261
-		$keyPosition = intval( array_search( $key, array_keys( $array )));
261
+		$keyPosition = intval( array_search( $key, array_keys( $array ) ) );
262 262
 		if( 'after' == $position ) {
263 263
 			$keyPosition++;
264 264
 		}
265 265
 		if( false !== $keyPosition ) {
266 266
 			$result = array_slice( $array, 0, $keyPosition );
267 267
 			$result = array_merge( $result, $insert );
268
-			return array_merge( $result, array_slice( $array, $keyPosition ));
268
+			return array_merge( $result, array_slice( $array, $keyPosition ) );
269 269
 		}
270 270
 		return array_merge( $array, $insert );
271 271
 	}
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function isIndexedFlatArray( $array )
278 278
 	{
279
-		if( !is_array( $array ) || array_filter( $array, 'is_array' )) {
279
+		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) {
280 280
 			return false;
281 281
 		}
282 282
 		return wp_is_numeric_array( $array );
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function prefixString( $string, $prefix = '' )
291 291
 	{
292
-		return $prefix.str_replace( $prefix, '', trim( $string ));
292
+		return $prefix.str_replace( $prefix, '', trim( $string ) );
293 293
 	}
294 294
 
295 295
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	public function removePrefix( $prefix, $text )
316 316
 	{
317 317
 		return 0 === strpos( $text, $prefix )
318
-			? substr( $text, strlen( $prefix ))
318
+			? substr( $text, strlen( $prefix ) )
319 319
 			: $text;
320 320
 	}
321 321
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public function snakeCase( $string )
327 327
 	{
328
-		if( !ctype_lower( $string )) {
328
+		if( !ctype_lower( $string ) ) {
329 329
 			$string = preg_replace( '/\s+/u', '', $string );
330 330
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
331 331
 			$string = function_exists( 'mb_strtolower' )
@@ -342,6 +342,6 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	public function startsWith( $needle, $haystack )
344 344
 	{
345
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
345
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
346 346
 	}
347 347
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	public function approve()
23 23
 	{
24 24
 		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
25
-		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
26
-		wp_update_post([
25
+		check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
26
+		wp_update_post( [
27 27
 			'ID' => $postId,
28 28
 			'post_status' => 'publish',
29
-		]);
29
+		] );
30 30
 		wp_safe_redirect( wp_get_referer() );
31 31
 		exit;
32 32
 	}
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 		$columns = glsr( Helper::class )->consolidateArray( $columns );
60 60
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
61 61
 		foreach( $postTypeColumns as $key => &$value ) {
62
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
62
+			if( !array_key_exists( $key, $columns ) || !empty($value) )continue;
63 63
 			$value = $columns[$key];
64 64
 		}
65
-		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) {
66
-			unset( $postTypeColumns['review_type'] );
65
+		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) {
66
+			unset($postTypeColumns['review_type']);
67 67
 		}
68 68
 		return array_filter( $postTypeColumns, 'strlen' );
69 69
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function filterPostStates( $postStates, $post ) {
107 107
 		$postStates = glsr( Helper::class )->consolidateArray( $postStates );
108
-		if( glsr_get( $post, 'post_type' ) == Application::POST_TYPE && array_key_exists( 'pending', $postStates )) {
108
+		if( glsr_get( $post, 'post_type' ) == Application::POST_TYPE && array_key_exists( 'pending', $postStates ) ) {
109 109
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
110 110
 		}
111 111
 		return $postStates;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		if( glsr_get( $post, 'post_type' ) != Application::POST_TYPE || $post->post_status == 'trash' ) {
123 123
 			return $actions;
124 124
 		}
125
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
125
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
126 126
 		$rowActions = [
127 127
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
128 128
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID ),
137 137
 					$key.'-review_'.$post->ID
138 138
 				),
139
-			]);
139
+			] );
140 140
 		}
141 141
 		return $newActions + glsr( Helper::class )->consolidateArray( $actions );
142 142
 	}
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	{
151 151
 		$columns = glsr( Helper::class )->consolidateArray( $columns );
152 152
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
153
-		unset( $postTypeColumns['cb'] );
153
+		unset($postTypeColumns['cb']);
154 154
 		foreach( $postTypeColumns as $key => $value ) {
155
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
155
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
156 156
 			$columns[$key] = $key;
157 157
 		}
158 158
 		return $columns;
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
172 172
 	{
173
-		if( $this->canModifyTranslation( $domain )) {
173
+		if( $this->canModifyTranslation( $domain ) ) {
174 174
 			$strings = [
175 175
 				'Published' => __( 'Approved', 'site-reviews' ),
176 176
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
177 177
 			];
178 178
 			foreach( $strings as $search => $replace ) {
179 179
 				if( strpos( $single, $search ) === false )continue;
180
-				$translation = $this->getTranslation([
180
+				$translation = $this->getTranslation( [
181 181
 					'number' => $number,
182 182
 					'plural' => str_replace( $search, $replace, $plural ),
183 183
 					'single' => str_replace( $search, $replace, $single ),
184
-				]);
184
+				] );
185 185
 			}
186 186
 		}
187 187
 		return $translation;
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function saveBulkEditFields( $postId )
230 230
 	{
231
-		if( !current_user_can( 'edit_posts' ))return;
231
+		if( !current_user_can( 'edit_posts' ) )return;
232 232
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
233
-		if( $assignedTo && get_post( $assignedTo )) {
233
+		if( $assignedTo && get_post( $assignedTo ) ) {
234 234
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
235 235
 		}
236 236
 	}
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function setQueryForColumn( WP_Query $query )
243 243
 	{
244
-		if( !$this->hasPermission( $query ))return;
244
+		if( !$this->hasPermission( $query ) )return;
245 245
 		$this->setMetaQuery( $query, [
246 246
 			'rating', 'review_type',
247
-		]);
247
+		] );
248 248
 		$this->setOrderby( $query );
249 249
 	}
250 250
 
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 	public function unapprove()
256 256
 	{
257 257
 		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
258
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
259
-		wp_update_post([
258
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
259
+		wp_update_post( [
260 260
 			'ID' => $postId,
261 261
 			'post_status' => 'pending',
262
-		]);
262
+		] );
263 263
 		wp_safe_redirect( wp_get_referer() );
264 264
 		exit;
265 265
 	}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			'single' => '',
290 290
 			'text' => '',
291 291
 		];
292
-		$args = (object) wp_parse_args( $args, $defaults );
292
+		$args = (object)wp_parse_args( $args, $defaults );
293 293
 		$translations = get_translations_for_domain( Application::ID );
294 294
 		return $args->text
295 295
 			? $translations->translate( $args->text )
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
315 315
 	{
316 316
 		foreach( $metaKeys as $key ) {
317
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
317
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
318 318
 			$metaQuery = (array)$query->get( 'meta_query' );
319 319
 			$metaQuery[] = [
320 320
 				'key' => $key,
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	{
332 332
 		$orderby = $query->get( 'orderby' );
333 333
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
334
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
335
-		if( in_array( $orderby, array_keys( $columns ))) {
334
+		unset($columns['cb'], $columns['title'], $columns['date']);
335
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
336 336
 			if( $orderby == 'reviewer' ) {
337 337
 				$orderby = 'author';
338 338
 			}
Please login to merge, or discard this patch.