Passed
Push — master ( ceec33...d1be46 )
by Paul
05:18
created
views/partials/editor/metabox-categories.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		</ul>
21 21
 	</div>
22 22
 
23
-	<?php if( current_user_can( $taxonomy->cap->edit_terms )) : ?>
23
+	<?php if( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
24 24
 	<div id="<?= $tax_name; ?>-adder" class="wp-hidden-children">
25 25
 		<a id="<?= $tax_name; ?>-add-toggle" href="#<?= $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new">
26 26
 			<?= sprintf( '+ %s', $taxonomy->labels->add_new_item ); ?>
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			<label class="screen-reader-text" for="new<?= $tax_name; ?>"><?= $taxonomy->labels->add_new_item; ?></label>
30 30
 			<input type="text" name="new<?= $tax_name; ?>" id="new<?= $tax_name; ?>" class="form-required form-input-tip" value="<?= esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/>
31 31
 			<input type="button" id="<?= $tax_name; ?>-add-submit" data-wp-lists="add:<?= $tax_name; ?>checklist:<?= $tax_name; ?>-add" class="button category-add-submit" value="<?= esc_attr( $taxonomy->labels->add_new_item ); ?>" />
32
-			<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
32
+			<?php wp_nonce_field( 'add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false ); ?>
33 33
 			<span id="<?= $tax_name; ?>-ajax-response"></span>
34 34
 		</div>
35 35
 	</div>
Please login to merge, or discard this patch.
views/partials/email/header.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,6 +4,6 @@
 block discarded – undo
4 4
 <html>
5 5
 <head>
6 6
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7
-    <title><?= wp_specialchars_decode( (string) get_option( 'blogname', '' ), ENT_QUOTES ); ?></title>
7
+    <title><?= wp_specialchars_decode( (string)get_option( 'blogname', '' ), ENT_QUOTES ); ?></title>
8 8
 </head>
9 9
 <body>
Please login to merge, or discard this patch.
views/partials/email/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php defined( 'WPINC' ) || die;
2 2
 
3
-include trailingslashit(__DIR__).'header.php';
4
-include trailingslashit(__DIR__).'body.php';
5
-include trailingslashit(__DIR__).'footer.php';
3
+include trailingslashit( __DIR__ ).'header.php';
4
+include trailingslashit( __DIR__ ).'body.php';
5
+include trailingslashit( __DIR__ ).'footer.php';
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		$links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
34 34
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
35
-		]);
35
+		] );
36 36
 		return $links;
37 37
 	}
38 38
 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	{
45 45
 		$postType = Application::POST_TYPE;
46 46
 		$postCount = wp_count_posts( $postType );
47
-		if( !isset( $postCount->publish ) || !$postCount->publish ) {
47
+		if( !isset($postCount->publish) || !$postCount->publish ) {
48 48
 			return $items;
49 49
 		}
50 50
 		$postTypeObject = get_post_type_object( $postType );
51 51
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
52
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
52
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
53 53
 		$items[] = $postTypeObject && current_user_can( $postTypeObject->cap->edit_posts )
54 54
 			? sprintf( '<a class="glsr-review-count" href="edit.php?post_type=%s">%s</a>', $postType, $text )
55 55
 			: sprintf( '<span class="glsr-review-count">%s</span>', $text );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public function filterTinymcePlugins( array $plugins )
64 64
 	{
65 65
 		if( user_can_richedit()
66
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
66
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
67 67
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
68 68
 		}
69 69
 		return $plugins;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function registerPointers()
77 77
 	{
78
-		$command = new RegisterPointers([[
78
+		$command = new RegisterPointers( [[
79 79
 			'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
80 80
 			'id' => 'glsr-pointer-pinned',
81 81
 			'position' => [
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			'screen' => Application::POST_TYPE,
86 86
 			'target' => '#misc-pub-pinned',
87 87
 			'title' => __( 'Pin Your Reviews', 'site-reviews' ),
88
-		]]);
88
+		]] );
89 89
 		$this->execute( $command );
90 90
 	}
91 91
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function registerShortcodeButtons()
97 97
 	{
98
-		$command = new RegisterShortcodeButtons([
98
+		$command = new RegisterShortcodeButtons( [
99 99
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
100 100
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
101 101
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
102
-		]);
102
+		] );
103 103
 		$this->execute( $command );
104 104
 	}
105 105
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if( !$this->isReviewEditable( $post ) )return;
113 113
 		glsr()->render( 'partials/editor/review', [
114 114
 			'post' => $post,
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function renderReviewNotice( WP_Post $post )
123 123
 	{
124 124
 		if( !$this->isReviewEditable( $post ) )return;
125
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
125
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
126 126
 		glsr()->render( 'partials/editor/notice' );
127 127
 	}
128 128
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 		if( glsr_current_screen()->base != 'post' )return;
136 136
 		$shortcodes = [];
137 137
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
138
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
138
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
139 139
 			$shortcodes[$shortcode] = $values;
140 140
 		}
141
-		if( empty( $shortcodes ))return;
141
+		if( empty($shortcodes) )return;
142 142
 		glsr()->render( 'partials/editor/tinymce', [
143 143
 			'shortcodes' => $shortcodes,
144
-		]);
144
+		] );
145 145
 	}
146 146
 
147 147
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	public function routerClearLog()
151 151
 	{
152 152
 		glsr( Logger::class )->clear();
153
-		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ));
153
+		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) );
154 154
 	}
155 155
 
156 156
 	/**
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -109,7 +109,9 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function renderReviewEditor( WP_Post $post )
111 111
 	{
112
-		if( !$this->isReviewEditable( $post ) )return;
112
+		if( !$this->isReviewEditable( $post ) ) {
113
+			return;
114
+		}
113 115
 		glsr()->render( 'partials/editor/review', [
114 116
 			'post' => $post,
115 117
 		]);
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 	 */
122 124
 	public function renderReviewNotice( WP_Post $post )
123 125
 	{
124
-		if( !$this->isReviewEditable( $post ) )return;
126
+		if( !$this->isReviewEditable( $post ) ) {
127
+			return;
128
+		}
125 129
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
126 130
 		glsr()->render( 'partials/editor/notice' );
127 131
 	}
@@ -132,13 +136,19 @@  discard block
 block discarded – undo
132 136
 	 */
133 137
 	public function renderTinymceButton()
134 138
 	{
135
-		if( glsr_current_screen()->base != 'post' )return;
139
+		if( glsr_current_screen()->base != 'post' ) {
140
+			return;
141
+		}
136 142
 		$shortcodes = [];
137 143
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
138
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
144
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) {
145
+				continue;
146
+			}
139 147
 			$shortcodes[$shortcode] = $values;
140 148
 		}
141
-		if( empty( $shortcodes ))return;
149
+		if( empty( $shortcodes )) {
150
+			return;
151
+		}
142 152
 		glsr()->render( 'partials/editor/tinymce', [
143 153
 			'shortcodes' => $shortcodes,
144 154
 		]);
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function renderAssignedToMetabox( WP_Post $post )
149 149
 	{
150
-		if( !$this->isReviewPostType( $post ))return;
151
-		$assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ));
150
+		if( !$this->isReviewPostType( $post ) )return;
151
+		$assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ) );
152 152
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
153 153
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
154 154
 			'id' => $assignedTo,
155 155
 			'template' => $this->buildAssignedToTemplate( $assignedTo ),
156
-		]);
156
+		] );
157 157
 	}
158 158
 
159 159
 	/**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function renderDetailsMetaBox( WP_Post $post )
164 164
 	{
165
-		if( !$this->isReviewPostType( $post ))return;
165
+		if( !$this->isReviewPostType( $post ) )return;
166 166
 		$review = glsr( Database::class )->getReview( $post );
167 167
 		glsr()->render( 'partials/editor/metabox-details', [
168 168
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
169 169
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
170
-		]);
170
+		] );
171 171
 	}
172 172
 
173 173
 	/**
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function renderPinnedInPublishMetaBox()
178 178
 	{
179
-		if( !$this->isReviewPostType( get_post() ))return;
179
+		if( !$this->isReviewPostType( get_post() ) )return;
180 180
 		glsr()->render( 'partials/editor/pinned', [
181
-			'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
182
-		]);
181
+			'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
182
+		] );
183 183
 	}
184 184
 
185 185
 	/**
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function renderResponseMetaBox( WP_Post $post )
190 190
 	{
191
-		if( !$this->isReviewPostType( $post ))return;
191
+		if( !$this->isReviewPostType( $post ) )return;
192 192
 		wp_nonce_field( 'response', '_nonce-response', false );
193 193
 		glsr()->render( 'partials/editor/metabox-response', [
194 194
 			'response' => glsr( Database::class )->getReview( $post )->response,
195
-		]);
195
+		] );
196 196
 	}
197 197
 
198 198
 	/**
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function renderTaxonomyMetabox( WP_Post $post )
204 204
 	{
205
-		if( !$this->isReviewPostType( $post ))return;
205
+		if( !$this->isReviewPostType( $post ) )return;
206 206
 		glsr()->render( 'partials/editor/metabox-categories', [
207 207
 			'post' => $post,
208 208
 			'tax_name' => Application::TAXONOMY,
209 209
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
210
-		]);
210
+		] );
211 211
 	}
212 212
 
213 213
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function revertReview()
219 219
 	{
220
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
220
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
221 221
 		glsr( Database::class )->revertReview( $postId );
222 222
 		$this->redirect( $postId, 52 );
223 223
 	}
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
 	protected function buildAssignedToTemplate( $assignedTo )
241 241
 	{
242 242
 		$assignedPost = get_post( $assignedTo );
243
-		if( !( $assignedPost instanceof WP_Post ))return;
243
+		if( !($assignedPost instanceof WP_Post) )return;
244 244
 		return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [
245 245
 			'context' => [
246 246
 				'url' => (string)get_permalink( $assignedPost ),
247 247
 				'title' => get_the_title( $assignedPost ),
248 248
 			],
249
-		]);
249
+		] );
250 250
 	}
251 251
 
252 252
 	/**
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 				'class' => 'button button-large',
268 268
 				'href' => $revertUrl,
269 269
 				'id' => 'revert',
270
-			]);
270
+			] );
271 271
 		}
272 272
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
273 273
 			'class' => 'button button-large',
274 274
 			'disabled' => true,
275 275
 			'id' => 'revert',
276
-		]);
276
+		] );
277 277
 	}
278 278
 
279 279
 	/**
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 	protected function getReviewType( $review )
284 284
 	{
285 285
 		$reviewType = $review->review_type;
286
-		if( !empty( $review->url )) {
286
+		if( !empty($review->url) ) {
287 287
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
288 288
 				'href' => $review->url,
289 289
 				'target' => '_blank',
290
-			]);
290
+			] );
291 291
 		}
292 292
 		return in_array( $reviewType, glsr()->reviewTypes )
293 293
 			? glsr()->reviewTypes[$reviewType]
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	protected function normalizeDetailsMetaBox( $review )
311 311
 	{
312
-		$reviewer = empty( $review->user_id )
312
+		$reviewer = empty($review->user_id)
313 313
 			? __( 'Unregistered user', 'site-reviews' )
314 314
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
315 315
 				'href' => get_author_posts_url( $review->user_id ),
316
-			]);
317
-		$email = empty( $review->email )
316
+			] );
317
+		$email = empty($review->email)
318 318
 			? '&mdash;'
319 319
 			: glsr( Builder::class )->a( $review->email, [
320 320
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
321
-			]);
321
+			] );
322 322
 		$metabox = [
323 323
 			__( 'Rating', 'site-reviews' ) => glsr( Html::class )->renderPartial( 'star-rating', ['rating' => $review->rating] ),
324 324
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		$redirectUri = $hasReferer
347 347
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
348 348
 			: get_edit_post_link( $postId );
349
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
349
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
350 350
 		exit;
351 351
 	}
352 352
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -117,7 +117,9 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function registerMetaBoxes( $postType )
119 119
 	{
120
-		if( $postType != Application::POST_TYPE )return;
120
+		if( $postType != Application::POST_TYPE ) {
121
+			return;
122
+		}
121 123
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
122 124
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
123 125
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
@@ -147,7 +149,9 @@  discard block
 block discarded – undo
147 149
 	 */
148 150
 	public function renderAssignedToMetabox( WP_Post $post )
149 151
 	{
150
-		if( !$this->isReviewPostType( $post ))return;
152
+		if( !$this->isReviewPostType( $post )) {
153
+			return;
154
+		}
151 155
 		$assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ));
152 156
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
153 157
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
@@ -162,7 +166,9 @@  discard block
 block discarded – undo
162 166
 	 */
163 167
 	public function renderDetailsMetaBox( WP_Post $post )
164 168
 	{
165
-		if( !$this->isReviewPostType( $post ))return;
169
+		if( !$this->isReviewPostType( $post )) {
170
+			return;
171
+		}
166 172
 		$review = glsr( Database::class )->getReview( $post );
167 173
 		glsr()->render( 'partials/editor/metabox-details', [
168 174
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -176,7 +182,9 @@  discard block
 block discarded – undo
176 182
 	 */
177 183
 	public function renderPinnedInPublishMetaBox()
178 184
 	{
179
-		if( !$this->isReviewPostType( get_post() ))return;
185
+		if( !$this->isReviewPostType( get_post() )) {
186
+			return;
187
+		}
180 188
 		glsr()->render( 'partials/editor/pinned', [
181 189
 			'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
182 190
 		]);
@@ -188,7 +196,9 @@  discard block
 block discarded – undo
188 196
 	 */
189 197
 	public function renderResponseMetaBox( WP_Post $post )
190 198
 	{
191
-		if( !$this->isReviewPostType( $post ))return;
199
+		if( !$this->isReviewPostType( $post )) {
200
+			return;
201
+		}
192 202
 		wp_nonce_field( 'response', '_nonce-response', false );
193 203
 		glsr()->render( 'partials/editor/metabox-response', [
194 204
 			'response' => glsr( Database::class )->getReview( $post )->response,
@@ -202,7 +212,9 @@  discard block
 block discarded – undo
202 212
 	 */
203 213
 	public function renderTaxonomyMetabox( WP_Post $post )
204 214
 	{
205
-		if( !$this->isReviewPostType( $post ))return;
215
+		if( !$this->isReviewPostType( $post )) {
216
+			return;
217
+		}
206 218
 		glsr()->render( 'partials/editor/metabox-categories', [
207 219
 			'post' => $post,
208 220
 			'tax_name' => Application::TAXONOMY,
@@ -240,7 +252,9 @@  discard block
 block discarded – undo
240 252
 	protected function buildAssignedToTemplate( $assignedTo )
241 253
 	{
242 254
 		$assignedPost = get_post( $assignedTo );
243
-		if( !( $assignedPost instanceof WP_Post ))return;
255
+		if( !( $assignedPost instanceof WP_Post )) {
256
+			return;
257
+		}
244 258
 		return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [
245 259
 			'context' => [
246 260
 				'url' => (string)get_permalink( $assignedPost ),
Please login to merge, or discard this patch.
uninstall.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/site-reviews.php';
6
-if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return;
6
+if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ) ) )return;
7 7
 
8 8
 delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() );
9 9
 delete_option( 'widget_'.glsr()->id.'_site-reviews' );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,9 @@
 block discarded – undo
3 3
 defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/site-reviews.php';
6
-if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return;
6
+if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ))) {
7
+	return;
8
+}
7 9
 
8 10
 delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() );
9 11
 delete_option( 'widget_'.glsr()->id.'_site-reviews' );
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	public function defaults()
14 14
 	{
15 15
 		$settings = $this->settings();
16
-		return array_combine( array_keys( $settings ), array_column( $settings, 'default' ));
16
+		return array_combine( array_keys( $settings ), array_column( $settings, 'default' ) );
17 17
 	}
18 18
 
19 19
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	protected function normalize( array $settings )
54 54
 	{
55 55
 		array_walk( $settings, function( &$setting ) {
56
-			if( isset( $setting['default'] ))return;
56
+			if( isset($setting['default']) )return;
57 57
 			$setting['default'] = '';
58 58
 		});
59 59
 		return $settings;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 	protected function normalize( array $settings )
54 54
 	{
55 55
 		array_walk( $settings, function( &$setting ) {
56
-			if( isset( $setting['default'] ))return;
56
+			if( isset( $setting['default'] )) {
57
+				return;
58
+			}
57 59
 			$setting['default'] = '';
58 60
 		});
59 61
 		return $settings;
Please login to merge, or discard this patch.
plugin/Modules/Html/Field.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 			'is_multi' => false,
24 24
 			'is_valid' => true,
25 25
 			'path' => '',
26
-		]);
26
+		] );
27 27
 		$this->normalize();
28 28
 	}
29 29
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		return glsr( Template::class )->build( 'partials/settings/form-table-row', [
41 41
 			'context' => [
42 42
 				'class' => $this->getFieldClass(),
43
-				'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ),
43
+				'field' => glsr( Builder::class )->{$this->field['type']}($this->field),
44 44
 				'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ),
45 45
 			],
46
-		]);
46
+		] );
47 47
 	}
48 48
 
49 49
 	/**
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 			'context' => [
64 64
 				'class' => $this->getFieldClass(),
65 65
 				'depends_on' => $this->getFieldDependsOn(),
66
-				'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ),
66
+				'field' => glsr( Builder::class )->{$this->field['type']}($this->field),
67 67
 				'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ),
68 68
 				'legend' => $this->field['legend'],
69 69
 			],
70
-		]);
70
+		] );
71 71
 	}
72 72
 
73 73
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	protected function getFieldDefault()
87 87
 	{
88
-		return isset( $this->field['default'] )
88
+		return isset($this->field['default'])
89 89
 			? $this->field['default']
90 90
 			: '';
91 91
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function getFieldDependsOn()
97 97
 	{
98
-		return !empty( $this->field['depends_on'] )
98
+		return !empty($this->field['depends_on'])
99 99
 			? $this->field['depends_on']
100 100
 			: '';
101 101
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			$path,
112 112
 			glsr( Helper::class )->getPathValue( $path, glsr()->defaults )
113 113
 		);
114
-		if( is_array( $expectedValue )) {
114
+		if( is_array( $expectedValue ) ) {
115 115
 			return !in_array( $optionValue, $expectedValue );
116 116
 		}
117 117
 		return $optionValue != $expectedValue;
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 			'label', 'name', 'type',
129 129
 		];
130 130
 		foreach( $requiredValues as $value ) {
131
-			if( isset( $this->field[$value] ))continue;
131
+			if( isset($this->field[$value]) )continue;
132 132
 			$missingValues[] = $value;
133 133
 			$isValid = $this->field['is_valid'] = false;
134 134
 		}
135
-		if( !empty( $missingValues )) {
135
+		if( !empty($missingValues) ) {
136 136
 			glsr_log()
137
-				->warning( 'Field is missing: '.implode( ', ', $missingValues ))
137
+				->warning( 'Field is missing: '.implode( ', ', $missingValues ) )
138 138
 				->info( $this->field );
139 139
 		}
140 140
 		return $isValid;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$field = $this->field;
150 150
 		foreach( $field as $key => $value ) {
151 151
 			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
152
-			if( !method_exists( $this, $methodName ))continue;
152
+			if( !method_exists( $this, $methodName ) )continue;
153 153
 			$this->$methodName();
154 154
 		}
155 155
 		$this->normalizeFieldId();
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	protected function normalizeDependsOn()
164 164
 	{
165
-		if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return;
165
+		if( empty($this->field['depends_on']) || !is_array( $this->field['depends_on'] ) )return;
166 166
 		$path = key( $this->field['depends_on'] );
167 167
 		$value = $this->field['depends_on'][$path];
168
-		$this->field['depends_on'] = json_encode([
168
+		$this->field['depends_on'] = json_encode( [
169 169
 			'name' => glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() ),
170 170
 			'value' => $value,
171
-		], JSON_HEX_APOS|JSON_HEX_QUOT );
171
+		], JSON_HEX_APOS | JSON_HEX_QUOT );
172 172
 		$this->field['is_hidden'] = $this->isFieldHidden( $path, $value );
173 173
 	}
174 174
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function normalizeFieldId()
179 179
 	{
180
-		if( isset( $this->field['id'] ))return;
180
+		if( isset($this->field['id']) )return;
181 181
 		$this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] );
182 182
 	}
183 183
 
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	protected function normalizeFieldType()
188 188
 	{
189 189
 		$className = glsr( Helper::class )->buildClassName( $this->field['type'], 'Modules\Html\Fields' );
190
-		if( class_exists( $className )) {
190
+		if( class_exists( $className ) ) {
191 191
 			$this->field = array_merge( $this->field, glsr( $className )->defaults() );
192 192
 		}
193
-		if( in_array( $this->field['type'], static::MULTI_FIELD_TYPES )) {
193
+		if( in_array( $this->field['type'], static::MULTI_FIELD_TYPES ) ) {
194 194
 			$this->field['is_multi'] = true;
195 195
 		}
196 196
 	}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	protected function normalizeFieldValue()
202 202
 	{
203
-		if( isset( $this->field['value'] ))return;
203
+		if( isset($this->field['value']) )return;
204 204
 		$this->field['value'] = glsr( OptionManager::class )->get(
205 205
 			$this->field['path'],
206 206
 			$this->getFieldDefault()
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	protected function normalizeLabel()
214 214
 	{
215 215
 		$this->field['legend'] = $this->field['label'];
216
-		unset( $this->field['label'] );
216
+		unset($this->field['label']);
217 217
 	}
218 218
 
219 219
 	/**
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function build()
34 34
 	{
35
-		if( !$this->field['is_valid'] )return;
35
+		if( !$this->field['is_valid'] ) {
36
+			return;
37
+		}
36 38
 		if( $this->field['is_multi'] ) {
37 39
 			return $this->buildMultiField();
38 40
 		}
@@ -128,7 +130,9 @@  discard block
 block discarded – undo
128 130
 			'label', 'name', 'type',
129 131
 		];
130 132
 		foreach( $requiredValues as $value ) {
131
-			if( isset( $this->field[$value] ))continue;
133
+			if( isset( $this->field[$value] )) {
134
+				continue;
135
+			}
132 136
 			$missingValues[] = $value;
133 137
 			$isValid = $this->field['is_valid'] = false;
134 138
 		}
@@ -145,11 +149,15 @@  discard block
 block discarded – undo
145 149
 	 */
146 150
 	protected function normalize()
147 151
 	{
148
-		if( !$this->isFieldValid() )return;
152
+		if( !$this->isFieldValid() ) {
153
+			return;
154
+		}
149 155
 		$field = $this->field;
150 156
 		foreach( $field as $key => $value ) {
151 157
 			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
152
-			if( !method_exists( $this, $methodName ))continue;
158
+			if( !method_exists( $this, $methodName )) {
159
+				continue;
160
+			}
153 161
 			$this->$methodName();
154 162
 		}
155 163
 		$this->normalizeFieldId();
@@ -162,7 +170,9 @@  discard block
 block discarded – undo
162 170
 	 */
163 171
 	protected function normalizeDependsOn()
164 172
 	{
165
-		if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return;
173
+		if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] )) {
174
+			return;
175
+		}
166 176
 		$path = key( $this->field['depends_on'] );
167 177
 		$value = $this->field['depends_on'][$path];
168 178
 		$this->field['depends_on'] = json_encode([
@@ -177,7 +187,9 @@  discard block
 block discarded – undo
177 187
 	 */
178 188
 	protected function normalizeFieldId()
179 189
 	{
180
-		if( isset( $this->field['id'] ))return;
190
+		if( isset( $this->field['id'] )) {
191
+			return;
192
+		}
181 193
 		$this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] );
182 194
 	}
183 195
 
@@ -200,7 +212,9 @@  discard block
 block discarded – undo
200 212
 	 */
201 213
 	protected function normalizeFieldValue()
202 214
 	{
203
-		if( isset( $this->field['value'] ))return;
215
+		if( isset( $this->field['value'] )) {
216
+			return;
217
+		}
204 218
 		$this->field['value'] = glsr( OptionManager::class )->get(
205 219
 			$this->field['path'],
206 220
 			$this->getFieldDefault()
Please login to merge, or discard this patch.
plugin/Modules/System.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'inactive-plugin' => 'Inactive Plugins',
38 38
 			'setting' => 'Plugin Settings',
39 39
 		];
40
-		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) {
40
+		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) {
41 41
 			$methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' );
42 42
 			if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
43 43
 				return $carry.$this->implode( $details[$key], $systemDetails );
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$plugins = get_plugins();
56 56
 		$activePlugins = (array)get_option( 'active_plugins', [] );
57
-		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ));
58
-		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
57
+		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
58
+		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
59 59
 	}
60 60
 
61 61
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function getInactivePluginDetails()
80 80
 	{
81 81
 		$activePlugins = (array)get_option( 'active_plugins', [] );
82
-		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins )));
82
+		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
83 83
 	}
84 84
 
85 85
 	/**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$plugins = array_merge(
91 91
 			get_mu_plugins(),
92
-			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
92
+			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) )
93 93
 		);
94
-		if( empty( $plugins ))return;
94
+		if( empty($plugins) )return;
95 95
 		return $this->normalizePluginList( $plugins );
96 96
 	}
97 97
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function getMultisitePluginDetails()
102 102
 	{
103
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
103
+		if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return;
104 104
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
105 105
 	}
106 106
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 			'Max Input Vars' => ini_get( 'max_input_vars' ),
123 123
 			'Memory Limit' => ini_get( 'memory_limit' ),
124 124
 			'Post Max Size' => ini_get( 'post_max_size' ),
125
-			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )),
126
-			'Session Name' => esc_html( ini_get( 'session.name' )),
127
-			'Session Save Path' => esc_html( ini_get( 'session.save_path' )),
128
-			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ),
129
-			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ),
125
+			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ),
126
+			'Session Name' => esc_html( ini_get( 'session.name' ) ),
127
+			'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ),
128
+			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ),
129
+			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ),
130 130
 			'Upload Max Filesize' => ini_get( 'upload_max_filesize' ),
131 131
 		];
132 132
 	}
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		$settings = glsr( OptionManager::class )->get( 'settings', [] );
155 155
 		$settings = $helper->flattenArray( $settings );
156 156
 		foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) {
157
-			if( empty( $settings[$key] ))continue;
157
+			if( empty($settings[$key]) )continue;
158 158
 			$settings[$key] = str_repeat( '*', 10 );
159 159
 		}
160 160
 		$details = [];
161 161
 		foreach( $settings as $key => $value ) {
162
-			if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key ))continue;
163
-			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
162
+			if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key ) )continue;
163
+			$value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
164 164
 			$details[$key] = $value;
165 165
 		}
166 166
 		return $details;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 				return $value;
241 241
 			}
242 242
 		}
243
-		return implode( ',', array_filter( [DB_HOST, $serverName] ));
243
+		return implode( ',', array_filter( [DB_HOST, $serverName] ) );
244 244
 	}
245 245
 
246 246
 	/**
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	{
262 262
 		$plugins = get_plugins();
263 263
 		$activePlugins = (array)get_option( 'active_plugins', [] );
264
-		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins )));
265
-		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
264
+		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
265
+		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
266 266
 		return $active + $inactive;
267 267
 	}
268 268
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	protected function implode( $title, array $details )
274 274
 	{
275 275
 		$strings = ['['.$title.']'];
276
-		$padding = max( array_map( 'strlen', array_keys( $details )) );
276
+		$padding = max( array_map( 'strlen', array_keys( $details ) ) );
277 277
 		$padding = max( [$padding, static::PAD] );
278 278
 		foreach( $details as $key => $value ) {
279 279
 			$strings[] = is_string( $key )
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 			get_mu_plugins(),
92 92
 			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
93 93
 		);
94
-		if( empty( $plugins ))return;
94
+		if( empty( $plugins )) {
95
+			return;
96
+		}
95 97
 		return $this->normalizePluginList( $plugins );
96 98
 	}
97 99
 
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
 	 */
101 103
 	public function getMultisitePluginDetails()
102 104
 	{
103
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
105
+		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) {
106
+			return;
107
+		}
104 108
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
105 109
 	}
106 110
 
@@ -154,12 +158,16 @@  discard block
 block discarded – undo
154 158
 		$settings = glsr( OptionManager::class )->get( 'settings', [] );
155 159
 		$settings = $helper->flattenArray( $settings );
156 160
 		foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) {
157
-			if( empty( $settings[$key] ))continue;
161
+			if( empty( $settings[$key] )) {
162
+				continue;
163
+			}
158 164
 			$settings[$key] = str_repeat( '*', 10 );
159 165
 		}
160 166
 		$details = [];
161 167
 		foreach( $settings as $key => $value ) {
162
-			if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key ))continue;
168
+			if( $helper->startsWith( 'translations', $key ) && $helper->endsWith( 'id', $key )) {
169
+				continue;
170
+			}
163 171
 			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
164 172
 			$details[$key] = $value;
165 173
 		}
Please login to merge, or discard this patch.