Completed
Push — master ( e7ef90...760553 )
by J.D.
03:28
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
 				'orderby'      => '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|void 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
 
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string|false The slug on success. False on failure.
115 115
  */
116
-function wordpoints_add_points_type( $settings ) {
116
+function wordpoints_add_points_type($settings) {
117 117
 
118
-	if ( ! is_array( $settings ) || ! isset( $settings['name'] ) ) {
118
+	if ( ! is_array($settings) || ! isset($settings['name'])) {
119 119
 		return false;
120 120
 	}
121 121
 
122 122
 	$slug = $settings['name'];
123
-	$slug = preg_replace( '/\s+/', '-', $slug );
124
-	$slug = preg_replace( '/-+/', '-', $slug );
125
-	$slug = trim( $slug, '-' );
126
-	$slug = sanitize_key( $slug );
123
+	$slug = preg_replace('/\s+/', '-', $slug);
124
+	$slug = preg_replace('/-+/', '-', $slug);
125
+	$slug = trim($slug, '-');
126
+	$slug = sanitize_key($slug);
127 127
 
128 128
 	$points_types = wordpoints_get_points_types();
129 129
 
130
-	if ( empty( $slug ) || isset( $points_types[ $slug ] ) ) {
130
+	if (empty($slug) || isset($points_types[$slug])) {
131 131
 		return false;
132 132
 	}
133 133
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 	 * @param string $slug     The slug for this points type.
141 141
 	 * @param bool   $is_new   Whether this points type is new, or being updated.
142 142
 	 */
143
-	$points_types[ $slug ] = apply_filters( 'wordpoints_points_settings', $settings, $slug, true );
143
+	$points_types[$slug] = apply_filters('wordpoints_points_settings', $settings, $slug, true);
144 144
 
145
-	if ( ! wordpoints_update_maybe_network_option( 'wordpoints_points_types', $points_types ) ) {
145
+	if ( ! wordpoints_update_maybe_network_option('wordpoints_points_types', $points_types)) {
146 146
 		return false;
147 147
 	}
148 148
 
@@ -159,20 +159,20 @@  discard block
 block discarded – undo
159 159
  *
160 160
  * @return bool True, or false on failure, or if this points type does not exist.
161 161
  */
162
-function wordpoints_update_points_type( $slug, $settings ) {
162
+function wordpoints_update_points_type($slug, $settings) {
163 163
 
164 164
 	$points_types = wordpoints_get_points_types();
165 165
 
166
-	if ( ! is_array( $settings ) || ! isset( $points_types[ $slug ], $settings['name'] ) ) {
166
+	if ( ! is_array($settings) || ! isset($points_types[$slug], $settings['name'])) {
167 167
 		return false;
168 168
 	}
169 169
 
170 170
 	/**
171 171
 	 * @see wordpoints_add_points_type()
172 172
 	 */
173
-	$points_types[ $slug ] = apply_filters( 'wordpoints_points_settings', $settings, $slug, false );
173
+	$points_types[$slug] = apply_filters('wordpoints_points_settings', $settings, $slug, false);
174 174
 
175
-	return wordpoints_update_maybe_network_option( 'wordpoints_points_types', $points_types );
175
+	return wordpoints_update_maybe_network_option('wordpoints_points_types', $points_types);
176 176
 }
177 177
 
178 178
 /**
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
  *
188 188
  * @return bool Whether the points type was deleted successfully.
189 189
  */
190
-function wordpoints_delete_points_type( $slug ) {
190
+function wordpoints_delete_points_type($slug) {
191 191
 
192 192
 	$points_types = wordpoints_get_points_types();
193 193
 
194
-	if ( ! isset( $points_types[ $slug ] ) ) {
194
+	if ( ! isset($points_types[$slug])) {
195 195
 		return false;
196 196
 	}
197 197
 
@@ -203,48 +203,48 @@  discard block
 block discarded – undo
203 203
 	 * @param string $slug      The slug of the points type being deleted.
204 204
 	 * @param array  $settings The settings of the points type being deleted.
205 205
 	 */
206
-	do_action( 'wordpoints_delete_points_type', $slug, $points_types[ $slug ] );
206
+	do_action('wordpoints_delete_points_type', $slug, $points_types[$slug]);
207 207
 
208
-	$meta_key = wordpoints_get_points_user_meta_key( $slug );
208
+	$meta_key = wordpoints_get_points_user_meta_key($slug);
209 209
 
210 210
 	global $wpdb;
211 211
 
212 212
 	// Delete log meta for this points type.
213 213
 	$query = new WordPoints_Points_Logs_Query(
214
-		array( 'field' => 'id', 'points_type' => $slug )
214
+		array('field' => 'id', 'points_type' => $slug)
215 215
 	);
216 216
 
217
-	$log_ids = $query->get( 'col' );
217
+	$log_ids = $query->get('col');
218 218
 
219
-	foreach ( $log_ids as $log_id ) {
220
-		wordpoints_points_log_delete_all_metadata( $log_id );
219
+	foreach ($log_ids as $log_id) {
220
+		wordpoints_points_log_delete_all_metadata($log_id);
221 221
 	}
222 222
 
223 223
 	// Delete logs for this points type.
224
-	$wpdb->delete( $wpdb->wordpoints_points_logs, array( 'points_type' => $slug ) );
224
+	$wpdb->delete($wpdb->wordpoints_points_logs, array('points_type' => $slug));
225 225
 
226
-	wordpoints_flush_points_logs_caches( array( 'points_type' => $slug ) );
226
+	wordpoints_flush_points_logs_caches(array('points_type' => $slug));
227 227
 
228 228
 	// Delete all user points of this type.
229
-	delete_metadata( 'user', 0, wp_slash( $meta_key ), '', true );
229
+	delete_metadata('user', 0, wp_slash($meta_key), '', true);
230 230
 
231 231
 	// Delete hooks associated with this points type.
232 232
 	$points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
233 233
 
234
-	unset( $points_types_hooks[ $slug ] );
234
+	unset($points_types_hooks[$slug]);
235 235
 
236
-	WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
236
+	WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
237 237
 
238 238
 	// Delete reactions associated with this points type.
239
-	foreach ( wordpoints_hooks()->get_reaction_stores( 'points' ) as $reaction_store ) {
240
-		foreach ( $reaction_store->get_reactions() as $reaction ) {
241
-			if ( $slug === $reaction->get_meta( 'points_type' ) ) {
242
-				$reaction_store->delete_reaction( $reaction->get_id() );
239
+	foreach (wordpoints_hooks()->get_reaction_stores('points') as $reaction_store) {
240
+		foreach ($reaction_store->get_reactions() as $reaction) {
241
+			if ($slug === $reaction->get_meta('points_type')) {
242
+				$reaction_store->delete_reaction($reaction->get_id());
243 243
 			}
244 244
 		}
245 245
 	}
246 246
 
247
-	unset( $points_types[ $slug ] );
247
+	unset($points_types[$slug]);
248 248
 
249 249
 	wordpoints_update_maybe_network_option(
250 250
 		'wordpoints_points_types'
@@ -277,19 +277,19 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return string|false The user meta meta_key for a points type, or false.
279 279
  */
280
-function wordpoints_get_points_user_meta_key( $points_type ) {
280
+function wordpoints_get_points_user_meta_key($points_type) {
281 281
 
282
-	if ( ! wordpoints_is_points_type( $points_type ) ) {
282
+	if ( ! wordpoints_is_points_type($points_type)) {
283 283
 		return false;
284 284
 	}
285 285
 
286
-	$setting = wordpoints_get_points_type_setting( $points_type, 'meta_key' );
286
+	$setting = wordpoints_get_points_type_setting($points_type, 'meta_key');
287 287
 
288
-	if ( ! empty( $setting ) ) {
288
+	if ( ! empty($setting)) {
289 289
 
290 290
 		$meta_key = $setting;
291 291
 
292
-	} elseif ( ! is_multisite() || is_wordpoints_network_active() ) {
292
+	} elseif ( ! is_multisite() || is_wordpoints_network_active()) {
293 293
 
294 294
 		$meta_key = "wordpoints_points-{$points_type}";
295 295
 
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return int|false The user's points, or false on failure.
317 317
  */
318
-function wordpoints_get_points( $user_id, $type ) {
318
+function wordpoints_get_points($user_id, $type) {
319 319
 
320
-	if ( ! wordpoints_posint( $user_id ) || ! wordpoints_is_points_type( $type ) ) {
320
+	if ( ! wordpoints_posint($user_id) || ! wordpoints_is_points_type($type)) {
321 321
 		return false;
322 322
 	}
323 323
 
324
-	$points = get_user_meta( $user_id, wordpoints_get_points_user_meta_key( $type ), true );
324
+	$points = get_user_meta($user_id, wordpoints_get_points_user_meta_key($type), true);
325 325
 
326
-	return (int) wordpoints_int( $points );
326
+	return (int) wordpoints_int($points);
327 327
 }
328 328
 
329 329
 /**
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
  *
366 366
  * @return int|false The minimum for this type of points. False if $type is bad.
367 367
  */
368
-function wordpoints_get_points_minimum( $type ) {
368
+function wordpoints_get_points_minimum($type) {
369 369
 
370
-	if ( ! wordpoints_is_points_type( $type ) ) {
370
+	if ( ! wordpoints_is_points_type($type)) {
371 371
 		return false;
372 372
 	}
373 373
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 * @param int    $minimum The minimum number of points.
380 380
 	 * @param string $type    The points type slug.
381 381
 	 */
382
-	return apply_filters( 'wordpoints_points_minimum', 0, $type );
382
+	return apply_filters('wordpoints_points_minimum', 0, $type);
383 383
 }
384 384
 
385 385
 /**
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The integer value of $points formatted for display.
402 402
  */
403
-function wordpoints_format_points( $points, $type, $context ) {
403
+function wordpoints_format_points($points, $type, $context) {
404 404
 
405 405
 	$_points = $points;
406
-	wordpoints_int( $_points );
406
+	wordpoints_int($_points);
407 407
 
408
-	if ( false === $_points || ! wordpoints_is_points_type( $type ) ) {
408
+	if (false === $_points || ! wordpoints_is_points_type($type)) {
409 409
 		return (string) $points;
410 410
 	}
411 411
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 * @param string $type      The type of points.
420 420
 	 * @param string $context   The context in which the points will be displayed.
421 421
 	 */
422
-	return apply_filters( 'wordpoints_format_points', $_points, $_points, $type, $context );
422
+	return apply_filters('wordpoints_format_points', $_points, $_points, $type, $context);
423 423
 }
424 424
 
425 425
 /**
@@ -436,15 +436,15 @@  discard block
 block discarded – undo
436 436
  *
437 437
  * @return string|false The user's points formatted for display, or false on failure.
438 438
  */
439
-function wordpoints_get_formatted_points( $user_id, $type, $context ) {
439
+function wordpoints_get_formatted_points($user_id, $type, $context) {
440 440
 
441
-	$points = wordpoints_get_points( $user_id, $type );
441
+	$points = wordpoints_get_points($user_id, $type);
442 442
 
443
-	if ( false === $points ) {
443
+	if (false === $points) {
444 444
 		return false;
445 445
 	}
446 446
 
447
-	return wordpoints_format_points( $points, $type, $context );
447
+	return wordpoints_format_points($points, $type, $context);
448 448
 }
449 449
 
450 450
 /**
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
  * @param string $type    The type of points to display.
459 459
  * @param string $context The context in which the points will be displayed.
460 460
  */
461
-function wordpoints_display_points( $user_id, $type, $context ) {
461
+function wordpoints_display_points($user_id, $type, $context) {
462 462
 
463
-	echo wordpoints_get_formatted_points( $user_id, $type, $context ); // XSS OK, WPCS
463
+	echo wordpoints_get_formatted_points($user_id, $type, $context); // XSS OK, WPCS
464 464
 }
465 465
 
466 466
 /**
@@ -483,21 +483,21 @@  discard block
 block discarded – undo
483 483
  *
484 484
  * @return int|false False on failure.
485 485
  */
486
-function wordpoints_get_points_above_minimum( $user_id, $type ) {
486
+function wordpoints_get_points_above_minimum($user_id, $type) {
487 487
 
488
-	$minimum = wordpoints_get_points_minimum( $type );
488
+	$minimum = wordpoints_get_points_minimum($type);
489 489
 
490
-	if ( false === $minimum ) {
490
+	if (false === $minimum) {
491 491
 		return false;
492 492
 	}
493 493
 
494
-	$points = wordpoints_get_points( $user_id, $type );
494
+	$points = wordpoints_get_points($user_id, $type);
495 495
 
496
-	if ( false === $points ) {
496
+	if (false === $points) {
497 497
 		return false;
498 498
 	}
499 499
 
500
-	return max( 0, $points - $minimum );
500
+	return max(0, $points - $minimum);
501 501
 }
502 502
 
503 503
 /**
@@ -519,19 +519,19 @@  discard block
 block discarded – undo
519 519
  *
520 520
  * @return bool Whether the transaction was successful.
521 521
  */
522
-function wordpoints_set_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
522
+function wordpoints_set_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
523 523
 
524
-	if ( false === wordpoints_int( $points ) ) {
524
+	if (false === wordpoints_int($points)) {
525 525
 		return false;
526 526
 	}
527 527
 
528
-	$current = wordpoints_get_points( $user_id, $points_type );
528
+	$current = wordpoints_get_points($user_id, $points_type);
529 529
 
530
-	if ( false === $current ) {
530
+	if (false === $current) {
531 531
 		return false;
532 532
 	}
533 533
 
534
-	return wordpoints_alter_points( $user_id, $points - $current, $points_type, $log_type, $meta, $log_text );
534
+	return wordpoints_alter_points($user_id, $points - $current, $points_type, $log_type, $meta, $log_text);
535 535
 }
536 536
 
537 537
 /**
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
  * @return int|bool On success, the log ID if the transaction is logged, or true if
575 575
  *                  it is not. False on failure.
576 576
  */
577
-function wordpoints_alter_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
577
+function wordpoints_alter_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
578 578
 
579 579
 	if (
580
-		! wordpoints_posint( $user_id )
581
-		|| ! wordpoints_int( $points )
582
-		|| ! wordpoints_is_points_type( $points_type )
583
-		|| empty( $log_type )
580
+		! wordpoints_posint($user_id)
581
+		|| ! wordpoints_int($points)
582
+		|| ! wordpoints_is_points_type($points_type)
583
+		|| empty($log_type)
584 584
 	) {
585 585
 		return false;
586 586
 	}
@@ -604,29 +604,29 @@  discard block
 block discarded – undo
604 604
 	 * @param string $log_type    The type of transaction.
605 605
 	 * @param array  $meta        Metadata for the transaction.
606 606
 	 */
607
-	$points = apply_filters( 'wordpoints_alter_points', $points, $points_type, $user_id, $log_type, $meta );
607
+	$points = apply_filters('wordpoints_alter_points', $points, $points_type, $user_id, $log_type, $meta);
608 608
 
609
-	if ( 0 === wordpoints_int( $points ) ) {
609
+	if (0 === wordpoints_int($points)) {
610 610
 		return true;
611
-	} elseif ( false === $points ) {
611
+	} elseif (false === $points) {
612 612
 		return false;
613 613
 	}
614 614
 
615 615
 	// Get the current points so we can check this won't go below the minimum.
616
-	$current_points = wordpoints_get_points( $user_id, $points_type );
617
-	$minimum = wordpoints_get_points_minimum( $points_type );
616
+	$current_points = wordpoints_get_points($user_id, $points_type);
617
+	$minimum = wordpoints_get_points_minimum($points_type);
618 618
 
619
-	if ( ( $current_points + $points ) < $minimum ) {
619
+	if (($current_points + $points) < $minimum) {
620 620
 
621 621
 		// The total was less than the minimum, set the number to the minimum.
622 622
 		$points = $minimum - $current_points;
623 623
 	}
624 624
 
625
-	$meta_key = wordpoints_get_points_user_meta_key( $points_type );
625
+	$meta_key = wordpoints_get_points_user_meta_key($points_type);
626 626
 
627
-	if ( '' === get_user_meta( $user_id, $meta_key, true ) ) {
627
+	if ('' === get_user_meta($user_id, $meta_key, true)) {
628 628
 
629
-		$result = add_user_meta( $user_id, wp_slash( $meta_key ), (int) $points, true );
629
+		$result = add_user_meta($user_id, wp_slash($meta_key), (int) $points, true);
630 630
 
631 631
 	} else {
632 632
 
@@ -645,10 +645,10 @@  discard block
 block discarded – undo
645 645
 			)
646 646
 		);
647 647
 
648
-		wp_cache_delete( $user_id, 'user_meta' );
648
+		wp_cache_delete($user_id, 'user_meta');
649 649
 	}
650 650
 
651
-	if ( ! $result ) {
651
+	if ( ! $result) {
652 652
 		return false;
653 653
 	}
654 654
 
@@ -662,15 +662,15 @@  discard block
 block discarded – undo
662 662
 	 * @param string $log_type        The type of transaction.
663 663
 	 * @param array  $meta            The metadata for this transaction.
664 664
 	 */
665
-	$log_transaction = apply_filters( 'wordpoints_points_log', true, $user_id, $points, $points_type, $log_type, $meta );
665
+	$log_transaction = apply_filters('wordpoints_points_log', true, $user_id, $points, $points_type, $log_type, $meta);
666 666
 
667 667
 	$log_id = false;
668
-	if ( $log_transaction ) {
668
+	if ($log_transaction) {
669 669
 
670
-		$log_text = wordpoints_render_points_log_text( $user_id, $points, $points_type, $log_type, $meta, $log_text );
670
+		$log_text = wordpoints_render_points_log_text($user_id, $points, $points_type, $log_type, $meta, $log_text);
671 671
 
672
-		if ( 'utf8' === $wpdb->get_col_charset( $wpdb->wordpoints_points_logs, 'text' ) ) {
673
-			$log_text = wp_encode_emoji( $log_text );
672
+		if ('utf8' === $wpdb->get_col_charset($wpdb->wordpoints_points_logs, 'text')) {
673
+			$log_text = wp_encode_emoji($log_text);
674 674
 		}
675 675
 
676 676
 		$result = $wpdb->insert(
@@ -681,20 +681,20 @@  discard block
 block discarded – undo
681 681
 				'points_type' => $points_type,
682 682
 				'log_type'    => $log_type,
683 683
 				'text'        => $log_text,
684
-				'date'        => current_time( 'mysql', 1 ),
684
+				'date'        => current_time('mysql', 1),
685 685
 				'site_id'     => $wpdb->siteid,
686 686
 				'blog_id'     => $wpdb->blogid,
687 687
 			),
688
-			array( '%d', '%d', '%s', '%s', '%s', '%s', '%d', '%d' )
688
+			array('%d', '%d', '%s', '%s', '%s', '%s', '%d', '%d')
689 689
 		);
690 690
 
691
-		if ( false !== $result ) {
691
+		if (false !== $result) {
692 692
 
693 693
 			$log_id = (int) $wpdb->insert_id;
694 694
 
695
-			foreach ( $meta as $meta_key => $meta_value ) {
695
+			foreach ($meta as $meta_key => $meta_value) {
696 696
 
697
-				wordpoints_add_points_log_meta( $log_id, $meta_key, $meta_value );
697
+				wordpoints_add_points_log_meta($log_id, $meta_key, $meta_value);
698 698
 			}
699 699
 
700 700
 			/**
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 			 * @param array  $meta        Metadata for the transaction.
711 711
 			 * @param int    $log_id      The ID of the transaction log entry.
712 712
 			 */
713
-			do_action( 'wordpoints_points_log', $user_id, $points, $points_type, $log_type, $meta, $log_id );
713
+			do_action('wordpoints_points_log', $user_id, $points, $points_type, $log_type, $meta, $log_id);
714 714
 		}
715 715
 
716 716
 	}  // End if ( $log_transaction ).
@@ -728,9 +728,9 @@  discard block
 block discarded – undo
728 728
 	 * @param array  $meta        Metadata for the transaction.
729 729
 	 * @param int|false $log_id   The ID of the transaction log, or false if not logged.
730 730
 	 */
731
-	do_action( 'wordpoints_points_altered', $user_id, $points, $points_type, $log_type, $meta, $log_id );
731
+	do_action('wordpoints_points_altered', $user_id, $points, $points_type, $log_type, $meta, $log_id);
732 732
 
733
-	if ( $log_id ) {
733
+	if ($log_id) {
734 734
 		return $log_id;
735 735
 	} else {
736 736
 		return true;
@@ -756,9 +756,9 @@  discard block
 block discarded – undo
756 756
  *
757 757
  * @return bool Whether the points were added successfully.
758 758
  */
759
-function wordpoints_add_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
759
+function wordpoints_add_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
760 760
 
761
-	return wordpoints_alter_points( $user_id, wordpoints_posint( $points ), $points_type, $log_type, $meta, $log_text );
761
+	return wordpoints_alter_points($user_id, wordpoints_posint($points), $points_type, $log_type, $meta, $log_text);
762 762
 }
763 763
 
764 764
 /**
@@ -779,9 +779,9 @@  discard block
 block discarded – undo
779 779
  *
780 780
  * @return bool Whether the points were subtracted successfully.
781 781
  */
782
-function wordpoints_subtract_points( $user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '' ) {
782
+function wordpoints_subtract_points($user_id, $points, $points_type, $log_type, $meta = array(), $log_text = '') {
783 783
 
784
-	return wordpoints_alter_points( $user_id, -wordpoints_posint( $points ), $points_type, $log_type, $meta, $log_text );
784
+	return wordpoints_alter_points($user_id, -wordpoints_posint($points), $points_type, $log_type, $meta, $log_text);
785 785
 }
786 786
 
787 787
 /**
@@ -793,9 +793,9 @@  discard block
 block discarded – undo
793 793
  *
794 794
  * @return string The corrected column name.
795 795
  */
796
-function _wordpoints_points_log_meta_column( $column ) {
796
+function _wordpoints_points_log_meta_column($column) {
797 797
 
798
-	if ( 'wordpoints_points_log_id' === $column ) {
798
+	if ('wordpoints_points_log_id' === $column) {
799 799
 		$column = 'log_id';
800 800
 	}
801 801
 
@@ -820,23 +820,23 @@  discard block
 block discarded – undo
820 820
  *
821 821
  * @return bool Whether the metadata was added successfully.
822 822
  */
823
-function wordpoints_add_points_log_meta( $log_id, $meta_key, $meta_value, $unique = false ) {
823
+function wordpoints_add_points_log_meta($log_id, $meta_key, $meta_value, $unique = false) {
824 824
 
825 825
 	global $wpdb;
826 826
 
827
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
827
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
828 828
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
829 829
 
830 830
 	$result = add_metadata(
831 831
 		'wordpoints_points_log'
832 832
 		, $log_id
833
-		, wp_slash( $meta_key )
834
-		, wp_slash( $meta_value )
833
+		, wp_slash($meta_key)
834
+		, wp_slash($meta_value)
835 835
 		, $unique
836 836
 	);
837 837
 
838
-	unset( $wpdb->wordpoints_points_logmeta );
839
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
838
+	unset($wpdb->wordpoints_points_logmeta);
839
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
840 840
 
841 841
 	return $result;
842 842
 }
@@ -855,15 +855,15 @@  discard block
 block discarded – undo
855 855
  *
856 856
  * @return mixed The meta key, or null on failure.
857 857
  */
858
-function wordpoints_get_points_log_meta( $log_id, $meta_key = '', $single = false ) {
858
+function wordpoints_get_points_log_meta($log_id, $meta_key = '', $single = false) {
859 859
 
860 860
 	global $wpdb;
861 861
 
862
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
862
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
863 863
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
864
-	$result = get_metadata( 'wordpoints_points_log', $log_id, $meta_key, $single );
865
-	unset( $wpdb->wordpoints_points_logmeta );
866
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
864
+	$result = get_metadata('wordpoints_points_log', $log_id, $meta_key, $single);
865
+	unset($wpdb->wordpoints_points_logmeta);
866
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
867 867
 
868 868
 	return $result;
869 869
 }
@@ -883,23 +883,23 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return bool Whether any rows were updated.
885 885
  */
886
-function wordpoints_update_points_log_meta( $log_id, $meta_key, $meta_value, $previous = null ) {
886
+function wordpoints_update_points_log_meta($log_id, $meta_key, $meta_value, $previous = null) {
887 887
 
888 888
 	global $wpdb;
889 889
 
890
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
890
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
891 891
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
892 892
 
893 893
 	$result = update_metadata(
894 894
 		'wordpoints_points_log'
895 895
 		, $log_id
896
-		, wp_slash( $meta_key )
897
-		, wp_slash( $meta_value )
896
+		, wp_slash($meta_key)
897
+		, wp_slash($meta_value)
898 898
 		, $previous
899 899
 	);
900 900
 
901
-	unset( $wpdb->wordpoints_points_logmeta );
902
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
901
+	unset($wpdb->wordpoints_points_logmeta);
902
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
903 903
 
904 904
 	return $result;
905 905
 }
@@ -920,23 +920,23 @@  discard block
 block discarded – undo
920 920
  *
921 921
  * @return bool Whether any rows where deleted.
922 922
  */
923
-function wordpoints_delete_points_log_meta( $log_id, $meta_key = '', $meta_value = null, $delete_all = false ) {
923
+function wordpoints_delete_points_log_meta($log_id, $meta_key = '', $meta_value = null, $delete_all = false) {
924 924
 
925 925
 	global $wpdb;
926 926
 
927
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
927
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
928 928
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
929 929
 
930 930
 	$result = delete_metadata(
931 931
 		'wordpoints_points_log'
932 932
 		, $log_id
933
-		, wp_slash( $meta_key )
934
-		, wp_slash( $meta_value )
933
+		, wp_slash($meta_key)
934
+		, wp_slash($meta_value)
935 935
 		, $delete_all
936 936
 	);
937 937
 
938
-	unset( $wpdb->wordpoints_points_logmeta );
939
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
938
+	unset($wpdb->wordpoints_points_logmeta);
939
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
940 940
 
941 941
 	return $result;
942 942
 }
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
  *
949 949
  * @param int $log_id The ID of the points log whose metadata to delete.
950 950
  */
951
-function wordpoints_points_log_delete_all_metadata( $log_id ) {
951
+function wordpoints_points_log_delete_all_metadata($log_id) {
952 952
 
953 953
 	global $wpdb;
954 954
 
@@ -963,15 +963,15 @@  discard block
 block discarded – undo
963 963
 		)
964 964
 	); // WPCS: cache pass.
965 965
 
966
-	add_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
966
+	add_filter('sanitize_key', '_wordpoints_points_log_meta_column');
967 967
 	$wpdb->wordpoints_points_logmeta = $wpdb->wordpoints_points_log_meta;
968 968
 
969
-	foreach ( $meta_ids as $mid ) {
970
-		delete_metadata_by_mid( 'wordpoints_points_log', $mid );
969
+	foreach ($meta_ids as $mid) {
970
+		delete_metadata_by_mid('wordpoints_points_log', $mid);
971 971
 	}
972 972
 
973
-	unset( $wpdb->wordpoints_points_logmeta );
974
-	remove_filter( 'sanitize_key', '_wordpoints_points_log_meta_column' );
973
+	unset($wpdb->wordpoints_points_logmeta);
974
+	remove_filter('sanitize_key', '_wordpoints_points_log_meta_column');
975 975
 }
976 976
 
977 977
 /**
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		'wordpoints_default_points_type'
988 988
 	);
989 989
 
990
-	if ( ! wordpoints_is_points_type( $points_type ) ) {
990
+	if ( ! wordpoints_is_points_type($points_type)) {
991 991
 		return false;
992 992
 	}
993 993
 
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
  *
1009 1009
  * @return string The log text.
1010 1010
  */
1011
-function wordpoints_render_points_log_text( $user_id, $points, $points_type, $log_type, $meta, $default_text = '' ) {
1011
+function wordpoints_render_points_log_text($user_id, $points, $points_type, $log_type, $meta, $default_text = '') {
1012 1012
 
1013 1013
 	/**
1014 1014
 	 * The text for a points log entry.
@@ -1020,10 +1020,10 @@  discard block
 block discarded – undo
1020 1020
 	 * @param string $log_type    The type of transaction being logged.
1021 1021
 	 * @param array  $meta        The metadata for this transaction.
1022 1022
 	 */
1023
-	$text = apply_filters( "wordpoints_points_log-{$log_type}", $default_text, $user_id, $points, $points_type, $log_type, $meta );
1023
+	$text = apply_filters("wordpoints_points_log-{$log_type}", $default_text, $user_id, $points, $points_type, $log_type, $meta);
1024 1024
 
1025
-	if ( empty( $text ) ) {
1026
-		$text = _x( '(no description)', 'points log', 'wordpoints' );
1025
+	if (empty($text)) {
1026
+		$text = _x('(no description)', 'points log', 'wordpoints');
1027 1027
 	}
1028 1028
 
1029 1029
 	return $text;
@@ -1039,32 +1039,32 @@  discard block
 block discarded – undo
1039 1039
  *
1040 1040
  * @return void
1041 1041
  */
1042
-function wordpoints_regenerate_points_logs( $logs ) {
1042
+function wordpoints_regenerate_points_logs($logs) {
1043 1043
 
1044
-	if ( empty( $logs ) || ! is_array( $logs ) ) {
1044
+	if (empty($logs) || ! is_array($logs)) {
1045 1045
 		return;
1046 1046
 	}
1047 1047
 
1048
-	if ( ! is_object( current( $logs ) ) ) {
1048
+	if ( ! is_object(current($logs))) {
1049 1049
 
1050
-		_deprecated_argument( __FUNCTION__, '1.6.0', 'The first parameter should be an array of log objects, not log IDs.' );
1050
+		_deprecated_argument(__FUNCTION__, '1.6.0', 'The first parameter should be an array of log objects, not log IDs.');
1051 1051
 
1052
-		$logs = new WordPoints_Points_Logs_Query( array( 'id__in' => $logs ) );
1052
+		$logs = new WordPoints_Points_Logs_Query(array('id__in' => $logs));
1053 1053
 		$logs = $logs->get();
1054 1054
 
1055
-		if ( ! is_array( $logs ) ) {
1055
+		if ( ! is_array($logs)) {
1056 1056
 			return;
1057 1057
 		}
1058 1058
 	}
1059 1059
 
1060 1060
 	global $wpdb;
1061 1061
 
1062
-	$flushed = array( 'points_types' => array(), 'user_ids' => array() );
1062
+	$flushed = array('points_types' => array(), 'user_ids' => array());
1063 1063
 
1064
-	foreach ( $logs as $log ) {
1064
+	foreach ($logs as $log) {
1065 1065
 
1066
-		$meta = wordpoints_get_points_log_meta( $log->id );
1067
-		$meta = wp_list_pluck( $meta, 0 );
1066
+		$meta = wordpoints_get_points_log_meta($log->id);
1067
+		$meta = wp_list_pluck($meta, 0);
1068 1068
 
1069 1069
 		$new_log_text = wordpoints_render_points_log_text(
1070 1070
 			$log->user_id
@@ -1074,31 +1074,31 @@  discard block
 block discarded – undo
1074 1074
 			, $meta
1075 1075
 		);
1076 1076
 
1077
-		if ( $new_log_text !== $log->text ) {
1077
+		if ($new_log_text !== $log->text) {
1078 1078
 
1079
-			if ( ! isset( $is_utf8 ) ) {
1080
-				$is_utf8 = 'utf8' === $wpdb->get_col_charset( $wpdb->wordpoints_points_logs, 'text' );
1079
+			if ( ! isset($is_utf8)) {
1080
+				$is_utf8 = 'utf8' === $wpdb->get_col_charset($wpdb->wordpoints_points_logs, 'text');
1081 1081
 			}
1082 1082
 
1083
-			if ( $is_utf8 ) {
1084
-				$new_log_text = wp_encode_emoji( $new_log_text );
1083
+			if ($is_utf8) {
1084
+				$new_log_text = wp_encode_emoji($new_log_text);
1085 1085
 			}
1086 1086
 
1087 1087
 			$wpdb->update(
1088 1088
 				$wpdb->wordpoints_points_logs
1089
-				, array( 'text' => $new_log_text )
1090
-				, array( 'id' => $log->id )
1091
-				, array( '%s' )
1092
-				, array( '%d' )
1089
+				, array('text' => $new_log_text)
1090
+				, array('id' => $log->id)
1091
+				, array('%s')
1092
+				, array('%d')
1093 1093
 			);
1094 1094
 
1095
-			if ( ! isset( $flushed['points_types'][ $log->points_type ], $flushed['user_ids'][ $log->user_id ] ) ) {
1095
+			if ( ! isset($flushed['points_types'][$log->points_type], $flushed['user_ids'][$log->user_id])) {
1096 1096
 				wordpoints_flush_points_logs_caches(
1097
-					array( 'user_id' => $log->user_id, 'points_type' => $log->points_type )
1097
+					array('user_id' => $log->user_id, 'points_type' => $log->points_type)
1098 1098
 				);
1099 1099
 
1100
-				$flushed['points_types'][ $log->points_type ] = true;
1101
-				$flushed['user_ids'][ $log->user_id ] = true;
1100
+				$flushed['points_types'][$log->points_type] = true;
1101
+				$flushed['user_ids'][$log->user_id] = true;
1102 1102
 			}
1103 1103
 		}
1104 1104
 
@@ -1118,35 +1118,35 @@  discard block
 block discarded – undo
1118 1118
  *
1119 1119
  * @return int[] The IDs of the users with the most points.
1120 1120
  */
1121
-function wordpoints_points_get_top_users( $num_users, $points_type ) {
1121
+function wordpoints_points_get_top_users($num_users, $points_type) {
1122 1122
 
1123
-	if ( ! wordpoints_posint( $num_users ) || ! wordpoints_is_points_type( $points_type ) ) {
1123
+	if ( ! wordpoints_posint($num_users) || ! wordpoints_is_points_type($points_type)) {
1124 1124
 		return;
1125 1125
 	}
1126 1126
 
1127
-	$cache = wp_cache_get( $points_type, 'wordpoints_points_top_users' );
1127
+	$cache = wp_cache_get($points_type, 'wordpoints_points_top_users');
1128 1128
 
1129
-	if ( ! is_array( $cache ) ) {
1130
-		$cache = array( 'is_max' => false, 'top_users' => array() );
1129
+	if ( ! is_array($cache)) {
1130
+		$cache = array('is_max' => false, 'top_users' => array());
1131 1131
 	}
1132 1132
 
1133
-	$cached_users = count( $cache['top_users'] );
1133
+	$cached_users = count($cache['top_users']);
1134 1134
 
1135
-	if ( $num_users > $cached_users && ! $cache['is_max'] ) {
1135
+	if ($num_users > $cached_users && ! $cache['is_max']) {
1136 1136
 
1137 1137
 		global $wpdb;
1138 1138
 
1139
-		$excluded = wordpoints_get_excluded_users( 'top_users' );
1139
+		$excluded = wordpoints_get_excluded_users('top_users');
1140 1140
 
1141 1141
 		$exclude_users = '';
1142
-		if ( ! empty( $excluded ) ) {
1143
-			$exclude_users = 'WHERE `ID` NOT IN (' . wordpoints_prepare__in( $excluded, '%d' ) . ')';
1142
+		if ( ! empty($excluded)) {
1143
+			$exclude_users = 'WHERE `ID` NOT IN (' . wordpoints_prepare__in($excluded, '%d') . ')';
1144 1144
 		}
1145 1145
 
1146 1146
 		$multisite_join = '';
1147
-		if ( is_multisite() && ! is_wordpoints_network_active() ) {
1147
+		if (is_multisite() && ! is_wordpoints_network_active()) {
1148 1148
 
1149
-			$prefix = $wpdb->get_blog_prefix( get_current_blog_id() );
1149
+			$prefix = $wpdb->get_blog_prefix(get_current_blog_id());
1150 1150
 
1151 1151
 			$multisite_join = "
1152 1152
 					INNER JOIN `{$wpdb->usermeta}` AS `cap`
@@ -1171,27 +1171,27 @@  discard block
 block discarded – undo
1171 1171
 					ORDER BY COALESCE(CONVERT(`meta`.`meta_value`, SIGNED INTEGER), 0) DESC
1172 1172
 					LIMIT %d,%d
1173 1173
 				",
1174
-				wordpoints_get_points_user_meta_key( $points_type ),
1174
+				wordpoints_get_points_user_meta_key($points_type),
1175 1175
 				$cached_users,
1176 1176
 				$num_users
1177 1177
 			)
1178 1178
 		);
1179 1179
 
1180
-		if ( ! is_array( $top_users ) ) {
1180
+		if ( ! is_array($top_users)) {
1181 1181
 			return array();
1182 1182
 		}
1183 1183
 
1184
-		$cache['top_users'] = array_merge( $cache['top_users'], $top_users );
1184
+		$cache['top_users'] = array_merge($cache['top_users'], $top_users);
1185 1185
 
1186
-		if ( count( $cache['top_users'] ) < $num_users ) {
1186
+		if (count($cache['top_users']) < $num_users) {
1187 1187
 			$cache['is_max'] = true;
1188 1188
 		}
1189 1189
 
1190
-		wp_cache_set( $points_type, $cache, 'wordpoints_points_top_users' );
1190
+		wp_cache_set($points_type, $cache, 'wordpoints_points_top_users');
1191 1191
 
1192 1192
 	} // End if ( not cached ).
1193 1193
 
1194
-	return array_slice( $cache['top_users'], 0, $num_users );
1194
+	return array_slice($cache['top_users'], 0, $num_users);
1195 1195
 }
1196 1196
 
1197 1197
 /**
@@ -1203,25 +1203,25 @@  discard block
 block discarded – undo
1203 1203
  * @param string $points_type The type of points.
1204 1204
  * @param string $context     The context in which the table is being displayed.
1205 1205
  */
1206
-function wordpoints_points_show_top_users( $num_users, $points_type, $context = 'default' ) {
1206
+function wordpoints_points_show_top_users($num_users, $points_type, $context = 'default') {
1207 1207
 
1208
-	wp_enqueue_style( 'wordpoints-top-users' );
1208
+	wp_enqueue_style('wordpoints-top-users');
1209 1209
 
1210
-	$top_users = wordpoints_points_get_top_users( $num_users, $points_type );
1210
+	$top_users = wordpoints_points_get_top_users($num_users, $points_type);
1211 1211
 
1212
-	if ( ! $top_users ) {
1212
+	if ( ! $top_users) {
1213 1213
 		return;
1214 1214
 	}
1215 1215
 
1216 1216
 	$column_headers = array(
1217
-		'position' => _x( 'Position', 'top users table heading', 'wordpoints' ),
1218
-		'user'     => _x( 'User', 'top users table heading', 'wordpoints' ),
1219
-		'points'   => _x( 'Points', 'top users table heading', 'wordpoints' ),
1217
+		'position' => _x('Position', 'top users table heading', 'wordpoints'),
1218
+		'user'     => _x('User', 'top users table heading', 'wordpoints'),
1219
+		'points'   => _x('Points', 'top users table heading', 'wordpoints'),
1220 1220
 	);
1221 1221
 
1222
-	$points_type_name = wordpoints_get_points_type_setting( $points_type, 'name' );
1222
+	$points_type_name = wordpoints_get_points_type_setting($points_type, 'name');
1223 1223
 
1224
-	if ( ! empty( $points_type_name ) ) {
1224
+	if ( ! empty($points_type_name)) {
1225 1225
 		$column_headers['points'] = $points_type_name;
1226 1226
 	}
1227 1227
 
@@ -1237,18 +1237,18 @@  discard block
 block discarded – undo
1237 1237
 	$extra_classes = apply_filters(
1238 1238
 		'wordpoints_points_top_users_table_extra_classes'
1239 1239
 		, array()
1240
-		, compact( 'num_users', 'points_type', 'context' )
1240
+		, compact('num_users', 'points_type', 'context')
1241 1241
 		, $top_users
1242 1242
 	);
1243 1243
 
1244 1244
 	?>
1245 1245
 
1246
-	<table class="wordpoints-points-top-users <?php echo esc_attr( implode( ' ', $extra_classes ) ); ?>">
1246
+	<table class="wordpoints-points-top-users <?php echo esc_attr(implode(' ', $extra_classes)); ?>">
1247 1247
 		<thead>
1248 1248
 			<tr>
1249
-				<th scope="col"><?php echo esc_html( $column_headers['position'] ); ?></th>
1250
-				<th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th>
1251
-				<th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th>
1249
+				<th scope="col"><?php echo esc_html($column_headers['position']); ?></th>
1250
+				<th scope="col"><?php echo esc_html($column_headers['user']); ?></th>
1251
+				<th scope="col"><?php echo esc_html($column_headers['points']); ?></th>
1252 1252
 			</tr>
1253 1253
 		</thead>
1254 1254
 		<tbody>
@@ -1256,16 +1256,16 @@  discard block
 block discarded – undo
1256 1256
 
1257 1257
 			$position = 1;
1258 1258
 
1259
-			foreach ( $top_users as $user_id ) {
1259
+			foreach ($top_users as $user_id) {
1260 1260
 
1261
-				$user = get_userdata( $user_id );
1261
+				$user = get_userdata($user_id);
1262 1262
 
1263 1263
 				?>
1264 1264
 
1265 1265
 				<tr class="top-<?php echo (int) $position; ?>">
1266
-					<td><?php echo esc_html( number_format_i18n( $position ) ); ?></td>
1266
+					<td><?php echo esc_html(number_format_i18n($position)); ?></td>
1267 1267
 					<td>
1268
-						<?php echo get_avatar( $user_id, 32 ); ?>
1268
+						<?php echo get_avatar($user_id, 32); ?>
1269 1269
 						<?php
1270 1270
 
1271 1271
 						$name = sanitize_user_field(
@@ -1287,13 +1287,13 @@  discard block
 block discarded – undo
1287 1287
 						 * @param string $points_type The points type the table is for.
1288 1288
 						 * @param string $context     The context in which the table is being displayed.
1289 1289
 						 */
1290
-						$name = apply_filters( 'wordpoints_points_top_users_username', $name, $user_id, $points_type, "top_users_{$context}" );
1290
+						$name = apply_filters('wordpoints_points_top_users_username', $name, $user_id, $points_type, "top_users_{$context}");
1291 1291
 
1292
-						echo wp_kses( $name, 'wordpoints_top_users_username' );
1292
+						echo wp_kses($name, 'wordpoints_top_users_username');
1293 1293
 
1294 1294
 						?>
1295 1295
 					</td>
1296
-					<td><?php wordpoints_display_points( $user_id, $points_type, "top_users_{$context}" ); ?></td>
1296
+					<td><?php wordpoints_display_points($user_id, $points_type, "top_users_{$context}"); ?></td>
1297 1297
 				</tr>
1298 1298
 
1299 1299
 				<?php
@@ -1306,9 +1306,9 @@  discard block
 block discarded – undo
1306 1306
 		</tbody>
1307 1307
 		<tfoot>
1308 1308
 		<tr>
1309
-			<th scope="col"><?php echo esc_html( $column_headers['position'] ); ?></th>
1310
-			<th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th>
1311
-			<th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th>
1309
+			<th scope="col"><?php echo esc_html($column_headers['position']); ?></th>
1310
+			<th scope="col"><?php echo esc_html($column_headers['user']); ?></th>
1311
+			<th scope="col"><?php echo esc_html($column_headers['points']); ?></th>
1312 1312
 		</tr>
1313 1313
 		</tfoot>
1314 1314
 	</table>
@@ -1328,9 +1328,9 @@  discard block
 block discarded – undo
1328 1328
  * @param int    $points      The number of points. Not used.
1329 1329
  * @param string $points_type The type of points being awarded.
1330 1330
  */
1331
-function wordpoints_clean_points_top_users_cache( $user_id, $points, $points_type ) {
1331
+function wordpoints_clean_points_top_users_cache($user_id, $points, $points_type) {
1332 1332
 
1333
-	wp_cache_delete( $points_type, 'wordpoints_points_top_users' );
1333
+	wp_cache_delete($points_type, 'wordpoints_points_top_users');
1334 1334
 }
1335 1335
 
1336 1336
 /**
@@ -1342,16 +1342,16 @@  discard block
 block discarded – undo
1342 1342
  */
1343 1343
 function wordpoints_clean_points_top_users_cache_user_register() {
1344 1344
 
1345
-	foreach ( wordpoints_get_points_types() as $slug => $unused ) {
1345
+	foreach (wordpoints_get_points_types() as $slug => $unused) {
1346 1346
 
1347
-		$cache = wp_cache_get( $slug, 'wordpoints_points_top_users' );
1347
+		$cache = wp_cache_get($slug, 'wordpoints_points_top_users');
1348 1348
 
1349 1349
 		// If there aren't fewer users than the cache holds, we don't need to clear it.
1350
-		if ( ! is_array( $cache ) || ! $cache['is_max'] ) {
1350
+		if ( ! is_array($cache) || ! $cache['is_max']) {
1351 1351
 			continue;
1352 1352
 		}
1353 1353
 
1354
-		wp_cache_delete( $slug, 'wordpoints_points_top_users' );
1354
+		wp_cache_delete($slug, 'wordpoints_points_top_users');
1355 1355
 	}
1356 1356
 }
1357 1357
 
@@ -1365,18 +1365,18 @@  discard block
 block discarded – undo
1365 1365
  *
1366 1366
  * @param int $user_id The ID of the user who was deleted.
1367 1367
  */
1368
-function wordpoints_clean_points_top_users_cache_user_deleted( $user_id ) {
1368
+function wordpoints_clean_points_top_users_cache_user_deleted($user_id) {
1369 1369
 
1370
-	foreach ( wordpoints_get_points_types() as $slug => $unused ) {
1370
+	foreach (wordpoints_get_points_types() as $slug => $unused) {
1371 1371
 
1372
-		$cache = wp_cache_get( $slug, 'wordpoints_points_top_users' );
1372
+		$cache = wp_cache_get($slug, 'wordpoints_points_top_users');
1373 1373
 
1374 1374
 		// If this user isn't in the cache, we don't need to clear it.
1375
-		if ( ! is_array( $cache ) || ! in_array( $user_id, $cache['top_users'] ) ) {
1375
+		if ( ! is_array($cache) || ! in_array($user_id, $cache['top_users'])) {
1376 1376
 			continue;
1377 1377
 		}
1378 1378
 
1379
-		wp_cache_delete( $slug, 'wordpoints_points_top_users' );
1379
+		wp_cache_delete($slug, 'wordpoints_points_top_users');
1380 1380
 	}
1381 1381
 }
1382 1382
 
@@ -1389,18 +1389,18 @@  discard block
 block discarded – undo
1389 1389
  */
1390 1390
 function wordpoints_register_points_hooks() {
1391 1391
 
1392
-	WordPoints_Points_Hooks::register( 'WordPoints_Comment_Received_Points_Hook' );
1393
-	WordPoints_Points_Hooks::register( 'WordPoints_Comment_Points_Hook' );
1394
-	WordPoints_Points_Hooks::register( 'WordPoints_Periodic_Points_Hook' );
1395
-	WordPoints_Points_Hooks::register( 'WordPoints_Post_Points_Hook' );
1396
-	WordPoints_Points_Hooks::register( 'WordPoints_Registration_Points_Hook' );
1392
+	WordPoints_Points_Hooks::register('WordPoints_Comment_Received_Points_Hook');
1393
+	WordPoints_Points_Hooks::register('WordPoints_Comment_Points_Hook');
1394
+	WordPoints_Points_Hooks::register('WordPoints_Periodic_Points_Hook');
1395
+	WordPoints_Points_Hooks::register('WordPoints_Post_Points_Hook');
1396
+	WordPoints_Points_Hooks::register('WordPoints_Registration_Points_Hook');
1397 1397
 
1398
-	if ( get_site_option( 'wordpoints_post_delete_hook_legacy' ) ) {
1399
-		WordPoints_Points_Hooks::register( 'WordPoints_Post_Delete_Points_Hook' );
1398
+	if (get_site_option('wordpoints_post_delete_hook_legacy')) {
1399
+		WordPoints_Points_Hooks::register('WordPoints_Post_Delete_Points_Hook');
1400 1400
 	}
1401 1401
 
1402
-	if ( get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
1403
-		WordPoints_Points_Hooks::register( 'WordPoints_Comment_Removed_Points_Hook' );
1402
+	if (get_site_option('wordpoints_comment_removed_hook_legacy')) {
1403
+		WordPoints_Points_Hooks::register('WordPoints_Comment_Removed_Points_Hook');
1404 1404
 	}
1405 1405
 }
1406 1406
 
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
 		}
89 89
 	}
90 90
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @return bool Whether the rank type was registered for this group.
122 122
 	 */
123
-	public function has_type( $type ) {
123
+	public function has_type($type) {
124 124
 
125
-		if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) {
125
+		if ( ! WordPoints_Rank_Types::is_type_registered($type)) {
126 126
 			return false;
127 127
 		}
128 128
 
129
-		return isset( $this->types[ $type ] );
129
+		return isset($this->types[$type]);
130 130
 	}
131 131
 
132 132
 	/**
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return bool Whether the type was added successfully.
140 140
 	 */
141
-	public function add_type( $type ) {
141
+	public function add_type($type) {
142 142
 
143
-		if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) {
143
+		if ( ! WordPoints_Rank_Types::is_type_registered($type)) {
144 144
 			return false;
145 145
 		}
146 146
 
147
-		if ( isset( $this->types[ $type ] ) ) {
147
+		if (isset($this->types[$type])) {
148 148
 			return false;
149 149
 		}
150 150
 
151
-		$this->types[ $type ] = $type;
151
+		$this->types[$type] = $type;
152 152
 
153 153
 		return true;
154 154
 	}
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @return bool Whether the type was removed successfully.
166 166
 	 */
167
-	public function remove_type( $type ) {
167
+	public function remove_type($type) {
168 168
 
169
-		if ( 'base' === $type ) {
169
+		if ('base' === $type) {
170 170
 			return false;
171 171
 		}
172 172
 
173
-		if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) {
173
+		if ( ! WordPoints_Rank_Types::is_type_registered($type)) {
174 174
 			return false;
175 175
 		}
176 176
 
177
-		if ( ! isset( $this->types[ $type ] ) ) {
177
+		if ( ! isset($this->types[$type])) {
178 178
 			return false;
179 179
 		}
180 180
 
181
-		unset( $this->types[ $type ] );
181
+		unset($this->types[$type]);
182 182
 
183 183
 		return true;
184 184
 	}
@@ -197,30 +197,30 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return bool Whether the rank was added successfully.
199 199
 	 */
200
-	public function add_rank( $rank_id, $position ) {
200
+	public function add_rank($rank_id, $position) {
201 201
 
202 202
 		if (
203
-			! wordpoints_posint( $rank_id )
204
-			|| false === wordpoints_int( $position )
203
+			! wordpoints_posint($rank_id)
204
+			|| false === wordpoints_int($position)
205 205
 			|| $position < 0
206 206
 		) {
207 207
 			return false;
208 208
 		}
209 209
 
210 210
 		// Don't allow a rank to be added to this group more than once.
211
-		if ( false !== $this->get_rank_position( $rank_id ) ) {
211
+		if (false !== $this->get_rank_position($rank_id)) {
212 212
 			return false;
213 213
 		}
214 214
 
215
-		$ranks = $this->_insert_rank( $this->get_ranks(), $rank_id, $position );
215
+		$ranks = $this->_insert_rank($this->get_ranks(), $rank_id, $position);
216 216
 
217
-		if ( ! $this->save_ranks( $ranks ) ) {
217
+		if ( ! $this->save_ranks($ranks)) {
218 218
 			return false;
219 219
 		}
220 220
 
221 221
 		// If there is a rank before this one, check if any of the users who have it
222 222
 		// can increase to this new one.
223
-		$this->_maybe_increase_users_with_previous_rank( $rank_id );
223
+		$this->_maybe_increase_users_with_previous_rank($rank_id);
224 224
 
225 225
 		return true;
226 226
 	}
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return bool Whether the rank was moved successfully.
240 240
 	 */
241
-	public function move_rank( $rank_id, $position ) {
241
+	public function move_rank($rank_id, $position) {
242 242
 
243
-		$current_position = $this->get_rank_position( $rank_id );
243
+		$current_position = $this->get_rank_position($rank_id);
244 244
 
245
-		if ( $current_position === $position ) {
245
+		if ($current_position === $position) {
246 246
 			return false;
247 247
 		}
248 248
 
249 249
 		$ranks = $this->get_ranks();
250 250
 
251
-		unset( $ranks[ $current_position ] );
251
+		unset($ranks[$current_position]);
252 252
 
253
-		ksort( $ranks );
253
+		ksort($ranks);
254 254
 
255
-		$ranks = $this->_insert_rank( array_values( $ranks ), $rank_id, $position );
255
+		$ranks = $this->_insert_rank(array_values($ranks), $rank_id, $position);
256 256
 
257
-		if ( ! $this->save_ranks( $ranks ) ) {
257
+		if ( ! $this->save_ranks($ranks)) {
258 258
 			return false;
259 259
 		}
260 260
 
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 		// rank's position.
263 263
 		$this->_move_users_from_rank_to_rank(
264 264
 			$rank_id
265
-			, $this->get_rank( $current_position - 1 )
265
+			, $this->get_rank($current_position - 1)
266 266
 		);
267 267
 
268 268
 		// The users of the rank previous to this one's new position should maybe be
269 269
 		// increased to this rank.
270
-		$this->_maybe_increase_users_with_previous_rank( $rank_id );
270
+		$this->_maybe_increase_users_with_previous_rank($rank_id);
271 271
 
272 272
 		return true;
273 273
 	}
@@ -281,45 +281,45 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return bool Whether the rank was removed successfully.
283 283
 	 */
284
-	public function remove_rank( $rank_id ) {
284
+	public function remove_rank($rank_id) {
285 285
 
286 286
 		global $wpdb;
287 287
 
288
-		$position = $this->get_rank_position( $rank_id );
288
+		$position = $this->get_rank_position($rank_id);
289 289
 
290
-		if ( false === $position ) {
290
+		if (false === $position) {
291 291
 			return false;
292 292
 		}
293 293
 
294 294
 		$ranks = $this->get_ranks();
295 295
 
296
-		unset( $ranks[ $position ] );
296
+		unset($ranks[$position]);
297 297
 
298
-		if ( ! $this->save_ranks( $ranks ) ) {
298
+		if ( ! $this->save_ranks($ranks)) {
299 299
 			return false;
300 300
 		}
301 301
 
302 302
 		// Assign the previous rank to users who have this rank.
303
-		if ( isset( $ranks[ $position - 1 ] ) ) {
303
+		if (isset($ranks[$position - 1])) {
304 304
 
305
-			$this->_move_users_from_rank_to_rank( $rank_id, $ranks[ $position - 1 ] );
305
+			$this->_move_users_from_rank_to_rank($rank_id, $ranks[$position - 1]);
306 306
 
307 307
 		} else {
308 308
 
309 309
 			// If there is no previous rank, just delete the rows.
310 310
 			$wpdb->delete(
311 311
 				$wpdb->wordpoints_user_ranks
312
-				, array( 'rank_id' => $rank_id )
312
+				, array('rank_id' => $rank_id)
313 313
 				, '%d'
314 314
 			);
315 315
 
316
-			$group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' );
317
-			unset( $group_ranks[ $rank_id ] );
318
-			wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' );
316
+			$group_ranks = wp_cache_get($this->slug, 'wordpoints_user_ranks');
317
+			unset($group_ranks[$rank_id]);
318
+			wp_cache_set($this->slug, $group_ranks, 'wordpoints_user_ranks');
319 319
 
320
-			unset( $group_ranks );
320
+			unset($group_ranks);
321 321
 
322
-			wp_cache_delete( $rank_id, 'wordpoints_users_with_rank' );
322
+			wp_cache_delete($rank_id, 'wordpoints_users_with_rank');
323 323
 		}
324 324
 
325 325
 		return true;
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @return bool Whether the ranks were saved successfully.
338 338
 	 */
339
-	public function save_ranks( $rank_ids ) {
339
+	public function save_ranks($rank_ids) {
340 340
 
341
-		if ( count( array_unique( $rank_ids ) ) !== count( $rank_ids ) ) {
341
+		if (count(array_unique($rank_ids)) !== count($rank_ids)) {
342 342
 			return false;
343 343
 		}
344 344
 
345
-		ksort( $rank_ids );
345
+		ksort($rank_ids);
346 346
 
347
-		$rank_ids = array_values( $rank_ids );
347
+		$rank_ids = array_values($rank_ids);
348 348
 
349
-		return update_option( $this->option_name, $rank_ids );
349
+		return update_option($this->option_name, $rank_ids);
350 350
 	}
351 351
 
352 352
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	public function get_ranks() {
360 360
 
361
-		return wordpoints_get_array_option( $this->option_name );
361
+		return wordpoints_get_array_option($this->option_name);
362 362
 	}
363 363
 
364 364
 	/**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function get_base_rank() {
374 374
 
375
-		return $this->get_rank( 0 );
375
+		return $this->get_rank(0);
376 376
 	}
377 377
 
378 378
 	/**
@@ -384,15 +384,15 @@  discard block
 block discarded – undo
384 384
 	 *
385 385
 	 * @return int|false The ID of the rank, or false if not found.
386 386
 	 */
387
-	public function get_rank( $position ) {
387
+	public function get_rank($position) {
388 388
 
389 389
 		$ranks = $this->get_ranks();
390 390
 
391
-		if ( ! isset( $ranks[ $position ] ) ) {
391
+		if ( ! isset($ranks[$position])) {
392 392
 			return false;
393 393
 		}
394 394
 
395
-		return $ranks[ $position ];
395
+		return $ranks[$position];
396 396
 	}
397 397
 
398 398
 	/**
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
 	 *
405 405
 	 * @return int|false The rank's position, or false.
406 406
 	 */
407
-	public function get_rank_position( $rank_id ) {
407
+	public function get_rank_position($rank_id) {
408 408
 
409 409
 		return array_search(
410
-			wordpoints_posint( $rank_id )
410
+			wordpoints_posint($rank_id)
411 411
 			, $this->get_ranks()
412 412
 			, true
413 413
 		);
@@ -428,26 +428,26 @@  discard block
 block discarded – undo
428 428
 	 *
429 429
 	 * @return int[] The list of ranks with the rank insterted.
430 430
 	 */
431
-	private function _insert_rank( $ranks, $rank_id, $position ) {
431
+	private function _insert_rank($ranks, $rank_id, $position) {
432 432
 
433
-		$count = count( $ranks );
433
+		$count = count($ranks);
434 434
 
435
-		if ( $count === $position ) {
435
+		if ($count === $position) {
436 436
 
437
-			$ranks[ $position ] = $rank_id;
437
+			$ranks[$position] = $rank_id;
438 438
 
439
-		} elseif ( $count < $position ) {
439
+		} elseif ($count < $position) {
440 440
 
441 441
 			$ranks[] = $rank_id;
442 442
 
443 443
 		} else {
444 444
 
445
-			$lower_ranks  = array_slice( $ranks, 0, $position, true );
446
-			$higher_ranks = array_slice( $ranks, $position, null, true );
445
+			$lower_ranks  = array_slice($ranks, 0, $position, true);
446
+			$higher_ranks = array_slice($ranks, $position, null, true);
447 447
 
448 448
 			$ranks = array_merge(
449 449
 				$lower_ranks
450
-				, array( $position => $rank_id )
450
+				, array($position => $rank_id)
451 451
 				, $higher_ranks
452 452
 			);
453 453
 		}
@@ -463,29 +463,29 @@  discard block
 block discarded – undo
463 463
 	 * @param int $rank_from_id The ID of the rank the users have now.
464 464
 	 * @param int $rank_to_id   The ID of the rank to give the users instead.
465 465
 	 */
466
-	private function _move_users_from_rank_to_rank( $rank_from_id, $rank_to_id ) {
466
+	private function _move_users_from_rank_to_rank($rank_from_id, $rank_to_id) {
467 467
 
468 468
 		global $wpdb;
469 469
 
470
-		if ( ! wordpoints_posint( $rank_from_id ) || ! wordpoints_posint( $rank_to_id ) ) {
470
+		if ( ! wordpoints_posint($rank_from_id) || ! wordpoints_posint($rank_to_id)) {
471 471
 			return;
472 472
 		}
473 473
 
474
-		$group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' );
474
+		$group_ranks = wp_cache_get($this->slug, 'wordpoints_user_ranks');
475 475
 
476
-		unset( $group_ranks[ $rank_from_id ], $group_ranks[ $rank_to_id ] );
476
+		unset($group_ranks[$rank_from_id], $group_ranks[$rank_to_id]);
477 477
 
478
-		wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' );
478
+		wp_cache_set($this->slug, $group_ranks, 'wordpoints_user_ranks');
479 479
 
480
-		unset( $group_ranks );
480
+		unset($group_ranks);
481 481
 
482
-		wp_cache_delete( $rank_from_id, 'wordpoints_users_with_rank' );
483
-		wp_cache_delete( $rank_to_id, 'wordpoints_users_with_rank' );
482
+		wp_cache_delete($rank_from_id, 'wordpoints_users_with_rank');
483
+		wp_cache_delete($rank_to_id, 'wordpoints_users_with_rank');
484 484
 
485 485
 		$wpdb->update(
486 486
 			$wpdb->wordpoints_user_ranks
487
-			, array( 'rank_id' => $rank_to_id )
488
-			, array( 'rank_id' => $rank_from_id )
487
+			, array('rank_id' => $rank_to_id)
488
+			, array('rank_id' => $rank_from_id)
489 489
 			, '%d'
490 490
 			, '%d'
491 491
 		);
@@ -498,35 +498,35 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @param int $rank_id A rank ID.
500 500
 	 */
501
-	private function _maybe_increase_users_with_previous_rank( $rank_id ) {
501
+	private function _maybe_increase_users_with_previous_rank($rank_id) {
502 502
 
503
-		$rank = wordpoints_get_rank( $rank_id );
503
+		$rank = wordpoints_get_rank($rank_id);
504 504
 		$previous_rank = $rank->get_adjacent( -1 );
505 505
 
506
-		if ( ! $previous_rank ) {
506
+		if ( ! $previous_rank) {
507 507
 			return;
508 508
 		}
509 509
 
510
-		$users = wordpoints_get_users_with_rank( $previous_rank->ID );
510
+		$users = wordpoints_get_users_with_rank($previous_rank->ID);
511 511
 
512
-		if ( empty( $users ) ) {
512
+		if (empty($users)) {
513 513
 			return;
514 514
 		}
515 515
 
516
-		$rank_type = WordPoints_Rank_Types::get_type( $rank->type );
516
+		$rank_type = WordPoints_Rank_Types::get_type($rank->type);
517 517
 
518
-		foreach ( $users as $user_id ) {
518
+		foreach ($users as $user_id) {
519 519
 
520 520
 			$new_rank = $rank_type->maybe_increase_user_rank(
521 521
 				$user_id
522 522
 				, $previous_rank
523 523
 			);
524 524
 
525
-			if ( $new_rank->ID === $previous_rank->ID ) {
525
+			if ($new_rank->ID === $previous_rank->ID) {
526 526
 				continue;
527 527
 			}
528 528
 
529
-			wordpoints_update_user_rank( $user_id, $new_rank->ID );
529
+			wordpoints_update_user_rank($user_id, $new_rank->ID);
530 530
 		}
531 531
 	}
532 532
 }
Please login to merge, or discard this patch.
src/includes/class-un-installer-base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -697,7 +697,7 @@
 block discarded – undo
697 697
 	 * @since 2.0.0
698 698
 	 *
699 699
 	 * @param string $option The name of the option to set.
700
-	 * @param mixed  $value  The value of the option.
700
+	 * @param string  $value  The value of the option.
701 701
 	 */
702 702
 	private function _set_option( $option, $value = true ) {
703 703
 
Please login to merge, or discard this patch.
Spacing   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 	 * @param string $slug    The slug of the entity.
286 286
 	 * @param string $version The current code version of the entity.
287 287
 	 */
288
-	public function __construct( $slug = null, $version = null ) {
288
+	public function __construct($slug = null, $version = null) {
289 289
 
290
-		if ( ! isset( $slug ) ) {
291
-			_doing_it_wrong( __METHOD__, 'The $slug parameter is required.', '2.0.0' );
290
+		if ( ! isset($slug)) {
291
+			_doing_it_wrong(__METHOD__, 'The $slug parameter is required.', '2.0.0');
292 292
 		}
293 293
 
294
-		if ( ! isset( $version ) ) {
295
-			_doing_it_wrong( __METHOD__, 'The $version parameter is required.', '2.0.0' );
294
+		if ( ! isset($version)) {
295
+			_doing_it_wrong(__METHOD__, 'The $version parameter is required.', '2.0.0');
296 296
 		}
297 297
 
298 298
 		$this->slug = $slug;
299 299
 		$this->version = $version;
300 300
 
301
-		if ( isset( $this->option_prefix ) ) {
302
-			_deprecated_argument( __METHOD__, '2.0.0', 'The $option_prefix property is deprecated.' );
301
+		if (isset($this->option_prefix)) {
302
+			_deprecated_argument(__METHOD__, '2.0.0', 'The $option_prefix property is deprecated.');
303 303
 		}
304 304
 	}
305 305
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @param bool $network Whether the install should be network-wide on multisite.
312 312
 	 */
313
-	public function install( $network ) {
313
+	public function install($network) {
314 314
 
315 315
 		$this->action = 'install';
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		$hooks = wordpoints_hooks();
322 322
 		$hooks_mode = $hooks->get_current_mode();
323
-		$hooks->set_current_mode( 'standard' );
323
+		$hooks->set_current_mode('standard');
324 324
 
325 325
 		$this->before_install();
326 326
 
@@ -329,38 +329,38 @@  discard block
 block discarded – undo
329 329
 		 *
330 330
 		 * @since 1.8.0
331 331
 		 */
332
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
332
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
333 333
 
334
-		if ( is_multisite() ) {
334
+		if (is_multisite()) {
335 335
 
336 336
 			$this->context = 'network';
337
-			$hooks->set_current_mode( 'network' );
337
+			$hooks->set_current_mode('network');
338 338
 
339 339
 			$this->install_network();
340 340
 
341 341
 			$this->context = 'site';
342
-			$hooks->set_current_mode( 'standard' );
342
+			$hooks->set_current_mode('standard');
343 343
 
344
-			if ( $network ) {
344
+			if ($network) {
345 345
 
346 346
 				$this->set_network_installed();
347 347
 
348 348
 				$skip_per_site_install = $this->skip_per_site_install();
349 349
 
350
-				if ( ! ( $skip_per_site_install & self::SKIP_INSTALL ) ) {
350
+				if ( ! ($skip_per_site_install & self::SKIP_INSTALL)) {
351 351
 
352 352
 					$ms_switched_state = new WordPoints_Multisite_Switched_State();
353 353
 					$ms_switched_state->backup();
354 354
 
355
-					foreach ( $this->get_all_site_ids() as $blog_id ) {
356
-						switch_to_blog( $blog_id );
355
+					foreach ($this->get_all_site_ids() as $blog_id) {
356
+						switch_to_blog($blog_id);
357 357
 						$this->install_site();
358 358
 					}
359 359
 
360 360
 					$ms_switched_state->restore();
361 361
 				}
362 362
 
363
-				if ( $skip_per_site_install & self::REQUIRES_MANUAL_INSTALL ) {
363
+				if ($skip_per_site_install & self::REQUIRES_MANUAL_INSTALL) {
364 364
 
365 365
 					// We'll check this later and let the user know that per-site
366 366
 					// install was skipped.
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 
381 381
 		} // End if ( is_multisite() ) else.
382 382
 
383
-		$hooks->set_current_mode( $hooks_mode );
383
+		$hooks->set_current_mode($hooks_mode);
384 384
 	}
385 385
 
386 386
 	/**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @param int $site_id The ID of the site to install on.
392 392
 	 */
393
-	public function install_on_site( $site_id ) {
393
+	public function install_on_site($site_id) {
394 394
 
395 395
 		$this->action = 'install';
396 396
 		$this->network_wide = true;
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
 		$hooks = wordpoints_hooks();
401 401
 		$hooks_mode = $hooks->get_current_mode();
402
-		$hooks->set_current_mode( 'standard' );
402
+		$hooks->set_current_mode('standard');
403 403
 
404 404
 		$this->before_install();
405 405
 
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		 *
409 409
 		 * @since 1.8.0
410 410
 		 */
411
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
411
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
412 412
 
413 413
 		$this->context = 'site';
414 414
 
415
-		switch_to_blog( $site_id );
415
+		switch_to_blog($site_id);
416 416
 		$this->install_site();
417 417
 		restore_current_blog();
418 418
 
419
-		$hooks->set_current_mode( $hooks_mode );
419
+		$hooks->set_current_mode($hooks_mode);
420 420
 	}
421 421
 
422 422
 	/**
@@ -435,13 +435,13 @@  discard block
 block discarded – undo
435 435
 
436 436
 		$hooks = wordpoints_hooks();
437 437
 		$hooks_mode = $hooks->get_current_mode();
438
-		$hooks->set_current_mode( 'standard' );
438
+		$hooks->set_current_mode('standard');
439 439
 
440 440
 		$this->before_uninstall();
441 441
 
442
-		if ( is_multisite() ) {
442
+		if (is_multisite()) {
443 443
 
444
-			if ( $this->do_per_site_uninstall() ) {
444
+			if ($this->do_per_site_uninstall()) {
445 445
 
446 446
 				$this->context = 'site';
447 447
 
@@ -450,22 +450,22 @@  discard block
 block discarded – undo
450 450
 
451 451
 				$site_ids = $this->get_installed_site_ids();
452 452
 
453
-				if ( ! $this->is_network_installed() ) {
454
-					$site_ids = $this->validate_site_ids( $site_ids );
453
+				if ( ! $this->is_network_installed()) {
454
+					$site_ids = $this->validate_site_ids($site_ids);
455 455
 				}
456 456
 
457
-				foreach ( $site_ids as $blog_id ) {
458
-					switch_to_blog( $blog_id );
457
+				foreach ($site_ids as $blog_id) {
458
+					switch_to_blog($blog_id);
459 459
 					$this->uninstall_site();
460 460
 				}
461 461
 
462 462
 				$ms_switched_state->restore();
463 463
 
464
-				unset( $ms_switched_state, $site_ids );
464
+				unset($ms_switched_state, $site_ids);
465 465
 			}
466 466
 
467 467
 			$this->context = 'network';
468
-			$hooks->set_current_mode( 'network' );
468
+			$hooks->set_current_mode('network');
469 469
 
470 470
 			$this->uninstall_network();
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 			// If WordPoints is being uninstalled, the options will already have been
475 475
 			// deleted, and calling these methods will actually create them again.
476
-			if ( 'wordpoints' !== $this->slug ) {
476
+			if ('wordpoints' !== $this->slug) {
477 477
 				$this->unset_network_installed();
478 478
 				$this->unset_network_install_skipped();
479 479
 				$this->unset_network_update_skipped();
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
 		} // End if ( is_multisite() ) else.
488 488
 
489
-		$hooks->set_current_mode( $hooks_mode );
489
+		$hooks->set_current_mode($hooks_mode);
490 490
 	}
491 491
 
492 492
 	/**
@@ -499,24 +499,24 @@  discard block
 block discarded – undo
499 499
 	 * @param bool   $network Whether the entity is network active. Defaults to the
500 500
 	 *                        state of WordPoints itself.
501 501
 	 */
502
-	protected function prepare_to_update( $from, $to, $network ) {
502
+	protected function prepare_to_update($from, $to, $network) {
503 503
 
504 504
 		$this->action = 'update';
505 505
 
506
-		if ( null === $network ) {
506
+		if (null === $network) {
507 507
 			$network = is_wordpoints_network_active();
508 508
 		}
509 509
 
510 510
 		$this->network_wide = $network;
511
-		$this->updating_from = ( null === $from ) ? $this->get_db_version() : $from;
512
-		$this->updating_to   = ( null === $to ) ? $this->version : $to;
511
+		$this->updating_from = (null === $from) ? $this->get_db_version() : $from;
512
+		$this->updating_to   = (null === $to) ? $this->version : $to;
513 513
 
514 514
 		$updates = array();
515 515
 
516
-		foreach ( $this->updates as $version => $types ) {
516
+		foreach ($this->updates as $version => $types) {
517 517
 
518
-			if ( version_compare( $from, $version, '<' ) ) {
519
-				$updates[ str_replace( array( '.', '-' ), '_', $version ) ] = $types;
518
+			if (version_compare($from, $version, '<')) {
519
+				$updates[str_replace(array('.', '-'), '_', $version)] = $types;
520 520
 			}
521 521
 		}
522 522
 
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	 * @param bool   $network Whether the entity is network active. Defaults to the
534 534
 	 *                        state of WordPoints itself.
535 535
 	 */
536
-	public function update( $from = null, $to = null, $network = null ) {
536
+	public function update($from = null, $to = null, $network = null) {
537 537
 
538
-		$this->prepare_to_update( $from, $to, $network );
538
+		$this->prepare_to_update($from, $to, $network);
539 539
 
540
-		if ( empty( $this->updates ) ) {
540
+		if (empty($this->updates)) {
541 541
 			return;
542 542
 		}
543 543
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
 		$hooks = wordpoints_hooks();
547 547
 		$hooks_mode = $hooks->get_current_mode();
548
-		$hooks->set_current_mode( 'standard' );
548
+		$hooks->set_current_mode('standard');
549 549
 
550 550
 		$this->before_update();
551 551
 
@@ -554,32 +554,32 @@  discard block
 block discarded – undo
554 554
 		 *
555 555
 		 * @since 1.8.0
556 556
 		 */
557
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
557
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
558 558
 
559
-		if ( is_multisite() ) {
559
+		if (is_multisite()) {
560 560
 
561 561
 			$this->context = 'network';
562
-			$hooks->set_current_mode( 'network' );
562
+			$hooks->set_current_mode('network');
563 563
 
564
-			$this->update_( 'network', $this->get_updates_for( 'network' ) );
564
+			$this->update_('network', $this->get_updates_for('network'));
565 565
 
566 566
 			$this->context = 'site';
567
-			$hooks->set_current_mode( 'standard' );
567
+			$hooks->set_current_mode('standard');
568 568
 
569
-			if ( $this->network_wide ) {
569
+			if ($this->network_wide) {
570 570
 
571
-				$updates = $this->get_updates_for( 'site' );
571
+				$updates = $this->get_updates_for('site');
572 572
 
573
-				if ( $updates ) {
573
+				if ($updates) {
574 574
 
575
-					if ( $this->do_per_site_update() ) {
575
+					if ($this->do_per_site_update()) {
576 576
 
577 577
 						$ms_switched_state = new WordPoints_Multisite_Switched_State();
578 578
 						$ms_switched_state->backup();
579 579
 
580
-						foreach ( $this->get_installed_site_ids() as $blog_id ) {
581
-							switch_to_blog( $blog_id );
582
-							$this->update_( 'site', $updates );
580
+						foreach ($this->get_installed_site_ids() as $blog_id) {
581
+							switch_to_blog($blog_id);
582
+							$this->update_('site', $updates);
583 583
 						}
584 584
 
585 585
 						$ms_switched_state->restore();
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
 
595 595
 			} else {
596 596
 
597
-				$this->update_( 'site', $this->get_updates_for( 'site' ) );
597
+				$this->update_('site', $this->get_updates_for('site'));
598 598
 			}
599 599
 
600 600
 		} else {
601 601
 
602 602
 			$this->context = 'single';
603
-			$this->update_( 'single', $this->get_updates_for( 'single' ) );
603
+			$this->update_('single', $this->get_updates_for('single'));
604 604
 
605 605
 		} // End if ( is_multisite() ) else.
606 606
 
607 607
 		$this->after_update();
608 608
 
609
-		$hooks->set_current_mode( $hooks_mode );
609
+		$hooks->set_current_mode($hooks_mode);
610 610
 	}
611 611
 
612 612
 	//
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	protected function no_interruptions() {
622 622
 
623
-		ignore_user_abort( true );
623
+		ignore_user_abort(true);
624 624
 
625
-		if ( ! wordpoints_is_function_disabled( 'set_time_limit' ) ) {
626
-			set_time_limit( 0 );
625
+		if ( ! wordpoints_is_function_disabled('set_time_limit')) {
626
+			set_time_limit(0);
627 627
 		}
628 628
 	}
629 629
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 	 */
639 639
 	protected function skip_per_site_install() {
640 640
 
641
-		return ( wp_is_large_network() )
641
+		return (wp_is_large_network())
642 642
 			? self::SKIP_INSTALL | self::REQUIRES_MANUAL_INSTALL
643 643
 			: self::DO_INSTALL;
644 644
 	}
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 	 */
674 674
 	protected function get_all_site_ids() {
675 675
 
676
-		$site_ids = get_site_transient( 'wordpoints_all_site_ids' );
676
+		$site_ids = get_site_transient('wordpoints_all_site_ids');
677 677
 
678
-		if ( ! $site_ids ) {
678
+		if ( ! $site_ids) {
679 679
 
680 680
 			$site_ids = get_sites(
681 681
 				array(
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 				)
686 686
 			);
687 687
 
688
-			set_site_transient( 'wordpoints_all_site_ids', $site_ids, 2 * MINUTE_IN_SECONDS );
688
+			set_site_transient('wordpoints_all_site_ids', $site_ids, 2 * MINUTE_IN_SECONDS);
689 689
 		}
690 690
 
691 691
 		return $site_ids;
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
 	 * @param string $option The name of the option to set.
700 700
 	 * @param mixed  $value  The value of the option.
701 701
 	 */
702
-	private function _set_option( $option, $value = true ) {
702
+	private function _set_option($option, $value = true) {
703 703
 
704
-		if ( isset( $this->option_prefix ) ) {
704
+		if (isset($this->option_prefix)) {
705 705
 
706
-			update_site_option( "{$this->option_prefix}{$option}", $value );
706
+			update_site_option("{$this->option_prefix}{$option}", $value);
707 707
 
708 708
 		} else {
709 709
 
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 				, 'site'
713 713
 			);
714 714
 
715
-			$data[ $this->type ][ $this->slug ] = $value;
715
+			$data[$this->type][$this->slug] = $value;
716 716
 
717
-			update_site_option( "wordpoints_{$option}", $data );
717
+			update_site_option("wordpoints_{$option}", $data);
718 718
 		}
719 719
 	}
720 720
 
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @param string $option The name of the option to delete.
727 727
 	 */
728
-	private function _unset_option( $option ) {
728
+	private function _unset_option($option) {
729 729
 
730
-		if ( isset( $this->option_prefix ) ) {
730
+		if (isset($this->option_prefix)) {
731 731
 
732
-			delete_site_option( "{$this->option_prefix}{$option}" );
732
+			delete_site_option("{$this->option_prefix}{$option}");
733 733
 
734 734
 		} else {
735 735
 
@@ -738,9 +738,9 @@  discard block
 block discarded – undo
738 738
 				, 'site'
739 739
 			);
740 740
 
741
-			unset( $data[ $this->type ][ $this->slug ] );
741
+			unset($data[$this->type][$this->slug]);
742 742
 
743
-			update_site_option( "wordpoints_{$option}", $data );
743
+			update_site_option("wordpoints_{$option}", $data);
744 744
 		}
745 745
 	}
746 746
 
@@ -753,9 +753,9 @@  discard block
 block discarded – undo
753 753
 	 */
754 754
 	protected function is_network_installed() {
755 755
 
756
-		if ( isset( $this->option_prefix ) ) {
756
+		if (isset($this->option_prefix)) {
757 757
 
758
-			return (bool) get_site_option( "{$this->option_prefix}network_installed" );
758
+			return (bool) get_site_option("{$this->option_prefix}network_installed");
759 759
 
760 760
 		} else {
761 761
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 				, 'site'
765 765
 			);
766 766
 
767
-			return isset( $network_installed[ $this->type ][ $this->slug ] );
767
+			return isset($network_installed[$this->type][$this->slug]);
768 768
 		}
769 769
 	}
770 770
 
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 * @since 2.0.0
775 775
 	 */
776 776
 	protected function set_network_installed() {
777
-		$this->_set_option( 'network_installed' );
777
+		$this->_set_option('network_installed');
778 778
 	}
779 779
 
780 780
 	/**
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 	 * @since 2.0.0
784 784
 	 */
785 785
 	protected function unset_network_installed() {
786
-		$this->_unset_option( 'network_installed' );
786
+		$this->_unset_option('network_installed');
787 787
 	}
788 788
 
789 789
 	/**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	 * @since 2.0.0
793 793
 	 */
794 794
 	protected function set_network_install_skipped() {
795
-		$this->_set_option( 'network_install_skipped' );
795
+		$this->_set_option('network_install_skipped');
796 796
 	}
797 797
 
798 798
 	/**
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 * @since 2.0.0
802 802
 	 */
803 803
 	protected function unset_network_install_skipped() {
804
-		$this->_unset_option( 'network_install_skipped' );
804
+		$this->_unset_option('network_install_skipped');
805 805
 	}
806 806
 
807 807
 	/**
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 * @since 2.0.0
811 811
 	 */
812 812
 	protected function set_network_update_skipped() {
813
-		$this->_set_option( 'network_update_skipped', $this->updating_from );
813
+		$this->_set_option('network_update_skipped', $this->updating_from);
814 814
 	}
815 815
 
816 816
 	/**
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 	 * @since 2.0.0
820 820
 	 */
821 821
 	protected function unset_network_update_skipped() {
822
-		$this->_unset_option( 'network_update_skipped' );
822
+		$this->_unset_option('network_update_skipped');
823 823
 	}
824 824
 
825 825
 	/**
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
 	 */
834 834
 	protected function do_per_site_uninstall() {
835 835
 
836
-		if ( wp_is_large_network() ) {
836
+		if (wp_is_large_network()) {
837 837
 
838
-			if ( $this->is_network_installed() ) {
838
+			if ($this->is_network_installed()) {
839 839
 				return false;
840
-			} elseif ( count( $this->get_installed_site_ids() ) > 10000 ) {
840
+			} elseif (count($this->get_installed_site_ids()) > 10000) {
841 841
 				return false;
842 842
 			}
843 843
 		}
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	 */
857 857
 	protected function do_per_site_update() {
858 858
 
859
-		if ( $this->is_network_installed() && wp_is_large_network() ) {
859
+		if ($this->is_network_installed() && wp_is_large_network()) {
860 860
 			return false;
861 861
 		}
862 862
 
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 	 */
873 873
 	private function _get_installed_site_ids_option_name() {
874 874
 
875
-		if ( isset( $this->option_prefix ) ) {
875
+		if (isset($this->option_prefix)) {
876 876
 			$option_prefix = $this->option_prefix;
877
-		} elseif ( 'wordpoints' === $this->slug ) {
877
+		} elseif ('wordpoints' === $this->slug) {
878 878
 			$option_prefix = 'wordpoints_';
879
-		} elseif ( 'component' === $this->type ) {
879
+		} elseif ('component' === $this->type) {
880 880
 			$option_prefix = "wordpoints_{$this->slug}_";
881 881
 		} else {
882 882
 			$option_prefix = "wordpoints_{$this->type}_{$this->slug}_";
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 	 */
895 895
 	protected function get_installed_site_ids() {
896 896
 
897
-		if ( $this->is_network_installed() ) {
897
+		if ($this->is_network_installed()) {
898 898
 			$sites = $this->get_all_site_ids();
899 899
 		} else {
900 900
 			$sites = wordpoints_get_array_option(
@@ -913,18 +913,18 @@  discard block
 block discarded – undo
913 913
 	 *
914 914
 	 * @param int $id The ID of the site to add. Defaults to the current site's ID.
915 915
 	 */
916
-	protected function add_installed_site_id( $id = null ) {
916
+	protected function add_installed_site_id($id = null) {
917 917
 
918
-		if ( empty( $id ) ) {
918
+		if (empty($id)) {
919 919
 			$id = get_current_blog_id();
920 920
 		}
921 921
 
922 922
 		$option_name = $this->_get_installed_site_ids_option_name();
923 923
 
924
-		$sites = wordpoints_get_array_option( $option_name, 'site' );
924
+		$sites = wordpoints_get_array_option($option_name, 'site');
925 925
 		$sites[] = $id;
926 926
 
927
-		update_site_option( $option_name, $sites );
927
+		update_site_option($option_name, $sites);
928 928
 	}
929 929
 
930 930
 	/**
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	 * @since 2.0.0
934 934
 	 */
935 935
 	protected function delete_installed_site_ids() {
936
-		delete_site_option( $this->_get_installed_site_ids_option_name() );
936
+		delete_site_option($this->_get_installed_site_ids_option_name());
937 937
 	}
938 938
 
939 939
 	/**
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return array The validated site IDs.
947 947
 	 */
948
-	protected function validate_site_ids( $site_ids ) {
948
+	protected function validate_site_ids($site_ids) {
949 949
 
950
-		if ( empty( $site_ids ) || ! is_array( $site_ids ) ) {
950
+		if (empty($site_ids) || ! is_array($site_ids)) {
951 951
 			return array();
952 952
 		}
953 953
 
@@ -976,20 +976,20 @@  discard block
 block discarded – undo
976 976
 	 */
977 977
 	protected function get_db_version() {
978 978
 
979
-		if ( $this->network_wide ) {
980
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' );
979
+		if ($this->network_wide) {
980
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site');
981 981
 		} else {
982
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' );
982
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data');
983 983
 		}
984 984
 
985
-		if ( 'wordpoints' === $this->slug ) {
985
+		if ('wordpoints' === $this->slug) {
986 986
 
987
-			if ( isset( $wordpoints_data['version'] ) ) {
987
+			if (isset($wordpoints_data['version'])) {
988 988
 				return $wordpoints_data['version'];
989 989
 			}
990 990
 
991
-		} elseif ( isset( $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'] ) ) {
992
-			return $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'];
991
+		} elseif (isset($wordpoints_data["{$this->type}s"][$this->slug]['version'])) {
992
+			return $wordpoints_data["{$this->type}s"][$this->slug]['version'];
993 993
 		}
994 994
 
995 995
 		return false;
@@ -1003,28 +1003,28 @@  discard block
 block discarded – undo
1003 1003
 	 *
1004 1004
 	 * @param string $version The version of the entity.
1005 1005
 	 */
1006
-	protected function set_db_version( $version = null ) {
1006
+	protected function set_db_version($version = null) {
1007 1007
 
1008
-		if ( null === $version ) {
1008
+		if (null === $version) {
1009 1009
 			$version = $this->version;
1010 1010
 		}
1011 1011
 
1012
-		if ( $this->network_wide ) {
1013
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' );
1012
+		if ($this->network_wide) {
1013
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site');
1014 1014
 		} else {
1015
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' );
1015
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data');
1016 1016
 		}
1017 1017
 
1018
-		if ( 'wordpoints' === $this->slug ) {
1018
+		if ('wordpoints' === $this->slug) {
1019 1019
 			$wordpoints_data['version'] = $version;
1020 1020
 		} else {
1021
-			$wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'] = $version;
1021
+			$wordpoints_data["{$this->type}s"][$this->slug]['version'] = $version;
1022 1022
 		}
1023 1023
 
1024
-		if ( $this->network_wide ) {
1025
-			update_site_option( 'wordpoints_data', $wordpoints_data );
1024
+		if ($this->network_wide) {
1025
+			update_site_option('wordpoints_data', $wordpoints_data);
1026 1026
 		} else {
1027
-			update_option( 'wordpoints_data', $wordpoints_data );
1027
+			update_option('wordpoints_data', $wordpoints_data);
1028 1028
 		}
1029 1029
 	}
1030 1030
 
@@ -1036,22 +1036,22 @@  discard block
 block discarded – undo
1036 1036
 	protected function unset_db_version() {
1037 1037
 
1038 1038
 		// The whole option will be deleted when WordPoints is uninstalled.
1039
-		if ( 'wordpoints' === $this->slug ) {
1039
+		if ('wordpoints' === $this->slug) {
1040 1040
 			return;
1041 1041
 		}
1042 1042
 
1043
-		if ( 'network' === $this->context ) {
1044
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' );
1043
+		if ('network' === $this->context) {
1044
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site');
1045 1045
 		} else {
1046
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' );
1046
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data');
1047 1047
 		}
1048 1048
 
1049
-		unset( $wordpoints_data[ "{$this->type}s" ][ $this->slug ] );
1049
+		unset($wordpoints_data["{$this->type}s"][$this->slug]);
1050 1050
 
1051
-		if ( 'network' === $this->context ) {
1052
-			update_site_option( 'wordpoints_data', $wordpoints_data );
1051
+		if ('network' === $this->context) {
1052
+			update_site_option('wordpoints_data', $wordpoints_data);
1053 1053
 		} else {
1054
-			update_option( 'wordpoints_data', $wordpoints_data );
1054
+			update_option('wordpoints_data', $wordpoints_data);
1055 1055
 		}
1056 1056
 	}
1057 1057
 
@@ -1066,19 +1066,19 @@  discard block
 block discarded – undo
1066 1066
 	 * @param string $component The component's slug.
1067 1067
 	 * @param string $version   The installed component version.
1068 1068
 	 */
1069
-	protected function set_component_version( $component, $version ) {
1069
+	protected function set_component_version($component, $version) {
1070 1070
 
1071
-		_deprecated_function( __METHOD__, '2.0.0', '::set_db_version()' );
1071
+		_deprecated_function(__METHOD__, '2.0.0', '::set_db_version()');
1072 1072
 
1073 1073
 		$wordpoints_data = wordpoints_get_maybe_network_array_option(
1074 1074
 			'wordpoints_data'
1075 1075
 		);
1076 1076
 
1077
-		if ( empty( $wordpoints_data['components'][ $component ]['version'] ) ) {
1078
-			$wordpoints_data['components'][ $component ]['version'] = $version;
1077
+		if (empty($wordpoints_data['components'][$component]['version'])) {
1078
+			$wordpoints_data['components'][$component]['version'] = $version;
1079 1079
 		}
1080 1080
 
1081
-		wordpoints_update_maybe_network_option( 'wordpoints_data', $wordpoints_data );
1081
+		wordpoints_update_maybe_network_option('wordpoints_data', $wordpoints_data);
1082 1082
 	}
1083 1083
 
1084 1084
 	/**
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
 	 */
1089 1089
 	protected function maybe_load_custom_caps() {
1090 1090
 
1091
-		if ( empty( $this->custom_caps_getter ) ) {
1091
+		if (empty($this->custom_caps_getter)) {
1092 1092
 			return;
1093 1093
 		}
1094 1094
 
1095
-		$this->custom_caps = call_user_func( $this->custom_caps_getter );
1096
-		$this->custom_caps_keys = array_keys( $this->custom_caps );
1095
+		$this->custom_caps = call_user_func($this->custom_caps_getter);
1096
+		$this->custom_caps_keys = array_keys($this->custom_caps);
1097 1097
 
1098
-		if ( 'uninstall' === $this->action ) {
1098
+		if ('uninstall' === $this->action) {
1099 1099
 			$this->uninstall['local']['custom_caps'] = true;
1100 1100
 		}
1101 1101
 	}
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 	 * @since 1.8.0
1107 1107
 	 */
1108 1108
 	protected function before_install() {
1109
-		$this->map_shortcuts( 'schema' );
1109
+		$this->map_shortcuts('schema');
1110 1110
 		$this->maybe_load_custom_caps();
1111 1111
 	}
1112 1112
 
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	protected function install_custom_caps() {
1119 1119
 
1120
-		if ( ! empty( $this->custom_caps ) ) {
1121
-			wordpoints_add_custom_caps( $this->custom_caps );
1120
+		if ( ! empty($this->custom_caps)) {
1121
+			wordpoints_add_custom_caps($this->custom_caps);
1122 1122
 		}
1123 1123
 	}
1124 1124
 
@@ -1131,8 +1131,8 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
 		$schema = $this->get_db_schema();
1133 1133
 
1134
-		if ( ! empty( $schema ) ) {
1135
-			dbDelta( $schema );
1134
+		if ( ! empty($schema)) {
1135
+			dbDelta($schema);
1136 1136
 		}
1137 1137
 	}
1138 1138
 
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 	 */
1146 1146
 	public function get_db_schema() {
1147 1147
 
1148
-		if ( ! isset( $this->schema[ $this->context ]['tables'] ) ) {
1148
+		if ( ! isset($this->schema[$this->context]['tables'])) {
1149 1149
 			return '';
1150 1150
 		}
1151 1151
 
@@ -1155,16 +1155,16 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		$charset_collate = $wpdb->get_charset_collate();
1157 1157
 
1158
-		if ( 'site' === $this->context ) {
1158
+		if ('site' === $this->context) {
1159 1159
 			$prefix = $wpdb->prefix;
1160 1160
 		} else {
1161 1161
 			$prefix = $wpdb->base_prefix;
1162 1162
 		}
1163 1163
 
1164
-		foreach ( $this->schema[ $this->context ]['tables'] as $table_name => $table_schema ) {
1164
+		foreach ($this->schema[$this->context]['tables'] as $table_name => $table_schema) {
1165 1165
 
1166
-			$table_name   = str_replace( '`', '``', $table_name );
1167
-			$table_schema = trim( $table_schema );
1166
+			$table_name   = str_replace('`', '``', $table_name);
1167
+			$table_schema = trim($table_schema);
1168 1168
 
1169 1169
 			$schema .= "CREATE TABLE {$prefix}{$table_name} (
1170 1170
 				{$table_schema}
@@ -1184,31 +1184,31 @@  discard block
 block discarded – undo
1184 1184
 		$this->maybe_load_custom_caps();
1185 1185
 
1186 1186
 		$this->prepare_uninstall_list_tables();
1187
-		$this->prepare_uninstall_non_per_site_items( 'meta_boxes' );
1188
-		$this->map_uninstall_shortcut( 'widgets', 'options', array( 'prefix' => 'widget_' ) );
1189
-		$this->map_uninstall_shortcut( 'points_hooks', 'options', array( 'prefix' => 'wordpoints_hook-' ) );
1187
+		$this->prepare_uninstall_non_per_site_items('meta_boxes');
1188
+		$this->map_uninstall_shortcut('widgets', 'options', array('prefix' => 'widget_'));
1189
+		$this->map_uninstall_shortcut('points_hooks', 'options', array('prefix' => 'wordpoints_hook-'));
1190 1190
 
1191 1191
 		// Add any tables to uninstall based on the db schema.
1192
-		foreach ( $this->schema as $context => $schema ) {
1192
+		foreach ($this->schema as $context => $schema) {
1193 1193
 
1194
-			if ( ! isset( $schema['tables'] ) ) {
1194
+			if ( ! isset($schema['tables'])) {
1195 1195
 				continue;
1196 1196
 			}
1197 1197
 
1198
-			if ( ! isset( $this->uninstall[ $context ]['tables'] ) ) {
1199
-				$this->uninstall[ $context ]['tables'] = array();
1198
+			if ( ! isset($this->uninstall[$context]['tables'])) {
1199
+				$this->uninstall[$context]['tables'] = array();
1200 1200
 			}
1201 1201
 
1202
-			$this->uninstall[ $context ]['tables'] = array_unique(
1202
+			$this->uninstall[$context]['tables'] = array_unique(
1203 1203
 				array_merge(
1204
-					$this->uninstall[ $context ]['tables']
1205
-					, array_keys( $schema['tables'] )
1204
+					$this->uninstall[$context]['tables']
1205
+					, array_keys($schema['tables'])
1206 1206
 				)
1207 1207
 			);
1208 1208
 		}
1209 1209
 
1210 1210
 		// This *must* happen *after* the schema and list tables args are parsed.
1211
-		$this->map_shortcuts( 'uninstall' );
1211
+		$this->map_shortcuts('uninstall');
1212 1212
 	}
1213 1213
 
1214 1214
 	/**
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 	 */
1243 1243
 	protected function prepare_uninstall_list_tables() {
1244 1244
 
1245
-		if ( ! isset( $this->uninstall['list_tables'] ) ) {
1245
+		if ( ! isset($this->uninstall['list_tables'])) {
1246 1246
 			return;
1247 1247
 		}
1248 1248
 
@@ -1253,17 +1253,17 @@  discard block
 block discarded – undo
1253 1253
 		);
1254 1254
 
1255 1255
 		// Loop through all of the list table screens.
1256
-		foreach ( $this->uninstall['list_tables'] as $screen_id => $args ) {
1256
+		foreach ($this->uninstall['list_tables'] as $screen_id => $args) {
1257 1257
 
1258 1258
 			// Back-compat for pre-2.1.0.
1259
-			if ( isset( $args['parent'] ) && '_page' === substr( $args['parent'], -5 /* _page */ ) ) {
1260
-				$args['parent'] = substr( $args['parent'], 0, -5 );
1259
+			if (isset($args['parent']) && '_page' === substr($args['parent'], -5 /* _page */)) {
1260
+				$args['parent'] = substr($args['parent'], 0, -5);
1261 1261
 			}
1262 1262
 
1263
-			$this->uninstall['universal']['list_tables'][ $screen_id ] = $args;
1263
+			$this->uninstall['universal']['list_tables'][$screen_id] = $args;
1264 1264
 		}
1265 1265
 
1266
-		$this->prepare_uninstall_non_per_site_items( 'list_tables' );
1266
+		$this->prepare_uninstall_non_per_site_items('list_tables');
1267 1267
 	}
1268 1268
 
1269 1269
 	/**
@@ -1281,22 +1281,22 @@  discard block
 block discarded – undo
1281 1281
 	 *
1282 1282
 	 * @param string $items_key The key name of the items in the uninstall[*] arrays.
1283 1283
 	 */
1284
-	protected function prepare_uninstall_non_per_site_items( $items_key ) {
1284
+	protected function prepare_uninstall_non_per_site_items($items_key) {
1285 1285
 
1286
-		if ( isset( $this->uninstall['universal'][ $items_key ] ) ) {
1286
+		if (isset($this->uninstall['universal'][$items_key])) {
1287 1287
 
1288
-			$this->uninstall['global'][ $items_key ]
1289
-				= $this->uninstall['universal'][ $items_key ];
1288
+			$this->uninstall['global'][$items_key]
1289
+				= $this->uninstall['universal'][$items_key];
1290 1290
 
1291
-			unset( $this->uninstall['universal'][ $items_key ] );
1291
+			unset($this->uninstall['universal'][$items_key]);
1292 1292
 		}
1293 1293
 
1294
-		if ( isset( $this->uninstall['site'][ $items_key ] ) ) {
1294
+		if (isset($this->uninstall['site'][$items_key])) {
1295 1295
 
1296
-			$this->uninstall['network'][ $items_key ]
1297
-				= $this->uninstall['site'][ $items_key ];
1296
+			$this->uninstall['network'][$items_key]
1297
+				= $this->uninstall['site'][$items_key];
1298 1298
 
1299
-			unset( $this->uninstall['site'][ $items_key ] );
1299
+			unset($this->uninstall['site'][$items_key]);
1300 1300
 		}
1301 1301
 	}
1302 1302
 
@@ -1333,20 +1333,20 @@  discard block
 block discarded – undo
1333 1333
 	 *                             adding to them to the canonical array.
1334 1334
 	 * }
1335 1335
 	 */
1336
-	protected function map_uninstall_shortcut( $shortcut, $canonical, $args ) {
1336
+	protected function map_uninstall_shortcut($shortcut, $canonical, $args) {
1337 1337
 
1338
-		$args = array_merge( array( 'prefix' => '' ), $args );
1338
+		$args = array_merge(array('prefix' => ''), $args);
1339 1339
 
1340
-		$types = array( 'single', 'site', 'network', 'local', 'global', 'universal' );
1340
+		$types = array('single', 'site', 'network', 'local', 'global', 'universal');
1341 1341
 
1342
-		foreach ( $types as $type ) {
1342
+		foreach ($types as $type) {
1343 1343
 
1344
-			if ( ! isset( $this->uninstall[ $type ][ $shortcut ] ) ) {
1344
+			if ( ! isset($this->uninstall[$type][$shortcut])) {
1345 1345
 				continue;
1346 1346
 			}
1347 1347
 
1348
-			foreach ( $this->uninstall[ $type ][ $shortcut ] as $slug ) {
1349
-				$this->uninstall[ $type ][ $canonical ][] = $args['prefix'] . $slug;
1348
+			foreach ($this->uninstall[$type][$shortcut] as $slug) {
1349
+				$this->uninstall[$type][$canonical][] = $args['prefix'] . $slug;
1350 1350
 			}
1351 1351
 		}
1352 1352
 	}
@@ -1366,28 +1366,28 @@  discard block
 block discarded – undo
1366 1366
 	 *
1367 1367
 	 * @param string $type The type of shortcuts to map. Corresponds to a member var.
1368 1368
 	 */
1369
-	protected function map_shortcuts( $type ) {
1369
+	protected function map_shortcuts($type) {
1370 1370
 
1371 1371
 		// shortcut => canonicals
1372 1372
 		$map = array(
1373
-			'local'     => array( 'single', 'site', /*  -  */ ),
1374
-			'global'    => array( 'single', /* - */ 'network' ),
1375
-			'universal' => array( 'single', 'site', 'network' ),
1373
+			'local'     => array('single', 'site', /*  -  */),
1374
+			'global'    => array('single', /* - */ 'network'),
1375
+			'universal' => array('single', 'site', 'network'),
1376 1376
 		);
1377 1377
 
1378 1378
 		$this->$type = array_merge(
1379 1379
 			array_fill_keys(
1380
-				array( 'single', 'site', 'network', 'local', 'global', 'universal' )
1380
+				array('single', 'site', 'network', 'local', 'global', 'universal')
1381 1381
 				, array()
1382 1382
 			)
1383 1383
 			, $this->$type
1384 1384
 		);
1385 1385
 
1386
-		foreach ( $map as $shortcut => $canonicals ) {
1387
-			foreach ( $canonicals as $canonical ) {
1388
-				$this->{$type}[ $canonical ] = array_merge_recursive(
1389
-					$this->{$type}[ $canonical ]
1390
-					, $this->{$type}[ $shortcut ]
1386
+		foreach ($map as $shortcut => $canonicals) {
1387
+			foreach ($canonicals as $canonical) {
1388
+				$this->{$type}[$canonical] = array_merge_recursive(
1389
+					$this->{$type}[$canonical]
1390
+					, $this->{$type}[$shortcut]
1391 1391
 				);
1392 1392
 			}
1393 1393
 		}
@@ -1418,9 +1418,9 @@  discard block
 block discarded – undo
1418 1418
 	 *
1419 1419
 	 * @return array The versions that request this type of update.
1420 1420
 	 */
1421
-	protected function get_updates_for( $type ) {
1421
+	protected function get_updates_for($type) {
1422 1422
 
1423
-		return array_keys( wp_list_filter( $this->updates, array( $type => true ) ) );
1423
+		return array_keys(wp_list_filter($this->updates, array($type => true)));
1424 1424
 	}
1425 1425
 
1426 1426
 	/**
@@ -1431,9 +1431,9 @@  discard block
 block discarded – undo
1431 1431
 	 * @param string $type     The type of update to run.
1432 1432
 	 * @param array  $versions The versions to run this type of update for.
1433 1433
 	 */
1434
-	protected function update_( $type, $versions ) {
1434
+	protected function update_($type, $versions) {
1435 1435
 
1436
-		foreach ( $versions as $version ) {
1436
+		foreach ($versions as $version) {
1437 1437
 			$this->{"update_{$type}_to_{$version}"}();
1438 1438
 		}
1439 1439
 	}
@@ -1445,22 +1445,22 @@  discard block
 block discarded – undo
1445 1445
 	 *
1446 1446
 	 * @param string $type The type of tables to update.
1447 1447
 	 */
1448
-	protected function maybe_update_tables_to_utf8mb4( $type ) {
1448
+	protected function maybe_update_tables_to_utf8mb4($type) {
1449 1449
 
1450 1450
 		global $wpdb;
1451 1451
 
1452
-		if ( 'utf8mb4' !== $wpdb->charset ) {
1452
+		if ('utf8mb4' !== $wpdb->charset) {
1453 1453
 			return;
1454 1454
 		}
1455 1455
 
1456
-		if ( 'global' === $type || 'network' === $type ) {
1456
+		if ('global' === $type || 'network' === $type) {
1457 1457
 			$prefix = $wpdb->base_prefix;
1458 1458
 		} else {
1459 1459
 			$prefix = $wpdb->prefix;
1460 1460
 		}
1461 1461
 
1462
-		foreach ( $this->schema[ $type ]['tables'] as $table_name => $schema ) {
1463
-			maybe_convert_table_to_utf8mb4( $prefix . $table_name );
1462
+		foreach ($this->schema[$type]['tables'] as $table_name => $schema) {
1463
+			maybe_convert_table_to_utf8mb4($prefix . $table_name);
1464 1464
 		}
1465 1465
 	}
1466 1466
 
@@ -1471,9 +1471,9 @@  discard block
 block discarded – undo
1471 1471
 	 *
1472 1472
 	 * @param string $type The type of uninstallation to perform.
1473 1473
 	 */
1474
-	protected function uninstall_( $type ) {
1474
+	protected function uninstall_($type) {
1475 1475
 
1476
-		if ( empty( $this->uninstall[ $type ] ) ) {
1476
+		if (empty($this->uninstall[$type])) {
1477 1477
 			return;
1478 1478
 		}
1479 1479
 
@@ -1486,35 +1486,35 @@  discard block
 block discarded – undo
1486 1486
 				'meta_boxes'   => array(),
1487 1487
 				'list_tables'  => array(),
1488 1488
 			)
1489
-			, $this->uninstall[ $type ]
1489
+			, $this->uninstall[$type]
1490 1490
 		);
1491 1491
 
1492
-		if ( ! empty( $uninstall['custom_caps'] ) ) {
1493
-			$this->uninstall_custom_caps( $this->custom_caps_keys );
1492
+		if ( ! empty($uninstall['custom_caps'])) {
1493
+			$this->uninstall_custom_caps($this->custom_caps_keys);
1494 1494
 		}
1495 1495
 
1496
-		foreach ( $uninstall['user_meta'] as $meta_key ) {
1497
-			$this->uninstall_metadata( 'user', $meta_key );
1496
+		foreach ($uninstall['user_meta'] as $meta_key) {
1497
+			$this->uninstall_metadata('user', $meta_key);
1498 1498
 		}
1499 1499
 
1500
-		foreach ( $uninstall['options'] as $option ) {
1501
-			$this->uninstall_option( $option );
1500
+		foreach ($uninstall['options'] as $option) {
1501
+			$this->uninstall_option($option);
1502 1502
 		}
1503 1503
 
1504
-		foreach ( $uninstall['tables'] as $table ) {
1505
-			$this->uninstall_table( $table );
1504
+		foreach ($uninstall['tables'] as $table) {
1505
+			$this->uninstall_table($table);
1506 1506
 		}
1507 1507
 
1508
-		foreach ( $uninstall['comment_meta'] as $meta_key ) {
1509
-			$this->uninstall_metadata( 'comment', $meta_key );
1508
+		foreach ($uninstall['comment_meta'] as $meta_key) {
1509
+			$this->uninstall_metadata('comment', $meta_key);
1510 1510
 		}
1511 1511
 
1512
-		foreach ( $uninstall['meta_boxes'] as $screen_id => $args ) {
1513
-			$this->uninstall_meta_boxes( $screen_id, $args );
1512
+		foreach ($uninstall['meta_boxes'] as $screen_id => $args) {
1513
+			$this->uninstall_meta_boxes($screen_id, $args);
1514 1514
 		}
1515 1515
 
1516
-		foreach ( $uninstall['list_tables'] as $screen_id => $args ) {
1517
-			$this->uninstall_list_table( $screen_id, $args );
1516
+		foreach ($uninstall['list_tables'] as $screen_id => $args) {
1517
+			$this->uninstall_list_table($screen_id, $args);
1518 1518
 		}
1519 1519
 	}
1520 1520
 
@@ -1525,9 +1525,9 @@  discard block
 block discarded – undo
1525 1525
 	 *
1526 1526
 	 * @param string[] $caps The capabilities to uninstall.
1527 1527
 	 */
1528
-	protected function uninstall_custom_caps( $caps ) {
1528
+	protected function uninstall_custom_caps($caps) {
1529 1529
 
1530
-		wordpoints_remove_custom_caps( $caps );
1530
+		wordpoints_remove_custom_caps($caps);
1531 1531
 	}
1532 1532
 
1533 1533
 	/**
@@ -1538,17 +1538,17 @@  discard block
 block discarded – undo
1538 1538
 	 * @param string $type The type of metadata to uninstall, e.g., 'user', 'post'.
1539 1539
 	 * @param string $key  The metadata key to delete.
1540 1540
 	 */
1541
-	protected function uninstall_metadata( $type, $key ) {
1541
+	protected function uninstall_metadata($type, $key) {
1542 1542
 
1543
-		if ( 'user' === $type && 'site' === $this->context ) {
1543
+		if ('user' === $type && 'site' === $this->context) {
1544 1544
 			$key = $GLOBALS['wpdb']->get_blog_prefix() . $key;
1545 1545
 		}
1546 1546
 
1547
-		if ( false !== strpos( $key, '%' ) ) {
1547
+		if (false !== strpos($key, '%')) {
1548 1548
 
1549 1549
 			global $wpdb;
1550 1550
 
1551
-			$table = wordpoints_escape_mysql_identifier( _get_meta_table( $type ) );
1551
+			$table = wordpoints_escape_mysql_identifier(_get_meta_table($type));
1552 1552
 
1553 1553
 			$keys = $wpdb->get_col( // WPCS: unprepared SQL OK.
1554 1554
 				$wpdb->prepare( // WPCS: unprepared SQL OK.
@@ -1562,11 +1562,11 @@  discard block
 block discarded – undo
1562 1562
 			); // WPCS: cache pass.
1563 1563
 
1564 1564
 		} else {
1565
-			$keys = array( $key );
1565
+			$keys = array($key);
1566 1566
 		}
1567 1567
 
1568
-		foreach ( $keys as $key ) {
1569
-			delete_metadata( $type, 0, wp_slash( $key ), '', true );
1568
+		foreach ($keys as $key) {
1569
+			delete_metadata($type, 0, wp_slash($key), '', true);
1570 1570
 		}
1571 1571
 	}
1572 1572
 
@@ -1600,25 +1600,25 @@  discard block
 block discarded – undo
1600 1600
 	 *                                'meta-box-order'.
1601 1601
 	 * }
1602 1602
 	 */
1603
-	protected function uninstall_meta_boxes( $screen_id, $args ) {
1603
+	protected function uninstall_meta_boxes($screen_id, $args) {
1604 1604
 
1605 1605
 		$defaults = array(
1606 1606
 			'parent' => 'wordpoints',
1607
-			'options' => array( 'closedpostboxes', 'metaboxhidden', 'meta-box-order' ),
1607
+			'options' => array('closedpostboxes', 'metaboxhidden', 'meta-box-order'),
1608 1608
 		);
1609 1609
 
1610
-		$args = array_merge( $defaults, $args );
1611
-		$args['options'] = array_merge( $defaults['options'], $args['options'] );
1610
+		$args = array_merge($defaults, $args);
1611
+		$args['options'] = array_merge($defaults['options'], $args['options']);
1612 1612
 
1613 1613
 		// Each user gets to set the options to their liking.
1614
-		foreach ( $args['options'] as $option ) {
1614
+		foreach ($args['options'] as $option) {
1615 1615
 
1616 1616
 			$this->uninstall_metadata(
1617 1617
 				'user'
1618 1618
 				, "{$option}_{$args['parent']}_page_{$screen_id}"
1619 1619
 			);
1620 1620
 
1621
-			if ( 'network' === $this->context ) {
1621
+			if ('network' === $this->context) {
1622 1622
 				$this->uninstall_metadata(
1623 1623
 					'user'
1624 1624
 					, "{$option}_{$args['parent']}_page_{$screen_id}-network"
@@ -1659,21 +1659,21 @@  discard block
 block discarded – undo
1659 1659
 	 *                                'per_page'.
1660 1660
 	 * }
1661 1661
 	 */
1662
-	protected function uninstall_list_table( $screen_id, $args ) {
1662
+	protected function uninstall_list_table($screen_id, $args) {
1663 1663
 
1664 1664
 		$defaults = array(
1665 1665
 			'parent' => 'wordpoints',
1666
-			'options' => array( 'per_page' ),
1666
+			'options' => array('per_page'),
1667 1667
 		);
1668 1668
 
1669
-		$args = array_merge( $defaults, $args );
1669
+		$args = array_merge($defaults, $args);
1670 1670
 
1671 1671
 		$network_parent = $args['parent'];
1672 1672
 		$parent = $network_parent;
1673 1673
 
1674 1674
 		// The parent page is usually the same on a multisite site, but we need to
1675 1675
 		// handle the special case of the modules screen.
1676
-		if ( 'wordpoints_modules' === $screen_id && is_multisite() ) {
1676
+		if ('wordpoints_modules' === $screen_id && is_multisite()) {
1677 1677
 			$parent = 'toplevel';
1678 1678
 		}
1679 1679
 
@@ -1682,23 +1682,23 @@  discard block
 block discarded – undo
1682 1682
 		// Each user can hide specific columns of the table.
1683 1683
 		$meta_keys[] = "manage{$parent}_page_{$screen_id}columnshidden";
1684 1684
 
1685
-		if ( 'network' === $this->context ) {
1685
+		if ('network' === $this->context) {
1686 1686
 			$meta_keys[] = "manage{$network_parent}_page_{$screen_id}-networkcolumnshidden";
1687 1687
 		}
1688 1688
 
1689 1689
 		// Loop through each of the other options provided by this list table.
1690
-		foreach ( $args['options'] as $option ) {
1690
+		foreach ($args['options'] as $option) {
1691 1691
 
1692 1692
 			// Each user gets to set the options to their liking.
1693 1693
 			$meta_keys[]  = "{$parent}_page_{$screen_id}_{$option}";
1694 1694
 
1695
-			if ( 'network' === $this->context ) {
1695
+			if ('network' === $this->context) {
1696 1696
 				$meta_keys[] = "{$network_parent}_page_{$screen_id}_network_{$option}";
1697 1697
 			}
1698 1698
 		}
1699 1699
 
1700
-		foreach ( $meta_keys as $meta_key ) {
1701
-			$this->uninstall_metadata( 'user', $meta_key );
1700
+		foreach ($meta_keys as $meta_key) {
1701
+			$this->uninstall_metadata('user', $meta_key);
1702 1702
 		}
1703 1703
 	}
1704 1704
 
@@ -1713,14 +1713,14 @@  discard block
 block discarded – undo
1713 1713
 	 *
1714 1714
 	 * @param string $option The option to uninstall.
1715 1715
 	 */
1716
-	protected function uninstall_option( $option ) {
1716
+	protected function uninstall_option($option) {
1717 1717
 
1718
-		if ( 'network' === $this->context ) {
1719
-			$this->uninstall_network_option( $option );
1718
+		if ('network' === $this->context) {
1719
+			$this->uninstall_network_option($option);
1720 1720
 			return;
1721 1721
 		}
1722 1722
 
1723
-		if ( false !== strpos( $option, '%' ) ) {
1723
+		if (false !== strpos($option, '%')) {
1724 1724
 
1725 1725
 			global $wpdb;
1726 1726
 
@@ -1736,10 +1736,10 @@  discard block
 block discarded – undo
1736 1736
 			); // WPCS: cache pass.
1737 1737
 
1738 1738
 		} else {
1739
-			$options = array( $option );
1739
+			$options = array($option);
1740 1740
 		}
1741 1741
 
1742
-		array_map( 'delete_option', $options );
1742
+		array_map('delete_option', $options);
1743 1743
 	}
1744 1744
 
1745 1745
 	/**
@@ -1751,9 +1751,9 @@  discard block
 block discarded – undo
1751 1751
 	 *
1752 1752
 	 * @param string $option The network option to uninstall.
1753 1753
 	 */
1754
-	protected function uninstall_network_option( $option ) {
1754
+	protected function uninstall_network_option($option) {
1755 1755
 
1756
-		if ( false !== strpos( $option, '%' ) ) {
1756
+		if (false !== strpos($option, '%')) {
1757 1757
 
1758 1758
 			global $wpdb;
1759 1759
 
@@ -1771,10 +1771,10 @@  discard block
 block discarded – undo
1771 1771
 			); // WPCS: cache pass.
1772 1772
 
1773 1773
 		} else {
1774
-			$options = array( $option );
1774
+			$options = array($option);
1775 1775
 		}
1776 1776
 
1777
-		array_map( 'delete_site_option', $options );
1777
+		array_map('delete_site_option', $options);
1778 1778
 	}
1779 1779
 
1780 1780
 	/**
@@ -1784,9 +1784,9 @@  discard block
 block discarded – undo
1784 1784
 	 *
1785 1785
 	 * @param string $id_base The base ID of the widget to uninstall (class name).
1786 1786
 	 */
1787
-	protected function uninstall_widget( $id_base ) {
1787
+	protected function uninstall_widget($id_base) {
1788 1788
 
1789
-		$this->uninstall_option( "widget_{$id_base}" );
1789
+		$this->uninstall_option("widget_{$id_base}");
1790 1790
 	}
1791 1791
 
1792 1792
 	/**
@@ -1796,9 +1796,9 @@  discard block
 block discarded – undo
1796 1796
 	 *
1797 1797
 	 * @param string $id_base The base ID (class) of the points hook to uninstall.
1798 1798
 	 */
1799
-	protected function uninstall_points_hook( $id_base ) {
1799
+	protected function uninstall_points_hook($id_base) {
1800 1800
 
1801
-		$this->uninstall_option( "wordpoints_hook-{$id_base}" );
1801
+		$this->uninstall_option("wordpoints_hook-{$id_base}");
1802 1802
 	}
1803 1803
 
1804 1804
 	/**
@@ -1808,20 +1808,20 @@  discard block
 block discarded – undo
1808 1808
 	 *
1809 1809
 	 * @param string $table The name of the table to uninstall, sans DB prefix.
1810 1810
 	 */
1811
-	protected function uninstall_table( $table ) {
1811
+	protected function uninstall_table($table) {
1812 1812
 
1813 1813
 		global $wpdb;
1814 1814
 
1815 1815
 		// Null will use the current blog's prefix, 0 the base prefix.
1816
-		if ( 'site' === $this->context ) {
1816
+		if ('site' === $this->context) {
1817 1817
 			$site_id = null;
1818 1818
 		} else {
1819 1819
 			$site_id = 0;
1820 1820
 		}
1821 1821
 
1822
-		$table = str_replace( '`', '``', $table );
1822
+		$table = str_replace('`', '``', $table);
1823 1823
 
1824
-		$wpdb->query( 'DROP TABLE IF EXISTS `' . $wpdb->get_blog_prefix( $site_id ) . $table . '`' ); // WPCS: unprepared SQL, cache pass.
1824
+		$wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->get_blog_prefix($site_id) . $table . '`'); // WPCS: unprepared SQL, cache pass.
1825 1825
 	}
1826 1826
 
1827 1827
 	//
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 
1842 1842
 		$this->install_db_schema();
1843 1843
 
1844
-		if ( $this->network_wide ) {
1844
+		if ($this->network_wide) {
1845 1845
 			$this->set_db_version();
1846 1846
 		}
1847 1847
 	}
@@ -1857,11 +1857,11 @@  discard block
 block discarded – undo
1857 1857
 	 */
1858 1858
 	protected function install_site() {
1859 1859
 
1860
-		if ( isset( $this->schema['site'] ) ) {
1860
+		if (isset($this->schema['site'])) {
1861 1861
 			$this->install_db_schema();
1862 1862
 		}
1863 1863
 
1864
-		if ( ! $this->network_wide ) {
1864
+		if ( ! $this->network_wide) {
1865 1865
 			$this->set_db_version();
1866 1866
 		}
1867 1867
 
@@ -1891,10 +1891,10 @@  discard block
 block discarded – undo
1891 1891
 	 */
1892 1892
 	protected function load_base_dependencies() {
1893 1893
 
1894
-		require_once dirname( __FILE__ ) . '/constants.php';
1894
+		require_once dirname(__FILE__) . '/constants.php';
1895 1895
 		require_once WORDPOINTS_DIR . '/classes/class/autoloader.php';
1896 1896
 
1897
-		WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . '/classes' );
1897
+		WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . '/classes');
1898 1898
 
1899 1899
 		require_once WORDPOINTS_DIR . '/includes/functions.php';
1900 1900
 		require_once WORDPOINTS_DIR . '/includes/apps.php';
@@ -1921,8 +1921,8 @@  discard block
 block discarded – undo
1921 1921
 	 */
1922 1922
 	protected function uninstall_network() {
1923 1923
 
1924
-		if ( ! empty( $this->uninstall['network'] ) ) {
1925
-			$this->uninstall_( 'network' );
1924
+		if ( ! empty($this->uninstall['network'])) {
1925
+			$this->uninstall_('network');
1926 1926
 		}
1927 1927
 
1928 1928
 		$this->unset_db_version();
@@ -1939,8 +1939,8 @@  discard block
 block discarded – undo
1939 1939
 	 */
1940 1940
 	protected function uninstall_site() {
1941 1941
 
1942
-		if ( ! empty( $this->uninstall['site'] ) ) {
1943
-			$this->uninstall_( 'site' );
1942
+		if ( ! empty($this->uninstall['site'])) {
1943
+			$this->uninstall_('site');
1944 1944
 		}
1945 1945
 
1946 1946
 		$this->unset_db_version();
@@ -1957,8 +1957,8 @@  discard block
 block discarded – undo
1957 1957
 	 */
1958 1958
 	protected function uninstall_single() {
1959 1959
 
1960
-		if ( ! empty( $this->uninstall['single'] ) ) {
1961
-			$this->uninstall_( 'single' );
1960
+		if ( ! empty($this->uninstall['single'])) {
1961
+			$this->uninstall_('single');
1962 1962
 		}
1963 1963
 
1964 1964
 		$this->unset_db_version();
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.