Completed
Push — master ( 7585ab...43f310 )
by J.D.
03:30
created
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 ( ! empty( $_POST['add_new'] ) ) { // WPCS: CSRF OK
486
+			if ( ! empty($_POST['add_new'])) { // WPCS: CSRF OK
487 487
 				$this->add_points_type();
488 488
 			} else {
489 489
 				$this->update_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.