Completed
Push — master ( 1d71fa...5b2818 )
by J.D.
03:48
created
src/includes/classes/index.php 1 patch
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -10,129 +10,129 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // auto-generated {
13
-$dir = dirname( __FILE__ );
14
-require_once( $dir . '/specedi.php' );
15
-require_once( $dir . '/hook/ui/script/data/provideri.php' );
16
-require_once( $dir . '/hook/settingsi.php' );
17
-require_once( $dir . '/hook/retroactive/queryi.php' );
18
-require_once( $dir . '/hook/retroactive/query/modifieri.php' );
19
-require_once( $dir . '/hook/reactori.php' );
20
-require_once( $dir . '/hook/reactioni.php' );
21
-require_once( $dir . '/hook/reaction/storei.php' );
22
-require_once( $dir . '/hook/extensioni.php' );
23
-require_once( $dir . '/hook/extension/miss/listeneri.php' );
24
-require_once( $dir . '/hook/extension/hit/listeneri.php' );
25
-require_once( $dir . '/hook/eventi.php' );
26
-require_once( $dir . '/hook/event/reversingi.php' );
27
-require_once( $dir . '/hook/conditioni.php' );
28
-require_once( $dir . '/hook/argi.php' );
29
-require_once( $dir . '/hook/actioni.php' );
30
-require_once( $dir . '/entityishi.php' );
31
-require_once( $dir . '/entityish/storedi.php' );
32
-require_once( $dir . '/entity/restricted/visibilityi.php' );
33
-require_once( $dir . '/entity/parenti.php' );
34
-require_once( $dir . '/entity/hierarchyi.php' );
35
-require_once( $dir . '/entity/enumerablei.php' );
36
-require_once( $dir . '/entity/childi.php' );
37
-require_once( $dir . '/data/typei.php' );
38
-require_once( $dir . '/class/registryi.php' );
39
-require_once( $dir . '/class/registry/childreni.php' );
40
-require_once( $dir . '/app.php' );
41
-require_once( $dir . '/app/registry.php' );
42
-require_once( $dir . '/class/autoloader.php' );
43
-require_once( $dir . '/class/registry.php' );
44
-require_once( $dir . '/class/registry/children.php' );
45
-require_once( $dir . '/class/registry/persistent.php' );
46
-require_once( $dir . '/data/type.php' );
47
-require_once( $dir . '/data/type/integer.php' );
48
-require_once( $dir . '/data/type/text.php' );
49
-require_once( $dir . '/db/query.php' );
50
-require_once( $dir . '/entityish.php' );
51
-require_once( $dir . '/entity.php' );
52
-require_once( $dir . '/entity/relationship.php' );
53
-require_once( $dir . '/entity/relationship/dynamic.php' );
54
-require_once( $dir . '/entity/relationship/stored/field.php' );
55
-require_once( $dir . '/entity/stored/array.php' );
56
-require_once( $dir . '/entity/stored/db/table.php' );
57
-require_once( $dir . '/entity/array.php' );
58
-require_once( $dir . '/entity/attr.php' );
59
-require_once( $dir . '/entity/attr/field.php' );
60
-require_once( $dir . '/entity/change.php' );
61
-require_once( $dir . '/entity/comment.php' );
62
-require_once( $dir . '/entity/comment/author.php' );
63
-require_once( $dir . '/entity/comment/post.php' );
64
-require_once( $dir . '/entity/context.php' );
65
-require_once( $dir . '/entity/context/network.php' );
66
-require_once( $dir . '/entity/context/site.php' );
67
-require_once( $dir . '/entity/hierarchy.php' );
68
-require_once( $dir . '/entity/post.php' );
69
-require_once( $dir . '/entity/post/author.php' );
70
-require_once( $dir . '/entity/post/content.php' );
71
-require_once( $dir . '/entity/post/terms.php' );
72
-require_once( $dir . '/entity/post/type.php' );
73
-require_once( $dir . '/entity/post/type/name.php' );
74
-require_once( $dir . '/entity/post/type/relationship.php' );
75
-require_once( $dir . '/entity/site.php' );
76
-require_once( $dir . '/entity/term.php' );
77
-require_once( $dir . '/entity/term/id.php' );
78
-require_once( $dir . '/entity/user.php' );
79
-require_once( $dir . '/entity/user/role.php' );
80
-require_once( $dir . '/entity/user/role/name.php' );
81
-require_once( $dir . '/entity/user/roles.php' );
82
-require_once( $dir . '/hierarchy.php' );
83
-require_once( $dir . '/hook/action.php' );
84
-require_once( $dir . '/hook/action/comment/new.php' );
85
-require_once( $dir . '/hook/action/post/depublish/delete.php' );
86
-require_once( $dir . '/hook/action/post/type.php' );
87
-require_once( $dir . '/hook/action/post/type/comment.php' );
88
-require_once( $dir . '/hook/actions.php' );
89
-require_once( $dir . '/hook/arg.php' );
90
-require_once( $dir . '/hook/arg/current/post.php' );
91
-require_once( $dir . '/hook/arg/current/site.php' );
92
-require_once( $dir . '/hook/arg/current/user.php' );
93
-require_once( $dir . '/hook/condition.php' );
94
-require_once( $dir . '/hook/condition/entity/array/contains.php' );
95
-require_once( $dir . '/hook/condition/equals.php' );
96
-require_once( $dir . '/hook/condition/string/contains.php' );
97
-require_once( $dir . '/hook/event.php' );
98
-require_once( $dir . '/hook/event/dynamic.php' );
99
-require_once( $dir . '/hook/event/args.php' );
100
-require_once( $dir . '/hook/event/comment/leave.php' );
101
-require_once( $dir . '/hook/event/media/upload.php' );
102
-require_once( $dir . '/hook/event/post/publish.php' );
103
-require_once( $dir . '/hook/event/user/register.php' );
104
-require_once( $dir . '/hook/event/user/visit.php' );
105
-require_once( $dir . '/hook/events.php' );
106
-require_once( $dir . '/hook/extension.php' );
107
-require_once( $dir . '/hook/extension/blocker.php' );
108
-require_once( $dir . '/hook/extension/conditions.php' );
109
-require_once( $dir . '/hook/extension/periods.php' );
110
-require_once( $dir . '/hook/extension/repeat/blocker.php' );
111
-require_once( $dir . '/hook/extension/reversals.php' );
112
-require_once( $dir . '/hook/extension/reversals/legacy/points.php' );
113
-require_once( $dir . '/hook/fire.php' );
114
-require_once( $dir . '/hook/hit/logger.php' );
115
-require_once( $dir . '/hook/hit/query.php' );
116
-require_once( $dir . '/hook/reaction.php' );
117
-require_once( $dir . '/hook/reaction/options.php' );
118
-require_once( $dir . '/hook/reaction/store.php' );
119
-require_once( $dir . '/hook/reaction/store/options.php' );
120
-require_once( $dir . '/hook/reaction/store/options/network.php' );
121
-require_once( $dir . '/hook/reaction/validator.php' );
122
-require_once( $dir . '/hook/reactor.php' );
123
-require_once( $dir . '/hook/reactor/points.php' );
124
-require_once( $dir . '/hook/reactor/points/legacy.php' );
125
-require_once( $dir . '/hook/retroactive/conditions.php' );
126
-require_once( $dir . '/hook/retroactive/query.php' );
127
-require_once( $dir . '/hook/retroactive/queryable.php' );
128
-require_once( $dir . '/hook/router.php' );
129
-require_once( $dir . '/hook/settings.php' );
130
-require_once( $dir . '/hook/validator/exception.php' );
131
-require_once( $dir . '/hooks.php' );
132
-require_once( $dir . '/legacy/points/hook/to/reaction/importer.php' );
133
-require_once( $dir . '/query/builder/db/mysql.php' );
134
-require_once( $dir . '/spec.php' );
135
-require_once( $dir . '/wpdb/wrapper.php' );
13
+$dir = dirname(__FILE__);
14
+require_once($dir.'/specedi.php');
15
+require_once($dir.'/hook/ui/script/data/provideri.php');
16
+require_once($dir.'/hook/settingsi.php');
17
+require_once($dir.'/hook/retroactive/queryi.php');
18
+require_once($dir.'/hook/retroactive/query/modifieri.php');
19
+require_once($dir.'/hook/reactori.php');
20
+require_once($dir.'/hook/reactioni.php');
21
+require_once($dir.'/hook/reaction/storei.php');
22
+require_once($dir.'/hook/extensioni.php');
23
+require_once($dir.'/hook/extension/miss/listeneri.php');
24
+require_once($dir.'/hook/extension/hit/listeneri.php');
25
+require_once($dir.'/hook/eventi.php');
26
+require_once($dir.'/hook/event/reversingi.php');
27
+require_once($dir.'/hook/conditioni.php');
28
+require_once($dir.'/hook/argi.php');
29
+require_once($dir.'/hook/actioni.php');
30
+require_once($dir.'/entityishi.php');
31
+require_once($dir.'/entityish/storedi.php');
32
+require_once($dir.'/entity/restricted/visibilityi.php');
33
+require_once($dir.'/entity/parenti.php');
34
+require_once($dir.'/entity/hierarchyi.php');
35
+require_once($dir.'/entity/enumerablei.php');
36
+require_once($dir.'/entity/childi.php');
37
+require_once($dir.'/data/typei.php');
38
+require_once($dir.'/class/registryi.php');
39
+require_once($dir.'/class/registry/childreni.php');
40
+require_once($dir.'/app.php');
41
+require_once($dir.'/app/registry.php');
42
+require_once($dir.'/class/autoloader.php');
43
+require_once($dir.'/class/registry.php');
44
+require_once($dir.'/class/registry/children.php');
45
+require_once($dir.'/class/registry/persistent.php');
46
+require_once($dir.'/data/type.php');
47
+require_once($dir.'/data/type/integer.php');
48
+require_once($dir.'/data/type/text.php');
49
+require_once($dir.'/db/query.php');
50
+require_once($dir.'/entityish.php');
51
+require_once($dir.'/entity.php');
52
+require_once($dir.'/entity/relationship.php');
53
+require_once($dir.'/entity/relationship/dynamic.php');
54
+require_once($dir.'/entity/relationship/stored/field.php');
55
+require_once($dir.'/entity/stored/array.php');
56
+require_once($dir.'/entity/stored/db/table.php');
57
+require_once($dir.'/entity/array.php');
58
+require_once($dir.'/entity/attr.php');
59
+require_once($dir.'/entity/attr/field.php');
60
+require_once($dir.'/entity/change.php');
61
+require_once($dir.'/entity/comment.php');
62
+require_once($dir.'/entity/comment/author.php');
63
+require_once($dir.'/entity/comment/post.php');
64
+require_once($dir.'/entity/context.php');
65
+require_once($dir.'/entity/context/network.php');
66
+require_once($dir.'/entity/context/site.php');
67
+require_once($dir.'/entity/hierarchy.php');
68
+require_once($dir.'/entity/post.php');
69
+require_once($dir.'/entity/post/author.php');
70
+require_once($dir.'/entity/post/content.php');
71
+require_once($dir.'/entity/post/terms.php');
72
+require_once($dir.'/entity/post/type.php');
73
+require_once($dir.'/entity/post/type/name.php');
74
+require_once($dir.'/entity/post/type/relationship.php');
75
+require_once($dir.'/entity/site.php');
76
+require_once($dir.'/entity/term.php');
77
+require_once($dir.'/entity/term/id.php');
78
+require_once($dir.'/entity/user.php');
79
+require_once($dir.'/entity/user/role.php');
80
+require_once($dir.'/entity/user/role/name.php');
81
+require_once($dir.'/entity/user/roles.php');
82
+require_once($dir.'/hierarchy.php');
83
+require_once($dir.'/hook/action.php');
84
+require_once($dir.'/hook/action/comment/new.php');
85
+require_once($dir.'/hook/action/post/depublish/delete.php');
86
+require_once($dir.'/hook/action/post/type.php');
87
+require_once($dir.'/hook/action/post/type/comment.php');
88
+require_once($dir.'/hook/actions.php');
89
+require_once($dir.'/hook/arg.php');
90
+require_once($dir.'/hook/arg/current/post.php');
91
+require_once($dir.'/hook/arg/current/site.php');
92
+require_once($dir.'/hook/arg/current/user.php');
93
+require_once($dir.'/hook/condition.php');
94
+require_once($dir.'/hook/condition/entity/array/contains.php');
95
+require_once($dir.'/hook/condition/equals.php');
96
+require_once($dir.'/hook/condition/string/contains.php');
97
+require_once($dir.'/hook/event.php');
98
+require_once($dir.'/hook/event/dynamic.php');
99
+require_once($dir.'/hook/event/args.php');
100
+require_once($dir.'/hook/event/comment/leave.php');
101
+require_once($dir.'/hook/event/media/upload.php');
102
+require_once($dir.'/hook/event/post/publish.php');
103
+require_once($dir.'/hook/event/user/register.php');
104
+require_once($dir.'/hook/event/user/visit.php');
105
+require_once($dir.'/hook/events.php');
106
+require_once($dir.'/hook/extension.php');
107
+require_once($dir.'/hook/extension/blocker.php');
108
+require_once($dir.'/hook/extension/conditions.php');
109
+require_once($dir.'/hook/extension/periods.php');
110
+require_once($dir.'/hook/extension/repeat/blocker.php');
111
+require_once($dir.'/hook/extension/reversals.php');
112
+require_once($dir.'/hook/extension/reversals/legacy/points.php');
113
+require_once($dir.'/hook/fire.php');
114
+require_once($dir.'/hook/hit/logger.php');
115
+require_once($dir.'/hook/hit/query.php');
116
+require_once($dir.'/hook/reaction.php');
117
+require_once($dir.'/hook/reaction/options.php');
118
+require_once($dir.'/hook/reaction/store.php');
119
+require_once($dir.'/hook/reaction/store/options.php');
120
+require_once($dir.'/hook/reaction/store/options/network.php');
121
+require_once($dir.'/hook/reaction/validator.php');
122
+require_once($dir.'/hook/reactor.php');
123
+require_once($dir.'/hook/reactor/points.php');
124
+require_once($dir.'/hook/reactor/points/legacy.php');
125
+require_once($dir.'/hook/retroactive/conditions.php');
126
+require_once($dir.'/hook/retroactive/query.php');
127
+require_once($dir.'/hook/retroactive/queryable.php');
128
+require_once($dir.'/hook/router.php');
129
+require_once($dir.'/hook/settings.php');
130
+require_once($dir.'/hook/validator/exception.php');
131
+require_once($dir.'/hooks.php');
132
+require_once($dir.'/legacy/points/hook/to/reaction/importer.php');
133
+require_once($dir.'/query/builder/db/mysql.php');
134
+require_once($dir.'/spec.php');
135
+require_once($dir.'/wpdb/wrapper.php');
136 136
 // }
137 137
 
138 138
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/legacy/points/hook/to/reaction/importer.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -189,45 +189,45 @@  discard block
 block discarded – undo
189 189
 			$this->legacy_id_base
190 190
 		);
191 191
 
192
-		if ( ! $this->legacy_handler ) {
192
+		if ( ! $this->legacy_handler) {
193 193
 			return;
194 194
 		}
195 195
 
196
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
196
+		if (WordPoints_Points_Hooks::get_network_mode()) {
197 197
 			$this->hook_mode = 'network';
198 198
 		} else {
199 199
 			$this->hook_mode = 'standard';
200 200
 		}
201 201
 
202 202
 		$imported_option = 'wordpoints_imported_points_hooks';
203
-		$this->imported_hooks = $this->get_array_option( $imported_option );
203
+		$this->imported_hooks = $this->get_array_option($imported_option);
204 204
 
205 205
 		$this->points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
206 206
 
207
-		$this->reaction_store = wordpoints_hooks()->get_reaction_store( 'points' );
207
+		$this->reaction_store = wordpoints_hooks()->get_reaction_store('points');
208 208
 
209 209
 		$this->legacy_instances = $this->legacy_handler->get_instances(
210 210
 			$this->hook_mode
211 211
 		);
212 212
 
213
-		foreach ( $this->legacy_instances as $number => $legacy_instance ) {
214
-			$this->import_instance( $legacy_instance, $number );
213
+		foreach ($this->legacy_instances as $number => $legacy_instance) {
214
+			$this->import_instance($legacy_instance, $number);
215 215
 		}
216 216
 
217 217
 		// This means that all of the instances were imported successfully.
218
-		if ( empty( $this->legacy_instances ) ) {
218
+		if (empty($this->legacy_instances)) {
219 219
 
220 220
 			$option = 'wordpoints_legacy_points_hooks_disabled';
221 221
 
222
-			$disabled = $this->get_array_option( $option );
223
-			$disabled[ $this->legacy_id_base ] = true;
222
+			$disabled = $this->get_array_option($option);
223
+			$disabled[$this->legacy_id_base] = true;
224 224
 
225
-			$this->update_option( $option, $disabled );
225
+			$this->update_option($option, $disabled);
226 226
 		}
227 227
 
228
-		WordPoints_Points_Hooks::save_points_types_hooks( $this->points_types_hooks );
228
+		WordPoints_Points_Hooks::save_points_types_hooks($this->points_types_hooks);
229 229
 
230
-		$this->update_option( $imported_option, $this->imported_hooks );
230
+		$this->update_option($imported_option, $this->imported_hooks);
231 231
 	}
232 232
 
233 233
 	/**
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool Whether the instance was successfully converted to a reaction.
242 242
 	 */
243
-	protected function import_instance( $legacy_instance, $number ) {
243
+	protected function import_instance($legacy_instance, $number) {
244 244
 
245 245
 		$this->legacy_instance = $legacy_instance;
246 246
 
247
-		if ( ! $this->should_import_instance() ) {
247
+		if ( ! $this->should_import_instance()) {
248 248
 			return false;
249 249
 		}
250 250
 
251
-		$this->legacy_handler->set_number( $number );
251
+		$this->legacy_handler->set_number($number);
252 252
 
253 253
 		$points_type = $this->legacy_handler->points_type(
254 254
 			'network' === $this->hook_mode ? "network_{$number}" : $number
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		$order = array_search(
268 268
 			$this->legacy_handler->get_id()
269
-			, $this->points_types_hooks[ $points_type ]
269
+			, $this->points_types_hooks[$points_type]
270 270
 			, true
271 271
 		);
272 272
 
@@ -275,21 +275,21 @@  discard block
 block discarded – undo
275 275
 			$order
276 276
 		);
277 277
 
278
-		if ( ! isset( $reaction_settings['log_text'] ) ) {
278
+		if ( ! isset($reaction_settings['log_text'])) {
279 279
 			$reaction_settings['log_text'] = $this->get_log_text_for_instance(
280 280
 				$points_type
281 281
 			);
282 282
 		}
283 283
 
284
-		if ( ! $this->create_reaction( $reaction_settings, $order ) ) {
284
+		if ( ! $this->create_reaction($reaction_settings, $order)) {
285 285
 			return false;
286 286
 		}
287 287
 
288
-		$this->legacy_handler->delete_callback( $number );
288
+		$this->legacy_handler->delete_callback($number);
289 289
 
290 290
 		unset(
291
-			$this->points_types_hooks[ $points_type ][ $order ]
292
-			, $this->legacy_instances[ $number ]
291
+			$this->points_types_hooks[$points_type][$order]
292
+			, $this->legacy_instances[$number]
293 293
 		);
294 294
 
295 295
 		return true;
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 	protected function should_import_instance() {
306 306
 
307 307
 		// We ignore certain settings...
308
-		$ignored = array( '_description' => true );
308
+		$ignored = array('_description' => true);
309 309
 
310 310
 		// But if there are any other unexpected ones, we really can't safely import.
311
-		if ( array_diff_key( $this->legacy_instance, $this->expected_settings, $ignored ) ) {
311
+		if (array_diff_key($this->legacy_instance, $this->expected_settings, $ignored)) {
312 312
 			return false;
313 313
 		}
314 314
 
315 315
 		if (
316 316
 			$this->skip_non_reversing_hooks
317
-			&& isset( $this->legacy_instance['auto_reverse'] )
317
+			&& isset($this->legacy_instance['auto_reverse'])
318 318
 			&& ! $this->legacy_instance['auto_reverse']
319 319
 		) {
320 320
 			return false;
@@ -333,22 +333,22 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return string The log text derived from this instance.
335 335
 	 */
336
-	protected function get_log_text_for_instance( $points_type, $meta = array() ) {
336
+	protected function get_log_text_for_instance($points_type, $meta = array()) {
337 337
 
338
-		if ( ! method_exists( $this->legacy_handler, 'logs' ) ) {
339
-			return $this->legacy_handler->get_option( 'description' );
338
+		if ( ! method_exists($this->legacy_handler, 'logs')) {
339
+			return $this->legacy_handler->get_option('description');
340 340
 		}
341 341
 
342 342
 		if (
343
-			! isset( $meta['post_type'] )
344
-			&& isset( $this->legacy_instance['post_type'] )
343
+			! isset($meta['post_type'])
344
+			&& isset($this->legacy_instance['post_type'])
345 345
 		) {
346 346
 			$meta['post_type'] = $this->legacy_instance['post_type'];
347 347
 		}
348 348
 
349 349
 		if (
350
-			! isset( $meta['period'] )
351
-			&& isset( $this->legacy_instance['period'] )
350
+			! isset($meta['period'])
351
+			&& isset($this->legacy_instance['period'])
352 352
 		) {
353 353
 			$meta['period'] = $this->legacy_instance['period'];
354 354
 		}
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 	 *
376 376
 	 * @return array The modified settings.
377 377
 	 */
378
-	protected function filter_reaction_settings( $settings, $order ) {
378
+	protected function filter_reaction_settings($settings, $order) {
379 379
 
380
-		if ( 'wordpoints_periodic_points_hook' !== $this->legacy_id_base ) {
380
+		if ('wordpoints_periodic_points_hook' !== $this->legacy_id_base) {
381 381
 			// We do this even if reversals will be blocked, in case the blocking
382 382
 			// is ever removed for this reaction.
383 383
 			$settings['reversals_legacy_points'] = array(
@@ -386,23 +386,23 @@  discard block
 block discarded – undo
386 386
 		}
387 387
 
388 388
 		if (
389
-			isset( $this->legacy_instance['auto_reverse'] )
389
+			isset($this->legacy_instance['auto_reverse'])
390 390
 			&& ! $this->legacy_instance['auto_reverse']
391 391
 		) {
392 392
 			$settings['blocker']['toggle_off'] = true;
393 393
 		}
394 394
 
395
-		if ( isset( $this->legacy_instance['post_type'] ) ) {
395
+		if (isset($this->legacy_instance['post_type'])) {
396 396
 
397 397
 			$post_type = $this->legacy_instance['post_type'];
398 398
 
399
-			if ( 'ALL' === $post_type ) {
399
+			if ('ALL' === $post_type) {
400 400
 
401
-				$post_type_slugs = get_post_types( array( 'public' => true ) );
401
+				$post_type_slugs = get_post_types(array('public' => true));
402 402
 
403
-				$post_type = array_pop( $post_type_slugs );
403
+				$post_type = array_pop($post_type_slugs);
404 404
 
405
-				foreach ( $post_type_slugs as $post_type_slug ) {
405
+				foreach ($post_type_slugs as $post_type_slug) {
406 406
 
407 407
 					$this->create_reaction(
408 408
 						$this->format_settings_for_post_type(
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 * @return array The settings modified for this particular post type.
435 435
 	 */
436
-	protected function format_settings_for_post_type( $post_type, $settings ) {
436
+	protected function format_settings_for_post_type($post_type, $settings) {
437 437
 
438
-		if ( 'attachment' === $post_type ) {
438
+		if ('attachment' === $post_type) {
439 439
 
440 440
 			$settings['event'] = 'media_upload';
441 441
 
@@ -443,20 +443,20 @@  discard block
 block discarded – undo
443 443
 
444 444
 			$settings['event'] = str_replace(
445 445
 				'\post'
446
-				, '\\' . $post_type
446
+				, '\\'.$post_type
447 447
 				, $settings['event']
448 448
 			);
449 449
 		}
450 450
 
451 451
 		$settings['target'] = str_replace(
452 452
 			'\post'
453
-			, '\\' . $post_type
453
+			, '\\'.$post_type
454 454
 			, $settings['target']
455 455
 		);
456 456
 
457 457
 		$settings['log_text'] = $this->get_log_text_for_instance(
458 458
 			$settings['points_type']
459
-			, array( 'post_type' => $post_type )
459
+			, array('post_type' => $post_type)
460 460
 		);
461 461
 
462 462
 		return $settings;
@@ -472,11 +472,11 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false.
474 474
 	 */
475
-	protected function create_reaction( $settings, $order ) {
475
+	protected function create_reaction($settings, $order) {
476 476
 
477
-		$reaction = $this->reaction_store->create_reaction( $settings );
477
+		$reaction = $this->reaction_store->create_reaction($settings);
478 478
 
479
-		if ( ! $reaction instanceof WordPoints_Hook_ReactionI ) {
479
+		if ( ! $reaction instanceof WordPoints_Hook_ReactionI) {
480 480
 			return false;
481 481
 		}
482 482
 
@@ -501,12 +501,12 @@  discard block
 block discarded – undo
501 501
 	 *
502 502
 	 * @return bool Whether the option was updated successfully.
503 503
 	 */
504
-	protected function update_option( $option, $value ) {
504
+	protected function update_option($option, $value) {
505 505
 
506
-		if ( 'network' === $this->hook_mode ) {
507
-			return update_site_option( $option, $value );
506
+		if ('network' === $this->hook_mode) {
507
+			return update_site_option($option, $value);
508 508
 		} else {
509
-			return update_option( $option, $value );
509
+			return update_option($option, $value);
510 510
 		}
511 511
 	}
512 512
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 *
520 520
 	 * @return array The option value.
521 521
 	 */
522
-	protected function get_array_option( $option ) {
522
+	protected function get_array_option($option) {
523 523
 
524 524
 		return wordpoints_get_array_option(
525 525
 			$option
Please login to merge, or discard this patch.
src/includes/classes/hook/action/comment/new.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @since 1.0.0
20 20
 	 */
21
-	protected $post_hierarchy = array( 'comment\\post', 'post\\post', 'post\\post' );
21
+	protected $post_hierarchy = array('comment\\post', 'post\\post', 'post\\post');
22 22
 
23 23
 	/**
24 24
 	 * @since 1.0.0
25 25
 	 */
26 26
 	public function should_fire() {
27 27
 
28
-		if ( ! isset( $this->args[1]->comment_approved ) ) {
28
+		if ( ! isset($this->args[1]->comment_approved)) {
29 29
 			return false;
30 30
 		}
31 31
 
32
-		if ( 1 !== (int) $this->args[1]->comment_approved ) {
32
+		if (1 !== (int) $this->args[1]->comment_approved) {
33 33
 			return false;
34 34
 		}
35 35
 
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/depublish/delete.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
 		$post = $this->get_post_entity();
23 23
 
24
-		if ( ! $post ) {
24
+		if ( ! $post) {
25 25
 			return false;
26 26
 		}
27 27
 
28
-		if ( 'publish' !== get_post_status( $post->get_the_id() ) ) {
28
+		if ('publish' !== get_post_status($post->get_the_id())) {
29 29
 			return false;
30 30
 		}
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/type/comment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @since 1.0.0
20 20
 	 */
21
-	protected $post_hierarchy = array( 'comment\\post', 'post\\post', 'post\\post' );
21
+	protected $post_hierarchy = array('comment\\post', 'post\\post', 'post\\post');
22 22
 }
23 23
 
24 24
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/type.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @var string[]
23 23
 	 */
24
-	protected $post_hierarchy = array( 'post\\post' );
24
+	protected $post_hierarchy = array('post\\post');
25 25
 
26 26
 	/**
27 27
 	 * @since 1.0.0
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$post = $this->get_post_entity();
32 32
 
33
-		if ( ! $post ) {
33
+		if ( ! $post) {
34 34
 			return false;
35 35
 		}
36 36
 
@@ -48,42 +48,42 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	protected function get_post_entity() {
50 50
 
51
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
51
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
52 52
 
53
-		if ( ! $parts['dynamic'] ) {
53
+		if ( ! $parts['dynamic']) {
54 54
 			return false;
55 55
 		}
56 56
 
57 57
 		$this->post_hierarchy = str_replace(
58 58
 			'\\post'
59
-			, '\\' . $parts['dynamic']
59
+			, '\\'.$parts['dynamic']
60 60
 			, $this->post_hierarchy
61 61
 		);
62 62
 
63
-		$entity = wordpoints_entities()->get( $this->post_hierarchy[0] );
63
+		$entity = wordpoints_entities()->get($this->post_hierarchy[0]);
64 64
 
65
-		if ( ! $entity instanceof WordPoints_Entity ) {
65
+		if ( ! $entity instanceof WordPoints_Entity) {
66 66
 			return false;
67 67
 		}
68 68
 
69
-		$entity->set_the_value( $this->get_arg_value( $this->post_hierarchy[0] ) );
69
+		$entity->set_the_value($this->get_arg_value($this->post_hierarchy[0]));
70 70
 
71
-		if ( 1 === count( $this->post_hierarchy ) ) {
71
+		if (1 === count($this->post_hierarchy)) {
72 72
 
73 73
 			$post_entity = $entity;
74 74
 
75 75
 		} else {
76 76
 
77
-			$args = new WordPoints_Entity_Hierarchy( $entity );
77
+			$args = new WordPoints_Entity_Hierarchy($entity);
78 78
 
79
-			$post_entity = $args->get_from_hierarchy( $this->post_hierarchy );
79
+			$post_entity = $args->get_from_hierarchy($this->post_hierarchy);
80 80
 
81
-			if ( ! $post_entity instanceof WordPoints_Entity ) {
81
+			if ( ! $post_entity instanceof WordPoints_Entity) {
82 82
 				return false;
83 83
 			}
84 84
 		}
85 85
 
86
-		if ( $parts['dynamic'] !== $post_entity->get_the_attr_value( 'post_type' ) ) {
86
+		if ($parts['dynamic'] !== $post_entity->get_the_attr_value('post_type')) {
87 87
 			return false;
88 88
 		}
89 89
 
Please login to merge, or discard this patch.
src/includes/class-un-installer.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	/**
62 62
 	 * @since 1.0.0
63 63
 	 */
64
-	public function install( $network ) {
64
+	public function install($network) {
65 65
 
66 66
 		// The autoloader won't automatically be initialized because it is usually
67 67
 		// hooked to the modules loaded action, which will have already fired before
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 		// Default to network mode off during the install, but save the current
72 72
 		// mode so we can restore it afterward.
73 73
 		$points_hooks_network_mode = WordPoints_Points_Hooks::get_network_mode();
74
-		WordPoints_Points_Hooks::set_network_mode( false );
74
+		WordPoints_Points_Hooks::set_network_mode(false);
75 75
 
76 76
 		$hooks = wordpoints_hooks();
77 77
 		$hooks_mode = $hooks->get_current_mode();
78
-		$hooks->set_current_mode( 'standard' );
78
+		$hooks->set_current_mode('standard');
79 79
 
80
-		parent::install( $network );
80
+		parent::install($network);
81 81
 
82
-		$hooks->set_current_mode( $hooks_mode );
83
-		WordPoints_Points_Hooks::set_network_mode( $points_hooks_network_mode );
82
+		$hooks->set_current_mode($hooks_mode);
83
+		WordPoints_Points_Hooks::set_network_mode($points_hooks_network_mode);
84 84
 	}
85 85
 
86 86
 	/**
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 
91 91
 		parent::install_network();
92 92
 
93
-		WordPoints_Points_Hooks::set_network_mode( true );
94
-		wordpoints_hooks()->set_current_mode( 'network' );
93
+		WordPoints_Points_Hooks::set_network_mode(true);
94
+		wordpoints_hooks()->set_current_mode('network');
95 95
 
96 96
 		$this->import_legacy_points_hooks();
97 97
 
98
-		WordPoints_Points_Hooks::set_network_mode( false );
99
-		wordpoints_hooks()->set_current_mode( 'standard' );
98
+		WordPoints_Points_Hooks::set_network_mode(false);
99
+		wordpoints_hooks()->set_current_mode('standard');
100 100
 	}
101 101
 
102 102
 	/**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		$this->import_legacy_points_hook(
130 130
 			'registration',
131 131
 			'user_register',
132
-			array( 'points' => true ),
132
+			array('points' => true),
133 133
 			'register',
134
-			array( 'user' )
134
+			array('user')
135 135
 		);
136 136
 
137 137
 		$this->import_legacy_points_hook(
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				'auto_reverse' => true,
144 144
 			),
145 145
 			'post_publish',
146
-			array( 'post\post', 'author', 'user' )
146
+			array('post\post', 'author', 'user')
147 147
 		);
148 148
 
149 149
 		$this->import_legacy_points_hook(
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				'auto_reverse' => true,
156 156
 			),
157 157
 			'comment_approve',
158
-			array( 'comment\post', 'author', 'user' )
158
+			array('comment\post', 'author', 'user')
159 159
 		);
160 160
 
161 161
 		$this->import_legacy_points_hook(
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 				'auto_reverse' => true,
168 168
 			),
169 169
 			'comment_received',
170
-			array( 'comment\post', 'post\post', 'post\post', 'author', 'user' )
170
+			array('comment\post', 'post\post', 'post\post', 'author', 'user')
171 171
 		);
172 172
 
173 173
 		$this->import_legacy_points_hook(
174 174
 			'periodic',
175 175
 			'user_visit',
176
-			array( 'points' => true, 'period' => true ),
176
+			array('points' => true, 'period' => true),
177 177
 			'periodic',
178
-			array( 'current:user' )
178
+			array('current:user')
179 179
 		);
180 180
 	}
181 181
 
Please login to merge, or discard this patch.
src/includes/functions.php 1 patch
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	// Just accessing this causes it to be initialized. We need to do that so
22 22
 	// the actions will be registered and hooked up. The rest of the API can be
23 23
 	// lazy-loaded as it is needed.
24
-	$hooks->get_sub_app( 'actions' );
24
+	$hooks->get_sub_app('actions');
25 25
 }
26 26
 
27 27
 /**
@@ -33,10 +33,10 @@  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' );
39
-	$reactors->register( 'points_legacy', 'WordPoints_Hook_Reactor_Points_Legacy' );
38
+	$reactors->register('points', 'WordPoints_Hook_Reactor_Points');
39
+	$reactors->register('points_legacy', 'WordPoints_Hook_Reactor_Points_Legacy');
40 40
 }
41 41
 
42 42
 /**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @param WordPoints_Class_Registry_Children $reaction_stores The store registry.
50 50
  */
51
-function wordpoints_hook_reaction_stores_init( $reaction_stores ) {
51
+function wordpoints_hook_reaction_stores_init($reaction_stores) {
52 52
 
53 53
 	$reaction_stores->register(
54 54
 		'standard'
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		, 'WordPoints_Hook_Reaction_Store_Options'
57 57
 	);
58 58
 
59
-	if ( is_wordpoints_network_active() ) {
59
+	if (is_wordpoints_network_active()) {
60 60
 		$reaction_stores->register(
61 61
 			'network'
62 62
 			, 'points'
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
  *
75 75
  * @param WordPoints_Class_Registry_Persistent $extensions The extension registry.
76 76
  */
77
-function wordpoints_hook_extension_init( $extensions ) {
78
-
79
-	$extensions->register( 'blocker', 'WordPoints_Hook_Extension_Blocker' );
80
-	$extensions->register( 'repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker' );
81
-	$extensions->register( 'reversals', 'WordPoints_Hook_Extension_Reversals' );
82
-	$extensions->register( 'reversals_legacy_points', 'WordPoints_Hook_Extension_Reversals_Legacy_Points' );
83
-	$extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' );
84
-	$extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' );
77
+function wordpoints_hook_extension_init($extensions) {
78
+
79
+	$extensions->register('blocker', 'WordPoints_Hook_Extension_Blocker');
80
+	$extensions->register('repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker');
81
+	$extensions->register('reversals', 'WordPoints_Hook_Extension_Reversals');
82
+	$extensions->register('reversals_legacy_points', 'WordPoints_Hook_Extension_Reversals_Legacy_Points');
83
+	$extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions');
84
+	$extensions->register('periods', 'WordPoints_Hook_Extension_Periods');
85 85
 }
86 86
 
87 87
 /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
  *
94 94
  * @param WordPoints_Class_Registry_Children $conditions The conditions registry.
95 95
  */
96
-function wordpoints_hook_conditions_init( $conditions ) {
96
+function wordpoints_hook_conditions_init($conditions) {
97 97
 
98 98
 	$conditions->register(
99 99
 		'text'
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @param WordPoints_Hook_Actions $actions The action registry.
131 131
  */
132
-function wordpoints_hook_actions_init( $actions ) {
132
+function wordpoints_hook_actions_init($actions) {
133 133
 
134 134
 	$actions->register(
135 135
 		'user_register'
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		, array(
138 138
 			'action' => 'user_register',
139 139
 			'data'   => array(
140
-				'arg_index' => array( 'user' => 0 ),
140
+				'arg_index' => array('user' => 0),
141 141
 			),
142 142
 		)
143 143
 	);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		, array(
149 149
 			'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user',
150 150
 			'data'   => array(
151
-				'arg_index' => array( 'user' => 0 ),
151
+				'arg_index' => array('user' => 0),
152 152
 			),
153 153
 		)
154 154
 	);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	);
163 163
 
164 164
 	// Register actions for all of the public post types.
165
-	$post_types = get_post_types( array( 'public' => true ) );
165
+	$post_types = get_post_types(array('public' => true));
166 166
 
167 167
 	/**
168 168
 	 * Filter which post types to register hook actions for.
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @param string[] The post type slugs ("names").
173 173
 	 */
174
-	$post_types = apply_filters( 'wordpoints_register_hook_actions_for_post_types', $post_types );
174
+	$post_types = apply_filters('wordpoints_register_hook_actions_for_post_types', $post_types);
175 175
 
176
-	foreach ( $post_types as $slug ) {
177
-		wordpoints_register_post_type_hook_actions( $slug );
176
+	foreach ($post_types as $slug) {
177
+		wordpoints_register_post_type_hook_actions($slug);
178 178
 	}
179 179
 }
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
  *
186 186
  * @param string $slug The slug of the post type.
187 187
  */
188
-function wordpoints_register_post_type_hook_actions( $slug ) {
188
+function wordpoints_register_post_type_hook_actions($slug) {
189 189
 
190
-	$actions = wordpoints_hooks()->get_sub_app( 'actions' );
190
+	$actions = wordpoints_hooks()->get_sub_app('actions');
191 191
 
192
-	if ( post_type_supports( $slug, 'comments' ) ) {
192
+	if (post_type_supports($slug, 'comments')) {
193 193
 
194 194
 		$actions->register(
195 195
 			"comment_approve\\{$slug}"
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 			, array(
198 198
 				'action' => 'transition_comment_status',
199 199
 				'data'   => array(
200
-					'arg_index'    => array( "comment\\{$slug}" => 2 ),
201
-					'requirements' => array( 0 => 'approved' ),
200
+					'arg_index'    => array("comment\\{$slug}" => 2),
201
+					'requirements' => array(0 => 'approved'),
202 202
 				),
203 203
 			)
204 204
 		);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			, array(
210 210
 				'action' => 'wp_insert_comment',
211 211
 				'data'   => array(
212
-					'arg_index' => array( "comment\\{$slug}" => 1 ),
212
+					'arg_index' => array("comment\\{$slug}" => 1),
213 213
 				),
214 214
 			)
215 215
 		);
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
 			, array(
221 221
 				'action' => 'transition_comment_status',
222 222
 				'data'   => array(
223
-					'arg_index'    => array( "comment\\{$slug}" => 2 ),
224
-					'requirements' => array( 1 => 'approved' ),
223
+					'arg_index'    => array("comment\\{$slug}" => 2),
224
+					'requirements' => array(1 => 'approved'),
225 225
 				),
226 226
 			)
227 227
 		);
228 228
 	}
229 229
 
230 230
 	// This works for all post types except attachments.
231
-	if ( 'attachment' !== $slug ) {
231
+	if ('attachment' !== $slug) {
232 232
 
233 233
 		$actions->register(
234 234
 			"post_publish\\{$slug}"
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 			, array(
237 237
 				'action' => 'transition_post_status',
238 238
 				'data'   => array(
239
-					'arg_index'    => array( "post\\{$slug}" => 2 ),
240
-					'requirements' => array( 0 => 'publish' ),
239
+					'arg_index'    => array("post\\{$slug}" => 2),
240
+					'requirements' => array(0 => 'publish'),
241 241
 				),
242 242
 			)
243 243
 		);
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 			, array(
249 249
 				'action' => 'transition_post_status',
250 250
 				'data'   => array(
251
-					'arg_index'    => array( "post\\{$slug}" => 2 ),
252
-					'requirements' => array( 1 => 'publish' ),
251
+					'arg_index'    => array("post\\{$slug}" => 2),
252
+					'requirements' => array(1 => 'publish'),
253 253
 				),
254 254
 			)
255 255
 		);
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 			, array(
261 261
 				'action' => 'delete_post',
262 262
 				'data'   => array(
263
-					'arg_index' => array( "post\\{$slug}" => 0 ),
263
+					'arg_index' => array("post\\{$slug}" => 0),
264 264
 				),
265 265
 			)
266 266
 		);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			, array(
274 274
 				'action' => 'add_attachment',
275 275
 				'data'   => array(
276
-					'arg_index' => array( 'post\attachment' => 0 ),
276
+					'arg_index' => array('post\attachment' => 0),
277 277
 				),
278 278
 			)
279 279
 		);
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			, array(
285 285
 				'action' => 'delete_post',
286 286
 				'data'   => array(
287
-					'arg_index' => array( "post\\{$slug}" => 0 ),
287
+					'arg_index' => array("post\\{$slug}" => 0),
288 288
 				),
289 289
 			)
290 290
 		);
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 *
298 298
 	 * @param string $slug The slug ("name") of the post type.
299 299
 	 */
300
-	do_action( 'wordpoints_register_post_type_hook_actions', $slug );
300
+	do_action('wordpoints_register_post_type_hook_actions', $slug);
301 301
 }
302 302
 
303 303
 /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
  *
310 310
  * @param WordPoints_Hook_Events $events The event registry.
311 311
  */
312
-function wordpoints_hook_events_init( $events ) {
312
+function wordpoints_hook_events_init($events) {
313 313
 
314 314
 	$events->register(
315 315
 		'user_register'
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	);
340 340
 
341 341
 	// Register events 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 hook events for.
@@ -348,10 +348,10 @@  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_hook_events_for_post_types', $post_types );
351
+	$post_types = apply_filters('wordpoints_register_hook_events_for_post_types', $post_types);
352 352
 
353
-	foreach ( $post_types as $slug ) {
354
-		wordpoints_register_post_type_hook_events( $slug );
353
+	foreach ($post_types as $slug) {
354
+		wordpoints_register_post_type_hook_events($slug);
355 355
 	}
356 356
 }
357 357
 
@@ -364,11 +364,11 @@  discard block
 block discarded – undo
364 364
  *
365 365
  * @param WordPoints_App_Registry $entities The entities app.
366 366
  */
367
-function wordpoints_entities_app_init( $entities ) {
367
+function wordpoints_entities_app_init($entities) {
368 368
 
369 369
 	$sub_apps = $entities->sub_apps();
370
-	$sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' );
371
-	$sub_apps->register( 'contexts', 'WordPoints_Class_Registry' );
370
+	$sub_apps->register('children', 'WordPoints_Class_Registry_Children');
371
+	$sub_apps->register('contexts', 'WordPoints_Class_Registry');
372 372
 }
373 373
 
374 374
 /**
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @param WordPoints_Class_RegistryI $contexts The entity context registry.
382 382
  */
383
-function wordpoints_entity_contexts_init( $contexts ) {
383
+function wordpoints_entity_contexts_init($contexts) {
384 384
 
385
-	$contexts->register( 'network', 'WordPoints_Entity_Context_Network' );
386
-	$contexts->register( 'site', 'WordPoints_Entity_Context_Site' );
385
+	$contexts->register('network', 'WordPoints_Entity_Context_Network');
386
+	$contexts->register('site', 'WordPoints_Entity_Context_Site');
387 387
 }
388 388
 
389 389
 /**
@@ -395,17 +395,17 @@  discard block
 block discarded – undo
395 395
  *
396 396
  * @param WordPoints_App_Registry $entities The entities app.
397 397
  */
398
-function wordpoints_entities_init( $entities ) {
398
+function wordpoints_entities_init($entities) {
399 399
 
400
-	$children = $entities->get_sub_app( 'children' );
400
+	$children = $entities->get_sub_app('children');
401 401
 
402
-	$entities->register( 'user', 'WordPoints_Entity_User' );
403
-	$children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' );
402
+	$entities->register('user', 'WordPoints_Entity_User');
403
+	$children->register('user', 'roles', 'WordPoints_Entity_User_Roles');
404 404
 
405
-	$entities->register( 'user_role', 'WordPoints_Entity_User_Role' );
405
+	$entities->register('user_role', 'WordPoints_Entity_User_Role');
406 406
 
407 407
 	// Register entities for all of the public post types.
408
-	$post_types = get_post_types( array( 'public' => true ) );
408
+	$post_types = get_post_types(array('public' => true));
409 409
 
410 410
 	/**
411 411
 	 * Filter which post types to register entities for.
@@ -414,14 +414,14 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @param string[] The post type slugs ("names").
416 416
 	 */
417
-	$post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types );
417
+	$post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types);
418 418
 
419
-	foreach ( $post_types as $slug ) {
420
-		wordpoints_register_post_type_entities( $slug );
419
+	foreach ($post_types as $slug) {
420
+		wordpoints_register_post_type_entities($slug);
421 421
 	}
422 422
 
423 423
 	// Register entities for all of the public taxonomies.
424
-	$taxonomies = get_taxonomies( array( 'public' => true ) );
424
+	$taxonomies = get_taxonomies(array('public' => true));
425 425
 
426 426
 	/**
427 427
 	 * Filter which taxonomies to register entities for.
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
 	 *
431 431
 	 * @param string[] The taxonomy slugs.
432 432
 	 */
433
-	$taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies );
433
+	$taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies);
434 434
 
435
-	foreach ( $taxonomies as $slug ) {
436
-		wordpoints_register_taxonomy_entities( $slug );
435
+	foreach ($taxonomies as $slug) {
436
+		wordpoints_register_taxonomy_entities($slug);
437 437
 	}
438 438
 }
439 439
 
@@ -444,28 +444,28 @@  discard block
 block discarded – undo
444 444
  *
445 445
  * @param string $slug The slug of the post type.
446 446
  */
447
-function wordpoints_register_post_type_entities( $slug ) {
447
+function wordpoints_register_post_type_entities($slug) {
448 448
 
449 449
 	$entities = wordpoints_entities();
450
-	$children = $entities->get_sub_app( 'children' );
450
+	$children = $entities->get_sub_app('children');
451 451
 
452
-	$entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' );
453
-	$children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' );
452
+	$entities->register("post\\{$slug}", 'WordPoints_Entity_Post');
453
+	$children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author');
454 454
 
455
-	$supports = get_all_post_type_supports( $slug );
455
+	$supports = get_all_post_type_supports($slug);
456 456
 
457
-	if ( isset( $supports['editor'] ) ) {
458
-		$children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' );
457
+	if (isset($supports['editor'])) {
458
+		$children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content');
459 459
 	}
460 460
 
461
-	if ( isset( $supports['comments'] ) ) {
462
-		$entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' );
463
-		$children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' );
464
-		$children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' );
461
+	if (isset($supports['comments'])) {
462
+		$entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment');
463
+		$children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post');
464
+		$children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author');
465 465
 	}
466 466
 
467
-	foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) {
468
-		$children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' );
467
+	foreach (get_object_taxonomies($slug) as $taxonomy_slug) {
468
+		$children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms');
469 469
 	}
470 470
 
471 471
 	/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 *
476 476
 	 * @param string $slug The slug ("name") of the post type.
477 477
 	 */
478
-	do_action( 'wordpoints_register_post_type_entities', $slug );
478
+	do_action('wordpoints_register_post_type_entities', $slug);
479 479
 }
480 480
 
481 481
 /**
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
  *
486 486
  * @param string $slug The slug of the post type.
487 487
  */
488
-function wordpoints_register_post_type_hook_events( $slug ) {
488
+function wordpoints_register_post_type_hook_events($slug) {
489 489
 
490
-	$events = wordpoints_hooks()->get_sub_app( 'events' );
490
+	$events = wordpoints_hooks()->get_sub_app('events');
491 491
 
492
-	if ( 'attachment' === $slug ) {
492
+	if ('attachment' === $slug) {
493 493
 
494 494
 		$events->register(
495 495
 			'media_upload'
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		);
526 526
 	}
527 527
 
528
-	if ( post_type_supports( $slug, 'comments' ) ) {
528
+	if (post_type_supports($slug, 'comments')) {
529 529
 
530 530
 		$events->register(
531 531
 			"comment_leave\\{$slug}"
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 *
553 553
 	 * @param string $slug The slug ("name") of the post type.
554 554
 	 */
555
-	do_action( 'wordpoints_register_post_type_hook_events', $slug );
555
+	do_action('wordpoints_register_post_type_hook_events', $slug);
556 556
 }
557 557
 
558 558
 /**
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
  *
563 563
  * @param string $slug The slug of the taxonomy.
564 564
  */
565
-function wordpoints_register_taxonomy_entities( $slug ) {
565
+function wordpoints_register_taxonomy_entities($slug) {
566 566
 
567 567
 	$entities = wordpoints_entities();
568
-	$children = $entities->get_sub_app( 'children' );
568
+	$children = $entities->get_sub_app('children');
569 569
 
570
-	$entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' );
571
-	$children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' );
570
+	$entities->register("term\\{$slug}", 'WordPoints_Entity_Term');
571
+	$children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id');
572 572
 
573 573
 	/**
574 574
 	 * Fired when registering the entities for a taxonomy.
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 *
578 578
 	 * @param string $slug The taxonomy's slug.
579 579
 	 */
580
-	do_action( 'wordpoints_register_taxonomy_entities', $slug );
580
+	do_action('wordpoints_register_taxonomy_entities', $slug);
581 581
 }
582 582
 
583 583
 /**
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @param WordPoints_Class_RegistryI $data_types The data types registry.
591 591
  */
592
-function wordpoints_data_types_init( $data_types ) {
592
+function wordpoints_data_types_init($data_types) {
593 593
 
594
-	$data_types->register( 'integer', 'WordPoints_Data_Type_Integer' );
595
-	$data_types->register( 'text', 'WordPoints_Data_Type_Text' );
594
+	$data_types->register('integer', 'WordPoints_Data_Type_Integer');
595
+	$data_types->register('text', 'WordPoints_Data_Type_Text');
596 596
 }
597 597
 
598 598
 /**
@@ -607,9 +607,9 @@  discard block
 block discarded – undo
607 607
  *
608 608
  * @return bool Whether the user can view the points log.
609 609
  */
610
-function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) {
610
+function wordpoints_hooks_user_can_view_points_log($can_view, $log) {
611 611
 
612
-	if ( ! $can_view ) {
612
+	if ( ! $can_view) {
613 613
 		return $can_view;
614 614
 	}
615 615
 
@@ -618,11 +618,11 @@  discard block
 block discarded – undo
618 618
 	$event_slug = $log->log_type;
619 619
 
620 620
 	/** @var WordPoints_Hook_ArgI $arg */
621
-	foreach ( wordpoints_hooks()->get_sub_app( 'events' )->get_sub_app( 'args' )->get_children( $event_slug ) as $slug => $arg ) {
621
+	foreach (wordpoints_hooks()->get_sub_app('events')->get_sub_app('args')->get_children($event_slug) as $slug => $arg) {
622 622
 
623
-		$value = wordpoints_get_points_log_meta( $log->id, $slug, true );
623
+		$value = wordpoints_get_points_log_meta($log->id, $slug, true);
624 624
 
625
-		if ( ! $value ) {
625
+		if ( ! $value) {
626 626
 			continue;
627 627
 		}
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 			, $value
633 633
 		);
634 634
 
635
-		if ( ! $can_view ) {
635
+		if ( ! $can_view) {
636 636
 			break;
637 637
 		}
638 638
 	}
@@ -651,20 +651,20 @@  discard block
 block discarded – undo
651 651
  *
652 652
  * @return bool Whether the user can view this entity.
653 653
  */
654
-function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) {
654
+function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) {
655 655
 
656
-	$entity = wordpoints_entities()->get( $entity_slug );
656
+	$entity = wordpoints_entities()->get($entity_slug);
657 657
 
658 658
 	// If this entity type is not found, we have no way of determining whether it is
659 659
 	// safe for the user to view it.
660
-	if ( ! ( $entity instanceof WordPoints_Entity ) ) {
660
+	if ( ! ($entity instanceof WordPoints_Entity)) {
661 661
 		return false;
662 662
 	}
663 663
 
664 664
 	$can_view = true;
665 665
 
666
-	if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) {
667
-		$can_view = $entity->user_can_view( $user_id, $entity_id );
666
+	if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) {
667
+		$can_view = $entity->user_can_view($user_id, $entity_id);
668 668
 	}
669 669
 
670 670
 	/**
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
  */
696 696
 function wordpoints_apps() {
697 697
 
698
-	if ( ! isset( WordPoints_App::$main ) ) {
699
-		WordPoints_App::$main = new WordPoints_App( 'apps' );
698
+	if ( ! isset(WordPoints_App::$main)) {
699
+		WordPoints_App::$main = new WordPoints_App('apps');
700 700
 	}
701 701
 
702 702
 	return WordPoints_App::$main;
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
  */
712 712
 function wordpoints_hooks() {
713 713
 
714
-	if ( ! isset( WordPoints_App::$main ) ) {
714
+	if ( ! isset(WordPoints_App::$main)) {
715 715
 		wordpoints_apps();
716 716
 	}
717 717
 
718
-	return WordPoints_App::$main->get_sub_app( 'hooks' );
718
+	return WordPoints_App::$main->get_sub_app('hooks');
719 719
 }
720 720
 
721 721
 /**
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
  */
728 728
 function wordpoints_entities() {
729 729
 
730
-	if ( ! isset( WordPoints_App::$main ) ) {
730
+	if ( ! isset(WordPoints_App::$main)) {
731 731
 		wordpoints_apps();
732 732
 	}
733 733
 
734
-	return WordPoints_App::$main->get_sub_app( 'entities' );
734
+	return WordPoints_App::$main->get_sub_app('entities');
735 735
 }
736 736
 
737 737
 /**
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
  *
744 744
  * @param WordPoints_App $app The main apps app.
745 745
  */
746
-function wordpoints_apps_init( $app ) {
746
+function wordpoints_apps_init($app) {
747 747
 
748 748
 	$apps = $app->sub_apps();
749 749
 
750
-	$apps->register( 'hooks', 'WordPoints_Hooks' );
751
-	$apps->register( 'entities', 'WordPoints_App_Registry' );
752
-	$apps->register( 'data_types', 'WordPoints_Class_Registry' );
750
+	$apps->register('hooks', 'WordPoints_Hooks');
751
+	$apps->register('entities', 'WordPoints_App_Registry');
752
+	$apps->register('data_types', 'WordPoints_Class_Registry');
753 753
 }
754 754
 
755 755
 /**
@@ -762,19 +762,19 @@  discard block
 block discarded – undo
762 762
  *
763 763
  * @return object|false The constructed object, or false if to many args were passed.
764 764
  */
765
-function wordpoints_construct_class_with_args( $class_name, array $args ) {
765
+function wordpoints_construct_class_with_args($class_name, array $args) {
766 766
 
767
-	switch ( count( $args ) ) {
767
+	switch (count($args)) {
768 768
 		case 0:
769 769
 			return new $class_name();
770 770
 		case 1:
771
-			return new $class_name( $args[0] );
771
+			return new $class_name($args[0]);
772 772
 		case 2:
773
-			return new $class_name( $args[0], $args[1] );
773
+			return new $class_name($args[0], $args[1]);
774 774
 		case 3:
775
-			return new $class_name( $args[0], $args[1], $args[2] );
775
+			return new $class_name($args[0], $args[1], $args[2]);
776 776
 		case 4:
777
-			return new $class_name( $args[0], $args[1], $args[2], $args[3] );
777
+			return new $class_name($args[0], $args[1], $args[2], $args[3]);
778 778
 		default:
779 779
 			return false;
780 780
 	}
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
  * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the
797 797
  *               slug is not dynamic, the value of each of those keys will be false.
798 798
  */
799
-function wordpoints_parse_dynamic_slug( $slug ) {
799
+function wordpoints_parse_dynamic_slug($slug) {
800 800
 
801
-	$parsed = array( 'dynamic' => false, 'generic' => false );
801
+	$parsed = array('dynamic' => false, 'generic' => false);
802 802
 
803
-	$parts = explode( '\\', $slug, 2 );
803
+	$parts = explode('\\', $slug, 2);
804 804
 
805
-	if ( isset( $parts[1] ) ) {
805
+	if (isset($parts[1])) {
806 806
 		$parsed['dynamic'] = $parts[1];
807 807
 		$parsed['generic'] = $parts[0];
808 808
 	}
@@ -841,28 +841,28 @@  discard block
 block discarded – undo
841 841
  *                     contexts, indexed by context slug, or false if any of the
842 842
  *                     contexts isn't current.
843 843
  */
844
-function wordpoints_entities_get_current_context_id( $slug ) {
844
+function wordpoints_entities_get_current_context_id($slug) {
845 845
 
846 846
 	$current_context = array();
847 847
 
848 848
 	/** @var WordPoints_Class_Registry $contexts */
849
-	$contexts = wordpoints_entities()->get_sub_app( 'contexts' );
849
+	$contexts = wordpoints_entities()->get_sub_app('contexts');
850 850
 
851
-	while ( $slug ) {
851
+	while ($slug) {
852 852
 
853
-		$context = $contexts->get( $slug );
853
+		$context = $contexts->get($slug);
854 854
 
855
-		if ( ! $context instanceof WordPoints_Entity_Context ) {
855
+		if ( ! $context instanceof WordPoints_Entity_Context) {
856 856
 			return false;
857 857
 		}
858 858
 
859 859
 		$id = $context->get_current_id();
860 860
 
861
-		if ( false === $id ) {
861
+		if (false === $id) {
862 862
 			return false;
863 863
 		}
864 864
 
865
-		$current_context[ $slug ] = $id;
865
+		$current_context[$slug] = $id;
866 866
 
867 867
 		$slug = $context->get_parent_slug();
868 868
 	}
@@ -883,22 +883,22 @@  discard block
 block discarded – undo
883 883
  */
884 884
 function wordpoints_is_network_context() {
885 885
 
886
-	if ( ! is_multisite() ) {
886
+	if ( ! is_multisite()) {
887 887
 		return false;
888 888
 	}
889 889
 
890
-	if ( is_network_admin() ) {
890
+	if (is_network_admin()) {
891 891
 		return true;
892 892
 	}
893 893
 
894 894
 	// See https://core.trac.wordpress.org/ticket/22589
895 895
 	if (
896
-		defined( 'DOING_AJAX' )
896
+		defined('DOING_AJAX')
897 897
 		&& DOING_AJAX
898
-		&& isset( $_SERVER['HTTP_REFERER'] )
898
+		&& isset($_SERVER['HTTP_REFERER'])
899 899
 		&& preg_match(
900
-			'#^' . preg_quote( network_admin_url(), '#' ) . '#i'
901
-			, esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) )
900
+			'#^'.preg_quote(network_admin_url(), '#').'#i'
901
+			, esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER']))
902 902
 		)
903 903
 	) {
904 904
 		return true;
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 	 *
912 912
 	 * @param bool $in_network_context Whether we are in network context.
913 913
 	 */
914
-	return apply_filters( 'wordpoints_is_network_context', false );
914
+	return apply_filters('wordpoints_is_network_context', false);
915 915
 }
916 916
 
917 917
 /**
@@ -925,21 +925,21 @@  discard block
 block discarded – undo
925 925
  *
926 926
  * @return string The primary arg's GUID, JSON encoded.
927 927
  */
928
-function wordpoints_hooks_get_event_primary_arg_guid_json( WordPoints_Hook_Event_Args $event_args ) {
928
+function wordpoints_hooks_get_event_primary_arg_guid_json(WordPoints_Hook_Event_Args $event_args) {
929 929
 
930 930
 	$entity = $event_args->get_primary_arg();
931 931
 
932
-	if ( ! $entity ) {
932
+	if ( ! $entity) {
933 933
 		return '';
934 934
 	}
935 935
 
936 936
 	$the_guid = $entity->get_the_guid();
937 937
 
938
-	if ( ! $the_guid ) {
938
+	if ( ! $the_guid) {
939 939
 		return '';
940 940
 	}
941 941
 
942
-	return wp_json_encode( $the_guid );
942
+	return wp_json_encode($the_guid);
943 943
 }
944 944
 
945 945
 /**
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function wordpoints_hooks_api_add_global_cache_groups() {
954 954
 
955
-	if ( function_exists( 'wp_cache_add_global_groups' ) ) {
955
+	if (function_exists('wp_cache_add_global_groups')) {
956 956
 
957 957
 		wp_cache_add_global_groups(
958 958
 			array(
@@ -978,8 +978,8 @@  discard block
 block discarded – undo
978 978
  * @return string The escaped identifier. Already quoted, do not place within
979 979
  *                backticks.
980 980
  */
981
-function wordpoints_escape_mysql_identifier( $identifier ) {
982
-	return '`' . str_replace( '`', '``', $identifier ) . '`';
981
+function wordpoints_escape_mysql_identifier($identifier) {
982
+	return '`'.str_replace('`', '``', $identifier).'`';
983 983
 }
984 984
 
985 985
 
@@ -999,11 +999,11 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return array The option value if it is an array, or an empty array if not.
1001 1001
  */
1002
-function wordpoints_get_maybe_network_array_option( $option, $network = null ) {
1002
+function wordpoints_get_maybe_network_array_option($option, $network = null) {
1003 1003
 
1004
-	$value = wordpoints_get_maybe_network_option( $option, $network );
1004
+	$value = wordpoints_get_maybe_network_option($option, $network);
1005 1005
 
1006
-	if ( ! is_array( $value ) ) {
1006
+	if ( ! is_array($value)) {
1007 1007
 		$value = array();
1008 1008
 	}
1009 1009
 
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
  *
1025 1025
  * @return mixed The option value if it exists, or $default (false by default).
1026 1026
  */
1027
-function wordpoints_get_maybe_network_option( $option, $network = null, $default = false ) {
1027
+function wordpoints_get_maybe_network_option($option, $network = null, $default = false) {
1028 1028
 
1029
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
1030
-		return get_site_option( $option, $default );
1029
+	if ($network || (null === $network && is_wordpoints_network_active())) {
1030
+		return get_site_option($option, $default);
1031 1031
 	} else {
1032
-		return get_option( $option, $default );
1032
+		return get_option($option, $default);
1033 1033
 	}
1034 1034
 }
1035 1035
 
@@ -1049,12 +1049,12 @@  discard block
 block discarded – undo
1049 1049
  *
1050 1050
  * @return bool Whether the option was added successfully.
1051 1051
  */
1052
-function wordpoints_add_maybe_network_option( $option, $value, $network = null, $autoload = 'yes' ) {
1052
+function wordpoints_add_maybe_network_option($option, $value, $network = null, $autoload = 'yes') {
1053 1053
 
1054
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
1055
-		return add_site_option( $option, $value );
1054
+	if ($network || (null === $network && is_wordpoints_network_active())) {
1055
+		return add_site_option($option, $value);
1056 1056
 	} else {
1057
-		return add_option( $option, $value, '', $autoload );
1057
+		return add_option($option, $value, '', $autoload);
1058 1058
 	}
1059 1059
 }
1060 1060
 
@@ -1072,12 +1072,12 @@  discard block
 block discarded – undo
1072 1072
  *
1073 1073
  * @return bool Whether the option was updated successfully.
1074 1074
  */
1075
-function wordpoints_update_maybe_network_option( $option, $value, $network = null ) {
1075
+function wordpoints_update_maybe_network_option($option, $value, $network = null) {
1076 1076
 
1077
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
1078
-		return update_site_option( $option, $value );
1077
+	if ($network || (null === $network && is_wordpoints_network_active())) {
1078
+		return update_site_option($option, $value);
1079 1079
 	} else {
1080
-		return update_option( $option, $value );
1080
+		return update_option($option, $value);
1081 1081
 	}
1082 1082
 }
1083 1083
 
@@ -1094,12 +1094,12 @@  discard block
 block discarded – undo
1094 1094
  *
1095 1095
  * @return bool Whether the option was successfully deleted.
1096 1096
  */
1097
-function wordpoints_delete_maybe_network_option( $option, $network = null ) {
1097
+function wordpoints_delete_maybe_network_option($option, $network = null) {
1098 1098
 
1099
-	if ( $network || ( null === $network && is_wordpoints_network_active() ) ) {
1100
-		return delete_site_option( $option );
1099
+	if ($network || (null === $network && is_wordpoints_network_active())) {
1100
+		return delete_site_option($option);
1101 1101
 	} else {
1102
-		return delete_option( $option );
1102
+		return delete_option($option);
1103 1103
 	}
1104 1104
 }
1105 1105
 
Please login to merge, or discard this patch.
src/admin/includes/classes/screen/points/types.php 1 patch
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 1.0.0
79 79
 	 */
80 80
 	protected function get_title() {
81
-		return _x( 'Points Types', 'page title', 'wordpoints' );
81
+		return _x('Points Types', 'page title', 'wordpoints');
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 
89 89
 		parent::hooks();
90 90
 
91
-		add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) );
92
-		add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) );
91
+		add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box'));
92
+		add_action('add_meta_boxes', array($this, 'add_event_meta_boxes'));
93 93
 	}
94 94
 
95 95
 	/**
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function enqueue_scripts() {
99 99
 
100
-		wp_enqueue_style( 'wordpoints-hooks-admin' );
100
+		wp_enqueue_style('wordpoints-hooks-admin');
101 101
 
102
-		wp_enqueue_script( 'postbox' );
103
-		wp_enqueue_script( 'wordpoints-admin-points-types' );
102
+		wp_enqueue_script('postbox');
103
+		wp_enqueue_script('wordpoints-admin-points-types');
104 104
 
105 105
 		wordpoints_hooks_ui_setup_script_data();
106 106
 	}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 					.addClass( 'closed' );
121 121
 
122 122
 				postboxes.add_postbox_toggles(
123
-					<?php echo wp_json_encode( $this->id ); ?>
123
+					<?php echo wp_json_encode($this->id); ?>
124 124
 				);
125 125
 			} );
126 126
 		</script>
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function add_points_settings_meta_box() {
137 137
 
138
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
138
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
139 139
 			return;
140 140
 		}
141 141
 
142 142
 		add_meta_box(
143 143
 			'settings'
144
-			, __( 'Settings', 'wordpoints' )
145
-			, array( $this, 'display_points_settings_meta_box' )
144
+			, __('Settings', 'wordpoints')
145
+			, array($this, 'display_points_settings_meta_box')
146 146
 			, $this->id
147 147
 			, 'side'
148 148
 			, 'default'
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function display_points_settings_meta_box() {
158 158
 
159
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
159
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 
165 165
 		$add_new = 0;
166 166
 
167
-		$points_type = wordpoints_get_points_type( $slug );
167
+		$points_type = wordpoints_get_points_type($slug);
168 168
 
169
-		if ( ! $points_type ) {
169
+		if ( ! $points_type) {
170 170
 
171 171
 			$points_type = array();
172
-			$add_new     = wp_create_nonce( 'wordpoints_add_new_points_type' );
172
+			$add_new     = wp_create_nonce('wordpoints_add_new_points_type');
173 173
 		}
174 174
 
175 175
 		$points_type = array_merge(
@@ -184,19 +184,19 @@  discard block
 block discarded – undo
184 184
 		?>
185 185
 
186 186
 		<form method="post">
187
-			<?php if ( is_wordpoints_network_active() && ! is_network_admin() ) : ?>
188
-				<div class="notice notice-info inline"><p><?php esc_html_e( 'Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints' ) ?></p></div>
187
+			<?php if (is_wordpoints_network_active() && ! is_network_admin()) : ?>
188
+				<div class="notice notice-info inline"><p><?php esc_html_e('Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints') ?></p></div>
189 189
 			<?php endif; ?>
190 190
 
191
-			<?php if ( $slug ) : ?>
191
+			<?php if ($slug) : ?>
192 192
 				<p>
193 193
 					<span class="wordpoints-points-slug">
194 194
 						<em>
195
-							<?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?>
195
+							<?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?>
196 196
 						</em>
197 197
 					</span>
198 198
 				</p>
199
-				<?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?>
199
+				<?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?>
200 200
 			<?php endif; ?>
201 201
 
202 202
 			<?php
@@ -210,45 +210,45 @@  discard block
 block discarded – undo
210 210
 			 *
211 211
 			 * @param string $points_type The slug of the points type.
212 212
 			 */
213
-			do_action( 'wordpoints_points_type_form_top', $slug );
213
+			do_action('wordpoints_points_type_form_top', $slug);
214 214
 
215
-			if ( $add_new ) {
215
+			if ($add_new) {
216 216
 
217 217
 				// Mark the prefix and suffix optional on the add new form.
218
-				$prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' );
219
-				$suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' );
218
+				$prefix = _x('Prefix (optional):', 'points type', 'wordpoints');
219
+				$suffix = _x('Suffix (optional):', 'points type', 'wordpoints');
220 220
 
221 221
 			} else {
222 222
 
223
-				$prefix = _x( 'Prefix:', 'points type', 'wordpoints' );
224
-				$suffix = _x( 'Suffix:', 'points type', 'wordpoints' );
223
+				$prefix = _x('Prefix:', 'points type', 'wordpoints');
224
+				$suffix = _x('Suffix:', 'points type', 'wordpoints');
225 225
 			}
226 226
 
227 227
 			?>
228 228
 
229 229
 			<p>
230 230
 				<label
231
-					for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label>
231
+					for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label>
232 232
 				<input class="widefat" type="text"
233
-				       id="points-name-<?php echo esc_attr( $slug ); ?>"
233
+				       id="points-name-<?php echo esc_attr($slug); ?>"
234 234
 				       name="points-name"
235
-				       value="<?php echo esc_attr( $points_type['name'] ); ?>"/>
235
+				       value="<?php echo esc_attr($points_type['name']); ?>"/>
236 236
 			</p>
237 237
 			<p>
238 238
 				<label
239
-					for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label>
239
+					for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label>
240 240
 				<input class="widefat" type="text"
241
-				       id="points-prefix-<?php echo esc_attr( $slug ); ?>"
241
+				       id="points-prefix-<?php echo esc_attr($slug); ?>"
242 242
 				       name="points-prefix"
243
-				       value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/>
243
+				       value="<?php echo esc_attr($points_type['prefix']); ?>"/>
244 244
 			</p>
245 245
 			<p>
246 246
 				<label
247
-					for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label>
247
+					for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label>
248 248
 				<input class="widefat" type="text"
249
-				       id="points-suffix-<?php echo esc_attr( $slug ); ?>"
249
+				       id="points-suffix-<?php echo esc_attr($slug); ?>"
250 250
 				       name="points-suffix"
251
-				       value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/>
251
+				       value="<?php echo esc_attr($points_type['suffix']); ?>"/>
252 252
 			</p>
253 253
 
254 254
 			<?php
@@ -262,28 +262,28 @@  discard block
 block discarded – undo
262 262
 			 *
263 263
 			 * @param string $points_type The slug of the points type.
264 264
 			 */
265
-			do_action( 'wordpoints_points_type_form_bottom', $slug );
265
+			do_action('wordpoints_points_type_form_bottom', $slug);
266 266
 
267 267
 			?>
268 268
 
269 269
 			<input type="hidden" name="points-slug"
270
-			       value="<?php echo esc_attr( $slug ); ?>"/>
270
+			       value="<?php echo esc_attr($slug); ?>"/>
271 271
 			<input type="hidden" name="add_new" class="add_new"
272
-			       value="<?php echo esc_attr( $add_new ); ?>"/>
272
+			       value="<?php echo esc_attr($add_new); ?>"/>
273 273
 
274 274
 			<div class="hook-control-actions">
275 275
 				<div class="alignleft">
276 276
 					<?php
277 277
 
278
-					if ( ! $add_new ) {
279
-						wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' );
280
-						submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) );
278
+					if ( ! $add_new) {
279
+						wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce');
280
+						submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}"));
281 281
 					}
282 282
 
283 283
 					?>
284 284
 				</div>
285 285
 				<div class="alignright">
286
-					<?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?>
286
+					<?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?>
287 287
 					<span class="spinner"></span>
288 288
 				</div>
289 289
 				<br class="clear"/>
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public function add_event_meta_boxes() {
302 302
 
303
-		if ( ! $this->current_points_type ) {
303
+		if ( ! $this->current_points_type) {
304 304
 			return;
305 305
 		}
306 306
 
307
-		$events_app       = $this->hooks->get_sub_app( 'events' );
308
-		$this->event_args = $events_app->get_sub_app( 'args' );
307
+		$events_app       = $this->hooks->get_sub_app('events');
308
+		$this->event_args = $events_app->get_sub_app('args');
309 309
 
310
-		$this->reaction_store = wordpoints_hooks()->get_reaction_store( 'points' );
310
+		$this->reaction_store = wordpoints_hooks()->get_reaction_store('points');
311 311
 
312 312
 		/** @var WordPoints_Hook_ReactorI $reactor */
313
-		$reactor = $this->hooks->get_sub_app( 'reactors' )->get( 'points' );
314
-		$reactor_action_types = array_fill_keys( $reactor->get_action_types(), true );
313
+		$reactor = $this->hooks->get_sub_app('reactors')->get('points');
314
+		$reactor_action_types = array_fill_keys($reactor->get_action_types(), true);
315 315
 
316 316
 		$event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types();
317 317
 
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 			, $this->current_points_type
337 337
 		);
338 338
 
339
-		foreach ( $events as $slug => $event ) {
339
+		foreach ($events as $slug => $event) {
340 340
 
341 341
 			if (
342 342
 				! array_intersect_key(
343
-					$event_action_types[ $slug ]
343
+					$event_action_types[$slug]
344 344
 					, $reactor_action_types
345 345
 				)
346 346
 			) {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			add_meta_box(
351 351
 				"{$this->current_points_type}-{$slug}"
352 352
 				, $event->get_title()
353
-				, array( $this, 'display_event_meta_box' )
353
+				, array($this, 'display_event_meta_box')
354 354
 				, $this->id
355 355
 				, 'events'
356 356
 				, 'default'
@@ -371,50 +371,50 @@  discard block
 block discarded – undo
371 371
 	 * @param array $points_type The points type this meta-box relates to.
372 372
 	 * @param array $meta_box    The data the meta-box was created with.
373 373
 	 */
374
-	public function display_event_meta_box( $points_type, $meta_box ) {
374
+	public function display_event_meta_box($points_type, $meta_box) {
375 375
 
376 376
 		$event_slug = $meta_box['args']['slug'];
377 377
 
378 378
 		$data = array();
379 379
 
380
-		foreach ( $this->reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
381
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
380
+		foreach ($this->reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) {
381
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
382 382
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
383 383
 					$reaction
384 384
 				);
385 385
 			}
386 386
 		}
387 387
 
388
-		$event_data = array( 'args' => array() );
388
+		$event_data = array('args' => array());
389 389
 
390
-		foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) {
390
+		foreach ($this->event_args->get_children($event_slug) as $slug => $arg) {
391 391
 
392
-			$event_data['args'][ $slug ] = array(
392
+			$event_data['args'][$slug] = array(
393 393
 				'slug' => $slug,
394 394
 			);
395 395
 
396
-			if ( $arg instanceof WordPoints_Hook_ArgI ) {
397
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
398
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
396
+			if ($arg instanceof WordPoints_Hook_ArgI) {
397
+				$event_data['args'][$slug]['title'] = $arg->get_title();
398
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
399 399
 			}
400 400
 		}
401 401
 
402 402
 		?>
403 403
 
404 404
 		<script>
405
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
406
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
405
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
406
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
407 407
 		</script>
408 408
 
409 409
 		<div class="wordpoints-hook-reaction-group-container">
410 410
 			<p class="description wordpoints-hook-reaction-group-description">
411
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
411
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
412 412
 			</p>
413 413
 
414 414
 			<div class="wordpoints-hook-reaction-group"
415
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
416
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
417
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $this->reaction_store ) ); ?>"
415
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
416
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
417
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($this->reaction_store)); ?>"
418 418
 				data-wordpoints-hooks-reaction-store="points"
419 419
 				data-wordpoints-hooks-reactor="points">
420 420
 			</div>
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
 			<div class="controls">
431 431
 				<button type="button" class="button-primary add-reaction">
432
-					<?php esc_html_e( 'Add New', 'wordpoints' ); ?>
432
+					<?php esc_html_e('Add New', 'wordpoints'); ?>
433 433
 				</button>
434 434
 			</div>
435 435
 		</div>
@@ -449,19 +449,19 @@  discard block
 block discarded – undo
449 449
 		// Show a tab for each points type.
450 450
 		$tabs = array();
451 451
 
452
-		foreach ( $points_types as $slug => $settings ) {
453
-			$tabs[ $slug ] = $settings['name'];
452
+		foreach ($points_types as $slug => $settings) {
453
+			$tabs[$slug] = $settings['name'];
454 454
 		}
455 455
 
456
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
456
+		$tabs['add-new'] = __('Add New', 'wordpoints');
457 457
 
458
-		$tab = wordpoints_admin_get_current_tab( $tabs );
458
+		$tab = wordpoints_admin_get_current_tab($tabs);
459 459
 
460
-		if ( 'add-new' !== $tab ) {
460
+		if ('add-new' !== $tab) {
461 461
 			$this->current_points_type = $tab;
462 462
 		}
463 463
 
464
-		do_action( 'add_meta_boxes', $this->id );
464
+		do_action('add_meta_boxes', $this->id);
465 465
 
466 466
 		$this->tabs = $tabs;
467 467
 	}
@@ -473,19 +473,19 @@  discard block
 block discarded – undo
473 473
 	 */
474 474
 	public function save_points_type() {
475 475
 
476
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
476
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
477 477
 			return;
478 478
 		}
479 479
 
480
-		if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK
480
+		if (isset($_POST['save-points-type'])) { // WPCS: CSRF OK
481 481
 
482
-			if ( isset( $_POST['points-slug'] ) ) { // WPCS: CSRF OK
482
+			if (isset($_POST['points-slug'])) { // WPCS: CSRF OK
483 483
 				$this->update_points_type();
484 484
 			} else {
485 485
 				$this->add_points_type();
486 486
 			}
487 487
 
488
-		} elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK
488
+		} elseif ( ! empty($_POST['delete-points-type'])) { // WPCS: CSRF OK
489 489
 
490 490
 			$this->delete_points_type();
491 491
 		}
@@ -502,21 +502,21 @@  discard block
 block discarded – undo
502 502
 
503 503
 		$settings = array();
504 504
 
505
-		if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK
505
+		if (isset($_POST['points-name'])) { // WPCS: CSRF OK
506 506
 			$settings['name'] = trim(
507
-				sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK
507
+				sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK
508 508
 			);
509 509
 		}
510 510
 
511
-		if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK
511
+		if (isset($_POST['points-prefix'])) { // WPCS: CSRF OK
512 512
 			$settings['prefix'] = ltrim(
513
-				sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK
513
+				sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK
514 514
 			);
515 515
 		}
516 516
 
517
-		if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK
517
+		if (isset($_POST['points-suffix'])) { // WPCS: CSRF OK
518 518
 			$settings['suffix'] = rtrim(
519
-				sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK
519
+				sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK
520 520
 			);
521 521
 		}
522 522
 
@@ -534,52 +534,52 @@  discard block
 block discarded – undo
534 534
 			! wordpoints_verify_nonce(
535 535
 				'update_points_type'
536 536
 				, 'wordpoints_update_points_type-%s'
537
-				, array( 'points-slug' )
537
+				, array('points-slug')
538 538
 				, 'post'
539 539
 			)
540
-			|| ! isset( $_POST['points-slug'] )
540
+			|| ! isset($_POST['points-slug'])
541 541
 		) {
542 542
 			return;
543 543
 		}
544 544
 
545 545
 		$settings = $this->get_points_type_settings();
546 546
 
547
-		if ( empty( $settings['name'] ) ) {
547
+		if (empty($settings['name'])) {
548 548
 
549 549
 			add_settings_error(
550 550
 				'points-name'
551 551
 				, 'wordpoints_points_type_update'
552
-				, __( 'Error: points type name cannot be empty.', 'wordpoints' )
552
+				, __('Error: points type name cannot be empty.', 'wordpoints')
553 553
 			);
554 554
 
555 555
 			return;
556 556
 		}
557 557
 
558
-		$points_type = sanitize_key( $_POST['points-slug'] );
558
+		$points_type = sanitize_key($_POST['points-slug']);
559 559
 
560
-		$old_settings = wordpoints_get_points_type( $points_type );
560
+		$old_settings = wordpoints_get_points_type($points_type);
561 561
 
562
-		if ( false === $old_settings ) {
562
+		if (false === $old_settings) {
563 563
 
564 564
 			add_settings_error(
565 565
 				''
566 566
 				, 'wordpoints_points_type_update'
567
-				, __( 'Error: failed updating points type.', 'wordpoints' )
567
+				, __('Error: failed updating points type.', 'wordpoints')
568 568
 			);
569 569
 
570 570
 			return;
571 571
 		}
572 572
 
573
-		if ( is_array( $old_settings ) ) {
574
-			$settings = array_merge( $old_settings, $settings );
573
+		if (is_array($old_settings)) {
574
+			$settings = array_merge($old_settings, $settings);
575 575
 		}
576 576
 
577
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
577
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
578 578
 
579 579
 			add_settings_error(
580 580
 				''
581 581
 				, 'wordpoints_points_type_update'
582
-				, __( 'Error: failed updating points type.', 'wordpoints' )
582
+				, __('Error: failed updating points type.', 'wordpoints')
583 583
 			);
584 584
 
585 585
 		} else {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			add_settings_error(
588 588
 				''
589 589
 				, 'wordpoints_points_type_update'
590
-				, __( 'Points type updated.', 'wordpoints' )
590
+				, __('Points type updated.', 'wordpoints')
591 591
 				, 'updated'
592 592
 			);
593 593
 		}
@@ -613,14 +613,14 @@  discard block
 block discarded – undo
613 613
 
614 614
 		$settings = $this->get_points_type_settings();
615 615
 
616
-		$slug = wordpoints_add_points_type( $settings );
616
+		$slug = wordpoints_add_points_type($settings);
617 617
 
618
-		if ( ! $slug ) {
618
+		if ( ! $slug) {
619 619
 
620 620
 			add_settings_error(
621 621
 				''
622 622
 				, 'wordpoints_points_type_create'
623
-				, __( 'Please choose a unique name for this points type.', 'wordpoints' )
623
+				, __('Please choose a unique name for this points type.', 'wordpoints')
624 624
 			);
625 625
 
626 626
 		} else {
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			add_settings_error(
631 631
 				''
632 632
 				, 'wordpoints_points_type_create'
633
-				, __( 'Points type created.', 'wordpoints' )
633
+				, __('Points type created.', 'wordpoints')
634 634
 				, 'updated'
635 635
 			);
636 636
 		}
@@ -647,22 +647,22 @@  discard block
 block discarded – undo
647 647
 			wordpoints_verify_nonce(
648 648
 				'delete-points-type-nonce'
649 649
 				, 'wordpoints_delete_points_type-%s'
650
-				, array( 'points-slug' )
650
+				, array('points-slug')
651 651
 				, 'post'
652 652
 			)
653
-			&& isset( $_POST['points-slug'] )
653
+			&& isset($_POST['points-slug'])
654 654
 		) {
655 655
 
656 656
 			if (
657 657
 				wordpoints_delete_points_type(
658
-					sanitize_key( $_POST['points-slug'] )
658
+					sanitize_key($_POST['points-slug'])
659 659
 				)
660 660
 			) {
661 661
 
662 662
 				add_settings_error(
663 663
 					''
664 664
 					, 'wordpoints_points_type_delete'
665
-					, __( 'Points type deleted.', 'wordpoints' )
665
+					, __('Points type deleted.', 'wordpoints')
666 666
 					, 'updated'
667 667
 				);
668 668
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 				add_settings_error(
672 672
 					''
673 673
 					, 'wordpoints_points_type_delete'
674
-					, __( 'Error while deleting.', 'wordpoints' )
674
+					, __('Error while deleting.', 'wordpoints')
675 675
 				);
676 676
 			}
677 677
 		}
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 		 *
688 688
 		 * @since 1.0.0
689 689
 		 */
690
-		do_action( 'wordpoints_admin_points_events_head' );
690
+		do_action('wordpoints_admin_points_events_head');
691 691
 
692
-		if ( is_network_admin() ) {
693
-			$title = __( 'Network Events', 'wordpoints' );
694
-			$description = __( 'Award points when various events happen on this network.', 'wordpoints' );
692
+		if (is_network_admin()) {
693
+			$title = __('Network Events', 'wordpoints');
694
+			$description = __('Award points when various events happen on this network.', 'wordpoints');
695 695
 		} else {
696
-			$title = __( 'Events', 'wordpoints' );
697
-			$description = __( 'Award points when various events happen on this site.', 'wordpoints' );
696
+			$title = __('Events', 'wordpoints');
697
+			$description = __('Award points when various events happen on this site.', 'wordpoints');
698 698
 		}
699 699
 
700
-		$points_type = wordpoints_get_points_type( $this->current_points_type );
700
+		$points_type = wordpoints_get_points_type($this->current_points_type);
701 701
 
702 702
 		?>
703 703
 
704 704
 		<div class="wordpoints-points-type-meta-box-wrap">
705 705
 
706 706
 				<form>
707
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
708
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
707
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
708
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
709 709
 				</form>
710 710
 
711 711
 				<div id="poststuff">
@@ -713,17 +713,17 @@  discard block
 block discarded – undo
713 713
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
714 714
 
715 715
 						<div id="postbox-container-1" class="postbox-container">
716
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
716
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
717 717
 						</div>
718 718
 
719
-						<?php if ( isset( $this->current_points_type ) ) : ?>
719
+						<?php if (isset($this->current_points_type)) : ?>
720 720
 							<div class="wordpoints-hook-events-heading">
721
-								<h2><?php echo esc_html( $title ); ?></h2>
722
-								<p class="description"><?php echo esc_html( $description ); ?></p>
721
+								<h2><?php echo esc_html($title); ?></h2>
722
+								<p class="description"><?php echo esc_html($description); ?></p>
723 723
 							</div>
724 724
 
725 725
 							<div id="postbox-container-2" class="postbox-container">
726
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
726
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
727 727
 							</div>
728 728
 						<?php endif; ?>
729 729
 
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 		 *
743 743
 		 * @since 1.0.0
744 744
 		 */
745
-		do_action( 'wordpoints_admin_points_events_foot' );
745
+		do_action('wordpoints_admin_points_events_foot');
746 746
 	}
747 747
 }
748 748
 
Please login to merge, or discard this patch.