Passed
Push — master ( af44f0...ee0da0 )
by Paul
04:21
created
plugin/Modules/Validator/ValidateReview.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function validateRequest( array $request )
57 57
 	{
58
-		if( !$this->isRequestValid( $request )) {
58
+		if( !$this->isRequestValid( $request ) ) {
59 59
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
60 60
 			return $request;
61 61
 		}
62
-		if( empty( $request['title'] )) {
62
+		if( empty($request['title']) ) {
63 63
 			$request['title'] = __( 'No Title', 'site-reviews' );
64 64
 		}
65 65
 		return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request );
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		$rules = array_intersect_key(
74 74
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES ),
75 75
 			array_flip( array_merge(
76
-				['rating','terms'],
76
+				['rating', 'terms'],
77 77
 				glsr( OptionManager::class )->get( 'settings.reviews-form.required', [] )
78
-			))
78
+			) )
79 79
 		);
80
-		$excluded = isset( $request['excluded'] )
80
+		$excluded = isset($request['excluded'])
81 81
 			? json_decode( $request['excluded'] )
82 82
 			: [];
83
-		return array_diff_key( $rules, array_flip( $excluded ));
83
+		return array_diff_key( $rules, array_flip( $excluded ) );
84 84
 	}
85 85
 
86 86
 	/**
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 			return true;
94 94
 		}
95 95
 		$recaptchaResponse = filter_input( INPUT_POST, 'g-recaptcha-response' );
96
-		if( empty( $recaptchaResponse )) {
96
+		if( empty($recaptchaResponse) ) {
97 97
 			return null; //if response is empty we need to return null
98 98
 		}
99 99
 		if( $integration == 'custom' ) {
100 100
 			return $this->isRecaptchaValid( $recaptchaResponse );
101 101
 		}
102 102
 		if( $integration == 'invisible-recaptcha' ) {
103
-			return boolval( apply_filters( 'google_invre_is_valid_request_filter', true ));
103
+			return boolval( apply_filters( 'google_invre_is_valid_request_filter', true ) );
104 104
 		}
105 105
 		return false;
106 106
 	}
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function isRecaptchaValid( $recaptchaResponse )
112 112
 	{
113
-		$endpoint = add_query_arg([
113
+		$endpoint = add_query_arg( [
114 114
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
115 115
 			'response' => $recaptchaResponse,
116 116
 			'secret' => glsr( OptionManager::class )->get( 'settings.reviews-form.recaptcha.secret' ),
117 117
 		], 'https://www.google.com/recaptcha/api/siteverify' );
118
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
118
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
119 119
 			glsr_log()->error( $response->get_error_message() );
120 120
 			return false;
121 121
 		}
122
-		$response = json_decode( wp_remote_retrieve_body( $response ));
123
-		if( !empty( $response->success )) {
122
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
123
+		if( !empty($response->success) ) {
124 124
 			return boolval( $response->success );
125 125
 		}
126 126
 		$errorCodes = [
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	{
144 144
 		$rules = $this->getValidationRules( $request );
145 145
 		$errors = glsr( Validator::class )->validate( $request, $rules );
146
-		if( empty( $errors )) {
146
+		if( empty($errors) ) {
147 147
 			return true;
148 148
 		}
149 149
 		$this->setSessionValues( 'errors', $errors );
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
161 161
 	{
162 162
 		glsr( Session::class )->set( $this->form_id.$type, $value );
163
-		if( !empty( $loggedMessage )) {
163
+		if( !empty($loggedMessage) ) {
164 164
 			glsr_log()->warning( $loggedMessage );
165 165
 			glsr_log()->warning( $this->request );
166 166
 		}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	protected function validateAkismet()
173 173
 	{
174
-		if( !empty( $this->error ))return;
175
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
174
+		if( !empty($this->error) )return;
175
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
176 176
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
177 177
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
178 178
 	}
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	protected function validateBlacklist()
184 184
 	{
185
-		if( !empty( $this->error ))return;
186
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
185
+		if( !empty($this->error) )return;
186
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
187 187
 		$blacklistAction = glsr( OptionManager::class )->get( 'settings.reviews-form.blacklist.action' );
188 188
 		if( $blacklistAction == 'unapprove' ) {
189 189
 			$this->request['blacklisted'] = true;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function validateCustom()
201 201
 	{
202
-		if( !empty( $this->error ))return;
202
+		if( !empty($this->error) )return;
203 203
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
204 204
 		if( $validated === true )return;
205 205
 		$this->setSessionValues( 'errors', [] );
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validateHoneyPot()
216 216
 	{
217
-		if( !empty( $this->error ))return;
218
-		if( empty( $this->request['gotcha'] ))return;
217
+		if( !empty($this->error) )return;
218
+		if( empty($this->request['gotcha']) )return;
219 219
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
220 220
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
221 221
 	}
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	protected function validateRecaptcha()
227 227
 	{
228
-		if( !empty( $this->error ))return;
228
+		if( !empty($this->error) )return;
229 229
 		$isValid = $this->isRecaptchaResponseValid();
230
-		if( is_null( $isValid )) {
230
+		if( is_null( $isValid ) ) {
231 231
 			$this->setSessionValues( 'recaptcha', true );
232 232
 			$this->recaptchaIsUnset = true;
233 233
 		}
Please login to merge, or discard this patch.
plugin/Modules/ListTable/Columns.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	public function renderFilters( $postType )
16 16
 	{
17 17
 		if( $postType !== Application::POST_TYPE )return;
18
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
18
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
19 19
 			$status = 'publish';
20 20
 		}
21 21
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	protected function buildColumnAssignedTo( $postId )
46 46
 	{
47 47
 		$post = get_post( glsr( Database::class )->getReviewMeta( $postId )->assigned_to );
48
-		if( !( $post instanceof WP_Post ) || $post->post_status != 'publish' ) {
48
+		if( !($post instanceof WP_Post) || $post->post_status != 'publish' ) {
49 49
 			return '—';
50 50
 		}
51 51
 		return glsr( Builder::class )->a( get_the_title( $post->ID ), [
52 52
 			'href' => (string)get_the_permalink( $post->ID ),
53
-		]);
53
+		] );
54 54
 	}
55 55
 
56 56
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		return glsr( Html::class )->buildPartial( 'star-rating', [
72 72
 			'rating' => glsr( Database::class )->getReviewMeta( $postId )->rating,
73
-		]);
73
+		] );
74 74
 	}
75 75
 
76 76
 	/**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 		$pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned
83 83
 			? ' pinned'
84 84
 			: '';
85
-		return glsr( Builder::class )->i([
85
+		return glsr( Builder::class )->i( [
86 86
 			'class' => trim( 'dashicons dashicons-sticky '.$pinned ),
87 87
 			'data-id' => $postId,
88
-		]);
88
+		] );
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	protected function buildColumnType( $postId )
96 96
 	{
97 97
 		$reviewMeta = glsr( Database::class )->getReviewMeta( $postId );
98
-		return isset( glsr()->reviewTypes[$reviewMeta->review_type] )
98
+		return isset(glsr()->reviewTypes[$reviewMeta->review_type])
99 99
 			? glsr()->reviewTypes[$reviewMeta->review_type]
100 100
 			: $reviewMeta->review_type;
101 101
 	}
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function renderFilterRatings( $ratings )
108 108
 	{
109
-		if( empty( $ratings )
109
+		if( empty($ratings)
110 110
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
111 111
 		)return;
112
-		$ratings = array_flip( array_reverse( $ratings ));
112
+		$ratings = array_flip( array_reverse( $ratings ) );
113 113
 		array_walk( $ratings, function( &$value, $key ) {
114 114
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
115 115
 			$value = sprintf( $label, $key );
116 116
 		});
117 117
 		$ratings = [__( 'All ratings', 'site-reviews' )] + $ratings;
118
-		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ));
118
+		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ) );
119 119
 		glsr( Html::class )->renderPartial( 'filterby', [
120 120
 			'name' => 'rating',
121 121
 			'values' => $ratings,
122
-		]);
122
+		] );
123 123
 	}
124 124
 
125 125
 	/**
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	{
131 131
 		if( count( glsr()->reviewTypes ) < 2 )return;
132 132
 		$reviewTypes = ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes;
133
-		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ));
133
+		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ) );
134 134
 		glsr( Html::class )->renderPartial( 'filterby', [
135 135
 			'name' => 'review_type',
136 136
 			'options' => $reviewTypes,
137
-		]);
137
+		] );
138 138
 	}
139 139
 }
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
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		natsort( $routines );
17 17
 		array_walk( $routines, function( $routine ) {
18 18
 			$version = str_replace( strtolower( __CLASS__ ).'_', '', $routine );
19
-			if( version_compare( glsr()->version, $version, '>=' ))return;
19
+			if( version_compare( glsr()->version, $version, '>=' ) )return;
20 20
 			call_user_func( [$this, $routine] );
21 21
 		});
22 22
 		$this->updateVersion();
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	public function updateVersion()
29 29
 	{
30 30
 		$currentVersion = glsr( OptionManager::class )->get( 'version' );
31
-		if( version_compare( $currentVersion, glsr()->version, '<' )) {
31
+		if( version_compare( $currentVersion, glsr()->version, '<' ) ) {
32 32
 			glsr( OptionManager::class )->set( 'version', glsr()->version );
33 33
 		}
34 34
 		if( $currentVersion != glsr()->version ) {
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function approve()
23 23
 	{
24
-		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
25
-		wp_update_post([
24
+		check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
25
+		wp_update_post( [
26 26
 			'ID' => $postId,
27 27
 			'post_status' => 'publish',
28
-		]);
28
+		] );
29 29
 		wp_safe_redirect( wp_get_referer() );
30 30
 		exit;
31 31
 	}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty($value) )continue;
58 58
 			$value = $columns[$key];
59 59
 		}
60
-		if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) {
61
-			unset( $postTypeColumns['review_type'] );
60
+		if( count( glsr( Database::class )->getReviewsMeta( 'type' ) ) < 2 ) {
61
+			unset($postTypeColumns['review_type']);
62 62
 		}
63 63
 		return array_filter( $postTypeColumns, 'strlen' );
64 64
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) {
85 85
 			return $actions;
86 86
 		}
87
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
87
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
88 88
 		$rowActions = [
89 89
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
90 90
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key ),
98 98
 					$key.'-review_'.$post->ID
99 99
 				),
100
-			]);
100
+			] );
101 101
 		}
102 102
 		return $actions;
103 103
 	}
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 	public function filterSortableColumns( array $columns )
110 110
 	{
111 111
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
112
-		unset( $postTypeColumns['cb'] );
112
+		unset($postTypeColumns['cb']);
113 113
 		foreach( $postTypeColumns as $key => $value ) {
114
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
114
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
115 115
 			$columns[$key] = $key;
116 116
 		}
117 117
 		return $columns;
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
131 131
 	{
132
-		if( $this->canModifyTranslation( $domain )) {
132
+		if( $this->canModifyTranslation( $domain ) ) {
133 133
 			$strings = [
134 134
 				'Published' => __( 'Approved', 'site-reviews' ),
135 135
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
136 136
 			];
137 137
 			foreach( $strings as $search => $replace ) {
138 138
 				if( strpos( $single, $search ) === false )continue;
139
-				$translation = $this->getTranslation([
139
+				$translation = $this->getTranslation( [
140 140
 					'number' => $number,
141 141
 					'plural' => str_replace( $search, $replace, $plural ),
142 142
 					'single' => str_replace( $search, $replace, $single ),
143
-				]);
143
+				] );
144 144
 			}
145 145
 		}
146 146
 		return $translation;
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function saveBulkEditFields( $postId )
188 188
 	{
189
-		if( !current_user_can( 'edit_posts' ))return;
189
+		if( !current_user_can( 'edit_posts' ) )return;
190 190
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
191
-		if( $assignedTo && get_post( $assignedTo )) {
191
+		if( $assignedTo && get_post( $assignedTo ) ) {
192 192
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
193 193
 		}
194 194
 	}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function setQueryForColumn( WP_Query $query )
201 201
 	{
202
-		if( !$this->hasPermission( $query ))return;
202
+		if( !$this->hasPermission( $query ) )return;
203 203
 		$this->setMetaQuery( $query, [
204 204
 			'rating', 'review_type',
205
-		]);
205
+		] );
206 206
 		$this->setOrderby( $query );
207 207
 	}
208 208
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function unapprove()
214 214
 	{
215
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
216
-		wp_update_post([
215
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
216
+		wp_update_post( [
217 217
 			'ID' => $postId,
218 218
 			'post_status' => 'pending',
219
-		]);
219
+		] );
220 220
 		wp_safe_redirect( wp_get_referer() );
221 221
 		exit;
222 222
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			'single' => '',
246 246
 			'text' => '',
247 247
 		];
248
-		$args = (object) wp_parse_args( $args, $defaults );
248
+		$args = (object)wp_parse_args( $args, $defaults );
249 249
 		$translations = get_translations_for_domain( Application::ID );
250 250
 		return $args->text
251 251
 			? $translations->translate( $args->text )
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
271 271
 	{
272 272
 		foreach( $metaKeys as $key ) {
273
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
273
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
274 274
 			$metaQuery = (array)$query->get( 'meta_query' );
275 275
 			$metaQuery[] = [
276 276
 				'key' => $key,
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	{
288 288
 		$orderby = $query->get( 'orderby' );
289 289
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
290
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
291
-		if( in_array( $orderby, array_keys( $columns ))) {
290
+		unset($columns['cb'], $columns['title'], $columns['date']);
291
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
292 292
 			$query->set( 'meta_key', $orderby );
293 293
 			$query->set( 'orderby', 'meta_value' );
294 294
 		}
Please login to merge, or discard this patch.
plugin/Modules/Translator.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$translations = $this->getTranslations();
32 32
 		$entries = $this->filter( $translations, $this->entries() )->results();
33
-		array_walk( $translations, function( &$entry ) use( $entries ) {
33
+		array_walk( $translations, function( &$entry ) use($entries) {
34 34
 			$entry['desc'] = array_key_exists( $entry['id'], $entries )
35 35
 				? $this->getEntryString( $entries[$entry['id']], 'msgctxt' )
36 36
 				: '';
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function entries()
45 45
 	{
46
-		if( !isset( $this->entries )) {
46
+		if( !isset($this->entries) ) {
47 47
 			try {
48 48
 				$entries = $this->normalize(
49
-					Parser::parseFile( glsr()->path( 'languages/site-reviews.pot' ))->getEntries()
49
+					Parser::parseFile( glsr()->path( 'languages/site-reviews.pot' ) )->getEntries()
50 50
 				);
51 51
 			}
52 52
 			catch( Exception $e ) {
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function filter( $filterWith = null, $entries = null, $intersect = true )
79 79
 	{
80
-		if( !is_array( $entries )) {
80
+		if( !is_array( $entries ) ) {
81 81
 			$entries = $this->results;
82 82
 		}
83
-		if( !is_array( $filterWith )) {
83
+		if( !is_array( $filterWith ) ) {
84 84
 			$filterWith = $this->getTranslations();
85 85
 		}
86
-		$keys = array_flip( array_column( $filterWith, 'id' ));
86
+		$keys = array_flip( array_column( $filterWith, 'id' ) );
87 87
 		$this->results = $intersect
88 88
 			? array_intersect_key( $entries, $keys )
89 89
 			: array_diff_key( $entries, $keys );
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		return $this->translate( $translation, $domain, [
102 102
 			'single' => $text,
103
-		]);
103
+		] );
104 104
 	}
105 105
 
106 106
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		return $this->translate( $translation, $domain, [
116 116
 			'context' => $context,
117 117
 			'single' => $text,
118
-		]);
118
+		] );
119 119
 	}
120 120
 
121 121
 	/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			'number' => $number,
133 133
 			'plural' => $plural,
134 134
 			'single' => $single,
135
-		]);
135
+		] );
136 136
 	}
137 137
 
138 138
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			'number' => $number,
152 152
 			'plural' => $plural,
153 153
 			'single' => $single,
154
-		]);
154
+		] );
155 155
 	}
156 156
 
157 157
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	public function render( $template, array $entry )
162 162
 	{
163 163
 		$data = array_combine(
164
-			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )),
164
+			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ),
165 165
 			$entry
166 166
 		);
167 167
 		ob_start();
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 				'p1' => $this->getEntryString( $entry, 'msgid_plural' ),
199 199
 				's1' => $this->getEntryString( $entry, 'msgid' ),
200 200
 			];
201
-			$text = !empty( $data['p1'] )
201
+			$text = !empty($data['p1'])
202 202
 				? sprintf( '%s | %s', $data['s1'], $data['p1'] )
203 203
 				: $data['s1'];
204 204
 			$rendered .= $this->render( 'result', [
205 205
 				'entry' => wp_json_encode( $data ),
206 206
 				'text' => wp_strip_all_tags( $text ),
207
-			]);
207
+			] );
208 208
 		}
209 209
 		if( $resetAfterRender ) {
210 210
 			$this->reset();
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 	public function search( $needle = '' )
238 238
 	{
239 239
 		$this->reset();
240
-		$needle = trim( strtolower( $needle ));
240
+		$needle = trim( strtolower( $needle ) );
241 241
 		foreach( $this->entries() as $key => $entry ) {
242
-			$single = strtolower( $this->getEntryString( $entry, 'msgid' ));
243
-			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ));
242
+			$single = strtolower( $this->getEntryString( $entry, 'msgid' ) );
243
+			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) );
244 244
 			if( strlen( $needle ) < static::SEARCH_THRESHOLD ) {
245
-				if( in_array( $needle, [$single, $plural] )) {
245
+				if( in_array( $needle, [$single, $plural] ) ) {
246 246
 					$this->results[$key] = $entry;
247 247
 				}
248 248
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		}
266 266
 		$args = $this->normalizeTranslationArgs( $args );
267 267
 		$strings = $this->getTranslationStrings( $args['single'], $args['plural'] );
268
-		if( empty( $strings )) {
268
+		if( empty($strings) ) {
269 269
 			return $original;
270 270
 		}
271 271
 		$string = current( $strings );
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	protected function getEntryString( array $entry, $key )
282 282
 	{
283
-		return isset( $entry[$key] )
284
-			? implode( '', (array) $entry[$key] )
283
+		return isset($entry[$key])
284
+			? implode( '', (array)$entry[$key] )
285 285
 			: '';
286 286
 	}
287 287
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	protected function getTranslations()
292 292
 	{
293 293
 		$settings = glsr( OptionManager::class )->get( 'settings' );
294
-		return isset( $settings['translations'] )
295
-			? $this->normalizeSettings( (array) $settings['translations'] )
294
+		return isset($settings['translations'])
295
+			? $this->normalizeSettings( (array)$settings['translations'] )
296 296
 			: [];
297 297
 	}
298 298
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	protected function getTranslationStrings( $single, $plural )
305 305
 	{
306
-		return array_filter( $this->getTranslations(), function( $string ) use( $single, $plural ) {
306
+		return array_filter( $this->getTranslations(), function( $string ) use($single, $plural) {
307 307
 			return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' )
308 308
 				&& $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' );
309 309
 		});
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		$keys = [
318 318
 			'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]',
319 319
 		];
320
-		array_walk( $entries, function( &$entry ) use( $keys ) {
320
+		array_walk( $entries, function( &$entry ) use($keys) {
321 321
 			foreach( $keys as $key ) {
322 322
 				$entry = $this->normalizeEntryString( $entry, $key );
323 323
 			}
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	protected function normalizeEntryString( array $entry, $key )
333 333
 	{
334
-		if( isset( $entry[$key] )) {
334
+		if( isset($entry[$key]) ) {
335 335
 			$entry[$key] = $this->getEntryString( $entry, $key );
336 336
 		}
337 337
 		return $entry;
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 		$defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' );
346 346
 		$strings = array_filter( $strings, 'is_array' );
347 347
 		foreach( $strings as &$string ) {
348
-			$string['type'] = isset( $string['p1'] ) ? 'plural' : 'single';
348
+			$string['type'] = isset($string['p1']) ? 'plural' : 'single';
349 349
 			$string = wp_parse_args( $string, $defaultString );
350 350
 		}
351 351
 		return array_filter( $strings, function( $string ) {
352
-			return !empty( $string['id'] );
352
+			return !empty($string['id']);
353 353
 		});
354 354
 	}
355 355
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	protected function translatePlural( $domain, array $string, array $args )
375 375
 	{
376
-		if( !empty( $string['p2'] )) {
376
+		if( !empty($string['p2']) ) {
377 377
 			$args['plural'] = $string['p2'];
378 378
 		}
379 379
 		return get_translations_for_domain( $domain )->translate_plural(
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	protected function translateSingle( $domain, array $string, array $args )
392 392
 	{
393
-		if( !empty( $string['s2'] )) {
393
+		if( !empty($string['s2']) ) {
394 394
 			$args['single'] = $string['s2'];
395 395
 		}
396 396
 		return get_translations_for_domain( $domain )->translate(
Please login to merge, or discard this patch.
plugin/Filters.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@
 block discarded – undo
38 38
 	 */
39 39
 	public function run()
40 40
 	{
41
-		add_filter( 'mce_external_plugins',                                    [$this->admin, 'filterTinymcePlugins'], 15 );
42
-		add_filter( 'plugin_action_links_'.$this->basename,                    [$this->admin, 'filterActionLinks'] );
43
-		add_filter( 'dashboard_glance_items',                                  [$this->admin, 'filterDashboardGlanceItems'] );
44
-		add_filter( 'wp_editor_settings',                                      [$this->editor, 'filterEditorSettings'] );
45
-		add_filter( 'the_editor',                                              [$this->editor, 'filterEditorTextarea'] );
46
-		add_filter( 'gettext',                                                 [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47
-		add_filter( 'gettext_with_context',                                    [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48
-		add_filter( 'post_updated_messages',                                   [$this->editor, 'filterUpdateMessages'] );
49
-		add_filter( 'bulk_post_updated_messages',                              [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
-		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns',         [$this->listtable, 'filterColumnsForPostType'] );
51
-		add_filter( 'default_hidden_columns',                                  [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
52
-		add_filter( 'post_row_actions',                                        [$this->listtable, 'filterRowActions'], 10, 2 );
41
+		add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 );
42
+		add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] );
43
+		add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] );
44
+		add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] );
45
+		add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] );
46
+		add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47
+		add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48
+		add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] );
49
+		add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
+		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] );
51
+		add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
52
+		add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 );
53 53
 		add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] );
54
-		add_filter( 'ngettext',                                                [$this->listtable, 'filterStatusText'], 10, 5 );
54
+		add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 );
55 55
 		// add_filter( 'script_loader_tag',                                       [$this->public, 'filterEnqueuedScripts'], 10, 2 );
56 56
 		// add_filter( 'query_vars',                                              [$this->public, 'filterQueryVars'] );
57 57
 		// add_filter( 'gettext',                                                 [$this->translator, 'filterGettext'], 10, 3 );
Please login to merge, or discard this patch.
plugin/Actions.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -42,48 +42,48 @@
 block discarded – undo
42 42
 	 */
43 43
 	public function run()
44 44
 	{
45
-		add_action( 'admin_enqueue_scripts',                     [$this->admin, 'enqueueAssets'] );
46
-		add_action( 'admin_enqueue_scripts',                     [$this->admin, 'registerPointers'], 13 );
47
-		add_action( 'admin_init',                                [$this->admin, 'registerShortcodeButtons'] );
48
-		add_action( 'edit_form_after_title',                     [$this->admin, 'renderReviewEditor'] );
49
-		add_action( 'edit_form_top',                             [$this->admin, 'renderReviewNotice'] );
50
-		add_action( 'media_buttons',                             [$this->admin, 'renderTinymceButton'], 11 );
51
-		add_action( 'plugins_loaded',                            [$this->app, 'getDefaults'], 11 );
52
-		add_action( 'plugins_loaded',                            [$this->app, 'registerAddons'] );
53
-		add_action( 'plugins_loaded',                            [$this->app, 'registerLanguages'] );
54
-		add_action( 'plugins_loaded',                            [$this->app, 'registerReviewTypes'] );
55
-		add_action( 'upgrader_process_complete',                 [$this->app, 'upgraded'], 10, 2 );
56
-		add_action( 'admin_enqueue_scripts',                     [$this->editor, 'customizePostStatusLabels'] );
57
-		add_action( 'site-reviews/create/review',                [$this->editor, 'onCreateReview'], 10, 3 );
58
-		add_action( 'before_delete_post',                        [$this->editor, 'onDeleteReview'] );
59
-		add_action( 'save_post_'.Application::POST_TYPE,         [$this->editor, 'onSaveReview'], 20, 2 );
60
-		add_action( 'add_meta_boxes',                            [$this->editor, 'registerMetaBoxes'] );
61
-		add_action( 'admin_print_scripts',                       [$this->editor, 'removeAutosave'], 999 );
62
-		add_action( 'admin_menu',                                [$this->editor, 'removeMetaBoxes'] );
63
-		add_action( 'post_submitbox_misc_actions',               [$this->editor, 'renderPinnedInPublishMetaBox'] );
64
-		add_action( 'admin_action_revert',                       [$this->editor, 'revertReview'] );
65
-		add_action( 'save_post_'.Application::POST_TYPE,         [$this->editor, 'saveMetaboxes'] );
66
-		add_action( 'admin_action_approve',                      [$this->listtable, 'approve'] );
67
-		add_action( 'bulk_edit_custom_box',                      [$this->listtable, 'renderBulkEditFields'], 10, 2 );
68
-		add_action( 'restrict_manage_posts',                     [$this->listtable, 'renderColumnFilters'] );
69
-		add_action( 'manage_posts_custom_column',                [$this->listtable, 'renderColumnValues'] );
70
-		add_action( 'save_post_'.Application::POST_TYPE,         [$this->listtable, 'saveBulkEditFields'] );
71
-		add_action( 'pre_get_posts',                             [$this->listtable, 'setQueryForColumn'] );
72
-		add_action( 'admin_action_unapprove',                    [$this->listtable, 'unapprove'] );
73
-		add_action( 'init',                                      [$this->main, 'registerPostType'], 8 );
74
-		add_action( 'init',                                      [$this->main, 'registerShortcodes'] );
75
-		add_action( 'init',                                      [$this->main, 'registerTaxonomy'] );
76
-		add_action( 'widgets_init',                              [$this->main, 'registerWidgets'] );
77
-		add_action( 'wp_footer',                                 [$this->main, 'renderSchema'] );
78
-		add_action( 'admin_menu',                                [$this->menu, 'registerMenuCount'] );
79
-		add_action( 'admin_menu',                                [$this->menu, 'registerSubMenus'] );
45
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
46
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'registerPointers'], 13 );
47
+		add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] );
48
+		add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] );
49
+		add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] );
50
+		add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
51
+		add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
52
+		add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
53
+		add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
54
+		add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
55
+		add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
56
+		add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
57
+		add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 );
58
+		add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] );
59
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 );
60
+		add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] );
61
+		add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
62
+		add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
63
+		add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
64
+		add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
65
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
66
+		add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
67
+		add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
68
+		add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
69
+		add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'] );
70
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
71
+		add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
72
+		add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
73
+		add_action( 'init', [$this->main, 'registerPostType'], 8 );
74
+		add_action( 'init', [$this->main, 'registerShortcodes'] );
75
+		add_action( 'init', [$this->main, 'registerTaxonomy'] );
76
+		add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
77
+		add_action( 'wp_footer', [$this->main, 'renderSchema'] );
78
+		add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
79
+		add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
80 80
 		// add_action( 'admin_init',                                [$this->menu, 'setCustomPermissions'], 999 );
81 81
 		// add_action( 'wp_enqueue_scripts',                        [$this->public, 'enqueueAssets'], 999 );
82
-		add_action( 'admin_init',                                   [$this->router, 'routeAdminPostRequest'] );
83
-		add_action( 'wp_ajax_'.Application::PREFIX.'action',        [$this->router, 'routeAjaxRequest'] );
82
+		add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
83
+		add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
84 84
 		add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
85
-		add_action( 'init',                                         [$this->router, 'routePublicPostRequest'] );
86
-		add_action( 'admin_init',                                   [$this->router, 'routeWebhookRequest'] );
85
+		add_action( 'init', [$this->router, 'routePublicPostRequest'] );
86
+		add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] );
87 87
 		// add_action( 'admin_init',                                [$this->settings, 'registerSettings'] );
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
plugin/Modules/Editor/Labels.php 1 patch
Spacing   +6 added lines, -6 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,7 +33,7 @@  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 = [
38 38
 				'Pending Review' => __( 'Unapproved', 'site-reviews' ),
39 39
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	public function filterUpdateMessages( array $messages )
56 56
 	{
57 57
 		$post = get_post();
58
-		if( !( $post instanceof WP_Post ))return;
58
+		if( !($post instanceof WP_Post) )return;
59 59
 		$strings = $this->getReviewLabels();
60 60
 		$restored = filter_input( INPUT_GET, 'revision' );
61
-		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) {
61
+		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) {
62 62
 			$restored = sprintf( $strings['restored'], $revisionTitle );
63 63
 		}
64
-		$scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ));
65
-		$messages[ Application::POST_TYPE ] = [
64
+		$scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) );
65
+		$messages[Application::POST_TYPE] = [
66 66
 			 1 => $strings['updated'],
67 67
 			 4 => $strings['updated'],
68 68
 			 5 => $restored,
Please login to merge, or discard this patch.
plugin/Modules/Editor/Customization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	 */
58 58
 	protected function isReviewEditable()
59 59
 	{
60
-		$postId = intval( filter_input( INPUT_GET, 'post' ));
60
+		$postId = intval( filter_input( INPUT_GET, 'post' ) );
61 61
 		return $postId > 0
62 62
 			&& get_post_meta( $postId, 'review_type', true ) == 'local'
63 63
 			&& $this->isReviewEditor();
Please login to merge, or discard this patch.