Completed
Push — master ( 3d46b5...fce27c )
by J.D.
03:47
created
src/includes/classes/entity/context/site.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@
 block discarded – undo
21 21
 	 */
22 22
 	public function get_current_id() {
23 23
 
24
-		if ( ! is_multisite() ) {
24
+		if ( ! is_multisite()) {
25 25
 			return 1;
26 26
 		}
27 27
 
28
-		if ( wordpoints_is_network_context() ) {
28
+		if (wordpoints_is_network_context()) {
29 29
 			return false;
30 30
 		}
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -97,25 +97,25 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @since 1.0.0
99 99
 	 */
100
-	public function __get( $var ) {
100
+	public function __get($var) {
101 101
 
102
-		if ( 'reactions' === $var ) {
102
+		if ('reactions' === $var) {
103 103
 			$mode = wordpoints_hooks()->get_current_mode();
104 104
 			$var  = "{$mode}_reactions";
105
-		} elseif ( '_reactions' !== substr( $var, -10 ) ) {
105
+		} elseif ('_reactions' !== substr($var, -10)) {
106 106
 			return null;
107 107
 		} else {
108
-			$mode = substr( $var, 0, -10 /* _reactions */ );
108
+			$mode = substr($var, 0, -10 /* _reactions */);
109 109
 		}
110 110
 
111
-		if ( 'network_reactions' === $var && ! $this->is_network_wide() ) {
111
+		if ('network_reactions' === $var && ! $this->is_network_wide()) {
112 112
 			return null;
113 113
 		}
114 114
 
115
-		if ( ! isset( $this->$var ) ) {
115
+		if ( ! isset($this->$var)) {
116 116
 
117
-			if ( isset( $this->{"{$var}_class"} ) ) {
118
-				$this->$var = new $this->{"{$var}_class"}( $mode, $this );
117
+			if (isset($this->{"{$var}_class"} )) {
118
+				$this->$var = new $this->{"{$var}_class"}($mode, $this);
119 119
 			} else {
120 120
 				return null;
121 121
 			}
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 
124 124
 		$store = $this->$var;
125 125
 
126
-		if ( ! $store instanceof WordPoints_Hook_Reaction_StorageI ) {
126
+		if ( ! $store instanceof WordPoints_Hook_Reaction_StorageI) {
127 127
 			return null;
128 128
 		}
129 129
 
130 130
 		// Allowing access to stores out-of-context would lead to strange behavior.
131
-		if ( false === $store->get_context_id() ) {
131
+		if (false === $store->get_context_id()) {
132 132
 			return null;
133 133
 		}
134 134
 
@@ -198,21 +198,21 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return WordPoints_Hook_ReactionI[] All of the reaction objects.
200 200
 	 */
201
-	public function get_all_reactions_to_event( $event_slug ) {
201
+	public function get_all_reactions_to_event($event_slug) {
202 202
 
203 203
 		$reactions = array();
204 204
 
205
-		foreach ( array( 'standard', 'network' ) as $store ) {
205
+		foreach (array('standard', 'network') as $store) {
206 206
 
207 207
 			$storage = $this->{"{$store}_reactions"};
208 208
 
209
-			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) {
209
+			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) {
210 210
 				continue;
211 211
 			}
212 212
 
213 213
 			$reactions = array_merge(
214 214
 				$reactions
215
-				, $storage->get_reactions_to_event( $event_slug )
215
+				, $storage->get_reactions_to_event($event_slug)
216 216
 			);
217 217
 		}
218 218
 
@@ -234,15 +234,15 @@  discard block
 block discarded – undo
234 234
 
235 235
 		$reactions = array();
236 236
 
237
-		foreach ( array( 'standard', 'network' ) as $store ) {
237
+		foreach (array('standard', 'network') as $store) {
238 238
 
239 239
 			$storage = $this->{"{$store}_reactions"};
240 240
 
241
-			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) {
241
+			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) {
242 242
 				continue;
243 243
 			}
244 244
 
245
-			$reactions = array_merge( $reactions, $storage->get_reactions() );
245
+			$reactions = array_merge($reactions, $storage->get_reactions());
246 246
 		}
247 247
 
248 248
 		return $reactions;
@@ -258,21 +258,21 @@  discard block
 block discarded – undo
258 258
 	) {
259 259
 
260 260
 		if (
261
-			empty( $settings['target'] )
262
-			|| ! is_array( $settings['target'] )
261
+			empty($settings['target'])
262
+			|| ! is_array($settings['target'])
263 263
 		) {
264 264
 
265
-			$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
265
+			$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
266 266
 
267 267
 		} else {
268 268
 
269
-			$target = $event_args->get_from_hierarchy( $settings['target'] );
269
+			$target = $event_args->get_from_hierarchy($settings['target']);
270 270
 
271 271
 			if (
272 272
 				! $target instanceof WordPoints_Entity
273
-				|| ! in_array( $target->get_slug(), (array) $this->arg_types )
273
+				|| ! in_array($target->get_slug(), (array) $this->arg_types)
274 274
 			) {
275
-				$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
275
+				$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
276 276
 			}
277 277
 		}
278 278
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	/**
283 283
 	 * @since 1.0.0
284 284
 	 */
285
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
286
-		$reaction->update_meta( 'target', $settings['target'] );
285
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
286
+		$reaction->update_meta('target', $settings['target']);
287 287
 	}
288 288
 
289 289
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hooks.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 	protected function init() {
47 47
 
48 48
 		$sub_apps = $this->sub_apps;
49
-		$sub_apps->register( 'router', 'WordPoints_Hook_Router' );
50
-		$sub_apps->register( 'actions', 'WordPoints_Hook_Actions' );
51
-		$sub_apps->register( 'events', 'WordPoints_Hook_Events' );
52
-		$sub_apps->register( 'firers', 'WordPoints_Class_Registry_Persistent' );
53
-		$sub_apps->register( 'reactors', 'WordPoints_Class_Registry_Persistent' );
54
-		$sub_apps->register( 'extensions', 'WordPoints_Class_Registry_Persistent' );
55
-		$sub_apps->register( 'conditions', 'WordPoints_Class_Registry_Children' );
49
+		$sub_apps->register('router', 'WordPoints_Hook_Router');
50
+		$sub_apps->register('actions', 'WordPoints_Hook_Actions');
51
+		$sub_apps->register('events', 'WordPoints_Hook_Events');
52
+		$sub_apps->register('firers', 'WordPoints_Class_Registry_Persistent');
53
+		$sub_apps->register('reactors', 'WordPoints_Class_Registry_Persistent');
54
+		$sub_apps->register('extensions', 'WordPoints_Class_Registry_Persistent');
55
+		$sub_apps->register('conditions', 'WordPoints_Class_Registry_Children');
56 56
 
57 57
 		parent::init();
58 58
 	}
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function get_current_mode() {
77 77
 
78
-		if ( ! isset( $this->current_mode ) ) {
79
-			$this->current_mode = ( wordpoints_is_network_context() ? 'network' : 'standard' );
78
+		if ( ! isset($this->current_mode)) {
79
+			$this->current_mode = (wordpoints_is_network_context() ? 'network' : 'standard');
80 80
 		}
81 81
 
82 82
 		return $this->current_mode;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @param string $mode The slug of the mode to set as the current mode.
96 96
 	 */
97
-	public function set_current_mode( $mode ) {
97
+	public function set_current_mode($mode) {
98 98
 		$this->current_mode = $mode;
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
src/includes/functions.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @param WordPoints_Class_Registry_Persistent $reactors The reactors registry.
35 35
  */
36
-function wordpoints_hook_reactors_init( $reactors ) {
36
+function wordpoints_hook_reactors_init($reactors) {
37 37
 
38
-	$reactors->register( 'points', 'WordPoints_Hook_Reactor_Points' );
38
+	$reactors->register('points', 'WordPoints_Hook_Reactor_Points');
39 39
 }
40 40
 
41 41
 /**
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @param WordPoints_Class_Registry_Persistent $extensions The extension registry.
49 49
  */
50
-function wordpoints_hook_extension_init( $extensions ) {
50
+function wordpoints_hook_extension_init($extensions) {
51 51
 
52
-	$extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' );
53
-	$extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' );
52
+	$extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions');
53
+	$extensions->register('periods', 'WordPoints_Hook_Extension_Periods');
54 54
 }
55 55
 
56 56
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @param WordPoints_Class_Registry_Children $conditions The conditions registry.
64 64
  */
65
-function wordpoints_hook_conditions_init( $conditions ) {
65
+function wordpoints_hook_conditions_init($conditions) {
66 66
 
67 67
 	$conditions->register(
68 68
 		'text'
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  *
99 99
  * @param WordPoints_Hook_Actions $actions The action registry.
100 100
  */
101
-function wordpoints_hook_actions_init( $actions ) {
101
+function wordpoints_hook_actions_init($actions) {
102 102
 
103 103
 	$actions->register(
104 104
 		'comment_approve'
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		, array(
107 107
 			'action' => 'transition_comment_status',
108 108
 			'data'   => array(
109
-				'arg_index'    => array( 'comment' => 2 ),
110
-				'requirements' => array( 0 => 'approved' ),
109
+				'arg_index'    => array('comment' => 2),
110
+				'requirements' => array(0 => 'approved'),
111 111
 			),
112 112
 		)
113 113
 	);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		, array(
119 119
 			'action' => 'wp_insert_comment',
120 120
 			'data'   => array(
121
-				'arg_index' => array( 'comment' => 1 ),
121
+				'arg_index' => array('comment' => 1),
122 122
 			),
123 123
 		)
124 124
 	);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 		, array(
130 130
 			'action' => 'transition_comment_status',
131 131
 			'data'   => array(
132
-				'arg_index' => array( 'comment' => 2 ),
133
-				'requirements' => array( 1 => 'approved' ),
132
+				'arg_index' => array('comment' => 2),
133
+				'requirements' => array(1 => 'approved'),
134 134
 			),
135 135
 		)
136 136
 	);
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 		, array(
143 143
 			'action' => 'transition_post_status',
144 144
 			'data'   => array(
145
-				'arg_index' => array( 'post' => 2 ),
146
-				'requirements' => array( 0 => 'publish' ),
145
+				'arg_index' => array('post' => 2),
146
+				'requirements' => array(0 => 'publish'),
147 147
 			),
148 148
 		)
149 149
 	);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		, array(
155 155
 			'action' => 'add_attachment',
156 156
 			'data'   => array(
157
-				'arg_index' => array( 'post\attachment' => 0 ),
157
+				'arg_index' => array('post\attachment' => 0),
158 158
 			),
159 159
 		)
160 160
 	);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		, array(
166 166
 			'action' => 'post_delete',
167 167
 			'data'   => array(
168
-				'arg_index' => array( 'post' => 0 ),
168
+				'arg_index' => array('post' => 0),
169 169
 			),
170 170
 		)
171 171
 	);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		, array(
177 177
 			'action' => 'user_register',
178 178
 			'data'   => array(
179
-				'arg_index' => array( 'user' => 0 ),
179
+				'arg_index' => array('user' => 0),
180 180
 			),
181 181
 		)
182 182
 	);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		, array(
188 188
 			'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user',
189 189
 			'data'   => array(
190
-				'arg_index' => array( 'user' => 0 ),
190
+				'arg_index' => array('user' => 0),
191 191
 			),
192 192
 		)
193 193
 	);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @param WordPoints_Hook_Events $events The event registry.
212 212
  */
213
-function wordpoints_hook_events_init( $events ) {
213
+function wordpoints_hook_events_init($events) {
214 214
 
215 215
 	$events->register(
216 216
 		'user_register'
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	);
241 241
 
242 242
 	// Register events for all of the public post types.
243
-	$post_types = get_post_types( array( 'public' => true ) );
243
+	$post_types = get_post_types(array('public' => true));
244 244
 
245 245
 	/**
246 246
 	 * Filter which post types to register hook events for.
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param string[] The post type slugs ("names").
251 251
 	 */
252
-	$post_types = apply_filters( 'wordpoints_register_hook_events_for_post_types', $post_types );
252
+	$post_types = apply_filters('wordpoints_register_hook_events_for_post_types', $post_types);
253 253
 
254
-	foreach ( $post_types as $slug ) {
255
-		wordpoints_register_post_type_hook_events( $slug );
254
+	foreach ($post_types as $slug) {
255
+		wordpoints_register_post_type_hook_events($slug);
256 256
 	}
257 257
 
258
-	if ( is_multisite() ) {
258
+	if (is_multisite()) {
259 259
 
260 260
 		$event_slugs = array(
261 261
 			'user_visit',
262 262
 			'user_register',
263 263
 		);
264 264
 
265
-		foreach ( $event_slugs as $event_slug ) {
265
+		foreach ($event_slugs as $event_slug) {
266 266
 			// TODO network hooks
267 267
 			$events->args->register(
268 268
 				$event_slug
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @param WordPoints_Class_Registry_Persistent $firers The firer registry.
284 284
  */
285
-function wordpoints_hook_firers_init( $firers ) {
285
+function wordpoints_hook_firers_init($firers) {
286 286
 
287
-	$firers->register( 'fire', 'WordPoints_Hook_Firer' );
288
-	$firers->register( 'reverse', 'WordPoints_Hook_Firer_Reverse' );
289
-	$firers->register( 'spam', 'WordPoints_Hook_Firer_Spam' );
287
+	$firers->register('fire', 'WordPoints_Hook_Firer');
288
+	$firers->register('reverse', 'WordPoints_Hook_Firer_Reverse');
289
+	$firers->register('spam', 'WordPoints_Hook_Firer_Spam');
290 290
 }
291 291
 
292 292
 /**
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
  *
299 299
  * @param WordPoints_App_Registry $entities The entities app.
300 300
  */
301
-function wordpoints_entities_app_init( $entities ) {
301
+function wordpoints_entities_app_init($entities) {
302 302
 
303
-	$entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' );
304
-	$entities->sub_apps->register( 'contexts', 'WordPoints_Class_Registry' );
303
+	$entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children');
304
+	$entities->sub_apps->register('contexts', 'WordPoints_Class_Registry');
305 305
 }
306 306
 
307 307
 /**
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
  *
314 314
  * @param WordPoints_Class_Registry $contexts The entity context registry.
315 315
  */
316
-function wordpoints_entity_contexts_init( $contexts ) {
316
+function wordpoints_entity_contexts_init($contexts) {
317 317
 
318
-	$contexts->register( 'network', 'WordPoints_Entity_Context_Network' );
319
-	$contexts->register( 'site', 'WordPoints_Entity_Context_Site' );
318
+	$contexts->register('network', 'WordPoints_Entity_Context_Network');
319
+	$contexts->register('site', 'WordPoints_Entity_Context_Site');
320 320
 }
321 321
 
322 322
 /**
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
  *
329 329
  * @param WordPoints_App_Registry $entities The entities app.
330 330
  */
331
-function wordpoints_entities_init( $entities ) {
331
+function wordpoints_entities_init($entities) {
332 332
 
333 333
 	$children = $entities->children;
334 334
 
335
-	$entities->register( 'user', 'WordPoints_Entity_User' );
336
-	$children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' );
335
+	$entities->register('user', 'WordPoints_Entity_User');
336
+	$children->register('user', 'roles', 'WordPoints_Entity_User_Roles');
337 337
 
338
-	$entities->register( 'user_role', 'WordPoints_Entity_User_Role' );
339
-	$children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' );
338
+	$entities->register('user_role', 'WordPoints_Entity_User_Role');
339
+	$children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name');
340 340
 
341 341
 	// Register entities for all of the public post types.
342
-	$post_types = get_post_types( array( 'public' => true ) );
342
+	$post_types = get_post_types(array('public' => true));
343 343
 
344 344
 	/**
345 345
 	 * Filter which post types to register entities for.
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @param string[] The post type slugs ("names").
350 350
 	 */
351
-	$post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types );
351
+	$post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types);
352 352
 
353
-	foreach ( $post_types as $slug ) {
354
-		wordpoints_register_post_type_entities( $slug );
353
+	foreach ($post_types as $slug) {
354
+		wordpoints_register_post_type_entities($slug);
355 355
 	}
356 356
 
357 357
 	// Register entities for all of the public taxonomies.
358
-	$taxonomies = get_taxonomies( array( 'public' => true ) );
358
+	$taxonomies = get_taxonomies(array('public' => true));
359 359
 
360 360
 	/**
361 361
 	 * Filter which taxonomies to register entities for.
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 	 *
365 365
 	 * @param string[] The taxonomy slugs.
366 366
 	 */
367
-	$taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies );
367
+	$taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies);
368 368
 
369
-	foreach ( $taxonomies as $slug ) {
370
-		wordpoints_register_taxonomy_entities( $slug );
369
+	foreach ($taxonomies as $slug) {
370
+		wordpoints_register_taxonomy_entities($slug);
371 371
 	}
372 372
 }
373 373
 
@@ -378,28 +378,28 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @param string $slug The slug of the post type.
380 380
  */
381
-function wordpoints_register_post_type_entities( $slug ) {
381
+function wordpoints_register_post_type_entities($slug) {
382 382
 
383 383
 	$entities = wordpoints_entities();
384 384
 	$children = $entities->children;
385 385
 
386
-	$entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' );
387
-	$children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' );
386
+	$entities->register("post\\{$slug}", 'WordPoints_Entity_Post');
387
+	$children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author');
388 388
 
389
-	$supports = get_all_post_type_supports( $slug );
389
+	$supports = get_all_post_type_supports($slug);
390 390
 
391
-	if ( isset( $supports['editor'] ) ) {
392
-		$children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' );
391
+	if (isset($supports['editor'])) {
392
+		$children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content');
393 393
 	}
394 394
 
395
-	if ( isset( $supports['comments'] ) ) {
396
-		$entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' );
397
-		$children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' );
398
-		$children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' );
395
+	if (isset($supports['comments'])) {
396
+		$entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment');
397
+		$children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post');
398
+		$children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author');
399 399
 	}
400 400
 
401
-	foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) {
402
-		$children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' );
401
+	foreach (get_object_taxonomies($slug) as $taxonomy_slug) {
402
+		$children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms');
403 403
 	}
404 404
 
405 405
 	/**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 *
410 410
 	 * @param string $slug The slug ("name") of the post type.
411 411
 	 */
412
-	do_action( 'wordpoints_register_post_type_entities', $slug );
412
+	do_action('wordpoints_register_post_type_entities', $slug);
413 413
 }
414 414
 
415 415
 /**
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
  *
420 420
  * @param string $slug The slug of the post type.
421 421
  */
422
-function wordpoints_register_post_type_hook_events( $slug ) {
422
+function wordpoints_register_post_type_hook_events($slug) {
423 423
 
424 424
 	$event_slugs = array();
425 425
 
426 426
 	$events = wordpoints_hooks()->events;
427 427
 
428
-	if ( 'attachment' === $slug ) {
428
+	if ('attachment' === $slug) {
429 429
 
430 430
 		$event_slugs[] = 'media_upload';
431 431
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		);
463 463
 	}
464 464
 
465
-	if ( post_type_supports( $slug, 'comments' ) ) {
465
+	if (post_type_supports($slug, 'comments')) {
466 466
 
467 467
 		$event_slugs[] = "comment_leave\\{$slug}";
468 468
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 			, 'WordPoints_Hook_Event_Comment_Leave'
472 472
 			, array(
473 473
 				'actions' => array(
474
-					'fire' => array( 'comment_approve', 'comment_new' ),
474
+					'fire' => array('comment_approve', 'comment_new'),
475 475
 					'reverse' => 'comment_deapprove',
476 476
 					'spam' => 'comment_spam',
477 477
 				),
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 		);
483 483
 	}
484 484
 
485
-	if ( is_multisite() ) {
486
-		foreach ( $event_slugs as $event_slug ) {
485
+	if (is_multisite()) {
486
+		foreach ($event_slugs as $event_slug) {
487 487
 			$events->args->register(
488 488
 				$event_slug
489 489
 				, 'current:site'
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @param string $slug The slug ("name") of the post type.
501 501
 	 */
502
-	do_action( 'wordpoints_register_post_type_hook_events', $slug );
502
+	do_action('wordpoints_register_post_type_hook_events', $slug);
503 503
 }
504 504
 
505 505
 /**
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
  *
510 510
  * @param string $slug The slug of the taxonomy.
511 511
  */
512
-function wordpoints_register_taxonomy_entities( $slug ) {
512
+function wordpoints_register_taxonomy_entities($slug) {
513 513
 
514 514
 	$entities = wordpoints_entities();
515 515
 	$children = $entities->children;
516 516
 
517
-	$entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' );
518
-	$children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' );
517
+	$entities->register("term\\{$slug}", 'WordPoints_Entity_Term');
518
+	$children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id');
519 519
 
520 520
 	/**
521 521
 	 * Fired when registering the entities for a taxonomy.
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @param string $slug The taxonomy's slug.
526 526
 	 */
527
-	do_action( 'wordpoints_register_taxonomy_entities', $slug );
527
+	do_action('wordpoints_register_taxonomy_entities', $slug);
528 528
 }
529 529
 
530 530
 /**
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
  *
537 537
  * @param WordPoints_Class_RegistryI $data_types The data types registry.
538 538
  */
539
-function wordpoints_data_types_init( $data_types ) {
539
+function wordpoints_data_types_init($data_types) {
540 540
 
541
-	$data_types->register( 'integer', 'WordPoints_Data_Type_Integer' );
542
-	$data_types->register( 'text', 'WordPoints_Data_Type_Text' );
541
+	$data_types->register('integer', 'WordPoints_Data_Type_Integer');
542
+	$data_types->register('text', 'WordPoints_Data_Type_Text');
543 543
 }
544 544
 
545 545
 /**
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
  *
555 555
  * @return bool Whether the user can view the points log.
556 556
  */
557
-function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) {
557
+function wordpoints_hooks_user_can_view_points_log($can_view, $log) {
558 558
 
559
-	if ( ! $can_view ) {
559
+	if ( ! $can_view) {
560 560
 		return $can_view;
561 561
 	}
562 562
 
@@ -565,11 +565,11 @@  discard block
 block discarded – undo
565 565
 	$event_slug = $log->log_type;
566 566
 
567 567
 	/** @var WordPoints_Hook_Arg $arg */
568
-	foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) {
568
+	foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) {
569 569
 
570
-		$value = wordpoints_get_points_log_meta( $log->id, $slug, true );
570
+		$value = wordpoints_get_points_log_meta($log->id, $slug, true);
571 571
 
572
-		if ( ! $value ) {
572
+		if ( ! $value) {
573 573
 			continue;
574 574
 		}
575 575
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 			, $value
580 580
 		);
581 581
 
582
-		if ( ! $can_view ) {
582
+		if ( ! $can_view) {
583 583
 			break;
584 584
 		}
585 585
 	}
@@ -598,20 +598,20 @@  discard block
 block discarded – undo
598 598
  *
599 599
  * @return bool Whether the user can view this entity.
600 600
  */
601
-function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) {
601
+function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) {
602 602
 
603
-	$entity = wordpoints_entities()->get( $entity_slug );
603
+	$entity = wordpoints_entities()->get($entity_slug);
604 604
 
605 605
 	// If this entity type is not found, we have no way of determining whether it is
606 606
 	// safe for the user to view it.
607
-	if ( ! ( $entity instanceof WordPoints_Entity ) ) {
607
+	if ( ! ($entity instanceof WordPoints_Entity)) {
608 608
 		return false;
609 609
 	}
610 610
 
611 611
 	$can_view = true;
612 612
 
613
-	if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) {
614
-		$can_view = $entity->user_can_view( $user_id, $entity_id );
613
+	if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) {
614
+		$can_view = $entity->user_can_view($user_id, $entity_id);
615 615
 	}
616 616
 
617 617
 	/**
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
  */
643 643
 function wordpoints_apps() {
644 644
 
645
-	if ( ! isset( WordPoints_App::$main ) ) {
646
-		WordPoints_App::$main = new WordPoints_App( 'apps' );
645
+	if ( ! isset(WordPoints_App::$main)) {
646
+		WordPoints_App::$main = new WordPoints_App('apps');
647 647
 	}
648 648
 
649 649
 	return WordPoints_App::$main;
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
  */
659 659
 function wordpoints_hooks() {
660 660
 
661
-	if ( ! isset( WordPoints_App::$main ) ) {
661
+	if ( ! isset(WordPoints_App::$main)) {
662 662
 		wordpoints_apps();
663 663
 	}
664 664
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
  */
675 675
 function wordpoints_entities() {
676 676
 
677
-	if ( ! isset( WordPoints_App::$main ) ) {
677
+	if ( ! isset(WordPoints_App::$main)) {
678 678
 		wordpoints_apps();
679 679
 	}
680 680
 
@@ -690,13 +690,13 @@  discard block
 block discarded – undo
690 690
  *
691 691
  * @param WordPoints_App $app The main apps app.
692 692
  */
693
-function wordpoints_apps_init( $app ) {
693
+function wordpoints_apps_init($app) {
694 694
 
695 695
 	$apps = $app->sub_apps;
696 696
 
697
-	$apps->register( 'hooks', 'WordPoints_Hooks' );
698
-	$apps->register( 'entities', 'WordPoints_App_Registry' );
699
-	$apps->register( 'data_types', 'WordPoints_Class_Registry' );
697
+	$apps->register('hooks', 'WordPoints_Hooks');
698
+	$apps->register('entities', 'WordPoints_App_Registry');
699
+	$apps->register('data_types', 'WordPoints_Class_Registry');
700 700
 }
701 701
 
702 702
 /**
@@ -709,19 +709,19 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return object|false The constructed object, or false if to many args were passed.
711 711
  */
712
-function wordpoints_construct_class_with_args( $class_name, array $args ) {
712
+function wordpoints_construct_class_with_args($class_name, array $args) {
713 713
 
714
-	switch ( count( $args ) ) {
714
+	switch (count($args)) {
715 715
 		case 0:
716 716
 			return new $class_name();
717 717
 		case 1:
718
-			return new $class_name( $args[0] );
718
+			return new $class_name($args[0]);
719 719
 		case 2:
720
-			return new $class_name( $args[0], $args[1] );
720
+			return new $class_name($args[0], $args[1]);
721 721
 		case 3:
722
-			return new $class_name( $args[0], $args[1], $args[2] );
722
+			return new $class_name($args[0], $args[1], $args[2]);
723 723
 		case 4:
724
-			return new $class_name( $args[0], $args[1], $args[2], $args[3] );
724
+			return new $class_name($args[0], $args[1], $args[2], $args[3]);
725 725
 		default:
726 726
 			return false;
727 727
 	}
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
  * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the
744 744
  *               slug is not dynamic, the value of each of those keys will be false.
745 745
  */
746
-function wordpoints_parse_dynamic_slug( $slug ) {
746
+function wordpoints_parse_dynamic_slug($slug) {
747 747
 
748
-	$parsed = array( 'dynamic' => false, 'generic' => false );
748
+	$parsed = array('dynamic' => false, 'generic' => false);
749 749
 
750
-	$parts = explode( '\\', $slug, 2 );
750
+	$parts = explode('\\', $slug, 2);
751 751
 
752
-	if ( isset( $parts[1] ) ) {
752
+	if (isset($parts[1])) {
753 753
 		$parsed['dynamic'] = $parts[1];
754 754
 		$parsed['generic'] = $parts[0];
755 755
 	}
@@ -786,28 +786,28 @@  discard block
 block discarded – undo
786 786
  * @return array|false The IDs of the context(s) you passed in, indexed by context
787 787
  *                     slug, or false if any of the contexts isn't current.
788 788
  */
789
-function wordpoints_entities_get_current_context_id( array $slugs ) {
789
+function wordpoints_entities_get_current_context_id(array $slugs) {
790 790
 
791 791
 	$current_context = array();
792 792
 
793 793
 	/** @var WordPoints_Class_Registry $contexts */
794 794
 	$contexts = wordpoints_entities()->contexts;
795 795
 
796
-	foreach ( $slugs as $slug ) {
796
+	foreach ($slugs as $slug) {
797 797
 
798
-		$context = $contexts->get( $slug );
798
+		$context = $contexts->get($slug);
799 799
 
800
-		if ( ! $context instanceof WordPoints_Entity_Context ) {
800
+		if ( ! $context instanceof WordPoints_Entity_Context) {
801 801
 			return false;
802 802
 		}
803 803
 
804 804
 		$id = $context->get_current_id();
805 805
 
806
-		if ( false === $id ) {
806
+		if (false === $id) {
807 807
 			return false;
808 808
 		}
809 809
 
810
-		$current_context[ $slug ] = $id;
810
+		$current_context[$slug] = $id;
811 811
 	}
812 812
 
813 813
 	return $current_context;
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
  */
827 827
 function wordpoints_is_network_context() {
828 828
 
829
-	if ( is_network_admin() ) {
829
+	if (is_network_admin()) {
830 830
 		return true;
831 831
 	}
832 832
 
833 833
 	// See https://core.trac.wordpress.org/ticket/22589
834 834
 	if (
835
-		defined( 'DOING_AJAX' )
835
+		defined('DOING_AJAX')
836 836
 		&& DOING_AJAX
837
-		&& isset( $_SERVER['HTTP_REFERER'] )
837
+		&& isset($_SERVER['HTTP_REFERER'])
838 838
 		&& preg_match(
839
-			'#^' . preg_quote( network_admin_url(), '#' ) . '#i'
840
-			, esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) )
839
+			'#^'.preg_quote(network_admin_url(), '#').'#i'
840
+			, esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER']))
841 841
 		)
842 842
 	) {
843 843
 		return true;
@@ -850,19 +850,19 @@  discard block
 block discarded – undo
850 850
 	 *
851 851
 	 * @param bool $in_network_context Whether we are in network context.
852 852
 	 */
853
-	return apply_filters( 'wordpoints_is_network_context', false );
853
+	return apply_filters('wordpoints_is_network_context', false);
854 854
 }
855 855
 
856
-function wordpoints_hooks_get_event_signature( WordPoints_Hook_Event_Args $event_args ) {
856
+function wordpoints_hooks_get_event_signature(WordPoints_Hook_Event_Args $event_args) {
857 857
 
858 858
 	$entity = $event_args->get_primary_arg();
859 859
 
860 860
 	// TODO what if GUID isn't set?
861
-	if ( ! $entity ) {
862
-		return str_repeat( '-', 64 );
861
+	if ( ! $entity) {
862
+		return str_repeat('-', 64);
863 863
 	}
864 864
 
865
-	return wordpoints_hash( wp_json_encode( $entity->get_the_guid() ) );
865
+	return wordpoints_hash(wp_json_encode($entity->get_the_guid()));
866 866
 }
867 867
 
868 868
 // EOF
Please login to merge, or discard this patch.