Passed
Push — master ( 57dde7...525778 )
by Paul
04:33
created
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.
plugin/Router.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	public function routeAdminPostRequest()
17 17
 	{
18 18
 		$request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
19
-		if( !isset( $request['action'] ))return;
19
+		if( !isset( $request['action'] )) {
20
+			return;
21
+		}
20 22
 		$this->checkNonce( $request['action'] );
21 23
 		$this->routeRequest( 'admin', $request['action'], $request );
22 24
 	}
@@ -71,7 +73,9 @@  discard block
 block discarded – undo
71 73
 	public function routeWebhookRequest()
72 74
 	{
73 75
 		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ));
74
-		if( !$request )return;
76
+		if( !$request ) {
77
+			return;
78
+		}
75 79
 		// @todo manage webhook here
76 80
 	}
77 81
 
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) {
46
+				continue;
47
+			}
46 48
 			$pointer = &$pointer[$key];
47 49
 		}
48 50
 		unset( $pointer[$last] );
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
 			glsr( DefaultsManager::class )->defaults()
78 80
 		);
79 81
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
82
+			if( !is_string( $value )) {
83
+				return;
84
+			}
81 85
 			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
82 86
 		});
83 87
 		return glsr( Helper::class )->convertDotNotationArray( $options );
Please login to merge, or discard this patch.
plugin/Modules/ListTable/Columns.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function renderFilters( $postType )
88 88
 	{
89
-		if( $postType !== Application::POST_TYPE )return;
89
+		if( $postType !== Application::POST_TYPE ) {
90
+			return;
91
+		}
90 92
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
91 93
 			$status = 'publish';
92 94
 		}
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	 */
104 106
 	public function renderValues( $column, $postId )
105 107
 	{
106
-		if( glsr_current_screen()->post_type != Application::POST_TYPE )return;
108
+		if( glsr_current_screen()->post_type != Application::POST_TYPE ) {
109
+			return;
110
+		}
107 111
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
108 112
 		echo method_exists( $this, $method )
109 113
 			? call_user_func( [$this, $method], $postId )
@@ -116,7 +120,9 @@  discard block
 block discarded – undo
116 120
 	 */
117 121
 	protected function renderFilterRatings( $ratings )
118 122
 	{
119
-		if( empty( $ratings ))return;
123
+		if( empty( $ratings )) {
124
+			return;
125
+		}
120 126
 		$ratings = array_flip( array_reverse( $ratings ));
121 127
 		array_walk( $ratings, function( &$value, $key ) {
122 128
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -139,7 +145,9 @@  discard block
 block discarded – undo
139 145
 	 */
140 146
 	protected function renderFilterTypes( $types )
141 147
 	{
142
-		if( count( glsr()->reviewTypes ) < 2 )return;
148
+		if( count( glsr()->reviewTypes ) < 2 ) {
149
+			return;
150
+		}
143 151
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
144 152
 			'class' => 'screen-reader-text',
145 153
 			'for' => 'review_type',
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
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 		$arrayKeys = ['context', 'globals'];
54 54
 		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ));
55 55
 		foreach( $arrayKeys as $key ) {
56
-			if( is_array( $data[$key] ))continue;
56
+			if( is_array( $data[$key] )) {
57
+				continue;
58
+			}
57 59
 			$data[$key] = [];
58 60
 		}
59 61
 		return $data;
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
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function renderReviewEditor( WP_Post $post )
117 117
 	{
118
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
118
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
119
+			return;
120
+		}
119 121
 		glsr()->render( 'partials/editor/review', [
120 122
 			'post' => $post,
121 123
 		]);
@@ -127,7 +129,9 @@  discard block
 block discarded – undo
127 129
 	 */
128 130
 	public function renderReviewNotice( WP_Post $post )
129 131
 	{
130
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
132
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
133
+			return;
134
+		}
131 135
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
132 136
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
133 137
 			'context' => [
@@ -142,13 +146,19 @@  discard block
 block discarded – undo
142 146
 	 */
143 147
 	public function renderTinymceButton()
144 148
 	{
145
-		if( glsr_current_screen()->base != 'post' )return;
149
+		if( glsr_current_screen()->base != 'post' ) {
150
+			return;
151
+		}
146 152
 		$shortcodes = [];
147 153
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
148
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
154
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) {
155
+				continue;
156
+			}
149 157
 			$shortcodes[$shortcode] = $values;
150 158
 		}
151
-		if( empty( $shortcodes ))return;
159
+		if( empty( $shortcodes )) {
160
+			return;
161
+		}
152 162
 		glsr()->render( 'partials/editor/tinymce', [
153 163
 			'shortcodes' => $shortcodes,
154 164
 		]);
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 1 patch
Braces   +20 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  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 )) {
58
+				continue;
59
+			}
58 60
 			$value = $columns[$key];
59 61
 		}
60 62
 		if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) {
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
 	 * @return array
93 95
 	 * @filter display_post_states
94 96
 	 */
95
-	public function filterPostStates( array $postStates, WP_Post $post ) {
97
+	public function filterPostStates( array $postStates, WP_Post $post )
98
+	{
96 99
 		if( $post->post_type == Application::POST_TYPE
97 100
 			&& array_key_exists( 'pending', $postStates )) {
98 101
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
@@ -137,7 +140,9 @@  discard block
 block discarded – undo
137 140
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
138 141
 		unset( $postTypeColumns['cb'] );
139 142
 		foreach( $postTypeColumns as $key => $value ) {
140
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
143
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) {
144
+				continue;
145
+			}
141 146
 			$columns[$key] = $key;
142 147
 		}
143 148
 		return $columns;
@@ -161,7 +166,9 @@  discard block
 block discarded – undo
161 166
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
162 167
 			];
163 168
 			foreach( $strings as $search => $replace ) {
164
-				if( strpos( $single, $search ) === false )continue;
169
+				if( strpos( $single, $search ) === false ) {
170
+					continue;
171
+				}
165 172
 				$translation = $this->getTranslation([
166 173
 					'number' => $number,
167 174
 					'plural' => str_replace( $search, $replace, $plural ),
@@ -213,7 +220,9 @@  discard block
 block discarded – undo
213 220
 	 */
214 221
 	public function saveBulkEditFields( $postId )
215 222
 	{
216
-		if( !current_user_can( 'edit_posts' ))return;
223
+		if( !current_user_can( 'edit_posts' )) {
224
+			return;
225
+		}
217 226
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
218 227
 		if( $assignedTo && get_post( $assignedTo )) {
219 228
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -226,7 +235,9 @@  discard block
 block discarded – undo
226 235
 	 */
227 236
 	public function setQueryForColumn( WP_Query $query )
228 237
 	{
229
-		if( !$this->hasPermission( $query ))return;
238
+		if( !$this->hasPermission( $query )) {
239
+			return;
240
+		}
230 241
 		$this->setMetaQuery( $query, [
231 242
 			'rating', 'review_type',
232 243
 		]);
@@ -297,7 +308,9 @@  discard block
 block discarded – undo
297 308
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
298 309
 	{
299 310
 		foreach( $metaKeys as $key ) {
300
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
311
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
312
+				continue;
313
+			}
301 314
 			$metaQuery = (array)$query->get( 'meta_query' );
302 315
 			$metaQuery[] = [
303 316
 				'key' => $key,
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,9 @@  discard block
 block discarded – undo
70 70
 	public function getAssignedToPost( $post, $assignedTo = '' )
71 71
 	{
72 72
 		$post = get_post( $post );
73
-		if( !( $post instanceof WP_Post ))return;
73
+		if( !( $post instanceof WP_Post )) {
74
+			return;
75
+		}
74 76
 		if( empty( $assignedTo )) {
75 77
 			$assignedTo = get_post_meta( $post->ID, 'assigned_to', true );
76 78
 		}
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 	 */
89 91
 	public function getReview( $post )
90 92
 	{
91
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
93
+		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE ) {
94
+			return;
95
+		}
92 96
 		$review = $this->getReviewMeta( $post->ID );
93 97
 		$modified = $this->isReviewModified( $post, $review );
94 98
 		$review->content = $post->post_content;
@@ -262,7 +266,9 @@  discard block
 block discarded – undo
262 266
 		$termIds = array_map( 'trim', explode( ',', $termIds ));
263 267
 		foreach( $termIds as $termId ) {
264 268
 			$term = term_exists( $termId, Application::TAXONOMY );
265
-			if( !isset( $term['term_id'] ))continue;
269
+			if( !isset( $term['term_id'] )) {
270
+				continue;
271
+			}
266 272
 			$terms[] = intval( $term['term_id'] );
267 273
 		}
268 274
 		return $terms;
@@ -275,7 +281,9 @@  discard block
 block discarded – undo
275 281
 	public function revertReview( $postId )
276 282
 	{
277 283
 		$post = get_post( $postId );
278
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
284
+		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE ) {
285
+			return;
286
+		}
279 287
 		delete_post_meta( $post->ID, '_edit_last' );
280 288
 		$result = wp_update_post([
281 289
 			'ID' => $post->ID,
@@ -310,7 +318,9 @@  discard block
 block discarded – undo
310 318
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
311 319
 		$search = new WP_Query( $args );
312 320
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
313
-		if( !$search->have_posts() )return;
321
+		if( !$search->have_posts() ) {
322
+			return;
323
+		}
314 324
 		$results = '';
315 325
 		while( $search->have_posts() ) {
316 326
 			$search->the_post();
@@ -334,7 +344,9 @@  discard block
 block discarded – undo
334 344
 	public function setReviewMeta( $postId, $termIds )
335 345
 	{
336 346
 		$terms = $this->normalizeTerms( $termIds );
337
-		if( empty( $terms ))return;
347
+		if( empty( $terms )) {
348
+			return;
349
+		}
338 350
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
339 351
 		if( is_wp_error( $result )) {
340 352
 			glsr_log()->error( $result->get_error_message() );
Please login to merge, or discard this patch.