Completed
Push — master ( 760553...dce43d )
by J.D.
03:49
created
src/classes/hook/reaction/store.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@
 block discarded – undo
190 190
 	 *
191 191
 	 * @param string $event_slug The slug of the event this reaction is for.
192 192
 	 *
193
-	 * @return int|false The reaction ID, or false if not created.
193
+	 * @return integer The reaction ID, or false if not created.
194 194
 	 */
195 195
 	abstract protected function _create_reaction( $event_slug );
196 196
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @param string $slug      The slug of this store.
64 64
 	 * @param string $mode_slug The slug of the mode this store relates to.
65 65
 	 */
66
-	public function __construct( $slug, $mode_slug ) {
66
+	public function __construct($slug, $mode_slug) {
67 67
 		$this->slug      = $slug;
68 68
 		$this->mode_slug = $mode_slug;
69 69
 	}
@@ -86,33 +86,33 @@  discard block
 block discarded – undo
86 86
 	 * @since 2.1.0
87 87
 	 */
88 88
 	public function get_context_id() {
89
-		return wordpoints_entities_get_current_context_id( $this->context );
89
+		return wordpoints_entities_get_current_context_id($this->context);
90 90
 	}
91 91
 
92 92
 	/**
93 93
 	 * @since 2.1.0
94 94
 	 */
95
-	public function get_reaction( $id ) {
95
+	public function get_reaction($id) {
96 96
 
97
-		if ( ! $this->reaction_exists( $id ) ) {
97
+		if ( ! $this->reaction_exists($id)) {
98 98
 			return false;
99 99
 		}
100 100
 
101
-		return new $this->reaction_class( $id, $this );
101
+		return new $this->reaction_class($id, $this);
102 102
 	}
103 103
 
104 104
 	/**
105 105
 	 * @since 2.1.0
106 106
 	 */
107
-	public function create_reaction( array $settings ) {
108
-		return $this->create_or_update_reaction( $settings );
107
+	public function create_reaction(array $settings) {
108
+		return $this->create_or_update_reaction($settings);
109 109
 	}
110 110
 
111 111
 	/**
112 112
 	 * @since 2.1.0
113 113
 	 */
114
-	public function update_reaction( $id, array $settings ) {
115
-		return $this->create_or_update_reaction( $settings, $id );
114
+	public function update_reaction($id, array $settings) {
115
+		return $this->create_or_update_reaction($settings, $id);
116 116
 	}
117 117
 
118 118
 	/**
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
 	 *         The reaction object if created/updated successfully. False or a
128 128
 	 *         validator instance if not.
129 129
 	 */
130
-	protected function create_or_update_reaction( array $settings, $id = null ) {
130
+	protected function create_or_update_reaction(array $settings, $id = null) {
131 131
 
132
-		$is_new = ! isset( $id );
132
+		$is_new = ! isset($id);
133 133
 
134
-		if ( ! $is_new && ! $this->reaction_exists( $id ) ) {
134
+		if ( ! $is_new && ! $this->reaction_exists($id)) {
135 135
 			return false;
136 136
 		}
137 137
 
138
-		$validator = new WordPoints_Hook_Reaction_Validator( $settings );
138
+		$validator = new WordPoints_Hook_Reaction_Validator($settings);
139 139
 		$settings = $validator->validate();
140 140
 
141
-		if ( $validator->had_errors() ) {
141
+		if ($validator->had_errors()) {
142 142
 			return $validator;
143 143
 		}
144 144
 
145
-		if ( $is_new ) {
145
+		if ($is_new) {
146 146
 
147
-			$id = $this->_create_reaction( $settings['event'] );
147
+			$id = $this->_create_reaction($settings['event']);
148 148
 
149
-			if ( ! $id ) {
149
+			if ( ! $id) {
150 150
 				return false;
151 151
 			}
152 152
 		}
153 153
 
154
-		$reaction = $this->get_reaction( $id );
154
+		$reaction = $this->get_reaction($id);
155 155
 
156
-		$reaction->update_event_slug( $settings['event'] );
156
+		$reaction->update_event_slug($settings['event']);
157 157
 
158
-		unset( $settings['event'] );
158
+		unset($settings['event']);
159 159
 
160
-		$reaction->update_meta( 'reactor', $settings['reactor'] );
160
+		$reaction->update_meta('reactor', $settings['reactor']);
161 161
 
162 162
 		/** @var WordPoints_Hook_ReactorI $reactor */
163
-		$reactor = wordpoints_hooks()->get_sub_app( 'reactors' )->get( $settings['reactor'] );
164
-		$reactor->update_settings( $reaction, $settings );
163
+		$reactor = wordpoints_hooks()->get_sub_app('reactors')->get($settings['reactor']);
164
+		$reactor->update_settings($reaction, $settings);
165 165
 
166 166
 		/** @var WordPoints_Hook_ExtensionI $extension */
167
-		foreach ( wordpoints_hooks()->get_sub_app( 'extensions' )->get_all() as $extension ) {
168
-			$extension->update_settings( $reaction, $settings );
167
+		foreach (wordpoints_hooks()->get_sub_app('extensions')->get_all() as $extension) {
168
+			$extension->update_settings($reaction, $settings);
169 169
 		}
170 170
 
171 171
 		/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		 * @param array                     $settings The new settings for the reaction.
176 176
 		 * @param bool                      $is_new   Whether the reaction was just now created.
177 177
 		 */
178
-		do_action( 'wordpoints_hook_reaction_save', $reaction, $settings, $is_new );
178
+		do_action('wordpoints_hook_reaction_save', $reaction, $settings, $is_new);
179 179
 
180 180
 		return $reaction;
181 181
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return int|false The reaction ID, or false if not created.
194 194
 	 */
195
-	abstract protected function _create_reaction( $event_slug );
195
+	abstract protected function _create_reaction($event_slug);
196 196
 }
197 197
 
198 198
 // EOF
Please login to merge, or discard this patch.
src/components/points/includes/class-un-installer.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -1073,6 +1073,7 @@
 block discarded – undo
1073 1073
 	 *
1074 1074
 	 * @since 2.1.4
1075 1075
 	 *
1076
+	 * @param string[] $post_types
1076 1077
 	 * @return array The slugs of the events.
1077 1078
 	 */
1078 1079
 	protected function _2_1_4_get_reversal_log_types( $post_types ) {
Please login to merge, or discard this patch.
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	 * @since 1.8.0
28 28
 	 */
29 29
 	protected $updates = array(
30
-		'1.2.0'  => array( 'single' => true, /*     -     */ 'network' => true ),
31
-		'1.4.0'  => array( 'single' => true, 'site' => true, 'network' => true ),
30
+		'1.2.0'  => array('single' => true, /*     -     */ 'network' => true),
31
+		'1.4.0'  => array('single' => true, 'site' => true, 'network' => true),
32 32
 		'1.5.0'  => array( /*      -      */ 'site' => true  /*      -      */ ),
33
-		'1.5.1'  => array( 'single' => true, /*     -     */ 'network' => true ),
33
+		'1.5.1'  => array('single' => true, /*     -     */ 'network' => true),
34 34
 		'1.8.0'  => array( /*      -      */ 'site' => true  /*      -      */ ),
35
-		'1.9.0'  => array( 'single' => true, 'site' => true, 'network' => true ),
36
-		'1.10.0' => array( 'single' => true, /*     -     */ 'network' => true ),
37
-		'2.0.0'  => array( 'single' => true, /*     -     */ 'network' => true ),
38
-		'2.1.0'  => array( 'single' => true, /*     -     */ 'network' => true ),
39
-		'2.1.4'  => array( 'single' => true, 'site' => true, /*      -      */ ),
35
+		'1.9.0'  => array('single' => true, 'site' => true, 'network' => true),
36
+		'1.10.0' => array('single' => true, /*     -     */ 'network' => true),
37
+		'2.0.0'  => array('single' => true, /*     -     */ 'network' => true),
38
+		'2.1.0'  => array('single' => true, /*     -     */ 'network' => true),
39
+		'2.1.4'  => array('single' => true, 'site' => true, /*      -      */),
40 40
 	);
41 41
 
42 42
 	/**
@@ -143,26 +143,26 @@  discard block
 block discarded – undo
143 143
 
144 144
 		parent::before_update();
145 145
 
146
-		if ( 1 === version_compare( '1.4.0', $this->updating_from ) ) {
147
-			add_filter( 'wordpoints_points_hook_update_callback', array( $this, '_1_4_0_clean_hook_settings' ), 10, 4 );
146
+		if (1 === version_compare('1.4.0', $this->updating_from)) {
147
+			add_filter('wordpoints_points_hook_update_callback', array($this, '_1_4_0_clean_hook_settings'), 10, 4);
148 148
 		}
149 149
 
150
-		if ( 1 === version_compare( '1.5.0', $this->updating_from ) ) {
150
+		if (1 === version_compare('1.5.0', $this->updating_from)) {
151 151
 
152
-			if ( ! $this->network_wide ) {
153
-				unset( $this->updates['1_5_0'] );
152
+			if ( ! $this->network_wide) {
153
+				unset($this->updates['1_5_0']);
154 154
 			}
155 155
 		}
156 156
 
157
-		if ( $this->network_wide ) {
158
-			unset( $this->updates['1_8_0'] );
157
+		if ($this->network_wide) {
158
+			unset($this->updates['1_8_0']);
159 159
 		}
160 160
 
161
-		if ( 1 === version_compare( '1.9.0', $this->updating_from ) ) {
161
+		if (1 === version_compare('1.9.0', $this->updating_from)) {
162 162
 
163 163
 			// If we're updating to 1.4.0, we initialize the hooks early, because
164 164
 			// we use them during the update.
165
-			remove_action( 'wordpoints_modules_loaded', array( 'WordPoints_Points_Hooks', 'initialize_hooks' ) );
165
+			remove_action('wordpoints_modules_loaded', array('WordPoints_Points_Hooks', 'initialize_hooks'));
166 166
 
167 167
 			WordPoints_Points_Hooks::register(
168 168
 				'WordPoints_Comment_Removed_Points_Hook'
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			// Default to network mode off during the tests, but save the current
178 178
 			// mode so we can restore it afterward.
179 179
 			$this->points_hooks_network_mode = WordPoints_Points_Hooks::get_network_mode();
180
-			WordPoints_Points_Hooks::set_network_mode( false );
180
+			WordPoints_Points_Hooks::set_network_mode(false);
181 181
 		}
182 182
 	}
183 183
 
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	protected function after_update() {
188 188
 
189
-		if ( isset( $this->points_hooks_network_mode ) ) {
189
+		if (isset($this->points_hooks_network_mode)) {
190 190
 
191
-			WordPoints_Points_Hooks::set_network_mode( $this->points_hooks_network_mode );
191
+			WordPoints_Points_Hooks::set_network_mode($this->points_hooks_network_mode);
192 192
 
193
-			remove_filter( 'wordpoints_points_hook_update_callback', array( $this, '_1_4_0_clean_hook_settings' ), 10 );
193
+			remove_filter('wordpoints_points_hook_update_callback', array($this, '_1_4_0_clean_hook_settings'), 10);
194 194
 		}
195 195
 	}
196 196
 
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 		 * Regenerate the custom caps every time on multisite, because they depend on
204 204
 		 * network activation status.
205 205
 		 */
206
-		if ( 'site' === $this->context ) {
207
-			wordpoints_remove_custom_caps( $this->custom_caps_keys );
206
+		if ('site' === $this->context) {
207
+			wordpoints_remove_custom_caps($this->custom_caps_keys);
208 208
 		}
209 209
 
210
-		wordpoints_add_custom_caps( $this->custom_caps );
210
+		wordpoints_add_custom_caps($this->custom_caps);
211 211
 	}
212 212
 
213 213
 	/**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 		parent::install_single();
239 239
 
240
-		add_option( 'wordpoints_default_points_type', '' );
240
+		add_option('wordpoints_default_points_type', '');
241 241
 
242 242
 		$this->disable_legacy_hooks();
243 243
 	}
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 			"
318 318
 		); // WPCS: cache pass.
319 319
 
320
-		if ( $log_ids && is_array( $log_ids ) ) {
320
+		if ($log_ids && is_array($log_ids)) {
321 321
 
322 322
 			$wpdb->query( // WPCS: unprepared SQL OK
323 323
 				"
324 324
 					DELETE
325 325
 					FROM {$wpdb->wordpoints_points_logs}
326
-					WHERE `id` IN (" . implode( ',', array_map( 'absint', $log_ids ) ) . ')
326
+					WHERE `id` IN (" . implode(',', array_map('absint', $log_ids)) . ')
327 327
 				'
328 328
 			); // WPCS: cache pass (points logs weren't cached until 1.5.0).
329 329
 
330
-			foreach ( $log_ids as $log_id ) {
331
-				wordpoints_points_log_delete_all_metadata( $log_id );
330
+			foreach ($log_ids as $log_id) {
331
+				wordpoints_points_log_delete_all_metadata($log_id);
332 332
 			}
333 333
 		}
334 334
 	}
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
 			"
354 354
 		); // WPCS: cache pass.
355 355
 
356
-		$hook = WordPoints_Points_Hooks::get_handler_by_id_base( 'wordpoints_post_points_hook' );
356
+		$hook = WordPoints_Points_Hooks::get_handler_by_id_base('wordpoints_post_points_hook');
357 357
 
358
-		if ( $post_ids && is_array( $post_ids ) && $hook ) {
359
-			foreach ( $post_ids as $post_id ) {
360
-				$hook->clean_logs_on_post_deletion( $post_id );
358
+		if ($post_ids && is_array($post_ids) && $hook) {
359
+			foreach ($post_ids as $post_id) {
360
+				$hook->clean_logs_on_post_deletion($post_id);
361 361
 			}
362 362
 		}
363 363
 	}
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
 			"
383 383
 		); // WPCS: cache pass.
384 384
 
385
-		$hook = WordPoints_Points_Hooks::get_handler_by_id_base( 'wordpoints_comment_points_hook' );
385
+		$hook = WordPoints_Points_Hooks::get_handler_by_id_base('wordpoints_comment_points_hook');
386 386
 
387
-		if ( $comment_ids && is_array( $comment_ids ) && $hook ) {
388
-			foreach ( $comment_ids as $comment_id ) {
389
-				$hook->clean_logs_on_comment_deletion( $comment_id );
387
+		if ($comment_ids && is_array($comment_ids) && $hook) {
388
+			foreach ($comment_ids as $comment_id) {
389
+				$hook->clean_logs_on_comment_deletion($comment_id);
390 390
 			}
391 391
 		}
392 392
 	}
@@ -398,14 +398,14 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	protected function update_network_to_1_4_0() {
400 400
 
401
-		if ( $this->network_wide ) {
401
+		if ($this->network_wide) {
402 402
 
403 403
 			// Split the network-wide points hooks.
404 404
 			$network_mode = WordPoints_Points_Hooks::get_network_mode();
405
-			WordPoints_Points_Hooks::set_network_mode( true );
405
+			WordPoints_Points_Hooks::set_network_mode(true);
406 406
 			$this->_1_4_0_split_post_hooks();
407 407
 			$this->_1_4_0_split_comment_hooks();
408
-			WordPoints_Points_Hooks::set_network_mode( $network_mode );
408
+			WordPoints_Points_Hooks::set_network_mode($network_mode);
409 409
 		}
410 410
 	}
411 411
 
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 	 * @param string $key       The settings key for the hook that holds the points.
472 472
 	 * @param string $split_key The settings key for points that is being split.
473 473
 	 */
474
-	protected function _1_4_0_split_points_hooks( $hook, $new_hook, $key, $split_key ) {
474
+	protected function _1_4_0_split_points_hooks($hook, $new_hook, $key, $split_key) {
475 475
 
476
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
476
+		if (WordPoints_Points_Hooks::get_network_mode()) {
477 477
 			$hook_type = 'network';
478 478
 			$network_ = 'network_';
479 479
 		} else {
@@ -481,58 +481,58 @@  discard block
 block discarded – undo
481 481
 			$network_ = '';
482 482
 		}
483 483
 
484
-		$new_hook = WordPoints_Points_Hooks::get_handler_by_id_base( $new_hook );
485
-		$hook = WordPoints_Points_Hooks::get_handler_by_id_base( $hook );
484
+		$new_hook = WordPoints_Points_Hooks::get_handler_by_id_base($new_hook);
485
+		$hook = WordPoints_Points_Hooks::get_handler_by_id_base($hook);
486 486
 
487 487
 		$points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
488
-		$instances = $hook->get_instances( $hook_type );
488
+		$instances = $hook->get_instances($hook_type);
489 489
 
490 490
 		// Loop through all of the post hook instances.
491
-		foreach ( $instances as $number => $settings ) {
491
+		foreach ($instances as $number => $settings) {
492 492
 
493 493
 			// Don't split the hook if it is just a placeholder, or it's already split.
494
-			if ( 0 === (int) $number || ! isset( $settings[ $key ], $settings[ $split_key ] ) ) {
494
+			if (0 === (int) $number || ! isset($settings[$key], $settings[$split_key])) {
495 495
 				continue;
496 496
 			}
497 497
 
498
-			if ( ! isset( $settings['post_type'] ) ) {
498
+			if ( ! isset($settings['post_type'])) {
499 499
 				$settings['post_type'] = 'ALL';
500 500
 			}
501 501
 
502 502
 			// If the trash points are set, create a post delete points hook instead.
503
-			if ( isset( $settings[ $split_key ] ) && wordpoints_posint( $settings[ $split_key ] ) ) {
503
+			if (isset($settings[$split_key]) && wordpoints_posint($settings[$split_key])) {
504 504
 
505 505
 				$new_hook->update_callback(
506 506
 					array(
507
-						'points'    => $settings[ $split_key ],
507
+						'points'    => $settings[$split_key],
508 508
 						'post_type' => $settings['post_type'],
509 509
 					)
510 510
 					, $new_hook->next_hook_id_number()
511 511
 				);
512 512
 
513 513
 				// Make sure the correct points type is retrieved for network hooks.
514
-				$points_type = $hook->points_type( $network_ . $number );
514
+				$points_type = $hook->points_type($network_ . $number);
515 515
 
516 516
 				// Add this instance to the points-types-hooks list.
517
-				$points_types_hooks[ $points_type ][] = $new_hook->get_id( $number );
517
+				$points_types_hooks[$points_type][] = $new_hook->get_id($number);
518 518
 			}
519 519
 
520 520
 			// If the publish points are set, update the settings of the hook.
521
-			if ( isset( $settings[ $key ] ) && wordpoints_posint( $settings[ $key ] ) ) {
521
+			if (isset($settings[$key]) && wordpoints_posint($settings[$key])) {
522 522
 
523
-				$settings['points'] = $settings[ $key ];
523
+				$settings['points'] = $settings[$key];
524 524
 
525
-				$hook->update_callback( $settings, $number );
525
+				$hook->update_callback($settings, $number);
526 526
 
527 527
 			} else {
528 528
 
529 529
 				// If not, delete this instance.
530
-				$hook->delete_callback( $hook->get_id( $number ) );
530
+				$hook->delete_callback($hook->get_id($number));
531 531
 			}
532 532
 
533 533
 		} // End foreach ( $instances ).
534 534
 
535
-		WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
535
+		WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
536 536
 	}
537 537
 
538 538
 	/**
@@ -551,12 +551,12 @@  discard block
 block discarded – undo
551 551
 	 *
552 552
 	 * @return array The filtered instance settings.
553 553
 	 */
554
-	public function _1_4_0_clean_hook_settings( $instance, $new_instance, $old_instance, $hook ) {
554
+	public function _1_4_0_clean_hook_settings($instance, $new_instance, $old_instance, $hook) {
555 555
 
556
-		if ( $hook instanceof WordPoints_Post_Points_Hook ) {
557
-			unset( $instance['trash'], $instance['publish'] );
558
-		} elseif ( $hook instanceof WordPoints_Comment_Points_Hook ) {
559
-			unset( $instance['approve'], $instance['disapprove'] );
556
+		if ($hook instanceof WordPoints_Post_Points_Hook) {
557
+			unset($instance['trash'], $instance['publish']);
558
+		} elseif ($hook instanceof WordPoints_Comment_Points_Hook) {
559
+			unset($instance['approve'], $instance['disapprove']);
560 560
 		}
561 561
 
562 562
 		return $instance;
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
 			"
586 586
 		); // WPCS: cache pass.
587 587
 
588
-		$hook = WordPoints_Points_Hooks::get_handler_by_id_base( 'wordpoints_comment_points_hook' );
588
+		$hook = WordPoints_Points_Hooks::get_handler_by_id_base('wordpoints_comment_points_hook');
589 589
 
590
-		if ( $post_ids && is_array( $post_ids ) && $hook ) {
591
-			foreach ( $post_ids as $post_id ) {
592
-				$hook->clean_logs_on_post_deletion( $post_id );
590
+		if ($post_ids && is_array($post_ids) && $hook) {
591
+			foreach ($post_ids as $post_id) {
592
+				$hook->clean_logs_on_post_deletion($post_id);
593 593
 			}
594 594
 		}
595 595
 	}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	 */
605 605
 	protected function update_site_to_1_5_0() {
606 606
 
607
-		wordpoints_add_custom_caps( $this->custom_caps );
607
+		wordpoints_add_custom_caps($this->custom_caps);
608 608
 	}
609 609
 
610 610
 	/**
@@ -616,18 +616,18 @@  discard block
 block discarded – undo
616 616
 
617 617
 		global $wpdb;
618 618
 
619
-		if ( empty( $wpdb->charset ) ) {
619
+		if (empty($wpdb->charset)) {
620 620
 			return;
621 621
 		}
622 622
 
623 623
 		$charset_collate = " CHARACTER SET {$wpdb->charset}";
624 624
 
625
-		if ( ! empty( $wpdb->collate ) ) {
625
+		if ( ! empty($wpdb->collate)) {
626 626
 			$charset_collate .= " COLLATE {$wpdb->collate}";
627 627
 		}
628 628
 
629
-		$wpdb->query( "ALTER TABLE {$wpdb->wordpoints_points_logs} CONVERT TO {$charset_collate}" ); // WPCS: unprepared SQL, cache pass.
630
-		$wpdb->query( "ALTER TABLE {$wpdb->wordpoints_points_log_meta} CONVERT TO {$charset_collate}" ); // WPCS: unprepared SQL, cache pass.
629
+		$wpdb->query("ALTER TABLE {$wpdb->wordpoints_points_logs} CONVERT TO {$charset_collate}"); // WPCS: unprepared SQL, cache pass.
630
+		$wpdb->query("ALTER TABLE {$wpdb->wordpoints_points_log_meta} CONVERT TO {$charset_collate}"); // WPCS: unprepared SQL, cache pass.
631 631
 	}
632 632
 
633 633
 	/**
@@ -655,14 +655,14 @@  discard block
 block discarded – undo
655 655
 	 */
656 656
 	protected function update_network_to_1_9_0() {
657 657
 
658
-		if ( $this->network_wide ) {
658
+		if ($this->network_wide) {
659 659
 
660 660
 			// Combine the network-wide points hooks.
661 661
 			$network_mode = WordPoints_Points_Hooks::get_network_mode();
662
-			WordPoints_Points_Hooks::set_network_mode( true );
663
-			$this->_1_9_0_combine_hooks( 'comment', 'comment_removed' );
664
-			$this->_1_9_0_combine_hooks( 'post', 'post_delete' );
665
-			WordPoints_Points_Hooks::set_network_mode( $network_mode );
662
+			WordPoints_Points_Hooks::set_network_mode(true);
663
+			$this->_1_9_0_combine_hooks('comment', 'comment_removed');
664
+			$this->_1_9_0_combine_hooks('post', 'post_delete');
665
+			WordPoints_Points_Hooks::set_network_mode($network_mode);
666 666
 		}
667 667
 	}
668 668
 
@@ -672,8 +672,8 @@  discard block
 block discarded – undo
672 672
 	 * @since 1.9.0
673 673
 	 */
674 674
 	protected function update_site_to_1_9_0() {
675
-		$this->_1_9_0_combine_hooks( 'comment', 'comment_removed' );
676
-		$this->_1_9_0_combine_hooks( 'post', 'post_delete' );
675
+		$this->_1_9_0_combine_hooks('comment', 'comment_removed');
676
+		$this->_1_9_0_combine_hooks('post', 'post_delete');
677 677
 	}
678 678
 
679 679
 	/**
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	 * @since 1.9.0
683 683
 	 */
684 684
 	protected function update_single_to_1_9_0() {
685
-		$this->_1_9_0_combine_hooks( 'comment', 'comment_removed' );
686
-		$this->_1_9_0_combine_hooks( 'post', 'post_delete' );
685
+		$this->_1_9_0_combine_hooks('comment', 'comment_removed');
686
+		$this->_1_9_0_combine_hooks('post', 'post_delete');
687 687
 	}
688 688
 
689 689
 	/**
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	 * @param string $type         The primary hook type that awards the points.
695 695
 	 * @param string $reverse_type The counterpart hook type that reverses points.
696 696
 	 */
697
-	protected function _1_9_0_combine_hooks( $type, $reverse_type ) {
697
+	protected function _1_9_0_combine_hooks($type, $reverse_type) {
698 698
 
699 699
 		$hook = WordPoints_Points_Hooks::get_handler_by_id_base(
700 700
 			"wordpoints_{$type}_points_hook"
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 			"wordpoints_{$reverse_type}_points_hook"
704 704
 		);
705 705
 
706
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
706
+		if (WordPoints_Points_Hooks::get_network_mode()) {
707 707
 			$hook_type = 'network';
708 708
 			$network_ = 'network_';
709 709
 		} else {
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
 			$network_ = '';
712 712
 		}
713 713
 
714
-		$hook_instances = $hook->get_instances( $hook_type );
715
-		$hook_reverse_instances = $reverse_hook->get_instances( $hook_type );
714
+		$hook_instances = $hook->get_instances($hook_type);
715
+		$hook_reverse_instances = $reverse_hook->get_instances($hook_type);
716 716
 
717
-		$default_points = ( 'post' === $hook_type ) ? 20 : 10;
718
-		$defaults = array( 'points' => $default_points, 'post_type' => 'ALL' );
717
+		$default_points = ('post' === $hook_type) ? 20 : 10;
718
+		$defaults = array('points' => $default_points, 'post_type' => 'ALL');
719 719
 
720 720
 		// Get the hooks into an array that is indexed by post type and the
721 721
 		// number of points. This allows us to easily check for any counterparts when
@@ -723,53 +723,53 @@  discard block
 block discarded – undo
723 723
 		// is doing something crazy like multiple hooks for the same post type.
724 724
 		$hook_instances_indexed = array();
725 725
 
726
-		foreach ( $hook_instances as $number => $instance ) {
726
+		foreach ($hook_instances as $number => $instance) {
727 727
 
728
-			$instance = array_merge( $defaults, $instance );
728
+			$instance = array_merge($defaults, $instance);
729 729
 
730 730
 			$hook_instances_indexed
731
-				[ $hook->points_type( $network_ . $number ) ]
732
-				[ $instance['post_type'] ]
733
-				[ $instance['points'] ]
731
+				[$hook->points_type($network_ . $number)]
732
+				[$instance['post_type']]
733
+				[$instance['points']]
734 734
 				[] = $number;
735 735
 		}
736 736
 
737
-		foreach ( $hook_reverse_instances as $number => $instance ) {
737
+		foreach ($hook_reverse_instances as $number => $instance) {
738 738
 
739
-			$instance = array_merge( $defaults, $instance );
739
+			$instance = array_merge($defaults, $instance);
740 740
 
741
-			$points_type = $reverse_hook->points_type( $network_ . $number );
741
+			$points_type = $reverse_hook->points_type($network_ . $number);
742 742
 
743 743
 			// We use empty() instead of isset() because array_pop() below may leave
744 744
 			// us with an empty array as the value.
745
-			if ( empty( $hook_instances_indexed[ $points_type ][ $instance['post_type'] ][ $instance['points'] ] ) ) {
745
+			if (empty($hook_instances_indexed[$points_type][$instance['post_type']][$instance['points']])) {
746 746
 				continue;
747 747
 			}
748 748
 
749 749
 			$comment_instance_number = array_pop(
750
-				$hook_instances_indexed[ $points_type ][ $instance['post_type'] ][ $instance['points'] ]
750
+				$hook_instances_indexed[$points_type][$instance['post_type']][$instance['points']]
751 751
 			);
752 752
 
753 753
 			// We need to unset this instance from the list of hook instances. It
754 754
 			// is expected for it to be automatically reversed, and that is the
755 755
 			// default setting. If we don't unset it here it will get auto-reversal
756 756
 			// turned off below, which isn't what we want.
757
-			unset( $hook_instances[ $comment_instance_number ] );
757
+			unset($hook_instances[$comment_instance_number]);
758 758
 
759 759
 			// Now we can just delete this reverse hook instance.
760 760
 			$reverse_hook->delete_callback(
761
-				$reverse_hook->get_id( $number )
761
+				$reverse_hook->get_id($number)
762 762
 			);
763 763
 		}
764 764
 
765 765
 		// Any hooks left in the array are not paired with a reverse type hook, and
766 766
 		// aren't expected to auto-reverse, so we need to turn their auto-reversal
767 767
 		// setting off.
768
-		if ( ! empty( $hook_instances ) ) {
768
+		if ( ! empty($hook_instances)) {
769 769
 
770
-			foreach ( $hook_instances as $number => $instance ) {
770
+			foreach ($hook_instances as $number => $instance) {
771 771
 				$instance['auto_reverse'] = 0;
772
-				$hook->update_callback( $instance, $number );
772
+				$hook->update_callback($instance, $number);
773 773
 			}
774 774
 
775 775
 			// We add a flag to the database so we'll know to enable legacy features.
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 		// Now we check if there are any unpaired reverse type hooks. If there are
783 783
 		// we'll set this flag in the database that will keep some legacy features
784 784
 		// enabled.
785
-		if ( $reverse_hook->get_instances( $hook_type ) ) {
785
+		if ($reverse_hook->get_instances($hook_type)) {
786 786
 			update_site_option(
787 787
 				"wordpoints_{$reverse_type}_hook_legacy"
788 788
 				, true
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	 * @since 1.10.0
797 797
 	 */
798 798
 	protected function update_network_to_1_10_0() {
799
-		$this->_1_10_0_delete_post_title_points_log_meta( true );
799
+		$this->_1_10_0_delete_post_title_points_log_meta(true);
800 800
 	}
801 801
 
802 802
 	/**
@@ -816,28 +816,28 @@  discard block
 block discarded – undo
816 816
 	 * @param bool $network_wide Whether to delete all of the metadata for the whole
817 817
 	 *                           network, or just the current site (default).
818 818
 	 */
819
-	protected function _1_10_0_delete_post_title_points_log_meta( $network_wide = false ) {
819
+	protected function _1_10_0_delete_post_title_points_log_meta($network_wide = false) {
820 820
 
821 821
 		$query_args = array(
822 822
 			'log_type'   => 'post_delete',
823 823
 			'meta_query' => array(
824
-				array( 'key' => 'post_title', 'compare' => 'EXISTS' ),
824
+				array('key' => 'post_title', 'compare' => 'EXISTS'),
825 825
 			),
826 826
 		);
827 827
 
828
-		if ( $network_wide ) {
828
+		if ($network_wide) {
829 829
 			$query_args['blog_id'] = false;
830 830
 		}
831 831
 
832
-		$query = new WordPoints_Points_Logs_Query( $query_args );
832
+		$query = new WordPoints_Points_Logs_Query($query_args);
833 833
 
834 834
 		$logs = $query->get();
835 835
 
836
-		foreach ( $logs as $log ) {
837
-			wordpoints_delete_points_log_meta( $log->id, 'post_title' );
836
+		foreach ($logs as $log) {
837
+			wordpoints_delete_points_log_meta($log->id, 'post_title');
838 838
 		}
839 839
 
840
-		wordpoints_regenerate_points_logs( $logs );
840
+		wordpoints_regenerate_points_logs($logs);
841 841
 	}
842 842
 
843 843
 	/**
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 			"
876 876
 		); // WPCS: cache pass.
877 877
 
878
-		$this->maybe_update_tables_to_utf8mb4( 'global' );
878
+		$this->maybe_update_tables_to_utf8mb4('global');
879 879
 	}
880 880
 
881 881
 	/**
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 * @since 2.1.0
894 894
 	 */
895 895
 	protected function update_network_to_2_1_0() {
896
-		add_site_option( 'wordpoints_disabled_points_hooks_edit_points_types', true );
896
+		add_site_option('wordpoints_disabled_points_hooks_edit_points_types', true);
897 897
 	}
898 898
 
899 899
 	/**
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 	 * @since 2.1.0
903 903
 	 */
904 904
 	protected function update_single_to_2_1_0() {
905
-		add_option( 'wordpoints_disabled_points_hooks_edit_points_types', true );
905
+		add_option('wordpoints_disabled_points_hooks_edit_points_types', true);
906 906
 	}
907 907
 
908 908
 	/**
@@ -922,44 +922,44 @@  discard block
 block discarded – undo
922 922
 	protected function update_single_to_2_1_4() {
923 923
 
924 924
 		$post_types = $this->_2_1_4_get_post_types();
925
-		$reversal_log_types = $this->_2_1_4_get_reversal_log_types( $post_types );
925
+		$reversal_log_types = $this->_2_1_4_get_reversal_log_types($post_types);
926 926
 		$hits = $this->_2_1_4_get_hits_with_multiple_logs();
927 927
 
928 928
 		$logs_to_delete = array();
929 929
 
930
-		foreach ( $hits as $hit ) {
930
+		foreach ($hits as $hit) {
931 931
 
932
-			$log_ids = explode( ',', $hit->log_ids );
932
+			$log_ids = explode(',', $hit->log_ids);
933 933
 
934 934
 			// If there weren't exactly two of them, we don't know what to do.
935
-			if ( count( $log_ids ) !== 2 ) {
935
+			if (count($log_ids) !== 2) {
936 936
 				continue;
937 937
 			}
938 938
 
939 939
 			$query = new WordPoints_Points_Logs_Query(
940 940
 				array(
941 941
 					'id__in'       => $log_ids,
942
-					'log_type__in' => array_keys( $reversal_log_types ),
942
+					'log_type__in' => array_keys($reversal_log_types),
943 943
 				)
944 944
 			);
945 945
 
946 946
 			// And if they aren't both the correct types, we don't know what to do.
947
-			if ( $query->count() !== 2 ) {
947
+			if ($query->count() !== 2) {
948 948
 				continue;
949 949
 			}
950 950
 
951
-			$original_log_ids = $this->_2_1_4_get_original_log_ids( $log_ids );
951
+			$original_log_ids = $this->_2_1_4_get_original_log_ids($log_ids);
952 952
 
953
-			$post_publish_log_id = min( array_keys( $original_log_ids ) );
954
-			$post_update_log_id = max( array_keys( $original_log_ids ) );
955
-			$post_publish_reverse_log_id = $original_log_ids[ $post_publish_log_id ];
956
-			$post_update_reverse_log_id = $original_log_ids[ $post_update_log_id ];
953
+			$post_publish_log_id = min(array_keys($original_log_ids));
954
+			$post_update_log_id = max(array_keys($original_log_ids));
955
+			$post_publish_reverse_log_id = $original_log_ids[$post_publish_log_id];
956
+			$post_update_reverse_log_id = $original_log_ids[$post_update_log_id];
957 957
 
958 958
 			$query = new WordPoints_Points_Logs_Query(
959
-				array( 'id__in' => array( $post_publish_reverse_log_id ) )
959
+				array('id__in' => array($post_publish_reverse_log_id))
960 960
 			);
961 961
 
962
-			$post_publish_reverse_log = $query->get( 'row' );
962
+			$post_publish_reverse_log = $query->get('row');
963 963
 
964 964
 			$post_type = str_replace(
965 965
 				'reverse-post_publish\\'
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 				, true
980 980
 			);
981 981
 
982
-			if ( $post_id !== $post_id_2 ) {
982
+			if ($post_id !== $post_id_2) {
983 983
 				continue;
984 984
 			}
985 985
 
@@ -988,9 +988,9 @@  discard block
 block discarded – undo
988 988
 			$logs_to_delete[] = $post_update_log_id;
989 989
 
990 990
 			// Give the user their points back, as they were removed in error.
991
-			$this->_2_1_4_revert_log( $post_publish_reverse_log );
991
+			$this->_2_1_4_revert_log($post_publish_reverse_log);
992 992
 
993
-			$this->_2_1_4_mark_unreversed( $post_publish_log_id );
993
+			$this->_2_1_4_mark_unreversed($post_publish_log_id);
994 994
 
995 995
 			// Now clean up any later updates.
996 996
 			$logs_to_delete = $this->_2_1_4_clean_other_logs(
@@ -1002,43 +1002,43 @@  discard block
 block discarded – undo
1002 1002
 		} // End foreach ( $hits ).
1003 1003
 
1004 1004
 		// Now the legacy logs.
1005
-		$legacy_logs = $this->_2_1_4_get_legacy_reactor_logs( $post_types );
1005
+		$legacy_logs = $this->_2_1_4_get_legacy_reactor_logs($post_types);
1006 1006
 		$post_ids = $this->_2_1_4_get_legacy_points_hook_post_ids();
1007 1007
 
1008
-		foreach ( $post_ids as $post_id ) {
1008
+		foreach ($post_ids as $post_id) {
1009 1009
 
1010
-			if ( ! isset( $legacy_logs[ $post_id ] ) ) {
1010
+			if ( ! isset($legacy_logs[$post_id])) {
1011 1011
 				continue;
1012 1012
 			}
1013 1013
 
1014
-			array_map( array( $this, '_2_1_4_revert_log' ), $legacy_logs[ $post_id ] );
1014
+			array_map(array($this, '_2_1_4_revert_log'), $legacy_logs[$post_id]);
1015 1015
 
1016 1016
 			$logs_to_delete = array_merge(
1017 1017
 				$logs_to_delete
1018
-				, wp_list_pluck( $legacy_logs[ $post_id ], 'id' )
1018
+				, wp_list_pluck($legacy_logs[$post_id], 'id')
1019 1019
 			);
1020 1020
 
1021
-			unset( $legacy_logs[ $post_id ] );
1021
+			unset($legacy_logs[$post_id]);
1022 1022
 		}
1023 1023
 
1024
-		foreach ( $legacy_logs as $logs ) {
1025
-			if ( count( $logs ) > 1 ) {
1024
+		foreach ($legacy_logs as $logs) {
1025
+			if (count($logs) > 1) {
1026 1026
 
1027 1027
 				// The first one is the original, so keep it.
1028
-				unset( $logs[0] );
1028
+				unset($logs[0]);
1029 1029
 
1030
-				array_map( array( $this, '_2_1_4_revert_log' ), $logs );
1030
+				array_map(array($this, '_2_1_4_revert_log'), $logs);
1031 1031
 
1032 1032
 				$logs_to_delete = array_merge(
1033 1033
 					$logs_to_delete
1034
-					, wp_list_pluck( $logs, 'id' )
1034
+					, wp_list_pluck($logs, 'id')
1035 1035
 				);
1036 1036
 			}
1037 1037
 		}
1038 1038
 
1039 1039
 		// Now delete the logs.
1040
-		if ( $logs_to_delete ) {
1041
-			$this->_2_1_4_delete_logs( $logs_to_delete );
1040
+		if ($logs_to_delete) {
1041
+			$this->_2_1_4_delete_logs($logs_to_delete);
1042 1042
 		}
1043 1043
 	}
1044 1044
 
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	 */
1052 1052
 	protected function _2_1_4_get_post_types() {
1053 1053
 
1054
-		$post_types = get_post_types( array( 'public' => true ) );
1054
+		$post_types = get_post_types(array('public' => true));
1055 1055
 
1056 1056
 		/**
1057 1057
 		 * Filter which post types to register hook events for.
@@ -1075,12 +1075,12 @@  discard block
 block discarded – undo
1075 1075
 	 *
1076 1076
 	 * @return array The slugs of the events.
1077 1077
 	 */
1078
-	protected function _2_1_4_get_reversal_log_types( $post_types ) {
1078
+	protected function _2_1_4_get_reversal_log_types($post_types) {
1079 1079
 
1080 1080
 		$event_slugs = array();
1081 1081
 
1082
-		foreach ( $post_types as $slug ) {
1083
-			$event_slugs[ "reverse-post_publish\\{$slug}" ] = true;
1082
+		foreach ($post_types as $slug) {
1083
+			$event_slugs["reverse-post_publish\\{$slug}"] = true;
1084 1084
 		}
1085 1085
 
1086 1086
 		return $event_slugs;
@@ -1124,11 +1124,11 @@  discard block
 block discarded – undo
1124 1124
 	 *
1125 1125
 	 * @return array The IDs of the original logs.
1126 1126
 	 */
1127
-	protected function _2_1_4_get_original_log_ids( $log_ids ) {
1127
+	protected function _2_1_4_get_original_log_ids($log_ids) {
1128 1128
 
1129 1129
 		$original_log_ids = array();
1130 1130
 
1131
-		foreach ( $log_ids as $log_id ) {
1131
+		foreach ($log_ids as $log_id) {
1132 1132
 
1133 1133
 			$original_log_id = wordpoints_get_points_log_meta(
1134 1134
 				$log_id
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 				, true
1137 1137
 			);
1138 1138
 
1139
-			$original_log_ids[ $original_log_id ] = $log_id;
1139
+			$original_log_ids[$original_log_id] = $log_id;
1140 1140
 		}
1141 1141
 
1142 1142
 		return $original_log_ids;
@@ -1151,13 +1151,13 @@  discard block
 block discarded – undo
1151 1151
 	 *
1152 1152
 	 * @param int[] $log_ids The IDs of the logs to delete.
1153 1153
 	 */
1154
-	protected function _2_1_4_delete_logs( $log_ids ) {
1154
+	protected function _2_1_4_delete_logs($log_ids) {
1155 1155
 
1156 1156
 		$hits_to_delete = array();
1157 1157
 
1158 1158
 		global $wpdb;
1159 1159
 
1160
-		foreach ( $log_ids as $log_id ) {
1160
+		foreach ($log_ids as $log_id) {
1161 1161
 
1162 1162
 			$hit_id = wordpoints_get_points_log_meta(
1163 1163
 				$log_id
@@ -1165,26 +1165,26 @@  discard block
 block discarded – undo
1165 1165
 				, true
1166 1166
 			);
1167 1167
 
1168
-			if ( $hit_id ) {
1168
+			if ($hit_id) {
1169 1169
 				$hits_to_delete[] = $hit_id;
1170 1170
 			}
1171 1171
 
1172
-			wordpoints_points_log_delete_all_metadata( $log_id );
1172
+			wordpoints_points_log_delete_all_metadata($log_id);
1173 1173
 		}
1174 1174
 
1175 1175
 		$wpdb->query( // WPCS: unprepared SQL OK.
1176 1176
 			"
1177 1177
 				DELETE
1178 1178
 				FROM `{$wpdb->wordpoints_points_logs}`
1179
-				WHERE `id` IN (" . wordpoints_prepare__in( $log_ids, '%d' ) . ')
1179
+				WHERE `id` IN (" . wordpoints_prepare__in($log_ids, '%d') . ')
1180 1180
 			'
1181 1181
 		);
1182 1182
 
1183 1183
 		wordpoints_flush_points_logs_caches();
1184 1184
 
1185 1185
 		// Now delete the hits.
1186
-		if ( $hits_to_delete ) {
1187
-			$this->_2_1_4_delete_hits( $hits_to_delete );
1186
+		if ($hits_to_delete) {
1187
+			$this->_2_1_4_delete_hits($hits_to_delete);
1188 1188
 		}
1189 1189
 	}
1190 1190
 
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
 	 *
1196 1196
 	 * @param int[] $hit_ids The IDs of the hits to delete.
1197 1197
 	 */
1198
-	protected function _2_1_4_delete_hits( $hit_ids ) {
1198
+	protected function _2_1_4_delete_hits($hit_ids) {
1199 1199
 
1200 1200
 		global $wpdb;
1201 1201
 
1202
-		foreach ( $hit_ids as $hit_id ) {
1202
+		foreach ($hit_ids as $hit_id) {
1203 1203
 
1204 1204
 			$hit_ids[] = get_metadata(
1205 1205
 				'wordpoints_hook_hit'
@@ -1208,14 +1208,14 @@  discard block
 block discarded – undo
1208 1208
 				, true
1209 1209
 			);
1210 1210
 
1211
-			delete_metadata( 'wordpoints_hook_hit', $hit_id, '', '', true );
1211
+			delete_metadata('wordpoints_hook_hit', $hit_id, '', '', true);
1212 1212
 		}
1213 1213
 
1214 1214
 		$wpdb->query( // WPCS: unprepared SQL OK.
1215 1215
 			"
1216 1216
 				DELETE
1217 1217
 				FROM `{$wpdb->wordpoints_hook_hits}`
1218
-				WHERE `id` IN (" . wordpoints_prepare__in( $hit_ids, '%d' ) . ')
1218
+				WHERE `id` IN (" . wordpoints_prepare__in($hit_ids, '%d') . ')
1219 1219
 			'
1220 1220
 		); // WPCS: cache OK.
1221 1221
 	}
@@ -1231,14 +1231,14 @@  discard block
 block discarded – undo
1231 1231
 	 *
1232 1232
 	 * @return int[] The list of logs to be deleted.
1233 1233
 	 */
1234
-	protected function _2_1_4_clean_other_logs( $post_id, $post_type, $logs_to_delete ) {
1234
+	protected function _2_1_4_clean_other_logs($post_id, $post_type, $logs_to_delete) {
1235 1235
 
1236 1236
 		$query = new WordPoints_Points_Logs_Query(
1237 1237
 			array(
1238 1238
 				'order'        => 'ASC',
1239 1239
 				'order_by'      => 'id',
1240 1240
 				'id__not_in'   => $logs_to_delete,
1241
-				'log_type__in' => array( 'post_publish\\' . $post_type ),
1241
+				'log_type__in' => array('post_publish\\' . $post_type),
1242 1242
 				'meta_query'   => array(
1243 1243
 					array(
1244 1244
 						'key'   => 'post\\' . $post_type,
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 				'meta_query' => array(
1258 1258
 					array(
1259 1259
 						'key'     => 'original_log_id',
1260
-						'value'   => wp_list_pluck( $other_logs, 'id' ),
1260
+						'value'   => wp_list_pluck($other_logs, 'id'),
1261 1261
 						'compare' => 'IN',
1262 1262
 					),
1263 1263
 				),
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 
1267 1267
 		$reversal_logs = array();
1268 1268
 
1269
-		foreach ( $query->get() as $log ) {
1269
+		foreach ($query->get() as $log) {
1270 1270
 
1271 1271
 			$original_log_id = wordpoints_get_points_log_meta(
1272 1272
 				$log->id
@@ -1274,20 +1274,20 @@  discard block
 block discarded – undo
1274 1274
 				, true
1275 1275
 			);
1276 1276
 
1277
-			$reversal_logs[ $original_log_id ] = $log;
1277
+			$reversal_logs[$original_log_id] = $log;
1278 1278
 		}
1279 1279
 
1280
-		foreach ( $other_logs as $index => $log ) {
1280
+		foreach ($other_logs as $index => $log) {
1281 1281
 
1282 1282
 			// If this is a log that was reversed within less than a second or so
1283 1283
 			// of its occurrence, it is almost certainly the result of another
1284 1284
 			// update, and it is just cluttering things up.
1285 1285
 			if (
1286
-				isset( $reversal_logs[ $log->id ] )
1287
-				&& strtotime( $reversal_logs[ $log->id ]->date ) - strtotime( $log->date ) < 2
1286
+				isset($reversal_logs[$log->id])
1287
+				&& strtotime($reversal_logs[$log->id]->date) - strtotime($log->date) < 2
1288 1288
 			) {
1289 1289
 				$logs_to_delete[] = $log->id;
1290
-				$logs_to_delete[] = $reversal_logs[ $log->id ]->id;
1290
+				$logs_to_delete[] = $reversal_logs[$log->id]->id;
1291 1291
 			}
1292 1292
 		}
1293 1293
 
@@ -1301,9 +1301,9 @@  discard block
 block discarded – undo
1301 1301
 	 *
1302 1302
 	 * @param object $log The points log object.
1303 1303
 	 */
1304
-	protected function _2_1_4_revert_log( $log ) {
1304
+	protected function _2_1_4_revert_log($log) {
1305 1305
 
1306
-		add_filter( 'wordpoints_points_log', '__return_false' );
1306
+		add_filter('wordpoints_points_log', '__return_false');
1307 1307
 
1308 1308
 		wordpoints_alter_points(
1309 1309
 			$log->user_id
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 			, $log->log_type
1313 1313
 		);
1314 1314
 
1315
-		remove_filter( 'wordpoints_points_log', '__return_false' );
1315
+		remove_filter('wordpoints_points_log', '__return_false');
1316 1316
 	}
1317 1317
 
1318 1318
 	/**
@@ -1322,13 +1322,13 @@  discard block
 block discarded – undo
1322 1322
 	 *
1323 1323
 	 * @param int $log_id The ID of the log to mark as unreversed.
1324 1324
 	 */
1325
-	protected function _2_1_4_mark_unreversed( $log_id ) {
1325
+	protected function _2_1_4_mark_unreversed($log_id) {
1326 1326
 
1327
-		wordpoints_delete_points_log_meta( $log_id, 'auto_reversed' );
1327
+		wordpoints_delete_points_log_meta($log_id, 'auto_reversed');
1328 1328
 
1329
-		$hit_id = wordpoints_get_points_log_meta( $log_id, 'hook_hit_id', true );
1329
+		$hit_id = wordpoints_get_points_log_meta($log_id, 'hook_hit_id', true);
1330 1330
 
1331
-		delete_metadata( 'wordpoints_hook_hit', $hit_id, 'reverse_fired' );
1331
+		delete_metadata('wordpoints_hook_hit', $hit_id, 'reverse_fired');
1332 1332
 	}
1333 1333
 
1334 1334
 	/**
@@ -1340,21 +1340,21 @@  discard block
 block discarded – undo
1340 1340
 	 *
1341 1341
 	 * @return array[] The logs, grouped by post ID.
1342 1342
 	 */
1343
-	protected function _2_1_4_get_legacy_reactor_logs( $post_types ) {
1343
+	protected function _2_1_4_get_legacy_reactor_logs($post_types) {
1344 1344
 
1345 1345
 		$legacy_log_types = array();
1346 1346
 
1347
-		foreach ( $post_types as $post_type ) {
1347
+		foreach ($post_types as $post_type) {
1348 1348
 			$legacy_log_types[] = "points_legacy_post_publish\\{$post_type}";
1349 1349
 		}
1350 1350
 
1351 1351
 		$query = new WordPoints_Points_Logs_Query(
1352
-			array( 'log_type__in' => $legacy_log_types, 'order' => 'ASC' )
1352
+			array('log_type__in' => $legacy_log_types, 'order' => 'ASC')
1353 1353
 		);
1354 1354
 
1355 1355
 		$legacy_logs = array();
1356 1356
 
1357
-		foreach ( $query->get() as $legacy_log ) {
1357
+		foreach ($query->get() as $legacy_log) {
1358 1358
 
1359 1359
 			$post_type = str_replace(
1360 1360
 				'points_legacy_post_publish\\'
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 				, true
1369 1369
 			);
1370 1370
 
1371
-			$legacy_logs[ $post_id ][] = $legacy_log;
1371
+			$legacy_logs[$post_id][] = $legacy_log;
1372 1372
 		}
1373 1373
 
1374 1374
 		return $legacy_logs;
Please login to merge, or discard this patch.
src/components/points/includes/class-wordpoints-points-hook.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
 	 *
104 104
 	 * @param int|string $number The hook number or ID to get the points for.
105 105
 	 *
106
-	 * @return int|false The number of points for this instance, or false.
106
+	 * @return integer The number of points for this instance, or false.
107 107
 	 */
108 108
 	public function get_points( $number = null ) {
109 109
 
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return int|false The number of points for this instance, or false.
107 107
 	 */
108
-	public function get_points( $number = null ) {
108
+	public function get_points($number = null) {
109 109
 
110
-		if ( isset( $number ) ) {
111
-			$number = $this->get_number_by_id( $number );
110
+		if (isset($number)) {
111
+			$number = $this->get_number_by_id($number);
112 112
 		} else {
113 113
 			$number = $this->number;
114 114
 		}
115 115
 
116 116
 		$instances = $this->get_instances();
117 117
 
118
-		if ( isset( $instances[ $number ]['points'] ) ) {
119
-			return $instances[ $number ]['points'];
118
+		if (isset($instances[$number]['points'])) {
119
+			return $instances[$number]['points'];
120 120
 		}
121 121
 
122 122
 		return false;
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return array|false Settings to save, or false to cancel saving.
149 149
 	 */
150
-	protected function update( $new_instance, $old_instance ) {
150
+	protected function update($new_instance, $old_instance) {
151 151
 
152
-		$new_instance = array_merge( array( 'points' => 0 ), $old_instance, $new_instance );
152
+		$new_instance = array_merge(array('points' => 0), $old_instance, $new_instance);
153 153
 
154
-		if ( false === wordpoints_posint( $new_instance['points'] ) ) {
155
-			if ( isset( $this->defaults['points'] ) ) {
154
+		if (false === wordpoints_posint($new_instance['points'])) {
155
+			if (isset($this->defaults['points'])) {
156 156
 				$new_instance['points'] = $this->defaults['points'];
157 157
 			} else {
158 158
 				return false;
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return bool Whether the hook has a form.
180 180
 	 */
181
-	protected function form( $instance ) {
181
+	protected function form($instance) {
182 182
 
183
-		if ( ! isset( $instance['points'] ) ) {
183
+		if ( ! isset($instance['points'])) {
184 184
 
185
-			if ( isset( $this->defaults['points'] ) ) {
185
+			if (isset($this->defaults['points'])) {
186 186
 				$instance['points'] = $this->defaults['points'];
187 187
 			} else {
188 188
 				$instance['points'] = 0;
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 		?>
193 193
 
194 194
 		<p>
195
-			<label for="<?php $this->the_field_id( 'points' ); ?>"><?php echo esc_html( $this->options['points_label'] ); ?></label>
196
-			<input class="widefat" name="<?php $this->the_field_name( 'points' ); ?>" id="<?php $this->the_field_id( 'points' ); ?>" type="number" min="0" value="<?php echo wordpoints_posint( $instance['points'] ); ?>" />
195
+			<label for="<?php $this->the_field_id('points'); ?>"><?php echo esc_html($this->options['points_label']); ?></label>
196
+			<input class="widefat" name="<?php $this->the_field_name('points'); ?>" id="<?php $this->the_field_id('points'); ?>" type="number" min="0" value="<?php echo wordpoints_posint($instance['points']); ?>" />
197 197
 		</p>
198 198
 
199 199
 		<?php
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 *
211 211
 	 * @return string The hook instance's description.
212 212
 	 */
213
-	protected function generate_description( $instance = array() ) {
213
+	protected function generate_description($instance = array()) {
214 214
 
215 215
 		return $this->options['description'];
216 216
 	}
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @return string The unique ID for the instance.
245 245
 	 */
246
-	final public function get_id( $number = null ) {
246
+	final public function get_id($number = null) {
247 247
 
248
-		if ( ! isset( $number ) ) {
248
+		if ( ! isset($number)) {
249 249
 			$number = $this->number;
250 250
 		}
251 251
 
@@ -275,16 +275,16 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @param int|string $instance_id The number or ID of an instance.
277 277
 	 */
278
-	final public function set_number( $instance_id ) {
278
+	final public function set_number($instance_id) {
279 279
 
280
-		$this->number = $this->get_number_by_id( $instance_id );
280
+		$this->number = $this->get_number_by_id($instance_id);
281 281
 
282
-		if ( '__i__' === $this->number ) {
282
+		if ('__i__' === $this->number) {
283 283
 			return;
284
-		} elseif ( '0' === $this->number ) {
284
+		} elseif ('0' === $this->number) {
285 285
 			$this->number = 0;
286 286
 		} else {
287
-			wordpoints_posint( $this->number );
287
+			wordpoints_posint($this->number);
288 288
 		}
289 289
 	}
290 290
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 	 * @return string The number for the hook instance. Prefixed with 'network_' for
299 299
 	 *                network hooks.
300 300
 	 */
301
-	final public function get_number_by_id( $id ) {
301
+	final public function get_number_by_id($id) {
302 302
 
303
-		return str_replace( $this->id_base . '-', '', $id );
303
+		return str_replace($this->id_base . '-', '', $id);
304 304
 	}
305 305
 
306 306
 	/**
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return mixed The option, or null if it doesn't exist.
340 340
 	 */
341
-	final public function get_option( $option ) {
341
+	final public function get_option($option) {
342 342
 
343
-		if ( isset( $this->options[ $option ] ) ) {
343
+		if (isset($this->options[$option])) {
344 344
 
345
-			return $this->options[ $option ];
345
+			return $this->options[$option];
346 346
 		}
347 347
 
348 348
 		return null;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @param array $options The options for the hook.
358 358
 	 */
359
-	final public function set_options( array $options ) {
359
+	final public function set_options(array $options) {
360 360
 		$this->options = $options;
361 361
 	}
362 362
 
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
 	 * @param string $option The index for the option.
370 370
 	 * @param mixed  $value  The value to assign to this option.
371 371
 	 */
372
-	final public function set_option( $option, $value ) {
372
+	final public function set_option($option, $value) {
373 373
 
374
-		$this->options[ $option ] = $value;
374
+		$this->options[$option] = $value;
375 375
 	}
376 376
 
377 377
 	/**
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	 */
388 388
 	final public function next_hook_id_number() {
389 389
 
390
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
390
+		if (WordPoints_Points_Hooks::get_network_mode()) {
391 391
 			$type = 'network';
392 392
 		} else {
393 393
 			$type = 'standard';
394 394
 		}
395 395
 
396
-		return 1 + max( array_keys( $this->get_instances( $type ) ) + array( 0 ) );
396
+		return 1 + max(array_keys($this->get_instances($type)) + array(0));
397 397
 	}
398 398
 
399 399
 	/**
@@ -415,34 +415,34 @@  discard block
 block discarded – undo
415 415
 	 *
416 416
 	 * @return array The saved instances of this hook.
417 417
 	 */
418
-	final public function get_instances( $type = 'all' ) {
418
+	final public function get_instances($type = 'all') {
419 419
 
420
-		switch ( $type ) {
420
+		switch ($type) {
421 421
 
422 422
 			case 'standard':
423
-				$instances = wordpoints_get_array_option( $this->option_name );
423
+				$instances = wordpoints_get_array_option($this->option_name);
424 424
 			break;
425 425
 
426 426
 			case 'network':
427
-				if ( is_multisite() ) {
428
-					$instances = wordpoints_get_array_option( $this->option_name, 'site' );
427
+				if (is_multisite()) {
428
+					$instances = wordpoints_get_array_option($this->option_name, 'site');
429 429
 				} else {
430 430
 					$instances = array();
431 431
 				}
432 432
 			break;
433 433
 
434 434
 			case 'all':
435
-				$instances = wordpoints_get_array_option( $this->option_name );
435
+				$instances = wordpoints_get_array_option($this->option_name);
436 436
 
437
-				if ( is_multisite() ) {
438
-					foreach ( wordpoints_get_array_option( $this->option_name, 'site' ) as $number => $instance ) {
439
-						$instances[ 'network_' . $number ] = $instance;
437
+				if (is_multisite()) {
438
+					foreach (wordpoints_get_array_option($this->option_name, 'site') as $number => $instance) {
439
+						$instances['network_' . $number] = $instance;
440 440
 					}
441 441
 				}
442 442
 			break;
443 443
 		}
444 444
 
445
-		unset( $instances['__i__'] );
445
+		unset($instances['__i__']);
446 446
 
447 447
 		return $instances;
448 448
 	}
@@ -457,22 +457,22 @@  discard block
 block discarded – undo
457 457
 	 * @param array $new_instance The new instance of this hooks settings.
458 458
 	 * @param int   $number       The ID number for this hook.
459 459
 	 */
460
-	final public function update_callback( $new_instance, $number ) {
460
+	final public function update_callback($new_instance, $number) {
461 461
 
462
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
462
+		if (WordPoints_Points_Hooks::get_network_mode()) {
463 463
 			$type = 'network';
464 464
 		} else {
465 465
 			$type = 'standard';
466 466
 		}
467 467
 
468 468
 		// Get all saved instances of this points hook.
469
-		$all_instances = $this->get_instances( $type );
469
+		$all_instances = $this->get_instances($type);
470 470
 
471
-		$this->set_number( $number );
471
+		$this->set_number($number);
472 472
 
473
-		$old_instance = isset( $all_instances[ $this->number ] ) ? $all_instances[ $this->number ] : array();
473
+		$old_instance = isset($all_instances[$this->number]) ? $all_instances[$this->number] : array();
474 474
 
475
-		$instance = $this->update( $new_instance, $old_instance );
475
+		$instance = $this->update($new_instance, $old_instance);
476 476
 
477 477
 		/**
478 478
 		 * Filter a points hook's settings before saving.
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
 		 * @param array                  $old_instance The old instance of the hook.
489 489
 		 * @param WordPoints_Points_Hook $hook         The hook object.
490 490
 		 */
491
-		$instance = apply_filters( 'wordpoints_points_hook_update_callback', $instance, $new_instance, $old_instance, $this );
491
+		$instance = apply_filters('wordpoints_points_hook_update_callback', $instance, $new_instance, $old_instance, $this);
492 492
 
493
-		if ( false !== $instance ) {
494
-			$all_instances[ $this->number ] = $instance;
493
+		if (false !== $instance) {
494
+			$all_instances[$this->number] = $instance;
495 495
 		}
496 496
 
497
-		$this->_save_instances( $all_instances );
497
+		$this->_save_instances($all_instances);
498 498
 	}
499 499
 
500 500
 	/**
@@ -504,24 +504,24 @@  discard block
 block discarded – undo
504 504
 	 *
505 505
 	 * @param string $hook_id The ID of the instance to delete.
506 506
 	 */
507
-	final public function delete_callback( $hook_id ) {
507
+	final public function delete_callback($hook_id) {
508 508
 
509
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
509
+		if (WordPoints_Points_Hooks::get_network_mode()) {
510 510
 			$type = 'network';
511 511
 		} else {
512 512
 			$type = 'standard';
513 513
 		}
514 514
 
515 515
 		// Get all saved instances of this points hook.
516
-		$all_instances = $this->get_instances( $type );
516
+		$all_instances = $this->get_instances($type);
517 517
 
518
-		$number = $this->get_number_by_id( $hook_id );
518
+		$number = $this->get_number_by_id($hook_id);
519 519
 
520
-		if ( isset( $all_instances[ $number ] ) ) {
520
+		if (isset($all_instances[$number])) {
521 521
 
522
-			unset( $all_instances[ $number ] );
522
+			unset($all_instances[$number]);
523 523
 
524
-			$this->_save_instances( $all_instances );
524
+			$this->_save_instances($all_instances);
525 525
 		}
526 526
 	}
527 527
 
@@ -534,27 +534,27 @@  discard block
 block discarded – undo
534 534
 	 *
535 535
 	 * @return bool|null Whether the form was displayed.
536 536
 	 */
537
-	final public function form_callback( $number ) {
537
+	final public function form_callback($number) {
538 538
 
539
-		$this->set_number( $number );
539
+		$this->set_number($number);
540 540
 
541
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
541
+		if (WordPoints_Points_Hooks::get_network_mode()) {
542 542
 			$type = 'network';
543 543
 		} else {
544 544
 			$type = 'standard';
545 545
 		}
546 546
 
547
-		$all_instances = $this->get_instances( $type );
547
+		$all_instances = $this->get_instances($type);
548 548
 
549
-		if ( 0 === $this->number || '0' === $this->number ) {
549
+		if (0 === $this->number || '0' === $this->number) {
550 550
 
551 551
 			// We echo out a form where 'number' can be set later.
552
-			$this->set_number( '__i__' );
552
+			$this->set_number('__i__');
553 553
 			$instance = array();
554 554
 
555 555
 		} else {
556 556
 
557
-			$instance = $all_instances[ $this->number ];
557
+			$instance = $all_instances[$this->number];
558 558
 		}
559 559
 
560 560
 		/**
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 		 * @param array                  $instance The settings for this instance.
568 568
 		 * @param WordPoints_Points_Hook $hook     The hook object.
569 569
 		 */
570
-		$instance = apply_filters( 'wordpoints_points_hook_form_callback', $instance, $this );
570
+		$instance = apply_filters('wordpoints_points_hook_form_callback', $instance, $this);
571 571
 
572
-		if ( false !== $instance ) {
572
+		if (false !== $instance) {
573 573
 
574
-			$has_form = $this->form( $instance );
574
+			$has_form = $this->form($instance);
575 575
 
576 576
 			/**
577 577
 			 * Inside the points hook form.
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 			 * @param array                  $instance Settings for this instance.
584 584
 			 * @param WordPoints_Points_Hook $hook     The hook object.
585 585
 			 */
586
-			do_action( 'wordpoints_in_points_hook_form', $has_form, $instance, $this );
586
+			do_action('wordpoints_in_points_hook_form', $has_form, $instance, $this);
587 587
 
588 588
 			return $has_form;
589 589
 		}
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 	 *
607 607
 	 * @return string Name attribute for $field_name.
608 608
 	 */
609
-	final public function get_field_name( $field_name ) {
609
+	final public function get_field_name($field_name) {
610 610
 
611
-		return esc_attr( 'hook-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']' );
611
+		return esc_attr('hook-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']');
612 612
 	}
613 613
 
614 614
 	/**
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
 	 *
621 621
 	 * @param string $field_name The field name.
622 622
 	 */
623
-	final public function the_field_name( $field_name ) {
623
+	final public function the_field_name($field_name) {
624 624
 
625
-		echo esc_attr( $this->get_field_name( $field_name ) );
625
+		echo esc_attr($this->get_field_name($field_name));
626 626
 	}
627 627
 
628 628
 	/**
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
 	 *
641 641
 	 * @return string ID attribute for $field_name.
642 642
 	 */
643
-	final public function get_field_id( $field_name ) {
643
+	final public function get_field_id($field_name) {
644 644
 
645
-		return esc_attr( 'hook-' . $this->id_base . '-' . $this->number . '-' . $field_name );
645
+		return esc_attr('hook-' . $this->id_base . '-' . $this->number . '-' . $field_name);
646 646
 	}
647 647
 
648 648
 	/**
@@ -654,9 +654,9 @@  discard block
 block discarded – undo
654 654
 	 *
655 655
 	 * @param string $field_name The field name.
656 656
 	 */
657
-	final public function the_field_id( $field_name ) {
657
+	final public function the_field_id($field_name) {
658 658
 
659
-		echo esc_attr( $this->get_field_id( $field_name ) );
659
+		echo esc_attr($this->get_field_id($field_name));
660 660
 	}
661 661
 
662 662
 	/**
@@ -669,15 +669,15 @@  discard block
 block discarded – undo
669 669
 	 *
670 670
 	 * @return string The hook's description.
671 671
 	 */
672
-	final public function get_description( $type = 'any' ) {
672
+	final public function get_description($type = 'any') {
673 673
 
674 674
 		$instances = $this->get_instances();
675 675
 
676
-		if ( 'generated' !== $type && ! empty( $instances[ $this->number ]['_description'] ) ) {
677
-			return $instances[ $this->number ]['_description'];
676
+		if ('generated' !== $type && ! empty($instances[$this->number]['_description'])) {
677
+			return $instances[$this->number]['_description'];
678 678
 		}
679 679
 
680
-		$instance = ( isset( $instances[ $this->number ] ) ) ? $instances[ $this->number ] : array();
680
+		$instance = (isset($instances[$this->number])) ? $instances[$this->number] : array();
681 681
 
682 682
 		/**
683 683
 		 * Filter the description for a points hook.
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		 * @param WordPoints_Points_Hook $hook        The points hook object.
689 689
 		 * @param array                  $instance    The settings for this instance.
690 690
 		 */
691
-		return apply_filters( 'wordpoints_points_hook_description', $this->generate_description( $instance ), $this, $instance );
691
+		return apply_filters('wordpoints_points_hook_description', $this->generate_description($instance), $this, $instance);
692 692
 	}
693 693
 
694 694
 	/**
@@ -701,31 +701,31 @@  discard block
 block discarded – undo
701 701
 	 *
702 702
 	 * @return string|false The type of points, or false if none found.
703 703
 	 */
704
-	final public function points_type( $number = null ) {
704
+	final public function points_type($number = null) {
705 705
 
706 706
 		$network_mode = false;
707 707
 
708
-		if ( ! isset( $number ) ) {
708
+		if ( ! isset($number)) {
709 709
 
710 710
 			$number = $this->number;
711 711
 
712
-		} elseif ( is_string( $number ) && 'network_' === substr( $number, 0, 8 ) ) {
712
+		} elseif (is_string($number) && 'network_' === substr($number, 0, 8)) {
713 713
 
714 714
 			$network_mode = true;
715
-			$number = (int) substr( $number, 8 );
715
+			$number = (int) substr($number, 8);
716 716
 		}
717 717
 
718 718
 		$current_mode = WordPoints_Points_Hooks::get_network_mode();
719 719
 
720
-		if ( $current_mode !== $network_mode ) {
721
-			WordPoints_Points_Hooks::set_network_mode( $network_mode );
720
+		if ($current_mode !== $network_mode) {
721
+			WordPoints_Points_Hooks::set_network_mode($network_mode);
722 722
 		}
723 723
 
724
-		$points_type = WordPoints_Points_Hooks::get_points_type( $this->get_id( $number ) );
724
+		$points_type = WordPoints_Points_Hooks::get_points_type($this->get_id($number));
725 725
 
726 726
 		// Reset network mode if it was changed.
727
-		if ( $current_mode !== $network_mode ) {
728
-			WordPoints_Points_Hooks::set_network_mode( $current_mode );
727
+		if ($current_mode !== $network_mode) {
728
+			WordPoints_Points_Hooks::set_network_mode($current_mode);
729 729
 		}
730 730
 
731 731
 		return $points_type;
@@ -754,15 +754,15 @@  discard block
 block discarded – undo
754 754
 	 *              overriding that function, you can ignore this option.
755 755
 	 * }
756 756
 	 */
757
-	final protected function init( $name, array $options = array() ) {
757
+	final protected function init($name, array $options = array()) {
758 758
 
759
-		$this->id_base     = strtolower( get_class( $this ) );
759
+		$this->id_base     = strtolower(get_class($this));
760 760
 		$this->name        = $name;
761 761
 		$this->option_name = 'wordpoints_hook-' . $this->id_base;
762 762
 
763 763
 		// Option names can only be 191 characters long.
764
-		if ( isset( $this->option_name{191} ) ) {
765
-			_doing_it_wrong( __METHOD__, sprintf( 'Points hook class names cannot be longer than 175 characters, %s is %s character(s) too long.', esc_html( $this->id_base ), (int) strlen( $this->id_base ) - 175 ), '1.5.0' );
764
+		if (isset($this->option_name{191} )) {
765
+			_doing_it_wrong(__METHOD__, sprintf('Points hook class names cannot be longer than 175 characters, %s is %s character(s) too long.', esc_html($this->id_base), (int) strlen($this->id_base) - 175), '1.5.0');
766 766
 			return;
767 767
 		}
768 768
 
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
 			array(
771 771
 				'width'        => 250,
772 772
 				'description'  => '',
773
-				'points_label' => __( 'Points:', 'wordpoints' ),
773
+				'points_label' => __('Points:', 'wordpoints'),
774 774
 			)
775 775
 			, $options
776 776
 		);
777 777
 
778
-		$this->options['_classname']   = $this->option_name;
778
+		$this->options['_classname'] = $this->option_name;
779 779
 	}
780 780
 
781 781
 	//
@@ -789,15 +789,15 @@  discard block
 block discarded – undo
789 789
 	 *
790 790
 	 * @param array $instances All settings, indexed by instance number.
791 791
 	 */
792
-	final private function _save_instances( $instances ) {
792
+	final private function _save_instances($instances) {
793 793
 
794 794
 		// This needs to start at 1.
795
-		unset( $instances[0] );
795
+		unset($instances[0]);
796 796
 
797
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
798
-			update_site_option( $this->option_name, $instances );
797
+		if (WordPoints_Points_Hooks::get_network_mode()) {
798
+			update_site_option($this->option_name, $instances);
799 799
 		} else {
800
-			update_option( $this->option_name, $instances );
800
+			update_option($this->option_name, $instances);
801 801
 		}
802 802
 	}
803 803
 
Please login to merge, or discard this patch.
src/components/points/includes/hooks/abstracts/post-type.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@
 block discarded – undo
421 421
 	 * @since 2.0.0
422 422
 	 *
423 423
 	 * @param string $key       The log meta key to match on.
424
-	 * @param mixed  $value     The log meta value to match on.
424
+	 * @param integer  $value     The log meta value to match on.
425 425
 	 * @param string $new_key   The key for the new meta value to add.
426 426
 	 * @param mixed  $new_value The new meta value to add. If falsey, new meta isn't added.
427 427
 	 */
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @since 1.9.0
43 43
 	 */
44
-	public function __construct( $title, $args ) {
44
+	public function __construct($title, $args) {
45 45
 
46
-		$this->init( $title, $args );
46
+		$this->init($title, $args);
47 47
 
48
-		add_filter( "wordpoints_points_log-{$this->log_type}", array( $this, 'logs' ), 10, 6 );
49
-		add_filter( "wordpoints_points_log-reverse_{$this->log_type}", array( $this, 'logs' ), 10, 6 );
48
+		add_filter("wordpoints_points_log-{$this->log_type}", array($this, 'logs'), 10, 6);
49
+		add_filter("wordpoints_points_log-reverse_{$this->log_type}", array($this, 'logs'), 10, 6);
50 50
 
51
-		add_action( 'delete_post', array( $this, 'clean_logs_on_post_deletion' ), 15 );
51
+		add_action('delete_post', array($this, 'clean_logs_on_post_deletion'), 15);
52 52
 
53
-		if ( ! $this->uses_points_logs_viewing_restriction_api ) {
54
-			add_filter( "wordpoints_user_can_view_points_log-{$this->log_type}", array( $this, 'user_can_view' ), 10, 3 );
53
+		if ( ! $this->uses_points_logs_viewing_restriction_api) {
54
+			add_filter("wordpoints_user_can_view_points_log-{$this->log_type}", array($this, 'user_can_view'), 10, 3);
55 55
 		}
56 56
 	}
57 57
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return bool Whether this post type matches and points should be awarded.
67 67
 	 */
68
-	public function is_matching_post_type( $post_type, $instance_post_type ) {
68
+	public function is_matching_post_type($post_type, $instance_post_type) {
69 69
 
70 70
 		return (
71 71
 			$instance_post_type === $post_type
72 72
 			|| (
73 73
 				'ALL' === $instance_post_type
74
-				&& post_type_exists( $post_type )
75
-				&& get_post_type_object( $post_type )->public
74
+				&& post_type_exists($post_type)
75
+				&& get_post_type_object($post_type)->public
76 76
 			)
77 77
 		);
78 78
 	}
@@ -86,27 +86,27 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return bool True if auto-reversals should be done; false otherwise.
88 88
 	 */
89
-	protected function should_do_auto_reversals_for_post_type( $post_type ) {
89
+	protected function should_do_auto_reversals_for_post_type($post_type) {
90 90
 
91 91
 		// Check if this hook type allows auto-reversals to be disabled.
92
-		if ( ! $this->get_option( 'disable_auto_reverse_label' ) ) {
92
+		if ( ! $this->get_option('disable_auto_reverse_label')) {
93 93
 			return true;
94 94
 		}
95 95
 
96 96
 		$instances = $this->get_instances();
97 97
 
98
-		foreach ( $instances as $instance ) {
98
+		foreach ($instances as $instance) {
99 99
 
100
-			$instance = array_merge( $this->defaults, $instance );
100
+			$instance = array_merge($this->defaults, $instance);
101 101
 
102
-			if ( $post_type === $instance['post_type'] ) {
103
-				return ! empty( $instance['auto_reverse'] );
104
-			} elseif ( 'ALL' === $instance['post_type'] ) {
102
+			if ($post_type === $instance['post_type']) {
103
+				return ! empty($instance['auto_reverse']);
104
+			} elseif ('ALL' === $instance['post_type']) {
105 105
 				$all_posts_instance = $instance;
106 106
 			}
107 107
 		}
108 108
 
109
-		return ! empty( $all_posts_instance['auto_reverse'] );
109
+		return ! empty($all_posts_instance['auto_reverse']);
110 110
 	}
111 111
 
112 112
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return array The logs to reverse.
120 120
 	 */
121
-	protected function get_logs_to_auto_reverse( array $meta_query ) {
121
+	protected function get_logs_to_auto_reverse(array $meta_query) {
122 122
 
123 123
 		$query = new WordPoints_Points_Logs_Query(
124 124
 			array(
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
 		$logs = $query->get();
137 137
 
138
-		if ( ! $logs ) {
138
+		if ( ! $logs) {
139 139
 			return array();
140 140
 		}
141 141
 
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @param object $log The log to reverse.
151 151
 	 */
152
-	protected function auto_reverse_log( $log ) {
152
+	protected function auto_reverse_log($log) {
153 153
 
154 154
 		wordpoints_alter_points(
155 155
 			$log->user_id
156 156
 			, -$log->points
157 157
 			, $log->points_type
158 158
 			, "reverse_{$this->log_type}"
159
-			, array( 'original_log_id' => $log->id )
159
+			, array('original_log_id' => $log->id)
160 160
 		);
161 161
 
162
-		wordpoints_add_points_log_meta( $log->id, 'auto_reversed', true );
162
+		wordpoints_add_points_log_meta($log->id, 'auto_reversed', true);
163 163
 	}
164 164
 
165 165
 	/**
@@ -176,47 +176,47 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string
178 178
 	 */
179
-	public function logs( $text, $points, $points_type, $user_id, $log_type, $meta ) {
179
+	public function logs($text, $points, $points_type, $user_id, $log_type, $meta) {
180 180
 
181 181
 		$reverse = '';
182 182
 
183
-		if ( "reverse_{$this->log_type}" === $log_type ) {
183
+		if ("reverse_{$this->log_type}" === $log_type) {
184 184
 			$reverse = '_reverse';
185 185
 		}
186 186
 
187 187
 		$post = false;
188 188
 
189
-		if ( '' === $reverse && isset( $meta['post_id'] ) ) {
190
-			$post = get_post( $meta['post_id'] );
189
+		if ('' === $reverse && isset($meta['post_id'])) {
190
+			$post = get_post($meta['post_id']);
191 191
 		}
192 192
 
193
-		if ( $post ) {
193
+		if ($post) {
194 194
 
195 195
 			// This post exists, so we should include the permalink in the log text.
196
-			$text = $this->log_with_post_title_link( $post->ID, $reverse );
196
+			$text = $this->log_with_post_title_link($post->ID, $reverse);
197 197
 
198 198
 		} else {
199 199
 
200 200
 			// This post doesn't exist; we probably can't use the title.
201
-			$text = $this->get_option( 'log_text_no_post_title' . $reverse );
201
+			$text = $this->get_option('log_text_no_post_title' . $reverse);
202 202
 
203 203
 			if (
204
-				$this->get_option( 'log_text_post_type' . $reverse )
205
-				&& isset( $meta['post_type'] )
206
-				&& post_type_exists( $meta['post_type'] )
204
+				$this->get_option('log_text_post_type' . $reverse)
205
+				&& isset($meta['post_type'])
206
+				&& post_type_exists($meta['post_type'])
207 207
 			) {
208 208
 
209 209
 				// We do know the type of post though, so include that in the log.
210 210
 				$text = sprintf(
211
-					$this->get_option( 'log_text_post_type' . $reverse )
212
-					, get_post_type_object( $meta['post_type'] )->labels->singular_name
211
+					$this->get_option('log_text_post_type' . $reverse)
212
+					, get_post_type_object($meta['post_type'])->labels->singular_name
213 213
 				);
214 214
 
215
-			} elseif ( isset( $meta['post_title'] ) ) {
215
+			} elseif (isset($meta['post_title'])) {
216 216
 
217 217
 				// If the title is saved as metadata, then we can use it.
218 218
 				$text = sprintf(
219
-					$this->get_option( 'log_text_post_title' . $reverse )
219
+					$this->get_option('log_text_post_title' . $reverse)
220 220
 					, $meta['post_title']
221 221
 				);
222 222
 			}
@@ -236,31 +236,31 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return string The text for the log entry.
238 238
 	 */
239
-	protected function log_with_post_title_link( $post_id, $reverse = '', $url = null ) {
239
+	protected function log_with_post_title_link($post_id, $reverse = '', $url = null) {
240 240
 
241
-		if ( ! isset( $url ) ) {
242
-			$url = get_permalink( $post_id );
241
+		if ( ! isset($url)) {
242
+			$url = get_permalink($post_id);
243 243
 		}
244 244
 
245
-		$post_title = get_the_title( $post_id );
245
+		$post_title = get_the_title($post_id);
246 246
 
247 247
 		$args = array();
248 248
 
249
-		$args[] = '<a href="' . esc_url( $url ) . '">'
250
-			. ( $post_title ? $post_title : _x( '(no title)', 'post title', 'wordpoints' ) )
249
+		$args[] = '<a href="' . esc_url($url) . '">'
250
+			. ($post_title ? $post_title : _x('(no title)', 'post title', 'wordpoints'))
251 251
 			. '</a>';
252 252
 
253
-		$text = $this->get_option( 'log_text_post_title_and_type' . $reverse );
253
+		$text = $this->get_option('log_text_post_title_and_type' . $reverse);
254 254
 
255
-		$post_type = get_post_field( 'post_type', $post_id );
255
+		$post_type = get_post_field('post_type', $post_id);
256 256
 
257
-		if ( $text && $post_type && post_type_exists( $post_type ) ) {
258
-			$args[] = get_post_type_object( $post_type )->labels->singular_name;
257
+		if ($text && $post_type && post_type_exists($post_type)) {
258
+			$args[] = get_post_type_object($post_type)->labels->singular_name;
259 259
 		} else {
260
-			$text = $this->get_option( 'log_text_post_title' . $reverse );
260
+			$text = $this->get_option('log_text_post_title' . $reverse);
261 261
 		}
262 262
 
263
-		return vsprintf( $text, $args );
263
+		return vsprintf($text, $args);
264 264
 	}
265 265
 
266 266
 	/**
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return string A description for the hook instance.
274 274
 	 */
275
-	protected function generate_description( $instance = array() ) {
275
+	protected function generate_description($instance = array()) {
276 276
 
277
-		if ( ! empty( $instance['post_type'] ) && 'ALL' !== $instance['post_type'] ) {
278
-			$post_type = get_post_type_object( $instance['post_type'] );
277
+		if ( ! empty($instance['post_type']) && 'ALL' !== $instance['post_type']) {
278
+			$post_type = get_post_type_object($instance['post_type']);
279 279
 
280
-			if ( $post_type ) {
281
-				return sprintf( $this->get_option( 'post_type_description' ), $post_type->labels->singular_name );
280
+			if ($post_type) {
281
+				return sprintf($this->get_option('post_type_description'), $post_type->labels->singular_name);
282 282
 			}
283 283
 		}
284 284
 
285
-		return parent::generate_description( $instance );
285
+		return parent::generate_description($instance);
286 286
 	}
287 287
 
288 288
 	/**
@@ -294,43 +294,43 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return bool True.
296 296
 	 */
297
-	protected function form( $instance ) {
297
+	protected function form($instance) {
298 298
 
299
-		$instance = array_merge( $this->defaults, $instance );
299
+		$instance = array_merge($this->defaults, $instance);
300 300
 
301 301
 		?>
302 302
 
303 303
 		<p>
304
-			<label for="<?php $this->the_field_id( 'post_type' ); ?>"><?php esc_html_e( 'Select post type:', 'wordpoints' ); ?></label>
304
+			<label for="<?php $this->the_field_id('post_type'); ?>"><?php esc_html_e('Select post type:', 'wordpoints'); ?></label>
305 305
 			<?php
306 306
 
307 307
 			wordpoints_list_post_types(
308 308
 				array(
309 309
 					'selected' => $instance['post_type'],
310
-					'id'       => $this->get_field_id( 'post_type' ),
311
-					'name'     => $this->get_field_name( 'post_type' ),
310
+					'id'       => $this->get_field_id('post_type'),
311
+					'name'     => $this->get_field_name('post_type'),
312 312
 					'class'    => 'widefat wordpoints-append-to-hook-title',
313
-					'filter'   => $this->get_option( 'post_type_filter' ),
313
+					'filter'   => $this->get_option('post_type_filter'),
314 314
 				)
315
-				, array( 'public' => true )
315
+				, array('public' => true)
316 316
 			);
317 317
 
318 318
 			?>
319 319
 		</p>
320 320
 
321
-		<?php parent::form( $instance ); ?>
321
+		<?php parent::form($instance); ?>
322 322
 
323 323
 		<?php
324 324
 
325
-		$disable_label = $this->get_option( 'disable_auto_reverse_label' );
325
+		$disable_label = $this->get_option('disable_auto_reverse_label');
326 326
 
327
-		if ( $disable_label ) {
327
+		if ($disable_label) {
328 328
 
329 329
 			?>
330 330
 
331 331
 			<p>
332
-				<input class="widefat" name="<?php $this->the_field_name( 'auto_reverse' ); ?>" id="<?php $this->the_field_id( 'auto_reverse' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['auto_reverse'] ); ?> />
333
-				<label for="<?php $this->the_field_id( 'auto_reverse' ); ?>"><?php echo esc_html( $disable_label ); ?></label>
332
+				<input class="widefat" name="<?php $this->the_field_name('auto_reverse'); ?>" id="<?php $this->the_field_id('auto_reverse'); ?>" type="checkbox" value="1" <?php checked('1', $instance['auto_reverse']); ?> />
333
+				<label for="<?php $this->the_field_id('auto_reverse'); ?>"><?php echo esc_html($disable_label); ?></label>
334 334
 			</p>
335 335
 
336 336
 		<?php
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return bool True if the post type supports comments, false otherwise.
350 350
 	 */
351
-	public function post_type_supports_comments( $post_type ) {
351
+	public function post_type_supports_comments($post_type) {
352 352
 
353
-		return post_type_supports( $post_type->name, 'comments' );
353
+		return post_type_supports($post_type->name, 'comments');
354 354
 	}
355 355
 
356 356
 	/**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 *
369 369
 	 * @return bool Whether the user can view this log.
370 370
 	 */
371
-	public function user_can_view( $can_view, $log, $user_id ) {
371
+	public function user_can_view($can_view, $log, $user_id) {
372 372
 
373 373
 		_deprecated_function(
374 374
 			__METHOD__
@@ -376,13 +376,13 @@  discard block
 block discarded – undo
376 376
 			, 'the points logs viewing restrictions API'
377 377
 		);
378 378
 
379
-		if ( $can_view ) {
379
+		if ($can_view) {
380 380
 
381 381
 			$restriction = new WordPoints_Points_Logs_Viewing_Restriction_Read_Post(
382 382
 				$log
383 383
 			);
384 384
 
385
-			$can_view = $restriction->user_can( $user_id );
385
+			$can_view = $restriction->user_can($user_id);
386 386
 		}
387 387
 
388 388
 		return $can_view;
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 *
404 404
 	 * @param int $post_id The ID of the post being deleted.
405 405
 	 */
406
-	public function clean_logs_on_post_deletion( $post_id ) {
406
+	public function clean_logs_on_post_deletion($post_id) {
407 407
 
408 408
 		$this->clean_logs(
409 409
 			'post_id'
410 410
 			, $post_id
411 411
 			, 'post_type'
412
-			, get_post_field( 'post_type', $post_id )
412
+			, get_post_field('post_type', $post_id)
413 413
 		);
414 414
 	}
415 415
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	 * @param string $new_key   The key for the new meta value to add.
424 424
 	 * @param mixed  $new_value The new meta value to add. If falsey, new meta isn't added.
425 425
 	 */
426
-	protected function clean_logs( $key, $value, $new_key, $new_value ) {
426
+	protected function clean_logs($key, $value, $new_key, $new_value) {
427 427
 
428 428
 		$logs_query = new WordPoints_Points_Logs_Query(
429 429
 			array(
@@ -439,20 +439,20 @@  discard block
 block discarded – undo
439 439
 
440 440
 		$logs = $logs_query->get();
441 441
 
442
-		if ( ! $logs ) {
442
+		if ( ! $logs) {
443 443
 			return;
444 444
 		}
445 445
 
446
-		foreach ( $logs as $log ) {
446
+		foreach ($logs as $log) {
447 447
 
448
-			wordpoints_delete_points_log_meta( $log->id, $key );
448
+			wordpoints_delete_points_log_meta($log->id, $key);
449 449
 
450
-			if ( $new_value ) {
451
-				wordpoints_add_points_log_meta( $log->id, $new_key, $new_value );
450
+			if ($new_value) {
451
+				wordpoints_add_points_log_meta($log->id, $new_key, $new_value);
452 452
 			}
453 453
 		}
454 454
 
455
-		wordpoints_regenerate_points_logs( $logs );
455
+		wordpoints_regenerate_points_logs($logs);
456 456
 	}
457 457
 }
458 458
 
Please login to merge, or discard this patch.
src/components/points/includes/logs.php 2 patches
Doc Comments   +11 added lines, -1 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  *        'default', which will return a list of the most recent points logs, with
295 295
  *        users excluded according to the general settings.
296 296
  *
297
- * @return WordPoints_Points_Logs_Query|false Logs query instance, or false.
297
+ * @return WordPoints_Points_Logs_Query Logs query instance, or false.
298 298
  */
299 299
 function wordpoints_get_points_logs_query( $points_type, $query_slug = 'default' ) {
300 300
 
@@ -466,6 +466,11 @@  discard block
 block discarded – undo
466 466
  * @since 1.9.0
467 467
  *
468 468
  * @WordPress\action wordpoints_points_log-comment_disapprove
469
+ * @param string $text
470
+ * @param integer $points
471
+ * @param string $points_type
472
+ * @param integer $user_id
473
+ * @param string $log_type
469 474
  */
470 475
 function wordpoints_points_logs_comment_disapprove( $text, $points, $points_type, $user_id, $log_type, $meta ) {
471 476
 
@@ -492,6 +497,11 @@  discard block
 block discarded – undo
492 497
  * @since 1.9.0
493 498
  *
494 499
  * @WordPress\action wordpoints_points_log-post_delete
500
+ * @param string $text
501
+ * @param integer $points
502
+ * @param string $points_type
503
+ * @param integer $user_id
504
+ * @param string $log_type
495 505
  */
496 506
 function wordpoints_points_logs_post_delete( $text, $points, $points_type, $user_id, $log_type, $meta ) {
497 507
 
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
  *
40 40
  * @return bool Whether the query was registered.
41 41
  */
42
-function wordpoints_register_points_logs_query( $slug, array $args, array $data = array() ) {
42
+function wordpoints_register_points_logs_query($slug, array $args, array $data = array()) {
43 43
 
44
-	return WordPoints_Points_Log_Queries::register_query( $slug, $args, $data );
44
+	return WordPoints_Points_Log_Queries::register_query($slug, $args, $data);
45 45
 }
46 46
 
47 47
 /**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
  *
56 56
  * @return bool Whether $slug is the slug of a registered query.
57 57
  */
58
-function wordpoints_is_points_logs_query( $slug ) {
58
+function wordpoints_is_points_logs_query($slug) {
59 59
 
60
-	return WordPoints_Points_Log_Queries::is_query( $slug );
60
+	return WordPoints_Points_Log_Queries::is_query($slug);
61 61
 }
62 62
 
63 63
 /**
@@ -72,23 +72,23 @@  discard block
 block discarded – undo
72 72
  *
73 73
  * @return array|false The args for the query, or false on failure.
74 74
  */
75
-function wordpoints_get_points_logs_query_args( $points_type, $query_slug = 'default' ) {
75
+function wordpoints_get_points_logs_query_args($points_type, $query_slug = 'default') {
76 76
 
77
-	$args = WordPoints_Points_Log_Queries::get_query_args( $query_slug );
77
+	$args = WordPoints_Points_Log_Queries::get_query_args($query_slug);
78 78
 
79
-	if ( is_null( $args ) || ! wordpoints_is_points_type( $points_type ) ) {
79
+	if (is_null($args) || ! wordpoints_is_points_type($points_type)) {
80 80
 		return false;
81 81
 	}
82 82
 
83 83
 	$defaults = array(
84
-		'user_id__not_in' => wordpoints_get_excluded_users( 'points_logs' ),
84
+		'user_id__not_in' => wordpoints_get_excluded_users('points_logs'),
85 85
 		'points_type'     => $points_type,
86 86
 	);
87 87
 
88
-	$args = array_merge( $defaults, $args );
88
+	$args = array_merge($defaults, $args);
89 89
 
90 90
 	// The current user needs to be set dynamically, since it can change at times.
91
-	if ( 'current_user' === $query_slug ) {
91
+	if ('current_user' === $query_slug) {
92 92
 		$args['user_id'] = get_current_user_id();
93 93
 	}
94 94
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string $query_slug  The slug for the query.
106 106
 	 * @param string $points_type The points type the query is being made for.
107 107
 	 */
108
-	return apply_filters( 'wordpoints_points_logs_query_args', $args, $query_slug, $points_type );
108
+	return apply_filters('wordpoints_points_logs_query_args', $args, $query_slug, $points_type);
109 109
 }
110 110
 
111 111
 /**
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return WordPoints_Points_Logs_Query|false Logs query instance, or false.
127 127
  */
128
-function wordpoints_get_points_logs_query( $points_type, $query_slug = 'default' ) {
128
+function wordpoints_get_points_logs_query($points_type, $query_slug = 'default') {
129 129
 
130
-	$args = wordpoints_get_points_logs_query_args( $points_type, $query_slug );
130
+	$args = wordpoints_get_points_logs_query_args($points_type, $query_slug);
131 131
 
132
-	if ( ! $args ) {
132
+	if ( ! $args) {
133 133
 		return false;
134 134
 	}
135 135
 
136
-	$query = new WordPoints_Points_Logs_Query( $args );
136
+	$query = new WordPoints_Points_Logs_Query($args);
137 137
 
138
-	$query_data = WordPoints_Points_Log_Queries::get_query_data( $query_slug );
138
+	$query_data = WordPoints_Points_Log_Queries::get_query_data($query_slug);
139 139
 
140
-	if ( $query_data['cache_queries'] ) {
140
+	if ($query_data['cache_queries']) {
141 141
 
142 142
 		$query->prime_cache(
143 143
 			$query_data['cache_key']
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function wordpoints_show_points_logs( $logs_query, array $args = array() ) {
183
+function wordpoints_show_points_logs($logs_query, array $args = array()) {
184 184
 
185
-	if ( ! $logs_query instanceof WordPoints_Points_Logs_Query ) {
185
+	if ( ! $logs_query instanceof WordPoints_Points_Logs_Query) {
186 186
 		return;
187 187
 	}
188 188
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 		'show_users' => true,
195 195
 	);
196 196
 
197
-	$args = array_merge( $defaults, $args );
197
+	$args = array_merge($defaults, $args);
198 198
 
199
-	if ( ! $args['datatable'] ) {
199
+	if ( ! $args['datatable']) {
200 200
 
201 201
 		_deprecated_argument(
202 202
 			__FUNCTION__
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
 		$args['paginate'] = false;
208 208
 	}
209 209
 
210
-	$view = wordpoints_component( 'points' )
211
-		->get_sub_app( 'logs' )
212
-		->get_sub_app( 'views' )
213
-		->get( $args['view'], array( $logs_query, $args ) );
210
+	$view = wordpoints_component('points')
211
+		->get_sub_app('logs')
212
+		->get_sub_app('views')
213
+		->get($args['view'], array($logs_query, $args));
214 214
 
215
-	if ( ! $view instanceof WordPoints_Points_Logs_View ) {
215
+	if ( ! $view instanceof WordPoints_Points_Logs_View) {
216 216
 		return;
217 217
 	}
218 218
 
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
  * @param string $query_slug  The query to use to display the logs.
233 233
  * @param array  $args        Arguments to pass to wordpoints_show_points_logs().
234 234
  */
235
-function wordpoints_show_points_logs_query( $points_type, $query_slug = 'default', array $args = array() ) {
235
+function wordpoints_show_points_logs_query($points_type, $query_slug = 'default', array $args = array()) {
236 236
 
237
-	wordpoints_show_points_logs( wordpoints_get_points_logs_query( $points_type, $query_slug ), $args );
237
+	wordpoints_show_points_logs(wordpoints_get_points_logs_query($points_type, $query_slug), $args);
238 238
 }
239 239
 
240 240
 /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	wordpoints_register_points_logs_query(
255 255
 		'current_user'
256
-		, array( 'user_id' => get_current_user_id() )
256
+		, array('user_id' => get_current_user_id())
257 257
 		, array(
258 258
 			'cache_key'     => 'current_user:%points_type%:%user_id%',
259 259
 			'cache_queries' => true,
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	wordpoints_register_points_logs_query(
269 269
 		'network'
270
-		, array( 'blog_id' => false )
270
+		, array('blog_id' => false)
271 271
 		, array(
272 272
 			'network_wide'  => true,
273 273
 			'cache_queries' => true,
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @WordPress\action wordpoints_points_log-profile_edit
284 284
  */
285
-function wordpoints_points_logs_profile_edit( $text, $points, $points_type, $user_id, $log_type, $meta ) {
285
+function wordpoints_points_logs_profile_edit($text, $points, $points_type, $user_id, $log_type, $meta) {
286 286
 
287
-	$user_name = sanitize_user_field( 'display_name', get_userdata( $meta['user_id'] )->display_name, $meta['user_id'], 'display' );
287
+	$user_name = sanitize_user_field('display_name', get_userdata($meta['user_id'])->display_name, $meta['user_id'], 'display');
288 288
 
289 289
 	// translators: 1. User name; 2. Reason given.
290
-	return sprintf( _x( 'Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints' ), $user_name, esc_html( $meta['reason'] ) );
290
+	return sprintf(_x('Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints'), $user_name, esc_html($meta['reason']));
291 291
 }
292 292
 
293 293
 /**
@@ -297,20 +297,20 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @WordPress\action wordpoints_points_log-comment_disapprove
299 299
  */
300
-function wordpoints_points_logs_comment_disapprove( $text, $points, $points_type, $user_id, $log_type, $meta ) {
300
+function wordpoints_points_logs_comment_disapprove($text, $points, $points_type, $user_id, $log_type, $meta) {
301 301
 
302
-	switch ( $meta['status'] ) {
302
+	switch ($meta['status']) {
303 303
 
304 304
 		case 'spam':
305
-			$text = _x( 'Comment marked as spam.', 'points log description', 'wordpoints' );
305
+			$text = _x('Comment marked as spam.', 'points log description', 'wordpoints');
306 306
 		break;
307 307
 
308 308
 		case 'trash':
309
-			$text = _x( 'Comment moved to trash.', 'points log description', 'wordpoints' );
309
+			$text = _x('Comment moved to trash.', 'points log description', 'wordpoints');
310 310
 		break;
311 311
 
312 312
 		default:
313
-			$text = _x( 'Comment unapproved.', 'points log description', 'wordpoints' );
313
+			$text = _x('Comment unapproved.', 'points log description', 'wordpoints');
314 314
 	}
315 315
 
316 316
 	return $text;
@@ -323,23 +323,23 @@  discard block
 block discarded – undo
323 323
  *
324 324
  * @WordPress\action wordpoints_points_log-post_delete
325 325
  */
326
-function wordpoints_points_logs_post_delete( $text, $points, $points_type, $user_id, $log_type, $meta ) {
326
+function wordpoints_points_logs_post_delete($text, $points, $points_type, $user_id, $log_type, $meta) {
327 327
 
328
-	if ( isset( $meta['post_type'] ) ) {
328
+	if (isset($meta['post_type'])) {
329 329
 
330
-		$post_type = get_post_type_object( $meta['post_type'] );
330
+		$post_type = get_post_type_object($meta['post_type']);
331 331
 
332
-		if ( ! is_null( $post_type ) ) {
332
+		if ( ! is_null($post_type)) {
333 333
 
334 334
 			return sprintf(
335 335
 				// translators: Singular post type name.
336
-				_x( '%s deleted.', 'points log description', 'wordpoints' )
336
+				_x('%s deleted.', 'points log description', 'wordpoints')
337 337
 				, $post_type->labels->singular_name
338 338
 			);
339 339
 		}
340 340
 	}
341 341
 
342
-	return _x( 'Post deleted.', 'points log description', 'wordpoints' );
342
+	return _x('Post deleted.', 'points log description', 'wordpoints');
343 343
 }
344 344
 
345 345
 /**
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
  * @param int    $points      The number of points. Not used.
356 356
  * @param string $points_type The type of points being awarded.
357 357
  */
358
-function wordpoints_clean_points_logs_cache( $user_id, $points, $points_type ) {
358
+function wordpoints_clean_points_logs_cache($user_id, $points, $points_type) {
359 359
 
360 360
 	wordpoints_flush_points_logs_caches(
361
-		array( 'user_id' => $user_id, 'points_type' => $points_type )
361
+		array('user_id' => $user_id, 'points_type' => $points_type)
362 362
 	);
363 363
 }
364 364
 
@@ -380,27 +380,27 @@  discard block
 block discarded – undo
380 380
  *        @type int             $user_id     Only clear the cache for this user.
381 381
  * }
382 382
  */
383
-function wordpoints_flush_points_logs_caches( $args = array() ) {
383
+function wordpoints_flush_points_logs_caches($args = array()) {
384 384
 
385
-	$args = array_merge( array( 'points_type' => false, 'user_id' => 0 ), $args );
385
+	$args = array_merge(array('points_type' => false, 'user_id' => 0), $args);
386 386
 
387 387
 	$find = array(
388 388
 		'%points_type%',
389 389
 		'%user_id%',
390 390
 	);
391 391
 
392
-	if ( empty( $args['points_type'] ) ) {
393
-		$points_types = array_keys( wordpoints_get_points_types() );
392
+	if (empty($args['points_type'])) {
393
+		$points_types = array_keys(wordpoints_get_points_types());
394 394
 	} else {
395 395
 		$points_types = (array) $args['points_type'];
396 396
 	}
397 397
 
398
-	foreach ( $points_types as $points_type ) {
399
-		foreach ( WordPoints_Points_Log_Queries::get_queries() as $query ) {
398
+	foreach ($points_types as $points_type) {
399
+		foreach (WordPoints_Points_Log_Queries::get_queries() as $query) {
400 400
 
401
-			if ( ! empty( $query['cache_key'] ) ) {
401
+			if ( ! empty($query['cache_key'])) {
402 402
 
403
-				if ( $query['network_wide'] ) {
403
+				if ($query['network_wide']) {
404 404
 					$group = 'wordpoints_network_points_logs_query';
405 405
 				} else {
406 406
 					$group = 'wordpoints_points_logs_query';
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 				);
413 413
 
414 414
 				wp_cache_delete(
415
-					str_replace( $find, $replace, $query['cache_key'] )
415
+					str_replace($find, $replace, $query['cache_key'])
416 416
 					, $group
417 417
 				);
418 418
 			}
@@ -431,26 +431,26 @@  discard block
 block discarded – undo
431 431
  *
432 432
  * @return bool Whether the user can view this points log entry.
433 433
  */
434
-function wordpoints_user_can_view_points_log( $user_id, $log ) {
434
+function wordpoints_user_can_view_points_log($user_id, $log) {
435 435
 
436 436
 	// We do this just once here for optimization, as otherwise it would run 3 times.
437
-	if ( $log->blog_id && get_current_blog_id() !== $log->blog_id ) {
438
-		$switched = switch_to_blog( $log->blog_id );
437
+	if ($log->blog_id && get_current_blog_id() !== $log->blog_id) {
438
+		$switched = switch_to_blog($log->blog_id);
439 439
 	}
440 440
 
441 441
 	/** @var WordPoints_Points_Logs_Viewing_Restrictions $viewing_restrictions */
442
-	$viewing_restrictions = wordpoints_component( 'points' )
443
-		->get_sub_app( 'logs' )
444
-		->get_sub_app( 'viewing_restrictions' );
442
+	$viewing_restrictions = wordpoints_component('points')
443
+		->get_sub_app('logs')
444
+		->get_sub_app('viewing_restrictions');
445 445
 
446
-	$can_view = $viewing_restrictions->get_restriction( $log )
447
-		->user_can( $user_id );
446
+	$can_view = $viewing_restrictions->get_restriction($log)
447
+		->user_can($user_id);
448 448
 
449
-	if ( $can_view ) {
450
-		$can_view = $viewing_restrictions->apply_legacy_filters( $user_id, $log );
449
+	if ($can_view) {
450
+		$can_view = $viewing_restrictions->apply_legacy_filters($user_id, $log);
451 451
 	}
452 452
 
453
-	if ( isset( $switched ) ) {
453
+	if (isset($switched)) {
454 454
 		restore_current_blog();
455 455
 	}
456 456
 
@@ -471,17 +471,17 @@  discard block
 block discarded – undo
471 471
  *
472 472
  * @return bool Whether the user can view the points log.
473 473
  */
474
-function wordpoints_hooks_user_can_view_points_log( $can_view, $user_id, $log ) {
474
+function wordpoints_hooks_user_can_view_points_log($can_view, $user_id, $log) {
475 475
 
476
-	_deprecated_function( __FUNCTION__, '2.2.0' );
476
+	_deprecated_function(__FUNCTION__, '2.2.0');
477 477
 
478
-	if ( ! $can_view ) {
478
+	if ( ! $can_view) {
479 479
 		return $can_view;
480 480
 	}
481 481
 
482
-	$restriction = new WordPoints_Points_Logs_Viewing_Restriction_Hooks( $log );
482
+	$restriction = new WordPoints_Points_Logs_Viewing_Restriction_Hooks($log);
483 483
 
484
-	return $restriction->user_can( $user_id );
484
+	return $restriction->user_can($user_id);
485 485
 }
486 486
 
487 487
 // EOF
Please login to merge, or discard this patch.
src/components/points/includes/points.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -363,7 +363,7 @@
 block discarded – undo
363 363
  *
364 364
  * @param string $type The slug for a points type.
365 365
  *
366
- * @return int|false The minimum for this type of points. False if $type is bad.
366
+ * @return integer The minimum for this type of points. False if $type is bad.
367 367
  */
368 368
 function wordpoints_get_points_minimum( $type ) {
369 369
 
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return bool Whether a points type with the given slug exists.
21 21
  */
22
-function wordpoints_is_points_type( $slug ) {
22
+function wordpoints_is_points_type($slug) {
23 23
 
24 24
 	$points_types = wordpoints_get_points_types();
25 25
 
26
-	return isset( $points_types[ $slug ] );
26
+	return isset($points_types[$slug]);
27 27
 }
28 28
 
29 29
 /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function wordpoints_get_points_types() {
57 57
 
58
-	return wordpoints_get_maybe_network_array_option( 'wordpoints_points_types' );
58
+	return wordpoints_get_maybe_network_array_option('wordpoints_points_types');
59 59
 }
60 60
 
61 61
 /**
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return array|false An array of settings for this points type. False on failure.
69 69
  */
70
-function wordpoints_get_points_type( $slug ) {
70
+function wordpoints_get_points_type($slug) {
71 71
 
72 72
 	$points_types = wordpoints_get_points_types();
73 73
 
74
-	if ( ! isset( $points_types[ $slug ] ) ) {
74
+	if ( ! isset($points_types[$slug])) {
75 75
 		return false;
76 76
 	}
77 77
 
78
-	return $points_types[ $slug ];
78
+	return $points_types[$slug];
79 79
 }
80 80
 
81 81
 /**
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
  *
92 92
  * @return string|null The value of the setting if it exists, otherwise null.
93 93
  */
94
-function wordpoints_get_points_type_setting( $slug, $setting ) {
94
+function wordpoints_get_points_type_setting($slug, $setting) {
95 95
 
96
-	$points_type = wordpoints_get_points_type( $slug );
96
+	$points_type = wordpoints_get_points_type($slug);
97 97
 
98
-	if ( isset( $points_type[ $setting ] ) ) {
99
-		return $points_type[ $setting ];
98
+	if (isset($points_type[$setting])) {
99
+		return $points_type[$setting];
100 100
 	}
101 101
 
102 102
 	return null;
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
  *
116 116
  * @return string|false The slug on success. False on failure.
117 117
  */
118
-function wordpoints_add_points_type( $settings ) {
118
+function wordpoints_add_points_type($settings) {
119 119
 
120
-	if ( ! is_array( $settings ) || ! isset( $settings['name'] ) ) {
120
+	if ( ! is_array($settings) || ! isset($settings['name'])) {
121 121
 		return false;
122 122
 	}
123 123
 
124 124
 	$slug = $settings['name'];
125
-	$slug = preg_replace( '/\s+/', '-', $slug );
126
-	$slug = preg_replace( '/-+/', '-', $slug );
127
-	$slug = trim( $slug, '-' );
128
-	$slug = sanitize_key( $slug );
125
+	$slug = preg_replace('/\s+/', '-', $slug);
126
+	$slug = preg_replace('/-+/', '-', $slug);
127
+	$slug = trim($slug, '-');
128
+	$slug = sanitize_key($slug);
129 129
 
130 130
 	$points_types = wordpoints_get_points_types();
131 131
 
132
-	if ( empty( $slug ) || isset( $points_types[ $slug ] ) ) {
132
+	if (empty($slug) || isset($points_types[$slug])) {
133 133
 		return false;
134 134
 	}
135 135
 
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @param string $slug     The slug for this points type.
143 143
 	 * @param bool   $is_new   Whether this points type is new, or being updated.
144 144
 	 */
145
-	$points_types[ $slug ] = apply_filters( 'wordpoints_points_settings', $settings, $slug, true );
145
+	$points_types[$slug] = apply_filters('wordpoints_points_settings', $settings, $slug, true);
146 146
 
147
-	if ( ! wordpoints_update_maybe_network_option( 'wordpoints_points_types', $points_types ) ) {
147
+	if ( ! wordpoints_update_maybe_network_option('wordpoints_points_types', $points_types)) {
148 148
 		return false;
149 149
 	}
150 150
 
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
  *
162 162
  * @return bool True, or false on failure, or if this points type does not exist.
163 163
  */
164
-function wordpoints_update_points_type( $slug, $settings ) {
164
+function wordpoints_update_points_type($slug, $settings) {
165 165
 
166 166
 	$points_types = wordpoints_get_points_types();
167 167
 
168
-	if ( ! is_array( $settings ) || ! isset( $points_types[ $slug ], $settings['name'] ) ) {
168
+	if ( ! is_array($settings) || ! isset($points_types[$slug], $settings['name'])) {
169 169
 		return false;
170 170
 	}
171 171
 
172 172
 	/**
173 173
 	 * @see wordpoints_add_points_type()
174 174
 	 */
175
-	$points_types[ $slug ] = apply_filters( 'wordpoints_points_settings', $settings, $slug, false );
175
+	$points_types[$slug] = apply_filters('wordpoints_points_settings', $settings, $slug, false);
176 176
 
177
-	return wordpoints_update_maybe_network_option( 'wordpoints_points_types', $points_types );
177
+	return wordpoints_update_maybe_network_option('wordpoints_points_types', $points_types);
178 178
 }
179 179
 
180 180
 /**
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @return bool Whether the points type was deleted successfully.
191 191
  */
192
-function wordpoints_delete_points_type( $slug ) {
192
+function wordpoints_delete_points_type($slug) {
193 193
 
194 194
 	$points_types = wordpoints_get_points_types();
195 195
 
196
-	if ( ! isset( $points_types[ $slug ] ) ) {
196
+	if ( ! isset($points_types[$slug])) {
197 197
 		return false;
198 198
 	}
199 199
 
@@ -205,48 +205,48 @@  discard block
 block discarded – undo
205 205
 	 * @param string $slug      The slug of the points type being deleted.
206 206
 	 * @param array  $settings The settings of the points type being deleted.
207 207
 	 */
208
-	do_action( 'wordpoints_delete_points_type', $slug, $points_types[ $slug ] );
208
+	do_action('wordpoints_delete_points_type', $slug, $points_types[$slug]);
209 209
 
210
-	$meta_key = wordpoints_get_points_user_meta_key( $slug );
210
+	$meta_key = wordpoints_get_points_user_meta_key($slug);
211 211
 
212 212
 	global $wpdb;
213 213
 
214 214
 	// Delete log meta for this points type.
215 215
 	$query = new WordPoints_Points_Logs_Query(
216
-		array( 'field' => 'id', 'points_type' => $slug )
216
+		array('field' => 'id', 'points_type' => $slug)
217 217
 	);
218 218
 
219
-	$log_ids = $query->get( 'col' );
219
+	$log_ids = $query->get('col');
220 220
 
221
-	foreach ( $log_ids as $log_id ) {
222
-		wordpoints_points_log_delete_all_metadata( $log_id );
221
+	foreach ($log_ids as $log_id) {
222
+		wordpoints_points_log_delete_all_metadata($log_id);
223 223
 	}
224 224
 
225 225
 	// Delete logs for this points type.
226
-	$wpdb->delete( $wpdb->wordpoints_points_logs, array( 'points_type' => $slug ) );
226
+	$wpdb->delete($wpdb->wordpoints_points_logs, array('points_type' => $slug));
227 227
 
228
-	wordpoints_flush_points_logs_caches( array( 'points_type' => $slug ) );
228
+	wordpoints_flush_points_logs_caches(array('points_type' => $slug));
229 229
 
230 230
 	// Delete all user points of this type.
231
-	delete_metadata( 'user', 0, wp_slash( $meta_key ), '', true );
231
+	delete_metadata('user', 0, wp_slash($meta_key), '', true);
232 232
 
233 233
 	// Delete hooks associated with this points type.
234 234
 	$points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
235 235
 
236
-	unset( $points_types_hooks[ $slug ] );
236
+	unset($points_types_hooks[$slug]);
237 237
 
238
-	WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
238
+	WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
239 239
 
240 240
 	// Delete reactions associated with this points type.
241
-	foreach ( wordpoints_hooks()->get_reaction_stores( 'points' ) as $reaction_store ) {
242
-		foreach ( $reaction_store->get_reactions() as $reaction ) {
243
-			if ( $slug === $reaction->get_meta( 'points_type' ) ) {
244
-				$reaction_store->delete_reaction( $reaction->get_id() );
241
+	foreach (wordpoints_hooks()->get_reaction_stores('points') as $reaction_store) {
242
+		foreach ($reaction_store->get_reactions() as $reaction) {
243
+			if ($slug === $reaction->get_meta('points_type')) {
244
+				$reaction_store->delete_reaction($reaction->get_id());
245 245
 			}
246 246
 		}
247 247
 	}
248 248
 
249
-	unset( $points_types[ $slug ] );
249
+	unset($points_types[$slug]);
250 250
 
251 251
 	wordpoints_update_maybe_network_option(
252 252
 		'wordpoints_points_types'
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
  *
280 280
  * @return string|false The user meta meta_key for a points type, or false.
281 281
  */
282
-function wordpoints_get_points_user_meta_key( $points_type ) {
282
+function wordpoints_get_points_user_meta_key($points_type) {
283 283
 
284
-	if ( ! wordpoints_is_points_type( $points_type ) ) {
284
+	if ( ! wordpoints_is_points_type($points_type)) {
285 285
 		return false;
286 286
 	}
287 287
 
288
-	$setting = wordpoints_get_points_type_setting( $points_type, 'meta_key' );
288
+	$setting = wordpoints_get_points_type_setting($points_type, 'meta_key');
289 289
 
290
-	if ( ! empty( $setting ) ) {
290
+	if ( ! empty($setting)) {
291 291
 
292 292
 		$meta_key = $setting;
293 293
 
294
-	} elseif ( ! is_multisite() || is_wordpoints_network_active() ) {
294
+	} elseif ( ! is_multisite() || is_wordpoints_network_active()) {
295 295
 
296 296
 		$meta_key = "wordpoints_points-{$points_type}";
297 297
 
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return int|false The user's points, or false on failure.
319 319
  */
320
-function wordpoints_get_points( $user_id, $type ) {
320
+function wordpoints_get_points($user_id, $type) {
321 321
 
322
-	if ( ! wordpoints_posint( $user_id ) || ! wordpoints_is_points_type( $type ) ) {
322
+	if ( ! wordpoints_posint($user_id) || ! wordpoints_is_points_type($type)) {
323 323
 		return false;
324 324
 	}
325 325
 
326
-	$points = get_user_meta( $user_id, wordpoints_get_points_user_meta_key( $type ), true );
326
+	$points = get_user_meta($user_id, wordpoints_get_points_user_meta_key($type), true);
327 327
 
328
-	return (int) wordpoints_int( $points );
328
+	return (int) wordpoints_int($points);
329 329
 }
330 330
 
331 331
 /**
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @return int|false The minimum for this type of points. False if $type is bad.
369 369
  */
370
-function wordpoints_get_points_minimum( $type ) {
370
+function wordpoints_get_points_minimum($type) {
371 371
 
372
-	if ( ! wordpoints_is_points_type( $type ) ) {
372
+	if ( ! wordpoints_is_points_type($type)) {
373 373
 		return false;
374 374
 	}
375 375
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @param int    $minimum The minimum number of points.
382 382
 	 * @param string $type    The points type slug.
383 383
 	 */
384
-	return apply_filters( 'wordpoints_points_minimum', 0, $type );
384
+	return apply_filters('wordpoints_points_minimum', 0, $type);
385 385
 }
386 386
 
387 387
 /**
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
  *
403 403
  * @return string The integer value of $points formatted for display.
404 404
  */
405
-function wordpoints_format_points( $points, $type, $context ) {
405
+function wordpoints_format_points($points, $type, $context) {
406 406
 
407 407
 	$_points = $points;
408
-	wordpoints_int( $_points );
408
+	wordpoints_int($_points);
409 409
 
410
-	if ( false === $_points || ! wordpoints_is_points_type( $type ) ) {
410
+	if (false === $_points || ! wordpoints_is_points_type($type)) {
411 411
 		return (string) $points;
412 412
 	}
413 413
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 * @param string $type      The type of points.
422 422
 	 * @param string $context   The context in which the points will be displayed.
423 423
 	 */
424
-	return apply_filters( 'wordpoints_format_points', $_points, $_points, $type, $context );
424
+	return apply_filters('wordpoints_format_points', $_points, $_points, $type, $context);
425 425
 }
426 426
 
427 427
 /**
@@ -438,15 +438,15 @@  discard block
 block discarded – undo
438 438
  *
439 439
  * @return string|false The user's points formatted for display, or false on failure.
440 440
  */
441
-function wordpoints_get_formatted_points( $user_id, $type, $context ) {
441
+function wordpoints_get_formatted_points($user_id, $type, $context) {
442 442
 
443
-	$points = wordpoints_get_points( $user_id, $type );
443
+	$points = wordpoints_get_points($user_id, $type);
444 444
 
445
-	if ( false === $points ) {
445
+	if (false === $points) {
446 446
 		return false;
447 447
 	}
448 448
 
449
-	return wordpoints_format_points( $points, $type, $context );
449
+	return wordpoints_format_points($points, $type, $context);
450 450
 }
451 451
 
452 452
 /**
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
  * @param string $type    The type of points to display.
461 461
  * @param string $context The context in which the points will be displayed.
462 462
  */
463
-function wordpoints_display_points( $user_id, $type, $context ) {
463
+function wordpoints_display_points($user_id, $type, $context) {
464 464
 
465
-	echo wordpoints_get_formatted_points( $user_id, $type, $context ); // XSS OK, WPCS
465
+	echo wordpoints_get_formatted_points($user_id, $type, $context); // XSS OK, WPCS
466 466
 }
467 467
 
468 468
 /**
@@ -485,21 +485,21 @@  discard block
 block discarded – undo
485 485
  *
486 486
  * @return int|false False on failure.
487 487
  */
488
-function wordpoints_get_points_above_minimum( $user_id, $type ) {
488
+function wordpoints_get_points_above_minimum($user_id, $type) {
489 489
 
490
-	$minimum = wordpoints_get_points_minimum( $type );
490
+	$minimum = wordpoints_get_points_minimum($type);
491 491
 
492
-	if ( false === $minimum ) {
492
+	if (false === $minimum) {
493 493
 		return false;
494 494
 	}
495 495
 
496
-	$points = wordpoints_get_points( $user_id, $type );
496
+	$points = wordpoints_get_points($user_id, $type);
497 497
 
498
-	if ( false === $points ) {
498
+	if (false === $points) {
499 499
 		return false;
500 500
 	}
501 501
 
502
-	return max( 0, $points - $minimum );
502
+	return max(0, $points - $minimum);
503 503
 }
504 504
 
505 505
 /**
@@ -521,19 +521,19 @@  discard block
 block discarded – undo
521 521
  *
522 522
  * @return bool Whether the transaction was successful.
523 523
  */
524
-function wordpoints_set_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
524
+function wordpoints_set_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
525 525
 
526
-	if ( false === wordpoints_int( $points ) ) {
526
+	if (false === wordpoints_int($points)) {
527 527
 		return false;
528 528
 	}
529 529
 
530
-	$current = wordpoints_get_points( $user_id, $points_type );
530
+	$current = wordpoints_get_points($user_id, $points_type);
531 531
 
532
-	if ( false === $current ) {
532
+	if (false === $current) {
533 533
 		return false;
534 534
 	}
535 535
 
536
-	return wordpoints_alter_points( $user_id, $points - $current, $points_type, $log_type, $meta, $log_text );
536
+	return wordpoints_alter_points($user_id, $points - $current, $points_type, $log_type, $meta, $log_text);
537 537
 }
538 538
 
539 539
 /**
@@ -576,13 +576,13 @@  discard block
 block discarded – undo
576 576
  * @return int|bool On success, the log ID if the transaction is logged, or true if
577 577
  *                  it is not. False on failure.
578 578
  */
579
-function wordpoints_alter_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
579
+function wordpoints_alter_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
580 580
 
581 581
 	if (
582
-		! wordpoints_posint( $user_id )
583
-		|| ! wordpoints_int( $points )
584
-		|| ! wordpoints_is_points_type( $points_type )
585
-		|| empty( $log_type )
582
+		! wordpoints_posint($user_id)
583
+		|| ! wordpoints_int($points)
584
+		|| ! wordpoints_is_points_type($points_type)
585
+		|| empty($log_type)
586 586
 	) {
587 587
 		return false;
588 588
 	}
@@ -606,29 +606,29 @@  discard block
 block discarded – undo
606 606
 	 * @param string $log_type    The type of transaction.
607 607
 	 * @param array  $meta        Metadata for the transaction.
608 608
 	 */
609
-	$points = apply_filters( 'wordpoints_alter_points', $points, $points_type, $user_id, $log_type, $meta );
609
+	$points = apply_filters('wordpoints_alter_points', $points, $points_type, $user_id, $log_type, $meta);
610 610
 
611
-	if ( 0 === wordpoints_int( $points ) ) {
611
+	if (0 === wordpoints_int($points)) {
612 612
 		return true;
613
-	} elseif ( false === $points ) {
613
+	} elseif (false === $points) {
614 614
 		return false;
615 615
 	}
616 616
 
617 617
 	// Get the current points so we can check this won't go below the minimum.
618
-	$current_points = wordpoints_get_points( $user_id, $points_type );
619
-	$minimum = wordpoints_get_points_minimum( $points_type );
618
+	$current_points = wordpoints_get_points($user_id, $points_type);
619
+	$minimum = wordpoints_get_points_minimum($points_type);
620 620
 
621
-	if ( ( $current_points + $points ) < $minimum ) {
621
+	if (($current_points + $points) < $minimum) {
622 622
 
623 623
 		// The total was less than the minimum, set the number to the minimum.
624 624
 		$points = $minimum - $current_points;
625 625
 	}
626 626
 
627
-	$meta_key = wordpoints_get_points_user_meta_key( $points_type );
627
+	$meta_key = wordpoints_get_points_user_meta_key($points_type);
628 628
 
629
-	if ( '' === get_user_meta( $user_id, $meta_key, true ) ) {
629
+	if ('' === get_user_meta($user_id, $meta_key, true)) {
630 630
 
631
-		$result = add_user_meta( $user_id, wp_slash( $meta_key ), (int) $points, true );
631
+		$result = add_user_meta($user_id, wp_slash($meta_key), (int) $points, true);
632 632
 
633 633
 	} else {
634 634
 
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 			)
648 648
 		);
649 649
 
650
-		wp_cache_delete( $user_id, 'user_meta' );
650
+		wp_cache_delete($user_id, 'user_meta');
651 651
 	}
652 652
 
653
-	if ( ! $result ) {
653
+	if ( ! $result) {
654 654
 		return false;
655 655
 	}
656 656
 
@@ -664,15 +664,15 @@  discard block
 block discarded – undo
664 664
 	 * @param string $log_type        The type of transaction.
665 665
 	 * @param array  $meta            The metadata for this transaction.
666 666
 	 */
667
-	$log_transaction = apply_filters( 'wordpoints_points_log', true, $user_id, $points, $points_type, $log_type, $meta );
667
+	$log_transaction = apply_filters('wordpoints_points_log', true, $user_id, $points, $points_type, $log_type, $meta);
668 668
 
669 669
 	$log_id = false;
670
-	if ( $log_transaction ) {
670
+	if ($log_transaction) {
671 671
 
672
-		$log_text = wordpoints_render_points_log_text( $user_id, $points, $points_type, $log_type, $meta, $log_text );
672
+		$log_text = wordpoints_render_points_log_text($user_id, $points, $points_type, $log_type, $meta, $log_text);
673 673
 
674
-		if ( 'utf8' === $wpdb->get_col_charset( $wpdb->wordpoints_points_logs, 'text' ) ) {
675
-			$log_text = wp_encode_emoji( $log_text );
674
+		if ('utf8' === $wpdb->get_col_charset($wpdb->wordpoints_points_logs, 'text')) {
675
+			$log_text = wp_encode_emoji($log_text);
676 676
 		}
677 677
 
678 678
 		$result = $wpdb->insert(
@@ -683,20 +683,20 @@  discard block
 block discarded – undo
683 683
 				'points_type' => $points_type,
684 684
 				'log_type'    => $log_type,
685 685
 				'text'        => $log_text,
686
-				'date'        => current_time( 'mysql', 1 ),
686
+				'date'        => current_time('mysql', 1),
687 687
 				'site_id'     => $wpdb->siteid,
688 688
 				'blog_id'     => $wpdb->blogid,
689 689
 			),
690
-			array( '%d', '%d', '%s', '%s', '%s', '%s', '%d', '%d' )
690
+			array('%d', '%d', '%s', '%s', '%s', '%s', '%d', '%d')
691 691
 		);
692 692
 
693
-		if ( false !== $result ) {
693
+		if (false !== $result) {
694 694
 
695 695
 			$log_id = (int) $wpdb->insert_id;
696 696
 
697
-			foreach ( $meta as $meta_key => $meta_value ) {
697
+			foreach ($meta as $meta_key => $meta_value) {
698 698
 
699
-				wordpoints_add_points_log_meta( $log_id, $meta_key, $meta_value );
699
+				wordpoints_add_points_log_meta($log_id, $meta_key, $meta_value);
700 700
 			}
701 701
 
702 702
 			/**
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			 * @param array  $meta        Metadata for the transaction.
713 713
 			 * @param int    $log_id      The ID of the transaction log entry.
714 714
 			 */
715
-			do_action( 'wordpoints_points_log', $user_id, $points, $points_type, $log_type, $meta, $log_id );
715
+			do_action('wordpoints_points_log', $user_id, $points, $points_type, $log_type, $meta, $log_id);
716 716
 		}
717 717
 
718 718
 	}  // End if ( $log_transaction ).
@@ -730,9 +730,9 @@  discard block
 block discarded – undo
730 730
 	 * @param array  $meta        Metadata for the transaction.
731 731
 	 * @param int|false $log_id   The ID of the transaction log, or false if not logged.
732 732
 	 */
733
-	do_action( 'wordpoints_points_altered', $user_id, $points, $points_type, $log_type, $meta, $log_id );
733
+	do_action('wordpoints_points_altered', $user_id, $points, $points_type, $log_type, $meta, $log_id);
734 734
 
735
-	if ( $log_id ) {
735
+	if ($log_id) {
736 736
 		return $log_id;
737 737
 	} else {
738 738
 		return true;
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
  *
759 759
  * @return bool Whether the points were added successfully.
760 760
  */
761
-function wordpoints_add_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
761
+function wordpoints_add_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
762 762
 
763
-	return wordpoints_alter_points( $user_id, wordpoints_posint( $points ), $points_type, $log_type, $meta, $log_text );
763
+	return wordpoints_alter_points($user_id, wordpoints_posint($points), $points_type, $log_type, $meta, $log_text);
764 764
 }
765 765
 
766 766
 /**
@@ -781,9 +781,9 @@  discard block
 block discarded – undo
781 781
  *
782 782
  * @return bool Whether the points were subtracted successfully.
783 783
  */
784
-function wordpoints_subtract_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
784
+function wordpoints_subtract_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
785 785
 
786
-	return wordpoints_alter_points( $user_id, -wordpoints_posint( $points ), $points_type, $log_type, $meta, $log_text );
786
+	return wordpoints_alter_points($user_id, -wordpoints_posint($points), $points_type, $log_type, $meta, $log_text);
787 787
 }
788 788
 
789 789
 /**
@@ -795,9 +795,9 @@  discard block
 block discarded – undo
795 795
  *
796 796
  * @return string The corrected column name.
797 797
  */
798
-function _wordpoints_points_log_meta_column( $column ) {
798
+function _wordpoints_points_log_meta_column($column) {
799 799
 
800
-	if ( 'wordpoints_points_log_id' === $column ) {
800
+	if ('wordpoints_points_log_id' === $column) {
801 801
 		$column = 'log_id';
802 802
 	}
803 803
 
@@ -822,23 +822,23 @@  discard block
 block discarded – undo
822 822
  *
823 823
  * @return bool Whether the metadata was added successfully.
824 824
  */
825
-function wordpoints_add_points_log_meta( $log_id, $meta_key, $meta_value, $unique = false ) {
825
+function wordpoints_add_points_log_meta($log_id, $meta_key, $meta_value, $unique = false) {
826 826
 
827 827
 	global $wpdb;
828 828
 
829
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
829
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
830 830
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
831 831
 
832 832
 	$result = add_metadata(
833 833
 		'wordpoints_points_log'
834 834
 		, $log_id
835
-		, wp_slash( $meta_key )
836
-		, wp_slash( $meta_value )
835
+		, wp_slash($meta_key)
836
+		, wp_slash($meta_value)
837 837
 		, $unique
838 838
 	);
839 839
 
840
-	unset( $wpdb->wordpoints_points_logmeta );
841
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
840
+	unset($wpdb->wordpoints_points_logmeta);
841
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
842 842
 
843 843
 	return $result;
844 844
 }
@@ -857,15 +857,15 @@  discard block
 block discarded – undo
857 857
  *
858 858
  * @return mixed The meta key, or null on failure.
859 859
  */
860
-function wordpoints_get_points_log_meta( $log_id, $meta_key = '', $single = false ) {
860
+function wordpoints_get_points_log_meta($log_id, $meta_key = '', $single = false) {
861 861
 
862 862
 	global $wpdb;
863 863
 
864
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
864
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
865 865
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
866
-	$result = get_metadata( 'wordpoints_points_log', $log_id, $meta_key, $single );
867
-	unset( $wpdb->wordpoints_points_logmeta );
868
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
866
+	$result = get_metadata('wordpoints_points_log', $log_id, $meta_key, $single);
867
+	unset($wpdb->wordpoints_points_logmeta);
868
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
869 869
 
870 870
 	return $result;
871 871
 }
@@ -885,23 +885,23 @@  discard block
 block discarded – undo
885 885
  *
886 886
  * @return bool Whether any rows were updated.
887 887
  */
888
-function wordpoints_update_points_log_meta( $log_id, $meta_key, $meta_value, $previous = null ) {
888
+function wordpoints_update_points_log_meta($log_id, $meta_key, $meta_value, $previous = null) {
889 889
 
890 890
 	global $wpdb;
891 891
 
892
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
892
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
893 893
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
894 894
 
895 895
 	$result = update_metadata(
896 896
 		'wordpoints_points_log'
897 897
 		, $log_id
898
-		, wp_slash( $meta_key )
899
-		, wp_slash( $meta_value )
898
+		, wp_slash($meta_key)
899
+		, wp_slash($meta_value)
900 900
 		, $previous
901 901
 	);
902 902
 
903
-	unset( $wpdb->wordpoints_points_logmeta );
904
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
903
+	unset($wpdb->wordpoints_points_logmeta);
904
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
905 905
 
906 906
 	return $result;
907 907
 }
@@ -922,23 +922,23 @@  discard block
 block discarded – undo
922 922
  *
923 923
  * @return bool Whether any rows where deleted.
924 924
  */
925
-function wordpoints_delete_points_log_meta( $log_id, $meta_key = '', $meta_value = null, $delete_all = false ) {
925
+function wordpoints_delete_points_log_meta($log_id, $meta_key = '', $meta_value = null, $delete_all = false) {
926 926
 
927 927
 	global $wpdb;
928 928
 
929
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
929
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
930 930
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
931 931
 
932 932
 	$result = delete_metadata(
933 933
 		'wordpoints_points_log'
934 934
 		, $log_id
935
-		, wp_slash( $meta_key )
936
-		, wp_slash( $meta_value )
935
+		, wp_slash($meta_key)
936
+		, wp_slash($meta_value)
937 937
 		, $delete_all
938 938
 	);
939 939
 
940
-	unset( $wpdb->wordpoints_points_logmeta );
941
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
940
+	unset($wpdb->wordpoints_points_logmeta);
941
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
942 942
 
943 943
 	return $result;
944 944
 }
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
  *
951 951
  * @param int $log_id The ID of the points log whose metadata to delete.
952 952
  */
953
-function wordpoints_points_log_delete_all_metadata( $log_id ) {
953
+function wordpoints_points_log_delete_all_metadata($log_id) {
954 954
 
955 955
 	global $wpdb;
956 956
 
@@ -965,15 +965,15 @@  discard block
 block discarded – undo
965 965
 		)
966 966
 	); // WPCS: cache pass.
967 967
 
968
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
968
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
969 969
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
970 970
 
971
-	foreach ( $meta_ids as $mid ) {
972
-		delete_metadata_by_mid( 'wordpoints_points_log', $mid );
971
+	foreach ($meta_ids as $mid) {
972
+		delete_metadata_by_mid('wordpoints_points_log', $mid);
973 973
 	}
974 974
 
975
-	unset( $wpdb->wordpoints_points_logmeta );
976
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
975
+	unset($wpdb->wordpoints_points_logmeta);
976
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
977 977
 }
978 978
 
979 979
 /**
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 		'wordpoints_default_points_type'
990 990
 	);
991 991
 
992
-	if ( ! wordpoints_is_points_type( $points_type ) ) {
992
+	if ( ! wordpoints_is_points_type($points_type)) {
993 993
 		return false;
994 994
 	}
995 995
 
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @return string The log text.
1012 1012
  */
1013
-function wordpoints_render_points_log_text( $user_id, $points, $points_type, $log_type, $meta, $default_text = '' ) {
1013
+function wordpoints_render_points_log_text($user_id, $points, $points_type, $log_type, $meta, $default_text = '') {
1014 1014
 
1015 1015
 	/**
1016 1016
 	 * The text for a points log entry.
@@ -1022,10 +1022,10 @@  discard block
 block discarded – undo
1022 1022
 	 * @param string $log_type    The type of transaction being logged.
1023 1023
 	 * @param array  $meta        The metadata for this transaction.
1024 1024
 	 */
1025
-	$text = apply_filters( "wordpoints_points_log-{$log_type}", $default_text, $user_id, $points, $points_type, $log_type, $meta );
1025
+	$text = apply_filters("wordpoints_points_log-{$log_type}", $default_text, $user_id, $points, $points_type, $log_type, $meta);
1026 1026
 
1027
-	if ( empty( $text ) ) {
1028
-		$text = _x( '(no description)', 'points log', 'wordpoints' );
1027
+	if (empty($text)) {
1028
+		$text = _x('(no description)', 'points log', 'wordpoints');
1029 1029
 	}
1030 1030
 
1031 1031
 	return $text;
@@ -1041,32 +1041,32 @@  discard block
 block discarded – undo
1041 1041
  *
1042 1042
  * @return void
1043 1043
  */
1044
-function wordpoints_regenerate_points_logs( $logs ) {
1044
+function wordpoints_regenerate_points_logs($logs) {
1045 1045
 
1046
-	if ( empty( $logs ) || ! is_array( $logs ) ) {
1046
+	if (empty($logs) || ! is_array($logs)) {
1047 1047
 		return;
1048 1048
 	}
1049 1049
 
1050
-	if ( ! is_object( current( $logs ) ) ) {
1050
+	if ( ! is_object(current($logs))) {
1051 1051
 
1052
-		_deprecated_argument( __FUNCTION__, '1.6.0', 'The first parameter should be an array of log objects, not log IDs.' );
1052
+		_deprecated_argument(__FUNCTION__, '1.6.0', 'The first parameter should be an array of log objects, not log IDs.');
1053 1053
 
1054
-		$logs = new WordPoints_Points_Logs_Query( array( 'id__in' => $logs ) );
1054
+		$logs = new WordPoints_Points_Logs_Query(array('id__in' => $logs));
1055 1055
 		$logs = $logs->get();
1056 1056
 
1057
-		if ( ! is_array( $logs ) ) {
1057
+		if ( ! is_array($logs)) {
1058 1058
 			return;
1059 1059
 		}
1060 1060
 	}
1061 1061
 
1062 1062
 	global $wpdb;
1063 1063
 
1064
-	$flushed = array( 'points_types' => array(), 'user_ids' => array() );
1064
+	$flushed = array('points_types' => array(), 'user_ids' => array());
1065 1065
 
1066
-	foreach ( $logs as $log ) {
1066
+	foreach ($logs as $log) {
1067 1067
 
1068
-		$meta = wordpoints_get_points_log_meta( $log->id );
1069
-		$meta = wp_list_pluck( $meta, 0 );
1068
+		$meta = wordpoints_get_points_log_meta($log->id);
1069
+		$meta = wp_list_pluck($meta, 0);
1070 1070
 
1071 1071
 		$new_log_text = wordpoints_render_points_log_text(
1072 1072
 			$log->user_id
@@ -1076,31 +1076,31 @@  discard block
 block discarded – undo
1076 1076
 			, $meta
1077 1077
 		);
1078 1078
 
1079
-		if ( $new_log_text !== $log->text ) {
1079
+		if ($new_log_text !== $log->text) {
1080 1080
 
1081
-			if ( ! isset( $is_utf8 ) ) {
1082
-				$is_utf8 = 'utf8' === $wpdb->get_col_charset( $wpdb->wordpoints_points_logs, 'text' );
1081
+			if ( ! isset($is_utf8)) {
1082
+				$is_utf8 = 'utf8' === $wpdb->get_col_charset($wpdb->wordpoints_points_logs, 'text');
1083 1083
 			}
1084 1084
 
1085
-			if ( $is_utf8 ) {
1086
-				$new_log_text = wp_encode_emoji( $new_log_text );
1085
+			if ($is_utf8) {
1086
+				$new_log_text = wp_encode_emoji($new_log_text);
1087 1087
 			}
1088 1088
 
1089 1089
 			$wpdb->update(
1090 1090
 				$wpdb->wordpoints_points_logs
1091
-				, array( 'text' => $new_log_text )
1092
-				, array( 'id' => $log->id )
1093
-				, array( '%s' )
1094
-				, array( '%d' )
1091
+				, array('text' => $new_log_text)
1092
+				, array('id' => $log->id)
1093
+				, array('%s')
1094
+				, array('%d')
1095 1095
 			);
1096 1096
 
1097
-			if ( ! isset( $flushed['points_types'][ $log->points_type ], $flushed['user_ids'][ $log->user_id ] ) ) {
1097
+			if ( ! isset($flushed['points_types'][$log->points_type], $flushed['user_ids'][$log->user_id])) {
1098 1098
 				wordpoints_flush_points_logs_caches(
1099
-					array( 'user_id' => $log->user_id, 'points_type' => $log->points_type )
1099
+					array('user_id' => $log->user_id, 'points_type' => $log->points_type)
1100 1100
 				);
1101 1101
 
1102
-				$flushed['points_types'][ $log->points_type ] = true;
1103
-				$flushed['user_ids'][ $log->user_id ] = true;
1102
+				$flushed['points_types'][$log->points_type] = true;
1103
+				$flushed['user_ids'][$log->user_id] = true;
1104 1104
 			}
1105 1105
 		}
1106 1106
 
@@ -1122,35 +1122,35 @@  discard block
 block discarded – undo
1122 1122
  * @return int[]|false The IDs of the users with the most points, or false if the
1123 1123
  *                     args are invalid.
1124 1124
  */
1125
-function wordpoints_points_get_top_users( $num_users, $points_type ) {
1125
+function wordpoints_points_get_top_users($num_users, $points_type) {
1126 1126
 
1127
-	if ( ! wordpoints_posint( $num_users ) || ! wordpoints_is_points_type( $points_type ) ) {
1127
+	if ( ! wordpoints_posint($num_users) || ! wordpoints_is_points_type($points_type)) {
1128 1128
 		return false;
1129 1129
 	}
1130 1130
 
1131
-	$cache = wp_cache_get( $points_type, 'wordpoints_points_top_users' );
1131
+	$cache = wp_cache_get($points_type, 'wordpoints_points_top_users');
1132 1132
 
1133
-	if ( ! is_array( $cache ) ) {
1134
-		$cache = array( 'is_max' => false, 'top_users' => array() );
1133
+	if ( ! is_array($cache)) {
1134
+		$cache = array('is_max' => false, 'top_users' => array());
1135 1135
 	}
1136 1136
 
1137
-	$cached_users = count( $cache['top_users'] );
1137
+	$cached_users = count($cache['top_users']);
1138 1138
 
1139
-	if ( $num_users > $cached_users && ! $cache['is_max'] ) {
1139
+	if ($num_users > $cached_users && ! $cache['is_max']) {
1140 1140
 
1141 1141
 		global $wpdb;
1142 1142
 
1143
-		$excluded = wordpoints_get_excluded_users( 'top_users' );
1143
+		$excluded = wordpoints_get_excluded_users('top_users');
1144 1144
 
1145 1145
 		$exclude_users = '';
1146
-		if ( ! empty( $excluded ) ) {
1147
-			$exclude_users = 'WHERE `ID` NOT IN (' . wordpoints_prepare__in( $excluded, '%d' ) . ')';
1146
+		if ( ! empty($excluded)) {
1147
+			$exclude_users = 'WHERE `ID` NOT IN (' . wordpoints_prepare__in($excluded, '%d') . ')';
1148 1148
 		}
1149 1149
 
1150 1150
 		$multisite_join = '';
1151
-		if ( is_multisite() && ! is_wordpoints_network_active() ) {
1151
+		if (is_multisite() && ! is_wordpoints_network_active()) {
1152 1152
 
1153
-			$prefix = $wpdb->get_blog_prefix( get_current_blog_id() );
1153
+			$prefix = $wpdb->get_blog_prefix(get_current_blog_id());
1154 1154
 
1155 1155
 			$multisite_join = "
1156 1156
 					INNER JOIN `{$wpdb->usermeta}` AS `cap`
@@ -1175,27 +1175,27 @@  discard block
 block discarded – undo
1175 1175
 					ORDER BY COALESCE(CONVERT(`meta`.`meta_value`, SIGNED INTEGER), 0) DESC
1176 1176
 					LIMIT %d,%d
1177 1177
 				",
1178
-				wordpoints_get_points_user_meta_key( $points_type ),
1178
+				wordpoints_get_points_user_meta_key($points_type),
1179 1179
 				$cached_users,
1180 1180
 				$num_users
1181 1181
 			)
1182 1182
 		);
1183 1183
 
1184
-		if ( ! is_array( $top_users ) ) {
1184
+		if ( ! is_array($top_users)) {
1185 1185
 			return array();
1186 1186
 		}
1187 1187
 
1188
-		$cache['top_users'] = array_merge( $cache['top_users'], $top_users );
1188
+		$cache['top_users'] = array_merge($cache['top_users'], $top_users);
1189 1189
 
1190
-		if ( count( $cache['top_users'] ) < $num_users ) {
1190
+		if (count($cache['top_users']) < $num_users) {
1191 1191
 			$cache['is_max'] = true;
1192 1192
 		}
1193 1193
 
1194
-		wp_cache_set( $points_type, $cache, 'wordpoints_points_top_users' );
1194
+		wp_cache_set($points_type, $cache, 'wordpoints_points_top_users');
1195 1195
 
1196 1196
 	} // End if ( not cached ).
1197 1197
 
1198
-	return array_slice( $cache['top_users'], 0, $num_users );
1198
+	return array_slice($cache['top_users'], 0, $num_users);
1199 1199
 }
1200 1200
 
1201 1201
 /**
@@ -1207,25 +1207,25 @@  discard block
 block discarded – undo
1207 1207
  * @param string $points_type The type of points.
1208 1208
  * @param string $context     The context in which the table is being displayed.
1209 1209
  */
1210
-function wordpoints_points_show_top_users( $num_users, $points_type, $context = 'default' ) {
1210
+function wordpoints_points_show_top_users($num_users, $points_type, $context = 'default') {
1211 1211
 
1212
-	wp_enqueue_style( 'wordpoints-top-users' );
1212
+	wp_enqueue_style('wordpoints-top-users');
1213 1213
 
1214
-	$top_users = wordpoints_points_get_top_users( $num_users, $points_type );
1214
+	$top_users = wordpoints_points_get_top_users($num_users, $points_type);
1215 1215
 
1216
-	if ( ! $top_users ) {
1216
+	if ( ! $top_users) {
1217 1217
 		return;
1218 1218
 	}
1219 1219
 
1220 1220
 	$column_headers = array(
1221
-		'position' => _x( 'Position', 'top users table heading', 'wordpoints' ),
1222
-		'user'     => _x( 'User', 'top users table heading', 'wordpoints' ),
1223
-		'points'   => _x( 'Points', 'top users table heading', 'wordpoints' ),
1221
+		'position' => _x('Position', 'top users table heading', 'wordpoints'),
1222
+		'user'     => _x('User', 'top users table heading', 'wordpoints'),
1223
+		'points'   => _x('Points', 'top users table heading', 'wordpoints'),
1224 1224
 	);
1225 1225
 
1226
-	$points_type_name = wordpoints_get_points_type_setting( $points_type, 'name' );
1226
+	$points_type_name = wordpoints_get_points_type_setting($points_type, 'name');
1227 1227
 
1228
-	if ( ! empty( $points_type_name ) ) {
1228
+	if ( ! empty($points_type_name)) {
1229 1229
 		$column_headers['points'] = $points_type_name;
1230 1230
 	}
1231 1231
 
@@ -1241,18 +1241,18 @@  discard block
 block discarded – undo
1241 1241
 	$extra_classes = apply_filters(
1242 1242
 		'wordpoints_points_top_users_table_extra_classes'
1243 1243
 		, array()
1244
-		, compact( 'num_users', 'points_type', 'context' )
1244
+		, compact('num_users', 'points_type', 'context')
1245 1245
 		, $top_users
1246 1246
 	);
1247 1247
 
1248 1248
 	?>
1249 1249
 
1250
-	<table class="wordpoints-points-top-users <?php echo esc_attr( implode( ' ', $extra_classes ) ); ?>">
1250
+	<table class="wordpoints-points-top-users <?php echo esc_attr(implode(' ', $extra_classes)); ?>">
1251 1251
 		<thead>
1252 1252
 			<tr>
1253
-				<th scope="col"><?php echo esc_html( $column_headers['position'] ); ?></th>
1254
-				<th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th>
1255
-				<th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th>
1253
+				<th scope="col"><?php echo esc_html($column_headers['position']); ?></th>
1254
+				<th scope="col"><?php echo esc_html($column_headers['user']); ?></th>
1255
+				<th scope="col"><?php echo esc_html($column_headers['points']); ?></th>
1256 1256
 			</tr>
1257 1257
 		</thead>
1258 1258
 		<tbody>
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
 			$position = 1;
1262 1262
 
1263
-			foreach ( $top_users as $user_id ) {
1263
+			foreach ($top_users as $user_id) {
1264 1264
 
1265
-				$user = get_userdata( $user_id );
1265
+				$user = get_userdata($user_id);
1266 1266
 
1267 1267
 				?>
1268 1268
 
1269 1269
 				<tr class="top-<?php echo (int) $position; ?>">
1270
-					<td><?php echo esc_html( number_format_i18n( $position ) ); ?></td>
1270
+					<td><?php echo esc_html(number_format_i18n($position)); ?></td>
1271 1271
 					<td>
1272
-						<?php echo get_avatar( $user_id, 32 ); ?>
1272
+						<?php echo get_avatar($user_id, 32); ?>
1273 1273
 						<?php
1274 1274
 
1275 1275
 						$name = sanitize_user_field(
@@ -1291,13 +1291,13 @@  discard block
 block discarded – undo
1291 1291
 						 * @param string $points_type The points type the table is for.
1292 1292
 						 * @param string $context     The context in which the table is being displayed.
1293 1293
 						 */
1294
-						$name = apply_filters( 'wordpoints_points_top_users_username', $name, $user_id, $points_type, "top_users_{$context}" );
1294
+						$name = apply_filters('wordpoints_points_top_users_username', $name, $user_id, $points_type, "top_users_{$context}");
1295 1295
 
1296
-						echo wp_kses( $name, 'wordpoints_top_users_username' );
1296
+						echo wp_kses($name, 'wordpoints_top_users_username');
1297 1297
 
1298 1298
 						?>
1299 1299
 					</td>
1300
-					<td><?php wordpoints_display_points( $user_id, $points_type, "top_users_{$context}" ); ?></td>
1300
+					<td><?php wordpoints_display_points($user_id, $points_type, "top_users_{$context}"); ?></td>
1301 1301
 				</tr>
1302 1302
 
1303 1303
 				<?php
@@ -1310,9 +1310,9 @@  discard block
 block discarded – undo
1310 1310
 		</tbody>
1311 1311
 		<tfoot>
1312 1312
 		<tr>
1313
-			<th scope="col"><?php echo esc_html( $column_headers['position'] ); ?></th>
1314
-			<th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th>
1315
-			<th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th>
1313
+			<th scope="col"><?php echo esc_html($column_headers['position']); ?></th>
1314
+			<th scope="col"><?php echo esc_html($column_headers['user']); ?></th>
1315
+			<th scope="col"><?php echo esc_html($column_headers['points']); ?></th>
1316 1316
 		</tr>
1317 1317
 		</tfoot>
1318 1318
 	</table>
@@ -1332,9 +1332,9 @@  discard block
 block discarded – undo
1332 1332
  * @param int    $points      The number of points. Not used.
1333 1333
  * @param string $points_type The type of points being awarded.
1334 1334
  */
1335
-function wordpoints_clean_points_top_users_cache( $user_id, $points, $points_type ) {
1335
+function wordpoints_clean_points_top_users_cache($user_id, $points, $points_type) {
1336 1336
 
1337
-	wp_cache_delete( $points_type, 'wordpoints_points_top_users' );
1337
+	wp_cache_delete($points_type, 'wordpoints_points_top_users');
1338 1338
 }
1339 1339
 
1340 1340
 /**
@@ -1346,16 +1346,16 @@  discard block
 block discarded – undo
1346 1346
  */
1347 1347
 function wordpoints_clean_points_top_users_cache_user_register() {
1348 1348
 
1349
-	foreach ( wordpoints_get_points_types() as $slug => $unused ) {
1349
+	foreach (wordpoints_get_points_types() as $slug => $unused) {
1350 1350
 
1351
-		$cache = wp_cache_get( $slug, 'wordpoints_points_top_users' );
1351
+		$cache = wp_cache_get($slug, 'wordpoints_points_top_users');
1352 1352
 
1353 1353
 		// If there aren't fewer users than the cache holds, we don't need to clear it.
1354
-		if ( ! is_array( $cache ) || ! $cache['is_max'] ) {
1354
+		if ( ! is_array($cache) || ! $cache['is_max']) {
1355 1355
 			continue;
1356 1356
 		}
1357 1357
 
1358
-		wp_cache_delete( $slug, 'wordpoints_points_top_users' );
1358
+		wp_cache_delete($slug, 'wordpoints_points_top_users');
1359 1359
 	}
1360 1360
 }
1361 1361
 
@@ -1369,18 +1369,18 @@  discard block
 block discarded – undo
1369 1369
  *
1370 1370
  * @param int $user_id The ID of the user who was deleted.
1371 1371
  */
1372
-function wordpoints_clean_points_top_users_cache_user_deleted( $user_id ) {
1372
+function wordpoints_clean_points_top_users_cache_user_deleted($user_id) {
1373 1373
 
1374
-	foreach ( wordpoints_get_points_types() as $slug => $unused ) {
1374
+	foreach (wordpoints_get_points_types() as $slug => $unused) {
1375 1375
 
1376
-		$cache = wp_cache_get( $slug, 'wordpoints_points_top_users' );
1376
+		$cache = wp_cache_get($slug, 'wordpoints_points_top_users');
1377 1377
 
1378 1378
 		// If this user isn't in the cache, we don't need to clear it.
1379
-		if ( ! is_array( $cache ) || ! in_array( $user_id, $cache['top_users'] ) ) {
1379
+		if ( ! is_array($cache) || ! in_array($user_id, $cache['top_users'])) {
1380 1380
 			continue;
1381 1381
 		}
1382 1382
 
1383
-		wp_cache_delete( $slug, 'wordpoints_points_top_users' );
1383
+		wp_cache_delete($slug, 'wordpoints_points_top_users');
1384 1384
 	}
1385 1385
 }
1386 1386
 
@@ -1393,18 +1393,18 @@  discard block
 block discarded – undo
1393 1393
  */
1394 1394
 function wordpoints_register_points_hooks() {
1395 1395
 
1396
-	WordPoints_Points_Hooks::register( 'WordPoints_Comment_Received_Points_Hook' );
1397
-	WordPoints_Points_Hooks::register( 'WordPoints_Comment_Points_Hook' );
1398
-	WordPoints_Points_Hooks::register( 'WordPoints_Periodic_Points_Hook' );
1399
-	WordPoints_Points_Hooks::register( 'WordPoints_Post_Points_Hook' );
1400
-	WordPoints_Points_Hooks::register( 'WordPoints_Registration_Points_Hook' );
1396
+	WordPoints_Points_Hooks::register('WordPoints_Comment_Received_Points_Hook');
1397
+	WordPoints_Points_Hooks::register('WordPoints_Comment_Points_Hook');
1398
+	WordPoints_Points_Hooks::register('WordPoints_Periodic_Points_Hook');
1399
+	WordPoints_Points_Hooks::register('WordPoints_Post_Points_Hook');
1400
+	WordPoints_Points_Hooks::register('WordPoints_Registration_Points_Hook');
1401 1401
 
1402
-	if ( get_site_option( 'wordpoints_post_delete_hook_legacy' ) ) {
1403
-		WordPoints_Points_Hooks::register( 'WordPoints_Post_Delete_Points_Hook' );
1402
+	if (get_site_option('wordpoints_post_delete_hook_legacy')) {
1403
+		WordPoints_Points_Hooks::register('WordPoints_Post_Delete_Points_Hook');
1404 1404
 	}
1405 1405
 
1406
-	if ( get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
1407
-		WordPoints_Points_Hooks::register( 'WordPoints_Comment_Removed_Points_Hook' );
1406
+	if (get_site_option('wordpoints_comment_removed_hook_legacy')) {
1407
+		WordPoints_Points_Hooks::register('WordPoints_Comment_Removed_Points_Hook');
1408 1408
 	}
1409 1409
 }
1410 1410
 
Please login to merge, or discard this patch.
src/components/ranks/includes/class-wordpoints-rank-group.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -402,7 +402,7 @@
 block discarded – undo
402 402
 	 *
403 403
 	 * @param int $rank_id The ID of the rank to get the position of.
404 404
 	 *
405
-	 * @return int|false The rank's position, or false.
405
+	 * @return integer The rank's position, or false.
406 406
 	 */
407 407
 	public function get_rank_position( $rank_id ) {
408 408
 
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @type string[] $types
54 54
 	 */
55
-	private $types = array( 'base' => 'base' );
55
+	private $types = array('base' => 'base');
56 56
 
57 57
 	/**
58 58
 	 * Construct the group with its slug and other data.
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *        @type string $description A description of this group.
68 68
 	 * }
69 69
 	 */
70
-	public function __construct( $slug, $data ) {
70
+	public function __construct($slug, $data) {
71 71
 
72 72
 		$this->slug = $slug;
73 73
 		$this->data = $data;
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @since 1.7.0
81 81
 	 */
82
-	public function __get( $key ) {
82
+	public function __get($key) {
83 83
 
84
-		if ( isset( $this->$key ) ) {
84
+		if (isset($this->$key)) {
85 85
 			return $this->$key;
86
-		} elseif ( isset( $this->data[ $key ] ) ) {
87
-			return $this->data[ $key ];
86
+		} elseif (isset($this->data[$key])) {
87
+			return $this->data[$key];
88 88
 		} else {
89 89
 			return null;
90 90
 		}
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return bool Whether the rank type was registered for this group.
124 124
 	 */
125
-	public function has_type( $type ) {
125
+	public function has_type($type) {
126 126
 
127
-		if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) {
127
+		if ( ! WordPoints_Rank_Types::is_type_registered($type)) {
128 128
 			return false;
129 129
 		}
130 130
 
131
-		return isset( $this->types[ $type ] );
131
+		return isset($this->types[$type]);
132 132
 	}
133 133
 
134 134
 	/**
@@ -140,17 +140,17 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return bool Whether the type was added successfully.
142 142
 	 */
143
-	public function add_type( $type ) {
143
+	public function add_type($type) {
144 144
 
145
-		if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) {
145
+		if ( ! WordPoints_Rank_Types::is_type_registered($type)) {
146 146
 			return false;
147 147
 		}
148 148
 
149
-		if ( isset( $this->types[ $type ] ) ) {
149
+		if (isset($this->types[$type])) {
150 150
 			return false;
151 151
 		}
152 152
 
153
-		$this->types[ $type ] = $type;
153
+		$this->types[$type] = $type;
154 154
 
155 155
 		return true;
156 156
 	}
@@ -166,21 +166,21 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return bool Whether the type was removed successfully.
168 168
 	 */
169
-	public function remove_type( $type ) {
169
+	public function remove_type($type) {
170 170
 
171
-		if ( 'base' === $type ) {
171
+		if ('base' === $type) {
172 172
 			return false;
173 173
 		}
174 174
 
175
-		if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) {
175
+		if ( ! WordPoints_Rank_Types::is_type_registered($type)) {
176 176
 			return false;
177 177
 		}
178 178
 
179
-		if ( ! isset( $this->types[ $type ] ) ) {
179
+		if ( ! isset($this->types[$type])) {
180 180
 			return false;
181 181
 		}
182 182
 
183
-		unset( $this->types[ $type ] );
183
+		unset($this->types[$type]);
184 184
 
185 185
 		return true;
186 186
 	}
@@ -199,30 +199,30 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return bool Whether the rank was added successfully.
201 201
 	 */
202
-	public function add_rank( $rank_id, $position ) {
202
+	public function add_rank($rank_id, $position) {
203 203
 
204 204
 		if (
205
-			! wordpoints_posint( $rank_id )
206
-			|| false === wordpoints_int( $position )
205
+			! wordpoints_posint($rank_id)
206
+			|| false === wordpoints_int($position)
207 207
 			|| $position < 0
208 208
 		) {
209 209
 			return false;
210 210
 		}
211 211
 
212 212
 		// Don't allow a rank to be added to this group more than once.
213
-		if ( false !== $this->get_rank_position( $rank_id ) ) {
213
+		if (false !== $this->get_rank_position($rank_id)) {
214 214
 			return false;
215 215
 		}
216 216
 
217
-		$ranks = $this->_insert_rank( $this->get_ranks(), $rank_id, $position );
217
+		$ranks = $this->_insert_rank($this->get_ranks(), $rank_id, $position);
218 218
 
219
-		if ( ! $this->save_ranks( $ranks ) ) {
219
+		if ( ! $this->save_ranks($ranks)) {
220 220
 			return false;
221 221
 		}
222 222
 
223 223
 		// If there is a rank before this one, check if any of the users who have it
224 224
 		// can increase to this new one.
225
-		$this->_maybe_increase_users_with_previous_rank( $rank_id );
225
+		$this->_maybe_increase_users_with_previous_rank($rank_id);
226 226
 
227 227
 		return true;
228 228
 	}
@@ -240,23 +240,23 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool Whether the rank was moved successfully.
242 242
 	 */
243
-	public function move_rank( $rank_id, $position ) {
243
+	public function move_rank($rank_id, $position) {
244 244
 
245
-		$current_position = $this->get_rank_position( $rank_id );
245
+		$current_position = $this->get_rank_position($rank_id);
246 246
 
247
-		if ( $current_position === $position ) {
247
+		if ($current_position === $position) {
248 248
 			return false;
249 249
 		}
250 250
 
251 251
 		$ranks = $this->get_ranks();
252 252
 
253
-		unset( $ranks[ $current_position ] );
253
+		unset($ranks[$current_position]);
254 254
 
255
-		ksort( $ranks );
255
+		ksort($ranks);
256 256
 
257
-		$ranks = $this->_insert_rank( array_values( $ranks ), $rank_id, $position );
257
+		$ranks = $this->_insert_rank(array_values($ranks), $rank_id, $position);
258 258
 
259
-		if ( ! $this->save_ranks( $ranks ) ) {
259
+		if ( ! $this->save_ranks($ranks)) {
260 260
 			return false;
261 261
 		}
262 262
 
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		// rank's position.
265 265
 		$this->_move_users_from_rank_to_rank(
266 266
 			$rank_id
267
-			, $this->get_rank( $current_position - 1 )
267
+			, $this->get_rank($current_position - 1)
268 268
 		);
269 269
 
270 270
 		// The users of the rank previous to this one's new position should maybe be
271 271
 		// increased to this rank.
272
-		$this->_maybe_increase_users_with_previous_rank( $rank_id );
272
+		$this->_maybe_increase_users_with_previous_rank($rank_id);
273 273
 
274 274
 		return true;
275 275
 	}
@@ -283,45 +283,45 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return bool Whether the rank was removed successfully.
285 285
 	 */
286
-	public function remove_rank( $rank_id ) {
286
+	public function remove_rank($rank_id) {
287 287
 
288 288
 		global $wpdb;
289 289
 
290
-		$position = $this->get_rank_position( $rank_id );
290
+		$position = $this->get_rank_position($rank_id);
291 291
 
292
-		if ( false === $position ) {
292
+		if (false === $position) {
293 293
 			return false;
294 294
 		}
295 295
 
296 296
 		$ranks = $this->get_ranks();
297 297
 
298
-		unset( $ranks[ $position ] );
298
+		unset($ranks[$position]);
299 299
 
300
-		if ( ! $this->save_ranks( $ranks ) ) {
300
+		if ( ! $this->save_ranks($ranks)) {
301 301
 			return false;
302 302
 		}
303 303
 
304 304
 		// Assign the previous rank to users who have this rank.
305
-		if ( isset( $ranks[ $position - 1 ] ) ) {
305
+		if (isset($ranks[$position - 1])) {
306 306
 
307
-			$this->_move_users_from_rank_to_rank( $rank_id, $ranks[ $position - 1 ] );
307
+			$this->_move_users_from_rank_to_rank($rank_id, $ranks[$position - 1]);
308 308
 
309 309
 		} else {
310 310
 
311 311
 			// If there is no previous rank, just delete the rows.
312 312
 			$wpdb->delete(
313 313
 				$wpdb->wordpoints_user_ranks
314
-				, array( 'rank_id' => $rank_id )
314
+				, array('rank_id' => $rank_id)
315 315
 				, '%d'
316 316
 			);
317 317
 
318
-			$group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' );
319
-			unset( $group_ranks[ $rank_id ] );
320
-			wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' );
318
+			$group_ranks = wp_cache_get($this->slug, 'wordpoints_user_ranks');
319
+			unset($group_ranks[$rank_id]);
320
+			wp_cache_set($this->slug, $group_ranks, 'wordpoints_user_ranks');
321 321
 
322
-			unset( $group_ranks );
322
+			unset($group_ranks);
323 323
 
324
-			wp_cache_delete( $rank_id, 'wordpoints_users_with_rank' );
324
+			wp_cache_delete($rank_id, 'wordpoints_users_with_rank');
325 325
 		}
326 326
 
327 327
 		return true;
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return bool Whether the ranks were saved successfully.
340 340
 	 */
341
-	public function save_ranks( $rank_ids ) {
341
+	public function save_ranks($rank_ids) {
342 342
 
343
-		if ( count( array_unique( $rank_ids ) ) !== count( $rank_ids ) ) {
343
+		if (count(array_unique($rank_ids)) !== count($rank_ids)) {
344 344
 			return false;
345 345
 		}
346 346
 
347
-		ksort( $rank_ids );
347
+		ksort($rank_ids);
348 348
 
349
-		$rank_ids = array_values( $rank_ids );
349
+		$rank_ids = array_values($rank_ids);
350 350
 
351
-		return update_option( $this->option_name, $rank_ids );
351
+		return update_option($this->option_name, $rank_ids);
352 352
 	}
353 353
 
354 354
 	/**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	public function get_ranks() {
362 362
 
363
-		return wordpoints_get_array_option( $this->option_name );
363
+		return wordpoints_get_array_option($this->option_name);
364 364
 	}
365 365
 
366 366
 	/**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function get_base_rank() {
376 376
 
377
-		return $this->get_rank( 0 );
377
+		return $this->get_rank(0);
378 378
 	}
379 379
 
380 380
 	/**
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @return int|false The ID of the rank, or false if not found.
388 388
 	 */
389
-	public function get_rank( $position ) {
389
+	public function get_rank($position) {
390 390
 
391 391
 		$ranks = $this->get_ranks();
392 392
 
393
-		if ( ! isset( $ranks[ $position ] ) ) {
393
+		if ( ! isset($ranks[$position])) {
394 394
 			return false;
395 395
 		}
396 396
 
397
-		return $ranks[ $position ];
397
+		return $ranks[$position];
398 398
 	}
399 399
 
400 400
 	/**
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @return int|false The rank's position, or false.
408 408
 	 */
409
-	public function get_rank_position( $rank_id ) {
409
+	public function get_rank_position($rank_id) {
410 410
 
411 411
 		return array_search(
412
-			wordpoints_posint( $rank_id )
412
+			wordpoints_posint($rank_id)
413 413
 			, $this->get_ranks()
414 414
 			, true
415 415
 		);
@@ -430,26 +430,26 @@  discard block
 block discarded – undo
430 430
 	 *
431 431
 	 * @return int[] The list of ranks with the rank inserted.
432 432
 	 */
433
-	private function _insert_rank( $ranks, $rank_id, $position ) {
433
+	private function _insert_rank($ranks, $rank_id, $position) {
434 434
 
435
-		$count = count( $ranks );
435
+		$count = count($ranks);
436 436
 
437
-		if ( $count === $position ) {
437
+		if ($count === $position) {
438 438
 
439
-			$ranks[ $position ] = $rank_id;
439
+			$ranks[$position] = $rank_id;
440 440
 
441
-		} elseif ( $count < $position ) {
441
+		} elseif ($count < $position) {
442 442
 
443 443
 			$ranks[] = $rank_id;
444 444
 
445 445
 		} else {
446 446
 
447
-			$lower_ranks  = array_slice( $ranks, 0, $position, true );
448
-			$higher_ranks = array_slice( $ranks, $position, null, true );
447
+			$lower_ranks  = array_slice($ranks, 0, $position, true);
448
+			$higher_ranks = array_slice($ranks, $position, null, true);
449 449
 
450 450
 			$ranks = array_merge(
451 451
 				$lower_ranks
452
-				, array( $position => $rank_id )
452
+				, array($position => $rank_id)
453 453
 				, $higher_ranks
454 454
 			);
455 455
 		}
@@ -465,29 +465,29 @@  discard block
 block discarded – undo
465 465
 	 * @param int $rank_from_id The ID of the rank the users have now.
466 466
 	 * @param int $rank_to_id   The ID of the rank to give the users instead.
467 467
 	 */
468
-	private function _move_users_from_rank_to_rank( $rank_from_id, $rank_to_id ) {
468
+	private function _move_users_from_rank_to_rank($rank_from_id, $rank_to_id) {
469 469
 
470 470
 		global $wpdb;
471 471
 
472
-		if ( ! wordpoints_posint( $rank_from_id ) || ! wordpoints_posint( $rank_to_id ) ) {
472
+		if ( ! wordpoints_posint($rank_from_id) || ! wordpoints_posint($rank_to_id)) {
473 473
 			return;
474 474
 		}
475 475
 
476
-		$group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' );
476
+		$group_ranks = wp_cache_get($this->slug, 'wordpoints_user_ranks');
477 477
 
478
-		unset( $group_ranks[ $rank_from_id ], $group_ranks[ $rank_to_id ] );
478
+		unset($group_ranks[$rank_from_id], $group_ranks[$rank_to_id]);
479 479
 
480
-		wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' );
480
+		wp_cache_set($this->slug, $group_ranks, 'wordpoints_user_ranks');
481 481
 
482
-		unset( $group_ranks );
482
+		unset($group_ranks);
483 483
 
484
-		wp_cache_delete( $rank_from_id, 'wordpoints_users_with_rank' );
485
-		wp_cache_delete( $rank_to_id, 'wordpoints_users_with_rank' );
484
+		wp_cache_delete($rank_from_id, 'wordpoints_users_with_rank');
485
+		wp_cache_delete($rank_to_id, 'wordpoints_users_with_rank');
486 486
 
487 487
 		$wpdb->update(
488 488
 			$wpdb->wordpoints_user_ranks
489
-			, array( 'rank_id' => $rank_to_id )
490
-			, array( 'rank_id' => $rank_from_id )
489
+			, array('rank_id' => $rank_to_id)
490
+			, array('rank_id' => $rank_from_id)
491 491
 			, '%d'
492 492
 			, '%d'
493 493
 		);
@@ -500,35 +500,35 @@  discard block
 block discarded – undo
500 500
 	 *
501 501
 	 * @param int $rank_id A rank ID.
502 502
 	 */
503
-	private function _maybe_increase_users_with_previous_rank( $rank_id ) {
503
+	private function _maybe_increase_users_with_previous_rank($rank_id) {
504 504
 
505
-		$rank = wordpoints_get_rank( $rank_id );
505
+		$rank = wordpoints_get_rank($rank_id);
506 506
 		$previous_rank = $rank->get_adjacent( -1 );
507 507
 
508
-		if ( ! $previous_rank ) {
508
+		if ( ! $previous_rank) {
509 509
 			return;
510 510
 		}
511 511
 
512
-		$users = wordpoints_get_users_with_rank( $previous_rank->ID );
512
+		$users = wordpoints_get_users_with_rank($previous_rank->ID);
513 513
 
514
-		if ( empty( $users ) ) {
514
+		if (empty($users)) {
515 515
 			return;
516 516
 		}
517 517
 
518
-		$rank_type = WordPoints_Rank_Types::get_type( $rank->type );
518
+		$rank_type = WordPoints_Rank_Types::get_type($rank->type);
519 519
 
520
-		foreach ( $users as $user_id ) {
520
+		foreach ($users as $user_id) {
521 521
 
522 522
 			$new_rank = $rank_type->maybe_increase_user_rank(
523 523
 				$user_id
524 524
 				, $previous_rank
525 525
 			);
526 526
 
527
-			if ( $new_rank->ID === $previous_rank->ID ) {
527
+			if ($new_rank->ID === $previous_rank->ID) {
528 528
 				continue;
529 529
 			}
530 530
 
531
-			wordpoints_update_user_rank( $user_id, $new_rank->ID );
531
+			wordpoints_update_user_rank($user_id, $new_rank->ID);
532 532
 		}
533 533
 	}
534 534
 }
Please login to merge, or discard this patch.
src/includes/functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  *
174 174
  * @param mixed $maybe_int The value to convert to an integer.
175 175
  *
176
- * @return int|false False if $maybe_int couldn't reliably be converted to an integer.
176
+ * @return integer False if $maybe_int couldn't reliably be converted to an integer.
177 177
  */
178 178
 function wordpoints_int( &$maybe_int ) {
179 179
 
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
  * @since 1.0.1
970 970
  * @since 1.8.0 The $message now supports WP_Error objects.
971 971
  *
972
- * @param string|WP_Error $message The error message.
972
+ * @param string $message The error message.
973 973
  *
974 974
  * @return string The error message.
975 975
  */
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
  *
40 40
  * @param bool $network_active Whether the plugin is being network activated.
41 41
  */
42
-function wordpoints_activate( $network_active ) {
42
+function wordpoints_activate($network_active) {
43 43
 
44 44
 	// The installer won't be registered yet.
45 45
 	wordpoints_register_installer();
46 46
 
47
-	WordPoints_Installables::install( 'plugin', 'wordpoints', $network_active );
47
+	WordPoints_Installables::install('plugin', 'wordpoints', $network_active);
48 48
 }
49 49
 
50 50
 /**
@@ -56,25 +56,25 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function wordpoints_breaking_update() {
58 58
 
59
-	if ( is_wordpoints_network_active() ) {
60
-		$wordpoints_data = get_site_option( 'wordpoints_data' );
59
+	if (is_wordpoints_network_active()) {
60
+		$wordpoints_data = get_site_option('wordpoints_data');
61 61
 	} else {
62
-		$wordpoints_data = get_option( 'wordpoints_data' );
62
+		$wordpoints_data = get_option('wordpoints_data');
63 63
 	}
64 64
 
65 65
 	// Normally this should never happen, because the plugins_loaded action won't
66 66
 	// run until the next request after WordPoints is activated and installs itself.
67
-	if ( empty( $wordpoints_data['version'] ) ) {
67
+	if (empty($wordpoints_data['version'])) {
68 68
 		return;
69 69
 	}
70 70
 
71 71
 	// The major version is determined by the first number, so we can just cast to
72 72
 	// an integer. IF the major versions are equal, we don't need to do anything.
73
-	if ( (int) WORDPOINTS_VERSION === (int) $wordpoints_data['version'] ) {
73
+	if ((int) WORDPOINTS_VERSION === (int) $wordpoints_data['version']) {
74 74
 		return;
75 75
 	}
76 76
 
77
-	$updater = new WordPoints_Breaking_Updater( 'wordpoints_breaking', WORDPOINTS_VERSION );
77
+	$updater = new WordPoints_Breaking_Updater('wordpoints_breaking', WORDPOINTS_VERSION);
78 78
 	$updater->update();
79 79
 }
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function wordpoints_maintenance_shutdown_print_rand_str() {
90 90
 
91
-	if ( ! isset( $_GET['wordpoints_module_check'] ) ) {
91
+	if ( ! isset($_GET['wordpoints_module_check'])) {
92 92
 		return;
93 93
 	}
94 94
 
95
-	if ( is_network_admin() ) {
96
-		$nonce = get_site_option( 'wordpoints_module_check_nonce' );
95
+	if (is_network_admin()) {
96
+		$nonce = get_site_option('wordpoints_module_check_nonce');
97 97
 	} else {
98
-		$nonce = get_option( 'wordpoints_module_check_nonce' );
98
+		$nonce = get_option('wordpoints_module_check_nonce');
99 99
 	}
100 100
 
101
-	if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) {
101
+	if ( ! $nonce || ! hash_equals($nonce, sanitize_key($_GET['wordpoints_module_check']))) {
102 102
 		return;
103 103
 	}
104 104
 
105
-	if ( is_network_admin() ) {
106
-		$rand_str = get_site_option( 'wordpoints_module_check_rand_str' );
105
+	if (is_network_admin()) {
106
+		$rand_str = get_site_option('wordpoints_module_check_rand_str');
107 107
 	} else {
108
-		$rand_str = get_option( 'wordpoints_module_check_rand_str' );
108
+		$rand_str = get_option('wordpoints_module_check_rand_str');
109 109
 	}
110 110
 
111
-	echo esc_html( $rand_str );
111
+	echo esc_html($rand_str);
112 112
 }
113 113
 
114 114
 /**
@@ -126,29 +126,29 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return array The modules whose compatibility is being checked.
128 128
  */
129
-function wordpoints_maintenance_filter_modules( $modules ) {
129
+function wordpoints_maintenance_filter_modules($modules) {
130 130
 
131
-	if ( ! isset( $_GET['check_module'], $_GET['wordpoints_module_check'] ) ) {
131
+	if ( ! isset($_GET['check_module'], $_GET['wordpoints_module_check'])) {
132 132
 		return $modules;
133 133
 	}
134 134
 
135
-	if ( is_network_admin() ) {
136
-		$nonce = get_site_option( 'wordpoints_module_check_nonce' );
135
+	if (is_network_admin()) {
136
+		$nonce = get_site_option('wordpoints_module_check_nonce');
137 137
 	} else {
138
-		$nonce = get_option( 'wordpoints_module_check_nonce' );
138
+		$nonce = get_option('wordpoints_module_check_nonce');
139 139
 	}
140 140
 
141
-	if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) {
141
+	if ( ! $nonce || ! hash_equals($nonce, sanitize_key($_GET['wordpoints_module_check']))) {
142 142
 		return $modules;
143 143
 	}
144 144
 
145 145
 	$modules = explode(
146 146
 		','
147
-		, sanitize_text_field( wp_unslash( $_GET['check_module'] ) )
147
+		, sanitize_text_field(wp_unslash($_GET['check_module']))
148 148
 	);
149 149
 
150
-	if ( 'pre_site_option_wordpoints_sitewide_active_modules' === current_filter() ) {
151
-		$modules = array_flip( $modules );
150
+	if ('pre_site_option_wordpoints_sitewide_active_modules' === current_filter()) {
151
+		$modules = array_flip($modules);
152 152
 	}
153 153
 
154 154
 	return $modules;
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return int|false False if $maybe_int couldn't reliably be converted to an integer.
177 177
  */
178
-function wordpoints_int( &$maybe_int ) {
178
+function wordpoints_int(&$maybe_int) {
179 179
 
180
-	$type = gettype( $maybe_int );
180
+	$type = gettype($maybe_int);
181 181
 
182
-	switch ( $type ) {
182
+	switch ($type) {
183 183
 
184 184
 		case 'integer': break;
185 185
 
186 186
 		case 'string':
187
-			if ( (string) (int) $maybe_int === $maybe_int ) {
187
+			if ((string) (int) $maybe_int === $maybe_int) {
188 188
 				$maybe_int = (int) $maybe_int;
189 189
 			} else {
190 190
 				$maybe_int = false;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		break;
193 193
 
194 194
 		case 'double':
195
-			if ( (float) (int) $maybe_int === $maybe_int ) {
195
+			if ((float) (int) $maybe_int === $maybe_int) {
196 196
 				$maybe_int = (int) $maybe_int;
197 197
 			} else {
198 198
 				$maybe_int = false;
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return int
231 231
  */
232
-function wordpoints_posint( &$maybe_int ) {
232
+function wordpoints_posint(&$maybe_int) {
233 233
 
234
-	$maybe_int = ( wordpoints_int( $maybe_int ) > 0 ) ? $maybe_int : false;
234
+	$maybe_int = (wordpoints_int($maybe_int) > 0) ? $maybe_int : false;
235 235
 	return $maybe_int;
236 236
 }
237 237
 
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return int
249 249
  */
250
-function wordpoints_negint( &$maybe_int ) {
250
+function wordpoints_negint(&$maybe_int) {
251 251
 
252
-	$maybe_int = ( wordpoints_int( $maybe_int ) < 0 ) ? $maybe_int : false;
252
+	$maybe_int = (wordpoints_int($maybe_int) < 0) ? $maybe_int : false;
253 253
 	return $maybe_int;
254 254
 }
255 255
 
@@ -284,38 +284,38 @@  discard block
 block discarded – undo
284 284
 	$request_type = 'get'
285 285
 ) {
286 286
 
287
-	if ( 'post' === $request_type ) {
287
+	if ('post' === $request_type) {
288 288
 		$request = $_POST; // WPCS: CSRF OK.
289 289
 	} else {
290 290
 		$request = $_GET;
291 291
 	}
292 292
 
293
-	if ( ! isset( $request[ $nonce_key ] ) ) {
293
+	if ( ! isset($request[$nonce_key])) {
294 294
 		return false;
295 295
 	}
296 296
 
297
-	if ( ! empty( $format_values ) ) {
297
+	if ( ! empty($format_values)) {
298 298
 
299 299
 		$values = array();
300 300
 
301
-		foreach ( (array) $format_values as $value ) {
301
+		foreach ((array) $format_values as $value) {
302 302
 
303
-			if ( ! isset( $request[ $value ] ) ) {
303
+			if ( ! isset($request[$value])) {
304 304
 				return false;
305 305
 			}
306 306
 
307
-			$values[] = $request[ $value ];
307
+			$values[] = $request[$value];
308 308
 		}
309 309
 
310
-		$action_format = vsprintf( $action_format, $values );
310
+		$action_format = vsprintf($action_format, $values);
311 311
 	}
312 312
 
313 313
 	$is_valid = wp_verify_nonce(
314
-		sanitize_key( $request[ $nonce_key ] )
315
-		, strip_tags( $action_format )
314
+		sanitize_key($request[$nonce_key])
315
+		, strip_tags($action_format)
316 316
 	);
317 317
 
318
-	if ( 1 === $is_valid || 2 === $is_valid ) {
318
+	if (1 === $is_valid || 2 === $is_valid) {
319 319
 		return $is_valid;
320 320
 	}
321 321
 
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
  *
341 341
  * @return WP_Error The sanitized error.
342 342
  */
343
-function wordpoints_sanitize_wp_error( $error ) {
343
+function wordpoints_sanitize_wp_error($error) {
344 344
 
345 345
 	$code = $error->get_error_code();
346 346
 
347 347
 	$error_data = $error->error_data;
348 348
 
349
-	if ( isset( $error_data[ $code ]['title'] ) ) {
349
+	if (isset($error_data[$code]['title'])) {
350 350
 
351
-		$error_data[ $code ]['title'] = wp_kses(
352
-			$error->error_data[ $code ]['title']
351
+		$error_data[$code]['title'] = wp_kses(
352
+			$error->error_data[$code]['title']
353 353
 			, 'wordpoints_sanitize_wp_error_title'
354 354
 		);
355 355
 
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 
359 359
 	$all_errors = $error->errors;
360 360
 
361
-	foreach ( $all_errors as $code => $errors ) {
361
+	foreach ($all_errors as $code => $errors) {
362 362
 
363
-		foreach ( $errors as $key => $message ) {
364
-			$all_errors[ $code ][ $key ] = wp_kses(
363
+		foreach ($errors as $key => $message) {
364
+			$all_errors[$code][$key] = wp_kses(
365 365
 				$message
366 366
 				, 'wordpoints_sanitize_wp_error_message'
367 367
 			);
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
  * @return string The escaped identifier. Already quoted, do not place within
389 389
  *                backticks.
390 390
  */
391
-function wordpoints_escape_mysql_identifier( $identifier ) {
392
-	return '`' . str_replace( '`', '``', $identifier ) . '`';
391
+function wordpoints_escape_mysql_identifier($identifier) {
392
+	return '`' . str_replace('`', '``', $identifier) . '`';
393 393
 }
394 394
 
395 395
 //
@@ -412,16 +412,16 @@  discard block
 block discarded – undo
412 412
  *
413 413
  * @return array The option value if it is an array, or an empty array if not.
414 414
  */
415
-function wordpoints_get_array_option( $option, $context = 'default' ) {
415
+function wordpoints_get_array_option($option, $context = 'default') {
416 416
 
417
-	switch ( $context ) {
417
+	switch ($context) {
418 418
 
419 419
 		case 'default':
420
-			$value = get_option( $option, array() );
420
+			$value = get_option($option, array());
421 421
 		break;
422 422
 
423 423
 		case 'site':
424
-			$value = get_site_option( $option, array() );
424
+			$value = get_site_option($option, array());
425 425
 		break;
426 426
 
427 427
 		case 'network':
@@ -431,15 +431,15 @@  discard block
 block discarded – undo
431 431
 				, 'Using "network" as the value of $context is deprecated, use wordpoints_get_maybe_network_array_option() instead.'
432 432
 			);
433 433
 
434
-			$value = wordpoints_get_maybe_network_option( $option, array() );
434
+			$value = wordpoints_get_maybe_network_option($option, array());
435 435
 		break;
436 436
 
437 437
 		default:
438
-			_doing_it_wrong( __FUNCTION__, sprintf( 'Unknown option context "%s"', esc_html( $context ) ), '1.2.0' );
438
+			_doing_it_wrong(__FUNCTION__, sprintf('Unknown option context "%s"', esc_html($context)), '1.2.0');
439 439
 			$value = array();
440 440
 	}
441 441
 
442
-	if ( ! is_array( $value ) ) {
442
+	if ( ! is_array($value)) {
443 443
 		$value = array();
444 444
 	}
445 445
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
  *
461 461
  * @return mixed The option value if it exists, or $default (false by default).
462 462
  */
463
-function wordpoints_get_network_option( $option, $default = false ) {
463
+function wordpoints_get_network_option($option, $default = false) {
464 464
 
465 465
 	_deprecated_function(
466 466
 		__FUNCTION__
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		, 'wordpoints_get_maybe_network_option()'
469 469
 	);
470 470
 
471
-	return wordpoints_get_maybe_network_option( $option, null, $default );
471
+	return wordpoints_get_maybe_network_option($option, null, $default);
472 472
 }
473 473
 
474 474
 /**
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
  *
488 488
  * @return bool Whether the option was added successfully.
489 489
  */
490
-function wordpoints_add_network_option( $option, $value, $autoload = 'yes' ) {
490
+function wordpoints_add_network_option($option, $value, $autoload = 'yes') {
491 491
 
492 492
 	_deprecated_function(
493 493
 		__FUNCTION__
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		, 'wordpoints_add_maybe_network_option()'
496 496
 	);
497 497
 
498
-	return wordpoints_add_maybe_network_option( $option, $value, null, $autoload );
498
+	return wordpoints_add_maybe_network_option($option, $value, null, $autoload);
499 499
 }
500 500
 
501 501
 /**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
  *
513 513
  * @return bool Whether the option was updated successfully.
514 514
  */
515
-function wordpoints_update_network_option( $option, $value ) {
515
+function wordpoints_update_network_option($option, $value) {
516 516
 
517 517
 	_deprecated_function(
518 518
 		__FUNCTION__
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		, 'wordpoints_update_maybe_network_option()'
521 521
 	);
522 522
 
523
-	return wordpoints_update_maybe_network_option( $option, $value );
523
+	return wordpoints_update_maybe_network_option($option, $value);
524 524
 }
525 525
 
526 526
 /**
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
  *
537 537
  * @return bool Whether the option was successfully deleted.
538 538
  */
539
-function wordpoints_delete_network_option( $option ) {
539
+function wordpoints_delete_network_option($option) {
540 540
 
541 541
 	_deprecated_function(
542 542
 		__FUNCTION__
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		, 'wordpoints_delete_maybe_network_option()'
545 545
 	);
546 546
 
547
-	return wordpoints_delete_maybe_network_option( $option );
547
+	return wordpoints_delete_maybe_network_option($option);
548 548
 }
549 549
 
550 550
 /**
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
  *
564 564
  * @return array The option value if it is an array, or an empty array if not.
565 565
  */
566
-function wordpoints_get_maybe_network_array_option( $option, $network = null ) {
566
+function wordpoints_get_maybe_network_array_option($option, $network = null) {
567 567
 
568
-	$value = wordpoints_get_maybe_network_option( $option, $network );
568
+	$value = wordpoints_get_maybe_network_option($option, $network);
569 569
 
570
-	if ( ! is_array( $value ) ) {
570
+	if ( ! is_array($value)) {
571 571
 		$value = array();
572 572
 	}
573 573
 
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
  *
589 589
  * @return mixed The option value if it exists, or $default (false by default).
590 590
  */
591
-function wordpoints_get_maybe_network_option( $option, $network = null, $default = false ) {
591
+function wordpoints_get_maybe_network_option($option, $network = null, $default = false) {
592 592
 
593
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
594
-		return get_site_option( $option, $default );
593
+	if ($network || (null === $network && is_wordpoints_network_active())) {
594
+		return get_site_option($option, $default);
595 595
 	} else {
596
-		return get_option( $option, $default );
596
+		return get_option($option, $default);
597 597
 	}
598 598
 }
599 599
 
@@ -613,12 +613,12 @@  discard block
 block discarded – undo
613 613
  *
614 614
  * @return bool Whether the option was added successfully.
615 615
  */
616
-function wordpoints_add_maybe_network_option( $option, $value, $network = null, $autoload = 'yes' ) {
616
+function wordpoints_add_maybe_network_option($option, $value, $network = null, $autoload = 'yes') {
617 617
 
618
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
619
-		return add_site_option( $option, $value );
618
+	if ($network || (null === $network && is_wordpoints_network_active())) {
619
+		return add_site_option($option, $value);
620 620
 	} else {
621
-		return add_option( $option, $value, '', $autoload );
621
+		return add_option($option, $value, '', $autoload);
622 622
 	}
623 623
 }
624 624
 
@@ -636,12 +636,12 @@  discard block
 block discarded – undo
636 636
  *
637 637
  * @return bool Whether the option was updated successfully.
638 638
  */
639
-function wordpoints_update_maybe_network_option( $option, $value, $network = null ) {
639
+function wordpoints_update_maybe_network_option($option, $value, $network = null) {
640 640
 
641
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
642
-		return update_site_option( $option, $value );
641
+	if ($network || (null === $network && is_wordpoints_network_active())) {
642
+		return update_site_option($option, $value);
643 643
 	} else {
644
-		return update_option( $option, $value );
644
+		return update_option($option, $value);
645 645
 	}
646 646
 }
647 647
 
@@ -658,12 +658,12 @@  discard block
 block discarded – undo
658 658
  *
659 659
  * @return bool Whether the option was successfully deleted.
660 660
  */
661
-function wordpoints_delete_maybe_network_option( $option, $network = null ) {
661
+function wordpoints_delete_maybe_network_option($option, $network = null) {
662 662
 
663
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
664
-		return delete_site_option( $option );
663
+	if ($network || (null === $network && is_wordpoints_network_active())) {
664
+		return delete_site_option($option);
665 665
 	} else {
666
-		return delete_option( $option );
666
+		return delete_option($option);
667 667
 	}
668 668
 }
669 669
 
@@ -681,36 +681,36 @@  discard block
 block discarded – undo
681 681
  *
682 682
  * @return string|false The comma-delimited string of values. False on failure.
683 683
  */
684
-function wordpoints_prepare__in( $_in, $format = '%s' ) {
684
+function wordpoints_prepare__in($_in, $format = '%s') {
685 685
 
686 686
 	global $wpdb;
687 687
 
688 688
 	// Validate $format.
689
-	$formats = array( '%d', '%s', '%f' );
689
+	$formats = array('%d', '%s', '%f');
690 690
 
691
-	if ( ! in_array( $format, $formats ) ) {
691
+	if ( ! in_array($format, $formats)) {
692 692
 
693
-		$format = esc_html( $format );
694
-		_doing_it_wrong( __FUNCTION__, esc_html( "WordPoints Debug Error: invalid format '{$format}', allowed values are %s, %d, and %f" ), '1.0.0' );
693
+		$format = esc_html($format);
694
+		_doing_it_wrong(__FUNCTION__, esc_html("WordPoints Debug Error: invalid format '{$format}', allowed values are %s, %d, and %f"), '1.0.0');
695 695
 
696 696
 		$format = '%s';
697 697
 	}
698 698
 
699
-	$_in = array_unique( $_in );
699
+	$_in = array_unique($_in);
700 700
 
701
-	$count = count( $_in );
701
+	$count = count($_in);
702 702
 
703
-	if ( 0 === $count ) {
703
+	if (0 === $count) {
704 704
 
705
-		_doing_it_wrong( __FUNCTION__, 'WordPoints Debug Error: empty array passed as first parameter', '1.0.0' );
705
+		_doing_it_wrong(__FUNCTION__, 'WordPoints Debug Error: empty array passed as first parameter', '1.0.0');
706 706
 
707 707
 		return false;
708 708
 	}
709 709
 
710 710
 	// String a bunch of format signs together, one for each value in $_in.
711
-	$in = $format . str_repeat( ",{$format}", $count - 1 );
711
+	$in = $format . str_repeat(",{$format}", $count - 1);
712 712
 
713
-	return $wpdb->prepare( $in, $_in ); // WPCS: unprepared SQL OK
713
+	return $wpdb->prepare($in, $_in); // WPCS: unprepared SQL OK
714 714
 }
715 715
 
716 716
 //
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
  * }
739 739
  * @param array $args Arguments to pass to get_post_types(). Default is array().
740 740
  */
741
-function wordpoints_list_post_types( $options, $args = array() ) {
741
+function wordpoints_list_post_types($options, $args = array()) {
742 742
 
743 743
 	$defaults = array(
744 744
 		'name'     => '',
@@ -748,18 +748,18 @@  discard block
 block discarded – undo
748 748
 		'filter'   => null,
749 749
 	);
750 750
 
751
-	$options = array_merge( $defaults, $options );
751
+	$options = array_merge($defaults, $options);
752 752
 
753
-	echo '<select class="' . esc_attr( $options['class'] ) . '" name="' . esc_attr( $options['name'] ) . '" id="' . esc_attr( $options['id'] ) . '">';
754
-	echo '<option value="ALL"' . selected( $options['selected'], 'ALL', false ) . '>' . esc_html_x( 'Any', 'post type', 'wordpoints' ) . '</option>';
753
+	echo '<select class="' . esc_attr($options['class']) . '" name="' . esc_attr($options['name']) . '" id="' . esc_attr($options['id']) . '">';
754
+	echo '<option value="ALL"' . selected($options['selected'], 'ALL', false) . '>' . esc_html_x('Any', 'post type', 'wordpoints') . '</option>';
755 755
 
756
-	foreach ( get_post_types( $args, 'objects' ) as $post_type ) {
756
+	foreach (get_post_types($args, 'objects') as $post_type) {
757 757
 
758
-		if ( isset( $options['filter'] ) && ! call_user_func( $options['filter'], $post_type ) ) {
758
+		if (isset($options['filter']) && ! call_user_func($options['filter'], $post_type)) {
759 759
 			continue;
760 760
 		}
761 761
 
762
-		echo '<option value="' . esc_attr( $post_type->name ) . '"' . selected( $options['selected'], $post_type->name, false ) . '>' . esc_html( $post_type->label ) . '</option>';
762
+		echo '<option value="' . esc_attr($post_type->name) . '"' . selected($options['selected'], $post_type->name, false) . '>' . esc_html($post_type->label) . '</option>';
763 763
 	}
764 764
 
765 765
 	echo '</select>';
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	require_once ABSPATH . '/wp-admin/includes/plugin.php';
782 782
 
783 783
 	$network_active = is_plugin_active_for_network(
784
-		plugin_basename( WORDPOINTS_DIR . 'wordpoints.php' )
784
+		plugin_basename(WORDPOINTS_DIR . 'wordpoints.php')
785 785
 	);
786 786
 
787 787
 	/**
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	 *
795 795
 	 * @param bool $network_active Whether WordPoints is network activated.
796 796
 	 */
797
-	return apply_filters( 'is_wordpoints_network_active', $network_active );
797
+	return apply_filters('is_wordpoints_network_active', $network_active);
798 798
 }
799 799
 
800 800
 /**
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
  *
811 811
  * @return array An array of user IDs to exclude in the current $context.
812 812
  */
813
-function wordpoints_get_excluded_users( $context ) {
813
+function wordpoints_get_excluded_users($context) {
814 814
 
815 815
 	$user_ids = wordpoints_get_maybe_network_array_option(
816 816
 		'wordpoints_excluded_users'
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 	 * @param int[]  $user_ids The ids of the user's to be excluded.
827 827
 	 * @param string $context  The context in which the function is being called.
828 828
 	 */
829
-	return apply_filters( 'wordpoints_excluded_users', $user_ids, $context );
829
+	return apply_filters('wordpoints_excluded_users', $user_ids, $context);
830 830
 }
831 831
 
832 832
 /**
@@ -842,18 +842,18 @@  discard block
 block discarded – undo
842 842
  *
843 843
  * @return string The error message.
844 844
  */
845
-function wordpoints_shortcode_error( $message ) {
845
+function wordpoints_shortcode_error($message) {
846 846
 
847 847
 	if (
848
-		( get_post() && current_user_can( 'edit_post', get_the_ID() ) )
849
-		|| current_user_can( 'manage_options' )
848
+		(get_post() && current_user_can('edit_post', get_the_ID()))
849
+		|| current_user_can('manage_options')
850 850
 	) {
851 851
 
852
-		if ( is_wp_error( $message ) ) {
852
+		if (is_wp_error($message)) {
853 853
 			$message = $message->get_error_message();
854 854
 		}
855 855
 
856
-		return '<p class="wordpoints-shortcode-error">' . esc_html__( 'Shortcode error:', 'wordpoints' ) . ' ' . wp_kses( $message, 'wordpoints_shortcode_error' ) . '</p>';
856
+		return '<p class="wordpoints-shortcode-error">' . esc_html__('Shortcode error:', 'wordpoints') . ' ' . wp_kses($message, 'wordpoints_shortcode_error') . '</p>';
857 857
 	}
858 858
 
859 859
 	return '';
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
  * @param array $capabilities The capabilities to add as keys, WP core counterparts
887 887
  *                            as values.
888 888
  */
889
-function wordpoints_add_custom_caps( $capabilities ) {
889
+function wordpoints_add_custom_caps($capabilities) {
890 890
 
891 891
 	/** @var WP_Role $role */
892
-	foreach ( wp_roles()->role_objects as $role ) {
892
+	foreach (wp_roles()->role_objects as $role) {
893 893
 
894
-		foreach ( $capabilities as $custom_cap => $core_cap ) {
895
-			if ( $role->has_cap( $core_cap ) ) {
896
-				$role->add_cap( $custom_cap );
894
+		foreach ($capabilities as $custom_cap => $core_cap) {
895
+			if ($role->has_cap($core_cap)) {
896
+				$role->add_cap($custom_cap);
897 897
 			}
898 898
 		}
899 899
 	}
@@ -908,12 +908,12 @@  discard block
 block discarded – undo
908 908
  *
909 909
  * @param string[] $capabilities The list of capabilities to remove.
910 910
  */
911
-function wordpoints_remove_custom_caps( $capabilities ) {
911
+function wordpoints_remove_custom_caps($capabilities) {
912 912
 
913 913
 	/** @var WP_Role $role */
914
-	foreach ( wp_roles()->role_objects as $role ) {
915
-		foreach ( $capabilities as $custom_cap ) {
916
-			$role->remove_cap( $custom_cap );
914
+	foreach (wp_roles()->role_objects as $role) {
915
+		foreach ($capabilities as $custom_cap) {
916
+			$role->remove_cap($custom_cap);
917 917
 		}
918 918
 	}
919 919
 }
@@ -931,13 +931,13 @@  discard block
 block discarded – undo
931 931
  *
932 932
  * @return array The user's capabilities.
933 933
  */
934
-function wordpoints_map_custom_meta_caps( $caps, $cap, $user_id ) {
934
+function wordpoints_map_custom_meta_caps($caps, $cap, $user_id) {
935 935
 
936
-	switch ( $cap ) {
936
+	switch ($cap) {
937 937
 		case 'install_wordpoints_modules':
938
-			if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
938
+			if (defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS) {
939 939
 				$caps[] = 'do_not_allow';
940
-			} elseif ( is_multisite() && ! is_super_admin( $user_id ) ) {
940
+			} elseif (is_multisite() && ! is_super_admin($user_id)) {
941 941
 				$caps[] = 'do_not_allow';
942 942
 			} else {
943 943
 				$caps[] = $cap;
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @return bool Whether the component was registered.
961 961
  */
962
-function wordpoints_component_register( $args ) {
962
+function wordpoints_component_register($args) {
963 963
 
964
-	return WordPoints_Components::instance()->register( $args );
964
+	return WordPoints_Components::instance()->register($args);
965 965
 }
966 966
 
967 967
 /**
@@ -975,9 +975,9 @@  discard block
 block discarded – undo
975 975
  *
976 976
  * @return bool Whether the component is active.
977 977
  */
978
-function wordpoints_component_is_active( $slug ) {
978
+function wordpoints_component_is_active($slug) {
979 979
 
980
-	return WordPoints_Components::instance()->is_active( $slug );
980
+	return WordPoints_Components::instance()->is_active($slug);
981 981
 }
982 982
 
983 983
 /**
@@ -994,12 +994,12 @@  discard block
 block discarded – undo
994 994
 	wordpoints_component_register(
995 995
 		array(
996 996
 			'slug'          => 'points',
997
-			'name'          => _x( 'Points', 'component name', 'wordpoints' ),
997
+			'name'          => _x('Points', 'component name', 'wordpoints'),
998 998
 			'version'       => WORDPOINTS_VERSION,
999
-			'author'        => _x( 'WordPoints', 'component author', 'wordpoints' ),
999
+			'author'        => _x('WordPoints', 'component author', 'wordpoints'),
1000 1000
 			'author_uri'    => 'https://wordpoints.org/',
1001 1001
 			'component_uri' => 'https://wordpoints.org/',
1002
-			'description'   => __( 'Enables a points system for your site.', 'wordpoints' ),
1002
+			'description'   => __('Enables a points system for your site.', 'wordpoints'),
1003 1003
 			'file'          => WORDPOINTS_DIR . 'components/points/points.php',
1004 1004
 			'un_installer'  => WORDPOINTS_DIR . 'components/points/includes/class-un-installer.php',
1005 1005
 		)
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
 	wordpoints_component_register(
1019 1019
 		array(
1020 1020
 			'slug'           => 'ranks',
1021
-			'name'           => _x( 'Ranks', 'component name', 'wordpoints' ),
1021
+			'name'           => _x('Ranks', 'component name', 'wordpoints'),
1022 1022
 			'version'        => WORDPOINTS_VERSION,
1023
-			'author'         => _x( 'WordPoints', 'component author', 'wordpoints' ),
1023
+			'author'         => _x('WordPoints', 'component author', 'wordpoints'),
1024 1024
 			'author_uri'     => 'https://wordpoints.org/',
1025 1025
 			'component_uri'  => 'https://wordpoints.org/',
1026
-			'description'    => __( 'Assign users ranks based on their points levels.', 'wordpoints' ),
1026
+			'description'    => __('Assign users ranks based on their points levels.', 'wordpoints'),
1027 1027
 			'file'           => WORDPOINTS_DIR . 'components/ranks/ranks.php',
1028 1028
 			'un_installer'   => WORDPOINTS_DIR . 'components/ranks/includes/class-un-installer.php',
1029 1029
 		)
@@ -1040,11 +1040,11 @@  discard block
 block discarded – undo
1040 1040
  */
1041 1041
 function wordpoints_init_cache_groups() {
1042 1042
 
1043
-	if ( function_exists( 'wp_cache_add_non_persistent_groups' ) ) {
1044
-		wp_cache_add_non_persistent_groups( array( 'wordpoints_modules' ) );
1043
+	if (function_exists('wp_cache_add_non_persistent_groups')) {
1044
+		wp_cache_add_non_persistent_groups(array('wordpoints_modules'));
1045 1045
 	}
1046 1046
 
1047
-	if ( function_exists( 'wp_cache_add_global_groups' ) ) {
1047
+	if (function_exists('wp_cache_add_global_groups')) {
1048 1048
 
1049 1049
 		wp_cache_add_global_groups(
1050 1050
 			array(
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
  */
1079 1079
 function wordpoints_load_textdomain() {
1080 1080
 
1081
-	load_plugin_textdomain( 'wordpoints', false, plugin_basename( WORDPOINTS_DIR ) . '/languages/' );
1081
+	load_plugin_textdomain('wordpoints', false, plugin_basename(WORDPOINTS_DIR) . '/languages/');
1082 1082
 }
1083 1083
 
1084 1084
 /**
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
  *
1097 1097
  * @return string The hash.
1098 1098
  */
1099
-function wordpoints_hash( $data ) {
1100
-	return hash( 'sha256', $data );
1099
+function wordpoints_hash($data) {
1100
+	return hash('sha256', $data);
1101 1101
 }
1102 1102
 
1103 1103
 /**
@@ -1110,19 +1110,19 @@  discard block
 block discarded – undo
1110 1110
  *
1111 1111
  * @return object|false The constructed object, or false if to many args were passed.
1112 1112
  */
1113
-function wordpoints_construct_class_with_args( $class_name, array $args ) {
1113
+function wordpoints_construct_class_with_args($class_name, array $args) {
1114 1114
 
1115
-	switch ( count( $args ) ) {
1115
+	switch (count($args)) {
1116 1116
 		case 0:
1117 1117
 			return new $class_name();
1118 1118
 		case 1:
1119
-			return new $class_name( $args[0] );
1119
+			return new $class_name($args[0]);
1120 1120
 		case 2:
1121
-			return new $class_name( $args[0], $args[1] );
1121
+			return new $class_name($args[0], $args[1]);
1122 1122
 		case 3:
1123
-			return new $class_name( $args[0], $args[1], $args[2] );
1123
+			return new $class_name($args[0], $args[1], $args[2]);
1124 1124
 		case 4:
1125
-			return new $class_name( $args[0], $args[1], $args[2], $args[3] );
1125
+			return new $class_name($args[0], $args[1], $args[2], $args[3]);
1126 1126
 		default:
1127 1127
 			return false;
1128 1128
 	}
@@ -1137,13 +1137,13 @@  discard block
 block discarded – undo
1137 1137
  *
1138 1138
  * @return bool Whether the function is disabled.
1139 1139
  */
1140
-function wordpoints_is_function_disabled( $function ) {
1140
+function wordpoints_is_function_disabled($function) {
1141 1141
 
1142
-	if ( 'set_time_limit' === $function && ini_get( 'safe_mode' ) ) {
1142
+	if ('set_time_limit' === $function && ini_get('safe_mode')) {
1143 1143
 		return true;
1144 1144
 	}
1145 1145
 
1146
-	return in_array( $function, explode( ',', ini_get( 'disable_functions' ) ) );
1146
+	return in_array($function, explode(',', ini_get('disable_functions')));
1147 1147
 }
1148 1148
 
1149 1149
 // EOF
Please login to merge, or discard this patch.
src/components/points/points.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
  */
72 72
 include_once WORDPOINTS_DIR . 'components/points/includes/deprecated.php';
73 73
 
74
-if ( is_admin() ) {
74
+if (is_admin()) {
75 75
 
76 76
 	// We are on the administration side of the site.
77 77
 
Please login to merge, or discard this patch.