Completed
Push — master ( 760553...dce43d )
by J.D.
03:49
created
src/admin/admin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @since 2.1.0
19 19
  */
20
-require_once( WORDPOINTS_DIR . '/admin/includes/functions.php' );
20
+require_once(WORDPOINTS_DIR . '/admin/includes/functions.php');
21 21
 
22 22
 /**
23 23
  * Admin-side hooks.
24 24
  *
25 25
  * @since 2.1.0
26 26
  */
27
-require_once( WORDPOINTS_DIR . '/admin/includes/filters.php' );
27
+require_once(WORDPOINTS_DIR . '/admin/includes/filters.php');
28 28
 
29 29
 /**
30 30
  * Screen: Configuration.
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  */
34 34
 include_once WORDPOINTS_DIR . 'admin/screens/configure.php';
35 35
 
36
-WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'admin/includes' );
37
-WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'admin/classes' );
36
+WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'admin/includes');
37
+WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'admin/classes');
38 38
 
39 39
 // EOF
Please login to merge, or discard this patch.
src/admin/classes/screen.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	public function hooks() {
63 63
 
64 64
 		/* Load the JavaScript needed for the settings screen. */
65
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
66
-		add_action( 'admin_print_footer_scripts', array( $this, 'footer_scripts' ) );
65
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
66
+		add_action('admin_print_footer_scripts', array($this, 'footer_scripts'));
67 67
 	}
68 68
 
69 69
 	/**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 
99 99
 		<div class="wrap">
100 100
 
101
-			<h1><?php echo esc_html( $this->get_title() ); ?></h1>
101
+			<h1><?php echo esc_html($this->get_title()); ?></h1>
102 102
 
103 103
 			<?php settings_errors(); ?>
104 104
 
105
-			<?php if ( ! empty( $this->tabs ) ) : ?>
106
-				<?php wordpoints_admin_show_tabs( $this->tabs, false ); ?>
105
+			<?php if ( ! empty($this->tabs)) : ?>
106
+				<?php wordpoints_admin_show_tabs($this->tabs, false); ?>
107 107
 			<?php endif; ?>
108 108
 
109 109
 			<?php $this->display_content(); ?>
Please login to merge, or discard this patch.
src/admin/classes/ajax/hooks.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	) {
101 101
 
102 102
 		return 'wordpoints_create_hook_reaction|' . $reaction_store->get_slug()
103
-		       . '|' . wordpoints_hooks()->get_current_mode()
104
-		       . '|' . wp_json_encode( $reaction_store->get_context_id() );
103
+			   . '|' . wordpoints_hooks()->get_current_mode()
104
+			   . '|' . wp_json_encode( $reaction_store->get_context_id() );
105 105
 	}
106 106
 
107 107
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		WordPoints_Hook_ReactionI $reaction
132 132
 	) {
133 133
 		return 'wordpoints_update_hook_reaction|'
134
-		       . wp_json_encode( $reaction->get_guid() );
134
+			   . wp_json_encode( $reaction->get_guid() );
135 135
 	}
136 136
 
137 137
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		WordPoints_Hook_ReactionI $reaction
162 162
 	) {
163 163
 		return 'wordpoints_delete_hook_reaction|'
164
-		       . wp_json_encode( $reaction->get_guid() );
164
+			   . wp_json_encode( $reaction->get_guid() );
165 165
 	}
166 166
 
167 167
 	//
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array The hook reaction data extracted into an array.
54 54
 	 */
55
-	public static function prepare_hook_reaction( WordPoints_Hook_ReactionI $reaction ) {
55
+	public static function prepare_hook_reaction(WordPoints_Hook_ReactionI $reaction) {
56 56
 
57 57
 		return array_merge(
58 58
 			$reaction->get_all_meta()
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 				'id' => $reaction->get_id(),
61 61
 				'event' => $reaction->get_event_slug(),
62 62
 				'reaction_store' => $reaction->get_store_slug(),
63
-				'nonce' => self::get_update_nonce( $reaction ),
64
-				'delete_nonce' => self::get_delete_nonce( $reaction ),
63
+				'nonce' => self::get_update_nonce($reaction),
64
+				'delete_nonce' => self::get_delete_nonce($reaction),
65 65
 			)
66 66
 		);
67 67
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		WordPoints_Hook_Reaction_StoreI $reaction_store
82 82
 	) {
83 83
 
84
-		return wp_create_nonce( self::get_create_nonce_action( $reaction_store ) );
84
+		return wp_create_nonce(self::get_create_nonce_action($reaction_store));
85 85
 	}
86 86
 
87 87
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 		return 'wordpoints_create_hook_reaction|' . $reaction_store->get_slug()
103 103
 		       . '|' . wordpoints_hooks()->get_current_mode()
104
-		       . '|' . wp_json_encode( $reaction_store->get_context_id() );
104
+		       . '|' . wp_json_encode($reaction_store->get_context_id());
105 105
 	}
106 106
 
107 107
 	/**
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string A nonce for updating this reaction.
115 115
 	 */
116
-	public static function get_update_nonce( WordPoints_Hook_ReactionI $reaction ) {
116
+	public static function get_update_nonce(WordPoints_Hook_ReactionI $reaction) {
117 117
 
118
-		return wp_create_nonce( self::get_update_nonce_action( $reaction ) );
118
+		return wp_create_nonce(self::get_update_nonce_action($reaction));
119 119
 	}
120 120
 
121 121
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		WordPoints_Hook_ReactionI $reaction
132 132
 	) {
133 133
 		return 'wordpoints_update_hook_reaction|'
134
-		       . wp_json_encode( $reaction->get_guid() );
134
+		       . wp_json_encode($reaction->get_guid());
135 135
 	}
136 136
 
137 137
 	/**
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return string A nonce for deleting this reaction.
145 145
 	 */
146
-	public static function get_delete_nonce( WordPoints_Hook_ReactionI $reaction ) {
146
+	public static function get_delete_nonce(WordPoints_Hook_ReactionI $reaction) {
147 147
 
148
-		return wp_create_nonce( self::get_delete_nonce_action( $reaction ) );
148
+		return wp_create_nonce(self::get_delete_nonce_action($reaction));
149 149
 	}
150 150
 
151 151
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		WordPoints_Hook_ReactionI $reaction
162 162
 	) {
163 163
 		return 'wordpoints_delete_hook_reaction|'
164
-		       . wp_json_encode( $reaction->get_guid() );
164
+		       . wp_json_encode($reaction->get_guid());
165 165
 	}
166 166
 
167 167
 	//
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
 
188 188
 		add_action(
189 189
 			'wp_ajax_wordpoints_admin_create_hook_reaction'
190
-			, array( $this, 'create_hook_reaction' )
190
+			, array($this, 'create_hook_reaction')
191 191
 		);
192 192
 
193 193
 		add_action(
194 194
 			'wp_ajax_wordpoints_admin_update_hook_reaction'
195
-			, array( $this, 'update_hook_reaction' )
195
+			, array($this, 'update_hook_reaction')
196 196
 		);
197 197
 
198 198
 		add_action(
199 199
 			'wp_ajax_wordpoints_admin_delete_hook_reaction'
200
-			, array( $this, 'delete_hook_reaction' )
200
+			, array($this, 'delete_hook_reaction')
201 201
 		);
202 202
 	}
203 203
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 
213 213
 		$reaction_store = $this->get_reaction_store();
214 214
 
215
-		$this->verify_request( $this->get_create_nonce_action( $reaction_store ) );
215
+		$this->verify_request($this->get_create_nonce_action($reaction_store));
216 216
 
217
-		$reaction = $reaction_store->create_reaction( $this->get_data() );
217
+		$reaction = $reaction_store->create_reaction($this->get_data());
218 218
 
219
-		$this->send_json_result( $reaction, 'create' );
219
+		$this->send_json_result($reaction, 'create');
220 220
 	}
221 221
 
222 222
 	/**
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
 		$reaction_store = $this->get_reaction_store();
232 232
 		$reaction = $this->get_reaction();
233 233
 
234
-		$this->verify_request( $this->get_update_nonce_action( $reaction ) );
234
+		$this->verify_request($this->get_update_nonce_action($reaction));
235 235
 
236 236
 		$reaction = $reaction_store->update_reaction(
237 237
 			$reaction->get_id()
238 238
 			, $this->get_data()
239 239
 		);
240 240
 
241
-		$this->send_json_result( $reaction, 'update' );
241
+		$this->send_json_result($reaction, 'update');
242 242
 	}
243 243
 
244 244
 	/**
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 		$reaction_store = $this->get_reaction_store();
254 254
 		$reaction = $this->get_reaction();
255 255
 
256
-		$this->verify_request( $this->get_delete_nonce_action( $reaction ) );
256
+		$this->verify_request($this->get_delete_nonce_action($reaction));
257 257
 
258
-		$result = $reaction_store->delete_reaction( $reaction->get_id() );
258
+		$result = $reaction_store->delete_reaction($reaction->get_id());
259 259
 
260
-		if ( ! $result ) {
261
-			wp_send_json_error( array( 'message' => __( 'There was an error deleting the reaction. Please try again.', 'wordpoints' ) ) );
260
+		if ( ! $result) {
261
+			wp_send_json_error(array('message' => __('There was an error deleting the reaction. Please try again.', 'wordpoints')));
262 262
 		}
263 263
 
264 264
 		wp_send_json_success();
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @param string $debug_context Context sent with the message (for debugging).
281 281
 	 */
282
-	private function unexpected_error( $debug_context ) {
282
+	private function unexpected_error($debug_context) {
283 283
 
284 284
 		wp_send_json_error(
285 285
 			array(
286
-				'message' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ),
286
+				'message' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'),
287 287
 				'debug'   => $debug_context,
288 288
 			)
289 289
 		);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	private function verify_user_can() {
301 301
 
302
-		if ( ! current_user_can( 'manage_options' ) ) {
303
-			wp_send_json_error( array( 'message' => __( 'Sorry, you are not allowed to perform this action. Maybe you have been logged out?', 'wordpoints' ) ) );
302
+		if ( ! current_user_can('manage_options')) {
303
+			wp_send_json_error(array('message' => __('Sorry, you are not allowed to perform this action. Maybe you have been logged out?', 'wordpoints')));
304 304
 		}
305 305
 	}
306 306
 
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @param string $action The action the nonce should be for.
315 315
 	 */
316
-	private function verify_request( $action ) {
316
+	private function verify_request($action) {
317 317
 
318 318
 		if (
319
-			empty( $_POST['nonce'] )
320
-			|| ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' )
319
+			empty($_POST['nonce'])
320
+			|| ! wordpoints_verify_nonce('nonce', $action, null, 'post')
321 321
 		) {
322 322
 			wp_send_json_error(
323
-				array( 'message' => __( 'Your security token for this action has expired. Refresh the page and try again.', 'wordpoints' ) )
323
+				array('message' => __('Your security token for this action has expired. Refresh the page and try again.', 'wordpoints'))
324 324
 			);
325 325
 		}
326 326
 	}
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	protected function get_reaction_store() {
336 336
 
337
-		if ( ! isset( $_POST['reaction_store'] ) ) { // WPCS: CSRF OK.
338
-			$this->unexpected_error( 'reaction_store' );
337
+		if ( ! isset($_POST['reaction_store'])) { // WPCS: CSRF OK.
338
+			$this->unexpected_error('reaction_store');
339 339
 		}
340 340
 
341
-		$reactor_slug = sanitize_key( $_POST['reaction_store'] ); // WPCS: CSRF OK.
341
+		$reactor_slug = sanitize_key($_POST['reaction_store']); // WPCS: CSRF OK.
342 342
 
343
-		$reaction_store = wordpoints_hooks()->get_reaction_store( $reactor_slug );
343
+		$reaction_store = wordpoints_hooks()->get_reaction_store($reactor_slug);
344 344
 
345
-		if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI ) {
346
-			$this->unexpected_error( 'reaction_store_invalid' );
345
+		if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI) {
346
+			$this->unexpected_error('reaction_store_invalid');
347 347
 		}
348 348
 
349 349
 		$this->reaction_store_slug = $reactor_slug;
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	protected function get_reaction() {
363 363
 
364
-		if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK.
365
-			$this->unexpected_error( 'id' );
364
+		if ( ! isset($_POST['id'])) { // WPCS: CSRF OK.
365
+			$this->unexpected_error('id');
366 366
 		}
367 367
 
368 368
 		$reaction = $this->reaction_store->get_reaction(
369
-			wordpoints_int( $_POST['id'] ) // WPCS: CSRF OK.
369
+			wordpoints_int($_POST['id']) // WPCS: CSRF OK.
370 370
 		);
371 371
 
372
-		if ( ! $reaction ) {
373
-			wp_send_json_error( array( 'message' => __( 'The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) );
372
+		if ( ! $reaction) {
373
+			wp_send_json_error(array('message' => __('The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints')));
374 374
 		}
375 375
 
376 376
 		return $reaction;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	 */
386 386
 	protected function get_data() {
387 387
 
388
-		$data = wp_unslash( $_POST ); // WPCS: CSRF OK.
388
+		$data = wp_unslash($_POST); // WPCS: CSRF OK.
389 389
 
390
-		unset( $data['id'], $data['action'], $data['nonce'], $data['reaction_store'] );
390
+		unset($data['id'], $data['action'], $data['nonce'], $data['reaction_store']);
391 391
 
392 392
 		return $data;
393 393
 	}
@@ -400,30 +400,30 @@  discard block
 block discarded – undo
400 400
 	 * @param mixed  $result The result of the action.
401 401
 	 * @param string $action The action being performed: 'create' or 'update'.
402 402
 	 */
403
-	private function send_json_result( $result, $action ) {
403
+	private function send_json_result($result, $action) {
404 404
 
405
-		if ( ! $result ) {
405
+		if ( ! $result) {
406 406
 
407
-			if ( 'create' === $action ) {
408
-				$message = __( 'There was an error adding the reaction. Please try again.', 'wordpoints' );
407
+			if ('create' === $action) {
408
+				$message = __('There was an error adding the reaction. Please try again.', 'wordpoints');
409 409
 			} else {
410
-				$message = __( 'There was an error updating the reaction. Please try again.', 'wordpoints' );
410
+				$message = __('There was an error updating the reaction. Please try again.', 'wordpoints');
411 411
 			}
412 412
 
413
-			wp_send_json_error( array( 'message' => $message ) );
413
+			wp_send_json_error(array('message' => $message));
414 414
 
415
-		} elseif ( $result instanceof WordPoints_Hook_Reaction_Validator ) {
415
+		} elseif ($result instanceof WordPoints_Hook_Reaction_Validator) {
416 416
 
417
-			wp_send_json_error( array( 'errors' => $result->get_errors() ) );
417
+			wp_send_json_error(array('errors' => $result->get_errors()));
418 418
 		}
419 419
 
420 420
 		$data = null;
421 421
 
422
-		if ( 'create' === $action ) {
423
-			$data = self::prepare_hook_reaction( $result );
422
+		if ('create' === $action) {
423
+			$data = self::prepare_hook_reaction($result);
424 424
 		}
425 425
 
426
-		wp_send_json_success( $data );
426
+		wp_send_json_success($data);
427 427
 	}
428 428
 }
429 429
 
Please login to merge, or discard this patch.
src/admin/classes/screens.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @since 2.1.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'current_screen', array( $this, 'set_current_screen' ) );
30
+		add_action('current_screen', array($this, 'set_current_screen'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param WP_Screen $current_screen The WP_Screen object for the current screen.
39 39
 	 */
40
-	public function set_current_screen( $current_screen ) {
40
+	public function set_current_screen($current_screen) {
41 41
 
42 42
 		$screen_id = $current_screen->id;
43 43
 
44
-		if ( is_network_admin() ) {
45
-			$screen_id = substr( $screen_id, 0, -8 /* -network */ );
44
+		if (is_network_admin()) {
45
+			$screen_id = substr($screen_id, 0, -8 /* -network */);
46 46
 		}
47 47
 
48
-		$screen = $this->get( $screen_id );
48
+		$screen = $this->get($screen_id);
49 49
 
50
-		if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) {
50
+		if ( ! ($screen instanceof WordPoints_Admin_Screen)) {
51 51
 			return;
52 52
 		}
53 53
 
54 54
 		$this->current_screen = $screen;
55 55
 
56
-		add_action( "load-{$screen_id}", array( $this->current_screen, 'load' ) );
56
+		add_action("load-{$screen_id}", array($this->current_screen, 'load'));
57 57
 	}
58 58
 
59 59
 	/**
Please login to merge, or discard this patch.
src/admin/screens/module-install.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $tab;
11 11
 
12
-if ( empty( $tab ) ) {
12
+if (empty($tab)) {
13 13
 	$tab = 'upload';
14 14
 }
15 15
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 });
26 26
 </script>
27 27
 <div class="wrap">
28
-	<h1><?php esc_html_e( 'Install Modules', 'wordpoints' ); ?></h1>
28
+	<h1><?php esc_html_e('Install Modules', 'wordpoints'); ?></h1>
29 29
 	<?php
30 30
 
31 31
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @since 1.1.0
37 37
 	 */
38
-	do_action( 'wordpoints_install_modules_screen' );
38
+	do_action('wordpoints_install_modules_screen');
39 39
 
40 40
 	?>
41 41
 	<br class="clear" />
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @since 1.1.0
51 51
 	 */
52
-	do_action( "wordpoints_install_modules-{$tab}" );
52
+	do_action("wordpoints_install_modules-{$tab}");
53 53
 
54 54
 	?>
55 55
 </div>
Please login to merge, or discard this patch.
src/admin/screens/configure-components-load.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,45 +7,45 @@  discard block
 block discarded – undo
7 7
  * @since 1.1.0
8 8
  */
9 9
 
10
-if ( ! current_user_can( 'manage_options' ) ) {
10
+if ( ! current_user_can('manage_options')) {
11 11
 	return;
12 12
 }
13 13
 
14 14
 if (
15 15
 	'components' !== wordpoints_admin_get_current_tab()
16
-	|| ! isset( $_POST['wordpoints_component'], $_POST['wordpoints_component_action'], $_POST['_wpnonce'] )
16
+	|| ! isset($_POST['wordpoints_component'], $_POST['wordpoints_component_action'], $_POST['_wpnonce'])
17 17
 ) {
18 18
 	return;
19 19
 }
20 20
 
21 21
 $components = WordPoints_Components::instance();
22
-$component  = sanitize_key( $_POST['wordpoints_component'] );
22
+$component  = sanitize_key($_POST['wordpoints_component']);
23 23
 
24
-$action = sanitize_key( $_POST['wordpoints_component_action'] );
24
+$action = sanitize_key($_POST['wordpoints_component_action']);
25 25
 
26
-check_admin_referer( "wordpoints_{$action}_component-{$component}" );
26
+check_admin_referer("wordpoints_{$action}_component-{$component}");
27 27
 
28
-switch ( $action ) {
28
+switch ($action) {
29 29
 
30 30
 	case 'activate':
31
-		if ( $components->activate( $component ) ) {
31
+		if ($components->activate($component)) {
32 32
 
33
-			$message = array( 'message' => 1 );
33
+			$message = array('message' => 1);
34 34
 
35 35
 		} else {
36 36
 
37
-			$message = array( 'error' => 1 );
37
+			$message = array('error' => 1);
38 38
 		}
39 39
 	break;
40 40
 
41 41
 	case 'deactivate':
42
-		if ( $components->deactivate( $component ) ) {
42
+		if ($components->deactivate($component)) {
43 43
 
44
-			$message = array( 'message' => 2 );
44
+			$message = array('message' => 2);
45 45
 
46 46
 		} else {
47 47
 
48
-			$message = array( 'error' => 2 );
48
+			$message = array('error' => 2);
49 49
 		}
50 50
 	break;
51 51
 
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 			'page'                 => 'wordpoints_configure',
59 59
 			'tab'                  => 'components',
60 60
 			'wordpoints_component' => $component,
61
-			'_wpnonce'             => wp_create_nonce( 'wordpoints_component_' . key( $message ) . "-{$component}" ),
61
+			'_wpnonce'             => wp_create_nonce('wordpoints_component_' . key($message) . "-{$component}"),
62 62
 		)
63
-		, self_admin_url( 'admin.php' )
63
+		, self_admin_url('admin.php')
64 64
 	)
65 65
 );
66 66
 
Please login to merge, or discard this patch.
src/admin/screens/configure-settings-load.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@
 block discarded – undo
12 12
 $screen->add_help_tab(
13 13
 	array(
14 14
 		'id'      => 'overview',
15
-		'title'   => __( 'Overview', 'wordpoints' ),
15
+		'title'   => __('Overview', 'wordpoints'),
16 16
 		'content' =>
17
-			'<p>' . esc_html__( 'WordPoints doesn&#8217;t have a lot of configuration options, which makes it simple and easy to use.', 'wordpoints' ) . '</p>
18
-			<p>' . esc_html__( 'The settings provided below are optional, and are mainly for convenience', 'wordpoints' ) . '</p>
19
-			<p>' . esc_html__( 'If you need more help getting started with WordPoints, see the links in the help sidebar.', 'wordpoints' ) . '</p>',
17
+			'<p>' . esc_html__('WordPoints doesn&#8217;t have a lot of configuration options, which makes it simple and easy to use.', 'wordpoints') . '</p>
18
+			<p>' . esc_html__('The settings provided below are optional, and are mainly for convenience', 'wordpoints') . '</p>
19
+			<p>' . esc_html__('If you need more help getting started with WordPoints, see the links in the help sidebar.', 'wordpoints') . '</p>',
20 20
 	)
21 21
 );
22 22
 
23 23
 $screen->set_help_sidebar(
24
-	'<p><strong>' . esc_html__( 'For more information:', 'wordpoints' ) . '</strong></p>
25
-	<p><a href="https://wordpoints.org/user-guide/">' . esc_html__( 'User Guide', 'wordpoints' ) . '</a></p>
26
-	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__( 'Support Forums', 'wordpoints' ) . '</a></p>'
24
+	'<p><strong>' . esc_html__('For more information:', 'wordpoints') . '</strong></p>
25
+	<p><a href="https://wordpoints.org/user-guide/">' . esc_html__('User Guide', 'wordpoints') . '</a></p>
26
+	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__('Support Forums', 'wordpoints') . '</a></p>'
27 27
 );
28 28
 
29 29
 // EOF
Please login to merge, or discard this patch.
src/admin/screens/configure-settings.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@  discard block
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( ! current_user_can( 'manage_options' ) ) {
10
+if ( ! current_user_can('manage_options')) {
11 11
 	return;
12 12
 }
13 13
 
14 14
 if (
15
-	isset( $_POST['wordpoints_settings_nonce'], $_POST['excluded_users'] )
16
-	&& wordpoints_verify_nonce( 'wordpoints_settings_nonce', 'wordpoints_settings_submit', null, 'post' )
15
+	isset($_POST['wordpoints_settings_nonce'], $_POST['excluded_users'])
16
+	&& wordpoints_verify_nonce('wordpoints_settings_nonce', 'wordpoints_settings_submit', null, 'post')
17 17
 ) {
18 18
 
19 19
 	// - The form has been submitted.
20 20
 
21
-	$excluded_users = preg_replace( '/\s/', '', sanitize_text_field( wp_unslash( $_POST['excluded_users'] ) ) );
21
+	$excluded_users = preg_replace('/\s/', '', sanitize_text_field(wp_unslash($_POST['excluded_users'])));
22 22
 
23
-	if ( ! empty( $excluded_users ) ) {
23
+	if ( ! empty($excluded_users)) {
24 24
 
25
-		$excluded_users = explode( ',', $excluded_users );
25
+		$excluded_users = explode(',', $excluded_users);
26 26
 
27
-		$excluded_users = array_unique( array_filter( $excluded_users, 'wordpoints_posint' ) );
27
+		$excluded_users = array_unique(array_filter($excluded_users, 'wordpoints_posint'));
28 28
 	}
29 29
 
30 30
 	wordpoints_update_maybe_network_option(
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @since 1.0.0
41 41
 	 */
42
-	do_action( 'wordpoints_admin_settings_update' );
42
+	do_action('wordpoints_admin_settings_update');
43 43
 
44 44
 	wordpoints_show_admin_message(
45
-		esc_html__( 'Settings updated.', 'wordpoints' )
45
+		esc_html__('Settings updated.', 'wordpoints')
46 46
 		, 'success'
47
-		, array( 'dismissible' => true )
47
+		, array('dismissible' => true)
48 48
 	);
49 49
 }
50 50
 
51 51
 ?>
52 52
 
53
-<p><?php esc_html_e( 'Configure WordPoints to your liking.', 'wordpoints' ); ?></p>
53
+<p><?php esc_html_e('Configure WordPoints to your liking.', 'wordpoints'); ?></p>
54 54
 <form id="wordpoints-settings" method="post">
55 55
 
56 56
 	<?php
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @since 1.0.0
62 62
 	 */
63
-	do_action( 'wordpoints_admin_settings_top' );
63
+	do_action('wordpoints_admin_settings_top');
64 64
 
65 65
 	?>
66 66
 
67
-	<h3><?php esc_html_e( 'Excluded Users', 'wordpoints' ); ?></h3>
68
-	<p><?php esc_html_e( 'Enter the IDs of users to exclude from leader boards, logs, etc. This may be useful if you use certain accounts for testing.', 'wordpoints' ); ?></p>
67
+	<h3><?php esc_html_e('Excluded Users', 'wordpoints'); ?></h3>
68
+	<p><?php esc_html_e('Enter the IDs of users to exclude from leader boards, logs, etc. This may be useful if you use certain accounts for testing.', 'wordpoints'); ?></p>
69 69
 	<table class="form-table">
70 70
 		<tbody>
71 71
 			<tr>
72 72
 				<th>
73
-					<label for="excluded_users"><?php esc_html_e( 'Excluded Users', 'wordpoints' ); ?></label>
73
+					<label for="excluded_users"><?php esc_html_e('Excluded Users', 'wordpoints'); ?></label>
74 74
 				</th>
75 75
 				<td>
76
-					<input type="text" name="excluded_users" id="excluded_users" value="<?php echo esc_attr( implode( ', ', wordpoints_get_maybe_network_array_option( 'wordpoints_excluded_users' ) ) ); ?>" />
76
+					<input type="text" name="excluded_users" id="excluded_users" value="<?php echo esc_attr(implode(', ', wordpoints_get_maybe_network_array_option('wordpoints_excluded_users'))); ?>" />
77 77
 				</td>
78 78
 			</tr>
79 79
 		</tbody>
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @since 1.0.0
88 88
 	 */
89
-	do_action( 'wordpoints_admin_settings_bottom' );
89
+	do_action('wordpoints_admin_settings_bottom');
90 90
 
91 91
 	?>
92 92
 
93
-	<?php wp_nonce_field( 'wordpoints_settings_submit', 'wordpoints_settings_nonce' ); ?>
93
+	<?php wp_nonce_field('wordpoints_settings_submit', 'wordpoints_settings_nonce'); ?>
94 94
 	<?php submit_button(); ?>
95 95
 </form>
Please login to merge, or discard this patch.
src/classes/entity.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -430,7 +430,7 @@
 block discarded – undo
430 430
 	 *
431 431
 	 * @since 2.1.0
432 432
 	 *
433
-	 * @return mixed The ID of the entity.
433
+	 * @return integer The ID of the entity.
434 434
 	 */
435 435
 	public function get_the_id() {
436 436
 		return $this->get_the_value();
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return mixed The entity, or false if not found.
110 110
 	 */
111
-	protected function get_entity( $id ) {
111
+	protected function get_entity($id) {
112 112
 
113
-		$entity = call_user_func( $this->getter, $id );
113
+		$entity = call_user_func($this->getter, $id);
114 114
 
115
-		if ( ! $this->is_entity( $entity ) ) {
115
+		if ( ! $this->is_entity($entity)) {
116 116
 			return false;
117 117
 		}
118 118
 
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return bool Whether the passed value is an entity.
130 130
 	 */
131
-	protected function is_entity( $entity ) {
131
+	protected function is_entity($entity) {
132 132
 
133
-		if ( ! is_object( $entity ) && ! is_array( $entity ) ) {
133
+		if ( ! is_object($entity) && ! is_array($entity)) {
134 134
 			return false;
135 135
 		}
136 136
 
137
-		return (bool) $this->get_entity_id( $entity );
137
+		return (bool) $this->get_entity_id($entity);
138 138
 	}
139 139
 
140 140
 	/**
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return mixed The entity, or false if not found.
153 153
 	 */
154
-	protected function get_entity_from_context( $id, $context ) {
154
+	protected function get_entity_from_context($id, $context) {
155 155
 
156 156
 		/** @var WordPoints_Entity_Contexts $contexts */
157
-		$contexts = wordpoints_entities()->get_sub_app( 'contexts' );
157
+		$contexts = wordpoints_entities()->get_sub_app('contexts');
158 158
 
159
-		if ( ! $contexts->switch_to( $context ) ) {
159
+		if ( ! $contexts->switch_to($context)) {
160 160
 			return false;
161 161
 		}
162 162
 
163
-		$entity = $this->get_entity( $id );
163
+		$entity = $this->get_entity($id);
164 164
 
165 165
 		$contexts->switch_back();
166 166
 
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return bool Whether the passed value is a GUID for an entity of this type.
178 178
 	 */
179
-	protected function is_guid( $guid ) {
179
+	protected function is_guid($guid) {
180 180
 
181
-		if ( ! is_array( $guid ) ) {
181
+		if ( ! is_array($guid)) {
182 182
 			return false;
183 183
 		}
184 184
 
185
-		return isset( $guid[ $this->get_slug() ], $guid[ $this->get_context() ] );
185
+		return isset($guid[$this->get_slug()], $guid[$this->get_context()]);
186 186
 	}
187 187
 
188 188
 	/**
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 *         @type array      $context The entity context.
198 198
 	 * }
199 199
 	 */
200
-	protected function split_guid( $guid ) {
200
+	protected function split_guid($guid) {
201 201
 
202 202
 		$slug    = $this->get_slug();
203
-		$id      = $guid[ $slug ];
203
+		$id      = $guid[$slug];
204 204
 		$context = $guid;
205 205
 
206
-		unset( $context[ $slug ] );
206
+		unset($context[$slug]);
207 207
 
208
-		return array( 'id' => $id, 'context' => $context );
208
+		return array('id' => $id, 'context' => $context);
209 209
 	}
210 210
 
211 211
 	/**
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return mixed The value of the attribute of the entity.
220 220
 	 */
221
-	protected function get_attr_value( $entity, $attr ) {
221
+	protected function get_attr_value($entity, $attr) {
222 222
 
223
-		if ( is_array( $entity ) ) {
224
-			if ( isset( $entity[ $attr ] ) ) {
225
-				return $entity[ $attr ];
223
+		if (is_array($entity)) {
224
+			if (isset($entity[$attr])) {
225
+				return $entity[$attr];
226 226
 			}
227 227
 		} else {
228
-			if ( isset( $entity->{$attr} ) ) {
228
+			if (isset($entity->{$attr} )) {
229 229
 				return $entity->{$attr};
230 230
 			}
231 231
 		}
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return mixed The ID of the entity.
244 244
 	 */
245
-	protected function get_entity_id( $entity ) {
246
-		return $this->get_attr_value( $entity, $this->get_id_field() );
245
+	protected function get_entity_id($entity) {
246
+		return $this->get_attr_value($entity, $this->get_id_field());
247 247
 	}
248 248
 
249 249
 	/**
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 	 *
260 260
 	 * @return mixed The human ID of the entity.
261 261
 	 */
262
-	protected function get_entity_human_id( $entity ) {
263
-		return $this->get_attr_value( $entity, $this->human_id_field );
262
+	protected function get_entity_human_id($entity) {
263
+		return $this->get_attr_value($entity, $this->human_id_field);
264 264
 	}
265 265
 
266 266
 	//
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @return string|int|float|false The human identifier for the entity, or false.
304 304
 	 */
305
-	public function get_human_id( $id ) {
305
+	public function get_human_id($id) {
306 306
 
307
-		$entity = $this->get_entity( $id );
307
+		$entity = $this->get_entity($id);
308 308
 
309
-		if ( ! $entity ) {
309
+		if ( ! $entity) {
310 310
 			return false;
311 311
 		}
312 312
 
313
-		return $this->get_entity_human_id( $entity );
313
+		return $this->get_entity_human_id($entity);
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return bool Whether or not an entity with that ID exists.
324 324
 	 */
325
-	public function exists( $id ) {
326
-		return (bool) $this->get_entity( $id );
325
+	public function exists($id) {
326
+		return (bool) $this->get_entity($id);
327 327
 	}
328 328
 
329 329
 	/**
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return WordPoints_Entityish|false The child's object, or false if not found.
340 340
 	 */
341
-	public function get_child( $child_slug ) {
341
+	public function get_child($child_slug) {
342 342
 
343
-		$children = wordpoints_entities()->get_sub_app( 'children' );
343
+		$children = wordpoints_entities()->get_sub_app('children');
344 344
 
345
-		$child = $children->get( $this->slug, $child_slug );
345
+		$child = $children->get($this->slug, $child_slug);
346 346
 
347 347
 		if (
348
-			isset( $this->the_value )
348
+			isset($this->the_value)
349 349
 			&& $child instanceof WordPoints_Entity_ChildI
350 350
 		) {
351
-			$child->set_the_value_from_entity( $this );
351
+			$child->set_the_value_from_entity($this);
352 352
 		}
353 353
 
354 354
 		return $child;
@@ -371,35 +371,35 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return bool Whether the value was set.
373 373
 	 */
374
-	public function set_the_value( $value ) {
374
+	public function set_the_value($value) {
375 375
 
376 376
 		$this->the_value = null;
377 377
 		$this->the_entity = null;
378 378
 		$this->the_context = null;
379 379
 
380
-		if ( $this->is_entity( $value ) ) {
380
+		if ($this->is_entity($value)) {
381 381
 
382 382
 			$entity = $value;
383
-			$value = $this->get_entity_id( $value );
383
+			$value = $this->get_entity_id($value);
384 384
 
385
-		} elseif ( $this->is_guid( $value ) ) {
385
+		} elseif ($this->is_guid($value)) {
386 386
 
387
-			$guid = $this->split_guid( $value );
387
+			$guid = $this->split_guid($value);
388 388
 			$context = $guid['context'];
389 389
 			$value   = $guid['id'];
390 390
 
391
-			$entity = $this->get_entity_from_context( $guid['id'], $context );
391
+			$entity = $this->get_entity_from_context($guid['id'], $context);
392 392
 
393 393
 		} else {
394 394
 
395
-			$entity = $this->get_entity( $value );
395
+			$entity = $this->get_entity($value);
396 396
 		}
397 397
 
398
-		if ( ! $entity ) {
398
+		if ( ! $entity) {
399 399
 			return false;
400 400
 		}
401 401
 
402
-		if ( ! isset( $context ) ) {
402
+		if ( ! isset($context)) {
403 403
 			$context = wordpoints_entities_get_current_context_id(
404 404
 				$this->get_context()
405 405
 			);
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 *
422 422
 	 * @return mixed The value of the attribute.
423 423
 	 */
424
-	public function get_the_attr_value( $attr ) {
425
-		return $this->get_attr_value( $this->the_entity, $attr );
424
+	public function get_the_attr_value($attr) {
425
+		return $this->get_attr_value($this->the_entity, $attr);
426 426
 	}
427 427
 
428 428
 	/**
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 * @return string|int|float|null The human identifier for the entity, or null.
447 447
 	 */
448 448
 	public function get_the_human_id() {
449
-		return $this->get_entity_human_id( $this->the_entity );
449
+		return $this->get_entity_human_id($this->the_entity);
450 450
 	}
451 451
 
452 452
 	/**
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
 
481 481
 		$guid = $this->get_the_context();
482 482
 
483
-		if ( ! is_array( $guid ) ) {
483
+		if ( ! is_array($guid)) {
484 484
 			return $guid;
485 485
 		}
486 486
 
487
-		$guid = array( $this->slug => $this->get_the_id() ) + $guid;
487
+		$guid = array($this->slug => $this->get_the_id()) + $guid;
488 488
 
489 489
 		return $guid;
490 490
 	}
Please login to merge, or discard this patch.