Completed
Push — develop ( 9aa69a...b20875 )
by J.D.
03:27
created
src/admin/screens/modules-load.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,11 @@
 block discarded – undo
11 11
 
12 12
 if ( isset( $_POST['clear-recent-list'] ) ) {
13 13
 	$action = 'clear-recent-list';
14
-} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { // WPCS: CSRF OK.
14
+} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) {
15
+// WPCS: CSRF OK.
15 16
 	$action = sanitize_key( $_REQUEST['action'] );
16
-} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { // WPCS: CSRF OK.
17
+} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) {
18
+// WPCS: CSRF OK.
17 19
 	$action = sanitize_key( $_REQUEST['action2'] );
18 20
 } else {
19 21
 	$action = '';
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $status, $wp_version, $parent_file;
11 11
 
12
-if ( isset( $_POST['clear-recent-list'] ) ) {
12
+if ( isset( $_POST[ 'clear-recent-list' ] ) ) {
13 13
 	$action = 'clear-recent-list';
14
-} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { // WPCS: CSRF OK.
15
-	$action = sanitize_key( $_REQUEST['action'] );
16
-} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { // WPCS: CSRF OK.
17
-	$action = sanitize_key( $_REQUEST['action2'] );
14
+} elseif ( isset( $_REQUEST[ 'action' ] ) && -1 !== (int) $_REQUEST[ 'action' ] ) { // WPCS: CSRF OK.
15
+	$action = sanitize_key( $_REQUEST[ 'action' ] );
16
+} elseif ( isset( $_REQUEST[ 'action2' ] ) && -1 !== (int) $_REQUEST[ 'action2' ] ) { // WPCS: CSRF OK.
17
+	$action = sanitize_key( $_REQUEST[ 'action2' ] );
18 18
 } else {
19 19
 	$action = '';
20 20
 }
21 21
 
22
-$page   = ( isset( $_REQUEST['paged'] ) ) ? max( 1, absint( $_REQUEST['paged'] ) ) : 1; // WPCS: CSRF OK.
23
-$module = ( isset( $_REQUEST['module'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) ) : ''; // WPCS: CSRF OK.
24
-$s      = ( isset( $_REQUEST['s'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : ''; // WPCS: CSRF OK.
22
+$page   = ( isset( $_REQUEST[ 'paged' ] ) ) ? max( 1, absint( $_REQUEST[ 'paged' ] ) ) : 1; // WPCS: CSRF OK.
23
+$module = ( isset( $_REQUEST[ 'module' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 'module' ] ) ) : ''; // WPCS: CSRF OK.
24
+$s      = ( isset( $_REQUEST[ 's' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) : ''; // WPCS: CSRF OK.
25 25
 
26 26
 // Clean up request URI from temporary args for screen options/paging URI's to work as expected.
27
-$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) );
27
+$_SERVER[ 'REQUEST_URI' ] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) );
28 28
 
29 29
 $redirect_url = self_admin_url( "admin.php?page=wordpoints_extensions&module_status={$status}&paged={$page}&s={$s}" );
30 30
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 
92 92
 		check_admin_referer( 'bulk-modules' );
93 93
 
94
-		$modules = isset( $_POST['checked'] )
95
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) )
94
+		$modules = isset( $_POST[ 'checked' ] )
95
+			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST[ 'checked' ] ) )
96 96
 			: array();
97 97
 
98 98
 		// Only activate modules which are not already active.
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 
220 220
 		check_admin_referer( 'bulk-modules' );
221 221
 
222
-		$modules = isset( $_POST['checked'] )
223
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) )
222
+		$modules = isset( $_POST[ 'checked' ] )
223
+			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST[ 'checked' ] ) )
224 224
 			: array();
225 225
 
226 226
 		$network_modules = array_filter( $modules, 'is_wordpoints_module_active_for_network' );
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 		check_admin_referer( 'bulk-modules' );
263 263
 
264 264
 		// $_POST = from the module form; $_GET = from the FTP details screen.
265
-		$modules = isset( $_REQUEST['checked'] )
266
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST['checked'] ) )
265
+		$modules = isset( $_REQUEST[ 'checked' ] )
266
+			? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST[ 'checked' ] ) )
267 267
 			: array();
268 268
 
269 269
 		if ( empty( $modules ) ) {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
 		$parent_file = 'admin.php';
293 293
 
294
-		if ( ! isset( $_REQUEST['verify-delete'] ) ) {
294
+		if ( ! isset( $_REQUEST[ 'verify-delete' ] ) ) {
295 295
 
296 296
 			wp_enqueue_script( 'jquery' );
297 297
 			require_once ABSPATH . 'wp-admin/admin-header.php';
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
 
312 312
 					if ( '.' === dirname( $module ) ) {
313 313
 
314
-						$files_to_delete[] = $module_dir . '/' . $module;
314
+						$files_to_delete[ ] = $module_dir . '/' . $module;
315 315
 						$data              = wordpoints_get_module_data( $module_dir . '/' . $module );
316 316
 
317 317
 						if ( ! empty( $data ) ) {
318 318
 
319 319
 							$module_info[ $module ] = $data;
320
-							$module_info[ $module ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module );
320
+							$module_info[ $module ][ 'is_uninstallable' ] = is_uninstallable_wordpoints_module( $module );
321 321
 
322
-							if ( ! $module_info[ $module ]['network'] ) {
322
+							if ( ! $module_info[ $module ][ 'network' ] ) {
323 323
 								$have_non_network_modules = true;
324 324
 							}
325 325
 						}
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
 						foreach ( $folder_modules as $module_file => $data ) {
340 340
 
341 341
 							$module_info[ $module_file ] = $data;
342
-							$module_info[ $module_file ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module );
342
+							$module_info[ $module_file ][ 'is_uninstallable' ] = is_uninstallable_wordpoints_module( $module );
343 343
 
344
-							if ( ! $module_info[ $module_file ]['network'] ) {
344
+							if ( ! $module_info[ $module_file ][ 'network' ] ) {
345 345
 								$have_non_network_modules = true;
346 346
 							}
347 347
 						}
@@ -380,16 +380,16 @@  discard block
 block discarded – undo
380 380
 
381 381
 						foreach ( $module_info as $module ) {
382 382
 
383
-							if ( $module['is_uninstallable'] ) {
383
+							if ( $module[ 'is_uninstallable' ] ) {
384 384
 
385 385
 								// translators: 1. Extension name; 2. Extension author.
386
-								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
386
+								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module[ 'name' ] ), esc_html( $module[ 'author_name' ] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
387 387
 								$data_to_delete = true;
388 388
 
389 389
 							} else {
390 390
 
391 391
 								// translators: 1. Extension name; 2. Extension author.
392
-								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
392
+								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module[ 'name' ] ), esc_html( $module[ 'author_name' ] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
393 393
 							}
394 394
 						}
395 395
 
Please login to merge, or discard this patch.
src/admin/screens/configure-components.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 // Show messages and errors.
18 18
 //
19 19
 
20
-if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) { // WPCS: CSRF OK.
20
+if ( isset( $_GET[ 'wordpoints_component' ], $_GET[ '_wpnonce' ] ) && $wordpoints_components->is_registered( sanitize_key( $_GET[ 'wordpoints_component' ] ) ) ) { // WPCS: CSRF OK.
21 21
 
22
-	$component = sanitize_key( $_GET['wordpoints_component'] );
22
+	$component = sanitize_key( $_GET[ 'wordpoints_component' ] );
23 23
 
24
-	if ( isset( $_GET['message'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) {
24
+	if ( isset( $_GET[ 'message' ] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) {
25 25
 
26
-		switch ( (int) $_GET['message'] ) {
26
+		switch ( (int) $_GET[ 'message' ] ) {
27 27
 
28 28
 			case 1:
29 29
 				if ( $wordpoints_components->is_active( $component ) ) {
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 		if ( isset( $message ) ) {
44 44
 
45 45
 			wordpoints_show_admin_message(
46
-				esc_html( sprintf( $message, $components[ $component ]['name'] ) )
46
+				esc_html( sprintf( $message, $components[ $component ][ 'name' ] ) )
47 47
 				, 'success'
48 48
 				, array( 'dismissible' => true )
49 49
 			);
50 50
 		}
51 51
 
52
-	} elseif ( isset( $_GET['error'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) {
52
+	} elseif ( isset( $_GET[ 'error' ] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) {
53 53
 
54
-		switch ( (int) $_GET['error'] ) {
54
+		switch ( (int) $_GET[ 'error' ] ) {
55 55
 
56 56
 			case 1:
57 57
 				if ( ! $wordpoints_components->is_active( $component ) ) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		if ( isset( $error ) ) {
72 72
 
73 73
 			wordpoints_show_admin_error(
74
-				esc_html( sprintf( $error, $components[ $component ]['name'] ) )
74
+				esc_html( sprintf( $error, $components[ $component ][ 'name' ] ) )
75 75
 				, array( 'dismissible' => true )
76 76
 			);
77 77
 		}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 		<?php
111 111
 
112
-		if ( $wordpoints_components->is_active( $component['slug'] ) ) {
112
+		if ( $wordpoints_components->is_active( $component[ 'slug' ] ) ) {
113 113
 
114 114
 			$action = 'deactivate';
115 115
 			$button = __( 'Deactivate', 'wordpoints' );
@@ -124,38 +124,38 @@  discard block
 block discarded – undo
124 124
 
125 125
 		<tr>
126 126
 			<td>
127
-				<?php if ( '' !== $component['component_uri'] ) : ?>
128
-					<a href="<?php echo esc_url( $component['component_uri'] ); ?>">
127
+				<?php if ( '' !== $component[ 'component_uri' ] ) : ?>
128
+					<a href="<?php echo esc_url( $component[ 'component_uri' ] ); ?>">
129 129
 				<?php endif; ?>
130
-					<?php echo esc_html( $component['name'] ); ?>
131
-				<?php if ( '' !== $component['component_uri'] ) : ?>
130
+					<?php echo esc_html( $component[ 'name' ] ); ?>
131
+				<?php if ( '' !== $component[ 'component_uri' ] ) : ?>
132 132
 					</a>
133 133
 				<?php endif; ?>
134 134
 			</td>
135 135
 			<td>
136
-				<?php echo wp_kses( $component['description'], 'wordpoints_component_description' ); ?>
137
-				<?php if ( '' !== $component['author'] ) : ?>
136
+				<?php echo wp_kses( $component[ 'description' ], 'wordpoints_component_description' ); ?>
137
+				<?php if ( '' !== $component[ 'author' ] ) : ?>
138 138
 					&nbsp;|&nbsp;
139 139
 					<?php
140 140
 					// translators: Author name.
141 141
 					echo esc_html( sprintf( __( 'By %s', 'wordpoints' ), '' /* This space intentionally left blank */ ) );
142 142
 					?>
143
-					<?php if ( '' !== $component['author_uri'] ) : ?>
144
-						<a href="<?php echo esc_url( $component['author_uri'] ); ?>">
143
+					<?php if ( '' !== $component[ 'author_uri' ] ) : ?>
144
+						<a href="<?php echo esc_url( $component[ 'author_uri' ] ); ?>">
145 145
 					<?php endif; ?>
146
-						<?php echo esc_html( $component['author'] ); ?>
147
-					<?php if ( '' !== $component['author_uri'] ) : ?>
146
+						<?php echo esc_html( $component[ 'author' ] ); ?>
147
+					<?php if ( '' !== $component[ 'author_uri' ] ) : ?>
148 148
 						</a>
149 149
 					<?php endif; ?>
150 150
 				<?php endif; ?>
151 151
 			</td>
152
-			<td><?php echo esc_html( $component['version'] ); ?></td>
152
+			<td><?php echo esc_html( $component[ 'version' ] ); ?></td>
153 153
 			<td>
154
-				<form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component['slug'] ); ?>">
154
+				<form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component[ 'slug' ] ); ?>">
155 155
 					<input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr( $action ); ?>" />
156
-					<input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component['slug'] ); ?>" />
157
-					<?php wp_nonce_field( "wordpoints_{$action}_component-{$component['slug']}" ); ?>
158
-					<?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false ); ?>
156
+					<input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component[ 'slug' ] ); ?>" />
157
+					<?php wp_nonce_field( "wordpoints_{$action}_component-{$component[ 'slug' ]}" ); ?>
158
+					<?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component[ 'slug' ]}", false ); ?>
159 159
 				</form>
160 160
 			</td>
161 161
 		</tr>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
 // Show messages and errors.
18 18
 //
19 19
 
20
-if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) { // WPCS: CSRF OK.
20
+if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) {
21
+// WPCS: CSRF OK.
21 22
 
22 23
 	$component = sanitize_key( $_GET['wordpoints_component'] );
23 24
 
Please login to merge, or discard this patch.
src/components/points/includes/deprecated.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 
185 185
 				$instance = array_merge( $this->defaults, $instance );
186 186
 
187
-				if ( ! $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) ) {
187
+				if ( ! $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) ) {
188 188
 					continue;
189 189
 				}
190 190
 
191 191
 				$points_type = $this->points_type( $number );
192 192
 
193
-				wordpoints_subtract_points( $comment->user_id, $instance['points'], $points_type, 'comment_disapprove', array( 'status' => $new_status ) );
193
+				wordpoints_subtract_points( $comment->user_id, $instance[ 'points' ], $points_type, 'comment_disapprove', array( 'status' => $new_status ) );
194 194
 
195 195
 				update_comment_meta(
196 196
 					$comment->comment_ID
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 			$instance = array_merge( $this->defaults, $instance );
376 376
 
377 377
 			if (
378
-				$this->is_matching_post_type( $post->post_type, $instance['post_type'] )
378
+				$this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] )
379 379
 				&& 'auto-draft' !== $post->post_status
380 380
 				&& __( 'Auto Draft', 'default' ) !== $post->post_title
381 381
 			) {
382 382
 
383 383
 				wordpoints_alter_points(
384 384
 					$post->post_author
385
-					, -$instance['points']
385
+					, -$instance[ 'points' ]
386 386
 					, $this->points_type( $number )
387 387
 					, 'post_delete'
388 388
 					, array( 'post_title' => $post->post_title, 'post_type' => $post->post_type )
Please login to merge, or discard this patch.
src/components/points/includes/hooks/post.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -111,22 +111,22 @@
 block discarded – undo
111 111
 			$points_type = $this->points_type( $number );
112 112
 
113 113
 			if (
114
-				$this->is_matching_post_type( $post->post_type, $instance['post_type'] )
114
+				$this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] )
115 115
 				&& ! $this->awarded_points_already( $post->ID, $points_type )
116 116
 			) {
117 117
 
118
-				if ( isset( $instance['publish'] ) ) {
118
+				if ( isset( $instance[ 'publish' ] ) ) {
119 119
 					_deprecated_argument( __METHOD__, '1.4.0', 'The "publish" hook setting is no longer used to hold the value for the points. Use "points" instead.' );
120
-					$instance['points'] = $instance['publish'];
120
+					$instance[ 'points' ] = $instance[ 'publish' ];
121 121
 				}
122 122
 
123
-				if ( ! isset( $instance['points'] ) ) {
123
+				if ( ! isset( $instance[ 'points' ] ) ) {
124 124
 					continue;
125 125
 				}
126 126
 
127 127
 				wordpoints_alter_points(
128 128
 					$post->post_author
129
-					, $instance['points']
129
+					, $instance[ 'points' ]
130 130
 					, $points_type
131 131
 					, 'post_publish'
132 132
 					, array( 'post_id' => $post->ID )
Please login to merge, or discard this patch.
src/components/points/includes/hooks/registration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@
 block discarded – undo
59 59
 
60 60
 		foreach ( $this->get_instances() as $number => $instance ) {
61 61
 
62
-			if ( isset( $instance['points'] ) ) {
63
-				wordpoints_add_points( $user_id, $instance['points'], $this->points_type( $number ), 'register' );
62
+			if ( isset( $instance[ 'points' ] ) ) {
63
+				wordpoints_add_points( $user_id, $instance[ 'points' ], $this->points_type( $number ), 'register' );
64 64
 			}
65 65
 		}
66 66
 	}
Please login to merge, or discard this patch.
src/components/points/includes/hooks/abstracts/comment-approved.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 
87 87
 			if (
88 88
 				'approved' === $last_status
89
-				|| ! $this->is_matching_post_type( $post->post_type, $instance['post_type'] )
89
+				|| ! $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] )
90 90
 			) {
91 91
 				continue;
92 92
 			}
93 93
 
94 94
 			wordpoints_add_points(
95 95
 				$this->select_user_to_award( $comment, $post )
96
-				, $instance['points']
96
+				, $instance[ 'points' ]
97 97
 				, $points_type
98 98
 				, $this->log_type
99 99
 				, array( 'comment_id' => $comment->comment_ID )
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$comment = false;
260 260
 
261
-		if ( isset( $meta['comment_id'] ) ) {
262
-			$comment = get_comment( $meta['comment_id'] );
261
+		if ( isset( $meta[ 'comment_id' ] ) ) {
262
+			$comment = get_comment( $meta[ 'comment_id' ] );
263 263
 		}
264 264
 
265 265
 		if ( ! $comment ) {
Please login to merge, or discard this patch.
src/components/points/admin/includes/ajax.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	// Save hooks order for all points types.
41
-	if ( ! isset( $_POST['points_types'] ) || ! is_array( $_POST['points_types'] ) ) {
41
+	if ( ! isset( $_POST[ 'points_types' ] ) || ! is_array( $_POST[ 'points_types' ] ) ) {
42 42
 		wp_die( -1, '', array( 'response' => 400 ) );
43 43
 	}
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 
47 47
 	foreach ( array_keys( wordpoints_get_points_types() ) as $points_type ) {
48 48
 
49
-		if ( empty( $_POST['points_types'][ $points_type ] ) ) {
49
+		if ( empty( $_POST[ 'points_types' ][ $points_type ] ) ) {
50 50
 			continue;
51 51
 		}
52 52
 
53
-		$hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][ $points_type ] ) );
53
+		$hooks = sanitize_text_field( wp_unslash( $_POST[ 'points_types' ][ $points_type ] ) );
54 54
 
55 55
 		$points_type_hooks = array();
56 56
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 	$error = __( 'An error has occurred. Please reload the page and try again.', 'wordpoints' );
108 108
 
109
-	if ( isset( $_POST['points-slug'] ) ) {
109
+	if ( isset( $_POST[ 'points-slug' ] ) ) {
110 110
 
111 111
 		// - We are saving the settings for a points type.
112 112
 
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 
124 124
 		$settings = array();
125 125
 
126
-		if ( isset( $_POST['points-name'] ) ) {
127
-			$settings['name'] = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) );
126
+		if ( isset( $_POST[ 'points-name' ] ) ) {
127
+			$settings[ 'name' ] = trim( sanitize_text_field( wp_unslash( $_POST[ 'points-name' ] ) ) );
128 128
 		}
129 129
 
130
-		if ( isset( $_POST['points-prefix'] ) ) {
131
-			$settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) );
130
+		if ( isset( $_POST[ 'points-prefix' ] ) ) {
131
+			$settings[ 'prefix' ] = ltrim( sanitize_text_field( wp_unslash( $_POST[ 'points-prefix' ] ) ) );
132 132
 		}
133 133
 
134
-		if ( isset( $_POST['points-suffix'] ) ) {
135
-			$settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) );
134
+		if ( isset( $_POST[ 'points-suffix' ] ) ) {
135
+			$settings[ 'suffix' ] = rtrim( sanitize_text_field( wp_unslash( $_POST[ 'points-suffix' ] ) ) );
136 136
 		}
137 137
 
138
-		$points_type = sanitize_key( $_POST['points-slug'] );
138
+		$points_type = sanitize_key( $_POST[ 'points-slug' ] );
139 139
 
140 140
 		$old_settings = wordpoints_get_points_type( $points_type );
141 141
 
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
 
160 160
 		// - We are creating/updating/deleting an instance of a hook.
161 161
 
162
-		if ( ! isset( $_POST['id_base'], $_POST['hook-id'], $_POST['points_type'], $_POST['hook_number'] ) ) {
162
+		if ( ! isset( $_POST[ 'id_base' ], $_POST[ 'hook-id' ], $_POST[ 'points_type' ], $_POST[ 'hook_number' ] ) ) {
163 163
 			wp_die( -1, '', array( 'response' => 400 ) );
164 164
 		}
165 165
 
166
-		$id_base        = sanitize_key( $_POST['id_base'] );
167
-		$hook_id        = sanitize_key( $_POST['hook-id'] );
168
-		$points_type_id = sanitize_key( $_POST['points_type'] );
169
-		$number         = (int) $_POST['hook_number'];
166
+		$id_base        = sanitize_key( $_POST[ 'id_base' ] );
167
+		$hook_id        = sanitize_key( $_POST[ 'hook-id' ] );
168
+		$points_type_id = sanitize_key( $_POST[ 'points_type' ] );
169
+		$number         = (int) $_POST[ 'hook_number' ];
170 170
 
171 171
 		/*
172 172
 		 * Normally the hook ID will be in 'hook-id' when we are updating a hook.
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 		if ( ! $number ) {
178 178
 
179 179
 			// This holds the ID number if the hook is brand new.
180
-			if ( ! isset( $_POST['multi_number'] ) || ! wordpoints_posint( $_POST['multi_number'] ) ) {
180
+			if ( ! isset( $_POST[ 'multi_number' ] ) || ! wordpoints_posint( $_POST[ 'multi_number' ] ) ) {
181 181
 				wp_die( '<p>' . esc_html( $error ) . '</p>', '', array( 'response' => 400 ) );
182 182
 			}
183 183
 
184
-			$number  = (int) $_POST['multi_number'];
184
+			$number  = (int) $_POST[ 'multi_number' ];
185 185
 			$hook_id = $id_base . '-' . $number;
186 186
 		}
187 187
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		// Get the hooks for this points type.
199 199
 		$points_type_hooks = ( isset( $points_types_hooks[ $points_type_id ] ) ) ? $points_types_hooks[ $points_type_id ] : array();
200 200
 
201
-		if ( ! empty( $_POST['delete_hook'] ) ) {
201
+		if ( ! empty( $_POST[ 'delete_hook' ] ) ) {
202 202
 
203 203
 			// - We are deleting a hook instance.
204 204
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			$new_instance = reset( $settings );
230 230
 
231 231
 			// Save the points types-hooks associations.
232
-			$points_type_hooks[] = $hook->get_id( $number );
232
+			$points_type_hooks[ ] = $hook->get_id( $number );
233 233
 			$points_types_hooks[ $points_type_id ] = $points_type_hooks;
234 234
 			WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
235 235
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 		$hook->update_callback( wp_unslash( $new_instance ), $number );
249 249
 
250
-		if ( empty( $_POST['add_new'] ) ) {
250
+		if ( empty( $_POST[ 'add_new' ] ) ) {
251 251
 			$hook->form_callback( $number );
252 252
 		}
253 253
 
Please login to merge, or discard this patch.
src/components/points/admin/includes/functions.php 2 patches
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -143,7 +143,8 @@  discard block
 block discarded – undo
143 143
  */
144 144
 function wordpoints_points_admin_screen_hooks() {
145 145
 
146
-	if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK.
146
+	if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) {
147
+// WPCS: CSRF OK.
147 148
 
148 149
 		// - We're doing this without AJAX (JS).
149 150
 
@@ -206,7 +207,8 @@  discard block
 block discarded – undo
206 207
  */
207 208
 function wordpoints_no_js_points_hooks_save() {
208 209
 
209
-	if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK.
210
+	if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) {
211
+// WPCS: CSRF OK.
210 212
 		return;
211 213
 	}
212 214
 
@@ -290,9 +292,12 @@  discard block
 block discarded – undo
290 292
 
291 293
 	<?php if ( $has_form ) : ?>
292 294
 		<hr />
293
-	<?php else : ?>
295
+	<?php else {
296
+	: ?>
294 297
 		<br />
295
-	<?php endif; ?>
298
+	<?php endif;
299
+}
300
+?>
296 301
 
297 302
 	<div class="hook-instance-description">
298 303
 		<label for="<?php $hook->the_field_id( '_description' ); ?>"><?php echo esc_html_x( 'Description (optional):', 'points hook', 'wordpoints' ); ?></label>
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function wordpoints_points_admin_screen_hooks() {
148 148
 
149
-	if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK.
149
+	if ( isset( $_GET[ 'edithook' ] ) || isset( $_POST[ 'savehook' ] ) || isset( $_POST[ 'removehook' ] ) ) { // WPCS: CSRF OK.
150 150
 
151 151
 		// - We're doing this without AJAX (JS).
152 152
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function wordpoints_no_js_points_hooks_save() {
211 211
 
212
-	if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK.
212
+	if ( ! isset( $_POST[ 'savehook' ] ) && ! isset( $_POST[ 'removehook' ] ) ) { // WPCS: CSRF OK.
213 213
 		return;
214 214
 	}
215 215
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function wordpoints_points_hook_description_form( $has_form, $instance, $hook ) {
289 289
 
290
-	$description = ( isset( $instance['_description'] ) ) ? $instance['_description'] : '';
290
+	$description = ( isset( $instance[ '_description' ] ) ) ? $instance[ '_description' ] : '';
291 291
 
292 292
 	?>
293 293
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			?>
354 354
 
355 355
 			<tr>
356
-				<th scope="row"><?php echo esc_html( $type['name'] ); ?></th>
356
+				<th scope="row"><?php echo esc_html( $type[ 'name' ] ); ?></th>
357 357
 				<td>
358 358
 					<input type="hidden" name="<?php echo esc_attr( "wordpoints_points_old-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" />
359 359
 					<input type="number" name="<?php echo esc_attr( "wordpoints_points-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" autocomplete="off" />
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 		<tbody>
399 399
 		<?php foreach ( wordpoints_get_points_types() as $slug => $type ) : ?>
400 400
 			<tr>
401
-				<th scope="row" style="text-align: left;"><?php echo esc_html( $type['name'] ); ?></th>
401
+				<th scope="row" style="text-align: left;"><?php echo esc_html( $type[ 'name' ] ); ?></th>
402 402
 				<td style="text-align: right;"><?php wordpoints_display_points( $user->ID, $slug, 'profile_page' ); ?></td>
403 403
 			</tr>
404 404
 		<?php endforeach; ?>
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	}
429 429
 
430 430
 	if (
431
-		! isset( $_POST['wordpoints_points_set_nonce'], $_POST['wordpoints_set_reason'] )
431
+		! isset( $_POST[ 'wordpoints_points_set_nonce' ], $_POST[ 'wordpoints_set_reason' ] )
432 432
 		|| ! wordpoints_verify_nonce( 'wordpoints_points_set_nonce', 'wordpoints_points_set_profile', null, 'post' )
433 433
 	) {
434 434
 		return;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 				, 'profile_edit'
454 454
 				, array(
455 455
 					'user_id' => get_current_user_id(),
456
-					'reason'  => sanitize_text_field( wp_unslash( $_POST['wordpoints_set_reason'] ) ),
456
+					'reason'  => sanitize_text_field( wp_unslash( $_POST[ 'wordpoints_set_reason' ] ) ),
457 457
 				)
458 458
 			);
459 459
 		}
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 function wordpoints_points_admin_settings_save() {
510 510
 
511 511
 	if (
512
-		isset( $_POST['default_points_type'] )
512
+		isset( $_POST[ 'default_points_type' ] )
513 513
 		&& wordpoints_verify_nonce( 'wordpoints_default_points_type_nonce', 'wordpoints_default_points_type', null, 'post' )
514 514
 	) {
515 515
 
516
-		$points_type = sanitize_key( $_POST['default_points_type'] );
516
+		$points_type = sanitize_key( $_POST[ 'default_points_type' ] );
517 517
 
518 518
 		if ( '-1' === $points_type ) {
519 519
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 function wordpoints_points_admin_notices() {
537 537
 
538 538
 	if (
539
-		( ! isset( $_GET['page'] ) || 'wordpoints_points_types' !== $_GET['page'] ) // WPCS: CSRF OK.
539
+		( ! isset( $_GET[ 'page' ] ) || 'wordpoints_points_types' !== $_GET[ 'page' ] ) // WPCS: CSRF OK.
540 540
 		&& current_user_can( 'manage_wordpoints_points_types' )
541 541
 		&& ! wordpoints_get_points_types()
542 542
 	) {
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks-no-js-load.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 	return;
12 12
 }
13 13
 
14
-if ( ! isset( $_POST['hook-id'] ) ) {
14
+if ( ! isset( $_POST[ 'hook-id' ] ) ) {
15 15
 	return;
16 16
 }
17 17
 
18
-$hook_id = sanitize_key( $_POST['hook-id'] );
18
+$hook_id = sanitize_key( $_POST[ 'hook-id' ] );
19 19
 
20 20
 check_admin_referer( "save-delete-hook-{$hook_id}" );
21 21
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	WordPoints_Points_Hooks::set_network_mode( true );
26 26
 }
27 27
 
28
-if ( ! isset( $_POST['points_type'], $_POST['id_base'] ) ) {
28
+if ( ! isset( $_POST[ 'points_type' ], $_POST[ 'id_base' ] ) ) {
29 29
 	return;
30 30
 }
31 31
 
32
-$points_type_id = sanitize_key( $_POST['points_type'] );
33
-$id_base        = sanitize_key( $_POST['id_base'] );
32
+$points_type_id = sanitize_key( $_POST[ 'points_type' ] );
33
+$id_base        = sanitize_key( $_POST[ 'id_base' ] );
34 34
 
35 35
 // These are the hooks grouped by points type.
36 36
 $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 $hook = WordPoints_Points_Hooks::get_handler_by_id_base( $id_base );
49 49
 
50
-if ( ! empty( $_POST['removehook'] ) ) {
50
+if ( ! empty( $_POST[ 'removehook' ] ) ) {
51 51
 
52 52
 	// - We are deleting an instance of a hook.
53 53
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
 	$hook->delete_callback( $hook_id );
65 65
 
66
-} elseif ( ! empty( $_POST['savehook'] ) ) {
66
+} elseif ( ! empty( $_POST[ 'savehook' ] ) ) {
67 67
 
68 68
 	// - We are saving an instance of a hook.
69 69
 
70
-	$number = isset( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : '';
70
+	$number = isset( $_POST[ 'multi_number' ] ) ? (int) $_POST[ 'multi_number' ] : '';
71 71
 
72 72
 	if ( $number ) {
73 73
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	// Add hook it to this points type.
102 102
 	if ( ! in_array( $hook_id, $points_type_hooks, true ) ) {
103 103
 
104
-		$points_type_hooks[] = $hook_id;
104
+		$points_type_hooks[ ] = $hook_id;
105 105
 		$points_types_hooks[ $points_type_id ] = $points_type_hooks;
106 106
 	}
107 107
 
Please login to merge, or discard this patch.