Completed
Push — master ( 5b2818...3f335f )
by J.D.
03:35
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/post/type.php' );
85
-require_once( $dir . '/hook/action/post/type/comment.php' );
86
-require_once( $dir . '/hook/action/comment/new.php' );
87
-require_once( $dir . '/hook/action/post/depublish/delete.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/post/type.php');
85
+require_once($dir.'/hook/action/post/type/comment.php');
86
+require_once($dir.'/hook/action/comment/new.php');
87
+require_once($dir.'/hook/action/post/depublish/delete.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   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -189,24 +189,24 @@  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
-		if ( ! $this->reaction_store ) {
209
+		if ( ! $this->reaction_store) {
210 210
 			return;
211 211
 		}
212 212
 
@@ -214,24 +214,24 @@  discard block
 block discarded – undo
214 214
 			$this->hook_mode
215 215
 		);
216 216
 
217
-		foreach ( $this->legacy_instances as $number => $legacy_instance ) {
218
-			$this->import_instance( $legacy_instance, $number );
217
+		foreach ($this->legacy_instances as $number => $legacy_instance) {
218
+			$this->import_instance($legacy_instance, $number);
219 219
 		}
220 220
 
221 221
 		// This means that all of the instances were imported successfully.
222
-		if ( empty( $this->legacy_instances ) ) {
222
+		if (empty($this->legacy_instances)) {
223 223
 
224 224
 			$option = 'wordpoints_legacy_points_hooks_disabled';
225 225
 
226
-			$disabled = $this->get_array_option( $option );
227
-			$disabled[ $this->legacy_id_base ] = true;
226
+			$disabled = $this->get_array_option($option);
227
+			$disabled[$this->legacy_id_base] = true;
228 228
 
229
-			$this->update_option( $option, $disabled );
229
+			$this->update_option($option, $disabled);
230 230
 		}
231 231
 
232
-		WordPoints_Points_Hooks::save_points_types_hooks( $this->points_types_hooks );
232
+		WordPoints_Points_Hooks::save_points_types_hooks($this->points_types_hooks);
233 233
 
234
-		$this->update_option( $imported_option, $this->imported_hooks );
234
+		$this->update_option($imported_option, $this->imported_hooks);
235 235
 	}
236 236
 
237 237
 	/**
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return bool Whether the instance was successfully converted to a reaction.
246 246
 	 */
247
-	protected function import_instance( $legacy_instance, $number ) {
247
+	protected function import_instance($legacy_instance, $number) {
248 248
 
249 249
 		$this->legacy_instance = $legacy_instance;
250 250
 
251
-		if ( ! $this->should_import_instance() ) {
251
+		if ( ! $this->should_import_instance()) {
252 252
 			return false;
253 253
 		}
254 254
 
255
-		$this->legacy_handler->set_number( $number );
255
+		$this->legacy_handler->set_number($number);
256 256
 
257 257
 		$points_type = $this->legacy_handler->points_type(
258 258
 			'network' === $this->hook_mode ? "network_{$number}" : $number
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 		$order = array_search(
272 272
 			$this->legacy_handler->get_id()
273
-			, $this->points_types_hooks[ $points_type ]
273
+			, $this->points_types_hooks[$points_type]
274 274
 			, true
275 275
 		);
276 276
 
@@ -279,21 +279,21 @@  discard block
 block discarded – undo
279 279
 			$order
280 280
 		);
281 281
 
282
-		if ( ! isset( $reaction_settings['log_text'] ) ) {
282
+		if ( ! isset($reaction_settings['log_text'])) {
283 283
 			$reaction_settings['log_text'] = $this->get_log_text_for_instance(
284 284
 				$points_type
285 285
 			);
286 286
 		}
287 287
 
288
-		if ( ! $this->create_reaction( $reaction_settings, $order ) ) {
288
+		if ( ! $this->create_reaction($reaction_settings, $order)) {
289 289
 			return false;
290 290
 		}
291 291
 
292
-		$this->legacy_handler->delete_callback( $number );
292
+		$this->legacy_handler->delete_callback($number);
293 293
 
294 294
 		unset(
295
-			$this->points_types_hooks[ $points_type ][ $order ]
296
-			, $this->legacy_instances[ $number ]
295
+			$this->points_types_hooks[$points_type][$order]
296
+			, $this->legacy_instances[$number]
297 297
 		);
298 298
 
299 299
 		return true;
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
 	protected function should_import_instance() {
310 310
 
311 311
 		// We ignore certain settings...
312
-		$ignored = array( '_description' => true );
312
+		$ignored = array('_description' => true);
313 313
 
314 314
 		// But if there are any other unexpected ones, we really can't safely import.
315
-		if ( array_diff_key( $this->legacy_instance, $this->expected_settings, $ignored ) ) {
315
+		if (array_diff_key($this->legacy_instance, $this->expected_settings, $ignored)) {
316 316
 			return false;
317 317
 		}
318 318
 
319 319
 		if (
320 320
 			$this->skip_non_reversing_hooks
321
-			&& isset( $this->legacy_instance['auto_reverse'] )
321
+			&& isset($this->legacy_instance['auto_reverse'])
322 322
 			&& ! $this->legacy_instance['auto_reverse']
323 323
 		) {
324 324
 			return false;
@@ -337,22 +337,22 @@  discard block
 block discarded – undo
337 337
 	 *
338 338
 	 * @return string The log text derived from this instance.
339 339
 	 */
340
-	protected function get_log_text_for_instance( $points_type, $meta = array() ) {
340
+	protected function get_log_text_for_instance($points_type, $meta = array()) {
341 341
 
342
-		if ( ! method_exists( $this->legacy_handler, 'logs' ) ) {
343
-			return $this->legacy_handler->get_option( 'description' );
342
+		if ( ! method_exists($this->legacy_handler, 'logs')) {
343
+			return $this->legacy_handler->get_option('description');
344 344
 		}
345 345
 
346 346
 		if (
347
-			! isset( $meta['post_type'] )
348
-			&& isset( $this->legacy_instance['post_type'] )
347
+			! isset($meta['post_type'])
348
+			&& isset($this->legacy_instance['post_type'])
349 349
 		) {
350 350
 			$meta['post_type'] = $this->legacy_instance['post_type'];
351 351
 		}
352 352
 
353 353
 		if (
354
-			! isset( $meta['period'] )
355
-			&& isset( $this->legacy_instance['period'] )
354
+			! isset($meta['period'])
355
+			&& isset($this->legacy_instance['period'])
356 356
 		) {
357 357
 			$meta['period'] = $this->legacy_instance['period'];
358 358
 		}
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
 	 *
380 380
 	 * @return array The modified settings.
381 381
 	 */
382
-	protected function filter_reaction_settings( $settings, $order ) {
382
+	protected function filter_reaction_settings($settings, $order) {
383 383
 
384
-		if ( 'wordpoints_periodic_points_hook' !== $this->legacy_id_base ) {
384
+		if ('wordpoints_periodic_points_hook' !== $this->legacy_id_base) {
385 385
 			// We do this even if reversals will be blocked, in case the blocking
386 386
 			// is ever removed for this reaction.
387 387
 			$settings['reversals_legacy_points'] = array(
@@ -390,23 +390,23 @@  discard block
 block discarded – undo
390 390
 		}
391 391
 
392 392
 		if (
393
-			isset( $this->legacy_instance['auto_reverse'] )
393
+			isset($this->legacy_instance['auto_reverse'])
394 394
 			&& ! $this->legacy_instance['auto_reverse']
395 395
 		) {
396 396
 			$settings['blocker']['toggle_off'] = true;
397 397
 		}
398 398
 
399
-		if ( isset( $this->legacy_instance['post_type'] ) ) {
399
+		if (isset($this->legacy_instance['post_type'])) {
400 400
 
401 401
 			$post_type = $this->legacy_instance['post_type'];
402 402
 
403
-			if ( 'ALL' === $post_type ) {
403
+			if ('ALL' === $post_type) {
404 404
 
405
-				$post_type_slugs = get_post_types( array( 'public' => true ) );
405
+				$post_type_slugs = get_post_types(array('public' => true));
406 406
 
407
-				$post_type = array_pop( $post_type_slugs );
407
+				$post_type = array_pop($post_type_slugs);
408 408
 
409
-				foreach ( $post_type_slugs as $post_type_slug ) {
409
+				foreach ($post_type_slugs as $post_type_slug) {
410 410
 
411 411
 					$this->create_reaction(
412 412
 						$this->format_settings_for_post_type(
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 	 *
438 438
 	 * @return array The settings modified for this particular post type.
439 439
 	 */
440
-	protected function format_settings_for_post_type( $post_type, $settings ) {
440
+	protected function format_settings_for_post_type($post_type, $settings) {
441 441
 
442
-		if ( 'attachment' === $post_type ) {
442
+		if ('attachment' === $post_type) {
443 443
 
444 444
 			$settings['event'] = 'media_upload';
445 445
 
@@ -447,20 +447,20 @@  discard block
 block discarded – undo
447 447
 
448 448
 			$settings['event'] = str_replace(
449 449
 				'\post'
450
-				, '\\' . $post_type
450
+				, '\\'.$post_type
451 451
 				, $settings['event']
452 452
 			);
453 453
 		}
454 454
 
455 455
 		$settings['target'] = str_replace(
456 456
 			'\post'
457
-			, '\\' . $post_type
457
+			, '\\'.$post_type
458 458
 			, $settings['target']
459 459
 		);
460 460
 
461 461
 		$settings['log_text'] = $this->get_log_text_for_instance(
462 462
 			$settings['points_type']
463
-			, array( 'post_type' => $post_type )
463
+			, array('post_type' => $post_type)
464 464
 		);
465 465
 
466 466
 		return $settings;
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false.
478 478
 	 */
479
-	protected function create_reaction( $settings, $order ) {
479
+	protected function create_reaction($settings, $order) {
480 480
 
481
-		$reaction = $this->reaction_store->create_reaction( $settings );
481
+		$reaction = $this->reaction_store->create_reaction($settings);
482 482
 
483
-		if ( ! $reaction instanceof WordPoints_Hook_ReactionI ) {
483
+		if ( ! $reaction instanceof WordPoints_Hook_ReactionI) {
484 484
 			return false;
485 485
 		}
486 486
 
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @return bool Whether the option was updated successfully.
507 507
 	 */
508
-	protected function update_option( $option, $value ) {
508
+	protected function update_option($option, $value) {
509 509
 
510
-		if ( 'network' === $this->hook_mode ) {
511
-			return update_site_option( $option, $value );
510
+		if ('network' === $this->hook_mode) {
511
+			return update_site_option($option, $value);
512 512
 		} else {
513
-			return update_option( $option, $value );
513
+			return update_option($option, $value);
514 514
 		}
515 515
 	}
516 516
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 	 *
524 524
 	 * @return array The option value.
525 525
 	 */
526
-	protected function get_array_option( $option ) {
526
+	protected function get_array_option($option) {
527 527
 
528 528
 		return wordpoints_get_array_option(
529 529
 			$option
Please login to merge, or discard this patch.
src/admin/includes/classes/screen/points/types.php 1 patch
Spacing   +120 added lines, -120 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,22 +300,22 @@  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
-		if ( ! $this->reaction_store ) {
312
+		if ( ! $this->reaction_store) {
313 313
 			return;
314 314
 		}
315 315
 
316 316
 		/** @var WordPoints_Hook_ReactorI $reactor */
317
-		$reactor = $this->hooks->get_sub_app( 'reactors' )->get( 'points' );
318
-		$reactor_action_types = array_fill_keys( $reactor->get_action_types(), true );
317
+		$reactor = $this->hooks->get_sub_app('reactors')->get('points');
318
+		$reactor_action_types = array_fill_keys($reactor->get_action_types(), true);
319 319
 
320 320
 		$event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types();
321 321
 
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 			, $this->current_points_type
341 341
 		);
342 342
 
343
-		foreach ( $events as $slug => $event ) {
343
+		foreach ($events as $slug => $event) {
344 344
 
345 345
 			if (
346 346
 				! array_intersect_key(
347
-					$event_action_types[ $slug ]
347
+					$event_action_types[$slug]
348 348
 					, $reactor_action_types
349 349
 				)
350 350
 			) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			add_meta_box(
355 355
 				"{$this->current_points_type}-{$slug}"
356 356
 				, $event->get_title()
357
-				, array( $this, 'display_event_meta_box' )
357
+				, array($this, 'display_event_meta_box')
358 358
 				, $this->id
359 359
 				, 'events'
360 360
 				, 'default'
@@ -375,50 +375,50 @@  discard block
 block discarded – undo
375 375
 	 * @param array $points_type The points type this meta-box relates to.
376 376
 	 * @param array $meta_box    The data the meta-box was created with.
377 377
 	 */
378
-	public function display_event_meta_box( $points_type, $meta_box ) {
378
+	public function display_event_meta_box($points_type, $meta_box) {
379 379
 
380 380
 		$event_slug = $meta_box['args']['slug'];
381 381
 
382 382
 		$data = array();
383 383
 
384
-		foreach ( $this->reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
385
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
384
+		foreach ($this->reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) {
385
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
386 386
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
387 387
 					$reaction
388 388
 				);
389 389
 			}
390 390
 		}
391 391
 
392
-		$event_data = array( 'args' => array() );
392
+		$event_data = array('args' => array());
393 393
 
394
-		foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) {
394
+		foreach ($this->event_args->get_children($event_slug) as $slug => $arg) {
395 395
 
396
-			$event_data['args'][ $slug ] = array(
396
+			$event_data['args'][$slug] = array(
397 397
 				'slug' => $slug,
398 398
 			);
399 399
 
400
-			if ( $arg instanceof WordPoints_Hook_ArgI ) {
401
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
402
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
400
+			if ($arg instanceof WordPoints_Hook_ArgI) {
401
+				$event_data['args'][$slug]['title'] = $arg->get_title();
402
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
403 403
 			}
404 404
 		}
405 405
 
406 406
 		?>
407 407
 
408 408
 		<script>
409
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
410
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
409
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
410
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
411 411
 		</script>
412 412
 
413 413
 		<div class="wordpoints-hook-reaction-group-container">
414 414
 			<p class="description wordpoints-hook-reaction-group-description">
415
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
415
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
416 416
 			</p>
417 417
 
418 418
 			<div class="wordpoints-hook-reaction-group"
419
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
420
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
421
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $this->reaction_store ) ); ?>"
419
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
420
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
421
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($this->reaction_store)); ?>"
422 422
 				data-wordpoints-hooks-reaction-store="points"
423 423
 				data-wordpoints-hooks-reactor="points">
424 424
 			</div>
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
 			<div class="controls">
435 435
 				<button type="button" class="button-primary add-reaction">
436
-					<?php esc_html_e( 'Add New', 'wordpoints' ); ?>
436
+					<?php esc_html_e('Add New', 'wordpoints'); ?>
437 437
 				</button>
438 438
 			</div>
439 439
 		</div>
@@ -453,19 +453,19 @@  discard block
 block discarded – undo
453 453
 		// Show a tab for each points type.
454 454
 		$tabs = array();
455 455
 
456
-		foreach ( $points_types as $slug => $settings ) {
457
-			$tabs[ $slug ] = $settings['name'];
456
+		foreach ($points_types as $slug => $settings) {
457
+			$tabs[$slug] = $settings['name'];
458 458
 		}
459 459
 
460
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
460
+		$tabs['add-new'] = __('Add New', 'wordpoints');
461 461
 
462
-		$tab = wordpoints_admin_get_current_tab( $tabs );
462
+		$tab = wordpoints_admin_get_current_tab($tabs);
463 463
 
464
-		if ( 'add-new' !== $tab ) {
464
+		if ('add-new' !== $tab) {
465 465
 			$this->current_points_type = $tab;
466 466
 		}
467 467
 
468
-		do_action( 'add_meta_boxes', $this->id );
468
+		do_action('add_meta_boxes', $this->id);
469 469
 
470 470
 		$this->tabs = $tabs;
471 471
 	}
@@ -477,19 +477,19 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	public function save_points_type() {
479 479
 
480
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
480
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
481 481
 			return;
482 482
 		}
483 483
 
484
-		if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK
484
+		if (isset($_POST['save-points-type'])) { // WPCS: CSRF OK
485 485
 
486
-			if ( isset( $_POST['points-slug'] ) ) { // WPCS: CSRF OK
486
+			if (isset($_POST['points-slug'])) { // WPCS: CSRF OK
487 487
 				$this->update_points_type();
488 488
 			} else {
489 489
 				$this->add_points_type();
490 490
 			}
491 491
 
492
-		} elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK
492
+		} elseif ( ! empty($_POST['delete-points-type'])) { // WPCS: CSRF OK
493 493
 
494 494
 			$this->delete_points_type();
495 495
 		}
@@ -506,21 +506,21 @@  discard block
 block discarded – undo
506 506
 
507 507
 		$settings = array();
508 508
 
509
-		if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK
509
+		if (isset($_POST['points-name'])) { // WPCS: CSRF OK
510 510
 			$settings['name'] = trim(
511
-				sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK
511
+				sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK
512 512
 			);
513 513
 		}
514 514
 
515
-		if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK
515
+		if (isset($_POST['points-prefix'])) { // WPCS: CSRF OK
516 516
 			$settings['prefix'] = ltrim(
517
-				sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK
517
+				sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK
518 518
 			);
519 519
 		}
520 520
 
521
-		if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK
521
+		if (isset($_POST['points-suffix'])) { // WPCS: CSRF OK
522 522
 			$settings['suffix'] = rtrim(
523
-				sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK
523
+				sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK
524 524
 			);
525 525
 		}
526 526
 
@@ -538,52 +538,52 @@  discard block
 block discarded – undo
538 538
 			! wordpoints_verify_nonce(
539 539
 				'update_points_type'
540 540
 				, 'wordpoints_update_points_type-%s'
541
-				, array( 'points-slug' )
541
+				, array('points-slug')
542 542
 				, 'post'
543 543
 			)
544
-			|| ! isset( $_POST['points-slug'] )
544
+			|| ! isset($_POST['points-slug'])
545 545
 		) {
546 546
 			return;
547 547
 		}
548 548
 
549 549
 		$settings = $this->get_points_type_settings();
550 550
 
551
-		if ( empty( $settings['name'] ) ) {
551
+		if (empty($settings['name'])) {
552 552
 
553 553
 			add_settings_error(
554 554
 				'points-name'
555 555
 				, 'wordpoints_points_type_update'
556
-				, __( 'Error: points type name cannot be empty.', 'wordpoints' )
556
+				, __('Error: points type name cannot be empty.', 'wordpoints')
557 557
 			);
558 558
 
559 559
 			return;
560 560
 		}
561 561
 
562
-		$points_type = sanitize_key( $_POST['points-slug'] );
562
+		$points_type = sanitize_key($_POST['points-slug']);
563 563
 
564
-		$old_settings = wordpoints_get_points_type( $points_type );
564
+		$old_settings = wordpoints_get_points_type($points_type);
565 565
 
566
-		if ( false === $old_settings ) {
566
+		if (false === $old_settings) {
567 567
 
568 568
 			add_settings_error(
569 569
 				''
570 570
 				, 'wordpoints_points_type_update'
571
-				, __( 'Error: failed updating points type.', 'wordpoints' )
571
+				, __('Error: failed updating points type.', 'wordpoints')
572 572
 			);
573 573
 
574 574
 			return;
575 575
 		}
576 576
 
577
-		if ( is_array( $old_settings ) ) {
578
-			$settings = array_merge( $old_settings, $settings );
577
+		if (is_array($old_settings)) {
578
+			$settings = array_merge($old_settings, $settings);
579 579
 		}
580 580
 
581
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
581
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
582 582
 
583 583
 			add_settings_error(
584 584
 				''
585 585
 				, 'wordpoints_points_type_update'
586
-				, __( 'Error: failed updating points type.', 'wordpoints' )
586
+				, __('Error: failed updating points type.', 'wordpoints')
587 587
 			);
588 588
 
589 589
 		} else {
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 			add_settings_error(
592 592
 				''
593 593
 				, 'wordpoints_points_type_update'
594
-				, __( 'Points type updated.', 'wordpoints' )
594
+				, __('Points type updated.', 'wordpoints')
595 595
 				, 'updated'
596 596
 			);
597 597
 		}
@@ -617,14 +617,14 @@  discard block
 block discarded – undo
617 617
 
618 618
 		$settings = $this->get_points_type_settings();
619 619
 
620
-		$slug = wordpoints_add_points_type( $settings );
620
+		$slug = wordpoints_add_points_type($settings);
621 621
 
622
-		if ( ! $slug ) {
622
+		if ( ! $slug) {
623 623
 
624 624
 			add_settings_error(
625 625
 				''
626 626
 				, 'wordpoints_points_type_create'
627
-				, __( 'Please choose a unique name for this points type.', 'wordpoints' )
627
+				, __('Please choose a unique name for this points type.', 'wordpoints')
628 628
 			);
629 629
 
630 630
 		} else {
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 			add_settings_error(
635 635
 				''
636 636
 				, 'wordpoints_points_type_create'
637
-				, __( 'Points type created.', 'wordpoints' )
637
+				, __('Points type created.', 'wordpoints')
638 638
 				, 'updated'
639 639
 			);
640 640
 		}
@@ -651,22 +651,22 @@  discard block
 block discarded – undo
651 651
 			wordpoints_verify_nonce(
652 652
 				'delete-points-type-nonce'
653 653
 				, 'wordpoints_delete_points_type-%s'
654
-				, array( 'points-slug' )
654
+				, array('points-slug')
655 655
 				, 'post'
656 656
 			)
657
-			&& isset( $_POST['points-slug'] )
657
+			&& isset($_POST['points-slug'])
658 658
 		) {
659 659
 
660 660
 			if (
661 661
 				wordpoints_delete_points_type(
662
-					sanitize_key( $_POST['points-slug'] )
662
+					sanitize_key($_POST['points-slug'])
663 663
 				)
664 664
 			) {
665 665
 
666 666
 				add_settings_error(
667 667
 					''
668 668
 					, 'wordpoints_points_type_delete'
669
-					, __( 'Points type deleted.', 'wordpoints' )
669
+					, __('Points type deleted.', 'wordpoints')
670 670
 					, 'updated'
671 671
 				);
672 672
 
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 				add_settings_error(
676 676
 					''
677 677
 					, 'wordpoints_points_type_delete'
678
-					, __( 'Error while deleting.', 'wordpoints' )
678
+					, __('Error while deleting.', 'wordpoints')
679 679
 				);
680 680
 			}
681 681
 		}
@@ -691,25 +691,25 @@  discard block
 block discarded – undo
691 691
 		 *
692 692
 		 * @since 1.0.0
693 693
 		 */
694
-		do_action( 'wordpoints_admin_points_events_head' );
694
+		do_action('wordpoints_admin_points_events_head');
695 695
 
696
-		if ( is_network_admin() ) {
697
-			$title = __( 'Network Events', 'wordpoints' );
698
-			$description = __( 'Award points when various events happen on this network.', 'wordpoints' );
696
+		if (is_network_admin()) {
697
+			$title = __('Network Events', 'wordpoints');
698
+			$description = __('Award points when various events happen on this network.', 'wordpoints');
699 699
 		} else {
700
-			$title = __( 'Events', 'wordpoints' );
701
-			$description = __( 'Award points when various events happen on this site.', 'wordpoints' );
700
+			$title = __('Events', 'wordpoints');
701
+			$description = __('Award points when various events happen on this site.', 'wordpoints');
702 702
 		}
703 703
 
704
-		$points_type = wordpoints_get_points_type( $this->current_points_type );
704
+		$points_type = wordpoints_get_points_type($this->current_points_type);
705 705
 
706 706
 		?>
707 707
 
708 708
 		<div class="wordpoints-points-type-meta-box-wrap">
709 709
 
710 710
 				<form>
711
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
712
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
711
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
712
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
713 713
 				</form>
714 714
 
715 715
 				<div id="poststuff">
@@ -717,17 +717,17 @@  discard block
 block discarded – undo
717 717
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
718 718
 
719 719
 						<div id="postbox-container-1" class="postbox-container">
720
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
720
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
721 721
 						</div>
722 722
 
723
-						<?php if ( isset( $this->current_points_type ) ) : ?>
723
+						<?php if (isset($this->current_points_type)) : ?>
724 724
 							<div class="wordpoints-hook-events-heading">
725
-								<h2><?php echo esc_html( $title ); ?></h2>
726
-								<p class="description"><?php echo esc_html( $description ); ?></p>
725
+								<h2><?php echo esc_html($title); ?></h2>
726
+								<p class="description"><?php echo esc_html($description); ?></p>
727 727
 							</div>
728 728
 
729 729
 							<div id="postbox-container-2" class="postbox-container">
730
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
730
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
731 731
 							</div>
732 732
 						<?php endif; ?>
733 733
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 		 *
747 747
 		 * @since 1.0.0
748 748
 		 */
749
-		do_action( 'wordpoints_admin_points_events_foot' );
749
+		do_action('wordpoints_admin_points_events_foot');
750 750
 	}
751 751
 }
752 752
 
Please login to merge, or discard this patch.