Completed
Push — master ( 760553...dce43d )
by J.D.
03:49
created
src/includes/apps.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wordpoints_apps() {
22 22
 
23
-	if ( ! isset( WordPoints_App::$main ) ) {
24
-		WordPoints_App::$main = new WordPoints_App( 'apps' );
23
+	if ( ! isset(WordPoints_App::$main)) {
24
+		WordPoints_App::$main = new WordPoints_App('apps');
25 25
 	}
26 26
 
27 27
 	return WordPoints_App::$main;
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @param WordPoints_App $app The main apps app.
38 38
  */
39
-function wordpoints_apps_init( $app ) {
39
+function wordpoints_apps_init($app) {
40 40
 
41 41
 	$apps = $app->sub_apps();
42 42
 
43
-	$apps->register( 'hooks', 'WordPoints_Hooks' );
44
-	$apps->register( 'entities', 'WordPoints_App_Registry' );
45
-	$apps->register( 'data_types', 'WordPoints_Class_Registry' );
46
-	$apps->register( 'components', 'WordPoints_App' );
47
-	$apps->register( 'modules', 'WordPoints_App' );
43
+	$apps->register('hooks', 'WordPoints_Hooks');
44
+	$apps->register('entities', 'WordPoints_App_Registry');
45
+	$apps->register('data_types', 'WordPoints_Class_Registry');
46
+	$apps->register('components', 'WordPoints_App');
47
+	$apps->register('modules', 'WordPoints_App');
48 48
 }
49 49
 
50 50
 /**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
  * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the
64 64
  *               slug is not dynamic, the value of each of those keys will be false.
65 65
  */
66
-function wordpoints_parse_dynamic_slug( $slug ) {
66
+function wordpoints_parse_dynamic_slug($slug) {
67 67
 
68
-	$parsed = array( 'dynamic' => false, 'generic' => false );
68
+	$parsed = array('dynamic' => false, 'generic' => false);
69 69
 
70
-	$parts = explode( '\\', $slug, 2 );
70
+	$parts = explode('\\', $slug, 2);
71 71
 
72
-	if ( isset( $parts[1] ) ) {
72
+	if (isset($parts[1])) {
73 73
 		$parsed['dynamic'] = $parts[1];
74 74
 		$parsed['generic'] = $parts[0];
75 75
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function wordpoints_get_post_types_for_auto_integration() {
88 88
 
89
-	$post_types = get_post_types( array( 'public' => true ) );
89
+	$post_types = get_post_types(array('public' => true));
90 90
 
91 91
 	/**
92 92
 	 * Filter which post types to automatically integrate with.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @param string[] $post_types The post type slugs ("names").
97 97
 	 */
98
-	return apply_filters( 'wordpoints_post_types_for_auto_integration', $post_types );
98
+	return apply_filters('wordpoints_post_types_for_auto_integration', $post_types);
99 99
 }
100 100
 
101 101
 //
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return false|WordPoints_App The component's app.
113 113
  */
114
-function wordpoints_component( $slug ) {
114
+function wordpoints_component($slug) {
115 115
 
116
-	if ( ! isset( WordPoints_App::$main ) ) {
116
+	if ( ! isset(WordPoints_App::$main)) {
117 117
 		wordpoints_apps();
118 118
 	}
119 119
 
120
-	return WordPoints_App::$main->get_sub_app( 'components' )->get_sub_app( $slug );
120
+	return WordPoints_App::$main->get_sub_app('components')->get_sub_app($slug);
121 121
 }
122 122
 
123 123
 //
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return false|WordPoints_App The module's app.
135 135
  */
136
-function wordpoints_module( $slug ) {
136
+function wordpoints_module($slug) {
137 137
 
138
-	if ( ! isset( WordPoints_App::$main ) ) {
138
+	if ( ! isset(WordPoints_App::$main)) {
139 139
 		wordpoints_apps();
140 140
 	}
141 141
 
142
-	return WordPoints_App::$main->get_sub_app( 'modules' )->get_sub_app( $slug );
142
+	return WordPoints_App::$main->get_sub_app('modules')->get_sub_app($slug);
143 143
 }
144 144
 
145 145
 //
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function wordpoints_entities() {
157 157
 
158
-	if ( ! isset( WordPoints_App::$main ) ) {
158
+	if ( ! isset(WordPoints_App::$main)) {
159 159
 		wordpoints_apps();
160 160
 	}
161 161
 
162
-	return WordPoints_App::$main->get_sub_app( 'entities' );
162
+	return WordPoints_App::$main->get_sub_app('entities');
163 163
 }
164 164
 
165 165
 /**
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @param WordPoints_App_Registry $entities The entities app.
173 173
  */
174
-function wordpoints_entities_app_init( $entities ) {
174
+function wordpoints_entities_app_init($entities) {
175 175
 
176 176
 	$sub_apps = $entities->sub_apps();
177
-	$sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' );
178
-	$sub_apps->register( 'contexts', 'WordPoints_Entity_Contexts' );
179
-	$sub_apps->register( 'restrictions', 'WordPoints_Entity_Restrictions' );
177
+	$sub_apps->register('children', 'WordPoints_Class_Registry_Children');
178
+	$sub_apps->register('contexts', 'WordPoints_Entity_Contexts');
179
+	$sub_apps->register('restrictions', 'WordPoints_Entity_Restrictions');
180 180
 }
181 181
 
182 182
 /**
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
  *
189 189
  * @param WordPoints_Class_RegistryI $contexts The entity context registry.
190 190
  */
191
-function wordpoints_entity_contexts_init( $contexts ) {
191
+function wordpoints_entity_contexts_init($contexts) {
192 192
 
193
-	$contexts->register( 'network', 'WordPoints_Entity_Context_Network' );
194
-	$contexts->register( 'site', 'WordPoints_Entity_Context_Site' );
193
+	$contexts->register('network', 'WordPoints_Entity_Context_Network');
194
+	$contexts->register('site', 'WordPoints_Entity_Context_Site');
195 195
 }
196 196
 
197 197
 /**
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @param WordPoints_App $restrictions The entity restrictions app.
205 205
  */
206
-function wordpoints_entities_restrictions_app_init( $restrictions ) {
206
+function wordpoints_entities_restrictions_app_init($restrictions) {
207 207
 
208 208
 	$sub_apps = $restrictions->sub_apps();
209
-	$sub_apps->register( 'know', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless' );
210
-	$sub_apps->register( 'view', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless' );
209
+	$sub_apps->register('know', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless');
210
+	$sub_apps->register('view', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless');
211 211
 }
212 212
 
213 213
 /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  * @param WordPoints_Class_Registry_Deep_Multilevel $restrictions The restrictions
224 224
  *                                                                registry.
225 225
  */
226
-function wordpoints_entity_restrictions_know_init( $restrictions ) {
226
+function wordpoints_entity_restrictions_know_init($restrictions) {
227 227
 
228 228
 	$restrictions->register(
229 229
 		'unregistered'
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 		, 'WordPoints_Entity_Restriction_Legacy'
238 238
 	);
239 239
 
240
-	foreach ( wordpoints_get_post_types_for_entities() as $slug ) {
240
+	foreach (wordpoints_get_post_types_for_entities() as $slug) {
241 241
 
242 242
 		$restrictions->register(
243 243
 			'status_nonpublic'
244
-			, array( "post\\$slug" )
244
+			, array("post\\$slug")
245 245
 			, 'WordPoints_Entity_Restriction_Post_Status_Nonpublic'
246 246
 		);
247 247
 
248 248
 		$restrictions->register(
249 249
 			'post_status_nonpublic'
250
-			, array( "comment\\$slug" )
250
+			, array("comment\\$slug")
251 251
 			, 'WordPoints_Entity_Restriction_Comment_Post_Status_Nonpublic'
252 252
 		);
253 253
 	}
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
  * @param WordPoints_Class_Registry_Deep_Multilevel $restrictions The restrictions
264 264
  *                                                                registry.
265 265
  */
266
-function wordpoints_entity_restrictions_view_init( $restrictions ) {
266
+function wordpoints_entity_restrictions_view_init($restrictions) {
267 267
 
268
-	foreach ( wordpoints_get_post_types_for_entities() as $slug ) {
268
+	foreach (wordpoints_get_post_types_for_entities() as $slug) {
269 269
 
270 270
 		$restrictions->register(
271 271
 			'password_protected'
272
-			, array( "post\\$slug", 'content' )
272
+			, array("post\\$slug", 'content')
273 273
 			, 'WordPoints_Entity_Restriction_View_Post_Content_Password_Protected'
274 274
 		);
275 275
 	}
@@ -284,21 +284,21 @@  discard block
 block discarded – undo
284 284
  *
285 285
  * @param WordPoints_App_Registry $entities The entities app.
286 286
  */
287
-function wordpoints_entities_init( $entities ) {
287
+function wordpoints_entities_init($entities) {
288 288
 
289
-	$children = $entities->get_sub_app( 'children' );
289
+	$children = $entities->get_sub_app('children');
290 290
 
291
-	$entities->register( 'user', 'WordPoints_Entity_User' );
292
-	$children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' );
291
+	$entities->register('user', 'WordPoints_Entity_User');
292
+	$children->register('user', 'roles', 'WordPoints_Entity_User_Roles');
293 293
 
294
-	$entities->register( 'user_role', 'WordPoints_Entity_User_Role' );
294
+	$entities->register('user_role', 'WordPoints_Entity_User_Role');
295 295
 
296
-	foreach ( wordpoints_get_post_types_for_entities() as $slug ) {
297
-		wordpoints_register_post_type_entities( $slug );
296
+	foreach (wordpoints_get_post_types_for_entities() as $slug) {
297
+		wordpoints_register_post_type_entities($slug);
298 298
 	}
299 299
 
300 300
 	// Also register entities for any post types that are late to the party.
301
-	add_action( 'registered_post_type', 'wordpoints_register_post_type_entities' );
301
+	add_action('registered_post_type', 'wordpoints_register_post_type_entities');
302 302
 }
303 303
 
304 304
 /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @param string[] $post_types The post type slugs ("names").
321 321
 	 */
322
-	return apply_filters( 'wordpoints_register_entities_for_post_types', $post_types );
322
+	return apply_filters('wordpoints_register_entities_for_post_types', $post_types);
323 323
 }
324 324
 
325 325
 /**
@@ -331,24 +331,24 @@  discard block
 block discarded – undo
331 331
  *
332 332
  * @param string $slug The slug of the post type.
333 333
  */
334
-function wordpoints_register_post_type_entities( $slug ) {
334
+function wordpoints_register_post_type_entities($slug) {
335 335
 
336 336
 	$entities = wordpoints_entities();
337
-	$children = $entities->get_sub_app( 'children' );
337
+	$children = $entities->get_sub_app('children');
338 338
 
339
-	$entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' );
340
-	$children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' );
339
+	$entities->register("post\\{$slug}", 'WordPoints_Entity_Post');
340
+	$children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author');
341 341
 
342
-	$supports = get_all_post_type_supports( $slug );
342
+	$supports = get_all_post_type_supports($slug);
343 343
 
344
-	if ( isset( $supports['editor'] ) ) {
345
-		$children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' );
344
+	if (isset($supports['editor'])) {
345
+		$children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content');
346 346
 	}
347 347
 
348
-	if ( isset( $supports['comments'] ) ) {
349
-		$entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' );
350
-		$children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' );
351
-		$children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' );
348
+	if (isset($supports['comments'])) {
349
+		$entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment');
350
+		$children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post');
351
+		$children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author');
352 352
 	}
353 353
 
354 354
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @param string $slug The slug ("name") of the post type.
360 360
 	 */
361
-	do_action( 'wordpoints_register_post_type_entities', $slug );
361
+	do_action('wordpoints_register_post_type_entities', $slug);
362 362
 }
363 363
 
364 364
 /**
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return bool Whether the user can view this entity.
375 375
  */
376
-function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) {
376
+function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) {
377 377
 
378 378
 	/** @var WordPoints_Entity_Restrictions $restrictions */
379
-	$restrictions = wordpoints_entities()->get_sub_app( 'restrictions' );
380
-	$restriction = $restrictions->get( $entity_id, $entity_slug, 'view' );
381
-	return $restriction->user_can( $user_id );
379
+	$restrictions = wordpoints_entities()->get_sub_app('restrictions');
380
+	$restriction = $restrictions->get($entity_id, $entity_slug, 'view');
381
+	return $restriction->user_can($user_id);
382 382
 }
383 383
 
384 384
 /**
@@ -412,28 +412,28 @@  discard block
 block discarded – undo
412 412
  *                     contexts, indexed by context slug, or false if any of the
413 413
  *                     contexts isn't current.
414 414
  */
415
-function wordpoints_entities_get_current_context_id( $slug ) {
415
+function wordpoints_entities_get_current_context_id($slug) {
416 416
 
417 417
 	$current_context = array();
418 418
 
419 419
 	/** @var WordPoints_Class_Registry $contexts */
420
-	$contexts = wordpoints_entities()->get_sub_app( 'contexts' );
420
+	$contexts = wordpoints_entities()->get_sub_app('contexts');
421 421
 
422
-	while ( $slug ) {
422
+	while ($slug) {
423 423
 
424
-		$context = $contexts->get( $slug );
424
+		$context = $contexts->get($slug);
425 425
 
426
-		if ( ! $context instanceof WordPoints_Entity_Context ) {
426
+		if ( ! $context instanceof WordPoints_Entity_Context) {
427 427
 			return false;
428 428
 		}
429 429
 
430 430
 		$id = $context->get_current_id();
431 431
 
432
-		if ( false === $id ) {
432
+		if (false === $id) {
433 433
 			return false;
434 434
 		}
435 435
 
436
-		$current_context[ $slug ] = $id;
436
+		$current_context[$slug] = $id;
437 437
 
438 438
 		$slug = $context->get_parent_slug();
439 439
 	}
@@ -454,22 +454,22 @@  discard block
 block discarded – undo
454 454
  */
455 455
 function wordpoints_is_network_context() {
456 456
 
457
-	if ( ! is_multisite() ) {
457
+	if ( ! is_multisite()) {
458 458
 		return false;
459 459
 	}
460 460
 
461
-	if ( is_network_admin() ) {
461
+	if (is_network_admin()) {
462 462
 		return true;
463 463
 	}
464 464
 
465 465
 	// See https://core.trac.wordpress.org/ticket/22589
466 466
 	if (
467
-		defined( 'DOING_AJAX' )
467
+		defined('DOING_AJAX')
468 468
 		&& DOING_AJAX
469
-		&& isset( $_SERVER['HTTP_REFERER'] )
469
+		&& isset($_SERVER['HTTP_REFERER'])
470 470
 		&& preg_match(
471
-			'#^' . preg_quote( network_admin_url(), '#' ) . '#i'
472
-			, esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) )
471
+			'#^' . preg_quote(network_admin_url(), '#') . '#i'
472
+			, esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER']))
473 473
 		)
474 474
 	) {
475 475
 		return true;
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @param bool $in_network_context Whether we are in network context.
484 484
 	 */
485
-	return apply_filters( 'wordpoints_is_network_context', false );
485
+	return apply_filters('wordpoints_is_network_context', false);
486 486
 }
487 487
 
488 488
 //
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
  *
499 499
  * @param WordPoints_Class_RegistryI $data_types The data types registry.
500 500
  */
501
-function wordpoints_data_types_init( $data_types ) {
501
+function wordpoints_data_types_init($data_types) {
502 502
 
503
-	$data_types->register( 'integer', 'WordPoints_Data_Type_Integer' );
504
-	$data_types->register( 'text', 'WordPoints_Data_Type_Text' );
503
+	$data_types->register('integer', 'WordPoints_Data_Type_Integer');
504
+	$data_types->register('text', 'WordPoints_Data_Type_Text');
505 505
 }
506 506
 
507 507
 // EOF
Please login to merge, or discard this patch.
src/includes/hooks.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function wordpoints_hooks() {
18 18
 
19
-	if ( ! isset( WordPoints_App::$main ) ) {
19
+	if ( ! isset(WordPoints_App::$main)) {
20 20
 		wordpoints_apps();
21 21
 	}
22 22
 
23
-	return WordPoints_App::$main->get_sub_app( 'hooks' );
23
+	return WordPoints_App::$main->get_sub_app('hooks');
24 24
 }
25 25
 
26 26
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	// Just accessing this causes it to be initialized. We need to do that so
38 38
 	// the actions will be registered and hooked up. The rest of the API can be
39 39
 	// lazy-loaded as it is needed.
40
-	$hooks->get_sub_app( 'actions' );
40
+	$hooks->get_sub_app('actions');
41 41
 }
42 42
 
43 43
 /**
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
  *
50 50
  * @param WordPoints_Class_Registry_Persistent $extensions The extension registry.
51 51
  */
52
-function wordpoints_hook_extensions_init( $extensions ) {
52
+function wordpoints_hook_extensions_init($extensions) {
53 53
 
54
-	$extensions->register( 'blocker', 'WordPoints_Hook_Extension_Blocker' );
55
-	$extensions->register( 'repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker' );
56
-	$extensions->register( 'reversals', 'WordPoints_Hook_Extension_Reversals' );
57
-	$extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' );
58
-	$extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' );
54
+	$extensions->register('blocker', 'WordPoints_Hook_Extension_Blocker');
55
+	$extensions->register('repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker');
56
+	$extensions->register('reversals', 'WordPoints_Hook_Extension_Reversals');
57
+	$extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions');
58
+	$extensions->register('periods', 'WordPoints_Hook_Extension_Periods');
59 59
 }
60 60
 
61 61
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @param WordPoints_Class_Registry_Children $conditions The conditions registry.
69 69
  */
70
-function wordpoints_hook_conditions_init( $conditions ) {
70
+function wordpoints_hook_conditions_init($conditions) {
71 71
 
72 72
 	$conditions->register(
73 73
 		'text'
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  *
104 104
  * @param WordPoints_Hook_Actions $actions The action registry.
105 105
  */
106
-function wordpoints_hook_actions_init( $actions ) {
106
+function wordpoints_hook_actions_init($actions) {
107 107
 
108 108
 	$actions->register(
109 109
 		'user_register'
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		, array(
112 112
 			'action' => 'user_register',
113 113
 			'data'   => array(
114
-				'arg_index' => array( 'user' => 0 ),
114
+				'arg_index' => array('user' => 0),
115 115
 			),
116 116
 		)
117 117
 	);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		, array(
123 123
 			'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user',
124 124
 			'data'   => array(
125
-				'arg_index' => array( 'user' => 0 ),
125
+				'arg_index' => array('user' => 0),
126 126
 			),
127 127
 		)
128 128
 	);
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	$post_types = apply_filters_deprecated(
150 150
 		'wordpoints_register_hook_actions_for_post_types'
151
-		, array( $post_types )
151
+		, array($post_types)
152 152
 		, '2.2.0'
153 153
 		, 'wordpoints_register_hook_events_for_post_types'
154 154
 	);
155 155
 
156
-	foreach ( $post_types as $slug ) {
157
-		wordpoints_register_post_type_hook_actions( $slug );
156
+	foreach ($post_types as $slug) {
157
+		wordpoints_register_post_type_hook_actions($slug);
158 158
 	}
159 159
 
160 160
 	// Also register actions for any post types that are late to the party.
161
-	add_action( 'registered_post_type', 'wordpoints_register_post_type_hook_actions' );
161
+	add_action('registered_post_type', 'wordpoints_register_post_type_hook_actions');
162 162
 }
163 163
 
164 164
 /**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @param string $slug The slug of the post type.
172 172
  */
173
-function wordpoints_register_post_type_hook_actions( $slug ) {
173
+function wordpoints_register_post_type_hook_actions($slug) {
174 174
 
175
-	$actions = wordpoints_hooks()->get_sub_app( 'actions' );
175
+	$actions = wordpoints_hooks()->get_sub_app('actions');
176 176
 
177
-	if ( post_type_supports( $slug, 'comments' ) ) {
177
+	if (post_type_supports($slug, 'comments')) {
178 178
 
179 179
 		$actions->register(
180 180
 			"comment_approve\\{$slug}"
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 			, array(
183 183
 				'action' => 'transition_comment_status',
184 184
 				'data'   => array(
185
-					'arg_index'    => array( "comment\\{$slug}" => 2 ),
186
-					'requirements' => array( 0 => 'approved' ),
185
+					'arg_index'    => array("comment\\{$slug}" => 2),
186
+					'requirements' => array(0 => 'approved'),
187 187
 				),
188 188
 			)
189 189
 		);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 			, array(
195 195
 				'action' => 'wp_insert_comment',
196 196
 				'data'   => array(
197
-					'arg_index' => array( "comment\\{$slug}" => 1 ),
197
+					'arg_index' => array("comment\\{$slug}" => 1),
198 198
 				),
199 199
 			)
200 200
 		);
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 			, array(
206 206
 				'action' => 'transition_comment_status',
207 207
 				'data'   => array(
208
-					'arg_index'    => array( "comment\\{$slug}" => 2 ),
209
-					'requirements' => array( 1 => 'approved' ),
208
+					'arg_index'    => array("comment\\{$slug}" => 2),
209
+					'requirements' => array(1 => 'approved'),
210 210
 				),
211 211
 			)
212 212
 		);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	} // End if ( post type supports comments ).
215 215
 
216 216
 	// This works for all post types except attachments.
217
-	if ( 'attachment' !== $slug ) {
217
+	if ('attachment' !== $slug) {
218 218
 
219 219
 		$actions->register(
220 220
 			"post_publish\\{$slug}"
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 			, array(
223 223
 				'action' => 'transition_post_status',
224 224
 				'data'   => array(
225
-					'arg_index'    => array( "post\\{$slug}" => 2 ),
225
+					'arg_index'    => array("post\\{$slug}" => 2),
226 226
 					'requirements' => array(
227 227
 						0 => 'publish',
228
-						1 => array( 'comparator' => '!=', 'value' => 'publish' ),
228
+						1 => array('comparator' => '!=', 'value' => 'publish'),
229 229
 					),
230 230
 				),
231 231
 			)
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 			, array(
238 238
 				'action' => 'transition_post_status',
239 239
 				'data'   => array(
240
-					'arg_index'    => array( "post\\{$slug}" => 2 ),
240
+					'arg_index'    => array("post\\{$slug}" => 2),
241 241
 					'requirements' => array(
242
-						0 => array( 'comparator' => '!=', 'value' => 'publish' ),
242
+						0 => array('comparator' => '!=', 'value' => 'publish'),
243 243
 						1 => 'publish',
244 244
 					),
245 245
 				),
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			, array(
253 253
 				'action' => 'delete_post',
254 254
 				'data'   => array(
255
-					'arg_index' => array( "post\\{$slug}" => 0 ),
255
+					'arg_index' => array("post\\{$slug}" => 0),
256 256
 				),
257 257
 			)
258 258
 		);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			, array(
266 266
 				'action' => 'add_attachment',
267 267
 				'data'   => array(
268
-					'arg_index' => array( 'post\attachment' => 0 ),
268
+					'arg_index' => array('post\attachment' => 0),
269 269
 				),
270 270
 			)
271 271
 		);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		, array(
279 279
 			'action' => 'delete_post',
280 280
 			'data'   => array(
281
-				'arg_index' => array( "post\\{$slug}" => 0 ),
281
+				'arg_index' => array("post\\{$slug}" => 0),
282 282
 			),
283 283
 		)
284 284
 	);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @param string $slug The slug ("name") of the post type.
292 292
 	 */
293
-	do_action( 'wordpoints_register_post_type_hook_actions', $slug );
293
+	do_action('wordpoints_register_post_type_hook_actions', $slug);
294 294
 }
295 295
 
296 296
 /**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
  *
303 303
  * @param WordPoints_Hook_Events $events The event registry.
304 304
  */
305
-function wordpoints_hook_events_init( $events ) {
305
+function wordpoints_hook_events_init($events) {
306 306
 
307 307
 	$events->register(
308 308
 		'user_register'
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 		)
332 332
 	);
333 333
 
334
-	foreach ( wordpoints_get_post_types_for_hook_events() as $slug ) {
335
-		wordpoints_register_post_type_hook_events( $slug );
334
+	foreach (wordpoints_get_post_types_for_hook_events() as $slug) {
335
+		wordpoints_register_post_type_hook_events($slug);
336 336
 	}
337 337
 
338 338
 	// Also register events for any post types that are late to the party.
339
-	add_action( 'registered_post_type', 'wordpoints_register_post_type_hook_events' );
339
+	add_action('registered_post_type', 'wordpoints_register_post_type_hook_events');
340 340
 }
341 341
 
342 342
 /**
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
  *
371 371
  * @param string $slug The slug of the post type.
372 372
  */
373
-function wordpoints_register_post_type_hook_events( $slug ) {
373
+function wordpoints_register_post_type_hook_events($slug) {
374 374
 
375
-	$events = wordpoints_hooks()->get_sub_app( 'events' );
375
+	$events = wordpoints_hooks()->get_sub_app('events');
376 376
 
377
-	if ( 'attachment' === $slug ) {
377
+	if ('attachment' === $slug) {
378 378
 
379 379
 		$events->register(
380 380
 			'media_upload'
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		);
411 411
 	}
412 412
 
413
-	if ( post_type_supports( $slug, 'comments' ) ) {
413
+	if (post_type_supports($slug, 'comments')) {
414 414
 
415 415
 		$events->register(
416 416
 			"comment_leave\\{$slug}"
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 *
438 438
 	 * @param string $slug The slug ("name") of the post type.
439 439
 	 */
440
-	do_action( 'wordpoints_register_post_type_hook_events', $slug );
440
+	do_action('wordpoints_register_post_type_hook_events', $slug);
441 441
 }
442 442
 
443 443
 /**
@@ -451,36 +451,36 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return string The signature arg(s)'s GUID(s), JSON encoded.
453 453
  */
454
-function wordpoints_hooks_get_event_signature_arg_guids_json( WordPoints_Hook_Event_Args $event_args ) {
454
+function wordpoints_hooks_get_event_signature_arg_guids_json(WordPoints_Hook_Event_Args $event_args) {
455 455
 
456 456
 	$entities = $event_args->get_signature_args();
457 457
 
458
-	if ( ! $entities ) {
458
+	if ( ! $entities) {
459 459
 		return '';
460 460
 	}
461 461
 
462 462
 	$the_guids = array();
463 463
 
464
-	foreach ( $entities as $arg_slug => $entity ) {
464
+	foreach ($entities as $arg_slug => $entity) {
465 465
 
466 466
 		$the_guid = $entity->get_the_guid();
467 467
 
468
-		if ( $the_guid ) {
469
-			$the_guids[ $arg_slug ] = $the_guid;
468
+		if ($the_guid) {
469
+			$the_guids[$arg_slug] = $the_guid;
470 470
 		}
471 471
 	}
472 472
 
473
-	if ( ! $the_guids ) {
473
+	if ( ! $the_guids) {
474 474
 		return '';
475 475
 	}
476 476
 
477
-	if ( 1 === count( $the_guids ) ) {
478
-		$the_guids = reset( $the_guids );
477
+	if (1 === count($the_guids)) {
478
+		$the_guids = reset($the_guids);
479 479
 	} else {
480
-		ksort( $the_guids );
480
+		ksort($the_guids);
481 481
 	}
482 482
 
483
-	return wp_json_encode( $the_guids );
483
+	return wp_json_encode($the_guids);
484 484
 }
485 485
 
486 486
 /**
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The primary arg's GUID, JSON encoded.
497 497
  */
498
-function wordpoints_hooks_get_event_primary_arg_guid_json( WordPoints_Hook_Event_Args $event_args ) {
498
+function wordpoints_hooks_get_event_primary_arg_guid_json(WordPoints_Hook_Event_Args $event_args) {
499 499
 
500 500
 	_deprecated_function(
501 501
 		__FUNCTION__
@@ -505,17 +505,17 @@  discard block
 block discarded – undo
505 505
 
506 506
 	$entity = $event_args->get_primary_arg();
507 507
 
508
-	if ( ! $entity ) {
508
+	if ( ! $entity) {
509 509
 		return '';
510 510
 	}
511 511
 
512 512
 	$the_guid = $entity->get_the_guid();
513 513
 
514
-	if ( ! $the_guid ) {
514
+	if ( ! $the_guid) {
515 515
 		return '';
516 516
 	}
517 517
 
518
-	return wp_json_encode( $the_guid );
518
+	return wp_json_encode($the_guid);
519 519
 }
520 520
 
521 521
 // EOF
Please login to merge, or discard this patch.
src/includes/class-widget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  * @deprecated 2.3.0
9 9
  */
10 10
 
11
-_deprecated_file( __FILE__, '2.3.0', 'classes/widget.php' );
11
+_deprecated_file(__FILE__, '2.3.0', 'classes/widget.php');
12 12
 
13 13
 /**
14 14
  * The widget class.
Please login to merge, or discard this patch.
src/includes/modules.php 1 patch
Spacing   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return bool Whether the module is active.
20 20
  */
21
-function is_wordpoints_module_active( $module ) {
21
+function is_wordpoints_module_active($module) {
22 22
 
23 23
 	return (
24
-		in_array( $module, wordpoints_get_array_option( 'wordpoints_active_modules' ) )
25
-		|| is_wordpoints_module_active_for_network( $module )
24
+		in_array($module, wordpoints_get_array_option('wordpoints_active_modules'))
25
+		|| is_wordpoints_module_active_for_network($module)
26 26
 	);
27 27
 }
28 28
 
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return bool Whether the module is network active.
37 37
  */
38
-function is_wordpoints_module_active_for_network( $module ) {
38
+function is_wordpoints_module_active_for_network($module) {
39 39
 
40
-	if ( ! is_wordpoints_network_active() ) {
40
+	if ( ! is_wordpoints_network_active()) {
41 41
 		return false;
42 42
 	}
43 43
 
44
-	$modules = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
44
+	$modules = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
45 45
 
46
-	if ( isset( $modules[ $module ] ) ) {
46
+	if (isset($modules[$module])) {
47 47
 		return true;
48 48
 	}
49 49
 
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return bool True if the module is network only, false otherwise.
67 67
  */
68
-function is_network_only_wordpoints_module( $module ) {
68
+function is_network_only_wordpoints_module($module) {
69 69
 
70
-	$module_data = wordpoints_get_module_data( wordpoints_modules_dir() . '/' . $module );
70
+	$module_data = wordpoints_get_module_data(wordpoints_modules_dir() . '/' . $module);
71 71
 
72 72
 	return $module_data['network'];
73 73
 }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
  *
82 82
  * @return bool True if the module has an uninstall script, false otherwise.
83 83
  */
84
-function is_uninstallable_wordpoints_module( $module ) {
84
+function is_uninstallable_wordpoints_module($module) {
85 85
 
86
-	return ( file_exists( wordpoints_modules_dir() . '/' . dirname( wordpoints_module_basename( $module ) ) . '/uninstall.php' ) );
86
+	return (file_exists(wordpoints_modules_dir() . '/' . dirname(wordpoints_module_basename($module)) . '/uninstall.php'));
87 87
 }
88 88
 
89 89
 /**
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 
108 108
 	static $modules_dir;
109 109
 
110
-	if ( ! $modules_dir ) {
110
+	if ( ! $modules_dir) {
111 111
 
112
-		if ( defined( 'WORDPOINTS_MODULES_DIR' ) ) {
112
+		if (defined('WORDPOINTS_MODULES_DIR')) {
113 113
 
114
-			$modules_dir = trailingslashit( WORDPOINTS_MODULES_DIR );
114
+			$modules_dir = trailingslashit(WORDPOINTS_MODULES_DIR);
115 115
 
116 116
 		} else {
117 117
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @param string $module_dir The full path to the modules folder.
129 129
 	 */
130
-	return apply_filters( 'wordpoints_modules_dir', $modules_dir );
130
+	return apply_filters('wordpoints_modules_dir', $modules_dir);
131 131
 }
132 132
 
133 133
 /**
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return string The URL for the path passed.
142 142
  */
143
-function wordpoints_modules_url( $path = '', $module = '' ) {
143
+function wordpoints_modules_url($path = '', $module = '') {
144 144
 
145
-	$path   = wp_normalize_path( $path );
146
-	$module = wp_normalize_path( $module );
145
+	$path   = wp_normalize_path($path);
146
+	$module = wp_normalize_path($module);
147 147
 
148
-	if ( defined( 'WORDPOINTS_MODULES_URL' ) ) {
148
+	if (defined('WORDPOINTS_MODULES_URL')) {
149 149
 		$url = WORDPOINTS_MODULES_URL;
150 150
 	} else {
151 151
 		$url = WP_CONTENT_URL . '/wordpoints-modules';
152 152
 	}
153 153
 
154
-	$url = set_url_scheme( $url );
154
+	$url = set_url_scheme($url);
155 155
 
156
-	if ( ! empty( $module ) && is_string( $module ) ) {
156
+	if ( ! empty($module) && is_string($module)) {
157 157
 
158
-		$folder = dirname( wordpoints_module_basename( $module ) );
158
+		$folder = dirname(wordpoints_module_basename($module));
159 159
 
160
-		if ( '.' !== $folder ) {
161
-			$url .= '/' . ltrim( $folder, '/' );
160
+		if ('.' !== $folder) {
161
+			$url .= '/' . ltrim($folder, '/');
162 162
 		}
163 163
 	}
164 164
 
165
-	if ( $path && is_string( $path ) ) {
166
-		$url .= '/' . ltrim( $path, '/' );
165
+	if ($path && is_string($path)) {
166
+		$url .= '/' . ltrim($path, '/');
167 167
 	}
168 168
 
169 169
 	/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @param string $path   A relative path to a file or folder.
176 176
 	 * @param string $module A module file that the $path should be relative to.
177 177
 	 */
178
-	return apply_filters( 'wordpoints_modules_url', $url, $path, $module );
178
+	return apply_filters('wordpoints_modules_url', $url, $path, $module);
179 179
 }
180 180
 
181 181
 /**
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
  *
188 188
  * @return string The name of the module file.
189 189
  */
190
-function wordpoints_module_basename( $file ) {
190
+function wordpoints_module_basename($file) {
191 191
 
192 192
 	// Sanitize, and resolve possible symlink path from what is likely a real path.
193
-	$file = WordPoints_Module_Paths::resolve( $file );
193
+	$file = WordPoints_Module_Paths::resolve($file);
194 194
 
195 195
 	// Sanitize for Win32 installs and remove any duplicate slashes.
196
-	$modules_dir = wp_normalize_path( wordpoints_modules_dir() );
196
+	$modules_dir = wp_normalize_path(wordpoints_modules_dir());
197 197
 
198 198
 	// Get the relative path from the modules directory, and trim off the slashes.
199
-	$file = preg_replace( '#^' . preg_quote( $modules_dir, '#' ) . '#', '', $file );
200
-	$file = trim( $file, '/' );
199
+	$file = preg_replace('#^' . preg_quote($modules_dir, '#') . '#', '', $file);
200
+	$file = trim($file, '/');
201 201
 
202 202
 	return $file;
203 203
 }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
  *         @type string $namespace   The namespace for this module. Should be Title_Case, and omit "WordPoints" prefix.
238 238
  * }
239 239
  */
240
-function wordpoints_get_module_data( $module_file, $markup = true, $translate = true ) {
240
+function wordpoints_get_module_data($module_file, $markup = true, $translate = true) {
241 241
 
242 242
 	$default_headers = array(
243 243
 		'name'        => 'Module Name',
@@ -255,94 +255,94 @@  discard block
 block discarded – undo
255 255
 		'namespace'   => 'Namespace',
256 256
 	);
257 257
 
258
-	$module_data = WordPoints_Modules::get_data( $module_file );
258
+	$module_data = WordPoints_Modules::get_data($module_file);
259 259
 
260
-	if ( $module_data && wp_normalize_path( $module_file ) === $module_data['raw_file'] ) {
261
-		unset( $module_data['raw'], $module_data['raw_file'] );
260
+	if ($module_data && wp_normalize_path($module_file) === $module_data['raw_file']) {
261
+		unset($module_data['raw'], $module_data['raw_file']);
262 262
 	} else {
263
-		$module_data = get_file_data( $module_file, $default_headers, 'wordpoints_module' );
263
+		$module_data = get_file_data($module_file, $default_headers, 'wordpoints_module');
264 264
 	}
265 265
 
266
-	if ( ! empty( $module_data['update_api'] ) ) {
267
-		_deprecated_argument( __FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Channel".' );
266
+	if ( ! empty($module_data['update_api'])) {
267
+		_deprecated_argument(__FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Channel".');
268 268
 	}
269 269
 
270
-	$module_data['network'] = ( 'true' === strtolower( $module_data['network'] ) );
270
+	$module_data['network'] = ('true' === strtolower($module_data['network']));
271 271
 
272
-	if ( $markup || $translate ) {
272
+	if ($markup || $translate) {
273 273
 
274 274
 		// Sanitize the plugin filename to a WP_module_DIR relative path
275
-		$module_file = wordpoints_module_basename( $module_file );
275
+		$module_file = wordpoints_module_basename($module_file);
276 276
 
277 277
 		// Translate fields
278
-		if ( $translate ) {
278
+		if ($translate) {
279 279
 
280 280
 			$textdomain = $module_data['text_domain'];
281 281
 
282
-			if ( $textdomain ) {
282
+			if ($textdomain) {
283 283
 
284
-				if ( ! is_textdomain_loaded( $textdomain ) ) {
284
+				if ( ! is_textdomain_loaded($textdomain)) {
285 285
 
286
-					$domain_path = dirname( $module_file );
286
+					$domain_path = dirname($module_file);
287 287
 
288
-					if ( $module_data['domain_path'] ) {
288
+					if ($module_data['domain_path']) {
289 289
 						$domain_path .= $module_data['domain_path'];
290 290
 					}
291 291
 
292
-					wordpoints_load_module_textdomain( $textdomain, $domain_path );
292
+					wordpoints_load_module_textdomain($textdomain, $domain_path);
293 293
 				}
294 294
 
295
-				foreach ( array( 'name', 'module_uri', 'description', 'author', 'author_uri', 'version' ) as $field ) {
295
+				foreach (array('name', 'module_uri', 'description', 'author', 'author_uri', 'version') as $field) {
296 296
 
297
-					$module_data[ $field ] = translate( $module_data[ $field ], $textdomain ); // @codingStandardsIgnoreLine
297
+					$module_data[$field] = translate($module_data[$field], $textdomain); // @codingStandardsIgnoreLine
298 298
 				}
299 299
 			}
300 300
 		}
301 301
 
302 302
 		// Sanitize fields.
303 303
 		$allowed_tags_in_links = array(
304
-			'abbr'    => array( 'title' => true ),
305
-			'acronym' => array( 'title' => true ),
304
+			'abbr'    => array('title' => true),
305
+			'acronym' => array('title' => true),
306 306
 			'code'    => true,
307 307
 			'em'      => true,
308 308
 			'strong'  => true,
309 309
 		);
310 310
 
311 311
 		$allowed_tags = $allowed_tags_in_links;
312
-		$allowed_tags['a'] = array( 'href' => true, 'title' => true );
312
+		$allowed_tags['a'] = array('href' => true, 'title' => true);
313 313
 
314 314
 		// Name and author ar marked up inside <a> tags. Don't allow these.
315
-		$module_data['name']   = wp_kses( $module_data['name'],   $allowed_tags_in_links );
316
-		$module_data['author'] = wp_kses( $module_data['author'], $allowed_tags_in_links );
315
+		$module_data['name']   = wp_kses($module_data['name'], $allowed_tags_in_links);
316
+		$module_data['author'] = wp_kses($module_data['author'], $allowed_tags_in_links);
317 317
 
318
-		$module_data['description'] = wp_kses( $module_data['description'], $allowed_tags );
319
-		$module_data['version']     = wp_kses( $module_data['version'],     $allowed_tags );
318
+		$module_data['description'] = wp_kses($module_data['description'], $allowed_tags);
319
+		$module_data['version']     = wp_kses($module_data['version'], $allowed_tags);
320 320
 
321
-		$module_data['module_uri'] = esc_url( $module_data['module_uri'] );
322
-		$module_data['author_uri'] = esc_url( $module_data['author_uri'] );
321
+		$module_data['module_uri'] = esc_url($module_data['module_uri']);
322
+		$module_data['author_uri'] = esc_url($module_data['author_uri']);
323 323
 
324 324
 		$module_data['title']       = $module_data['name'];
325 325
 		$module_data['author_name'] = $module_data['author'];
326 326
 
327 327
 		// Apply markup.
328
-		if ( $markup ) {
328
+		if ($markup) {
329 329
 
330
-			if ( $module_data['module_uri'] && $module_data['name'] ) {
330
+			if ($module_data['module_uri'] && $module_data['name']) {
331 331
 				$module_data['title'] = '<a href="' . $module_data['module_uri']
332 332
 					. '">' . $module_data['name'] . '</a>';
333 333
 			}
334 334
 
335
-			if ( $module_data['author_uri'] && $module_data['author'] ) {
335
+			if ($module_data['author_uri'] && $module_data['author']) {
336 336
 				$module_data['author'] = '<a href="' . $module_data['author_uri']
337 337
 					. '">' . $module_data['author'] . '</a>';
338 338
 			}
339 339
 
340
-			$module_data['description'] = wptexturize( $module_data['description'] );
340
+			$module_data['description'] = wptexturize($module_data['description']);
341 341
 
342
-			if ( $module_data['author'] ) {
342
+			if ($module_data['author']) {
343 343
 				$module_data['description'] .= ' <cite>'
344 344
 					// translators: Author name.
345
-					. sprintf( __( 'By %s.', 'wordpoints' ), $module_data['author'] )
345
+					. sprintf(__('By %s.', 'wordpoints'), $module_data['author'])
346 346
 					. '</cite>';
347 347
 			}
348 348
 		}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return bool Whether the textdoamin was loaded successfully.
370 370
  */
371
-function wordpoints_load_module_textdomain( $domain, $module_rel_path = false ) {
371
+function wordpoints_load_module_textdomain($domain, $module_rel_path = false) {
372 372
 
373 373
 	$locale = get_locale();
374 374
 
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
 	 * @param string $locale The module's current locale.
381 381
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
382 382
 	 */
383
-	$locale = apply_filters( 'wordpoints_module_locale', $locale, $domain );
383
+	$locale = apply_filters('wordpoints_module_locale', $locale, $domain);
384 384
 
385
-	if ( false !== $module_rel_path	) {
385
+	if (false !== $module_rel_path) {
386 386
 
387
-		$path = wordpoints_modules_dir() . '/' . trim( $module_rel_path, '/' );
387
+		$path = wordpoints_modules_dir() . '/' . trim($module_rel_path, '/');
388 388
 
389 389
 	} else {
390 390
 
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
 	// Load the textdomain according to the module first.
395 395
 	$mofile = $domain . '-' . $locale . '.mo';
396 396
 
397
-	if ( load_textdomain( $domain, $path . '/' . $mofile ) ) {
397
+	if (load_textdomain($domain, $path . '/' . $mofile)) {
398 398
 		return true;
399 399
 	}
400 400
 
401 401
 	// Otherwise, load from the languages directory.
402 402
 	$mofile = WP_LANG_DIR . '/wordpoints-modules/' . $mofile;
403 403
 
404
-	return load_textdomain( $domain, $mofile );
404
+	return load_textdomain($domain, $mofile);
405 405
 }
406 406
 
407 407
 /**
@@ -421,76 +421,76 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return array A list of the module files found (files with module headers).
423 423
  */
424
-function wordpoints_get_modules( $module_folder = '', $markup = false, $translate = false ) {
424
+function wordpoints_get_modules($module_folder = '', $markup = false, $translate = false) {
425 425
 
426
-	$cache_modules = wp_cache_get( 'wordpoints_modules', 'wordpoints_modules' );
426
+	$cache_modules = wp_cache_get('wordpoints_modules', 'wordpoints_modules');
427 427
 
428
-	if ( ! $cache_modules ) {
428
+	if ( ! $cache_modules) {
429 429
 		$cache_modules = array();
430 430
 	}
431 431
 
432
-	if ( isset( $cache_modules[ $module_folder ] ) ) {
433
-		return $cache_modules[ $module_folder ];
432
+	if (isset($cache_modules[$module_folder])) {
433
+		return $cache_modules[$module_folder];
434 434
 	}
435 435
 
436 436
 	$modules     = array();
437 437
 	$module_root = wordpoints_modules_dir();
438 438
 
439
-	if ( ! empty( $module_folder ) ) {
439
+	if ( ! empty($module_folder)) {
440 440
 		$module_root .= $module_folder;
441 441
 	}
442 442
 
443 443
 	// Escape pattern-matching characters in the path.
444
-	$module_escape_root = str_replace( array( '*', '?', '[' ), array( '[*]', '[?]', '[[]' ), $module_root );
444
+	$module_escape_root = str_replace(array('*', '?', '['), array('[*]', '[?]', '[[]'), $module_root);
445 445
 
446 446
 	// Get the top level files.
447
-	$module_files = glob( "{$module_escape_root}/*.php" );
447
+	$module_files = glob("{$module_escape_root}/*.php");
448 448
 
449
-	if ( false === $module_files ) {
449
+	if (false === $module_files) {
450 450
 		return $modules;
451 451
 	}
452 452
 
453 453
 	// Get the files of subfolders, if not already searching in a subfolder.
454
-	if ( empty( $module_folder ) ) {
454
+	if (empty($module_folder)) {
455 455
 
456
-		$subfolder_files = glob( "{$module_escape_root}/*/*.php" );
456
+		$subfolder_files = glob("{$module_escape_root}/*/*.php");
457 457
 
458
-		if ( false === $subfolder_files ) {
458
+		if (false === $subfolder_files) {
459 459
 			return $modules;
460 460
 		}
461 461
 
462
-		$module_files = array_merge( $module_files, $subfolder_files );
462
+		$module_files = array_merge($module_files, $subfolder_files);
463 463
 	}
464 464
 
465
-	if ( empty( $module_files ) ) {
465
+	if (empty($module_files)) {
466 466
 		return $modules;
467 467
 	}
468 468
 
469
-	foreach ( $module_files as $module_file ) {
469
+	foreach ($module_files as $module_file) {
470 470
 
471
-		if ( ! is_readable( $module_file ) ) {
471
+		if ( ! is_readable($module_file)) {
472 472
 			continue;
473 473
 		}
474 474
 
475
-		$module_data = wordpoints_get_module_data( $module_file, $markup, $translate );
475
+		$module_data = wordpoints_get_module_data($module_file, $markup, $translate);
476 476
 
477
-		if ( empty( $module_data['name'] ) ) {
477
+		if (empty($module_data['name'])) {
478 478
 			continue;
479 479
 		}
480 480
 
481
-		$module_file = wordpoints_module_basename( $module_file );
481
+		$module_file = wordpoints_module_basename($module_file);
482 482
 
483
-		if ( $module_folder ) {
484
-			$module_file = basename( $module_file );
483
+		if ($module_folder) {
484
+			$module_file = basename($module_file);
485 485
 		}
486 486
 
487
-		$modules[ $module_file ] = $module_data;
487
+		$modules[$module_file] = $module_data;
488 488
 	}
489 489
 
490
-	uasort( $modules, '_wordpoints_sort_uname_callback' );
490
+	uasort($modules, '_wordpoints_sort_uname_callback');
491 491
 
492
-	$cache_modules[ $module_folder ] = $modules;
493
-	wp_cache_set( 'wordpoints_modules', $cache_modules, 'wordpoints_modules' );
492
+	$cache_modules[$module_folder] = $modules;
493
+	wp_cache_set('wordpoints_modules', $cache_modules, 'wordpoints_modules');
494 494
 
495 495
 	return $modules;
496 496
 }
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @return true|WP_Error True on success, a WP_Error on failure.
506 506
  */
507
-function wordpoints_validate_module( $module ) {
507
+function wordpoints_validate_module($module) {
508 508
 
509
-	if ( validate_file( $module ) ) {
510
-		return new WP_Error( 'module_invalid', __( 'Invalid module path.', 'wordpoints' ) );
509
+	if (validate_file($module)) {
510
+		return new WP_Error('module_invalid', __('Invalid module path.', 'wordpoints'));
511 511
 	}
512 512
 
513
-	if ( ! file_exists( wordpoints_modules_dir() . '/' . $module ) ) {
514
-		return new WP_Error( 'module_not_found', __( 'Module file does not exist.', 'wordpoints' ) );
513
+	if ( ! file_exists(wordpoints_modules_dir() . '/' . $module)) {
514
+		return new WP_Error('module_not_found', __('Module file does not exist.', 'wordpoints'));
515 515
 	}
516 516
 
517 517
 	$installed_modules = wordpoints_get_modules();
518 518
 
519
-	if ( ! isset( $installed_modules[ $module ] ) ) {
520
-		return new WP_Error( 'no_module_header', __( 'The module does not have a valid header.', 'wordpoints' ) );
519
+	if ( ! isset($installed_modules[$module])) {
520
+		return new WP_Error('no_module_header', __('The module does not have a valid header.', 'wordpoints'));
521 521
 	}
522 522
 
523 523
 	return true;
@@ -534,27 +534,27 @@  discard block
 block discarded – undo
534 534
  */
535 535
 function wordpoints_validate_active_modules() {
536 536
 
537
-	$modules = wordpoints_get_array_option( 'wordpoints_active_modules' );
537
+	$modules = wordpoints_get_array_option('wordpoints_active_modules');
538 538
 
539
-	if ( is_multisite() && current_user_can( 'manage_network_wordpoints_modules' ) ) {
539
+	if (is_multisite() && current_user_can('manage_network_wordpoints_modules')) {
540 540
 
541
-		$network_modules = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
542
-		$modules = array_merge( $modules, array_keys( $network_modules ) );
541
+		$network_modules = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
542
+		$modules = array_merge($modules, array_keys($network_modules));
543 543
 	}
544 544
 
545
-	if ( empty( $modules ) ) {
545
+	if (empty($modules)) {
546 546
 		return null;
547 547
 	}
548 548
 
549 549
 	$invalid = array();
550 550
 
551
-	foreach ( $modules as $module ) {
551
+	foreach ($modules as $module) {
552 552
 
553
-		$result = wordpoints_validate_module( $module );
553
+		$result = wordpoints_validate_module($module);
554 554
 
555
-		if ( is_wp_error( $result ) ) {
556
-			$invalid[ $module ] = $result;
557
-			wordpoints_deactivate_modules( $module, true );
555
+		if (is_wp_error($result)) {
556
+			$invalid[$module] = $result;
557
+			wordpoints_deactivate_modules($module, true);
558 558
 		}
559 559
 	}
560 560
 
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
  *
572 572
  * @return int {@see strnatcasecmp()}.
573 573
  */
574
-function _wordpoints_sort_uname_callback( $a, $b ) {
574
+function _wordpoints_sort_uname_callback($a, $b) {
575 575
 
576
-	return strnatcasecmp( $a['name'], $b['name'] );
576
+	return strnatcasecmp($a['name'], $b['name']);
577 577
 }
578 578
 
579 579
 /**
@@ -604,33 +604,33 @@  discard block
 block discarded – undo
604 604
  *
605 605
  * @return WP_Error|null An error object on failure, or null on success.
606 606
  */
607
-function wordpoints_activate_module( $module, $redirect = '', $network_wide = false, $silent = false ) {
607
+function wordpoints_activate_module($module, $redirect = '', $network_wide = false, $silent = false) {
608 608
 
609
-	$module = wordpoints_module_basename( $module );
609
+	$module = wordpoints_module_basename($module);
610 610
 
611
-	$valid = wordpoints_validate_module( $module );
611
+	$valid = wordpoints_validate_module($module);
612 612
 
613
-	if ( is_wp_error( $valid ) ) {
613
+	if (is_wp_error($valid)) {
614 614
 		return $valid;
615 615
 	}
616 616
 
617
-	if ( is_multisite() && ( $network_wide || is_network_only_wordpoints_module( $module ) ) ) {
617
+	if (is_multisite() && ($network_wide || is_network_only_wordpoints_module($module))) {
618 618
 
619 619
 		$network_wide = true;
620
-		$network_current = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
621
-		$current = array_keys( $network_current );
620
+		$network_current = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
621
+		$current = array_keys($network_current);
622 622
 
623 623
 	} else {
624 624
 
625
-		$current = wordpoints_get_array_option( 'wordpoints_active_modules' );
625
+		$current = wordpoints_get_array_option('wordpoints_active_modules');
626 626
 	}
627 627
 
628 628
 	// If the module is already active, return.
629
-	if ( in_array( $module, $current ) ) {
629
+	if (in_array($module, $current)) {
630 630
 		return null;
631 631
 	}
632 632
 
633
-	if ( ! empty( $redirect ) ) {
633
+	if ( ! empty($redirect)) {
634 634
 
635 635
 		/*
636 636
 		 * Redirect. We'll override this later if the module can be included
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 		wp_safe_redirect(
640 640
 			add_query_arg(
641 641
 				'_error_nonce'
642
-				, wp_create_nonce( 'module-activation-error_' . $module )
642
+				, wp_create_nonce('module-activation-error_' . $module)
643 643
 				, $redirect
644 644
 			)
645 645
 		);
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
 	ob_start();
649 649
 
650 650
 	$module_file = wordpoints_modules_dir() . '/' . $module;
651
-	WordPoints_Module_Paths::register( $module_file );
651
+	WordPoints_Module_Paths::register($module_file);
652 652
 
653 653
 	include_once $module_file;
654 654
 
655
-	if ( ! $silent ) {
655
+	if ( ! $silent) {
656 656
 
657 657
 		/**
658 658
 		 * Fires before a module is activated.
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		 *                             all sites in the network or just the
665 665
 		 *                             current site.
666 666
 		 */
667
-		do_action( 'wordpoints_module_activate', $module, $network_wide );
667
+		do_action('wordpoints_module_activate', $module, $network_wide);
668 668
 
669 669
 		/**
670 670
 		 * Fires before a module is activated.
@@ -675,28 +675,28 @@  discard block
 block discarded – undo
675 675
 		 *                           all sites in the network or just the current
676 676
 		 *                           site.
677 677
 		 */
678
-		do_action( "wordpoints_module_activate-{$module}", $network_wide );
678
+		do_action("wordpoints_module_activate-{$module}", $network_wide);
679 679
 
680 680
 		WordPoints_Installables::install(
681 681
 			'module'
682
-			, WordPoints_Modules::get_slug( $module )
682
+			, WordPoints_Modules::get_slug($module)
683 683
 			, $network_wide
684 684
 		);
685 685
 	}
686 686
 
687
-	if ( $network_wide ) {
687
+	if ($network_wide) {
688 688
 
689
-		$network_current[ $module ] = time();
690
-		update_site_option( 'wordpoints_sitewide_active_modules', $network_current );
689
+		$network_current[$module] = time();
690
+		update_site_option('wordpoints_sitewide_active_modules', $network_current);
691 691
 
692 692
 	} else {
693 693
 
694 694
 		$current[] = $module;
695
-		sort( $current );
696
-		update_option( 'wordpoints_active_modules', $current );
695
+		sort($current);
696
+		update_option('wordpoints_active_modules', $current);
697 697
 	}
698 698
 
699
-	if ( ! $silent ) {
699
+	if ( ! $silent) {
700 700
 		/**
701 701
 		 * Fires after a module has been activated in activate_plugin() when the $silent parameter is false.
702 702
 		 *
@@ -707,14 +707,14 @@  discard block
 block discarded – undo
707 707
 		 *                             all sites in the network or just the
708 708
 		 *                             current site.
709 709
 		 */
710
-		do_action( 'wordpoints_activated_module', $module, $network_wide );
710
+		do_action('wordpoints_activated_module', $module, $network_wide);
711 711
 	}
712 712
 
713
-	if ( ob_get_length() > 0 ) {
713
+	if (ob_get_length() > 0) {
714 714
 
715 715
 		return new WP_Error(
716 716
 			'unexpected_output'
717
-			, __( 'The module generated unexpected output.', 'wordpoints' )
717
+			, __('The module generated unexpected output.', 'wordpoints')
718 718
 			, ob_get_contents()
719 719
 		);
720 720
 	}
@@ -734,29 +734,29 @@  discard block
 block discarded – undo
734 734
  *                                   Default is false.
735 735
  * @param bool         $network_wide Whether to apply the change network wide.
736 736
  */
737
-function wordpoints_deactivate_modules( $modules, $silent = false, $network_wide = null ) {
737
+function wordpoints_deactivate_modules($modules, $silent = false, $network_wide = null) {
738 738
 
739 739
 	$network_current = array();
740
-	if ( is_wordpoints_network_active() ) {
741
-		$network_current = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
740
+	if (is_wordpoints_network_active()) {
741
+		$network_current = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
742 742
 	}
743 743
 
744
-	$current = wordpoints_get_array_option( 'wordpoints_active_modules' );
744
+	$current = wordpoints_get_array_option('wordpoints_active_modules');
745 745
 
746 746
 	$do_network = false;
747 747
 	$do_blog = false;
748 748
 
749
-	foreach ( (array) $modules as $module ) {
749
+	foreach ((array) $modules as $module) {
750 750
 
751
-		$module = wordpoints_module_basename( $module );
751
+		$module = wordpoints_module_basename($module);
752 752
 
753
-		if ( ! is_wordpoints_module_active( $module ) ) {
753
+		if ( ! is_wordpoints_module_active($module)) {
754 754
 			continue;
755 755
 		}
756 756
 
757
-		$network_deactivating = ( false !== $network_wide && is_wordpoints_module_active_for_network( $module ) );
757
+		$network_deactivating = (false !== $network_wide && is_wordpoints_module_active_for_network($module));
758 758
 
759
-		if ( ! $silent ) {
759
+		if ( ! $silent) {
760 760
 			/**
761 761
 			 * Fires for each module being deactivated in wordpoints_deactivate_modules(), before deactivation
762 762
 			 * and when the $silent parameter is false.
@@ -767,34 +767,34 @@  discard block
 block discarded – undo
767 767
 			 * @param bool   $network_deactivating Whether the module is deactivated for all sites in the network
768 768
 			 *                                     or just the current site. Multisite only. Default is false.
769 769
 			 */
770
-			do_action( 'wordpoints_deactivate_module', $module, $network_deactivating );
770
+			do_action('wordpoints_deactivate_module', $module, $network_deactivating);
771 771
 		}
772 772
 
773
-		if ( false !== $network_wide ) {
773
+		if (false !== $network_wide) {
774 774
 
775
-			if ( is_wordpoints_module_active_for_network( $module ) ) {
775
+			if (is_wordpoints_module_active_for_network($module)) {
776 776
 
777 777
 				$do_network = true;
778
-				unset( $network_current[ $module ] );
778
+				unset($network_current[$module]);
779 779
 
780
-			} elseif ( $network_wide ) {
780
+			} elseif ($network_wide) {
781 781
 
782 782
 				continue;
783 783
 			}
784 784
 		}
785 785
 
786
-		if ( true !== $network_wide ) {
786
+		if (true !== $network_wide) {
787 787
 
788
-			$key = array_search( $module, $current );
788
+			$key = array_search($module, $current);
789 789
 
790
-			if ( false !== $key ) {
790
+			if (false !== $key) {
791 791
 
792 792
 				$do_blog = true;
793
-				unset( $current[ $key ] );
793
+				unset($current[$key]);
794 794
 			}
795 795
 		}
796 796
 
797
-		if ( ! $silent ) {
797
+		if ( ! $silent) {
798 798
 			/**
799 799
 			 * Fires for each module being deactivated in wordpoints_deactivate_module(), after deactivation
800 800
 			 * and when the $silent parameter is false.
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 			 * @param bool $network_deactivating Whether the module is deactivated for all sites in the network
808 808
 			 *                                   or just the current site. Multisite only. Default is false.
809 809
 			 */
810
-			do_action( 'wordpoints_deactivate_module-' . $module, $network_deactivating );
810
+			do_action('wordpoints_deactivate_module-' . $module, $network_deactivating);
811 811
 
812 812
 			/**
813 813
 			 * Fires for each module being deactivated in deactivate_plugins(), after deactivation
@@ -819,17 +819,17 @@  discard block
 block discarded – undo
819 819
 			 * @param bool   $network_deactivating Whether the module is deactivated for all sites in the network
820 820
 			 *                                     or just the current site. Multisite only. Default is false.
821 821
 			 */
822
-			do_action( 'wordpoints_deactivated_module', $module, $network_deactivating );
822
+			do_action('wordpoints_deactivated_module', $module, $network_deactivating);
823 823
 		}
824 824
 
825 825
 	} // End foreach ( $modules ).
826 826
 
827
-	if ( $do_blog ) {
828
-		update_option( 'wordpoints_active_modules', $current );
827
+	if ($do_blog) {
828
+		update_option('wordpoints_active_modules', $current);
829 829
 	}
830 830
 
831
-	if ( $do_network ) {
832
-		update_site_option( 'wordpoints_sitewide_active_modules', $network_current );
831
+	if ($do_network) {
832
+		update_site_option('wordpoints_sitewide_active_modules', $network_current);
833 833
 	}
834 834
 }
835 835
 
@@ -846,31 +846,31 @@  discard block
 block discarded – undo
846 846
  * @return bool|WP_Error True if all modules deleted successfully, false or WP_Error
847 847
  *                       on failure.
848 848
  */
849
-function wordpoints_delete_modules( $modules ) {
849
+function wordpoints_delete_modules($modules) {
850 850
 
851 851
 	global $wp_filesystem;
852 852
 
853
-	if ( empty( $modules ) ) {
853
+	if (empty($modules)) {
854 854
 		return false;
855 855
 	}
856 856
 
857 857
 	$checked = array();
858 858
 
859
-	foreach ( $modules as $module ) {
859
+	foreach ($modules as $module) {
860 860
 		$checked[] = 'checked[]=' . $module;
861 861
 	}
862 862
 
863 863
 	ob_start();
864 864
 
865
-	$url = wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&verify-delete=1&' . implode( '&', $checked ) ), 'bulk-modules' );
865
+	$url = wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=delete-selected&verify-delete=1&' . implode('&', $checked)), 'bulk-modules');
866 866
 
867
-	$credentials = request_filesystem_credentials( $url );
867
+	$credentials = request_filesystem_credentials($url);
868 868
 
869
-	if ( false === $credentials ) {
869
+	if (false === $credentials) {
870 870
 
871 871
 		$data = ob_get_clean();
872 872
 
873
-		if ( ! empty( $data ) ) {
873
+		if ( ! empty($data)) {
874 874
 
875 875
 			include_once ABSPATH . 'wp-admin/admin-header.php';
876 876
 			echo $data; // XSS OK here, WPCS.
@@ -881,14 +881,14 @@  discard block
 block discarded – undo
881 881
 		return false;
882 882
 	}
883 883
 
884
-	if ( ! WP_Filesystem( $credentials ) ) {
884
+	if ( ! WP_Filesystem($credentials)) {
885 885
 
886 886
 		// Failed to connect, Error and request again
887
-		request_filesystem_credentials( $url, '', true );
887
+		request_filesystem_credentials($url, '', true);
888 888
 
889 889
 		$data = ob_get_clean();
890 890
 
891
-		if ( ! empty( $data ) ) {
891
+		if ( ! empty($data)) {
892 892
 
893 893
 			include_once ABSPATH . 'wp-admin/admin-header.php';
894 894
 			echo $data; // XSS OK here too, WPCS.
@@ -899,41 +899,41 @@  discard block
 block discarded – undo
899 899
 		return false;
900 900
 	}
901 901
 
902
-	if ( ! is_object( $wp_filesystem ) ) {
903
-		return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.', 'wordpoints' ) );
902
+	if ( ! is_object($wp_filesystem)) {
903
+		return new WP_Error('fs_unavailable', __('Could not access filesystem.', 'wordpoints'));
904 904
 	}
905 905
 
906
-	if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
907
-		return new WP_Error( 'fs_error', __( 'Filesystem error.', 'wordpoints' ), $wp_filesystem->errors );
906
+	if (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
907
+		return new WP_Error('fs_error', __('Filesystem error.', 'wordpoints'), $wp_filesystem->errors);
908 908
 	}
909 909
 
910 910
 	// Get the base module folder.
911
-	$modules_dir = $wp_filesystem->find_folder( wordpoints_modules_dir() );
911
+	$modules_dir = $wp_filesystem->find_folder(wordpoints_modules_dir());
912 912
 
913
-	if ( empty( $modules_dir ) ) {
914
-		return new WP_Error( 'fs_no_modules_dir', __( 'Unable to locate WordPoints Module directory.', 'wordpoints' ) );
913
+	if (empty($modules_dir)) {
914
+		return new WP_Error('fs_no_modules_dir', __('Unable to locate WordPoints Module directory.', 'wordpoints'));
915 915
 	}
916 916
 
917
-	$modules_dir = trailingslashit( $modules_dir );
917
+	$modules_dir = trailingslashit($modules_dir);
918 918
 	$errors = array();
919 919
 
920
-	foreach ( $modules as $module_file ) {
920
+	foreach ($modules as $module_file) {
921 921
 
922 922
 		// Run uninstall hook.
923
-		if ( is_uninstallable_wordpoints_module( $module_file ) ) {
924
-			wordpoints_uninstall_module( $module_file );
923
+		if (is_uninstallable_wordpoints_module($module_file)) {
924
+			wordpoints_uninstall_module($module_file);
925 925
 		}
926 926
 
927
-		$this_module_dir = trailingslashit( dirname( $modules_dir . $module_file ) );
927
+		$this_module_dir = trailingslashit(dirname($modules_dir . $module_file));
928 928
 
929 929
 		// If module is in its own directory, recursively delete the directory.
930
-		if ( strpos( $module_file, '/' ) && $this_module_dir !== $modules_dir ) {
931
-			$deleted = $wp_filesystem->delete( $this_module_dir, true );
930
+		if (strpos($module_file, '/') && $this_module_dir !== $modules_dir) {
931
+			$deleted = $wp_filesystem->delete($this_module_dir, true);
932 932
 		} else {
933
-			$deleted = $wp_filesystem->delete( $modules_dir . $module_file );
933
+			$deleted = $wp_filesystem->delete($modules_dir . $module_file);
934 934
 		}
935 935
 
936
-		if ( ! $deleted ) {
936
+		if ( ! $deleted) {
937 937
 			$errors[] = $module_file;
938 938
 		}
939 939
 	}
@@ -950,9 +950,9 @@  discard block
 block discarded – undo
950 950
 	 * @param array $modules The modules that were to be deleted.
951 951
 	 * @param array $errors  The modules that failed to delete.
952 952
 	 */
953
-	do_action( 'wordpoints_deleted_modules', $modules, $errors );
953
+	do_action('wordpoints_deleted_modules', $modules, $errors);
954 954
 
955
-	if ( ! empty( $errors ) ) {
955
+	if ( ! empty($errors)) {
956 956
 		return new WP_Error(
957 957
 			'could_not_remove_module'
958 958
 			, sprintf(
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
 				_n(
961 961
 					'Could not fully remove the module %s.'
962 962
 					, 'Could not fully remove the modules %s.'
963
-					, count( $errors )
963
+					, count($errors)
964 964
 					, 'wordpoints'
965 965
 				)
966
-				, implode( ', ', $errors )
966
+				, implode(', ', $errors)
967 967
 			)
968 968
 		);
969 969
 	}
@@ -982,16 +982,16 @@  discard block
 block discarded – undo
982 982
  *
983 983
  * @return bool Whether the module had an uninstall process.
984 984
  */
985
-function wordpoints_uninstall_module( $module ) {
985
+function wordpoints_uninstall_module($module) {
986 986
 
987
-	$file              = wordpoints_module_basename( $module );
988
-	$module_dir        = wordpoints_modules_dir() . '/' . dirname( $file );
987
+	$file              = wordpoints_module_basename($module);
988
+	$module_dir        = wordpoints_modules_dir() . '/' . dirname($file);
989 989
 	$uninstall_file    = $module_dir . '/uninstall.php';
990 990
 	$un_installer_file = $module_dir . '/includes/class-un-installer.php';
991 991
 
992
-	if ( file_exists( $uninstall_file ) ) {
992
+	if (file_exists($uninstall_file)) {
993 993
 
994
-		if ( ! defined( 'WORDPOINTS_UNINSTALL_MODULE' ) ) {
994
+		if ( ! defined('WORDPOINTS_UNINSTALL_MODULE')) {
995 995
 			/**
996 996
 			 * Uninstalling a module.
997 997
 			 *
@@ -1005,17 +1005,17 @@  discard block
 block discarded – undo
1005 1005
 			 *
1006 1006
 			 * @const WORDPOINTS_UNINSTALL_MODULE
1007 1007
 			 */
1008
-			define( 'WORDPOINTS_UNINSTALL_MODULE', true );
1008
+			define('WORDPOINTS_UNINSTALL_MODULE', true);
1009 1009
 		}
1010 1010
 
1011
-		WordPoints_Module_Paths::register( $uninstall_file );
1011
+		WordPoints_Module_Paths::register($uninstall_file);
1012 1012
 		include $uninstall_file;
1013 1013
 
1014 1014
 		return true;
1015 1015
 
1016
-	} elseif ( file_exists( $un_installer_file ) ) {
1016
+	} elseif (file_exists($un_installer_file)) {
1017 1017
 
1018
-		$slug = WordPoints_Modules::get_slug( $module );
1018
+		$slug = WordPoints_Modules::get_slug($module);
1019 1019
 
1020 1020
 		WordPoints_Installables::register(
1021 1021
 			'module'
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			)
1028 1028
 		);
1029 1029
 
1030
-		return WordPoints_Installables::uninstall( 'module', $slug );
1030
+		return WordPoints_Installables::uninstall('module', $slug);
1031 1031
 
1032 1032
 	} else {
1033 1033
 
@@ -1053,34 +1053,34 @@  discard block
 block discarded – undo
1053 1053
  */
1054 1054
 function wordpoints_load_modules() {
1055 1055
 
1056
-	$active_modules = wordpoints_get_array_option( 'wordpoints_active_modules' );
1056
+	$active_modules = wordpoints_get_array_option('wordpoints_active_modules');
1057 1057
 
1058
-	if ( is_wordpoints_network_active() ) {
1058
+	if (is_wordpoints_network_active()) {
1059 1059
 
1060 1060
 		$network_active_modules = array_keys(
1061
-			wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' )
1061
+			wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site')
1062 1062
 		);
1063 1063
 
1064 1064
 		// On the network admin screens we only load the network active modules.
1065
-		if ( is_network_admin() ) {
1065
+		if (is_network_admin()) {
1066 1066
 			$active_modules = $network_active_modules;
1067 1067
 		} else {
1068
-			$active_modules = array_merge( $active_modules, $network_active_modules );
1068
+			$active_modules = array_merge($active_modules, $network_active_modules);
1069 1069
 		}
1070 1070
 	}
1071 1071
 
1072
-	if ( ! empty( $active_modules ) ) {
1072
+	if ( ! empty($active_modules)) {
1073 1073
 
1074 1074
 		$modules_dir = wordpoints_modules_dir();
1075 1075
 
1076
-		foreach ( $active_modules as $module ) {
1076
+		foreach ($active_modules as $module) {
1077 1077
 
1078 1078
 			if (
1079
-				0 === validate_file( $module )
1080
-				&& '.php' === substr( $module, -4 )
1081
-				&& file_exists( $modules_dir . '/' . $module )
1079
+				0 === validate_file($module)
1080
+				&& '.php' === substr($module, -4)
1081
+				&& file_exists($modules_dir . '/' . $module)
1082 1082
 			) {
1083
-				WordPoints_Module_Paths::register( $modules_dir . '/' . $module );
1083
+				WordPoints_Module_Paths::register($modules_dir . '/' . $module);
1084 1084
 				include $modules_dir . '/' . $module;
1085 1085
 			}
1086 1086
 		}
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 	 *
1094 1094
 	 * @since 1.0.0
1095 1095
 	 */
1096
-	do_action( 'wordpoints_modules_loaded' );
1096
+	do_action('wordpoints_modules_loaded');
1097 1097
 }
1098 1098
 
1099 1099
 /**
@@ -1104,11 +1104,11 @@  discard block
 block discarded – undo
1104 1104
  * @param string $file     The main file of the module the hook is for.
1105 1105
  * @param string $function The callback function.
1106 1106
  */
1107
-function wordpoints_register_module_activation_hook( $file, $function ) {
1107
+function wordpoints_register_module_activation_hook($file, $function) {
1108 1108
 
1109
-	$module_file = wordpoints_module_basename( $file );
1109
+	$module_file = wordpoints_module_basename($file);
1110 1110
 
1111
-	add_action( "wordpoints_module_activate-{$module_file}", $function );
1111
+	add_action("wordpoints_module_activate-{$module_file}", $function);
1112 1112
 }
1113 1113
 
1114 1114
 /**
@@ -1119,11 +1119,11 @@  discard block
 block discarded – undo
1119 1119
  * @param string $file     The main file of the module the hook is for.
1120 1120
  * @param string $function The callback function.
1121 1121
  */
1122
-function wordpoints_register_module_deactivation_hook( $file, $function ) {
1122
+function wordpoints_register_module_deactivation_hook($file, $function) {
1123 1123
 
1124
-	$module_file = wordpoints_module_basename( $file );
1124
+	$module_file = wordpoints_module_basename($file);
1125 1125
 
1126
-	add_action( "wordpoints_deactivate_module-{$module_file}", $function );
1126
+	add_action("wordpoints_deactivate_module-{$module_file}", $function);
1127 1127
 }
1128 1128
 
1129 1129
 // EOF
Please login to merge, or discard this patch.
src/classes/module/paths.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -64,30 +64,30 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool Whether the path was able to be registered.
66 66
 	 */
67
-	public static function register( $file ) {
67
+	public static function register($file) {
68 68
 
69
-		$file = wp_normalize_path( $file );
69
+		$file = wp_normalize_path($file);
70 70
 
71 71
 		// We store this so that we don't have to keep normalizing a constant value.
72
-		if ( ! isset( self::$modules_dir ) ) {
73
-			self::$modules_dir = wp_normalize_path( wordpoints_modules_dir() );
72
+		if ( ! isset(self::$modules_dir)) {
73
+			self::$modules_dir = wp_normalize_path(wordpoints_modules_dir());
74 74
 		}
75 75
 
76
-		$module_path = wp_normalize_path( dirname( $file ) );
76
+		$module_path = wp_normalize_path(dirname($file));
77 77
 
78 78
 		// It was a single-file module.
79
-		if ( $module_path . '/' === self::$modules_dir ) {
79
+		if ($module_path . '/' === self::$modules_dir) {
80 80
 			return false;
81 81
 		}
82 82
 
83
-		$module_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
83
+		$module_realpath = wp_normalize_path(dirname(realpath($file)));
84 84
 
85
-		if ( $module_path !== $module_realpath ) {
85
+		if ($module_path !== $module_realpath) {
86 86
 
87
-			$realpath_length = strlen( $module_realpath );
87
+			$realpath_length = strlen($module_realpath);
88 88
 
89 89
 			// Use unique keys, but still easy to sort by realpath length.
90
-			self::$paths[ $realpath_length . '-' . $module_path ] = array(
90
+			self::$paths[$realpath_length . '-' . $module_path] = array(
91 91
 				'module_path'     => $module_path,
92 92
 				'module_realpath' => $module_realpath,
93 93
 				'realpath_length' => $realpath_length,
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return string The path to the symlink in the modules directory.
110 110
 	 */
111
-	public static function resolve( $file ) {
111
+	public static function resolve($file) {
112 112
 
113
-		$file = wp_normalize_path( $file );
113
+		$file = wp_normalize_path($file);
114 114
 
115 115
 		// Sort the paths by the realpath length, see https://core.trac.wordpress.org/ticket/28441.
116
-		if ( ! self::$paths_sorted ) {
117
-			krsort( self::$paths );
116
+		if ( ! self::$paths_sorted) {
117
+			krsort(self::$paths);
118 118
 			self::$paths_sorted = true;
119 119
 		}
120 120
 
121
-		foreach ( self::$paths as $path ) {
122
-			if ( 0 === strpos( $file, $path['module_realpath'] ) ) {
123
-				$file = $path['module_path'] . substr( $file, $path['realpath_length'] );
121
+		foreach (self::$paths as $path) {
122
+			if (0 === strpos($file, $path['module_realpath'])) {
123
+				$file = $path['module_path'] . substr($file, $path['realpath_length']);
124 124
 			}
125 125
 		}
126 126
 
Please login to merge, or discard this patch.
src/classes/shortcodes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	 * @param string $shortcode The shortcode to register a handler class for.
46 46
 	 * @param string $class     The handler class for this shortcode.
47 47
 	 */
48
-	public static function register( $shortcode, $class ) {
48
+	public static function register($shortcode, $class) {
49 49
 
50
-		self::$shortcodes[ $shortcode ] = $class;
50
+		self::$shortcodes[$shortcode] = $class;
51 51
 
52
-		add_shortcode( $shortcode, array( __CLASS__, 'do_shortcode' ) );
52
+		add_shortcode($shortcode, array(__CLASS__, 'do_shortcode'));
53 53
 	}
54 54
 
55 55
 	/**
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	 *                                          or a handler, or false if $shortcode
72 72
 	 *                                          is invalid.
73 73
 	 */
74
-	public static function get( $shortcode = null, $atts = null, $content = null ) {
74
+	public static function get($shortcode = null, $atts = null, $content = null) {
75 75
 
76
-		if ( isset( $shortcode ) ) {
76
+		if (isset($shortcode)) {
77 77
 
78
-			if ( isset( self::$shortcodes[ $shortcode ] ) ) {
79
-				return new self::$shortcodes[ $shortcode ]( $atts, $content, $shortcode );
78
+			if (isset(self::$shortcodes[$shortcode])) {
79
+				return new self::$shortcodes[$shortcode]($atts, $content, $shortcode);
80 80
 			} else {
81 81
 				return false;
82 82
 			}
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return string The content generated for this shortcode.
105 105
 	 */
106
-	public static function do_shortcode( $atts, $content, $shortcode ) {
106
+	public static function do_shortcode($atts, $content, $shortcode) {
107 107
 
108
-		if ( ! isset( self::$shortcodes[ $shortcode ] ) ) {
108
+		if ( ! isset(self::$shortcodes[$shortcode])) {
109 109
 			return wordpoints_shortcode_error(
110 110
 				sprintf(
111 111
 					// translators: Shortcode name.
112
-					esc_html__( 'The %s shortcode was not registered properly.', 'wordpoints' )
113
-					, '<code>[' . esc_html( $shortcode ) . ']</code>'
112
+					esc_html__('The %s shortcode was not registered properly.', 'wordpoints')
113
+					, '<code>[' . esc_html($shortcode) . ']</code>'
114 114
 				)
115 115
 			);
116 116
 		}
117 117
 
118 118
 		/** @var WordPoints_Shortcode $shortcode */
119
-		$shortcode = new self::$shortcodes[ $shortcode ]( $atts, $content, $shortcode );
119
+		$shortcode = new self::$shortcodes[$shortcode]($atts, $content, $shortcode);
120 120
 		return $shortcode->expand();
121 121
 	}
122 122
 }
Please login to merge, or discard this patch.
src/classes/dropdown/builder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                                       option is an array or object.
75 75
 	 * }
76 76
 	 */
77
-	public function __construct( array $options, array $args ) {
77
+	public function __construct(array $options, array $args) {
78 78
 
79
-		$this->args = array_merge( $this->args, $args );
79
+		$this->args = array_merge($this->args, $args);
80 80
 
81 81
 		$this->options = $options;
82 82
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function start() {
102 102
 
103
-		echo '<select id="', esc_attr( $this->args['id'] ), '" name="', esc_attr( $this->args['name'] ), '" class="', esc_attr( $this->args['class'] ), '">';
103
+		echo '<select id="', esc_attr($this->args['id']), '" name="', esc_attr($this->args['name']), '" class="', esc_attr($this->args['class']), '">';
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function options() {
112 112
 
113
-		if ( ! empty( $this->args['show_option_none'] ) ) {
113
+		if ( ! empty($this->args['show_option_none'])) {
114 114
 
115
-			echo '<option value="-1"', selected( '-1', $this->args['selected'], false ), '>', esc_html( $this->args['show_option_none'] ), '</option>';
115
+			echo '<option value="-1"', selected('-1', $this->args['selected'], false), '>', esc_html($this->args['show_option_none']), '</option>';
116 116
 		}
117 117
 
118
-		foreach ( $this->options as $value => $option ) {
118
+		foreach ($this->options as $value => $option) {
119 119
 
120
-			if ( isset( $this->args['values_key'], $this->args['options_key'] ) ) {
120
+			if (isset($this->args['values_key'], $this->args['options_key'])) {
121 121
 				$option = (array) $option;
122
-				$value = $option[ $this->args['values_key'] ];
123
-				$option = $option[ $this->args['options_key'] ];
122
+				$value = $option[$this->args['values_key']];
123
+				$option = $option[$this->args['options_key']];
124 124
 			}
125 125
 
126
-			echo '<option value="', esc_attr( $value ), '"', selected( $value, $this->args['selected'], false ), '>', esc_html( $option ), '</option>';
126
+			echo '<option value="', esc_attr($value), '"', selected($value, $this->args['selected'], false), '>', esc_html($option), '</option>';
127 127
 		}
128 128
 	}
129 129
 
Please login to merge, or discard this patch.
src/components/ranks/includes/filters.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
  * @since 2.1.0
8 8
  */
9 9
 
10
-add_action( 'wordpoints_modules_loaded', 'WordPoints_Rank_Types::init' );
10
+add_action('wordpoints_modules_loaded', 'WordPoints_Rank_Types::init');
11 11
 
12
-add_action( 'wordpoints_ranks_register', 'wordpoints_register_core_ranks' );
12
+add_action('wordpoints_ranks_register', 'wordpoints_register_core_ranks');
13 13
 
14
-WordPoints_Shortcodes::register( 'wordpoints_user_rank', 'WordPoints_Rank_Shortcode_User_Rank' );
14
+WordPoints_Shortcodes::register('wordpoints_user_rank', 'WordPoints_Rank_Shortcode_User_Rank');
15 15
 
16 16
 // EOF
Please login to merge, or discard this patch.
src/components/ranks/includes/shortcodes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @since 2.3.0
21 21
 	 */
22
-	public function __construct( $atts, $content, $shortcode = null ) {
22
+	public function __construct($atts, $content, $shortcode = null) {
23 23
 
24 24
 		_deprecated_function(
25 25
 			__METHOD__
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			, 'WordPoints_Rank_Shortcode_User_Rank::__construct'
28 28
 		);
29 29
 
30
-		parent::__construct( $atts, $content, $shortcode );
30
+		parent::__construct($atts, $content, $shortcode);
31 31
 	}
32 32
 }
33 33
 
Please login to merge, or discard this patch.