Passed
Push — master ( 796b78...de3336 )
by Paul
05:32
created
plugin/Modules/Validator/ValidateReview.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -171,8 +171,12 @@  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 )) {
175
+			return;
176
+		}
177
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
178
+			return;
179
+		}
176 180
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
177 181
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
178 182
 	}
@@ -182,8 +186,12 @@  discard block
 block discarded – undo
182 186
 	 */
183 187
 	protected function validateBlacklist()
184 188
 	{
185
-		if( !empty( $this->error ))return;
186
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
189
+		if( !empty( $this->error )) {
190
+			return;
191
+		}
192
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
193
+			return;
194
+		}
187 195
 		$blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' );
188 196
 		if( $blacklistAction == 'unapprove' ) {
189 197
 			$this->request['blacklisted'] = true;
@@ -199,9 +207,13 @@  discard block
 block discarded – undo
199 207
 	 */
200 208
 	protected function validateCustom()
201 209
 	{
202
-		if( !empty( $this->error ))return;
210
+		if( !empty( $this->error )) {
211
+			return;
212
+		}
203 213
 		$validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request );
204
-		if( $validated === true )return;
214
+		if( $validated === true ) {
215
+			return;
216
+		}
205 217
 		$this->setSessionValues( 'errors', [] );
206 218
 		$this->setSessionValues( 'values', $this->request );
207 219
 		$this->error = is_string( $validated )
@@ -214,8 +226,12 @@  discard block
 block discarded – undo
214 226
 	 */
215 227
 	protected function validateHoneyPot()
216 228
 	{
217
-		if( !empty( $this->error ))return;
218
-		if( empty( $this->request['gotcha'] ))return;
229
+		if( !empty( $this->error )) {
230
+			return;
231
+		}
232
+		if( empty( $this->request['gotcha'] )) {
233
+			return;
234
+		}
219 235
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
220 236
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
221 237
 	}
@@ -225,7 +241,9 @@  discard block
 block discarded – undo
225 241
 	 */
226 242
 	protected function validateRecaptcha()
227 243
 	{
228
-		if( !empty( $this->error ))return;
244
+		if( !empty( $this->error )) {
245
+			return;
246
+		}
229 247
 		$isValid = $this->isRecaptchaResponseValid();
230 248
 		if( is_null( $isValid )) {
231 249
 			$this->setSessionValues( 'recaptcha', true );
Please login to merge, or discard this patch.
plugin/Modules/Html/Template.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 	{
64 64
 		$data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] ));
65 65
 		foreach( $data as $key => $value ) {
66
-			if( is_array( $value ))continue;
66
+			if( is_array( $value )) {
67
+				continue;
68
+			}
67 69
 			$data[$key] = [];
68 70
 		}
69 71
 		$data['template'] = $this;
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@  discard block
 block discarded – undo
87 87
 		];
88 88
 		if( !isset( $properties[$property] )
89 89
 			|| empty( array_filter( [$value], $properties[$property] ))
90
-		)return;
90
+		) {
91
+			return;
92
+		}
91 93
 		$this->$property = $value;
92 94
 	}
93 95
 
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
 	 */
138 140
 	protected function buildFieldDescription()
139 141
 	{
140
-		if( empty( $this->args['description'] ))return;
142
+		if( empty( $this->args['description'] )) {
143
+			return;
144
+		}
141 145
 		if( !empty( $this->globals['is_widget'] )) {
142 146
 			return $this->small( $this->args['description'] );
143 147
 		}
@@ -186,7 +190,9 @@  discard block
 block discarded – undo
186 190
 	 */
187 191
 	protected function buildFormLabel()
188 192
 	{
189
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
193
+		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) {
194
+			return;
195
+		}
190 196
 		return $this->label([
191 197
 			'for' => $this->args['id'],
192 198
 			'text' => $this->args['label'],
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 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 1 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 1 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 1 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 1 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 1 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, true );
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( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
168
+			if( $helper->startsWith( 'strings', $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.