Completed
Branch master (e9e0b4)
by J.D.
03:54
created
src/components/points/admin/classes/screen/points/types.php 2 patches
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 2.1.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,9 +88,9 @@  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_points_logs_meta_box' ) );
93
-		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_points_logs_meta_box'));
93
+		add_action('add_meta_boxes', array($this, 'add_event_meta_boxes'));
94 94
 	}
95 95
 
96 96
 	/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function enqueue_scripts() {
100 100
 
101
-		wp_enqueue_style( 'wordpoints-hooks-admin' );
101
+		wp_enqueue_style('wordpoints-hooks-admin');
102 102
 
103
-		wp_enqueue_script( 'postbox' );
104
-		wp_enqueue_script( 'wordpoints-admin-points-types' );
103
+		wp_enqueue_script('postbox');
104
+		wp_enqueue_script('wordpoints-admin-points-types');
105 105
 
106 106
 		wordpoints_hooks_ui_setup_script_data();
107 107
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 					.addClass( 'closed' );
122 122
 
123 123
 				postboxes.add_postbox_toggles(
124
-					<?php echo wp_json_encode( $this->id ); ?>
124
+					<?php echo wp_json_encode($this->id); ?>
125 125
 				);
126 126
 			} );
127 127
 		</script>
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function add_points_settings_meta_box() {
138 138
 
139
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
139
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
140 140
 			return;
141 141
 		}
142 142
 
143 143
 		add_meta_box(
144 144
 			'settings'
145
-			, __( 'Settings', 'wordpoints' )
146
-			, array( $this, 'display_points_settings_meta_box' )
145
+			, __('Settings', 'wordpoints')
146
+			, array($this, 'display_points_settings_meta_box')
147 147
 			, $this->id
148 148
 			, 'side'
149 149
 			, 'default'
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function add_points_logs_meta_box() {
159 159
 
160
-		if ( ! $this->current_points_type ) {
160
+		if ( ! $this->current_points_type) {
161 161
 			return;
162 162
 		}
163 163
 
164 164
 		add_meta_box(
165 165
 			'logs'
166
-			, __( 'Logs', 'wordpoints' )
167
-			, array( $this, 'display_points_logs_meta_box' )
166
+			, __('Logs', 'wordpoints')
167
+			, array($this, 'display_points_logs_meta_box')
168 168
 			, $this->id
169 169
 			, 'side'
170 170
 			, 'default'
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function display_points_settings_meta_box() {
180 180
 
181
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
181
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
182 182
 			return;
183 183
 		}
184 184
 
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$add_new = 0;
188 188
 
189
-		$points_type = wordpoints_get_points_type( $slug );
189
+		$points_type = wordpoints_get_points_type($slug);
190 190
 
191
-		if ( ! $points_type ) {
191
+		if ( ! $points_type) {
192 192
 
193 193
 			$points_type = array();
194
-			$add_new     = wp_create_nonce( 'wordpoints_add_new_points_type' );
194
+			$add_new     = wp_create_nonce('wordpoints_add_new_points_type');
195 195
 		}
196 196
 
197 197
 		$points_type = array_merge(
@@ -206,27 +206,27 @@  discard block
 block discarded – undo
206 206
 		?>
207 207
 
208 208
 		<form method="post">
209
-			<?php if ( is_wordpoints_network_active() && ! is_network_admin() ) : ?>
209
+			<?php if (is_wordpoints_network_active() && ! is_network_admin()) : ?>
210 210
 				<div class="notice notice-info inline">
211 211
 					<p>
212
-						<?php if ( $slug ) : ?>
213
-							<?php esc_html_e( 'Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints' ) ?>
212
+						<?php if ($slug) : ?>
213
+							<?php esc_html_e('Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints') ?>
214 214
 						<?php else : ?>
215
-							<?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ) ?>
215
+							<?php esc_html_e('The new points type will be global across all sites on this network.', 'wordpoints') ?>
216 216
 						<?php endif; ?>
217 217
 					</p>
218 218
 				</div>
219 219
 			<?php endif; ?>
220 220
 
221
-			<?php if ( $slug ) : ?>
221
+			<?php if ($slug) : ?>
222 222
 				<p>
223 223
 					<span class="wordpoints-points-slug">
224 224
 						<em>
225
-							<?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?>
225
+							<?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?>
226 226
 						</em>
227 227
 					</span>
228 228
 				</p>
229
-				<?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?>
229
+				<?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?>
230 230
 			<?php endif; ?>
231 231
 
232 232
 			<?php
@@ -240,45 +240,45 @@  discard block
 block discarded – undo
240 240
 			 *
241 241
 			 * @param string $points_type The slug of the points type.
242 242
 			 */
243
-			do_action( 'wordpoints_points_type_form_top', $slug );
243
+			do_action('wordpoints_points_type_form_top', $slug);
244 244
 
245
-			if ( $add_new ) {
245
+			if ($add_new) {
246 246
 
247 247
 				// Mark the prefix and suffix optional on the add new form.
248
-				$prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' );
249
-				$suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' );
248
+				$prefix = _x('Prefix (optional):', 'points type', 'wordpoints');
249
+				$suffix = _x('Suffix (optional):', 'points type', 'wordpoints');
250 250
 
251 251
 			} else {
252 252
 
253
-				$prefix = _x( 'Prefix:', 'points type', 'wordpoints' );
254
-				$suffix = _x( 'Suffix:', 'points type', 'wordpoints' );
253
+				$prefix = _x('Prefix:', 'points type', 'wordpoints');
254
+				$suffix = _x('Suffix:', 'points type', 'wordpoints');
255 255
 			}
256 256
 
257 257
 			?>
258 258
 
259 259
 			<p>
260 260
 				<label
261
-					for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label>
261
+					for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label>
262 262
 				<input class="widefat" type="text"
263
-				       id="points-name-<?php echo esc_attr( $slug ); ?>"
263
+				       id="points-name-<?php echo esc_attr($slug); ?>"
264 264
 				       name="points-name"
265
-				       value="<?php echo esc_attr( $points_type['name'] ); ?>"/>
265
+				       value="<?php echo esc_attr($points_type['name']); ?>"/>
266 266
 			</p>
267 267
 			<p>
268 268
 				<label
269
-					for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label>
269
+					for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label>
270 270
 				<input class="widefat" type="text"
271
-				       id="points-prefix-<?php echo esc_attr( $slug ); ?>"
271
+				       id="points-prefix-<?php echo esc_attr($slug); ?>"
272 272
 				       name="points-prefix"
273
-				       value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/>
273
+				       value="<?php echo esc_attr($points_type['prefix']); ?>"/>
274 274
 			</p>
275 275
 			<p>
276 276
 				<label
277
-					for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label>
277
+					for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label>
278 278
 				<input class="widefat" type="text"
279
-				       id="points-suffix-<?php echo esc_attr( $slug ); ?>"
279
+				       id="points-suffix-<?php echo esc_attr($slug); ?>"
280 280
 				       name="points-suffix"
281
-				       value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/>
281
+				       value="<?php echo esc_attr($points_type['suffix']); ?>"/>
282 282
 			</p>
283 283
 
284 284
 			<?php
@@ -292,28 +292,28 @@  discard block
 block discarded – undo
292 292
 			 *
293 293
 			 * @param string $points_type The slug of the points type.
294 294
 			 */
295
-			do_action( 'wordpoints_points_type_form_bottom', $slug );
295
+			do_action('wordpoints_points_type_form_bottom', $slug);
296 296
 
297 297
 			?>
298 298
 
299 299
 			<input type="hidden" name="points-slug"
300
-			       value="<?php echo esc_attr( $slug ); ?>"/>
300
+			       value="<?php echo esc_attr($slug); ?>"/>
301 301
 			<input type="hidden" name="add_new" class="add_new"
302
-			       value="<?php echo esc_attr( $add_new ); ?>"/>
302
+			       value="<?php echo esc_attr($add_new); ?>"/>
303 303
 
304 304
 			<div class="hook-control-actions">
305 305
 				<div class="alignleft">
306 306
 					<?php
307 307
 
308
-					if ( ! $add_new ) {
309
-						wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' );
310
-						submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) );
308
+					if ( ! $add_new) {
309
+						wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce');
310
+						submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}"));
311 311
 					}
312 312
 
313 313
 					?>
314 314
 				</div>
315 315
 				<div class="alignright">
316
-					<?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?>
316
+					<?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?>
317 317
 					<span class="spinner"></span>
318 318
 				</div>
319 319
 				<br class="clear"/>
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 
333 333
 		?>
334 334
 
335
-		<a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_logs&tab=' . $this->current_points_type ) ); ?>">
336
-			<?php esc_html_e( 'Go to the logs for this points type.', 'wordpoints' ); ?>
335
+		<a href="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_points_logs&tab=' . $this->current_points_type)); ?>">
336
+			<?php esc_html_e('Go to the logs for this points type.', 'wordpoints'); ?>
337 337
 		</a>
338 338
 
339 339
 		<?php
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	public function add_event_meta_boxes() {
348 348
 
349
-		if ( ! $this->current_points_type ) {
349
+		if ( ! $this->current_points_type) {
350 350
 			return;
351 351
 		}
352 352
 
353
-		$events_app       = $this->hooks->get_sub_app( 'events' );
354
-		$this->event_args = $events_app->get_sub_app( 'args' );
353
+		$events_app       = $this->hooks->get_sub_app('events');
354
+		$this->event_args = $events_app->get_sub_app('args');
355 355
 
356
-		$this->reaction_store = wordpoints_hooks()->get_reaction_store( 'points' );
356
+		$this->reaction_store = wordpoints_hooks()->get_reaction_store('points');
357 357
 
358
-		if ( ! $this->reaction_store ) {
358
+		if ( ! $this->reaction_store) {
359 359
 			return;
360 360
 		}
361 361
 
362 362
 		/** @var WordPoints_Hook_ReactorI $reactor */
363
-		$reactor = $this->hooks->get_sub_app( 'reactors' )->get( 'points' );
364
-		$reactor_action_types = array_fill_keys( $reactor->get_action_types(), true );
363
+		$reactor = $this->hooks->get_sub_app('reactors')->get('points');
364
+		$reactor_action_types = array_fill_keys($reactor->get_action_types(), true);
365 365
 
366 366
 		$event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types();
367 367
 
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 			, $this->current_points_type
387 387
 		);
388 388
 
389
-		foreach ( $events as $slug => $event ) {
389
+		foreach ($events as $slug => $event) {
390 390
 
391 391
 			if (
392 392
 				! array_intersect_key(
393
-					$event_action_types[ $slug ]
393
+					$event_action_types[$slug]
394 394
 					, $reactor_action_types
395 395
 				)
396 396
 			) {
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			add_meta_box(
401 401
 				"{$this->current_points_type}-{$slug}"
402 402
 				, $event->get_title()
403
-				, array( $this, 'display_event_meta_box' )
403
+				, array($this, 'display_event_meta_box')
404 404
 				, $this->id
405 405
 				, 'events'
406 406
 				, 'default'
@@ -421,50 +421,50 @@  discard block
 block discarded – undo
421 421
 	 * @param array $points_type The points type this meta-box relates to.
422 422
 	 * @param array $meta_box    The data the meta-box was created with.
423 423
 	 */
424
-	public function display_event_meta_box( $points_type, $meta_box ) {
424
+	public function display_event_meta_box($points_type, $meta_box) {
425 425
 
426 426
 		$event_slug = $meta_box['args']['slug'];
427 427
 
428 428
 		$data = array();
429 429
 
430
-		foreach ( $this->reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
431
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
430
+		foreach ($this->reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) {
431
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
432 432
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
433 433
 					$reaction
434 434
 				);
435 435
 			}
436 436
 		}
437 437
 
438
-		$event_data = array( 'args' => array() );
438
+		$event_data = array('args' => array());
439 439
 
440
-		foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) {
440
+		foreach ($this->event_args->get_children($event_slug) as $slug => $arg) {
441 441
 
442
-			$event_data['args'][ $slug ] = array(
442
+			$event_data['args'][$slug] = array(
443 443
 				'slug' => $slug,
444 444
 			);
445 445
 
446
-			if ( $arg instanceof WordPoints_Hook_ArgI ) {
447
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
448
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
446
+			if ($arg instanceof WordPoints_Hook_ArgI) {
447
+				$event_data['args'][$slug]['title'] = $arg->get_title();
448
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
449 449
 			}
450 450
 		}
451 451
 
452 452
 		?>
453 453
 
454 454
 		<script>
455
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
456
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
455
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
456
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
457 457
 		</script>
458 458
 
459 459
 		<div class="wordpoints-hook-reaction-group-container">
460 460
 			<p class="description wordpoints-hook-reaction-group-description">
461
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
461
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
462 462
 			</p>
463 463
 
464 464
 			<div class="wordpoints-hook-reaction-group"
465
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
466
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
467
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $this->reaction_store ) ); ?>"
465
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
466
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
467
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($this->reaction_store)); ?>"
468 468
 				data-wordpoints-hooks-reaction-store="points"
469 469
 				data-wordpoints-hooks-reactor="points">
470 470
 			</div>
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
 			<div class="controls">
481 481
 				<button type="button" class="button-primary add-reaction">
482
-					<?php esc_html_e( 'Add New Reaction', 'wordpoints' ); ?>
482
+					<?php esc_html_e('Add New Reaction', 'wordpoints'); ?>
483 483
 				</button>
484 484
 			</div>
485 485
 		</div>
@@ -499,19 +499,19 @@  discard block
 block discarded – undo
499 499
 		// Show a tab for each points type.
500 500
 		$tabs = array();
501 501
 
502
-		foreach ( $points_types as $slug => $settings ) {
503
-			$tabs[ $slug ] = $settings['name'];
502
+		foreach ($points_types as $slug => $settings) {
503
+			$tabs[$slug] = $settings['name'];
504 504
 		}
505 505
 
506
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
506
+		$tabs['add-new'] = __('Add New', 'wordpoints');
507 507
 
508
-		$tab = wordpoints_admin_get_current_tab( $tabs );
508
+		$tab = wordpoints_admin_get_current_tab($tabs);
509 509
 
510
-		if ( 'add-new' !== $tab ) {
510
+		if ('add-new' !== $tab) {
511 511
 			$this->current_points_type = $tab;
512 512
 		}
513 513
 
514
-		do_action( 'add_meta_boxes', $this->id );
514
+		do_action('add_meta_boxes', $this->id);
515 515
 
516 516
 		$this->tabs = $tabs;
517 517
 	}
@@ -523,19 +523,19 @@  discard block
 block discarded – undo
523 523
 	 */
524 524
 	public function save_points_type() {
525 525
 
526
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
526
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
527 527
 			return;
528 528
 		}
529 529
 
530
-		if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK
530
+		if (isset($_POST['save-points-type'])) { // WPCS: CSRF OK
531 531
 
532
-			if ( ! empty( $_POST['add_new'] ) ) { // WPCS: CSRF OK
532
+			if ( ! empty($_POST['add_new'])) { // WPCS: CSRF OK
533 533
 				$this->add_points_type();
534 534
 			} else {
535 535
 				$this->update_points_type();
536 536
 			}
537 537
 
538
-		} elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK
538
+		} elseif ( ! empty($_POST['delete-points-type'])) { // WPCS: CSRF OK
539 539
 
540 540
 			$this->delete_points_type();
541 541
 		}
@@ -552,21 +552,21 @@  discard block
 block discarded – undo
552 552
 
553 553
 		$settings = array();
554 554
 
555
-		if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK
555
+		if (isset($_POST['points-name'])) { // WPCS: CSRF OK
556 556
 			$settings['name'] = trim(
557
-				sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK
557
+				sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK
558 558
 			);
559 559
 		}
560 560
 
561
-		if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK
561
+		if (isset($_POST['points-prefix'])) { // WPCS: CSRF OK
562 562
 			$settings['prefix'] = ltrim(
563
-				sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK
563
+				sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK
564 564
 			);
565 565
 		}
566 566
 
567
-		if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK
567
+		if (isset($_POST['points-suffix'])) { // WPCS: CSRF OK
568 568
 			$settings['suffix'] = rtrim(
569
-				sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK
569
+				sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK
570 570
 			);
571 571
 		}
572 572
 
@@ -584,52 +584,52 @@  discard block
 block discarded – undo
584 584
 			! wordpoints_verify_nonce(
585 585
 				'update_points_type'
586 586
 				, 'wordpoints_update_points_type-%s'
587
-				, array( 'points-slug' )
587
+				, array('points-slug')
588 588
 				, 'post'
589 589
 			)
590
-			|| ! isset( $_POST['points-slug'] )
590
+			|| ! isset($_POST['points-slug'])
591 591
 		) {
592 592
 			return;
593 593
 		}
594 594
 
595 595
 		$settings = $this->get_points_type_settings();
596 596
 
597
-		if ( empty( $settings['name'] ) ) {
597
+		if (empty($settings['name'])) {
598 598
 
599 599
 			add_settings_error(
600 600
 				'points-name'
601 601
 				, 'wordpoints_points_type_update'
602
-				, __( 'Error: points type name cannot be empty.', 'wordpoints' )
602
+				, __('Error: points type name cannot be empty.', 'wordpoints')
603 603
 			);
604 604
 
605 605
 			return;
606 606
 		}
607 607
 
608
-		$points_type = sanitize_key( $_POST['points-slug'] );
608
+		$points_type = sanitize_key($_POST['points-slug']);
609 609
 
610
-		$old_settings = wordpoints_get_points_type( $points_type );
610
+		$old_settings = wordpoints_get_points_type($points_type);
611 611
 
612
-		if ( false === $old_settings ) {
612
+		if (false === $old_settings) {
613 613
 
614 614
 			add_settings_error(
615 615
 				''
616 616
 				, 'wordpoints_points_type_update'
617
-				, __( 'Error: failed updating points type.', 'wordpoints' )
617
+				, __('Error: failed updating points type.', 'wordpoints')
618 618
 			);
619 619
 
620 620
 			return;
621 621
 		}
622 622
 
623
-		if ( is_array( $old_settings ) ) {
624
-			$settings = array_merge( $old_settings, $settings );
623
+		if (is_array($old_settings)) {
624
+			$settings = array_merge($old_settings, $settings);
625 625
 		}
626 626
 
627
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
627
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
628 628
 
629 629
 			add_settings_error(
630 630
 				''
631 631
 				, 'wordpoints_points_type_update'
632
-				, __( 'Error: failed updating points type.', 'wordpoints' )
632
+				, __('Error: failed updating points type.', 'wordpoints')
633 633
 			);
634 634
 
635 635
 		} else {
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 			add_settings_error(
638 638
 				''
639 639
 				, 'wordpoints_points_type_update'
640
-				, __( 'Points type updated.', 'wordpoints' )
640
+				, __('Points type updated.', 'wordpoints')
641 641
 				, 'updated'
642 642
 			);
643 643
 		}
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
 
664 664
 		$settings = $this->get_points_type_settings();
665 665
 
666
-		$slug = wordpoints_add_points_type( $settings );
666
+		$slug = wordpoints_add_points_type($settings);
667 667
 
668
-		if ( ! $slug ) {
668
+		if ( ! $slug) {
669 669
 
670 670
 			add_settings_error(
671 671
 				''
672 672
 				, 'wordpoints_points_type_create'
673
-				, __( 'Please choose a unique name for this points type.', 'wordpoints' )
673
+				, __('Please choose a unique name for this points type.', 'wordpoints')
674 674
 			);
675 675
 
676 676
 		} else {
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 			add_settings_error(
681 681
 				''
682 682
 				, 'wordpoints_points_type_create'
683
-				, __( 'Points type created.', 'wordpoints' )
683
+				, __('Points type created.', 'wordpoints')
684 684
 				, 'updated'
685 685
 			);
686 686
 		}
@@ -697,22 +697,22 @@  discard block
 block discarded – undo
697 697
 			wordpoints_verify_nonce(
698 698
 				'delete-points-type-nonce'
699 699
 				, 'wordpoints_delete_points_type-%s'
700
-				, array( 'points-slug' )
700
+				, array('points-slug')
701 701
 				, 'post'
702 702
 			)
703
-			&& isset( $_POST['points-slug'] )
703
+			&& isset($_POST['points-slug'])
704 704
 		) {
705 705
 
706 706
 			if (
707 707
 				wordpoints_delete_points_type(
708
-					sanitize_key( $_POST['points-slug'] )
708
+					sanitize_key($_POST['points-slug'])
709 709
 				)
710 710
 			) {
711 711
 
712 712
 				add_settings_error(
713 713
 					''
714 714
 					, 'wordpoints_points_type_delete'
715
-					, __( 'Points type deleted.', 'wordpoints' )
715
+					, __('Points type deleted.', 'wordpoints')
716 716
 					, 'updated'
717 717
 				);
718 718
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 				add_settings_error(
722 722
 					''
723 723
 					, 'wordpoints_points_type_delete'
724
-					, __( 'Error while deleting.', 'wordpoints' )
724
+					, __('Error while deleting.', 'wordpoints')
725 725
 				);
726 726
 			}
727 727
 		}
@@ -737,18 +737,18 @@  discard block
 block discarded – undo
737 737
 		 *
738 738
 		 * @since 2.1.0
739 739
 		 */
740
-		do_action( 'wordpoints_admin_points_events_head' );
740
+		do_action('wordpoints_admin_points_events_head');
741 741
 
742
-		if ( is_network_admin() ) {
743
-			$title = __( 'Network Events', 'wordpoints' );
744
-			$description = __( 'Add reactions to these events to award points whenever they take place on this network.', 'wordpoints' );
742
+		if (is_network_admin()) {
743
+			$title = __('Network Events', 'wordpoints');
744
+			$description = __('Add reactions to these events to award points whenever they take place on this network.', 'wordpoints');
745 745
 		} else {
746
-			$title = __( 'Events', 'wordpoints' );
747
-			$description = __( 'Add reactions to these events to award points whenever they take place on this site.', 'wordpoints' );
746
+			$title = __('Events', 'wordpoints');
747
+			$description = __('Add reactions to these events to award points whenever they take place on this site.', 'wordpoints');
748 748
 		}
749 749
 
750
-		if ( isset( $this->current_points_type ) ) {
751
-			$points_type = wordpoints_get_points_type( $this->current_points_type );
750
+		if (isset($this->current_points_type)) {
751
+			$points_type = wordpoints_get_points_type($this->current_points_type);
752 752
 			$points_type['slug'] = $this->current_points_type;
753 753
 		} else {
754 754
 			$points_type = false;
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
 		<div class="wordpoints-points-type-meta-box-wrap">
760 760
 
761 761
 				<form>
762
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
763
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
762
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
763
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
764 764
 				</form>
765 765
 
766 766
 				<div id="poststuff">
@@ -768,22 +768,22 @@  discard block
 block discarded – undo
768 768
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
769 769
 
770 770
 						<div id="postbox-container-1" class="postbox-container">
771
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
771
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
772 772
 						</div>
773 773
 
774
-						<?php if ( isset( $this->current_points_type ) ) : ?>
774
+						<?php if (isset($this->current_points_type)) : ?>
775 775
 							<div class="wordpoints-hook-events-heading">
776
-								<h2><?php echo esc_html( $title ); ?></h2>
776
+								<h2><?php echo esc_html($title); ?></h2>
777 777
 								<p class="description">
778
-									<?php echo esc_html( $description ); ?>
778
+									<?php echo esc_html($description); ?>
779 779
 									<?php
780 780
 
781 781
 									echo wp_kses(
782 782
 										sprintf(
783
-											__( 'You can learn more about how they work from <a href="%s">the user guide on WordPoints.org</a>.', 'wordpoints' )
783
+											__('You can learn more about how they work from <a href="%s">the user guide on WordPoints.org</a>.', 'wordpoints')
784 784
 											, 'https://wordpoints.org/user-guide/points-reactions/'
785 785
 										)
786
-										, array( 'a' => array( 'href' => true, 'target' => true ) )
786
+										, array('a' => array('href' => true, 'target' => true))
787 787
 									);
788 788
 
789 789
 									?>
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 							</div>
792 792
 
793 793
 							<div id="postbox-container-2" class="postbox-container">
794
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
794
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
795 795
 							</div>
796 796
 						<?php endif; ?>
797 797
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 		 *
811 811
 		 * @since 2.1.0
812 812
 		 */
813
-		do_action( 'wordpoints_admin_points_events_foot' );
813
+		do_action('wordpoints_admin_points_events_foot');
814 814
 	}
815 815
 }
816 816
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -211,9 +211,12 @@
 block discarded – undo
211 211
 					<p>
212 212
 						<?php if ( $slug ) : ?>
213 213
 							<?php esc_html_e( 'Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints' ) ?>
214
-						<?php else : ?>
214
+						<?php else {
215
+	: ?>
215 216
 							<?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ) ?>
216
-						<?php endif; ?>
217
+						<?php endif;
218
+}
219
+?>
217 220
 					</p>
218 221
 				</div>
219 222
 			<?php endif; ?>
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks-load.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@
 block discarded – undo
13 13
 $screen->add_help_tab(
14 14
 	array(
15 15
 		'id'      => 'overview',
16
-		'title'   => esc_html__( 'Overview', 'wordpoints' ),
16
+		'title'   => esc_html__('Overview', 'wordpoints'),
17 17
 		'content' =>
18
-			'<p>' . esc_html__( 'Points Hooks let you award users points by &#8220;hooking into&#8221; different actions. They can be hooked to any points type that you have created.', 'wordpoints' ) . '</p>
19
-			<p>' . esc_html__( 'To link a hook to a points type, click on the hook&#8217;s title bar and select a points type, or drag and drop the hook title bars into the desired points type. By default, only the first points type area is expanded. To populate additional points types, click on their title bars to expand them.', 'wordpoints' ) . '</p>
20
-			<p>' . esc_html__( 'The Available Hooks section contains all the hooks you can choose from. Once you add a hook into a points type, it will open to allow you to configure its settings. When you are happy with the hook settings, click the Save button and the hook will begin awarding points. If you click Delete, it will remove the hook.', 'wordpoints' ) . '</p>',
18
+			'<p>' . esc_html__('Points Hooks let you award users points by &#8220;hooking into&#8221; different actions. They can be hooked to any points type that you have created.', 'wordpoints') . '</p>
19
+			<p>' . esc_html__('To link a hook to a points type, click on the hook&#8217;s title bar and select a points type, or drag and drop the hook title bars into the desired points type. By default, only the first points type area is expanded. To populate additional points types, click on their title bars to expand them.', 'wordpoints') . '</p>
20
+			<p>' . esc_html__('The Available Hooks section contains all the hooks you can choose from. Once you add a hook into a points type, it will open to allow you to configure its settings. When you are happy with the hook settings, click the Save button and the hook will begin awarding points. If you click Delete, it will remove the hook.', 'wordpoints') . '</p>',
21 21
 	)
22 22
 );
23 23
 
24 24
 $screen->add_help_tab(
25 25
 	array(
26 26
 		'id'      => 'removing-reusing',
27
-		'title'   => esc_html__( 'Removing and Reusing', 'wordpoints' ),
27
+		'title'   => esc_html__('Removing and Reusing', 'wordpoints'),
28 28
 		'content' =>
29
-			'<p>' . esc_html__( 'If you want to remove the hook but save its setting for possible future use, just drag it into the Inactive Hooks area. You can add them back anytime from there.', 'wordpoints' ) . '</p>
30
-			<p>' . esc_html__( 'Hooks may be used multiple times.', 'wordpoints' ) . '</p>
31
-			<p>' . esc_html__( 'Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.', 'wordpoints' ) . '</p>',
29
+			'<p>' . esc_html__('If you want to remove the hook but save its setting for possible future use, just drag it into the Inactive Hooks area. You can add them back anytime from there.', 'wordpoints') . '</p>
30
+			<p>' . esc_html__('Hooks may be used multiple times.', 'wordpoints') . '</p>
31
+			<p>' . esc_html__('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.', 'wordpoints') . '</p>',
32 32
 	)
33 33
 );
34 34
 
35 35
 $screen->set_help_sidebar(
36
-	'<p><strong>' . esc_html__( 'For more information:', 'wordpoints' ) . '</strong></p>
37
-	<p><a href="https://wordpoints.org/user-guide/points-hooks/">' . esc_html__( 'Documentation on Points Hooks', 'wordpoints' ) . '</a></p>
38
-	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__( 'Support Forums', 'wordpoints' ) . '</a></p>'
36
+	'<p><strong>' . esc_html__('For more information:', 'wordpoints') . '</strong></p>
37
+	<p><a href="https://wordpoints.org/user-guide/points-hooks/">' . esc_html__('Documentation on Points Hooks', 'wordpoints') . '</a></p>
38
+	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__('Support Forums', 'wordpoints') . '</a></p>'
39 39
 );
40 40
 
41
-$accessibility_mode = get_user_setting( 'wordpoints_points_hooks_access' );
41
+$accessibility_mode = get_user_setting('wordpoints_points_hooks_access');
42 42
 
43 43
 if (
44
-	isset( $_GET['accessibility-mode'], $_GET['wordpoints-accessiblity-nonce'] )
45
-	&& wordpoints_verify_nonce( 'wordpoints-accessiblity-nonce', 'wordpoints_points_hooks_accessiblity' )
44
+	isset($_GET['accessibility-mode'], $_GET['wordpoints-accessiblity-nonce'])
45
+	&& wordpoints_verify_nonce('wordpoints-accessiblity-nonce', 'wordpoints_points_hooks_accessiblity')
46 46
 ) {
47 47
 
48
-	$accessibility_mode = ( 'on' === sanitize_key( $_GET['accessibility-mode'] ) ) ? 'on' : 'off';
49
-	set_user_setting( 'wordpoints_points_hooks_access', $accessibility_mode );
48
+	$accessibility_mode = ('on' === sanitize_key($_GET['accessibility-mode'])) ? 'on' : 'off';
49
+	set_user_setting('wordpoints_points_hooks_access', $accessibility_mode);
50 50
 }
51 51
 
52 52
 // Enqueue needed scripts and styles.
53
-if ( 'on' === $accessibility_mode ) {
53
+if ('on' === $accessibility_mode) {
54 54
 
55
-	add_filter( 'admin_body_class', 'wordpoints_points_hooks_access_body_class' );
55
+	add_filter('admin_body_class', 'wordpoints_points_hooks_access_body_class');
56 56
 
57 57
 } else {
58 58
 
59
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
59
+	wp_enqueue_style('wp-jquery-ui-dialog');
60 60
 
61
-	wp_enqueue_script( 'wordpoints-admin-points-hooks' );
61
+	wp_enqueue_script('wordpoints-admin-points-hooks');
62 62
 
63
-	if ( wp_is_mobile() ) {
64
-		wp_enqueue_script( 'jquery-touch-punch' );
63
+	if (wp_is_mobile()) {
64
+		wp_enqueue_script('jquery-touch-punch');
65 65
 	}
66 66
 }
67 67
 
68
-wp_enqueue_style( 'wordpoints-admin-points-hooks' );
68
+wp_enqueue_style('wordpoints-admin-points-hooks');
69 69
 
70 70
 // EOF
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -12,57 +12,57 @@  discard block
 block discarded – undo
12 12
 
13 13
 // These messages/errors are used upon redirection from the non-JS version.
14 14
 $messages = array(
15
-	__( 'Changes saved.', 'wordpoints' ),
15
+	__('Changes saved.', 'wordpoints'),
16 16
 );
17 17
 
18 18
 $errors = array(
19
-	__( 'Error while saving.', 'wordpoints' ),
20
-	__( 'Error in displaying the hooks settings form.', 'wordpoints' ),
19
+	__('Error while saving.', 'wordpoints'),
20
+	__('Error in displaying the hooks settings form.', 'wordpoints'),
21 21
 	'', // Back-compat for pre-2.1.0.
22
-	__( 'Error while deleting.', 'wordpoints' ),
22
+	__('Error while deleting.', 'wordpoints'),
23 23
 );
24 24
 
25
-if ( is_network_admin() ) {
26
-	$title = _x( 'Network Points Hooks', 'page title', 'wordpoints' );
25
+if (is_network_admin()) {
26
+	$title = _x('Network Points Hooks', 'page title', 'wordpoints');
27 27
 } else {
28
-	$title = _x( 'Points Hooks', 'page title', 'wordpoints' );
28
+	$title = _x('Points Hooks', 'page title', 'wordpoints');
29 29
 }
30 30
 
31 31
 ?>
32 32
 
33 33
 <div class="wrap">
34
-	<h1><?php echo esc_html( $title ); ?></h1>
34
+	<h1><?php echo esc_html($title); ?></h1>
35 35
 
36 36
 	<?php
37 37
 
38
-	if ( empty( $points_types ) && ! current_user_can( 'manage_wordpoints_points_types' ) ) {
38
+	if (empty($points_types) && ! current_user_can('manage_wordpoints_points_types')) {
39 39
 
40
-		wordpoints_show_admin_error( esc_html__( 'No points types have been created yet. Only network administrators can create points types.', 'wordpoints' ) );
40
+		wordpoints_show_admin_error(esc_html__('No points types have been created yet. Only network administrators can create points types.', 'wordpoints'));
41 41
 
42 42
 		echo '</div>';
43 43
 		return;
44 44
 	}
45 45
 
46
-	if ( isset( $_GET['message'] ) && isset( $messages[ (int) $_GET['message'] ] ) ) {
46
+	if (isset($_GET['message']) && isset($messages[(int) $_GET['message']])) {
47 47
 
48 48
 		wordpoints_show_admin_message(
49
-			esc_html( $messages[ (int) $_GET['message'] ] )
49
+			esc_html($messages[(int) $_GET['message']])
50 50
 			, 'success'
51
-			, array( 'dismissible' => true )
51
+			, array('dismissible' => true)
52 52
 		);
53 53
 
54
-	} elseif ( isset( $_GET['error'] ) && isset( $errors[ (int) $_GET['error'] ] ) ) {
54
+	} elseif (isset($_GET['error']) && isset($errors[(int) $_GET['error']])) {
55 55
 
56 56
 		wordpoints_show_admin_error(
57
-			esc_html( $errors[ (int) $_GET['error'] ] )
58
-			, array( 'dismissible' => true )
57
+			esc_html($errors[(int) $_GET['error']])
58
+			, array('dismissible' => true)
59 59
 		);
60 60
 	}
61 61
 
62
-	if ( is_network_admin() && current_user_can( 'manage_network_wordpoints_points_hooks' ) ) {
62
+	if (is_network_admin() && current_user_can('manage_network_wordpoints_points_hooks')) {
63 63
 
64 64
 		// Display network wide hooks.
65
-		WordPoints_Points_Hooks::set_network_mode( true );
65
+		WordPoints_Points_Hooks::set_network_mode(true);
66 66
 	}
67 67
 
68 68
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @since 1.0.0
72 72
 	 */
73
-	do_action( 'wordpoints_admin_points_hooks_head' );
73
+	do_action('wordpoints_admin_points_hooks_head');
74 74
 
75 75
 	?>
76 76
 
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 			<div id="available-hooks" class="hooks-holder-wrap hooks-holder-wrap">
80 80
 				<div class="points-type-name">
81 81
 					<div class="points-type-name-arrow"><br /></div>
82
-					<h2><?php esc_html_e( 'Available Hooks', 'wordpoints' ); ?> <span id="removing-hook"><?php echo esc_html_x( 'Deactivate', 'removing-hook', 'wordpoints' ); ?> <span></span></span></h2>
82
+					<h2><?php esc_html_e('Available Hooks', 'wordpoints'); ?> <span id="removing-hook"><?php echo esc_html_x('Deactivate', 'removing-hook', 'wordpoints'); ?> <span></span></span></h2>
83 83
 				</div>
84 84
 				<div class="hook-holder hook-holder">
85
-					<p class="description"><?php esc_html_e( 'Drag hooks from here to a points type on the right to activate them. Drag hooks back here to deactivate them and delete their settings.', 'wordpoints' ); ?></p>
85
+					<p class="description"><?php esc_html_e('Drag hooks from here to a points type on the right to activate them. Drag hooks back here to deactivate them and delete their settings.', 'wordpoints'); ?></p>
86 86
 					<div id="hook-list">
87 87
 						<?php WordPoints_Points_Hooks::list_hooks(); ?>
88 88
 					</div>
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			<div class="hooks-holder-wrap inactive-points-type">
95 95
 				<div class="points-type-name">
96 96
 					<div class="points-type-name-arrow"><br /></div>
97
-					<h2><?php esc_html_e( 'Inactive Hooks', 'wordpoints' ); ?>
97
+					<h2><?php esc_html_e('Inactive Hooks', 'wordpoints'); ?>
98 98
 						<span class="spinner"></span>
99 99
 					</h2>
100 100
 				</div>
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 					<div id="_inactive_hooks" class="hooks-sortables">
103 103
 						<div class="points-type-description">
104 104
 							<p class="description">
105
-								<?php esc_html_e( 'Drag hooks here to remove them from the points type but keep their settings.', 'wordpoints' ); ?>
105
+								<?php esc_html_e('Drag hooks here to remove them from the points type but keep their settings.', 'wordpoints'); ?>
106 106
 							</p>
107 107
 						</div>
108
-						<?php WordPoints_Points_Hooks::list_by_points_type( '_inactive_hooks' ); ?>
108
+						<?php WordPoints_Points_Hooks::list_by_points_type('_inactive_hooks'); ?>
109 109
 					</div>
110 110
 					<div class="clear"></div>
111 111
 				</div>
@@ -121,31 +121,31 @@  discard block
 block discarded – undo
121 121
 
122 122
 			$i = 0;
123 123
 
124
-			foreach ( $points_types as $slug => $points_type ) {
124
+			foreach ($points_types as $slug => $points_type) {
125 125
 
126 126
 				$wrap_class = 'hooks-holder-wrap';
127
-				if ( ! empty( $points_type['class'] ) ) {
127
+				if ( ! empty($points_type['class'])) {
128 128
 					$wrap_class .= ' points-type-' . $points_type['class'];
129 129
 				}
130 130
 
131
-				if ( $i ) {
131
+				if ($i) {
132 132
 					$wrap_class .= ' closed';
133 133
 				}
134 134
 
135 135
 				?>
136 136
 
137
-				<div class="<?php echo esc_attr( $wrap_class ); ?>">
137
+				<div class="<?php echo esc_attr($wrap_class); ?>">
138 138
 					<div class="points-type-name">
139 139
 						<div class="points-type-name-arrow"><br /></div>
140
-						<h2><?php echo esc_html( $points_type['name'] ); ?><span class="spinner"></span></h2>
140
+						<h2><?php echo esc_html($points_type['name']); ?><span class="spinner"></span></h2>
141 141
 					</div>
142
-					<div id="<?php echo esc_attr( $slug ); ?>" class="hooks-sortables">
142
+					<div id="<?php echo esc_attr($slug); ?>" class="hooks-sortables">
143 143
 
144 144
 						<?php
145 145
 
146 146
 						if (
147
-							get_site_option( 'wordpoints_disabled_points_hooks_edit_points_types' )
148
-							&& current_user_can( 'manage_wordpoints_points_types' )
147
+							get_site_option('wordpoints_disabled_points_hooks_edit_points_types')
148
+							&& current_user_can('manage_wordpoints_points_types')
149 149
 						) {
150 150
 							?>
151 151
 							<div class="notice notice-info inline notice-alt">
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 							<?php
176 176
 						}
177 177
 
178
-						WordPoints_Points_Hooks::list_by_points_type( $slug );
178
+						WordPoints_Points_Hooks::list_by_points_type($slug);
179 179
 
180 180
 						?>
181 181
 
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
 			} // End foreach ( $points_types ).
190 190
 
191 191
 			if (
192
-				get_site_option( 'wordpoints_disabled_points_hooks_edit_points_types' )
193
-				&& current_user_can( 'manage_wordpoints_points_types' )
192
+				get_site_option('wordpoints_disabled_points_hooks_edit_points_types')
193
+				&& current_user_can('manage_wordpoints_points_types')
194 194
 			) {
195 195
 
196 196
 				?>
197 197
 
198
-				<div class="hooks-holder-wrap new-points-type <?php echo ( $i > 0 ) ? 'closed' : ''; ?>">
198
+				<div class="hooks-holder-wrap new-points-type <?php echo ($i > 0) ? 'closed' : ''; ?>">
199 199
 					<div class="points-type-name">
200 200
 						<div class="points-type-name-arrow"><br /></div>
201
-						<h2><?php esc_html_e( 'Add New Points Type', 'wordpoints' ); ?><span class="spinner"></span></h2>
201
+						<h2><?php esc_html_e('Add New Points Type', 'wordpoints'); ?><span class="spinner"></span></h2>
202 202
 					</div>
203 203
 					<div class="wordpoints-points-add-new hooks-sortables hook">
204 204
 						<div class="notice notice-info inline notice-alt">
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
 	<form method="post">
239 239
 		<?php
240 240
 
241
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
241
+		if (WordPoints_Points_Hooks::get_network_mode()) {
242 242
 			$field = 'save-network-wordpoints-points-hooks';
243 243
 		} else {
244 244
 			$field = 'save-wordpoints-points-hooks';
245 245
 		}
246 246
 
247
-		wp_nonce_field( $field, '_wpnonce_hooks', false );
247
+		wp_nonce_field($field, '_wpnonce_hooks', false);
248 248
 
249 249
 		?>
250 250
 	</form>
@@ -256,18 +256,18 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @since 1.0.0
258 258
 	 */
259
-	do_action( 'wordpoints_admin_points_hooks_foot' );
259
+	do_action('wordpoints_admin_points_hooks_foot');
260 260
 
261 261
 	?>
262 262
 
263 263
 	<br class="clear" />
264 264
 
265 265
 	<div class="hooks-chooser">
266
-		<h3><?php esc_html_e( 'Choose a points type:', 'wordpoints' ); ?></h3>
266
+		<h3><?php esc_html_e('Choose a points type:', 'wordpoints'); ?></h3>
267 267
 		<ul class="hooks-chooser-points-types"></ul>
268 268
 		<div class="hooks-chooser-actions">
269
-			<button class="button-secondary"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></button>
270
-			<button class="button-primary"><?php esc_html_e( 'Add Hook', 'wordpoints' ); ?></button>
269
+			<button class="button-secondary"><?php esc_html_e('Cancel', 'wordpoints'); ?></button>
270
+			<button class="button-primary"><?php esc_html_e('Add Hook', 'wordpoints'); ?></button>
271 271
 		</div>
272 272
 	</div>
273 273
 </div>
Please login to merge, or discard this patch.
src/components/points/admin/screens/logs.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( is_network_admin() ) {
11
-	$title = __( 'WordPoints — Network Points Logs', 'wordpoints' );
10
+if (is_network_admin()) {
11
+	$title = __('WordPoints — Network Points Logs', 'wordpoints');
12 12
 } else {
13
-	$title = __( 'WordPoints — Points Logs', 'wordpoints' );
13
+	$title = __('WordPoints — Points Logs', 'wordpoints');
14 14
 }
15 15
 
16 16
 ?>
17 17
 
18 18
 <div class="wrap">
19
-	<h1><?php echo esc_html( $title ); ?></h1>
20
-	<p class="wordpoints-admin-panel-desc"><?php esc_html_e( 'View recent points transactions.', 'wordpoints' ); ?></p>
19
+	<h1><?php echo esc_html($title); ?></h1>
20
+	<p class="wordpoints-admin-panel-desc"><?php esc_html_e('View recent points transactions.', 'wordpoints'); ?></p>
21 21
 
22 22
 	<?php
23 23
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @since 1.0.0
28 28
 	 */
29
-	do_action( 'wordpoints_admin_points_logs' );
29
+	do_action('wordpoints_admin_points_logs');
30 30
 
31 31
 	$points_types = wordpoints_get_points_types();
32 32
 
33
-	if ( empty( $points_types ) ) {
33
+	if (empty($points_types)) {
34 34
 
35 35
 		wordpoints_show_admin_error(
36 36
 			sprintf(
37
-				__( 'You need to <a href="%s">create a type of points</a> before you can use this page.', 'wordpoints' )
38
-				, esc_url( self_admin_url( 'admin.php?page=wordpoints_points_types' ) )
37
+				__('You need to <a href="%s">create a type of points</a> before you can use this page.', 'wordpoints')
38
+				, esc_url(self_admin_url('admin.php?page=wordpoints_points_types'))
39 39
 			)
40 40
 		);
41 41
 
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
 		// Show a tab for each points type.
45 45
 		$tabs = array();
46 46
 
47
-		foreach ( $points_types as $slug => $settings ) {
47
+		foreach ($points_types as $slug => $settings) {
48 48
 
49
-			$tabs[ $slug ] = $settings['name'];
49
+			$tabs[$slug] = $settings['name'];
50 50
 		}
51 51
 
52
-		wordpoints_admin_show_tabs( $tabs, false );
52
+		wordpoints_admin_show_tabs($tabs, false);
53 53
 
54
-		if ( is_network_admin() ) {
54
+		if (is_network_admin()) {
55 55
 			$query = 'network';
56 56
 		} else {
57 57
 			$query = 'default';
58 58
 		}
59 59
 
60
-		$current_type = wordpoints_admin_get_current_tab( $tabs );
60
+		$current_type = wordpoints_admin_get_current_tab($tabs);
61 61
 
62 62
 		/**
63 63
 		 * At the top of one of the tabs on the points logs admin panel.
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 * @param string $points_type The points type the current tab is for.
68 68
 		 * @param string $query       The current logs query being performed.
69 69
 		 */
70
-		do_action( 'wordpoints_admin_points_logs_tab', $current_type, $query );
70
+		do_action('wordpoints_admin_points_logs_tab', $current_type, $query);
71 71
 
72 72
 		// Get and display the logs based on current points type.
73
-		wordpoints_show_points_logs_query( $current_type, $query );
73
+		wordpoints_show_points_logs_query($current_type, $query);
74 74
 
75 75
 		/**
76 76
 		 * At the bottom of one of the tabs on the points logs admin panel.
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		 * @param string $points_type The points type the current tab is for.
81 81
 		 * @param string $query       The current logs query being performed.
82 82
 		 */
83
-		do_action( 'wordpoints_admin_points_logs_tab_after', $current_type, $query );
83
+		do_action('wordpoints_admin_points_logs_tab_after', $current_type, $query);
84 84
 
85 85
 	} // End if ( empty( $points_types ) ) else.
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @since 1.0.0
91 91
 	 */
92
-	do_action( 'wordpoints_admin_points_logs_after' );
92
+	do_action('wordpoints_admin_points_logs_after');
93 93
 
94 94
 	?>
95 95
 
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks-no-js-load.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,122 +7,122 @@
 block discarded – undo
7 7
  * @since 1.2.0
8 8
  */
9 9
 
10
-if ( ! current_user_can( 'manage_options' ) ) {
10
+if ( ! current_user_can('manage_options')) {
11 11
 	return;
12 12
 }
13 13
 
14
-if ( ! isset( $_POST['hook-id'] ) ) {
14
+if ( ! isset($_POST['hook-id'])) {
15 15
 	return;
16 16
 }
17 17
 
18
-$hook_id = sanitize_key( $_POST['hook-id'] );
18
+$hook_id = sanitize_key($_POST['hook-id']);
19 19
 
20
-check_admin_referer( "save-delete-hook-{$hook_id}" );
20
+check_admin_referer("save-delete-hook-{$hook_id}");
21 21
 
22
-$redirect_url = self_admin_url( 'admin.php?page=wordpoints_points_hooks' );
22
+$redirect_url = self_admin_url('admin.php?page=wordpoints_points_hooks');
23 23
 
24
-if ( is_network_admin() ) {
25
-	WordPoints_Points_Hooks::set_network_mode( true );
24
+if (is_network_admin()) {
25
+	WordPoints_Points_Hooks::set_network_mode(true);
26 26
 }
27 27
 
28
-if ( ! isset( $_POST['points_type'], $_POST['id_base'] ) ) {
28
+if ( ! isset($_POST['points_type'], $_POST['id_base'])) {
29 29
 	return;
30 30
 }
31 31
 
32
-$points_type_id = sanitize_key( $_POST['points_type'] );
33
-$id_base        = sanitize_key( $_POST['id_base'] );
32
+$points_type_id = sanitize_key($_POST['points_type']);
33
+$id_base        = sanitize_key($_POST['id_base']);
34 34
 
35 35
 // These are the hooks grouped by points type.
36 36
 $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
37 37
 
38
-if ( empty( $points_types_hooks ) ) {
38
+if (empty($points_types_hooks)) {
39 39
 	$points_types_hooks = WordPoints_Points_Hooks::get_defaults();
40 40
 }
41 41
 
42
-if ( isset( $points_types_hooks[ $points_type_id ] ) ) {
43
-	$points_type_hooks = $points_types_hooks[ $points_type_id ];
42
+if (isset($points_types_hooks[$points_type_id])) {
43
+	$points_type_hooks = $points_types_hooks[$points_type_id];
44 44
 } else {
45 45
 	$points_type_hooks = array();
46 46
 }
47 47
 
48
-$hook = WordPoints_Points_Hooks::get_handler_by_id_base( $id_base );
48
+$hook = WordPoints_Points_Hooks::get_handler_by_id_base($id_base);
49 49
 
50
-if ( ! empty( $_POST['removehook'] ) ) {
50
+if ( ! empty($_POST['removehook'])) {
51 51
 
52 52
 	// - We are deleting an instance of a hook.
53 53
 
54
-	if ( ! in_array( $hook_id, $points_type_hooks, true ) ) {
54
+	if ( ! in_array($hook_id, $points_type_hooks, true)) {
55 55
 
56 56
 		// The hook isn't hooked to this points type, give an error.
57
-		wp_safe_redirect( $redirect_url . '&error=0' );
57
+		wp_safe_redirect($redirect_url . '&error=0');
58 58
 		exit;
59 59
 	}
60 60
 
61 61
 	// Remove the hook from this points type.
62
-	$points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) );
62
+	$points_types_hooks[$points_type_id] = array_diff($points_type_hooks, array($hook_id));
63 63
 
64
-	$hook->delete_callback( $hook_id );
64
+	$hook->delete_callback($hook_id);
65 65
 
66
-} elseif ( ! empty( $_POST['savehook'] ) ) {
66
+} elseif ( ! empty($_POST['savehook'])) {
67 67
 
68 68
 	// - We are saving an instance of a hook.
69 69
 
70
-	$number = isset( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : '';
70
+	$number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : '';
71 71
 
72
-	if ( $number ) {
72
+	if ($number) {
73 73
 
74 74
 		// Search the POST for the instance settings.
75
-		foreach ( $_POST as $key => $val ) {
75
+		foreach ($_POST as $key => $val) {
76 76
 
77
-			if ( is_array( $val ) && preg_match( '/__i__|%i%/', key( $val ) ) ) {
77
+			if (is_array($val) && preg_match('/__i__|%i%/', key($val))) {
78 78
 
79
-				$new_instance = array_shift( $val );
79
+				$new_instance = array_shift($val);
80 80
 				break;
81 81
 			}
82 82
 		}
83 83
 
84 84
 	} else {
85 85
 
86
-		if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) {
87
-			$new_instance = wp_unslash( reset( $_POST[ 'hook-' . $id_base ] ) ); // WPCS sanitization OK.
86
+		if (isset($_POST['hook-' . $id_base]) && is_array($_POST['hook-' . $id_base])) {
87
+			$new_instance = wp_unslash(reset($_POST['hook-' . $id_base])); // WPCS sanitization OK.
88 88
 		}
89 89
 
90
-		$number = $hook->get_number_by_id( $hook_id );
90
+		$number = $hook->get_number_by_id($hook_id);
91 91
 	}
92 92
 
93
-	if ( ! isset( $new_instance ) || ! is_array( $new_instance ) ) {
93
+	if ( ! isset($new_instance) || ! is_array($new_instance)) {
94 94
 
95 95
 		$new_instance = array();
96 96
 	}
97 97
 
98 98
 	// Update the hook.
99
-	$hook->update_callback( $new_instance, $number );
99
+	$hook->update_callback($new_instance, $number);
100 100
 
101 101
 	// Add hook it to this points type.
102
-	if ( ! in_array( $hook_id, $points_type_hooks ) ) {
102
+	if ( ! in_array($hook_id, $points_type_hooks)) {
103 103
 
104 104
 		$points_type_hooks[] = $hook_id;
105
-		$points_types_hooks[ $points_type_id ] = $points_type_hooks;
105
+		$points_types_hooks[$points_type_id] = $points_type_hooks;
106 106
 	}
107 107
 
108 108
 	// Remove from old points type if it has changed.
109
-	$old_points_type = WordPoints_Points_Hooks::get_points_type( $hook_id );
109
+	$old_points_type = WordPoints_Points_Hooks::get_points_type($hook_id);
110 110
 
111
-	if ( $old_points_type && $old_points_type !== $points_type_id && is_array( $points_types_hooks[ $old_points_type ] ) ) {
111
+	if ($old_points_type && $old_points_type !== $points_type_id && is_array($points_types_hooks[$old_points_type])) {
112 112
 
113
-		$points_types_hooks[ $old_points_type ] = array_diff( $points_types_hooks[ $old_points_type ], array( $hook_id ) );
113
+		$points_types_hooks[$old_points_type] = array_diff($points_types_hooks[$old_points_type], array($hook_id));
114 114
 	}
115 115
 
116 116
 } else {
117 117
 
118
-	wp_safe_redirect( $redirect_url . '&error=0' );
118
+	wp_safe_redirect($redirect_url . '&error=0');
119 119
 	exit;
120 120
 
121 121
 } // End if ( deleting hook ) elseif ( saving hook ) else.
122 122
 
123
-WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
123
+WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
124 124
 
125
-wp_safe_redirect( $redirect_url . '&message=0' );
125
+wp_safe_redirect($redirect_url . '&message=0');
126 126
 exit;
127 127
 
128 128
 // EOF
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks-no-js.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,44 +7,44 @@  discard block
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( ! isset( $_GET['edithook'] ) ) {
10
+if ( ! isset($_GET['edithook'])) {
11 11
 	return;
12 12
 }
13 13
 
14
-$hook_id = sanitize_key( $_GET['edithook'] );
14
+$hook_id = sanitize_key($_GET['edithook']);
15 15
 
16 16
 $points_types = wordpoints_get_points_types();
17 17
 
18
-if ( isset( $_GET['addnew'] ) ) {
18
+if (isset($_GET['addnew'])) {
19 19
 
20 20
 	// - We are adding a new points hook.
21 21
 
22 22
 	$points_type = wordpoints_get_default_points_type();
23 23
 
24 24
 	// Default to the first points type.
25
-	if ( ! $points_type ) {
26
-		reset( $points_types );
27
-		$points_type = key( $points_types );
25
+	if ( ! $points_type) {
26
+		reset($points_types);
27
+		$points_type = key($points_types);
28 28
 	}
29 29
 
30
-	if ( ! $points_type ) {
30
+	if ( ! $points_type) {
31 31
 
32
-		wordpoints_show_admin_error( esc_html__( 'You need to add a points type before you can add any hooks.', 'wordpoints' ) );
32
+		wordpoints_show_admin_error(esc_html__('You need to add a points type before you can add any hooks.', 'wordpoints'));
33 33
 		return;
34 34
 	}
35 35
 
36
-	if ( isset( $_GET['base'], $_GET['num'] ) ) {
36
+	if (isset($_GET['base'], $_GET['num'])) {
37 37
 
38 38
 		// Copy minimal info from an existing instance of this hook to a new instance.
39 39
 		$hook = WordPoints_Points_Hooks::get_handler_by_id_base(
40
-			sanitize_key( $_GET['base'] )
40
+			sanitize_key($_GET['base'])
41 41
 		);
42 42
 
43
-		if ( ! $hook ) {
43
+		if ( ! $hook) {
44 44
 
45 45
 			wordpoints_show_admin_error(
46
-				esc_html__( 'Unable to add the points hook, please try again.', 'wordpoints' )
47
-				, array( 'dismissible' => true )
46
+				esc_html__('Unable to add the points hook, please try again.', 'wordpoints')
47
+				, array('dismissible' => true)
48 48
 			);
49 49
 
50 50
 			return;
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
 
53 53
 		$multi_number = (int) $_GET['num'];
54 54
 		$number       = 0;
55
-		$hook_id      = $hook->get_id( $multi_number );
55
+		$hook_id      = $hook->get_id($multi_number);
56 56
 		$_hook        = $hook;
57 57
 		$id_base      = $hook->get_id_base();
58 58
 
59 59
 	} else {
60 60
 
61 61
 		wordpoints_show_admin_error(
62
-			esc_html__( 'Unable to add the points hook, please try again.', 'wordpoints' )
63
-			, array( 'dismissible' => true )
62
+			esc_html__('Unable to add the points hook, please try again.', 'wordpoints')
63
+			, array('dismissible' => true)
64 64
 		);
65 65
 
66 66
 		return;
@@ -70,42 +70,42 @@  discard block
 block discarded – undo
70 70
 
71 71
 	// We are editing an existing points hook.
72 72
 
73
-	$points_type = isset( $_GET['points_type'] ) ? sanitize_key( $_GET['points_type'] ) : '_inactive_hooks';
73
+	$points_type = isset($_GET['points_type']) ? sanitize_key($_GET['points_type']) : '_inactive_hooks';
74 74
 
75
-	$hook = WordPoints_Points_Hooks::get_handler( $hook_id );
75
+	$hook = WordPoints_Points_Hooks::get_handler($hook_id);
76 76
 
77
-	if ( ! $hook ) {
77
+	if ( ! $hook) {
78 78
 
79
-		wordpoints_show_admin_error( esc_html__( 'The hook you have asked to edit could not be found. Please go back and try again.', 'wordpoints' ) );
79
+		wordpoints_show_admin_error(esc_html__('The hook you have asked to edit could not be found. Please go back and try again.', 'wordpoints'));
80 80
 		return;
81 81
 	}
82 82
 
83 83
 	$id_base = $hook->get_id_base();
84 84
 	$multi_number = 0;
85
-	$number = $hook->get_number_by_id( $hook_id );
85
+	$number = $hook->get_number_by_id($hook_id);
86 86
 
87 87
 } // End if ( adding hook ) else { updating hook }.
88 88
 
89
-$name = esc_html( $hook->get_name() );
89
+$name = esc_html($hook->get_name());
90 90
 
91 91
 // Show the hook form.
92 92
 
93 93
 ?>
94 94
 
95 95
 <div class="wrap">
96
-	<h1><?php esc_html_e( 'Points Hooks', 'wordpoints' ); ?></h1>
97
-	<div class="edithook" style="width:<?php echo absint( $hook->get_option( 'width' ) ); ?>px">
98
-		<h2><?php echo esc_html( sprintf( _x( 'Hook %s', 'hook name', 'wordpoints' ), $name ) ); ?></h2>
96
+	<h1><?php esc_html_e('Points Hooks', 'wordpoints'); ?></h1>
97
+	<div class="edithook" style="width:<?php echo absint($hook->get_option('width')); ?>px">
98
+		<h2><?php echo esc_html(sprintf(_x('Hook %s', 'hook name', 'wordpoints'), $name)); ?></h2>
99 99
 
100
-		<form action="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_hooks' ) ); ?>" method="post">
100
+		<form action="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_points_hooks')); ?>" method="post">
101 101
 			<div class="hook-inside">
102
-				<?php $hook->form_callback( $number ); ?>
102
+				<?php $hook->form_callback($number); ?>
103 103
 			</div>
104 104
 
105
-			<p class="describe"><?php esc_html_e( 'Select the points type to attach this hook to.', 'wordpoints' ); ?></p>
105
+			<p class="describe"><?php esc_html_e('Select the points type to attach this hook to.', 'wordpoints'); ?></p>
106 106
 			<div class="hook-position">
107 107
 				<label for="points_type" class="screen-reader-text">
108
-					<?php esc_html_e( 'Points Type:', 'wordpoints' ); ?>
108
+					<?php esc_html_e('Points Type:', 'wordpoints'); ?>
109 109
 				</label>
110 110
 				<?php
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 							'name'     => 'points_type',
116 116
 							'id'       => 'points_type',
117 117
 							'class'    => 'widefat',
118
-							'options'  => array( '_inactive_hooks' => __( 'Inactive Hooks', 'wordpoints' ) ),
118
+							'options'  => array('_inactive_hooks' => __('Inactive Hooks', 'wordpoints')),
119 119
 						)
120 120
 					);
121 121
 
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 			</div>
124 124
 			<br />
125 125
 			<div class="hook-control-actions">
126
-				<?php if ( isset( $_GET['addnew'] ) ) : ?>
127
-					<a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_hooks' ) ); ?>" class="button alignleft"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></a>
126
+				<?php if (isset($_GET['addnew'])) : ?>
127
+					<a href="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_points_hooks')); ?>" class="button alignleft"><?php esc_html_e('Cancel', 'wordpoints'); ?></a>
128 128
 				<?php else :
129
-						submit_button( _x( 'Delete', 'points hook', 'wordpoints' ), 'button alignleft', 'removehook', false );
129
+						submit_button(_x('Delete', 'points hook', 'wordpoints'), 'button alignleft', 'removehook', false);
130 130
 					endif;
131 131
 
132
-					submit_button( __( 'Save Hook', 'wordpoints' ), 'button-primary alignright', 'savehook', false );
132
+					submit_button(__('Save Hook', 'wordpoints'), 'button-primary alignright', 'savehook', false);
133 133
 				?>
134 134
 
135
-				<input type="hidden" name="hook-id" class="hook-id" value="<?php echo esc_attr( $hook_id ); ?>" />
136
-				<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
137
-				<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
138
-				<?php wp_nonce_field( "save-delete-hook-{$hook_id}" ); ?>
135
+				<input type="hidden" name="hook-id" class="hook-id" value="<?php echo esc_attr($hook_id); ?>" />
136
+				<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
137
+				<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
138
+				<?php wp_nonce_field("save-delete-hook-{$hook_id}"); ?>
139 139
 				<br class="clear" />
140 140
 			</div>
141 141
 		</form>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,8 +125,10 @@
 block discarded – undo
125 125
 			<div class="hook-control-actions">
126 126
 				<?php if ( isset( $_GET['addnew'] ) ) : ?>
127 127
 					<a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_hooks' ) ); ?>" class="button alignleft"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></a>
128
-				<?php else :
128
+				<?php else {
129
+	:
129 130
 						submit_button( _x( 'Delete', 'points hook', 'wordpoints' ), 'button alignleft', 'removehook', false );
131
+}
130 132
 					endif;
131 133
 
132 134
 					submit_button( __( 'Save Hook', 'wordpoints' ), 'button-primary alignright', 'savehook', false );
Please login to merge, or discard this patch.
src/components/points/admin/includes/filters.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,34 +7,34 @@
 block discarded – undo
7 7
  * @since 2.1.0
8 8
  */
9 9
 
10
-add_action( 'init', 'wordpoints_points_admin_register_scripts' );
10
+add_action('init', 'wordpoints_points_admin_register_scripts');
11 11
 
12
-add_action( 'admin_menu', 'wordpoints_points_admin_menu' );
12
+add_action('admin_menu', 'wordpoints_points_admin_menu');
13 13
 
14
-if ( is_wordpoints_network_active() ) {
15
-	add_action( 'network_admin_menu', 'wordpoints_points_admin_menu' );
14
+if (is_wordpoints_network_active()) {
15
+	add_action('network_admin_menu', 'wordpoints_points_admin_menu');
16 16
 }
17 17
 
18
-add_action( 'load-wordpoints_page_wordpoints_points_hooks', 'wordpoints_admin_points_hooks_help' );
18
+add_action('load-wordpoints_page_wordpoints_points_hooks', 'wordpoints_admin_points_hooks_help');
19 19
 
20
-add_action( 'load-wordpoints_page_wordpoints_points_hooks', 'wordpoints_no_js_points_hooks_save' );
20
+add_action('load-wordpoints_page_wordpoints_points_hooks', 'wordpoints_no_js_points_hooks_save');
21 21
 
22
-add_action( 'screen_settings', 'wordpoints_admin_points_hooks_screen_options', 10, 2 );
22
+add_action('screen_settings', 'wordpoints_admin_points_hooks_screen_options', 10, 2);
23 23
 
24
-add_action( 'wordpoints_in_points_hook_form', 'wordpoints_points_hook_description_form', 10, 3 );
24
+add_action('wordpoints_in_points_hook_form', 'wordpoints_points_hook_description_form', 10, 3);
25 25
 
26
-add_action( 'personal_options', 'wordpoints_points_profile_options', 20 );
26
+add_action('personal_options', 'wordpoints_points_profile_options', 20);
27 27
 
28
-add_action( 'personal_options_update', 'wordpoints_points_profile_options_update' );
29
-add_action( 'edit_user_profile_update', 'wordpoints_points_profile_options_update' );
28
+add_action('personal_options_update', 'wordpoints_points_profile_options_update');
29
+add_action('edit_user_profile_update', 'wordpoints_points_profile_options_update');
30 30
 
31
-add_action( 'wordpoints_admin_settings_top', 'wordpoints_points_admin_settings' );
31
+add_action('wordpoints_admin_settings_top', 'wordpoints_points_admin_settings');
32 32
 
33
-add_action( 'wordpoints_admin_settings_update', 'wordpoints_points_admin_settings_save' );
33
+add_action('wordpoints_admin_settings_update', 'wordpoints_points_admin_settings_save');
34 34
 
35
-add_action( 'admin_notices', 'wordpoints_points_admin_notices' );
35
+add_action('admin_notices', 'wordpoints_points_admin_notices');
36 36
 
37
-add_action( 'wp_ajax_wordpoints-points-hooks-order', 'wordpoints_ajax_points_hooks_order' );
38
-add_action( 'wp_ajax_save-wordpoints-points-hook', 'wordpoints_ajax_save_points_hook' );
37
+add_action('wp_ajax_wordpoints-points-hooks-order', 'wordpoints_ajax_points_hooks_order');
38
+add_action('wp_ajax_save-wordpoints-points-hook', 'wordpoints_ajax_save_points_hook');
39 39
 
40 40
 // EOF
Please login to merge, or discard this patch.
src/components/points/admin/includes/ajax.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -16,61 +16,61 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function wordpoints_ajax_points_hooks_order() {
18 18
 
19
-	if ( check_ajax_referer( 'save-network-wordpoints-points-hooks', 'savehooks', false ) ) {
19
+	if (check_ajax_referer('save-network-wordpoints-points-hooks', 'savehooks', false)) {
20 20
 
21
-		if ( ! current_user_can( 'manage_network_wordpoints_points_hooks' ) ) {
22
-			wp_die( -1, '', array( 'response' => 403 ) );
21
+		if ( ! current_user_can('manage_network_wordpoints_points_hooks')) {
22
+			wp_die( -1, '', array('response' => 403) );
23 23
 		}
24 24
 
25 25
 		// Saving network hooks order, turn on network mode.
26
-		WordPoints_Points_Hooks::set_network_mode( true );
26
+		WordPoints_Points_Hooks::set_network_mode(true);
27 27
 
28
-	} elseif ( check_ajax_referer( 'save-wordpoints-points-hooks', 'savehooks', false ) ) {
28
+	} elseif (check_ajax_referer('save-wordpoints-points-hooks', 'savehooks', false)) {
29 29
 
30
-		if ( ! current_user_can( 'manage_options' ) ) {
31
-			wp_die( -1, '', array( 'response' => 403 ) );
30
+		if ( ! current_user_can('manage_options')) {
31
+			wp_die( -1, '', array('response' => 403) );
32 32
 		}
33 33
 
34 34
 	} else {
35 35
 
36 36
 		// CSRF attack (or, more probably, the user left the browser open too long).
37
-		wp_die( -1, '', array( 'response' => 403 ) );
37
+		wp_die( -1, '', array('response' => 403) );
38 38
 	}
39 39
 
40 40
 	// Save hooks order for all points types.
41
-	if ( ! isset( $_POST['points_types'] ) || ! is_array( $_POST['points_types'] ) ) {
42
-		wp_die( -1, '', array( 'response' => 400 ) );
41
+	if ( ! isset($_POST['points_types']) || ! is_array($_POST['points_types'])) {
42
+		wp_die( -1, '', array('response' => 400) );
43 43
 	}
44 44
 
45 45
 	$points_types_hooks = array();
46 46
 
47
-	foreach ( array_keys( wordpoints_get_points_types() ) as $points_type ) {
47
+	foreach (array_keys(wordpoints_get_points_types()) as $points_type) {
48 48
 
49
-		if ( empty( $_POST['points_types'][ $points_type ] ) ) {
49
+		if (empty($_POST['points_types'][$points_type])) {
50 50
 			continue;
51 51
 		}
52 52
 
53
-		$hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][ $points_type ] ) );
53
+		$hooks = sanitize_text_field(wp_unslash($_POST['points_types'][$points_type]));
54 54
 
55 55
 		$points_type_hooks = array();
56 56
 
57
-		$hooks = explode( ',', $hooks );
57
+		$hooks = explode(',', $hooks);
58 58
 
59
-		foreach ( $hooks as $order => $hook_id ) {
59
+		foreach ($hooks as $order => $hook_id) {
60 60
 
61
-			if ( false === strpos( $hook_id, 'hook-' ) ) {
61
+			if (false === strpos($hook_id, 'hook-')) {
62 62
 				continue;
63 63
 			}
64 64
 
65
-			$points_type_hooks[ $order ] = substr( $hook_id, strpos( $hook_id, '_' ) + 1 );
65
+			$points_type_hooks[$order] = substr($hook_id, strpos($hook_id, '_') + 1);
66 66
 		}
67 67
 
68
-		$points_types_hooks[ $points_type ] = $points_type_hooks;
68
+		$points_types_hooks[$points_type] = $points_type_hooks;
69 69
 	}
70 70
 
71
-	WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
71
+	WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
72 72
 
73
-	wp_die( 1, '', array( 'response' => 200 ) );
73
+	wp_die(1, '', array('response' => 200));
74 74
 }
75 75
 
76 76
 /**
@@ -83,30 +83,30 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function wordpoints_ajax_save_points_hook() {
85 85
 
86
-	if ( check_ajax_referer( 'save-network-wordpoints-points-hooks', 'savehooks', false ) ) {
86
+	if (check_ajax_referer('save-network-wordpoints-points-hooks', 'savehooks', false)) {
87 87
 
88
-		if ( ! current_user_can( 'manage_network_wordpoints_points_hooks' ) ) {
89
-			wp_die( -1, '', array( 'response' => 403 ) );
88
+		if ( ! current_user_can('manage_network_wordpoints_points_hooks')) {
89
+			wp_die( -1, '', array('response' => 403) );
90 90
 		}
91 91
 
92 92
 		// Saving network hooks, turn on network mode.
93
-		WordPoints_Points_Hooks::set_network_mode( true );
93
+		WordPoints_Points_Hooks::set_network_mode(true);
94 94
 
95
-	} elseif ( check_ajax_referer( 'save-wordpoints-points-hooks', 'savehooks', false ) ) {
95
+	} elseif (check_ajax_referer('save-wordpoints-points-hooks', 'savehooks', false)) {
96 96
 
97
-		if ( ! current_user_can( 'manage_options' ) ) {
98
-			wp_die( -1, '', array( 'response' => 403 ) );
97
+		if ( ! current_user_can('manage_options')) {
98
+			wp_die( -1, '', array('response' => 403) );
99 99
 		}
100 100
 
101 101
 	} else {
102 102
 
103 103
 		// CSRF attack (or, more probably the user left the browser open too long).
104
-		wp_die( -1, '', array( 'response' => 403 ) );
104
+		wp_die( -1, '', array('response' => 403) );
105 105
 	}
106 106
 
107
-	$error = __( 'An error has occurred. Please reload the page and try again.', 'wordpoints' );
107
+	$error = __('An error has occurred. Please reload the page and try again.', 'wordpoints');
108 108
 
109
-	if ( isset( $_POST['points-slug'] ) ) {
109
+	if (isset($_POST['points-slug'])) {
110 110
 
111 111
 		// - We are saving the settings for a points type.
112 112
 
@@ -117,55 +117,55 @@  discard block
 block discarded – undo
117 117
 			, 'Performing CRUD actions on points types using this function is deprecated.'
118 118
 		);
119 119
 
120
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
121
-			wp_die( -1, '', array( 'response' => 403 ) );
120
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
121
+			wp_die( -1, '', array('response' => 403) );
122 122
 		}
123 123
 
124 124
 		$settings = array();
125 125
 
126
-		if ( isset( $_POST['points-name'] ) ) {
127
-			$settings['name'] = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) );
126
+		if (isset($_POST['points-name'])) {
127
+			$settings['name'] = trim(sanitize_text_field(wp_unslash($_POST['points-name'])));
128 128
 		}
129 129
 
130
-		if ( isset( $_POST['points-prefix'] ) ) {
131
-			$settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) );
130
+		if (isset($_POST['points-prefix'])) {
131
+			$settings['prefix'] = ltrim(sanitize_text_field(wp_unslash($_POST['points-prefix'])));
132 132
 		}
133 133
 
134
-		if ( isset( $_POST['points-suffix'] ) ) {
135
-			$settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) );
134
+		if (isset($_POST['points-suffix'])) {
135
+			$settings['suffix'] = rtrim(sanitize_text_field(wp_unslash($_POST['points-suffix'])));
136 136
 		}
137 137
 
138
-		$points_type = sanitize_key( $_POST['points-slug'] );
138
+		$points_type = sanitize_key($_POST['points-slug']);
139 139
 
140
-		$old_settings = wordpoints_get_points_type( $points_type );
140
+		$old_settings = wordpoints_get_points_type($points_type);
141 141
 
142
-		if ( false === $old_settings ) {
143
-			wp_die( -1, '', array( 'response' => 200 ) );
142
+		if (false === $old_settings) {
143
+			wp_die( -1, '', array('response' => 200) );
144 144
 		}
145 145
 
146
-		if ( is_array( $old_settings ) ) {
147
-			$settings = array_merge( $old_settings, $settings );
146
+		if (is_array($old_settings)) {
147
+			$settings = array_merge($old_settings, $settings);
148 148
 		}
149 149
 
150
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
150
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
151 151
 
152 152
 			// If this fails, show the user a message along with the form.
153
-			echo '<p>' . esc_html__( 'An error has occurred. Please try again.', 'wordpoints' ) . '</p>';
153
+			echo '<p>' . esc_html__('An error has occurred. Please try again.', 'wordpoints') . '</p>';
154 154
 
155
-			WordPoints_Points_Hooks::points_type_form( $points_type, 'none' );
155
+			WordPoints_Points_Hooks::points_type_form($points_type, 'none');
156 156
 		}
157 157
 
158 158
 	} else {
159 159
 
160 160
 		// - We are creating/updating/deleting an instance of a hook.
161 161
 
162
-		if ( ! isset( $_POST['id_base'], $_POST['hook-id'], $_POST['points_type'], $_POST['hook_number'] ) ) {
163
-			wp_die( -1, '', array( 'response' => 400 ) );
162
+		if ( ! isset($_POST['id_base'], $_POST['hook-id'], $_POST['points_type'], $_POST['hook_number'])) {
163
+			wp_die( -1, '', array('response' => 400) );
164 164
 		}
165 165
 
166
-		$id_base        = sanitize_key( $_POST['id_base'] );
167
-		$hook_id        = sanitize_key( $_POST['hook-id'] );
168
-		$points_type_id = sanitize_key( $_POST['points_type'] );
166
+		$id_base        = sanitize_key($_POST['id_base']);
167
+		$hook_id        = sanitize_key($_POST['hook-id']);
168
+		$points_type_id = sanitize_key($_POST['points_type']);
169 169
 		$number         = (int) $_POST['hook_number'];
170 170
 
171 171
 		/*
@@ -174,48 +174,48 @@  discard block
 block discarded – undo
174 174
 		 * created hook, the ID won't have been set when the form was output, so
175 175
 		 * 'hook-id' will be empty, and we'll get the ID from 'multi_number'.
176 176
 		 */
177
-		if ( ! $number ) {
177
+		if ( ! $number) {
178 178
 
179 179
 			// This holds the ID number if the hook is brand new.
180
-			if ( ! isset( $_POST['multi_number'] ) || ! wordpoints_posint( $_POST['multi_number'] ) ) {
181
-				wp_die( '<p>' . esc_html( $error ) . '</p>', '', array( 'response' => 400 ) );
180
+			if ( ! isset($_POST['multi_number']) || ! wordpoints_posint($_POST['multi_number'])) {
181
+				wp_die('<p>' . esc_html($error) . '</p>', '', array('response' => 400));
182 182
 			}
183 183
 
184 184
 			$number  = (int) $_POST['multi_number'];
185 185
 			$hook_id = $id_base . '-' . $number;
186 186
 		}
187 187
 
188
-		$hook = WordPoints_Points_Hooks::get_handler( $hook_id );
188
+		$hook = WordPoints_Points_Hooks::get_handler($hook_id);
189 189
 
190 190
 		$settings = false;
191 191
 
192
-		if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) {
193
-			$settings = wp_unslash( $_POST[ 'hook-' . $id_base ] ); // WPCS: sanitization OK.
192
+		if (isset($_POST['hook-' . $id_base]) && is_array($_POST['hook-' . $id_base])) {
193
+			$settings = wp_unslash($_POST['hook-' . $id_base]); // WPCS: sanitization OK.
194 194
 		}
195 195
 
196 196
 		$points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
197 197
 
198 198
 		// Get the hooks for this points type.
199
-		$points_type_hooks = ( isset( $points_types_hooks[ $points_type_id ] ) ) ? $points_types_hooks[ $points_type_id ] : array();
199
+		$points_type_hooks = (isset($points_types_hooks[$points_type_id])) ? $points_types_hooks[$points_type_id] : array();
200 200
 
201
-		if ( ! empty( $_POST['delete_hook'] ) ) {
201
+		if ( ! empty($_POST['delete_hook'])) {
202 202
 
203 203
 			// - We are deleting a hook instance.
204 204
 
205
-			if ( false === $hook ) {
206
-				wp_die( '<p>' . esc_html( $error ) . '</p>', '', array( 'response' => 400 ) );
205
+			if (false === $hook) {
206
+				wp_die('<p>' . esc_html($error) . '</p>', '', array('response' => 400));
207 207
 			}
208 208
 
209
-			$hook->delete_callback( $number );
209
+			$hook->delete_callback($number);
210 210
 
211 211
 			// Remove this instance of the hook, and reset the positions (keys).
212
-			$points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) );
212
+			$points_types_hooks[$points_type_id] = array_diff($points_type_hooks, array($hook_id));
213 213
 
214
-			WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
214
+			WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
215 215
 
216
-			wp_die( esc_html( "deleted:{$hook_id}" ), '', array( 'response' => 200 ) );
216
+			wp_die(esc_html("deleted:{$hook_id}"), '', array('response' => 200));
217 217
 
218
-		} elseif ( $settings && false === $hook ) {
218
+		} elseif ($settings && false === $hook) {
219 219
 
220 220
 			// - We are creating a new a new instance of a hook.
221 221
 
@@ -224,36 +224,36 @@  discard block
 block discarded – undo
224 224
 			 * since the hook is new, it hasn't been assigned an ID yet, so we can't
225 225
 			 * just get it from the array of hooks by ID.
226 226
 			 */
227
-			$hook = WordPoints_Points_Hooks::get_handler_by_id_base( $id_base );
227
+			$hook = WordPoints_Points_Hooks::get_handler_by_id_base($id_base);
228 228
 
229
-			$new_instance = reset( $settings );
229
+			$new_instance = reset($settings);
230 230
 
231 231
 			// Save the points types-hooks associations.
232
-			$points_type_hooks[] = $hook->get_id( $number );
233
-			$points_types_hooks[ $points_type_id ] = $points_type_hooks;
234
-			WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
232
+			$points_type_hooks[] = $hook->get_id($number);
233
+			$points_types_hooks[$points_type_id] = $points_type_hooks;
234
+			WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
235 235
 
236 236
 		} else {
237 237
 
238 238
 			// - We are updating the settings for an instance of a hook.
239 239
 
240
-			if ( false === $hook ) {
241
-				wp_die( '<p>' . esc_html( $error ) . '</p>', '', array( 'response' => 400 ) );
240
+			if (false === $hook) {
241
+				wp_die('<p>' . esc_html($error) . '</p>', '', array('response' => 400));
242 242
 			}
243 243
 
244
-			$new_instance = ( ! empty( $settings ) ) ? reset( $settings ) : array();
244
+			$new_instance = ( ! empty($settings)) ? reset($settings) : array();
245 245
 
246 246
 		} // End if ( deleting ) elseif ( creating ) else { updating }.
247 247
 
248
-		$hook->update_callback( wp_unslash( $new_instance ), $number );
248
+		$hook->update_callback(wp_unslash($new_instance), $number);
249 249
 
250
-		if ( empty( $_POST['add_new'] ) ) {
251
-			$hook->form_callback( $number );
250
+		if (empty($_POST['add_new'])) {
251
+			$hook->form_callback($number);
252 252
 		}
253 253
 
254 254
 	} // End if ( saving points type ) else { deleting/creation/updating hook }.
255 255
 
256
-	wp_die( '', '', array( 'response' => 200 ) );
256
+	wp_die('', '', array('response' => 200));
257 257
 }
258 258
 
259 259
 // EOF
Please login to merge, or discard this patch.
src/components/points/admin/includes/functions.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -246,9 +246,9 @@
 block discarded – undo
246 246
 			}
247 247
 
248 248
 			$screen_options = '<p><a id="access-on" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&amp;accessibility-mode=on">'
249
-			                  . esc_html__( 'Enable accessibility mode', 'wordpoints' )
250
-			                  . '</a><a id="access-off" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&amp;accessibility-mode=off">'
251
-			                  . esc_html__( 'Disable accessibility mode', 'wordpoints' ) . "</a></p>\n";
249
+							  . esc_html__( 'Enable accessibility mode', 'wordpoints' )
250
+							  . '</a><a id="access-off" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&amp;accessibility-mode=off">'
251
+							  . esc_html__( 'Disable accessibility mode', 'wordpoints' ) . "</a></p>\n";
252 252
 			break;
253 253
 	}
254 254
 
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 	wp_register_style(
26 26
 		'wordpoints-admin-points-hooks'
27 27
 		, "{$assets_url}/css/hooks{$suffix}.css"
28
-		, array( 'dashicons' )
28
+		, array('dashicons')
29 29
 		, WORDPOINTS_VERSION
30 30
 	);
31 31
 
32 32
 	$styles = wp_styles();
33
-	$styles->add_data( 'wordpoints-admin-points-hooks', 'rtl', 'replace' );
33
+	$styles->add_data('wordpoints-admin-points-hooks', 'rtl', 'replace');
34 34
 
35
-	if ( $suffix ) {
36
-		$styles->add_data( 'wordpoints-admin-points-hooks', 'suffix', $suffix );
35
+	if ($suffix) {
36
+		$styles->add_data('wordpoints-admin-points-hooks', 'suffix', $suffix);
37 37
 	}
38 38
 
39 39
 	// JS
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	wp_register_script(
42 42
 		'wordpoints-admin-points-types'
43 43
 		, "{$assets_url}/js/points-types{$suffix}.js"
44
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
44
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
45 45
 		, WORDPOINTS_VERSION
46 46
 	);
47 47
 
@@ -49,25 +49,25 @@  discard block
 block discarded – undo
49 49
 		'wordpoints-admin-points-types'
50 50
 		, 'WordPointsPointsTypesL10n'
51 51
 		, array(
52
-			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all logs, event reactions, and other data associated with this points type.', 'wordpoints' )
53
-				. ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
54
-			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
55
-			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
56
-			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
52
+			'confirmDelete' => esc_html__('Are you sure that you want to delete this points type? This will delete all logs, event reactions, and other data associated with this points type.', 'wordpoints')
53
+				. ' ' . esc_html__('Once a points type has been deleted, you cannot bring it back.', 'wordpoints'),
54
+			'confirmTitle'  => esc_html__('Are you sure?', 'wordpoints'),
55
+			'deleteText'    => esc_html__('Delete', 'wordpoints'),
56
+			'cancelText'    => esc_html__('Cancel', 'wordpoints'),
57 57
 		)
58 58
 	);
59 59
 
60 60
 	wp_register_script(
61 61
 		'wordpoints-hooks-reactor-points'
62 62
 		, "{$assets_url}/js/hooks/reactors/points{$manifested_suffix}.js"
63
-		, array( 'wordpoints-hooks-views' )
63
+		, array('wordpoints-hooks-views')
64 64
 		, WORDPOINTS_VERSION
65 65
 	);
66 66
 
67 67
 	wp_register_script(
68 68
 		'wordpoints-admin-points-hooks'
69 69
 		, "{$assets_url}/js/hooks{$suffix}.js"
70
-		, array( 'jquery', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-dialog' )
70
+		, array('jquery', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-dialog')
71 71
 		, WORDPOINTS_VERSION
72 72
 	);
73 73
 }
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 	$wordpoints_menu = wordpoints_get_main_admin_menu();
86 86
 
87 87
 	/** @var WordPoints_Admin_Screens $admin_screens */
88
-	$admin_screens = wordpoints_apps()->get_sub_app( 'admin' )->get_sub_app(
88
+	$admin_screens = wordpoints_apps()->get_sub_app('admin')->get_sub_app(
89 89
 		'screen'
90 90
 	);
91 91
 
92 92
 	// Hooks page.
93 93
 	$id = add_submenu_page(
94 94
 		$wordpoints_menu
95
-		, __( 'WordPoints — Points Types', 'wordpoints' )
96
-		, __( 'Points Types', 'wordpoints' )
95
+		, __('WordPoints — Points Types', 'wordpoints')
96
+		, __('Points Types', 'wordpoints')
97 97
 		, 'manage_options'
98 98
 		, 'wordpoints_points_types'
99
-		, array( $admin_screens, 'display' )
99
+		, array($admin_screens, 'display')
100 100
 	);
101 101
 
102
-	if ( $id ) {
103
-		$admin_screens->register( $id, 'WordPoints_Points_Admin_Screen_Points_Types' );
102
+	if ($id) {
103
+		$admin_screens->register($id, 'WordPoints_Points_Admin_Screen_Points_Types');
104 104
 	}
105 105
 
106 106
 	// Remove the old hooks screen if not needed.
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 
114 114
 	// If all of the registered hooks have been imported and disabled, then there is
115 115
 	// no need to keep the old hooks screen.
116
-	if ( array_diff_key( $hooks, $disabled_hooks ) ) {
116
+	if (array_diff_key($hooks, $disabled_hooks)) {
117 117
 		// Legacy hooks page.
118 118
 		add_submenu_page(
119 119
 			$wordpoints_menu
120
-			,__( 'WordPoints — Points Hooks', 'wordpoints' )
121
-			,__( 'Points Hooks', 'wordpoints' )
120
+			,__('WordPoints — Points Hooks', 'wordpoints')
121
+			,__('Points Hooks', 'wordpoints')
122 122
 			,'manage_options'
123 123
 			,'wordpoints_points_hooks'
124 124
 			,'wordpoints_points_admin_screen_hooks'
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	// Logs page.
129 129
 	add_submenu_page(
130 130
 		$wordpoints_menu
131
-		,__( 'WordPoints — Points Logs', 'wordpoints' )
132
-		,__( 'Points Logs', 'wordpoints' )
131
+		,__('WordPoints — Points Logs', 'wordpoints')
132
+		,__('Points Logs', 'wordpoints')
133 133
 		,'manage_options'
134 134
 		,'wordpoints_points_logs'
135 135
 		,'wordpoints_points_admin_screen_logs'
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
  */
144 144
 function wordpoints_points_admin_screen_hooks() {
145 145
 
146
-	if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK.
146
+	if (isset($_GET['edithook']) || isset($_POST['savehook']) || isset($_POST['removehook'])) { // WPCS: CSRF OK.
147 147
 
148 148
 		// - We're doing this without AJAX (JS).
149 149
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
  */
207 207
 function wordpoints_no_js_points_hooks_save() {
208 208
 
209
-	if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK.
209
+	if ( ! isset($_POST['savehook']) && ! isset($_POST['removehook'])) { // WPCS: CSRF OK.
210 210
 		return;
211 211
 	}
212 212
 
@@ -230,25 +230,25 @@  discard block
 block discarded – undo
230 230
  *
231 231
  * @return string Options for this screen.
232 232
  */
233
-function wordpoints_admin_points_hooks_screen_options( $screen_options, $screen ) {
233
+function wordpoints_admin_points_hooks_screen_options($screen_options, $screen) {
234 234
 
235 235
 	$path = 'admin.php?page=wordpoints_points_hooks';
236 236
 
237
-	switch ( $screen->id ) {
237
+	switch ($screen->id) {
238 238
 
239 239
 		case 'wordpoints_page_wordpoints_points_hooks':
240
-			$url = admin_url( $path );
240
+			$url = admin_url($path);
241 241
 			// fallthru
242 242
 
243 243
 		case 'wordpoints_page_wordpoints_points_hooks-network':
244
-			if ( ! isset( $url ) ) {
245
-				$url = network_admin_url( $path );
244
+			if ( ! isset($url)) {
245
+				$url = network_admin_url($path);
246 246
 			}
247 247
 
248
-			$screen_options = '<p><a id="access-on" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&amp;accessibility-mode=on">'
249
-			                  . esc_html__( 'Enable accessibility mode', 'wordpoints' )
250
-			                  . '</a><a id="access-off" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&amp;accessibility-mode=off">'
251
-			                  . esc_html__( 'Disable accessibility mode', 'wordpoints' ) . "</a></p>\n";
248
+			$screen_options = '<p><a id="access-on" href="' . esc_url(wp_nonce_url($url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce')) . '&amp;accessibility-mode=on">'
249
+			                  . esc_html__('Enable accessibility mode', 'wordpoints')
250
+			                  . '</a><a id="access-off" href="' . esc_url(wp_nonce_url($url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce')) . '&amp;accessibility-mode=off">'
251
+			                  . esc_html__('Disable accessibility mode', 'wordpoints') . "</a></p>\n";
252 252
 			break;
253 253
 	}
254 254
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
  *
267 267
  * @return string The classes, with 'wordpoints_hooks_access' added.
268 268
  */
269
-function wordpoints_points_hooks_access_body_class( $classes ) {
269
+function wordpoints_points_hooks_access_body_class($classes) {
270 270
 
271 271
 	return "{$classes} wordpoints_hooks_access ";
272 272
 }
@@ -282,22 +282,22 @@  discard block
 block discarded – undo
282 282
  * @param array                  $instance The settings for this hook instance.
283 283
  * @param WordPoints_Points_Hook $hook     The points hook object.
284 284
  */
285
-function wordpoints_points_hook_description_form( $has_form, $instance, $hook ) {
285
+function wordpoints_points_hook_description_form($has_form, $instance, $hook) {
286 286
 
287
-	$description = ( isset( $instance['_description'] ) ) ? $instance['_description'] : '';
287
+	$description = (isset($instance['_description'])) ? $instance['_description'] : '';
288 288
 
289 289
 	?>
290 290
 
291
-	<?php if ( $has_form ) : ?>
291
+	<?php if ($has_form) : ?>
292 292
 		<hr />
293 293
 	<?php else : ?>
294 294
 		<br />
295 295
 	<?php endif; ?>
296 296
 
297 297
 	<div class="hook-instance-description">
298
-		<label for="<?php $hook->the_field_id( '_description' ); ?>"><?php echo esc_html_x( 'Description (optional):', 'points hook', 'wordpoints' ); ?></label>
299
-		<input type="text" id="<?php $hook->the_field_id( '_description' ); ?>" name="<?php $hook->the_field_name( '_description' ); ?>" class="widefat" value="<?php echo esc_attr( $description ); ?>" />
300
-		<p class="description"><?php echo esc_html( sprintf( _x( 'Default: %s', 'points hook description', 'wordpoints' ), $hook->get_description( 'generated' ) ) ); ?></p>
298
+		<label for="<?php $hook->the_field_id('_description'); ?>"><?php echo esc_html_x('Description (optional):', 'points hook', 'wordpoints'); ?></label>
299
+		<input type="text" id="<?php $hook->the_field_id('_description'); ?>" name="<?php $hook->the_field_name('_description'); ?>" class="widefat" value="<?php echo esc_attr($description); ?>" />
300
+		<p class="description"><?php echo esc_html(sprintf(_x('Default: %s', 'points hook description', 'wordpoints'), $hook->get_description('generated'))); ?></p>
301 301
 	</div>
302 302
 
303 303
 	<br />
@@ -314,44 +314,44 @@  discard block
 block discarded – undo
314 314
  *
315 315
  * @param WP_User $user The user object for the user being edited.
316 316
  */
317
-function wordpoints_points_profile_options( $user ) {
317
+function wordpoints_points_profile_options($user) {
318 318
 
319
-	if ( current_user_can( 'set_wordpoints_points', $user->ID ) ) {
319
+	if (current_user_can('set_wordpoints_points', $user->ID)) {
320 320
 
321 321
 		?>
322 322
 
323 323
 		</table>
324 324
 
325
-		<h2><?php esc_html_e( 'WordPoints', 'wordpoints' ); ?></h2>
326
-		<p><?php esc_html_e( "If you would like to change the value for a type of points, enter the desired value in the text field, and check the checkbox beside it. If you don't check the checkbox, the change will not be saved. To provide a reason for the change, fill out the text field below.", 'wordpoints' ); ?></p>
327
-		<lable><?php esc_html_e( 'Reason', 'wordpoints' ); ?> <input type="text" name="wordpoints_set_reason" />
325
+		<h2><?php esc_html_e('WordPoints', 'wordpoints'); ?></h2>
326
+		<p><?php esc_html_e("If you would like to change the value for a type of points, enter the desired value in the text field, and check the checkbox beside it. If you don't check the checkbox, the change will not be saved. To provide a reason for the change, fill out the text field below.", 'wordpoints'); ?></p>
327
+		<lable><?php esc_html_e('Reason', 'wordpoints'); ?> <input type="text" name="wordpoints_set_reason" />
328 328
 		<table class="form-table">
329 329
 
330 330
 		<?php
331 331
 
332
-		wp_nonce_field( 'wordpoints_points_set_profile', 'wordpoints_points_set_nonce' );
332
+		wp_nonce_field('wordpoints_points_set_profile', 'wordpoints_points_set_nonce');
333 333
 
334
-		foreach ( wordpoints_get_points_types() as $slug => $type ) {
334
+		foreach (wordpoints_get_points_types() as $slug => $type) {
335 335
 
336
-			$points = wordpoints_get_points( $user->ID, $slug );
336
+			$points = wordpoints_get_points($user->ID, $slug);
337 337
 
338 338
 			?>
339 339
 
340 340
 			<tr>
341
-				<th scope="row"><?php echo esc_html( $type['name'] ); ?></th>
341
+				<th scope="row"><?php echo esc_html($type['name']); ?></th>
342 342
 				<td>
343
-					<input type="hidden" name="<?php echo esc_attr( "wordpoints_points_old-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" />
344
-					<input type="number" name="<?php echo esc_attr( "wordpoints_points-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" autocomplete="off" />
345
-					<input type="checkbox" value="1" name="<?php echo esc_attr( "wordpoints_points_set-{$slug}" ); ?>" />
343
+					<input type="hidden" name="<?php echo esc_attr("wordpoints_points_old-{$slug}"); ?>" value="<?php echo esc_attr($points); ?>" />
344
+					<input type="number" name="<?php echo esc_attr("wordpoints_points-{$slug}"); ?>" value="<?php echo esc_attr($points); ?>" autocomplete="off" />
345
+					<input type="checkbox" value="1" name="<?php echo esc_attr("wordpoints_points_set-{$slug}"); ?>" />
346 346
 					<?php /* translators: %s is the number of points. */ ?>
347
-					<span><?php echo esc_html( sprintf( __( '(current: %s)', 'wordpoints' ), $points ) ); ?></span>
347
+					<span><?php echo esc_html(sprintf(__('(current: %s)', 'wordpoints'), $points)); ?></span>
348 348
 				</td>
349 349
 			</tr>
350 350
 
351 351
 			<?php
352 352
 		}
353 353
 
354
-	} elseif ( defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) {
354
+	} elseif (defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE) {
355 355
 
356 356
 		/**
357 357
 		 * My points admin profile heading.
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
 		 *
366 366
 		 * @param string $heading The text for the heading.
367 367
 		 */
368
-		$heading = apply_filters( 'wordpoints_profile_points_heading', __( 'My Points', 'wordpoints' ) );
368
+		$heading = apply_filters('wordpoints_profile_points_heading', __('My Points', 'wordpoints'));
369 369
 
370 370
 		?>
371 371
 
372 372
 		</table>
373 373
 
374
-		<h2><?php echo esc_html( $heading ); ?></h2>
374
+		<h2><?php echo esc_html($heading); ?></h2>
375 375
 
376 376
 		<table>
377 377
 		<tbody>
378
-		<?php foreach ( wordpoints_get_points_types() as $slug => $type ) : ?>
378
+		<?php foreach (wordpoints_get_points_types() as $slug => $type) : ?>
379 379
 			<tr>
380
-				<th scope="row" style="text-align: left;"><?php echo esc_html( $type['name'] ); ?></th>
381
-				<td style="text-align: right;"><?php wordpoints_display_points( $user->ID, $slug, 'profile_page' ); ?></td>
380
+				<th scope="row" style="text-align: left;"><?php echo esc_html($type['name']); ?></th>
381
+				<td style="text-align: right;"><?php wordpoints_display_points($user->ID, $slug, 'profile_page'); ?></td>
382 382
 			</tr>
383 383
 		<?php endforeach; ?>
384 384
 		</tbody>
@@ -400,39 +400,39 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return void
402 402
  */
403
-function wordpoints_points_profile_options_update( $user_id ) {
403
+function wordpoints_points_profile_options_update($user_id) {
404 404
 
405
-	if ( ! current_user_can( 'set_wordpoints_points', $user_id ) ) {
405
+	if ( ! current_user_can('set_wordpoints_points', $user_id)) {
406 406
 		return;
407 407
 	}
408 408
 
409 409
 	if (
410
-		! isset( $_POST['wordpoints_points_set_nonce'], $_POST['wordpoints_set_reason'] )
411
-		|| ! wordpoints_verify_nonce( 'wordpoints_points_set_nonce', 'wordpoints_points_set_profile', null, 'post' )
410
+		! isset($_POST['wordpoints_points_set_nonce'], $_POST['wordpoints_set_reason'])
411
+		|| ! wordpoints_verify_nonce('wordpoints_points_set_nonce', 'wordpoints_points_set_profile', null, 'post')
412 412
 	) {
413 413
 		return;
414 414
 	}
415 415
 
416
-	foreach ( wordpoints_get_points_types() as $slug => $type ) {
416
+	foreach (wordpoints_get_points_types() as $slug => $type) {
417 417
 
418 418
 		if (
419 419
 			isset(
420
-				$_POST[ "wordpoints_points_set-{$slug}" ]
421
-				, $_POST[ "wordpoints_points-{$slug}" ]
422
-				, $_POST[ "wordpoints_points_old-{$slug}" ]
420
+				$_POST["wordpoints_points_set-{$slug}"]
421
+				, $_POST["wordpoints_points-{$slug}"]
422
+				, $_POST["wordpoints_points_old-{$slug}"]
423 423
 			)
424
-			&& false !== wordpoints_int( $_POST[ "wordpoints_points-{$slug}" ] )
425
-			&& false !== wordpoints_int( $_POST[ "wordpoints_points_old-{$slug}" ] )
424
+			&& false !== wordpoints_int($_POST["wordpoints_points-{$slug}"])
425
+			&& false !== wordpoints_int($_POST["wordpoints_points_old-{$slug}"])
426 426
 		) {
427 427
 
428 428
 			wordpoints_alter_points(
429 429
 				$user_id
430
-				, (int) $_POST[ "wordpoints_points-{$slug}" ] - (int) $_POST[ "wordpoints_points_old-{$slug}" ]
430
+				, (int) $_POST["wordpoints_points-{$slug}"] - (int) $_POST["wordpoints_points_old-{$slug}"]
431 431
 				, $slug
432 432
 				, 'profile_edit'
433 433
 				, array(
434 434
 					'user_id' => get_current_user_id(),
435
-					'reason' => sanitize_text_field( wp_unslash( $_POST['wordpoints_set_reason'] ) ),
435
+					'reason' => sanitize_text_field(wp_unslash($_POST['wordpoints_set_reason'])),
436 436
 				)
437 437
 			);
438 438
 		}
@@ -454,22 +454,22 @@  discard block
 block discarded – undo
454 454
 		'selected'         => wordpoints_get_default_points_type(),
455 455
 		'id'               => 'default_points_type',
456 456
 		'name'             => 'default_points_type',
457
-		'show_option_none' => __( 'No default', 'wordpoints' ),
457
+		'show_option_none' => __('No default', 'wordpoints'),
458 458
 	);
459 459
 
460 460
 	?>
461 461
 
462
-	<h3><?php esc_html_e( 'Default Points Type', 'wordpoints' ); ?></h3>
463
-	<p><?php esc_html_e( 'You can optionally set one points type to be the default. The default points type will, for example, be used by shortcodes when no type is specified. This is also useful if you only have one type of points.', 'wordpoints' ); ?></p>
462
+	<h3><?php esc_html_e('Default Points Type', 'wordpoints'); ?></h3>
463
+	<p><?php esc_html_e('You can optionally set one points type to be the default. The default points type will, for example, be used by shortcodes when no type is specified. This is also useful if you only have one type of points.', 'wordpoints'); ?></p>
464 464
 	<table class="form-table">
465 465
 		<tbody>
466 466
 			<tr>
467 467
 				<th>
468
-					<label for="default_points_type"><?php esc_html_e( 'Default', 'wordpoints' ); ?></label>
468
+					<label for="default_points_type"><?php esc_html_e('Default', 'wordpoints'); ?></label>
469 469
 				</th>
470 470
 				<td>
471
-					<?php wordpoints_points_types_dropdown( $dropdown_args ); ?>
472
-					<?php wp_nonce_field( 'wordpoints_default_points_type', 'wordpoints_default_points_type_nonce' ); ?>
471
+					<?php wordpoints_points_types_dropdown($dropdown_args); ?>
472
+					<?php wp_nonce_field('wordpoints_default_points_type', 'wordpoints_default_points_type_nonce'); ?>
473 473
 				</td>
474 474
 			</tr>
475 475
 		</tbody>
@@ -488,19 +488,19 @@  discard block
 block discarded – undo
488 488
 function wordpoints_points_admin_settings_save() {
489 489
 
490 490
 	if (
491
-		isset( $_POST['default_points_type'] )
492
-		&& wordpoints_verify_nonce( 'wordpoints_default_points_type_nonce', 'wordpoints_default_points_type', null, 'post' )
491
+		isset($_POST['default_points_type'])
492
+		&& wordpoints_verify_nonce('wordpoints_default_points_type_nonce', 'wordpoints_default_points_type', null, 'post')
493 493
 	) {
494 494
 
495
-		$points_type = sanitize_key( $_POST['default_points_type'] );
495
+		$points_type = sanitize_key($_POST['default_points_type']);
496 496
 
497
-		if ( '-1' === $points_type ) {
497
+		if ('-1' === $points_type) {
498 498
 
499
-			wordpoints_update_maybe_network_option( 'wordpoints_default_points_type', '' );
499
+			wordpoints_update_maybe_network_option('wordpoints_default_points_type', '');
500 500
 
501
-		} elseif ( wordpoints_is_points_type( $points_type ) ) {
501
+		} elseif (wordpoints_is_points_type($points_type)) {
502 502
 
503
-			wordpoints_update_maybe_network_option( 'wordpoints_default_points_type', $points_type );
503
+			wordpoints_update_maybe_network_option('wordpoints_default_points_type', $points_type);
504 504
 		}
505 505
 	}
506 506
 }
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
 function wordpoints_points_admin_notices() {
516 516
 
517 517
 	if (
518
-		( ! isset( $_GET['page'] ) || 'wordpoints_points_types' !== $_GET['page'] )
519
-		&& current_user_can( 'manage_wordpoints_points_types' )
518
+		( ! isset($_GET['page']) || 'wordpoints_points_types' !== $_GET['page'])
519
+		&& current_user_can('manage_wordpoints_points_types')
520 520
 		&& ! wordpoints_get_points_types()
521 521
 	) {
522 522
 
523 523
 		wordpoints_show_admin_message(
524 524
 			sprintf(
525
-				__( 'Welcome to WordPoints! Get started by <a href="%s">creating a points type</a>.', 'wordpoints' )
526
-				, esc_url( self_admin_url( 'admin.php?page=wordpoints_points_types' ) )
525
+				__('Welcome to WordPoints! Get started by <a href="%s">creating a points type</a>.', 'wordpoints')
526
+				, esc_url(self_admin_url('admin.php?page=wordpoints_points_types'))
527 527
 			)
528 528
 			, 'info'
529 529
 		);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -290,9 +290,12 @@
 block discarded – undo
290 290
 
291 291
 	<?php if ( $has_form ) : ?>
292 292
 		<hr />
293
-	<?php else : ?>
293
+	<?php else {
294
+	: ?>
294 295
 		<br />
295
-	<?php endif; ?>
296
+	<?php endif;
297
+}
298
+?>
296 299
 
297 300
 	<div class="hook-instance-description">
298 301
 		<label for="<?php $hook->the_field_id( '_description' ); ?>"><?php echo esc_html_x( 'Description (optional):', 'points hook', 'wordpoints' ); ?></label>
Please login to merge, or discard this patch.