Completed
Push — master ( 274f34...8ff377 )
by J.D.
04:05
created
src/admin/includes/classes/screen/points/types.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @since 1.0.0
57 57
 	 */
58 58
 	protected function get_title() {
59
-		return _x( 'Points Types', 'page title', 'wordpoints' );
59
+		return _x('Points Types', 'page title', 'wordpoints');
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
 		parent::hooks();
68 68
 
69
-		add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) );
70
-		add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) );
69
+		add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box'));
70
+		add_action('add_meta_boxes', array($this, 'add_event_meta_boxes'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function enqueue_scripts() {
77 77
 
78
-		wp_enqueue_style( 'wordpoints-hooks-admin' );
78
+		wp_enqueue_style('wordpoints-hooks-admin');
79 79
 
80
-		wp_enqueue_script( 'postbox' );
81
-		wp_enqueue_script( 'wordpoints-admin-points-types' );
80
+		wp_enqueue_script('postbox');
81
+		wp_enqueue_script('wordpoints-admin-points-types');
82 82
 
83 83
 		wordpoints_hooks_ui_setup_script_data();
84 84
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 					.addClass( 'closed' );
99 99
 
100 100
 				postboxes.add_postbox_toggles(
101
-					<?php echo wp_json_encode( $this->id ); ?>
101
+					<?php echo wp_json_encode($this->id); ?>
102 102
 				);
103 103
 			} );
104 104
 		</script>
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function add_points_settings_meta_box() {
115 115
 
116
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
116
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
117 117
 			return;
118 118
 		}
119 119
 
120 120
 		add_meta_box(
121 121
 			'settings'
122
-			, __( 'Settings', 'wordpoints' )
123
-			, array( $this, 'display_points_settings_meta_box' )
122
+			, __('Settings', 'wordpoints')
123
+			, array($this, 'display_points_settings_meta_box')
124 124
 			, $this->id
125 125
 			, 'side'
126 126
 			, 'default'
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function display_points_settings_meta_box() {
136 136
 
137
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
137
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
138 138
 			return;
139 139
 		}
140 140
 
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$add_new = 0;
144 144
 
145
-		$points_type = wordpoints_get_points_type( $slug );
145
+		$points_type = wordpoints_get_points_type($slug);
146 146
 
147
-		if ( ! $points_type ) {
147
+		if ( ! $points_type) {
148 148
 
149 149
 			$points_type = array();
150
-			$add_new     = wp_create_nonce( 'wordpoints_add_new_points_type' );
150
+			$add_new     = wp_create_nonce('wordpoints_add_new_points_type');
151 151
 		}
152 152
 
153 153
 		$points_type = array_merge(
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 		?>
163 163
 
164 164
 		<form method="post">
165
-			<?php if ( $slug ) : ?>
165
+			<?php if ($slug) : ?>
166 166
 				<p>
167 167
 					<span class="wordpoints-points-slug">
168 168
 						<em>
169
-							<?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?>
169
+							<?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?>
170 170
 						</em>
171 171
 					</span>
172 172
 				</p>
173
-				<?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?>
173
+				<?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?>
174 174
 			<?php endif; ?>
175 175
 
176 176
 			<?php
@@ -184,45 +184,45 @@  discard block
 block discarded – undo
184 184
 			 *
185 185
 			 * @param string $points_type The slug of the points type.
186 186
 			 */
187
-			do_action( 'wordpoints_points_type_form_top', $slug );
187
+			do_action('wordpoints_points_type_form_top', $slug);
188 188
 
189
-			if ( $add_new ) {
189
+			if ($add_new) {
190 190
 
191 191
 				// Mark the prefix and suffix optional on the add new form.
192
-				$prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' );
193
-				$suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' );
192
+				$prefix = _x('Prefix (optional):', 'points type', 'wordpoints');
193
+				$suffix = _x('Suffix (optional):', 'points type', 'wordpoints');
194 194
 
195 195
 			} else {
196 196
 
197
-				$prefix = _x( 'Prefix:', 'points type', 'wordpoints' );
198
-				$suffix = _x( 'Suffix:', 'points type', 'wordpoints' );
197
+				$prefix = _x('Prefix:', 'points type', 'wordpoints');
198
+				$suffix = _x('Suffix:', 'points type', 'wordpoints');
199 199
 			}
200 200
 
201 201
 			?>
202 202
 
203 203
 			<p>
204 204
 				<label
205
-					for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label>
205
+					for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label>
206 206
 				<input class="widefat" type="text"
207
-				       id="points-name-<?php echo esc_attr( $slug ); ?>"
207
+				       id="points-name-<?php echo esc_attr($slug); ?>"
208 208
 				       name="points-name"
209
-				       value="<?php echo esc_attr( $points_type['name'] ); ?>"/>
209
+				       value="<?php echo esc_attr($points_type['name']); ?>"/>
210 210
 			</p>
211 211
 			<p>
212 212
 				<label
213
-					for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label>
213
+					for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label>
214 214
 				<input class="widefat" type="text"
215
-				       id="points-prefix-<?php echo esc_attr( $slug ); ?>"
215
+				       id="points-prefix-<?php echo esc_attr($slug); ?>"
216 216
 				       name="points-prefix"
217
-				       value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/>
217
+				       value="<?php echo esc_attr($points_type['prefix']); ?>"/>
218 218
 			</p>
219 219
 			<p>
220 220
 				<label
221
-					for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label>
221
+					for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label>
222 222
 				<input class="widefat" type="text"
223
-				       id="points-suffix-<?php echo esc_attr( $slug ); ?>"
223
+				       id="points-suffix-<?php echo esc_attr($slug); ?>"
224 224
 				       name="points-suffix"
225
-				       value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/>
225
+				       value="<?php echo esc_attr($points_type['suffix']); ?>"/>
226 226
 			</p>
227 227
 
228 228
 			<?php
@@ -236,28 +236,28 @@  discard block
 block discarded – undo
236 236
 			 *
237 237
 			 * @param string $points_type The slug of the points type.
238 238
 			 */
239
-			do_action( 'wordpoints_points_type_form_bottom', $slug );
239
+			do_action('wordpoints_points_type_form_bottom', $slug);
240 240
 
241 241
 			?>
242 242
 
243 243
 			<input type="hidden" name="points-slug"
244
-			       value="<?php echo esc_attr( $slug ); ?>"/>
244
+			       value="<?php echo esc_attr($slug); ?>"/>
245 245
 			<input type="hidden" name="add_new" class="add_new"
246
-			       value="<?php echo esc_attr( $add_new ); ?>"/>
246
+			       value="<?php echo esc_attr($add_new); ?>"/>
247 247
 
248 248
 			<div class="hook-control-actions">
249 249
 				<div class="alignleft">
250 250
 					<?php
251 251
 
252
-					if ( ! $add_new ) {
253
-						wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' );
254
-						submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) );
252
+					if ( ! $add_new) {
253
+						wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce');
254
+						submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}"));
255 255
 					}
256 256
 
257 257
 					?>
258 258
 				</div>
259 259
 				<div class="alignright">
260
-					<?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?>
260
+					<?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?>
261 261
 					<span class="spinner"></span>
262 262
 				</div>
263 263
 				<br class="clear"/>
@@ -274,17 +274,17 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	public function add_event_meta_boxes() {
276 276
 
277
-		if ( ! $this->current_points_type ) {
277
+		if ( ! $this->current_points_type) {
278 278
 			return;
279 279
 		}
280 280
 
281 281
 		/** @var WordPoints_Hook_EventI $event */
282
-		foreach ( $this->hooks->events->get_all() as $slug => $event ) {
282
+		foreach ($this->hooks->events->get_all() as $slug => $event) {
283 283
 
284 284
 			add_meta_box(
285 285
 				"{$this->current_points_type}-{$slug}"
286 286
 				, $event->get_title()
287
-				, array( $this, 'display_event_meta_box' )
287
+				, array($this, 'display_event_meta_box')
288 288
 				, $this->id
289 289
 				, 'events'
290 290
 				, 'default'
@@ -305,54 +305,54 @@  discard block
 block discarded – undo
305 305
 	 * @param array $points_type The points type this meta-box relates to.
306 306
 	 * @param array $meta_box    The data the meta-box was created with.
307 307
 	 */
308
-	public function display_event_meta_box( $points_type, $meta_box ) {
308
+	public function display_event_meta_box($points_type, $meta_box) {
309 309
 
310 310
 		$event_slug = $meta_box['args']['slug'];
311 311
 
312 312
 		$data = array();
313 313
 
314
-		$reaction_store = wordpoints_hooks()->get_reaction_store( 'points' );
314
+		$reaction_store = wordpoints_hooks()->get_reaction_store('points');
315 315
 
316
-		foreach ( $reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
317
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
316
+		foreach ($reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) {
317
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
318 318
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
319 319
 					$reaction
320 320
 				);
321 321
 			}
322 322
 		}
323 323
 
324
-		$args = $this->hooks->events->args->get_children( $event_slug );
324
+		$args = $this->hooks->events->args->get_children($event_slug);
325 325
 
326
-		$event_data = array( 'args' => array() );
326
+		$event_data = array('args' => array());
327 327
 
328
-		foreach ( $args as $slug => $arg ) {
328
+		foreach ($args as $slug => $arg) {
329 329
 
330
-			$event_data['args'][ $slug ] = array(
330
+			$event_data['args'][$slug] = array(
331 331
 				'slug' => $slug,
332 332
 			);
333 333
 
334
-			if ( $arg instanceof WordPoints_Hook_Arg ) {
335
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
336
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
334
+			if ($arg instanceof WordPoints_Hook_Arg) {
335
+				$event_data['args'][$slug]['title'] = $arg->get_title();
336
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
337 337
 			}
338 338
 		}
339 339
 
340 340
 		?>
341 341
 
342 342
 		<script>
343
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
344
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
343
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
344
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
345 345
 		</script>
346 346
 
347 347
 		<div class="wordpoints-hook-reaction-group-container">
348 348
 			<p class="description wordpoints-hook-reaction-group-description">
349
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
349
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
350 350
 			</p>
351 351
 
352 352
 			<div class="wordpoints-hook-reaction-group"
353
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
354
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
355
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $reaction_store ) ); ?>"
353
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
354
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
355
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($reaction_store)); ?>"
356 356
 				data-wordpoints-hooks-reaction-store="points"
357 357
 				data-wordpoints-hooks-reactor="points">
358 358
 			</div>
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
 			<div class="controls">
369 369
 				<button type="button" class="button-primary add-reaction">
370
-					<?php esc_html_e( 'Add New', 'wordpoints' ); ?>
370
+					<?php esc_html_e('Add New', 'wordpoints'); ?>
371 371
 				</button>
372 372
 			</div>
373 373
 		</div>
@@ -387,19 +387,19 @@  discard block
 block discarded – undo
387 387
 		// Show a tab for each points type.
388 388
 		$tabs = array();
389 389
 
390
-		foreach ( $points_types as $slug => $settings ) {
391
-			$tabs[ $slug ] = $settings['name'];
390
+		foreach ($points_types as $slug => $settings) {
391
+			$tabs[$slug] = $settings['name'];
392 392
 		}
393 393
 
394
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
394
+		$tabs['add-new'] = __('Add New', 'wordpoints');
395 395
 
396
-		$tab = wordpoints_admin_get_current_tab( $tabs );
396
+		$tab = wordpoints_admin_get_current_tab($tabs);
397 397
 
398
-		if ( 'add-new' !== $tab ) {
398
+		if ('add-new' !== $tab) {
399 399
 			$this->current_points_type = $tab;
400 400
 		}
401 401
 
402
-		do_action( 'add_meta_boxes', $this->id );
402
+		do_action('add_meta_boxes', $this->id);
403 403
 
404 404
 		$this->tabs = $tabs;
405 405
 	}
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	public function save_points_type() {
413 413
 
414
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
414
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
415 415
 			return;
416 416
 		}
417 417
 
418
-		if ( isset( $_POST['save-points-type'] ) ) {
418
+		if (isset($_POST['save-points-type'])) {
419 419
 			
420
-			if ( isset( $_POST['points-slug'] ) ) {
420
+			if (isset($_POST['points-slug'])) {
421 421
 				$this->update_points_type();
422 422
 			} else {
423 423
 				$this->add_points_type();
424 424
 			}
425 425
 
426
-		} elseif ( ! empty( $_POST['delete-points-type'] ) ) {
426
+		} elseif ( ! empty($_POST['delete-points-type'])) {
427 427
 			
428 428
 			$this->delete_points_type();
429 429
 		}
@@ -440,21 +440,21 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$settings = array();
442 442
 
443
-		if ( isset( $_POST['points-name'] ) ) {
443
+		if (isset($_POST['points-name'])) {
444 444
 			$settings['name'] = trim(
445
-				sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK
445
+				sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK
446 446
 			);
447 447
 		}
448 448
 
449
-		if ( isset( $_POST['points-prefix'] ) ) {
449
+		if (isset($_POST['points-prefix'])) {
450 450
 			$settings['prefix'] = ltrim(
451
-				sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK
451
+				sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK
452 452
 			);
453 453
 		}
454 454
 
455
-		if ( isset( $_POST['points-suffix'] ) ) {
455
+		if (isset($_POST['points-suffix'])) {
456 456
 			$settings['suffix'] = rtrim(
457
-				sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK
457
+				sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK
458 458
 			);
459 459
 		}
460 460
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			! wordpoints_verify_nonce(
473 473
 				'update_points_type'
474 474
 				, 'wordpoints_update_points_type-%s'
475
-				, array( 'points-slug' )
475
+				, array('points-slug')
476 476
 				, 'post'
477 477
 			)
478 478
 		) {
@@ -481,42 +481,42 @@  discard block
 block discarded – undo
481 481
 
482 482
 		$settings = $this->get_points_type_settings();
483 483
 		
484
-		if ( empty( $settings['name'] ) ) {
484
+		if (empty($settings['name'])) {
485 485
 
486 486
 			add_settings_error(
487 487
 				'points-name'
488 488
 				, 'wordpoints_points_type_update'
489
-				, __( 'Error: points type name cannot be empty.', 'wordpoints' )
489
+				, __('Error: points type name cannot be empty.', 'wordpoints')
490 490
 			);
491 491
 
492 492
 			return;
493 493
 		}
494 494
 
495
-		$points_type = sanitize_key( $_POST['points-slug'] );
495
+		$points_type = sanitize_key($_POST['points-slug']);
496 496
 
497
-		$old_settings = wordpoints_get_points_type( $points_type );
497
+		$old_settings = wordpoints_get_points_type($points_type);
498 498
 
499
-		if ( false === $old_settings ) {
499
+		if (false === $old_settings) {
500 500
 
501 501
 			add_settings_error(
502 502
 				''
503 503
 				, 'wordpoints_points_type_update'
504
-				, __( 'Error: failed updating points type.', 'wordpoints' )
504
+				, __('Error: failed updating points type.', 'wordpoints')
505 505
 			);
506 506
 
507 507
 			return;
508 508
 		}
509 509
 
510
-		if ( is_array( $old_settings ) ) {
511
-			$settings = array_merge( $old_settings, $settings );
510
+		if (is_array($old_settings)) {
511
+			$settings = array_merge($old_settings, $settings);
512 512
 		}
513 513
 
514
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
514
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
515 515
 
516 516
 			add_settings_error(
517 517
 				''
518 518
 				, 'wordpoints_points_type_update'
519
-				, __( 'Error: failed updating points type.', 'wordpoints' )
519
+				, __('Error: failed updating points type.', 'wordpoints')
520 520
 			);
521 521
 
522 522
 		} else {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 			add_settings_error(
525 525
 				''
526 526
 				, 'wordpoints_points_type_update'
527
-				, __( 'Points type updated.', 'wordpoints' )
527
+				, __('Points type updated.', 'wordpoints')
528 528
 				, 'updated'
529 529
 			);
530 530
 		}
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
 			
551 551
 		$settings = $this->get_points_type_settings();
552 552
 		
553
-		$slug = wordpoints_add_points_type( $settings );
553
+		$slug = wordpoints_add_points_type($settings);
554 554
 
555
-		if ( ! $slug ) {
555
+		if ( ! $slug) {
556 556
 
557 557
 			add_settings_error(
558 558
 				''
559 559
 				, 'wordpoints_points_type_create'
560
-				, __( 'Please choose a unique name for this points type.', 'wordpoints' )
560
+				, __('Please choose a unique name for this points type.', 'wordpoints')
561 561
 			);
562 562
 
563 563
 		} else {
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 			add_settings_error(
568 568
 				''
569 569
 				, 'wordpoints_points_type_create'
570
-				, __( 'Points type created.', 'wordpoints' )
570
+				, __('Points type created.', 'wordpoints')
571 571
 				, 'updated'
572 572
 			);
573 573
 		}
@@ -581,25 +581,25 @@  discard block
 block discarded – undo
581 581
 	protected function delete_points_type() {
582 582
 		
583 583
 		if (
584
-			isset( $_POST['points-slug'] )
584
+			isset($_POST['points-slug'])
585 585
 		   && wordpoints_verify_nonce(
586 586
 				'delete-points-type-nonce'
587 587
 				, 'wordpoints_delete_points_type-%s'
588
-				, array( 'points-slug' )
588
+				, array('points-slug')
589 589
 				, 'post'
590 590
 			)
591 591
 		) {
592 592
 			
593 593
 			if (
594 594
 				wordpoints_delete_points_type(
595
-					sanitize_key( $_POST['points-slug'] )
595
+					sanitize_key($_POST['points-slug'])
596 596
 				)
597 597
 			) {
598 598
 
599 599
 				add_settings_error(
600 600
 					''
601 601
 					, 'wordpoints_points_type_delete'
602
-					, __( 'Points type deleted.', 'wordpoints' )
602
+					, __('Points type deleted.', 'wordpoints')
603 603
 					, 'updated'
604 604
 				);
605 605
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 				add_settings_error(
609 609
 					''
610 610
 					, 'wordpoints_points_type_delete'
611
-					, __( 'Error while deleting.', 'wordpoints' )
611
+					, __('Error while deleting.', 'wordpoints')
612 612
 				);
613 613
 			}
614 614
 		}
@@ -624,25 +624,25 @@  discard block
 block discarded – undo
624 624
 		 *
625 625
 		 * @since 1.0.0
626 626
 		 */
627
-		do_action( 'wordpoints_admin_points_events_head' );
627
+		do_action('wordpoints_admin_points_events_head');
628 628
 
629
-		if ( is_network_admin() ) {
630
-			$title = __( 'Network Events', 'wordpoints' );
631
-			$description = __( 'Award points when various events happen on this network.', 'wordpoints' );
629
+		if (is_network_admin()) {
630
+			$title = __('Network Events', 'wordpoints');
631
+			$description = __('Award points when various events happen on this network.', 'wordpoints');
632 632
 		} else {
633
-			$title = __( 'Events', 'wordpoints' );
634
-			$description = __( 'Award points when various events happen on this site.', 'wordpoints' );
633
+			$title = __('Events', 'wordpoints');
634
+			$description = __('Award points when various events happen on this site.', 'wordpoints');
635 635
 		}
636 636
 
637
-		$points_type = wordpoints_get_points_type( $this->current_points_type );
637
+		$points_type = wordpoints_get_points_type($this->current_points_type);
638 638
 
639 639
 		?>
640 640
 
641 641
 		<div class="wordpoints-points-type-meta-box-wrap">
642 642
 
643 643
 				<form>
644
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
645
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
644
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
645
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
646 646
 				</form>
647 647
 
648 648
 				<div id="poststuff">
@@ -650,17 +650,17 @@  discard block
 block discarded – undo
650 650
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
651 651
 
652 652
 						<div id="postbox-container-1" class="postbox-container">
653
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
653
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
654 654
 						</div>
655 655
 
656
-						<?php if ( isset( $this->current_points_type ) ) : ?>
656
+						<?php if (isset($this->current_points_type)) : ?>
657 657
 							<div class="wordpoints-hook-events-heading">
658
-								<h2><?php echo esc_html( $title ); ?></h2>
659
-								<p class="description"><?php echo esc_html( $description ); ?></p>
658
+								<h2><?php echo esc_html($title); ?></h2>
659
+								<p class="description"><?php echo esc_html($description); ?></p>
660 660
 							</div>
661 661
 
662 662
 							<div id="postbox-container-2" class="postbox-container">
663
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
663
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
664 664
 							</div>
665 665
 						<?php endif; ?>
666 666
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		 *
680 680
 		 * @since 1.0.0
681 681
 		 */
682
-		do_action( 'wordpoints_admin_points_events_foot' );
682
+		do_action('wordpoints_admin_points_events_foot');
683 683
 	}
684 684
 }
685 685
 
Please login to merge, or discard this patch.
src/admin/includes/functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 		, 'WordPointsPointsTypesL10n'
107 107
 		, array(
108 108
 			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' )
109
-			                   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
109
+							   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
110 110
 			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
111 111
 			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
112 112
 			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @param WordPoints_App $app The main WordPoints app.
18 18
  */
19
-function wordpoints_hooks_register_admin_apps( $app ) {
19
+function wordpoints_hooks_register_admin_apps($app) {
20 20
 
21 21
 	$apps = $app->sub_apps;
22 22
 
23
-	$apps->register( 'admin', 'WordPoints_App' );
23
+	$apps->register('admin', 'WordPoints_App');
24 24
 
25 25
 	/** @var WordPoints_App $admin */
26
-	$admin = $apps->get( 'admin' );
26
+	$admin = $apps->get('admin');
27 27
 
28
-	$admin->sub_apps->register( 'screen', 'WordPoints_Admin_Screens' );
28
+	$admin->sub_apps->register('screen', 'WordPoints_Admin_Screens');
29 29
 }
30 30
 
31 31
 /**
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	// Hooks page.
47 47
 	$id = add_submenu_page(
48 48
 		$wordpoints_menu
49
-		, __( 'WordPoints — Points Types', 'wordpoints' )
50
-		, __( 'Points Types', 'wordpoints' )
49
+		, __('WordPoints — Points Types', 'wordpoints')
50
+		, __('Points Types', 'wordpoints')
51 51
 		, 'manage_options'
52 52
 		, 'wordpoints_points_types'
53
-		, array( $admin_screens, 'display' )
53
+		, array($admin_screens, 'display')
54 54
 	);
55 55
 
56
-	if ( $id ) {
57
-		$admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' );
56
+	if ($id) {
57
+		$admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types');
58 58
 	}
59 59
 }
60 60
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function wordpoints_hooks_admin_register_scripts() {
69 69
 
70
-	$assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) );
70
+	$assets_url = wordpoints_modules_url('/assets', dirname(__FILE__));
71 71
 
72 72
 	// CSS
73 73
 
74 74
 	wp_register_style(
75 75
 		'wordpoints-hooks-admin'
76
-		, $assets_url . '/css/hooks.css'
77
-		, array( 'dashicons', 'wp-jquery-ui-dialog' )
76
+		, $assets_url.'/css/hooks.css'
77
+		, array('dashicons', 'wp-jquery-ui-dialog')
78 78
 		, WORDPOINTS_VERSION
79 79
 	);
80 80
 
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
 
83 83
 	wp_register_script(
84 84
 		'wordpoints-admin-points-types'
85
-		, $assets_url . '/js/points-types.js'
86
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
85
+		, $assets_url.'/js/points-types.js'
86
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
87 87
 		, WORDPOINTS_VERSION
88 88
 	);
89 89
 
90 90
 	wp_register_script(
91 91
 		'wordpoints-hooks-models'
92
-		, $assets_url . '/js/hooks/models.js'
93
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
92
+		, $assets_url.'/js/hooks/models.js'
93
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
94 94
 		, WORDPOINTS_VERSION
95 95
 	);
96 96
 
97 97
 	wp_register_script(
98 98
 		'wordpoints-hooks-views'
99
-		, $assets_url . '/js/hooks/views.js'
100
-		, array( 'wordpoints-hooks-models' )
99
+		, $assets_url.'/js/hooks/views.js'
100
+		, array('wordpoints-hooks-models')
101 101
 		, WORDPOINTS_VERSION
102 102
 	);
103 103
 
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 		'wordpoints-admin-points-types'
106 106
 		, 'WordPointsPointsTypesL10n'
107 107
 		, array(
108
-			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' )
109
-			                   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
110
-			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
111
-			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
112
-			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
108
+			'confirmDelete' => esc_html__('Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints')
109
+			                   . ' '.esc_html__('Once a points type has been deleted, you cannot bring it back.', 'wordpoints'),
110
+			'confirmTitle'  => esc_html__('Are you sure?', 'wordpoints'),
111
+			'deleteText'    => esc_html__('Delete', 'wordpoints'),
112
+			'cancelText'    => esc_html__('Cancel', 'wordpoints'),
113 113
 		)
114 114
 	);
115 115
 
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 		'wordpoints-hooks-views'
118 118
 		, 'WordPointsHooksAdminL10n'
119 119
 		, array(
120
-			'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ),
121
-			'changesSaved'    => __( 'Your changes have been saved.', 'wordpoints' ),
120
+			'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'),
121
+			'changesSaved'    => __('Your changes have been saved.', 'wordpoints'),
122 122
 			/* translators: the name of the field that cannot be empty */
123
-			'emptyField'      => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ),
124
-			'confirmDelete'   => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ),
125
-			'confirmTitle'    => __( 'Are you sure?', 'wordpoints' ),
126
-			'deleteText'      => __( 'Delete', 'wordpoints' ),
127
-			'cancelText'      => __( 'Cancel', 'wordpoints' ),
128
-			'separator'       => __( ' » ', 'wordpoints' ),
129
-			'target_label'    => __( 'Target', 'wordpoints' ),
123
+			'emptyField'      => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'),
124
+			'confirmDelete'   => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'),
125
+			'confirmTitle'    => __('Are you sure?', 'wordpoints'),
126
+			'deleteText'      => __('Delete', 'wordpoints'),
127
+			'cancelText'      => __('Cancel', 'wordpoints'),
128
+			'separator'       => __(' » ', 'wordpoints'),
129
+			'target_label'    => __('Target', 'wordpoints'),
130 130
 		)
131 131
 	);
132 132
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 			<div class="view">
139 139
 				<div class="title"></div>
140 140
 				<button type="button" class="edit button-secondary">
141
-					' . esc_html__( 'Edit', 'wordpoints' ) . '
141
+					' . esc_html__('Edit', 'wordpoints').'
142 142
 				</button>
143 143
 				<button type="button" class="close button-secondary">
144
-					' . esc_html__( 'Close', 'wordpoints' ) . '
144
+					' . esc_html__('Close', 'wordpoints').'
145 145
 				</button>
146 146
 			</div>
147 147
 			<div class="form">
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 						</div>
161 161
 						<div class="action-buttons">
162 162
 							<button type="button" class="save button-primary" disabled>
163
-								' . esc_html__( 'Save', 'wordpoints' ) . '
163
+								' . esc_html__('Save', 'wordpoints').'
164 164
 							</button>
165 165
 							<button type="button" class="cancel button-secondary">
166
-								' . esc_html__( 'Cancel', 'wordpoints' ) . '
166
+								' . esc_html__('Cancel', 'wordpoints').'
167 167
 							</button>
168 168
 							<button type="button" class="close button-secondary">
169
-								' . esc_html__( 'Close', 'wordpoints' ) . '
169
+								' . esc_html__('Close', 'wordpoints').'
170 170
 							</button>
171 171
 							<button type="button" class="delete button-secondary">
172
-								' . esc_html__( 'Delete', 'wordpoints' ) . '
172
+								' . esc_html__('Delete', 'wordpoints').'
173 173
 							</button>
174 174
 						</div>
175 175
 					</div>
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 
218 218
 	wp_register_script(
219 219
 		'wordpoints-hooks-reactor-points'
220
-		, $assets_url . '/js/hooks/reactors/points.js'
221
-		, array( 'wordpoints-hooks-views' )
220
+		, $assets_url.'/js/hooks/reactors/points.js'
221
+		, array('wordpoints-hooks-views')
222 222
 		, WORDPOINTS_VERSION
223 223
 	);
224 224
 
225 225
 	wp_register_script(
226 226
 		'wordpoints-hooks-extension-conditions'
227
-		, $assets_url . '/js/hooks/extensions/conditions.js'
228
-		, array( 'wordpoints-hooks-views' )
227
+		, $assets_url.'/js/hooks/extensions/conditions.js'
228
+		, array('wordpoints-hooks-views')
229 229
 		, WORDPOINTS_VERSION
230 230
 	);
231 231
 
@@ -235,25 +235,25 @@  discard block
 block discarded – undo
235 235
 		, '
236 236
 			<script type="text/template" id="tmpl-wordpoints-hook-condition-groups">
237 237
 				<div class="conditions-title section-title">
238
-					<h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4>
238
+					<h4>' . esc_html__('Conditions', 'wordpoints').'</h4>
239 239
 					<button type="button" class="add-new button-secondary button-link">
240
-						<span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span>
240
+						<span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span>
241 241
 						<span class="dashicons dashicons-plus"></span>
242 242
 					</button>
243 243
 				</div>
244 244
 				<div class="add-condition-form hidden">
245 245
 					<div class="no-conditions hidden">
246
-						' . esc_html__( 'No conditions available.', 'wordpoints' ) . '
246
+						' . esc_html__('No conditions available.', 'wordpoints').'
247 247
 					</div>
248 248
 					<div class="condition-selectors">
249 249
 						<div class="arg-selectors"></div>
250 250
 						<div class="condition-selector"></div>
251 251
 					</div>
252
-					<button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '">
253
-						' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . '
252
+					<button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'">
253
+						' . esc_html_x('Add', 'reaction condition', 'wordpoints').'
254 254
 					</button>
255
-					<button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '">
256
-						' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . '
255
+					<button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'">
256
+						' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').'
257 257
 					</button>
258 258
 				</div>
259 259
 				<div class="condition-groups section-content"></div>
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 				<div class="condition-controls">
268 268
 					<div class="condition-title"></div>
269 269
 					<button type="button" class="delete button-secondary button-link">
270
-						<span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span>
270
+						<span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span>
271 271
 						<span class="dashicons dashicons-no"></span>
272 272
 					</button>
273 273
 				</div>
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 
286 286
 	wp_register_script(
287 287
 		'wordpoints-hooks-extension-periods'
288
-		, $assets_url . '/js/hooks/extensions/periods.js'
289
-		, array( 'wordpoints-hooks-views' )
288
+		, $assets_url.'/js/hooks/extensions/periods.js'
289
+		, array('wordpoints-hooks-views')
290 290
 		, WORDPOINTS_VERSION
291 291
 	);
292 292
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		, '
297 297
 			<script type="text/template" id="tmpl-wordpoints-hook-periods">
298 298
 				<div class="periods-title section-title">
299
-					<h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4>
299
+					<h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4>
300 300
 				</div>
301 301
 				<div class="periods section-content"></div>
302 302
 			</script>
@@ -315,33 +315,33 @@  discard block
 block discarded – undo
315 315
 
316 316
 	$extensions_data = array();
317 317
 
318
-	foreach ( $hooks->extensions->get_all() as $slug => $extension ) {
318
+	foreach ($hooks->extensions->get_all() as $slug => $extension) {
319 319
 
320
-		if ( $extension instanceof WordPoints_Hook_Extension ) {
321
-			$extensions_data[ $slug ] = $extension->get_ui_script_data();
320
+		if ($extension instanceof WordPoints_Hook_Extension) {
321
+			$extensions_data[$slug] = $extension->get_ui_script_data();
322 322
 		}
323 323
 
324
-		if ( wp_script_is( "wordpoints-hooks-extension-{$slug}", 'registered' ) ) {
325
-			wp_enqueue_script( "wordpoints-hooks-extension-{$slug}" );
324
+		if (wp_script_is("wordpoints-hooks-extension-{$slug}", 'registered')) {
325
+			wp_enqueue_script("wordpoints-hooks-extension-{$slug}");
326 326
 		}
327 327
 	}
328 328
 
329
-	unset( $extension, $slug );
329
+	unset($extension, $slug);
330 330
 
331 331
 	$reactor_data = array();
332 332
 
333
-	foreach ( $hooks->reactors->get_all() as $slug => $reactor ) {
333
+	foreach ($hooks->reactors->get_all() as $slug => $reactor) {
334 334
 
335
-		if ( $reactor instanceof WordPoints_Hook_Reactor ) {
336
-			$reactor_data[ $slug ] = $reactor->get_ui_script_data();
335
+		if ($reactor instanceof WordPoints_Hook_Reactor) {
336
+			$reactor_data[$slug] = $reactor->get_ui_script_data();
337 337
 		}
338 338
 
339
-		if ( wp_script_is( "wordpoints-hooks-reactor-{$slug}", 'registered' ) ) {
340
-			wp_enqueue_script( "wordpoints-hooks-reactor-{$slug}" );
339
+		if (wp_script_is("wordpoints-hooks-reactor-{$slug}", 'registered')) {
340
+			wp_enqueue_script("wordpoints-hooks-reactor-{$slug}");
341 341
 		}
342 342
 	}
343 343
 
344
-	unset( $reactor, $slug );
344
+	unset($reactor, $slug);
345 345
 
346 346
 	$event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types();
347 347
 	$entities_data = wordpoints_hooks_ui_get_script_data_entities();
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @param array $data The data.
367 367
 	 */
368
-	$data = apply_filters( 'wordpoints_hooks_ui_data', $data );
368
+	$data = apply_filters('wordpoints_hooks_ui_data', $data);
369 369
 
370 370
 	wp_localize_script(
371 371
 		'wordpoints-hooks-models'
@@ -391,28 +391,28 @@  discard block
 block discarded – undo
391 391
 	$entity_children = $entities->children;
392 392
 
393 393
 	/** @var WordPoints_Entity $entity */
394
-	foreach ( $entities->get_all() as $slug => $entity ) {
394
+	foreach ($entities->get_all() as $slug => $entity) {
395 395
 
396 396
 		$child_data = array();
397 397
 
398 398
 		/** @var WordPoints_EntityishI $child */
399
-		foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) {
399
+		foreach ($entity_children->get_children($slug) as $child_slug => $child) {
400 400
 
401
-			$child_data[ $child_slug ] = array(
401
+			$child_data[$child_slug] = array(
402 402
 				'slug'  => $child_slug,
403 403
 				'title' => $child->get_title(),
404 404
 			);
405 405
 
406
-			if ( $child instanceof WordPoints_Entity_Attr ) {
406
+			if ($child instanceof WordPoints_Entity_Attr) {
407 407
 
408
-				$child_data[ $child_slug ]['_type']     = 'attr';
409
-				$child_data[ $child_slug ]['data_type'] = $child->get_data_type();
408
+				$child_data[$child_slug]['_type']     = 'attr';
409
+				$child_data[$child_slug]['data_type'] = $child->get_data_type();
410 410
 
411
-			} elseif ( $child instanceof WordPoints_Entity_Relationship ) {
411
+			} elseif ($child instanceof WordPoints_Entity_Relationship) {
412 412
 
413
-				$child_data[ $child_slug ]['_type']     = 'relationship';
414
-				$child_data[ $child_slug ]['primary']   = $child->get_primary_entity_slug();
415
-				$child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug();
413
+				$child_data[$child_slug]['_type']     = 'relationship';
414
+				$child_data[$child_slug]['primary']   = $child->get_primary_entity_slug();
415
+				$child_data[$child_slug]['secondary'] = $child->get_related_entity_slug();
416 416
 			}
417 417
 
418 418
 			/**
@@ -423,14 +423,14 @@  discard block
 block discarded – undo
423 423
 			 * @param array                $data  The data for the entity child.
424 424
 			 * @param WordPoints_Entityish $child The child's object.
425 425
 			 */
426
-			$child_data[ $child_slug ] = apply_filters(
426
+			$child_data[$child_slug] = apply_filters(
427 427
 				'wordpoints_hooks_ui_data_entity_child'
428
-				, $child_data[ $child_slug ]
428
+				, $child_data[$child_slug]
429 429
 				, $child
430 430
 			);
431 431
 		}
432 432
 
433
-		$entities_data[ $slug ] = array(
433
+		$entities_data[$slug] = array(
434 434
 			'slug'     => $slug,
435 435
 			'title'    => $entity->get_title(),
436 436
 			'children' => $child_data,
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 			'_type'    => 'entity',
439 439
 		);
440 440
 
441
-		if ( $entity instanceof WordPoints_Entity_EnumerableI ) {
441
+		if ($entity instanceof WordPoints_Entity_EnumerableI) {
442 442
 
443 443
 			$values = array();
444 444
 
445
-			foreach ( $entity->get_enumerated_values() as $value ) {
446
-				if ( $entity->set_the_value( $value ) ) {
445
+			foreach ($entity->get_enumerated_values() as $value) {
446
+				if ($entity->set_the_value($value)) {
447 447
 					$values[] = array(
448 448
 						'value' => $entity->get_the_id(),
449 449
 						'label' => $entity->get_the_human_id(),
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 				}
452 452
 			}
453 453
 
454
-			$entities_data[ $slug ]['values'] = $values;
454
+			$entities_data[$slug]['values'] = $values;
455 455
 		}
456 456
 
457 457
 		/**
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
 		 * @param array             $data   The data for the entity.
461 461
 		 * @param WordPoints_Entity $entity The entity object.
462 462
 		 */
463
-		$entities_data[ $slug ] = apply_filters(
463
+		$entities_data[$slug] = apply_filters(
464 464
 			'wordpoints_hooks_ui_data_entity'
465
-			, $entities_data[ $slug ]
465
+			, $entities_data[$slug]
466 466
 			, $entity
467 467
 		);
468 468
 	}
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 
487 487
 	// We don't care about the action slugs, so first we get rid of that bottom level
488 488
 	// of the array.
489
-	$event_index = call_user_func_array( 'array_merge_recursive', $event_index );
489
+	$event_index = call_user_func_array('array_merge_recursive', $event_index);
490 490
 
491 491
 	$event_action_types = array();
492 492
 
493 493
 	// This leaves us the event indexed by action type. But we actually need to flip
494 494
 	// this, so that we have the action types indexed by event slug.
495
-	foreach ( $event_index as $action_type => $events ) {
496
-		foreach ( $events as $event => $unused ) {
497
-			$event_action_types[ $event ][ $action_type ] = true;
495
+	foreach ($event_index as $action_type => $events) {
496
+		foreach ($events as $event => $unused) {
497
+			$event_action_types[$event][$action_type] = true;
498 498
 		}
499 499
 	}
500 500
 
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
  *
518 518
  * @return string The HTML with templates appended.
519 519
  */
520
-function wordpoints_script_templates_filter( $html, $handle ) {
520
+function wordpoints_script_templates_filter($html, $handle) {
521 521
 
522 522
 	global $wp_scripts;
523 523
 
524
-	$templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' );
524
+	$templates = $wp_scripts->get_data($handle, 'wordpoints-templates');
525 525
 
526
-	if ( $templates ) {
526
+	if ($templates) {
527 527
 		$html .= $templates;
528 528
 	}
529 529
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
  */
540 540
 function wordpoints_hooks_admin_ajax() {
541 541
 
542
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
542
+	if (defined('DOING_AJAX') && DOING_AJAX) {
543 543
 		new WordPoints_Admin_Ajax_Hooks;
544 544
 	}
545 545
 }
Please login to merge, or discard this patch.