Completed
Push — master ( 760553...dce43d )
by J.D.
03:49
created
src/classes/hook/hit/query.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 	 * @since 2.1.0
19 19
 	 */
20 20
 	protected $columns = array(
21
-		'id' => array( 'format' => '%d', 'unsigned' => true ),
22
-		'action_type' => array( 'format' => '%s' ),
23
-		'signature_arg_guids' => array( 'format' => '%s' ),
24
-		'event' => array( 'format' => '%s' ),
25
-		'reactor' => array( 'format' => '%s' ),
26
-		'reaction_mode' => array( 'format' => '%s' ),
27
-		'reaction_store' => array( 'format' => '%s' ),
28
-		'reaction_context_id' => array( 'format' => '%s' ),
29
-		'reaction_id' => array( 'format' => '%d', 'unsigned' => true ),
30
-		'date' => array( 'format' => '%s', 'is_date' => true ),
21
+		'id' => array('format' => '%d', 'unsigned' => true),
22
+		'action_type' => array('format' => '%s'),
23
+		'signature_arg_guids' => array('format' => '%s'),
24
+		'event' => array('format' => '%s'),
25
+		'reactor' => array('format' => '%s'),
26
+		'reaction_mode' => array('format' => '%s'),
27
+		'reaction_store' => array('format' => '%s'),
28
+		'reaction_context_id' => array('format' => '%s'),
29
+		'reaction_id' => array('format' => '%d', 'unsigned' => true),
30
+		'date' => array('format' => '%s', 'is_date' => true),
31 31
 	);
32 32
 
33 33
 	/**
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	 * @since 2.3.0
40 40
 	 */
41 41
 	protected $deprecated_args = array(
42
-		'primary_arg_guid'          => array( 'replacement' => 'signature_arg_guids', 'version' => '2.3.0', 'class' => __CLASS__ ),
43
-		'primary_arg_guid__compare' => array( 'replacement' => 'signature_arg_guids__compare', 'version' => '2.3.0', 'class' => __CLASS__ ),
44
-		'primary_arg_guid__in'      => array( 'replacement' => 'signature_arg_guids__in', 'version' => '2.3.0', 'class' => __CLASS__ ),
45
-		'primary_arg_guid__not_in'  => array( 'replacement' => 'signature_arg_guids__not_in', 'version' => '2.3.0', 'class' => __CLASS__ ),
42
+		'primary_arg_guid'          => array('replacement' => 'signature_arg_guids', 'version' => '2.3.0', 'class' => __CLASS__),
43
+		'primary_arg_guid__compare' => array('replacement' => 'signature_arg_guids__compare', 'version' => '2.3.0', 'class' => __CLASS__),
44
+		'primary_arg_guid__in'      => array('replacement' => 'signature_arg_guids__in', 'version' => '2.3.0', 'class' => __CLASS__),
45
+		'primary_arg_guid__not_in'  => array('replacement' => 'signature_arg_guids__not_in', 'version' => '2.3.0', 'class' => __CLASS__),
46 46
 	);
47 47
 
48 48
 	//
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *        @type array        $meta_query                   See WP_Meta_Query.
122 122
 	 * }
123 123
 	 */
124
-	public function __construct( $args = array() ) {
124
+	public function __construct($args = array()) {
125 125
 
126 126
 		global $wpdb;
127 127
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
 		$this->defaults['order_by'] = 'date';
131 131
 
132
-		parent::__construct( $args );
132
+		parent::__construct($args);
133 133
 	}
134 134
 }
135 135
 
Please login to merge, or discard this patch.
src/classes/db/query.php 1 patch
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -231,24 +231,24 @@  discard block
 block discarded – undo
231 231
 	 *        @type array        $meta_query          See WP_Meta_Query.
232 232
 	 * }
233 233
 	 */
234
-	public function __construct( $args = array() ) {
234
+	public function __construct($args = array()) {
235 235
 
236
-		foreach ( $this->deprecated_args as $arg => $data ) {
237
-			if ( isset( $args[ $arg ] ) ) {
236
+		foreach ($this->deprecated_args as $arg => $data) {
237
+			if (isset($args[$arg])) {
238 238
 
239 239
 				_deprecated_argument(
240
-					esc_html( "{$data['class']}::__construct" )
241
-					, esc_html( $data['version'] )
242
-					, esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" )
240
+					esc_html("{$data['class']}::__construct")
241
+					, esc_html($data['version'])
242
+					, esc_html("{$arg} is deprecated, use {$data['replacement']} instead")
243 243
 				);
244 244
 
245
-				$args[ $data['replacement'] ] = $args[ $arg ];
245
+				$args[$data['replacement']] = $args[$arg];
246 246
 
247
-				unset( $args[ $arg ] );
247
+				unset($args[$arg]);
248 248
 			}
249 249
 		}
250 250
 
251
-		$this->args = array_merge( $this->defaults, $args );
251
+		$this->args = array_merge($this->defaults, $args);
252 252
 	}
253 253
 
254 254
 	/**
@@ -260,21 +260,21 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return mixed|null The query arg's value, or null if it isn't set.
262 262
 	 */
263
-	public function get_arg( $arg ) {
263
+	public function get_arg($arg) {
264 264
 
265
-		if ( isset( $this->deprecated_args[ $arg ] ) ) {
265
+		if (isset($this->deprecated_args[$arg])) {
266 266
 
267 267
 			_deprecated_argument(
268
-				esc_html( "{$this->deprecated_args[ $arg ]['class']}::get_arg" )
269
-				, esc_html( $this->deprecated_args[ $arg ]['version'] )
270
-				, esc_html( "{$arg} is deprecated, use {$this->deprecated_args[ $arg ]['replacement']} instead" )
268
+				esc_html("{$this->deprecated_args[$arg]['class']}::get_arg")
269
+				, esc_html($this->deprecated_args[$arg]['version'])
270
+				, esc_html("{$arg} is deprecated, use {$this->deprecated_args[$arg]['replacement']} instead")
271 271
 			);
272 272
 
273
-			$arg = $this->deprecated_args[ $arg ]['replacement'];
273
+			$arg = $this->deprecated_args[$arg]['replacement'];
274 274
 		}
275 275
 
276
-		if ( isset( $this->args[ $arg ] ) ) {
277
-			return $this->args[ $arg ];
276
+		if (isset($this->args[$arg])) {
277
+			return $this->args[$arg];
278 278
 		} else {
279 279
 			return null;
280 280
 		}
@@ -292,24 +292,24 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @return WordPoints_DB_Query To allow for method chaining.
294 294
 	 */
295
-	public function set_args( array $args ) {
295
+	public function set_args(array $args) {
296 296
 
297
-		foreach ( $this->deprecated_args as $arg => $data ) {
298
-			if ( isset( $args[ $arg ] ) ) {
297
+		foreach ($this->deprecated_args as $arg => $data) {
298
+			if (isset($args[$arg])) {
299 299
 
300 300
 				_deprecated_argument(
301
-					esc_html( "{$data['class']}::set_args" )
302
-					, esc_html( $data['version'] )
303
-					, esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" )
301
+					esc_html("{$data['class']}::set_args")
302
+					, esc_html($data['version'])
303
+					, esc_html("{$arg} is deprecated, use {$data['replacement']} instead")
304 304
 				);
305 305
 
306
-				$args[ $data['replacement'] ] = $args[ $arg ];
306
+				$args[$data['replacement']] = $args[$arg];
307 307
 
308
-				unset( $args[ $arg ] );
308
+				unset($args[$arg]);
309 309
 			}
310 310
 		}
311 311
 
312
-		$this->args = array_merge( $this->args, $args );
312
+		$this->args = array_merge($this->args, $args);
313 313
 
314 314
 		$this->is_query_ready = false;
315 315
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
 		global $wpdb;
334 334
 
335
-		$count = (int) $wpdb->get_var( $this->get_sql( 'SELECT COUNT' ) ); // WPCS: unprepared SQL, cache OK
335
+		$count = (int) $wpdb->get_var($this->get_sql('SELECT COUNT')); // WPCS: unprepared SQL, cache OK
336 336
 
337 337
 		return $count;
338 338
 	}
@@ -347,20 +347,20 @@  discard block
 block discarded – undo
347 347
 	 *
348 348
 	 * @return mixed The results of the query, or false on failure.
349 349
 	 */
350
-	public function get( $method = 'results' ) {
350
+	public function get($method = 'results') {
351 351
 
352 352
 		global $wpdb;
353 353
 
354
-		$methods = array( 'results', 'row', 'col', 'var' );
354
+		$methods = array('results', 'row', 'col', 'var');
355 355
 
356
-		if ( ! in_array( $method, $methods ) ) {
356
+		if ( ! in_array($method, $methods)) {
357 357
 
358
-			_doing_it_wrong( __METHOD__, esc_html( sprintf( 'WordPoints Debug Error: invalid get method %s, possible values are %s', $method, implode( ', ', $methods ) ) ), '1.0.0' );
358
+			_doing_it_wrong(__METHOD__, esc_html(sprintf('WordPoints Debug Error: invalid get method %s, possible values are %s', $method, implode(', ', $methods))), '1.0.0');
359 359
 
360 360
 			return false;
361 361
 		}
362 362
 
363
-		$result = $wpdb->{"get_{$method}"}( $this->get_sql() );
363
+		$result = $wpdb->{"get_{$method}"}($this->get_sql());
364 364
 
365 365
 		return $result;
366 366
 	}
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @return string The SQL for the query.
382 382
 	 */
383
-	public function get_sql( $select_type = 'SELECT' ) {
383
+	public function get_sql($select_type = 'SELECT') {
384 384
 
385 385
 		$this->prepare_query();
386 386
 
387
-		$select = ( 'SELECT COUNT' === $select_type )
387
+		$select = ('SELECT COUNT' === $select_type)
388 388
 			? $this->select_count
389 389
 			: $this->select;
390 390
 
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @return string[] The valid columns.
414 414
 	 */
415
-	public function date_query_valid_columns_filter( $valid_columns ) {
415
+	public function date_query_valid_columns_filter($valid_columns) {
416 416
 
417 417
 		$valid_columns = array_merge(
418 418
 			$valid_columns
419 419
 			, array_keys(
420
-				wp_list_filter( $this->columns, array( 'is_date' => true ) )
420
+				wp_list_filter($this->columns, array('is_date' => true))
421 421
 			)
422 422
 		);
423 423
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	protected function prepare_query() {
437 437
 
438
-		if ( ! $this->is_query_ready ) {
438
+		if ( ! $this->is_query_ready) {
439 439
 
440 440
 			$this->prepare_select();
441 441
 			$this->prepare_where();
@@ -453,26 +453,26 @@  discard block
 block discarded – undo
453 453
 	 */
454 454
 	protected function prepare_select() {
455 455
 
456
-		$all_fields = array_keys( $this->columns );
456
+		$all_fields = array_keys($this->columns);
457 457
 		$fields = array();
458 458
 
459
-		if ( ! empty( $this->args['fields'] ) ) {
459
+		if ( ! empty($this->args['fields'])) {
460 460
 
461 461
 			$fields = (array) $this->args['fields'];
462
-			$diff   = array_diff( $fields, $all_fields );
463
-			$fields = array_intersect( $all_fields, $fields );
462
+			$diff   = array_diff($fields, $all_fields);
463
+			$fields = array_intersect($all_fields, $fields);
464 464
 
465
-			if ( ! empty( $diff ) ) {
466
-				_doing_it_wrong( __METHOD__, esc_html( 'WordPoints Debug Error: invalid field(s) "' . implode( '", "', $diff ) . '" given' ), '1.0.0' );
465
+			if ( ! empty($diff)) {
466
+				_doing_it_wrong(__METHOD__, esc_html('WordPoints Debug Error: invalid field(s) "' . implode('", "', $diff) . '" given'), '1.0.0');
467 467
 			}
468 468
 		}
469 469
 
470 470
 		// Pull all fields by default.
471
-		if ( empty( $fields ) ) {
471
+		if (empty($fields)) {
472 472
 			$fields = $all_fields;
473 473
 		}
474 474
 
475
-		$fields = implode( ', ', array_map( 'wordpoints_escape_mysql_identifier', $fields ) );
475
+		$fields = implode(', ', array_map('wordpoints_escape_mysql_identifier', $fields));
476 476
 
477 477
 		$this->select = "SELECT {$fields}";
478 478
 	}
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @return mixed The validated value, or false if invalid.
489 489
 	 */
490
-	protected function validate_value( $value, $validators ) {
490
+	protected function validate_value($value, $validators) {
491 491
 
492
-		foreach ( $validators as $validator ) {
492
+		foreach ($validators as $validator) {
493 493
 
494
-			$value = call_user_func_array( $validator, array( &$value ) );
494
+			$value = call_user_func_array($validator, array(&$value));
495 495
 
496
-			if ( false === $value ) {
496
+			if (false === $value) {
497 497
 				break;
498 498
 			}
499 499
 		}
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return array The validated values, with any invalid ones removed.
513 513
 	 */
514
-	protected function validate_values( $values, $validators ) {
514
+	protected function validate_values($values, $validators) {
515 515
 
516
-		foreach ( $values as $index => $value ) {
516
+		foreach ($values as $index => $value) {
517 517
 
518
-			$value = $this->validate_value( $value, $validators );
518
+			$value = $this->validate_value($value, $validators);
519 519
 
520
-			if ( false === $value ) {
521
-				unset( $values[ $index ] );
520
+			if (false === $value) {
521
+				unset($values[$index]);
522 522
 			}
523 523
 		}
524 524
 
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 	 *
538 538
 	 * @return int|false The validated value or false.
539 539
 	 */
540
-	protected function validate_unsigned_column( $value ) {
540
+	protected function validate_unsigned_column($value) {
541 541
 
542
-		if ( false !== wordpoints_int( $value ) && $value >= 0 ) {
542
+		if (false !== wordpoints_int($value) && $value >= 0) {
543 543
 			return $value;
544 544
 		}
545 545
 
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 	 *
556 556
 	 * @return callable[] The validation functions.
557 557
 	 */
558
-	protected function get_validators_for_column( $data ) {
558
+	protected function get_validators_for_column($data) {
559 559
 
560 560
 		$validators = array();
561 561
 
562 562
 		// Default validators for integer columns.
563
-		if ( '%d' === $data['format'] ) {
564
-			if ( ! empty( $data['unsigned'] ) ) {
565
-				$validators[] = array( $this, 'validate_unsigned_column' );
563
+		if ('%d' === $data['format']) {
564
+			if ( ! empty($data['unsigned'])) {
565
+				$validators[] = array($this, 'validate_unsigned_column');
566 566
 			} else {
567 567
 				$validators[] = 'wordpoints_int';
568 568
 			}
@@ -579,15 +579,15 @@  discard block
 block discarded – undo
579 579
 	 * @param string $column The column name.
580 580
 	 * @param array  $data   The column data.
581 581
 	 */
582
-	protected function prepare_column_where( $column, $data ) {
582
+	protected function prepare_column_where($column, $data) {
583 583
 
584 584
 		// If a single value has been supplied for the column, it takes precedence.
585
-		if ( isset( $this->args[ $column ] ) ) {
586
-			$this->prepare_column( $column, $data );
587
-		} elseif ( isset( $this->args[ "{$column}__in" ] ) ) {
588
-			$this->prepare_column__in( $column, $data );
589
-		} elseif ( isset( $this->args[ "{$column}__not_in" ] ) ) {
590
-			$this->prepare_column__in( $column, $data, 'NOT IN' );
585
+		if (isset($this->args[$column])) {
586
+			$this->prepare_column($column, $data);
587
+		} elseif (isset($this->args["{$column}__in"])) {
588
+			$this->prepare_column__in($column, $data);
589
+		} elseif (isset($this->args["{$column}__not_in"])) {
590
+			$this->prepare_column__in($column, $data, 'NOT IN');
591 591
 		}
592 592
 	}
593 593
 
@@ -599,29 +599,29 @@  discard block
 block discarded – undo
599 599
 	 * @param string $column The name of the column
600 600
 	 * @param array  $data   The column data.
601 601
 	 */
602
-	protected function prepare_column( $column, $data ) {
602
+	protected function prepare_column($column, $data) {
603 603
 
604 604
 		global $wpdb;
605 605
 
606 606
 		if (
607
-			isset( $data['values'] )
608
-			&& ! in_array( $this->args[ $column ], $data['values'], true )
607
+			isset($data['values'])
608
+			&& ! in_array($this->args[$column], $data['values'], true)
609 609
 		) {
610 610
 			return;
611 611
 		}
612 612
 
613 613
 		$value = $this->validate_value(
614
-			$this->args[ $column ]
615
-			, $this->get_validators_for_column( $data )
614
+			$this->args[$column]
615
+			, $this->get_validators_for_column($data)
616 616
 		);
617 617
 
618
-		if ( false === $value ) {
618
+		if (false === $value) {
619 619
 			return;
620 620
 		}
621 621
 
622
-		$compare = $this->get_comparator_for_column( $column, $data );
622
+		$compare = $this->get_comparator_for_column($column, $data);
623 623
 
624
-		$column = wordpoints_escape_mysql_identifier( $column );
624
+		$column = wordpoints_escape_mysql_identifier($column);
625 625
 
626 626
 		$this->wheres[] = $wpdb->prepare( // WPCS: unprepared SQL OK.
627 627
 			"{$column} {$compare} {$data['format']}"
@@ -639,23 +639,23 @@  discard block
 block discarded – undo
639 639
 	 *
640 640
 	 * @return string The comparator for the column.
641 641
 	 */
642
-	protected function get_comparator_for_column( $column, $data ) {
642
+	protected function get_comparator_for_column($column, $data) {
643 643
 
644
-		$comparisons = array( '=', '<', '>', '<>', '!=', '<=', '>=' );
644
+		$comparisons = array('=', '<', '>', '<>', '!=', '<=', '>=');
645 645
 
646 646
 		// MySQL doesn't support LIKE and NOT LIKE for int columns.
647 647
 		// See https://stackoverflow.com/q/8422455/1924128
648
-		if ( '%s' === $data['format'] ) {
649
-			$comparisons = array_merge( $comparisons, array( 'LIKE', 'NOT LIKE' ) );
648
+		if ('%s' === $data['format']) {
649
+			$comparisons = array_merge($comparisons, array('LIKE', 'NOT LIKE'));
650 650
 		}
651 651
 
652 652
 		$comparator = '=';
653 653
 
654 654
 		if (
655
-			isset( $this->args[ "{$column}__compare" ] )
656
-			&& in_array( $this->args[ "{$column}__compare" ], $comparisons, true )
655
+			isset($this->args["{$column}__compare"])
656
+			&& in_array($this->args["{$column}__compare"], $comparisons, true)
657 657
 		) {
658
-			$comparator = $this->args[ "{$column}__compare" ];
658
+			$comparator = $this->args["{$column}__compare"];
659 659
 		}
660 660
 
661 661
 		return $comparator;
@@ -670,36 +670,36 @@  discard block
 block discarded – undo
670 670
 	 * @param array  $data   The column data.
671 671
 	 * @param string $type   The type of IN clause, IN or NOT IN.
672 672
 	 */
673
-	protected function prepare_column__in( $column, $data, $type = 'IN' ) {
673
+	protected function prepare_column__in($column, $data, $type = 'IN') {
674 674
 
675
-		$key = "{$column}__" . strtolower( str_replace( ' ', '_', $type ) );
675
+		$key = "{$column}__" . strtolower(str_replace(' ', '_', $type));
676 676
 
677
-		if ( empty( $this->args[ $key ] ) || ! is_array( $this->args[ $key ] ) ) {
677
+		if (empty($this->args[$key]) || ! is_array($this->args[$key])) {
678 678
 			return;
679 679
 		}
680 680
 
681
-		$values = $this->args[ $key ];
681
+		$values = $this->args[$key];
682 682
 
683
-		if ( isset( $data['values'] ) ) {
684
-			$values = array_intersect( $values, $data['values'] );
683
+		if (isset($data['values'])) {
684
+			$values = array_intersect($values, $data['values']);
685 685
 		} else {
686 686
 			$values = $this->validate_values(
687 687
 				$values
688
-				, $this->get_validators_for_column( $data )
688
+				, $this->get_validators_for_column($data)
689 689
 			);
690 690
 		}
691 691
 
692
-		if ( empty( $values ) ) {
692
+		if (empty($values)) {
693 693
 			return;
694 694
 		}
695 695
 
696
-		$in = wordpoints_prepare__in( $values, $data['format'] );
696
+		$in = wordpoints_prepare__in($values, $data['format']);
697 697
 
698
-		if ( false === $in ) {
698
+		if (false === $in) {
699 699
 			return;
700 700
 		}
701 701
 
702
-		$column = wordpoints_escape_mysql_identifier( $column );
702
+		$column = wordpoints_escape_mysql_identifier($column);
703 703
 
704 704
 		$this->wheres[] = "{$column} {$type} ({$in})";
705 705
 	}
@@ -713,19 +713,19 @@  discard block
 block discarded – undo
713 713
 
714 714
 		$this->wheres = array();
715 715
 
716
-		foreach ( $this->columns as $column => $data ) {
716
+		foreach ($this->columns as $column => $data) {
717 717
 
718
-			if ( ! empty( $data['is_date'] ) ) {
719
-				$this->prepare_date_where( $column );
718
+			if ( ! empty($data['is_date'])) {
719
+				$this->prepare_date_where($column);
720 720
 			} else {
721
-				$this->prepare_column_where( $column, $data );
721
+				$this->prepare_column_where($column, $data);
722 722
 			}
723 723
 		}
724 724
 
725 725
 		$this->prepare_meta_where();
726 726
 
727
-		if ( ! empty( $this->wheres ) ) {
728
-			$this->where = 'WHERE ' . implode( ' AND ', $this->wheres ) . "\n";
727
+		if ( ! empty($this->wheres)) {
728
+			$this->where = 'WHERE ' . implode(' AND ', $this->wheres) . "\n";
729 729
 		}
730 730
 	}
731 731
 
@@ -738,32 +738,32 @@  discard block
 block discarded – undo
738 738
 
739 739
 		// MySQL doesn't allow for the offset without a limit, so if no limit is set
740 740
 		// we can ignore the start arg. See https://stackoverflow.com/a/271650/1924128
741
-		if ( ! isset( $this->args['limit'] ) ) {
741
+		if ( ! isset($this->args['limit'])) {
742 742
 			return;
743 743
 		}
744 744
 
745
-		foreach ( array( 'limit', 'start' ) as $key ) {
745
+		foreach (array('limit', 'start') as $key) {
746 746
 
747 747
 			// Save a backup of the arg value since wordpoints_int() is by reference.
748
-			$arg = $this->args[ $key ];
748
+			$arg = $this->args[$key];
749 749
 
750
-			if ( false === wordpoints_int( $this->args[ $key ] ) ) {
750
+			if (false === wordpoints_int($this->args[$key])) {
751 751
 
752 752
 				_doing_it_wrong(
753 753
 					__METHOD__
754 754
 					, sprintf(
755 755
 						"WordPoints Debug Error: '%s' must be a positive integer, %s given"
756
-						, esc_html( $key )
757
-						, esc_html( strval( $arg ) ? $arg : gettype( $arg ) )
756
+						, esc_html($key)
757
+						, esc_html(strval($arg) ? $arg : gettype($arg))
758 758
 					)
759 759
 					, '1.0.0'
760 760
 				);
761 761
 
762
-				$this->args[ $key ] = 0;
762
+				$this->args[$key] = 0;
763 763
 			}
764 764
 		}
765 765
 
766
-		if ( $this->args['limit'] > 0 && $this->args['start'] >= 0 ) {
766
+		if ($this->args['limit'] > 0 && $this->args['start'] >= 0) {
767 767
 			$this->limit = "LIMIT {$this->args['start']}, {$this->args['limit']}";
768 768
 		}
769 769
 	}
@@ -775,20 +775,20 @@  discard block
 block discarded – undo
775 775
 	 */
776 776
 	protected function prepare_order_by() {
777 777
 
778
-		if ( empty( $this->args['order_by'] ) ) {
778
+		if (empty($this->args['order_by'])) {
779 779
 			return;
780 780
 		}
781 781
 
782 782
 		$order    = $this->args['order'];
783 783
 		$order_by = $this->args['order_by'];
784 784
 
785
-		if ( ! in_array( $order, array( 'DESC', 'ASC' ) ) ) {
785
+		if ( ! in_array($order, array('DESC', 'ASC'))) {
786 786
 
787
-			_doing_it_wrong( __METHOD__, esc_html( "WordPoints Debug Error: invalid 'order' \"{$order}\", possible values are DESC and ASC" ), '1.0.0' );
787
+			_doing_it_wrong(__METHOD__, esc_html("WordPoints Debug Error: invalid 'order' \"{$order}\", possible values are DESC and ASC"), '1.0.0');
788 788
 			$order = 'DESC';
789 789
 		}
790 790
 
791
-		if ( 'meta_value' === $order_by ) {
791
+		if ('meta_value' === $order_by) {
792 792
 
793 793
 			global $wpdb;
794 794
 
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
 				$wpdb->{"{$this->meta_type}meta"}
797 797
 			);
798 798
 
799
-			if ( isset( $this->args['meta_type'] ) ) {
799
+			if (isset($this->args['meta_type'])) {
800 800
 
801
-				$meta_type = $this->meta_query->get_cast_for_type( $this->args['meta_type'] );
801
+				$meta_type = $this->meta_query->get_cast_for_type($this->args['meta_type']);
802 802
 				$order_by  = "CAST({$meta_table_name}.meta_value AS {$meta_type})";
803 803
 
804 804
 			} else {
@@ -806,13 +806,13 @@  discard block
 block discarded – undo
806 806
 				$order_by = "{$meta_table_name}.meta_value";
807 807
 			}
808 808
 
809
-		} elseif ( isset( $this->columns[ $order_by ] ) ) {
809
+		} elseif (isset($this->columns[$order_by])) {
810 810
 
811
-			$order_by = wordpoints_escape_mysql_identifier( $order_by );
811
+			$order_by = wordpoints_escape_mysql_identifier($order_by);
812 812
 
813 813
 		} else {
814 814
 
815
-			_doing_it_wrong( __METHOD__, esc_html( "WordPoints Debug Error: invalid 'order_by' \"{$order_by}\", possible values are " . implode( ', ', array_keys( $this->columns ) ) ), '1.0.0' );
815
+			_doing_it_wrong(__METHOD__, esc_html("WordPoints Debug Error: invalid 'order_by' \"{$order_by}\", possible values are " . implode(', ', array_keys($this->columns))), '1.0.0');
816 816
 			return;
817 817
 		}
818 818
 
@@ -826,25 +826,25 @@  discard block
 block discarded – undo
826 826
 	 *
827 827
 	 * @param string $column The name of the column.
828 828
 	 */
829
-	protected function prepare_date_where( $column ) {
829
+	protected function prepare_date_where($column) {
830 830
 
831 831
 		if (
832
-			empty( $this->args[ "{$column}_query" ] )
833
-			|| ! is_array( $this->args[ "{$column}_query" ] )
832
+			empty($this->args["{$column}_query"])
833
+			|| ! is_array($this->args["{$column}_query"])
834 834
 		) {
835 835
 			return;
836 836
 		}
837 837
 
838
-		add_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_filter' ) );
838
+		add_filter('date_query_valid_columns', array($this, 'date_query_valid_columns_filter'));
839 839
 
840
-		$date_query = new WP_Date_Query( $this->args[ "{$column}_query" ], $column );
840
+		$date_query = new WP_Date_Query($this->args["{$column}_query"], $column);
841 841
 		$date_query = $date_query->get_sql();
842 842
 
843
-		if ( ! empty( $date_query ) ) {
844
-			$this->wheres[] = ltrim( $date_query, ' AND' );
843
+		if ( ! empty($date_query)) {
844
+			$this->wheres[] = ltrim($date_query, ' AND');
845 845
 		}
846 846
 
847
-		remove_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_filter' ) );
847
+		remove_filter('date_query_valid_columns', array($this, 'date_query_valid_columns_filter'));
848 848
 	}
849 849
 
850 850
 	/**
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 */
855 855
 	protected function prepare_meta_where() {
856 856
 
857
-		if ( empty( $this->meta_type ) ) {
857
+		if (empty($this->meta_type)) {
858 858
 			return;
859 859
 		}
860 860
 
@@ -869,12 +869,12 @@  discard block
 block discarded – undo
869 869
 			)
870 870
 		);
871 871
 
872
-		if ( empty( $meta_args ) ) {
872
+		if (empty($meta_args)) {
873 873
 			return;
874 874
 		}
875 875
 
876 876
 		$this->meta_query = new WP_Meta_Query();
877
-		$this->meta_query->parse_query_vars( $meta_args );
877
+		$this->meta_query->parse_query_vars($meta_args);
878 878
 
879 879
 		$meta_query = $this->meta_query->get_sql(
880 880
 			$this->meta_type
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
 			, $this
884 884
 		);
885 885
 
886
-		if ( ! empty( $meta_query['where'] ) ) {
887
-			$this->wheres[] = ltrim( $meta_query['where'], ' AND' );
886
+		if ( ! empty($meta_query['where'])) {
887
+			$this->wheres[] = ltrim($meta_query['where'], ' AND');
888 888
 		}
889 889
 
890 890
 		$this->meta_join = $meta_query['join'] . "\n";
Please login to merge, or discard this patch.
src/admin/screens/configure-components.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 // Show messages and errors.
18 18
 //
19 19
 
20
-if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) {
20
+if (isset($_GET['wordpoints_component'], $_GET['_wpnonce']) && $wordpoints_components->is_registered(sanitize_key($_GET['wordpoints_component']))) {
21 21
 
22
-	$component = sanitize_key( $_GET['wordpoints_component'] );
22
+	$component = sanitize_key($_GET['wordpoints_component']);
23 23
 
24
-	if ( isset( $_GET['message'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) {
24
+	if (isset($_GET['message']) && wordpoints_verify_nonce('_wpnonce', "wordpoints_component_message-{$component}")) {
25 25
 
26
-		switch ( (int) $_GET['message'] ) {
26
+		switch ((int) $_GET['message']) {
27 27
 
28 28
 			case 1:
29
-				if ( $wordpoints_components->is_active( $component ) ) {
29
+				if ($wordpoints_components->is_active($component)) {
30 30
 					// translators: Component name.
31
-					$message = __( 'Component &#8220;%s&#8221; activated!', 'wordpoints' );
31
+					$message = __('Component &#8220;%s&#8221; activated!', 'wordpoints');
32 32
 				}
33 33
 			break;
34 34
 
35 35
 			case 2:
36
-				if ( ! $wordpoints_components->is_active( $component ) ) {
36
+				if ( ! $wordpoints_components->is_active($component)) {
37 37
 					// translators: Component name.
38
-					$message = __( 'Component &#8220;%s&#8221; deactivated!', 'wordpoints' );
38
+					$message = __('Component &#8220;%s&#8221; deactivated!', 'wordpoints');
39 39
 				}
40 40
 			break;
41 41
 		}
42 42
 
43
-		if ( isset( $message ) ) {
43
+		if (isset($message)) {
44 44
 
45 45
 			wordpoints_show_admin_message(
46
-				esc_html( sprintf( $message, $components[ $component ]['name'] ) )
46
+				esc_html(sprintf($message, $components[$component]['name']))
47 47
 				, 'success'
48
-				, array( 'dismissible' => true )
48
+				, array('dismissible' => true)
49 49
 			);
50 50
 		}
51 51
 
52
-	} elseif ( isset( $_GET['error'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) {
52
+	} elseif (isset($_GET['error']) && wordpoints_verify_nonce('_wpnonce', "wordpoints_component_error-{$component}")) {
53 53
 
54
-		switch ( (int) $_GET['error'] ) {
54
+		switch ((int) $_GET['error']) {
55 55
 
56 56
 			case 1:
57
-				if ( ! $wordpoints_components->is_active( $component ) ) {
57
+				if ( ! $wordpoints_components->is_active($component)) {
58 58
 					// translators: Component name.
59
-					$error = __( 'The component &#8220;%s&#8221; could not be activated. Please try again.', 'wordpoints' );
59
+					$error = __('The component &#8220;%s&#8221; could not be activated. Please try again.', 'wordpoints');
60 60
 				}
61 61
 			break;
62 62
 
63 63
 			case 2:
64
-				if ( $wordpoints_components->is_active( $component ) ) {
64
+				if ($wordpoints_components->is_active($component)) {
65 65
 					// translators: Component name.
66
-					$error = __( 'The component &#8220;%s&#8221; could not be deactivated. Please try again.', 'wordpoints' );
66
+					$error = __('The component &#8220;%s&#8221; could not be deactivated. Please try again.', 'wordpoints');
67 67
 				}
68 68
 			break;
69 69
 		}
70 70
 
71
-		if ( isset( $error ) ) {
71
+		if (isset($error)) {
72 72
 
73 73
 			wordpoints_show_admin_error(
74
-				esc_html( sprintf( $error, $components[ $component ]['name'] ) )
75
-				, array( 'dismissible' => true )
74
+				esc_html(sprintf($error, $components[$component]['name']))
75
+				, array('dismissible' => true)
76 76
 			);
77 77
 		}
78 78
 	} // End if ( message ) elseif ( error ).
@@ -88,74 +88,74 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @since 1.0.0
90 90
  */
91
-do_action( 'wordpoints_admin_components_top' );
91
+do_action('wordpoints_admin_components_top');
92 92
 
93 93
 ?>
94 94
 
95 95
 <br />
96 96
 <table id="wordpoints_components_table" class="widefat">
97
-	<caption><?php esc_html_e( 'Installed WordPoints components.', 'wordpoints' ); ?></caption>
97
+	<caption><?php esc_html_e('Installed WordPoints components.', 'wordpoints'); ?></caption>
98 98
 	<thead>
99 99
 		<tr>
100
-			<th scope="col"><?php echo esc_html_x( 'Component', 'components table heading', 'wordpoints' ); ?></th>
101
-			<th scope="col"><?php echo esc_html_x( 'Description', 'components table heading', 'wordpoints' ); ?></th>
102
-			<th scope="col"><?php echo esc_html_x( 'Version', 'components table heading', 'wordpoints' ); ?></th>
103
-			<th scope="col"><?php echo esc_html_x( 'Action', 'components table heading', 'wordpoints' ); ?></th>
100
+			<th scope="col"><?php echo esc_html_x('Component', 'components table heading', 'wordpoints'); ?></th>
101
+			<th scope="col"><?php echo esc_html_x('Description', 'components table heading', 'wordpoints'); ?></th>
102
+			<th scope="col"><?php echo esc_html_x('Version', 'components table heading', 'wordpoints'); ?></th>
103
+			<th scope="col"><?php echo esc_html_x('Action', 'components table heading', 'wordpoints'); ?></th>
104 104
 		</tr>
105 105
 	</thead>
106 106
 
107 107
 	<tbody>
108
-		<?php foreach ( $components as $component ) : ?>
108
+		<?php foreach ($components as $component) : ?>
109 109
 
110 110
 		<?php
111 111
 
112
-		if ( $wordpoints_components->is_active( $component['slug'] ) ) {
112
+		if ($wordpoints_components->is_active($component['slug'])) {
113 113
 
114 114
 			$action = 'deactivate';
115
-			$button = __( 'Deactivate', 'wordpoints' );
115
+			$button = __('Deactivate', 'wordpoints');
116 116
 
117 117
 		} else {
118 118
 
119 119
 			$action = 'activate';
120
-			$button = __( 'Activate', 'wordpoints' );
120
+			$button = __('Activate', 'wordpoints');
121 121
 		}
122 122
 
123 123
 		?>
124 124
 
125 125
 		<tr>
126 126
 			<td>
127
-				<?php if ( '' !== $component['component_uri'] ) : ?>
128
-					<a href="<?php echo esc_url( $component['component_uri'] ); ?>">
127
+				<?php if ('' !== $component['component_uri']) : ?>
128
+					<a href="<?php echo esc_url($component['component_uri']); ?>">
129 129
 				<?php endif; ?>
130
-					<?php echo esc_html( $component['name'] ); ?>
131
-				<?php if ( '' !== $component['component_uri'] ) : ?>
130
+					<?php echo esc_html($component['name']); ?>
131
+				<?php if ('' !== $component['component_uri']) : ?>
132 132
 					</a>
133 133
 				<?php endif; ?>
134 134
 			</td>
135 135
 			<td>
136
-				<?php echo wp_kses( $component['description'], 'wordpoints_component_description' ); ?>
137
-				<?php if ( '' !== $component['author'] ) : ?>
136
+				<?php echo wp_kses($component['description'], 'wordpoints_component_description'); ?>
137
+				<?php if ('' !== $component['author']) : ?>
138 138
 					&nbsp;|&nbsp;
139 139
 					<?php
140 140
 					// translators: Author name.
141
-					echo esc_html( sprintf( __( 'By %s', 'wordpoints' ), '' /* This space intentionally left blank */ ) );
141
+					echo esc_html(sprintf(__('By %s', 'wordpoints'), '' /* This space intentionally left blank */));
142 142
 					?>
143
-					<?php if ( '' !== $component['author_uri'] ) : ?>
144
-						<a href="<?php echo esc_url( $component['author_uri'] ); ?>">
143
+					<?php if ('' !== $component['author_uri']) : ?>
144
+						<a href="<?php echo esc_url($component['author_uri']); ?>">
145 145
 					<?php endif; ?>
146
-						<?php echo esc_html( $component['author'] ); ?>
147
-					<?php if ( '' !== $component['author_uri'] ) : ?>
146
+						<?php echo esc_html($component['author']); ?>
147
+					<?php if ('' !== $component['author_uri']) : ?>
148 148
 						</a>
149 149
 					<?php endif; ?>
150 150
 				<?php endif; ?>
151 151
 			</td>
152
-			<td><?php echo esc_html( $component['version'] ); ?></td>
152
+			<td><?php echo esc_html($component['version']); ?></td>
153 153
 			<td>
154
-				<form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component['slug'] ); ?>">
155
-					<input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr( $action ); ?>" />
156
-					<input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component['slug'] ); ?>" />
157
-					<?php wp_nonce_field( "wordpoints_{$action}_component-{$component['slug']}" ); ?>
158
-					<?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false ); ?>
154
+				<form method="post" name="wordpoints_components_form_<?php echo esc_attr($component['slug']); ?>">
155
+					<input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr($action); ?>" />
156
+					<input type="hidden" name="wordpoints_component" value="<?php echo esc_attr($component['slug']); ?>" />
157
+					<?php wp_nonce_field("wordpoints_{$action}_component-{$component['slug']}"); ?>
158
+					<?php submit_button($button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false); ?>
159 159
 				</form>
160 160
 			</td>
161 161
 		</tr>
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 
166 166
 	<tfoot>
167 167
 	<tr>
168
-		<th scope="col"><?php echo esc_html_x( 'Component', 'components table heading', 'wordpoints' ); ?></th>
169
-		<th scope="col"><?php echo esc_html_x( 'Description', 'components table heading', 'wordpoints' ); ?></th>
170
-		<th scope="col"><?php echo esc_html_x( 'Version', 'components table heading', 'wordpoints' ); ?></th>
171
-		<th scope="col"><?php echo esc_html_x( 'Action', 'components table heading', 'wordpoints' ); ?></th>
168
+		<th scope="col"><?php echo esc_html_x('Component', 'components table heading', 'wordpoints'); ?></th>
169
+		<th scope="col"><?php echo esc_html_x('Description', 'components table heading', 'wordpoints'); ?></th>
170
+		<th scope="col"><?php echo esc_html_x('Version', 'components table heading', 'wordpoints'); ?></th>
171
+		<th scope="col"><?php echo esc_html_x('Action', 'components table heading', 'wordpoints'); ?></th>
172 172
 	</tr>
173 173
 	</tfoot>
174 174
 </table>
@@ -180,6 +180,6 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @since 1.0.0
182 182
  */
183
-do_action( 'wordpoints_admin_components_bottom' );
183
+do_action('wordpoints_admin_components_bottom');
184 184
 
185 185
 // EOF
Please login to merge, or discard this patch.
src/admin/screens/modules-load.php 1 patch
Spacing   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -9,56 +9,56 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $status, $wp_version;
11 11
 
12
-if ( isset( $_POST['clear-recent-list'] ) ) {
12
+if (isset($_POST['clear-recent-list'])) {
13 13
 	$action = 'clear-recent-list';
14
-} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) {
15
-	$action = sanitize_key( $_REQUEST['action'] );
16
-} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) {
17
-	$action = sanitize_key( $_REQUEST['action2'] );
14
+} elseif (isset($_REQUEST['action']) && -1 !== (int) $_REQUEST['action']) {
15
+	$action = sanitize_key($_REQUEST['action']);
16
+} elseif (isset($_REQUEST['action2']) && -1 !== (int) $_REQUEST['action2']) {
17
+	$action = sanitize_key($_REQUEST['action2']);
18 18
 } else {
19 19
 	$action = '';
20 20
 }
21 21
 
22
-$page   = ( isset( $_REQUEST['paged'] ) ) ? max( 1, absint( $_REQUEST['paged'] ) ) : 1;
23
-$module = ( isset( $_REQUEST['module'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) ) : '';
24
-$s      = ( isset( $_REQUEST['s'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : '';
22
+$page   = (isset($_REQUEST['paged'])) ? max(1, absint($_REQUEST['paged'])) : 1;
23
+$module = (isset($_REQUEST['module'])) ? sanitize_text_field(wp_unslash($_REQUEST['module'])) : '';
24
+$s      = (isset($_REQUEST['s'])) ? sanitize_text_field(wp_unslash($_REQUEST['s'])) : '';
25 25
 
26 26
 // Clean up request URI from temporary args for screen options/paging URI's to work as expected.
27
-$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) );
27
+$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'));
28 28
 
29
-$redirect_url = self_admin_url( "admin.php?page=wordpoints_modules&module_status={$status}&paged={$page}&s={$s}" );
29
+$redirect_url = self_admin_url("admin.php?page=wordpoints_modules&module_status={$status}&paged={$page}&s={$s}");
30 30
 
31
-switch ( $action ) {
31
+switch ($action) {
32 32
 
33 33
 	case '': break;
34 34
 
35 35
 	// Activate a single module.
36 36
 	case 'activate':
37
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
38
-			wp_die( esc_html__( 'Sorry, you are not allowed to activate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
37
+		if ( ! current_user_can('activate_wordpoints_modules')) {
38
+			wp_die(esc_html__('Sorry, you are not allowed to activate modules for this site.', 'wordpoints'), '', array('response' => 403));
39 39
 		}
40 40
 
41
-		if ( is_multisite() && ! is_network_admin() && is_network_only_wordpoints_module( $module ) ) {
41
+		if (is_multisite() && ! is_network_admin() && is_network_only_wordpoints_module($module)) {
42 42
 
43
-			wp_safe_redirect( $redirect_url );
43
+			wp_safe_redirect($redirect_url);
44 44
 			exit;
45 45
 		}
46 46
 
47
-		check_admin_referer( 'activate-module_' . $module );
47
+		check_admin_referer('activate-module_' . $module);
48 48
 
49
-		$result = wordpoints_activate_module( $module, self_admin_url( 'admin.php?page=wordpoints_modules&error=true&module=' . $module ), is_network_admin() );
49
+		$result = wordpoints_activate_module($module, self_admin_url('admin.php?page=wordpoints_modules&error=true&module=' . $module), is_network_admin());
50 50
 
51
-		if ( is_wp_error( $result ) ) {
51
+		if (is_wp_error($result)) {
52 52
 
53
-			if ( 'unexpected_output' === $result->get_error_code() ) {
53
+			if ('unexpected_output' === $result->get_error_code()) {
54 54
 
55 55
 				wp_safe_redirect(
56 56
 					add_query_arg(
57 57
 						array(
58
-							'_error_nonce' => wp_create_nonce( 'module-activation-error_' . $module ),
58
+							'_error_nonce' => wp_create_nonce('module-activation-error_' . $module),
59 59
 							'module' => $module,
60 60
 							'error' => true,
61
-							'charsout' => strlen( $result->get_error_data() ),
61
+							'charsout' => strlen($result->get_error_data()),
62 62
 						)
63 63
 						, $redirect_url
64 64
 					)
@@ -68,96 +68,96 @@  discard block
 block discarded – undo
68 68
 
69 69
 			} else {
70 70
 
71
-				wp_die( wordpoints_sanitize_wp_error( $result ) );
71
+				wp_die(wordpoints_sanitize_wp_error($result));
72 72
 			}
73 73
 		}
74 74
 
75
-		if ( ! is_network_admin() ) {
75
+		if ( ! is_network_admin()) {
76 76
 
77
-			$recent = wordpoints_get_array_option( 'wordpoints_recently_activated_modules' );
78
-			unset( $recent[ $module ] );
79
-			update_option( 'wordpoints_recently_activated_modules', $recent );
77
+			$recent = wordpoints_get_array_option('wordpoints_recently_activated_modules');
78
+			unset($recent[$module]);
79
+			update_option('wordpoints_recently_activated_modules', $recent);
80 80
 		}
81 81
 
82
-		wp_safe_redirect( add_query_arg( 'activate', 'true', $redirect_url ) );
82
+		wp_safe_redirect(add_query_arg('activate', 'true', $redirect_url));
83 83
 	exit;
84 84
 
85 85
 	// Activate multiple modules.
86 86
 	case 'activate-selected':
87
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
88
-			wp_die( esc_html__( 'Sorry, you are not allowed to activate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
87
+		if ( ! current_user_can('activate_wordpoints_modules')) {
88
+			wp_die(esc_html__('Sorry, you are not allowed to activate modules for this site.', 'wordpoints'), '', array('response' => 403));
89 89
 		}
90 90
 
91
-		check_admin_referer( 'bulk-modules' );
91
+		check_admin_referer('bulk-modules');
92 92
 
93
-		$modules = isset( $_POST['checked'] )
94
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) )
93
+		$modules = isset($_POST['checked'])
94
+			? array_map('sanitize_text_field', (array) wp_unslash($_POST['checked']))
95 95
 			: array();
96 96
 
97 97
 		// Only activate modules which are not already active.
98
-		if ( is_network_admin() ) {
98
+		if (is_network_admin()) {
99 99
 
100
-			foreach ( $modules as $i => $module ) {
101
-				if ( is_wordpoints_module_active_for_network( $module ) ) {
102
-					unset( $modules[ $i ] );
100
+			foreach ($modules as $i => $module) {
101
+				if (is_wordpoints_module_active_for_network($module)) {
102
+					unset($modules[$i]);
103 103
 				}
104 104
 			}
105 105
 
106 106
 		} else {
107 107
 
108
-			foreach ( $modules as $i => $module ) {
109
-				if ( is_wordpoints_module_active( $module ) || is_network_only_wordpoints_module( $module ) ) {
110
-					unset( $modules[ $i ] );
108
+			foreach ($modules as $i => $module) {
109
+				if (is_wordpoints_module_active($module) || is_network_only_wordpoints_module($module)) {
110
+					unset($modules[$i]);
111 111
 				}
112 112
 			}
113 113
 		}
114 114
 
115
-		if ( empty( $modules ) ) {
116
-			wp_safe_redirect( $redirect_url );
115
+		if (empty($modules)) {
116
+			wp_safe_redirect($redirect_url);
117 117
 			exit;
118 118
 		}
119 119
 
120
-		$redirect = self_admin_url( 'admin.php?page=wordpoints_modules&error=true' );
120
+		$redirect = self_admin_url('admin.php?page=wordpoints_modules&error=true');
121 121
 
122
-		foreach ( $modules as $module ) {
122
+		foreach ($modules as $module) {
123 123
 
124
-			wordpoints_activate_module( $module, add_query_arg( 'module', $module, $redirect ), is_network_admin() );
124
+			wordpoints_activate_module($module, add_query_arg('module', $module, $redirect), is_network_admin());
125 125
 		}
126 126
 
127
-		if ( ! is_network_admin() ) {
127
+		if ( ! is_network_admin()) {
128 128
 
129
-			$recent = wordpoints_get_array_option( 'wordpoints_recently_activated_modules' );
129
+			$recent = wordpoints_get_array_option('wordpoints_recently_activated_modules');
130 130
 
131
-			foreach ( $modules as $module ) {
132
-				unset( $recent[ $module ] );
131
+			foreach ($modules as $module) {
132
+				unset($recent[$module]);
133 133
 			}
134 134
 
135
-			update_option( 'wordpoints_recently_activated_modules', $recent );
135
+			update_option('wordpoints_recently_activated_modules', $recent);
136 136
 		}
137 137
 
138
-		wp_safe_redirect( add_query_arg( 'activate-multi', 'true', $redirect_url ) );
138
+		wp_safe_redirect(add_query_arg('activate-multi', 'true', $redirect_url));
139 139
 	exit;
140 140
 
141 141
 	// Get the fatal error from a module.
142 142
 	case 'error_scrape':
143
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
144
-			wp_die( esc_html__( 'Sorry, you are not allowed to activate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
143
+		if ( ! current_user_can('activate_wordpoints_modules')) {
144
+			wp_die(esc_html__('Sorry, you are not allowed to activate modules for this site.', 'wordpoints'), '', array('response' => 403));
145 145
 		}
146 146
 
147
-		check_admin_referer( 'module-activation-error_' . $module );
147
+		check_admin_referer('module-activation-error_' . $module);
148 148
 
149
-		$valid = wordpoints_validate_module( $module );
149
+		$valid = wordpoints_validate_module($module);
150 150
 
151
-		if ( is_wp_error( $valid ) ) {
152
-			wp_die( wordpoints_sanitize_wp_error( $valid ), '', array( 'response' => 400 ) );
151
+		if (is_wp_error($valid)) {
152
+			wp_die(wordpoints_sanitize_wp_error($valid), '', array('response' => 400));
153 153
 		}
154 154
 
155 155
 		// Ensure that Fatal errors are displayed.
156
-		if ( ! WP_DEBUG ) {
157
-			error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); // @codingStandardsIgnoreLine
156
+		if ( ! WP_DEBUG) {
157
+			error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); // @codingStandardsIgnoreLine
158 158
 		}
159 159
 
160
-		@ini_set( 'display_errors', true ); // @codingStandardsIgnoreLine
160
+		@ini_set('display_errors', true); // @codingStandardsIgnoreLine
161 161
 
162 162
 		/**
163 163
 		 * Go back to "sandbox" scope so we get the same errors as before.
@@ -167,119 +167,119 @@  discard block
 block discarded – undo
167 167
 		 *
168 168
 		 * @param string $module The base path to the module to error scrape.
169 169
 		 */
170
-		function wordpoints_module_sandbox_scrape( $module ) {
170
+		function wordpoints_module_sandbox_scrape($module) {
171 171
 
172 172
 			$modules_dir = wordpoints_modules_dir();
173
-			WordPoints_Module_Paths::register( $modules_dir . '/' . $module );
174
-			include( $modules_dir . '/' . $module );
173
+			WordPoints_Module_Paths::register($modules_dir . '/' . $module);
174
+			include($modules_dir . '/' . $module);
175 175
 		}
176 176
 
177
-		wordpoints_module_sandbox_scrape( $module );
177
+		wordpoints_module_sandbox_scrape($module);
178 178
 
179 179
 		/**
180 180
 		 * @see wordpoints_activate_module()
181 181
 		 */
182
-		do_action( "wordpoints_module_activate-{$module}" );
182
+		do_action("wordpoints_module_activate-{$module}");
183 183
 	exit;
184 184
 
185 185
 	// Deactivate a module.
186 186
 	case 'deactivate':
187
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
188
-			wp_die( esc_html__( 'Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
187
+		if ( ! current_user_can('activate_wordpoints_modules')) {
188
+			wp_die(esc_html__('Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints'), '', array('response' => 403));
189 189
 		}
190 190
 
191
-		check_admin_referer( 'deactivate-module_' . $module );
191
+		check_admin_referer('deactivate-module_' . $module);
192 192
 
193
-		if ( ! is_network_admin() && is_wordpoints_module_active_for_network( $module ) ) {
194
-			wp_safe_redirect( $redirect_url );
193
+		if ( ! is_network_admin() && is_wordpoints_module_active_for_network($module)) {
194
+			wp_safe_redirect($redirect_url);
195 195
 			exit;
196 196
 		}
197 197
 
198
-		wordpoints_deactivate_modules( $module, false, is_network_admin() );
198
+		wordpoints_deactivate_modules($module, false, is_network_admin());
199 199
 
200
-		if ( ! is_network_admin() ) {
201
-			update_option( 'wordpoints_recently_activated_modules', array( $module => time() ) + wordpoints_get_array_option( 'wordpoints_recently_activated_modules' ) );
200
+		if ( ! is_network_admin()) {
201
+			update_option('wordpoints_recently_activated_modules', array($module => time()) + wordpoints_get_array_option('wordpoints_recently_activated_modules'));
202 202
 		}
203 203
 
204
-		$redirect_url = add_query_arg( 'deactivate', 'true', $redirect_url );
204
+		$redirect_url = add_query_arg('deactivate', 'true', $redirect_url);
205 205
 
206
-		if ( headers_sent() ) {
207
-			echo '<meta http-equiv="refresh" content="0;url=' . esc_url( $redirect_url ) . '" />';
206
+		if (headers_sent()) {
207
+			echo '<meta http-equiv="refresh" content="0;url=' . esc_url($redirect_url) . '" />';
208 208
 		} else {
209
-			wp_safe_redirect( $redirect_url );
209
+			wp_safe_redirect($redirect_url);
210 210
 		}
211 211
 	exit;
212 212
 
213 213
 	// Deactivate multiple modules.
214 214
 	case 'deactivate-selected':
215
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
216
-			wp_die( esc_html__( 'Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
215
+		if ( ! current_user_can('activate_wordpoints_modules')) {
216
+			wp_die(esc_html__('Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints'), '', array('response' => 403));
217 217
 		}
218 218
 
219
-		check_admin_referer( 'bulk-modules' );
219
+		check_admin_referer('bulk-modules');
220 220
 
221
-		$modules = isset( $_POST['checked'] )
222
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) )
221
+		$modules = isset($_POST['checked'])
222
+			? array_map('sanitize_text_field', (array) wp_unslash($_POST['checked']))
223 223
 			: array();
224 224
 
225
-		$network_modules = array_filter( $modules, 'is_wordpoints_module_active_for_network' );
225
+		$network_modules = array_filter($modules, 'is_wordpoints_module_active_for_network');
226 226
 
227 227
 		// Do not deactivate modules which are already deactivated.
228
-		if ( is_network_admin() ) {
228
+		if (is_network_admin()) {
229 229
 			$modules = $network_modules;
230 230
 		} else {
231
-			$modules = array_diff( array_filter( $modules, 'is_wordpoints_module_active' ), $network_modules );
231
+			$modules = array_diff(array_filter($modules, 'is_wordpoints_module_active'), $network_modules);
232 232
 		}
233 233
 
234
-		if ( empty( $modules ) ) {
235
-			wp_safe_redirect( $redirect_url );
234
+		if (empty($modules)) {
235
+			wp_safe_redirect($redirect_url);
236 236
 			exit;
237 237
 		}
238 238
 
239
-		wordpoints_deactivate_modules( $modules, false, is_network_admin() );
239
+		wordpoints_deactivate_modules($modules, false, is_network_admin());
240 240
 
241
-		if ( ! is_network_admin() ) {
241
+		if ( ! is_network_admin()) {
242 242
 
243 243
 			$deactivated = array();
244 244
 
245
-			foreach ( $modules as $module ) {
246
-				$deactivated[ $module ] = time();
245
+			foreach ($modules as $module) {
246
+				$deactivated[$module] = time();
247 247
 			}
248 248
 
249
-			update_option( 'wordpoints_recently_activated_modules', $deactivated + wordpoints_get_array_option( 'wordpoints_recently_activated_modules' ) );
249
+			update_option('wordpoints_recently_activated_modules', $deactivated + wordpoints_get_array_option('wordpoints_recently_activated_modules'));
250 250
 		}
251 251
 
252
-		wp_safe_redirect( add_query_arg( 'deactivate-multi', 'true', $redirect_url ) );
252
+		wp_safe_redirect(add_query_arg('deactivate-multi', 'true', $redirect_url));
253 253
 	exit;
254 254
 
255 255
 	// Delete multiple modules.
256 256
 	case 'delete-selected':
257
-		if ( ! current_user_can( 'delete_wordpoints_modules' ) ) {
258
-			wp_die( esc_html__( 'Sorry, you are not allowed to delete modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
257
+		if ( ! current_user_can('delete_wordpoints_modules')) {
258
+			wp_die(esc_html__('Sorry, you are not allowed to delete modules for this site.', 'wordpoints'), '', array('response' => 403));
259 259
 		}
260 260
 
261
-		check_admin_referer( 'bulk-modules' );
261
+		check_admin_referer('bulk-modules');
262 262
 
263 263
 		// $_POST = from the module form; $_GET = from the FTP details screen.
264
-		$modules = isset( $_REQUEST['checked'] )
265
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST['checked'] ) )
264
+		$modules = isset($_REQUEST['checked'])
265
+			? array_map('sanitize_text_field', (array) wp_unslash($_REQUEST['checked']))
266 266
 			: array();
267 267
 
268
-		if ( empty( $modules ) ) {
269
-			wp_safe_redirect( $redirect_url );
268
+		if (empty($modules)) {
269
+			wp_safe_redirect($redirect_url);
270 270
 			exit;
271 271
 		}
272 272
 
273 273
 		// Do not allow to delete activated modules.
274
-		foreach ( $modules as $key => $module ) {
274
+		foreach ($modules as $key => $module) {
275 275
 
276
-			if ( is_wordpoints_module_active( $module ) ) {
277
-				unset( $modules[ $key ] );
276
+			if (is_wordpoints_module_active($module)) {
277
+				unset($modules[$key]);
278 278
 			}
279 279
 		}
280 280
 
281
-		if ( empty( $modules ) ) {
282
-			wp_safe_redirect( add_query_arg( array( 'error' => 'true', 'main' => 'true' ), $redirect_url ) );
281
+		if (empty($modules)) {
282
+			wp_safe_redirect(add_query_arg(array('error' => 'true', 'main' => 'true'), $redirect_url));
283 283
 			exit;
284 284
 		}
285 285
 
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$parent_file = 'admin.php';
289 289
 
290
-		if ( ! isset( $_REQUEST['verify-delete'] ) ) {
290
+		if ( ! isset($_REQUEST['verify-delete'])) {
291 291
 
292
-			wp_enqueue_script( 'jquery' );
292
+			wp_enqueue_script('jquery');
293 293
 			require_once ABSPATH . 'wp-admin/admin-header.php';
294 294
 
295 295
 			?>
@@ -303,19 +303,19 @@  discard block
 block discarded – undo
303 303
 				$files_to_delete = array();
304 304
 				$have_non_network_modules = false;
305 305
 
306
-				foreach ( $modules as $module ) {
306
+				foreach ($modules as $module) {
307 307
 
308
-					if ( '.' === dirname( $module ) ) {
308
+					if ('.' === dirname($module)) {
309 309
 
310 310
 						$files_to_delete[] = $module_dir . '/' . $module;
311
-						$data = wordpoints_get_module_data( $module_dir . '/' . $module );
311
+						$data = wordpoints_get_module_data($module_dir . '/' . $module);
312 312
 
313
-						if ( ! empty( $data ) ) {
313
+						if ( ! empty($data)) {
314 314
 
315
-							$module_info[ $module ] = $data;
316
-							$module_info[ $module ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module );
315
+							$module_info[$module] = $data;
316
+							$module_info[$module]['is_uninstallable'] = is_uninstallable_wordpoints_module($module);
317 317
 
318
-							if ( ! $module_info[ $module ]['network'] ) {
318
+							if ( ! $module_info[$module]['network']) {
319 319
 								$have_non_network_modules = true;
320 320
 							}
321 321
 						}
@@ -323,21 +323,21 @@  discard block
 block discarded – undo
323 323
 					} else {
324 324
 
325 325
 						// Locate all the files in that folder.
326
-						$files = list_files( $module_dir . '/' . dirname( $module ) );
326
+						$files = list_files($module_dir . '/' . dirname($module));
327 327
 
328
-						if ( $files ) {
329
-							$files_to_delete = array_merge( $files_to_delete, $files );
328
+						if ($files) {
329
+							$files_to_delete = array_merge($files_to_delete, $files);
330 330
 						}
331 331
 
332 332
 						// Get modules list from that folder.
333
-						$folder_modules = wordpoints_get_modules( '/' . dirname( $module ) );
333
+						$folder_modules = wordpoints_get_modules('/' . dirname($module));
334 334
 
335
-						foreach ( $folder_modules as $module_file => $data ) {
335
+						foreach ($folder_modules as $module_file => $data) {
336 336
 
337
-							$module_info[ $module_file ] = $data;
338
-							$module_info[ $module_file ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module );
337
+							$module_info[$module_file] = $data;
338
+							$module_info[$module_file]['is_uninstallable'] = is_uninstallable_wordpoints_module($module);
339 339
 
340
-							if ( ! $module_info[ $module_file ]['network'] ) {
340
+							if ( ! $module_info[$module_file]['network']) {
341 341
 								$have_non_network_modules = true;
342 342
 							}
343 343
 						}
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
 
347 347
 				} // End foreach( $modules ).
348 348
 
349
-				$modules_to_delete = count( $module_info );
349
+				$modules_to_delete = count($module_info);
350 350
 
351
-				echo '<h1>' . esc_html( _n( 'Delete module', 'Delete modules', $modules_to_delete, 'wordpoints' ) ) . '</h1>';
351
+				echo '<h1>' . esc_html(_n('Delete module', 'Delete modules', $modules_to_delete, 'wordpoints')) . '</h1>';
352 352
 
353
-				if ( $have_non_network_modules && is_network_admin() ) {
353
+				if ($have_non_network_modules && is_network_admin()) {
354 354
 					wordpoints_show_admin_message(
355
-						'<strong>' . esc_html__( 'Caution:', 'wordpoints' ) . '</strong>'
355
+						'<strong>' . esc_html__('Caution:', 'wordpoints') . '</strong>'
356 356
 							. esc_html(
357 357
 								_n(
358 358
 									'This module may be active on other sites in the network.'
@@ -367,25 +367,25 @@  discard block
 block discarded – undo
367 367
 
368 368
 				?>
369 369
 
370
-				<p><?php echo esc_html( _n( 'You are about to remove the following module:', 'You are about to remove the following modules:', $modules_to_delete, 'wordpoints' ) ); ?></p>
370
+				<p><?php echo esc_html(_n('You are about to remove the following module:', 'You are about to remove the following modules:', $modules_to_delete, 'wordpoints')); ?></p>
371 371
 					<ul class="ul-disc">
372 372
 
373 373
 						<?php
374 374
 
375 375
 						$data_to_delete = false;
376 376
 
377
-						foreach ( $module_info as $module ) {
377
+						foreach ($module_info as $module) {
378 378
 
379
-							if ( $module['is_uninstallable'] ) {
379
+							if ($module['is_uninstallable']) {
380 380
 
381 381
 								// translators: 1. Module name; 2. Module author.
382
-								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
382
+								echo '<li>', wp_kses(sprintf(__('<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints'), esc_html($module['name']), esc_html($module['author_name'])), array('strong' => array(), 'em' => array())), '</li>';
383 383
 								$data_to_delete = true;
384 384
 
385 385
 							} else {
386 386
 
387 387
 								// translators: 1. Module name; 2. Module author.
388
-								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
388
+								echo '<li>', wp_kses(sprintf(__('<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints'), esc_html($module['name']), esc_html($module['author_name'])), array('strong' => array(), 'em' => array())), '</li>';
389 389
 							}
390 390
 						}
391 391
 
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 				<p>
396 396
 					<?php
397 397
 
398
-					if ( $data_to_delete ) {
399
-						esc_html_e( 'Are you sure you wish to delete these files and data?', 'wordpoints' );
398
+					if ($data_to_delete) {
399
+						esc_html_e('Are you sure you wish to delete these files and data?', 'wordpoints');
400 400
 					} else {
401
-						esc_html_e( 'Are you sure you wish to delete these files?', 'wordpoints' );
401
+						esc_html_e('Are you sure you wish to delete these files?', 'wordpoints');
402 402
 					}
403 403
 
404 404
 					?>
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
 				<form method="post" style="display:inline;">
408 408
 					<input type="hidden" name="verify-delete" value="1" />
409 409
 					<input type="hidden" name="action" value="delete-selected" />
410
-					<?php foreach ( (array) $modules as $module ) : ?>
411
-						<input type="hidden" name="checked[]" value="<?php echo esc_attr( $module ); ?>" />
410
+					<?php foreach ((array) $modules as $module) : ?>
411
+						<input type="hidden" name="checked[]" value="<?php echo esc_attr($module); ?>" />
412 412
 					<?php endforeach; ?>
413
-					<?php wp_nonce_field( 'bulk-modules' ) ?>
414
-					<?php submit_button( $data_to_delete ? __( 'Yes, Delete these files and data', 'wordpoints' ) : __( 'Yes, Delete these files', 'wordpoints' ), 'button', 'submit', false ); ?>
413
+					<?php wp_nonce_field('bulk-modules') ?>
414
+					<?php submit_button($data_to_delete ? __('Yes, Delete these files and data', 'wordpoints') : __('Yes, Delete these files', 'wordpoints'), 'button', 'submit', false); ?>
415 415
 				</form>
416
-				<form method="post" action="<?php echo esc_url( wp_get_referer() ); ?>" style="display:inline;">
417
-					<?php submit_button( __( 'No, Return me to the module list', 'wordpoints' ), 'button', 'submit', false ); ?>
416
+				<form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
417
+					<?php submit_button(__('No, Return me to the module list', 'wordpoints'), 'button', 'submit', false); ?>
418 418
 				</form>
419 419
 
420
-				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php esc_html_e( 'Click to view entire list of files which will be deleted', 'wordpoints' ); ?></a></p>
420
+				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php esc_html_e('Click to view entire list of files which will be deleted', 'wordpoints'); ?></a></p>
421 421
 				<div id="files-list" class="hidden">
422 422
 					<ul class="code">
423
-						<?php foreach ( (array) $files_to_delete as $file ) : ?>
424
-							<li><?php echo esc_html( str_replace( $module_dir, '', $file ) ); ?></li>
423
+						<?php foreach ((array) $files_to_delete as $file) : ?>
424
+							<li><?php echo esc_html(str_replace($module_dir, '', $file)); ?></li>
425 425
 						<?php endforeach; ?>
426 426
 					</ul>
427 427
 				</div>
@@ -434,17 +434,17 @@  discard block
 block discarded – undo
434 434
 
435 435
 		}  // End if ( ! isset( $_REQUEST['verify-delete'] ) ).
436 436
 
437
-		$delete_result = wordpoints_delete_modules( $modules );
437
+		$delete_result = wordpoints_delete_modules($modules);
438 438
 
439 439
 		// Store the result in a cache rather than a URL param due to object type & length
440
-		set_transient( 'wordpoints_modules_delete_result_' . get_current_user_id(), $delete_result );
440
+		set_transient('wordpoints_modules_delete_result_' . get_current_user_id(), $delete_result);
441 441
 
442
-		wp_safe_redirect( add_query_arg( 'deleted', 'true', $redirect_url ) );
442
+		wp_safe_redirect(add_query_arg('deleted', 'true', $redirect_url));
443 443
 	exit;
444 444
 
445 445
 	case 'clear-recent-list':
446
-		if ( ! is_network_admin() ) {
447
-			update_option( 'wordpoints_recently_activated_modules', array() );
446
+		if ( ! is_network_admin()) {
447
+			update_option('wordpoints_recently_activated_modules', array());
448 448
 		}
449 449
 	break;
450 450
 
@@ -454,56 +454,56 @@  discard block
 block discarded – undo
454 454
 		 *
455 455
 		 * @since 1.1.0
456 456
 		 */
457
-		do_action( "wordpoints_modules_screen-{$action}" );
457
+		do_action("wordpoints_modules_screen-{$action}");
458 458
 
459 459
 } // End switch ( $action ).
460 460
 
461
-add_screen_option( 'per_page', array( 'default' => 999 ) );
461
+add_screen_option('per_page', array('default' => 999));
462 462
 
463 463
 $screen = get_current_screen();
464 464
 
465 465
 $screen->add_help_tab(
466 466
 	array(
467 467
 		'id'		=> 'overview',
468
-		'title'		=> __( 'Overview', 'wordpoints' ),
468
+		'title'		=> __('Overview', 'wordpoints'),
469 469
 		'content'	=>
470
-			'<p>' . esc_html__( 'Modules extend and expand the functionality of WordPoints. Once a module is installed, you may activate it or deactivate it here.', 'wordpoints' ) . '</p>' .
470
+			'<p>' . esc_html__('Modules extend and expand the functionality of WordPoints. Once a module is installed, you may activate it or deactivate it here.', 'wordpoints') . '</p>' .
471 471
 			// translators: 1. URL of module directory on WordPoints.org; 2. URL of Install Module admin screen; 3. Directory name.
472
-			'<p>' . wp_kses( sprintf( __( 'You can find modules for your site by by browsing the <a href="%1$s">WordPoints Module Directory</a>. To install a module you generally just need to <a href="%2$s">upload the module file</a> into your %3$s directory. Once a module has been installed, you can activate it here.', 'wordpoints' ), 'https://wordpoints.org/modules/', esc_url( self_admin_url( 'admin.php?page=wordpoints_install_modules' ) ), '<code>/wp-content/wordpoints-modules</code>' ), array( 'a' => array( 'href' => true, 'target' => true ), 'code' => array() ) ) . '</p>',
472
+			'<p>' . wp_kses(sprintf(__('You can find modules for your site by by browsing the <a href="%1$s">WordPoints Module Directory</a>. To install a module you generally just need to <a href="%2$s">upload the module file</a> into your %3$s directory. Once a module has been installed, you can activate it here.', 'wordpoints'), 'https://wordpoints.org/modules/', esc_url(self_admin_url('admin.php?page=wordpoints_install_modules')), '<code>/wp-content/wordpoints-modules</code>'), array('a' => array('href' => true, 'target' => true), 'code' => array())) . '</p>',
473 473
 	)
474 474
 );
475 475
 
476 476
 $screen->add_help_tab(
477 477
 	array(
478 478
 		'id'		=> 'compatibility-problems',
479
-		'title'		=> __( 'Troubleshooting', 'wordpoints' ),
479
+		'title'		=> __('Troubleshooting', 'wordpoints'),
480 480
 		'content'	=>
481
-			'<p>' . esc_html__( 'Most of the time, modules play nicely with the core of WordPoints and with other modules. Sometimes, though, a module&#8217;s code will get in the way of another module, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your modules and re-activating them in various combinations until you isolate which one(s) caused the issue.', 'wordpoints' ) . '</p>' .
481
+			'<p>' . esc_html__('Most of the time, modules play nicely with the core of WordPoints and with other modules. Sometimes, though, a module&#8217;s code will get in the way of another module, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your modules and re-activating them in various combinations until you isolate which one(s) caused the issue.', 'wordpoints') . '</p>' .
482 482
 			// translators: Directory name.
483
-			'<p>' . sprintf( esc_html__( 'If something goes wrong with a module and you can&#8217;t use WordPoints, delete or rename that file in the %s directory and it will be automatically deactivated.', 'wordpoints' ), '<code>' . esc_html( wordpoints_modules_dir() ) . '</code>' ) . '</p>', // XSS OK WPCS
483
+			'<p>' . sprintf(esc_html__('If something goes wrong with a module and you can&#8217;t use WordPoints, delete or rename that file in the %s directory and it will be automatically deactivated.', 'wordpoints'), '<code>' . esc_html(wordpoints_modules_dir()) . '</code>') . '</p>', // XSS OK WPCS
484 484
 	)
485 485
 );
486 486
 
487 487
 $screen->set_help_sidebar(
488
-	'<p><strong>' . esc_html__( 'For more information:', 'wordpoints' ) . '</strong></p>
489
-	<p><a href="https://wordpoints.org/developer-guide/modules/">' . esc_html__( 'Developer Documentation', 'wordpoints' ) . '</a></p>
490
-	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__( 'Support Forums', 'wordpoints' ) . '</a></p>'
488
+	'<p><strong>' . esc_html__('For more information:', 'wordpoints') . '</strong></p>
489
+	<p><a href="https://wordpoints.org/developer-guide/modules/">' . esc_html__('Developer Documentation', 'wordpoints') . '</a></p>
490
+	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__('Support Forums', 'wordpoints') . '</a></p>'
491 491
 );
492 492
 
493 493
 register_column_headers(
494 494
 	$screen
495 495
 	, array(
496 496
 		'cb'          => '<input type="checkbox" />',
497
-		'name'        => _x( 'Module', 'modules table heading', 'wordpoints' ),
498
-		'description' => _x( 'Description', 'modules table heading', 'wordpoints' ),
497
+		'name'        => _x('Module', 'modules table heading', 'wordpoints'),
498
+		'description' => _x('Description', 'modules table heading', 'wordpoints'),
499 499
 	)
500 500
 );
501 501
 
502 502
 $screen->set_screen_reader_content(
503 503
 	array(
504
-		'heading_views'      => __( 'Filter modules list', 'wordpoints' ),
505
-		'heading_pagination' => __( 'Modules list navigation', 'wordpoints' ),
506
-		'heading_list'       => __( 'Modules list', 'wordpoints' ),
504
+		'heading_views'      => __('Filter modules list', 'wordpoints'),
505
+		'heading_pagination' => __('Modules list navigation', 'wordpoints'),
506
+		'heading_list'       => __('Modules list', 'wordpoints'),
507 507
 	)
508 508
 );
509 509
 
Please login to merge, or discard this patch.
src/admin/screens/modules.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,62 +11,62 @@  discard block
 block discarded – undo
11 11
 
12 12
 $invalid = wordpoints_validate_active_modules();
13 13
 
14
-if ( ! empty( $invalid ) ) {
15
-	foreach ( $invalid as $module_file => $error ) {
14
+if ( ! empty($invalid)) {
15
+	foreach ($invalid as $module_file => $error) {
16 16
 		wordpoints_show_admin_error(
17 17
 			sprintf(
18 18
 				// translators: 1. Module name; 2. Error message.
19
-				__( 'The module %1$s has been <strong>deactivated</strong> due to an error: %2$s', 'wordpoints' )
20
-				, esc_html( $module_file )
21
-				, '<code>' . esc_html( $error->get_error_message() ) . '</code>'
19
+				__('The module %1$s has been <strong>deactivated</strong> due to an error: %2$s', 'wordpoints')
20
+				, esc_html($module_file)
21
+				, '<code>' . esc_html($error->get_error_message()) . '</code>'
22 22
 			)
23
-			, array( 'dismissible' => true )
23
+			, array('dismissible' => true)
24 24
 		);
25 25
 	}
26 26
 }
27 27
 
28
-if ( isset( $_GET['error'] ) ) {
28
+if (isset($_GET['error'])) {
29 29
 
30
-	if ( isset( $_GET['main'] ) ) {
30
+	if (isset($_GET['main'])) {
31 31
 
32 32
 		wordpoints_show_admin_error(
33
-			esc_html__( 'You cannot delete a module while it is active on the main site.', 'wordpoints' )
34
-			, array( 'dismissible' => true )
33
+			esc_html__('You cannot delete a module while it is active on the main site.', 'wordpoints')
34
+			, array('dismissible' => true)
35 35
 		);
36 36
 
37
-	} elseif ( isset( $_GET['charsout'] ) ) {
37
+	} elseif (isset($_GET['charsout'])) {
38 38
 
39 39
 		wordpoints_show_admin_message(
40 40
 			sprintf(
41 41
 				// translators: Number of characters.
42
-				__( 'The module generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this module.', 'wordpoints' )
42
+				__('The module generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this module.', 'wordpoints')
43 43
 				, (int) $_GET['charsout']
44 44
 			)
45 45
 			, 'warning'
46
-			, array( 'dismissible' => true )
46
+			, array('dismissible' => true)
47 47
 		);
48 48
 
49 49
 	} else {
50 50
 
51
-		$error_message = __( 'Module could not be activated because it triggered a <strong>fatal error</strong>.', 'wordpoints' );
51
+		$error_message = __('Module could not be activated because it triggered a <strong>fatal error</strong>.', 'wordpoints');
52 52
 
53 53
 		if (
54
-			isset( $_GET['_error_nonce'], $_GET['module'] )
55
-			&& wordpoints_verify_nonce( '_error_nonce', 'module-activation-error_%s', array( 'module' ) )
54
+			isset($_GET['_error_nonce'], $_GET['module'])
55
+			&& wordpoints_verify_nonce('_error_nonce', 'module-activation-error_%s', array('module'))
56 56
 		) {
57 57
 
58 58
 			$url = self_admin_url(
59 59
 				'admin.php?page=wordpoints_modules&action=error_scrape&amp;module='
60
-					. sanitize_text_field( wp_unslash( $_GET['module'] ) )
61
-					. '&amp;_wpnonce=' . sanitize_key( $_GET['_error_nonce'] )
60
+					. sanitize_text_field(wp_unslash($_GET['module']))
61
+					. '&amp;_wpnonce=' . sanitize_key($_GET['_error_nonce'])
62 62
 			);
63 63
 
64 64
 			?>
65 65
 
66 66
 			<div class="notice notice-error is-dismissible">
67 67
 				<p>
68
-					<?php echo wp_kses( $error_message, '' ); ?>
69
-					<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $url ); ?>"></iframe>
68
+					<?php echo wp_kses($error_message, ''); ?>
69
+					<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url($url); ?>"></iframe>
70 70
 				</p>
71 71
 			</div>
72 72
 
@@ -76,78 +76,78 @@  discard block
 block discarded – undo
76 76
 
77 77
 			wordpoints_show_admin_error(
78 78
 				$error_message
79
-				, array( 'dismissible' => true )
79
+				, array('dismissible' => true)
80 80
 			);
81 81
 		}
82 82
 
83 83
 	} // End if ( main error ) elseif ( unexpected output error ) else.
84 84
 
85
-} elseif ( isset( $_GET['deleted'] ) ) {
85
+} elseif (isset($_GET['deleted'])) {
86 86
 
87 87
 	$user_id       = get_current_user_id();
88
-	$delete_result = get_transient( 'wordpoints_modules_delete_result_' . $user_id );
88
+	$delete_result = get_transient('wordpoints_modules_delete_result_' . $user_id);
89 89
 
90 90
 	// Delete it once we're done.
91
-	delete_transient( 'wordpoints_modules_delete_result_' . $user_id );
91
+	delete_transient('wordpoints_modules_delete_result_' . $user_id);
92 92
 
93
-	if ( is_wp_error( $delete_result ) ) {
93
+	if (is_wp_error($delete_result)) {
94 94
 
95 95
 		wordpoints_show_admin_error(
96 96
 			sprintf(
97 97
 				// translators: Error message.
98
-				__( 'Module could not be deleted due to an error: %s', 'wordpoints' )
98
+				__('Module could not be deleted due to an error: %s', 'wordpoints')
99 99
 				, $delete_result->get_error_message()
100 100
 			)
101
-			, array( 'dismissible' => true )
101
+			, array('dismissible' => true)
102 102
 		);
103 103
 
104 104
 	} else {
105 105
 
106 106
 		wordpoints_show_admin_message(
107
-			__( 'The selected modules have been <strong>deleted</strong>.', 'wordpoints' )
107
+			__('The selected modules have been <strong>deleted</strong>.', 'wordpoints')
108 108
 			, 'success'
109
-			, array( 'dismissible' => true )
109
+			, array('dismissible' => true)
110 110
 		);
111 111
 	}
112 112
 
113
-} elseif ( isset( $_GET['activate'] ) ) {
113
+} elseif (isset($_GET['activate'])) {
114 114
 
115 115
 	wordpoints_show_admin_message(
116
-		__( 'Module <strong>activated</strong>.', 'wordpoints' )
116
+		__('Module <strong>activated</strong>.', 'wordpoints')
117 117
 		, 'success'
118
-		, array( 'dismissible' => true )
118
+		, array('dismissible' => true)
119 119
 	);
120 120
 
121
-} elseif ( isset( $_GET['activate-multi'] ) ) {
121
+} elseif (isset($_GET['activate-multi'])) {
122 122
 
123 123
 	wordpoints_show_admin_message(
124
-		__( 'Selected modules <strong>activated</strong>.', 'wordpoints' )
124
+		__('Selected modules <strong>activated</strong>.', 'wordpoints')
125 125
 		, 'success'
126
-		, array( 'dismissible' => true )
126
+		, array('dismissible' => true)
127 127
 	);
128 128
 
129
-} elseif ( isset( $_GET['deactivate'] ) ) {
129
+} elseif (isset($_GET['deactivate'])) {
130 130
 
131 131
 	wordpoints_show_admin_message(
132
-		__( 'Module <strong>deactivated</strong>.', 'wordpoints' )
132
+		__('Module <strong>deactivated</strong>.', 'wordpoints')
133 133
 		, 'success'
134
-		, array( 'dismissible' => true )
134
+		, array('dismissible' => true)
135 135
 	);
136 136
 
137
-} elseif ( isset( $_GET['deactivate-multi'] ) ) {
137
+} elseif (isset($_GET['deactivate-multi'])) {
138 138
 
139 139
 	wordpoints_show_admin_message(
140
-		__( 'Selected modules <strong>deactivated</strong>.', 'wordpoints' )
140
+		__('Selected modules <strong>deactivated</strong>.', 'wordpoints')
141 141
 		, 'success'
142
-		, array( 'dismissible' => true )
142
+		, array('dismissible' => true)
143 143
 	);
144 144
 
145
-} elseif ( isset( $_REQUEST['action'] ) && 'update-selected' === sanitize_key( $_REQUEST['action'] ) ) {
145
+} elseif (isset($_REQUEST['action']) && 'update-selected' === sanitize_key($_REQUEST['action'])) {
146 146
 
147 147
 	wordpoints_show_admin_message(
148
-		esc_html__( 'No out of date modules were selected.', 'wordpoints' )
148
+		esc_html__('No out of date modules were selected.', 'wordpoints')
149 149
 		, 'warning'
150
-		, array( 'dismissible' => true )
150
+		, array('dismissible' => true)
151 151
 	);
152 152
 
153 153
 } // End if ( error ) elseif ( other messages/errors ).
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
 
157 157
 <div class="wrap">
158 158
 	<h1>
159
-		<?php esc_html_e( 'WordPoints Modules', 'wordpoints' ); ?>
159
+		<?php esc_html_e('WordPoints Modules', 'wordpoints'); ?>
160 160
 
161
-		<?php if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_wordpoints_modules' ) ) : ?>
162
-			<a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_install_modules' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'module', 'wordpoints' ); ?></a>
161
+		<?php if (( ! is_multisite() || is_network_admin()) && current_user_can('install_wordpoints_modules')) : ?>
162
+			<a href="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_install_modules')); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'module', 'wordpoints'); ?></a>
163 163
 		<?php endif; ?>
164 164
 
165
-		<?php if ( ! empty( $_REQUEST['s'] ) ) : ?>
165
+		<?php if ( ! empty($_REQUEST['s'])) : ?>
166 166
 			<span class="subtitle">
167 167
 				<?php
168 168
 
169 169
 				echo esc_html(
170 170
 					sprintf(
171 171
 						// translators: Search term.
172
-						__( 'Search results for &#8220;%s&#8221;', 'wordpoints' )
173
-						, sanitize_text_field( wp_unslash( $_REQUEST['s'] ) )
172
+						__('Search results for &#8220;%s&#8221;', 'wordpoints')
173
+						, sanitize_text_field(wp_unslash($_REQUEST['s']))
174 174
 					)
175 175
 				);
176 176
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 
189 189
 	<?php $wp_list_table->views(); ?>
190 190
 
191
-	<form method="get" action="<?php echo esc_url( self_admin_url( 'admin.php' ) ); ?>">
191
+	<form method="get" action="<?php echo esc_url(self_admin_url('admin.php')); ?>">
192 192
 		<input type="hidden" name="page" value="wordpoints_modules" />
193
-		<?php $wp_list_table->search_box( esc_html__( 'Search Installed Modules', 'wordpoints' ), 'module' ); ?>
193
+		<?php $wp_list_table->search_box(esc_html__('Search Installed Modules', 'wordpoints'), 'module'); ?>
194 194
 	</form>
195 195
 
196
-	<form method="post" action="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_modules' ) ); ?>">
197
-		<input type="hidden" name="module_status" value="<?php echo esc_attr( $status ) ?>" />
198
-		<input type="hidden" name="paged" value="<?php echo esc_attr( $page ) ?>" />
196
+	<form method="post" action="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_modules')); ?>">
197
+		<input type="hidden" name="module_status" value="<?php echo esc_attr($status) ?>" />
198
+		<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
199 199
 		<?php $wp_list_table->display(); ?>
200 200
 	</form>
201 201
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0.0
207 207
 	 */
208
-	do_action( 'wordpoints_admin_modules' );
208
+	do_action('wordpoints_admin_modules');
209 209
 	?>
210 210
 
211 211
 </div>
Please login to merge, or discard this patch.
src/admin/screens/configure.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 		 *
31 31
 		 * @since 1.0.0
32 32
 		 */
33
-		do_action( 'wordpoints_admin_configure_head' );
33
+		do_action('wordpoints_admin_configure_head');
34 34
 
35 35
 		wordpoints_admin_show_tabs(
36 36
 			array(
37
-				'general'    => __( 'General Settings', 'wordpoints' ),
38
-				'components' => __( 'Components', 'wordpoints' ),
37
+				'general'    => __('General Settings', 'wordpoints'),
38
+				'components' => __('Components', 'wordpoints'),
39 39
 			)
40 40
 		);
41 41
 
42
-		if ( 'components' === wordpoints_admin_get_current_tab() ) {
42
+		if ('components' === wordpoints_admin_get_current_tab()) {
43 43
 			/**
44 44
 			 * The Components screen.
45 45
 			 *
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 *
61 61
 		 * @since 1.0.0
62 62
 		 */
63
-		do_action( 'wordpoints_admin_configure_foot' );
63
+		do_action('wordpoints_admin_configure_foot');
64 64
 
65 65
 		?>
66 66
 
Please login to merge, or discard this patch.
src/admin/includes/filters.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@
 block discarded – undo
7 7
  * @since 2.1.0
8 8
  */
9 9
 
10
-add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' );
10
+add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps');
11 11
 
12
-add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' );
13
-add_action( 'admin_init', 'wordpoints_register_admin_scripts' );
12
+add_action('admin_init', 'wordpoints_hooks_admin_ajax');
13
+add_action('admin_init', 'wordpoints_register_admin_scripts');
14 14
 
15
-add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 );
15
+add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2);
16 16
 
17
-add_action( 'admin_menu', 'wordpoints_admin_menu' );
18
-add_action( 'network_admin_menu', 'wordpoints_admin_menu' );
17
+add_action('admin_menu', 'wordpoints_admin_menu');
18
+add_action('network_admin_menu', 'wordpoints_admin_menu');
19 19
 
20
-add_action( 'load-wordpoints_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load' );
21
-add_action( 'load-toplevel_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load' );
20
+add_action('load-wordpoints_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load');
21
+add_action('load-toplevel_page_wordpoints_modules', 'wordpoints_admin_screen_modules_load');
22 22
 
23
-add_action( 'load-toplevel_page_wordpoints_configure', 'wordpoints_admin_screen_configure_load' );
23
+add_action('load-toplevel_page_wordpoints_configure', 'wordpoints_admin_screen_configure_load');
24 24
 
25
-add_action( 'load-toplevel_page_wordpoints_configure', 'wordpoints_admin_activate_components' );
25
+add_action('load-toplevel_page_wordpoints_configure', 'wordpoints_admin_activate_components');
26 26
 
27
-add_action( 'wordpoints_install_modules-upload', 'wordpoints_install_modules_upload' );
27
+add_action('wordpoints_install_modules-upload', 'wordpoints_install_modules_upload');
28 28
 
29
-add_action( 'update-custom_upload-wordpoints-module', 'wordpoints_upload_module_zip' );
29
+add_action('update-custom_upload-wordpoints-module', 'wordpoints_upload_module_zip');
30 30
 
31
-add_action( 'upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 5 );
32
-add_action( 'upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 20 );
31
+add_action('upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 5);
32
+add_action('upgrader_source_selection', 'wordpoints_plugin_upload_error_filter', 20);
33 33
 
34
-add_action( 'wordpoints_admin_configure_foot', 'wordpoints_admin_settings_screen_sidebar', 5 );
34
+add_action('wordpoints_admin_configure_foot', 'wordpoints_admin_settings_screen_sidebar', 5);
35 35
 
36
-add_action( 'admin_notices', 'wordpoints_admin_notices' );
36
+add_action('admin_notices', 'wordpoints_admin_notices');
37 37
 
38
-add_action( 'set-screen-option', 'wordpoints_admin_set_screen_option', 10, 3 );
38
+add_action('set-screen-option', 'wordpoints_admin_set_screen_option', 10, 3);
39 39
 
40
-add_action( 'wp_ajax_nopriv_wordpoints_breaking_module_check', 'wordpoints_admin_ajax_breaking_module_check' );
41
-add_action( 'wp_ajax_wordpoints-delete-admin-notice-option', 'wordpoints_delete_admin_notice_option' );
40
+add_action('wp_ajax_nopriv_wordpoints_breaking_module_check', 'wordpoints_admin_ajax_breaking_module_check');
41
+add_action('wp_ajax_wordpoints-delete-admin-notice-option', 'wordpoints_delete_admin_notice_option');
42 42
 
43 43
 // EOF
Please login to merge, or discard this patch.
src/admin/includes/class-wordpoints-module-installer-skin.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *        @type string $title  Text for H2 title used by WP_Upgrader_Skin::header().
51 51
 	 * }
52 52
 	 */
53
-	public function __construct( $args = array() ) {
53
+	public function __construct($args = array()) {
54 54
 
55 55
 		$defaults = array(
56 56
 			'type'   => 'upload',
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 			'title'  => '',
60 60
 		);
61 61
 
62
-		$args = array_merge( $defaults, $args );
62
+		$args = array_merge($defaults, $args);
63 63
 
64 64
 		$this->type = $args['type'];
65 65
 
66
-		parent::__construct( $args );
66
+		parent::__construct($args);
67 67
 	}
68 68
 
69 69
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function after() {
75 75
 
76
-		if ( ! $this->upgrader instanceof WordPoints_Module_Installer ) {
76
+		if ( ! $this->upgrader instanceof WordPoints_Module_Installer) {
77 77
 			return;
78 78
 		}
79 79
 
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$install_actions = array();
83 83
 
84
-		if ( $this->result && ! is_wp_error( $this->result ) ) {
84
+		if ($this->result && ! is_wp_error($this->result)) {
85 85
 
86
-			if ( is_multisite() && current_user_can( 'manage_network_wordpoints_modules' ) ) {
86
+			if (is_multisite() && current_user_can('manage_network_wordpoints_modules')) {
87 87
 
88
-				$install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=activate&amp;networkwide=1&amp;module=' . urlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>';
88
+				$install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=activate&amp;networkwide=1&amp;module=' . urlencode($module_file)), "activate-module_{$module_file}") . '" target="_parent">' . esc_html__('Network Activate', 'wordpoints') . '</a>';
89 89
 
90
-			} elseif ( current_user_can( 'activate_wordpoints_modules' ) ) {
90
+			} elseif (current_user_can('activate_wordpoints_modules')) {
91 91
 
92
-				$install_actions['activate_module'] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=activate&amp;module=' . urlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Activate Module', 'wordpoints' ) . '</a>';
92
+				$install_actions['activate_module'] = '<a class="button button-primary" href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=activate&amp;module=' . urlencode($module_file)), "activate-module_{$module_file}") . '" target="_parent">' . esc_html__('Activate Module', 'wordpoints') . '</a>';
93 93
 			}
94 94
 		}
95 95
 
96
-		$install_actions['modules_page'] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_modules' ) ) . '" target="_parent">' . esc_html__( 'Return to Modules page', 'wordpoints' ) . '</a>';
97
-		$install_actions['install_page'] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_install_modules' ) ) . '" target="_parent">' . esc_html__( 'Return to Module Installer', 'wordpoints' ) . '</a>';
96
+		$install_actions['modules_page'] = '<a href="' . esc_url(self_admin_url('admin.php?page=wordpoints_modules')) . '" target="_parent">' . esc_html__('Return to Modules page', 'wordpoints') . '</a>';
97
+		$install_actions['install_page'] = '<a href="' . esc_url(self_admin_url('admin.php?page=wordpoints_install_modules')) . '" target="_parent">' . esc_html__('Return to Module Installer', 'wordpoints') . '</a>';
98 98
 
99 99
 		/**
100 100
 		 * The install module action links.
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 		 * }
113 113
 		 * @param string $module_file The main module file.
114 114
 		 */
115
-		$install_actions = apply_filters( 'wordpoints_install_module_complete_actions', $install_actions, $module_file );
115
+		$install_actions = apply_filters('wordpoints_install_module_complete_actions', $install_actions, $module_file);
116 116
 
117
-		if ( ! empty( $install_actions ) ) {
118
-			$this->feedback( implode( '&nbsp;&nbsp;', (array) $install_actions ) );
117
+		if ( ! empty($install_actions)) {
118
+			$this->feedback(implode('&nbsp;&nbsp;', (array) $install_actions));
119 119
 		}
120 120
 
121 121
 	} // function after()
Please login to merge, or discard this patch.
src/admin/includes/class-wordpoints-modules-list-table.php 2 patches
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @param array $args {@see WP_List_Table::__construct()}.
43 43
 	 */
44
-	public function __construct( $args = array() ) {
44
+	public function __construct($args = array()) {
45 45
 
46 46
 		global $status, $page;
47 47
 
48 48
 		parent::__construct(
49 49
 			array(
50 50
 				'plural' => 'modules',
51
-				'screen' => ( isset( $args['screen'] ) ) ? $args['screen'] : null,
51
+				'screen' => (isset($args['screen'])) ? $args['screen'] : null,
52 52
 			)
53 53
 		);
54 54
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 		$status = 'all';
58 58
 
59
-		$module_statuses = array( 'active', 'inactive', 'recently_activated', 'search' );
59
+		$module_statuses = array('active', 'inactive', 'recently_activated', 'search');
60 60
 
61 61
 		/**
62 62
 		 * Filter the module statuses on the modules administration panel.
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 		 * @param array $statuses The module statuses. The defaults are 'active',
67 67
 		 *                        'inactive', 'recently_activated', and 'search'.
68 68
 		 */
69
-		$module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses );
69
+		$module_statuses = apply_filters('wordpoints_module_statuses', $module_statuses);
70 70
 
71
-		if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses ) ) {
72
-			$status = sanitize_key( $_REQUEST['module_status'] );
71
+		if (isset($_REQUEST['module_status']) && in_array(wp_unslash($_REQUEST['module_status']), $module_statuses)) {
72
+			$status = sanitize_key($_REQUEST['module_status']);
73 73
 		}
74 74
 
75
-		if ( isset( $_REQUEST['s'] ) ) {
76
-			$_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) );
75
+		if (isset($_REQUEST['s'])) {
76
+			$_SERVER['REQUEST_URI'] = add_query_arg('s', sanitize_text_field(wp_unslash($_REQUEST['s'])));
77 77
 		}
78 78
 
79 79
 		$page = $this->get_pagenum();
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function get_table_classes() {
90 90
 
91
-		return array( 'widefat', $this->_args['plural'], 'plugins' );
91
+		return array('widefat', $this->_args['plural'], 'plugins');
92 92
 	}
93 93
 
94 94
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function ajax_user_can() {
102 102
 
103
-		return current_user_can( 'activate_wordpoints_modules' );
103
+		return current_user_can('activate_wordpoints_modules');
104 104
 	}
105 105
 
106 106
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 		global $status, $modules, $totals, $page, $orderby, $order, $s;
114 114
 
115
-		wp_reset_vars( array( 'orderby', 'order', 's' ) );
115
+		wp_reset_vars(array('orderby', 'order', 's'));
116 116
 
117 117
 		$modules = array(
118 118
 			/**
@@ -122,70 +122,70 @@  discard block
 block discarded – undo
122 122
 			 *
123 123
 			 * @param array $modules All of the installed modules.
124 124
 			 */
125
-			'all'                => apply_filters( 'all_wordpoints_modules', wordpoints_get_modules() ),
125
+			'all'                => apply_filters('all_wordpoints_modules', wordpoints_get_modules()),
126 126
 			'search'             => array(),
127 127
 			'active'             => array(),
128 128
 			'inactive'           => array(),
129 129
 			'recently_activated' => array(),
130 130
 		);
131 131
 
132
-		if ( ! $this->screen->in_admin( 'network' ) ) {
132
+		if ( ! $this->screen->in_admin('network')) {
133 133
 
134
-			$recently_activated = get_option( 'wordpoints_recently_activated_modules' );
134
+			$recently_activated = get_option('wordpoints_recently_activated_modules');
135 135
 
136
-			if ( ! is_array( $recently_activated ) ) {
137
-				add_option( 'wordpoints_recently_activated_modules', array(), '', 'no' );
136
+			if ( ! is_array($recently_activated)) {
137
+				add_option('wordpoints_recently_activated_modules', array(), '', 'no');
138 138
 				$recently_activated = array();
139 139
 			}
140 140
 
141
-			foreach ( $recently_activated as $key => $time ) {
141
+			foreach ($recently_activated as $key => $time) {
142 142
 
143
-				if ( $time + WEEK_IN_SECONDS < time() ) {
144
-					unset( $recently_activated[ $key ] );
143
+				if ($time + WEEK_IN_SECONDS < time()) {
144
+					unset($recently_activated[$key]);
145 145
 				}
146 146
 			}
147 147
 
148
-			update_option( 'wordpoints_recently_activated_modules', $recently_activated );
148
+			update_option('wordpoints_recently_activated_modules', $recently_activated);
149 149
 		}
150 150
 
151
-		foreach ( (array) $modules['all'] as $module_file => $module_data ) {
151
+		foreach ((array) $modules['all'] as $module_file => $module_data) {
152 152
 
153 153
 			// Filter into individual sections.
154
-			if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && is_network_only_wordpoints_module( $module_file ) ) {
154
+			if (is_multisite() && ! $this->screen->in_admin('network') && is_network_only_wordpoints_module($module_file)) {
155 155
 
156
-				unset( $modules['all'][ $module_file ] );
156
+				unset($modules['all'][$module_file]);
157 157
 
158
-			} elseif ( ! $this->screen->in_admin( 'network' ) && is_wordpoints_module_active_for_network( $module_file ) ) {
158
+			} elseif ( ! $this->screen->in_admin('network') && is_wordpoints_module_active_for_network($module_file)) {
159 159
 
160
-				unset( $modules['all'][ $module_file ] );
160
+				unset($modules['all'][$module_file]);
161 161
 
162 162
 			} elseif (
163 163
 				(
164
-					! $this->screen->in_admin( 'network' )
165
-					&& is_wordpoints_module_active( $module_file )
164
+					! $this->screen->in_admin('network')
165
+					&& is_wordpoints_module_active($module_file)
166 166
 				) || (
167
-					$this->screen->in_admin( 'network' )
168
-					&& is_wordpoints_module_active_for_network( $module_file )
167
+					$this->screen->in_admin('network')
168
+					&& is_wordpoints_module_active_for_network($module_file)
169 169
 				)
170 170
 			) {
171 171
 
172
-				$modules['active'][ $module_file ] = $module_data;
172
+				$modules['active'][$module_file] = $module_data;
173 173
 
174 174
 			} else {
175 175
 
176 176
 				// Was the module recently activated?
177
-				if ( ! $this->screen->in_admin( 'network' ) && isset( $recently_activated[ $module_file ] ) ) {
178
-					$modules['recently_activated'][ $module_file ] = $module_data;
177
+				if ( ! $this->screen->in_admin('network') && isset($recently_activated[$module_file])) {
178
+					$modules['recently_activated'][$module_file] = $module_data;
179 179
 				}
180 180
 
181
-				$modules['inactive'][ $module_file ] = $module_data;
181
+				$modules['inactive'][$module_file] = $module_data;
182 182
 			}
183 183
 		}
184 184
 
185
-		if ( $s ) {
185
+		if ($s) {
186 186
 
187 187
 			$status = 'search';
188
-			$modules['search'] = array_filter( $modules['all'], array( $this, '_search_callback' ) );
188
+			$modules['search'] = array_filter($modules['all'], array($this, '_search_callback'));
189 189
 		}
190 190
 
191 191
 		/**
@@ -203,42 +203,42 @@  discard block
 block discarded – undo
203 203
 		 *        @type array $recently_activated Modules that were recently active.
204 204
 		 * }
205 205
 		 */
206
-		$modules = apply_filters( 'wordpoints_modules_list_table_items', $modules );
206
+		$modules = apply_filters('wordpoints_modules_list_table_items', $modules);
207 207
 
208 208
 		// Calculate the totals.
209 209
 		$totals = array();
210 210
 
211
-		foreach ( $modules as $type => $list ) {
212
-			$totals[ $type ] = count( $list );
211
+		foreach ($modules as $type => $list) {
212
+			$totals[$type] = count($list);
213 213
 		}
214 214
 
215
-		if ( empty( $modules[ $status ] ) && ! in_array( $status, array( 'all', 'search' ) ) ) {
215
+		if (empty($modules[$status]) && ! in_array($status, array('all', 'search'))) {
216 216
 			$status = 'all';
217 217
 		}
218 218
 
219 219
 		$this->items = array();
220 220
 
221
-		foreach ( $modules[ $status ] as $module_file => $module_data ) {
221
+		foreach ($modules[$status] as $module_file => $module_data) {
222 222
 
223
-			$this->items[ $module_file ] = wordpoints_get_module_data( wordpoints_modules_dir() . '/' . $module_file, false );
223
+			$this->items[$module_file] = wordpoints_get_module_data(wordpoints_modules_dir() . '/' . $module_file, false);
224 224
 		}
225 225
 
226
-		$total_this_page = $totals[ $status ];
226
+		$total_this_page = $totals[$status];
227 227
 
228
-		if ( ! $orderby ) {
228
+		if ( ! $orderby) {
229 229
 			$orderby = 'name';
230 230
 		}
231 231
 
232
-		$order = strtoupper( $order );
232
+		$order = strtoupper($order);
233 233
 
234
-		uasort( $this->items, array( $this, '_order_callback' ) );
234
+		uasort($this->items, array($this, '_order_callback'));
235 235
 
236
-		$modules_per_page = $this->get_items_per_page( str_replace( '-', '_', $this->screen->id . '_per_page' ), 999 );
236
+		$modules_per_page = $this->get_items_per_page(str_replace('-', '_', $this->screen->id . '_per_page'), 999);
237 237
 
238
-		$start = ( $page - 1 ) * $modules_per_page;
238
+		$start = ($page - 1) * $modules_per_page;
239 239
 
240
-		if ( $total_this_page > $modules_per_page ) {
241
-			$this->items = array_slice( $this->items, $start, $modules_per_page );
240
+		if ($total_this_page > $modules_per_page) {
241
+			$this->items = array_slice($this->items, $start, $modules_per_page);
242 242
 		}
243 243
 
244 244
 		$this->set_pagination_args(
@@ -258,17 +258,17 @@  discard block
 block discarded – undo
258 258
 	 *
259 259
 	 * @return bool Whether any of the module's data matches the search.
260 260
 	 */
261
-	private function _search_callback( $module_data ) {
261
+	private function _search_callback($module_data) {
262 262
 
263 263
 		static $term;
264 264
 
265
-		if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) {
266
-			$term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
265
+		if (is_null($term) && isset($_REQUEST['s'])) {
266
+			$term = sanitize_text_field(wp_unslash($_REQUEST['s']));
267 267
 		}
268 268
 
269
-		foreach ( $module_data as $value ) {
269
+		foreach ($module_data as $value) {
270 270
 
271
-			if ( false !== stripos( strip_tags( $value ), $term ) ) {
271
+			if (false !== stripos(strip_tags($value), $term)) {
272 272
 				return true;
273 273
 			}
274 274
 		}
@@ -288,21 +288,21 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @return int How the modules compare.
290 290
 	 */
291
-	private function _order_callback( $module_a, $module_b ) {
291
+	private function _order_callback($module_a, $module_b) {
292 292
 
293 293
 		global $orderby, $order;
294 294
 
295
-		$a = $module_a[ $orderby ];
296
-		$b = $module_b[ $orderby ];
295
+		$a = $module_a[$orderby];
296
+		$b = $module_b[$orderby];
297 297
 
298
-		if ( $a === $b ) {
298
+		if ($a === $b) {
299 299
 			return 0;
300 300
 		}
301 301
 
302
-		if ( 'DESC' === $order ) {
303
-			return strcasecmp( $b, $a );
302
+		if ('DESC' === $order) {
303
+			return strcasecmp($b, $a);
304 304
 		} else {
305
-			return strcasecmp( $a, $b );
305
+			return strcasecmp($a, $b);
306 306
 		}
307 307
 	}
308 308
 
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 
316 316
 		global $modules;
317 317
 
318
-		if ( ! empty( $modules['all'] ) ) {
319
-			esc_html_e( 'No modules found.', 'wordpoints' );
318
+		if ( ! empty($modules['all'])) {
319
+			esc_html_e('No modules found.', 'wordpoints');
320 320
 		} else {
321
-			esc_html_e( 'There are not any modules installed.', 'wordpoints' );
321
+			esc_html_e('There are not any modules installed.', 'wordpoints');
322 322
 		}
323 323
 	}
324 324
 
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 
334 334
 		return array(
335 335
 			'cb'          => '<input type="checkbox" />',
336
-			'name'        => esc_html__( 'Module', 'wordpoints' ),
337
-			'description' => esc_html__( 'Description', 'wordpoints' ),
336
+			'name'        => esc_html__('Module', 'wordpoints'),
337
+			'description' => esc_html__('Description', 'wordpoints'),
338 338
 		);
339 339
 	}
340 340
 
@@ -351,39 +351,39 @@  discard block
 block discarded – undo
351 351
 
352 352
 		$status_links = array();
353 353
 
354
-		foreach ( $totals as $type => $count ) {
354
+		foreach ($totals as $type => $count) {
355 355
 
356
-			if ( ! $count ) {
356
+			if ( ! $count) {
357 357
 				continue;
358 358
 			}
359 359
 
360
-			switch ( $type ) {
360
+			switch ($type) {
361 361
 
362 362
 				case 'all':
363 363
 					// translators: Count.
364
-					$text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'modules', 'wordpoints' );
364
+					$text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'modules', 'wordpoints');
365 365
 				break;
366 366
 
367 367
 				case 'active':
368 368
 					// translators: Count.
369
-					$text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'wordpoints' );
369
+					$text = _n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'wordpoints');
370 370
 				break;
371 371
 
372 372
 				case 'recently_activated':
373 373
 					// translators: Count.
374
-					$text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'wordpoints' );
374
+					$text = _n('Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'wordpoints');
375 375
 				break;
376 376
 
377 377
 				case 'inactive':
378 378
 					// translators: Count.
379
-					$text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'wordpoints' );
379
+					$text = _n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'wordpoints');
380 380
 				break;
381 381
 
382 382
 				default:
383 383
 					$text = $type;
384 384
 			}
385 385
 
386
-			if ( 'search' !== $type ) {
386
+			if ('search' !== $type) {
387 387
 
388 388
 				/**
389 389
 				 * Filter the text for a module status link for the module list table.
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 				 * @param string $text  The link text.
394 394
 				 * @param int    $count The number of modules matching this filter.
395 395
 				 */
396
-				$text = apply_filters( "wordpoints_modules_status_link_text-{$type}", $text, $count );
396
+				$text = apply_filters("wordpoints_modules_status_link_text-{$type}", $text, $count);
397 397
 
398
-				$status_links[ $type ] = sprintf(
398
+				$status_links[$type] = sprintf(
399 399
 					"<a href='%s' %s>%s</a>"
400
-					, esc_url( add_query_arg( 'module_status', $type, self_admin_url( 'admin.php?page=wordpoints_modules' ) ) )
401
-					, ( $type === $status ) ? ' class="current"' : ''
402
-					, sprintf( $text, number_format_i18n( $count ) )
400
+					, esc_url(add_query_arg('module_status', $type, self_admin_url('admin.php?page=wordpoints_modules')))
401
+					, ($type === $status) ? ' class="current"' : ''
402
+					, sprintf($text, number_format_i18n($count))
403 403
 				);
404 404
 			}
405 405
 
@@ -428,20 +428,20 @@  discard block
 block discarded – undo
428 428
 
429 429
 		$actions = array();
430 430
 
431
-		if ( 'active' !== $status ) {
432
-			$actions['activate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' );
431
+		if ('active' !== $status) {
432
+			$actions['activate-selected'] = ($this->screen->in_admin('network')) ? esc_html__('Network Activate', 'wordpoints') : esc_html__('Activate', 'wordpoints');
433 433
 		}
434 434
 
435
-		if ( 'inactive' !== $status && 'recent' !== $status ) {
436
-			$actions['deactivate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' );
435
+		if ('inactive' !== $status && 'recent' !== $status) {
436
+			$actions['deactivate-selected'] = ($this->screen->in_admin('network')) ? esc_html__('Network Deactivate', 'wordpoints') : esc_html__('Deactivate', 'wordpoints');
437 437
 		}
438 438
 
439 439
 		if (
440
-			( ! is_multisite() || $this->screen->in_admin( 'network' ) )
441
-			&& current_user_can( 'delete_wordpoints_modules' )
440
+			( ! is_multisite() || $this->screen->in_admin('network'))
441
+			&& current_user_can('delete_wordpoints_modules')
442 442
 			&& 'active' !== $status
443 443
 		) {
444
-			$actions['delete-selected'] = esc_html__( 'Delete', 'wordpoints' );
444
+			$actions['delete-selected'] = esc_html__('Delete', 'wordpoints');
445 445
 		}
446 446
 
447 447
 		/**
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		 * @param array  $actions The bulk action links.
453 453
 		 * @param string $status  The current module status being displayed.
454 454
 		 */
455
-		$actions = apply_filters( 'wordpoints_module_bulk_actions', $actions, $status );
455
+		$actions = apply_filters('wordpoints_module_bulk_actions', $actions, $status);
456 456
 
457 457
 		return $actions;
458 458
 	}
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
 	 *
465 465
 	 * @param string $which Not used.
466 466
 	 */
467
-	public function extra_tablenav( $which ) {
467
+	public function extra_tablenav($which) {
468 468
 
469 469
 		global $status;
470 470
 
471
-		if ( 'recently_activated' !== $status ) {
471
+		if ('recently_activated' !== $status) {
472 472
 			return;
473 473
 		}
474 474
 
475 475
 		echo '<div class="alignleft actions">';
476 476
 
477
-		if ( ! $this->screen->in_admin( 'network' ) ) {
478
-			submit_button( __( 'Clear List', 'wordpoints' ), 'button', 'clear-recent-list', false );
477
+		if ( ! $this->screen->in_admin('network')) {
478
+			submit_button(__('Clear List', 'wordpoints'), 'button', 'clear-recent-list', false);
479 479
 		}
480 480
 
481 481
 		echo '</div>';
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 	 */
489 489
 	public function display_rows() {
490 490
 
491
-		foreach ( $this->items as $module_file => $module_data ) {
491
+		foreach ($this->items as $module_file => $module_data) {
492 492
 
493
-			$this->single_row( array( $module_file, $module_data ) );
493
+			$this->single_row(array($module_file, $module_data));
494 494
 		}
495 495
 	}
496 496
 
@@ -501,20 +501,20 @@  discard block
 block discarded – undo
501 501
 	 *
502 502
 	 * @param array $item The module file and the module data.
503 503
 	 */
504
-	public function single_row( $item ) {
504
+	public function single_row($item) {
505 505
 
506 506
 		global $status;
507 507
 
508
-		list( $module_file, $module_data ) = $item;
508
+		list($module_file, $module_data) = $item;
509 509
 		$context = $status;
510 510
 
511
-		if ( $this->screen->in_admin( 'network' ) ) {
512
-			$is_active = is_wordpoints_module_active_for_network( $module_file );
511
+		if ($this->screen->in_admin('network')) {
512
+			$is_active = is_wordpoints_module_active_for_network($module_file);
513 513
 		} else {
514
-			$is_active = is_wordpoints_module_active( $module_file );
514
+			$is_active = is_wordpoints_module_active($module_file);
515 515
 		}
516 516
 
517
-		$class = ( $is_active ) ? 'active' : 'inactive';
517
+		$class = ($is_active) ? 'active' : 'inactive';
518 518
 
519 519
 		/**
520 520
 		 * Filter the class of a row of the module's list table.
@@ -526,88 +526,88 @@  discard block
 block discarded – undo
526 526
 		 * @param string $module_data The module's data.
527 527
 		 * @param string $context     The current status context in which the modules are being displayed.
528 528
 		 */
529
-		$class = apply_filters( 'wordpoints_module_list_row_class', $class, $module_file, $module_data, $context );
529
+		$class = apply_filters('wordpoints_module_list_row_class', $class, $module_file, $module_data, $context);
530 530
 
531 531
 		?>
532
-		<tr id="<?php echo esc_attr( sanitize_title( $module_data['name'] ) ); ?>" class="<?php echo esc_attr( $class ); ?>">
532
+		<tr id="<?php echo esc_attr(sanitize_title($module_data['name'])); ?>" class="<?php echo esc_attr($class); ?>">
533 533
 			<?php
534 534
 
535
-			list( $columns, $hidden ) = $this->get_column_info();
535
+			list($columns, $hidden) = $this->get_column_info();
536 536
 
537
-			foreach ( $columns as $column_name => $column_display_name ) {
537
+			foreach ($columns as $column_name => $column_display_name) {
538 538
 
539
-				$is_hidden = in_array( $column_name, $hidden );
539
+				$is_hidden = in_array($column_name, $hidden);
540 540
 
541
-				switch ( $column_name ) {
541
+				switch ($column_name) {
542 542
 
543 543
 					case 'cb':
544
-						$checkbox_id = 'checkbox_' . sanitize_key( $module_file );
544
+						$checkbox_id = 'checkbox_' . sanitize_key($module_file);
545 545
 
546 546
 						?>
547 547
 						<th scope="row" class="check-column">
548
-							<label class="screen-reader-text" for="<?php echo esc_attr( $checkbox_id ); ?>">
548
+							<label class="screen-reader-text" for="<?php echo esc_attr($checkbox_id); ?>">
549 549
 								<?php
550 550
 
551 551
 								echo esc_html(
552 552
 									sprintf(
553 553
 										// translators: Module name.
554
-										__( 'Select %s', 'wordpoints' )
554
+										__('Select %s', 'wordpoints')
555 555
 										, $module_data['name']
556 556
 									)
557 557
 								);
558 558
 
559 559
 								?>
560 560
 							</label>
561
-							<input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_file ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" />
561
+							<input type="checkbox" name="checked[]" value="<?php echo esc_attr($module_file); ?>" id="<?php echo esc_attr($checkbox_id); ?>" />
562 562
 						</th>
563 563
 						<?php
564 564
 					break;
565 565
 
566 566
 					case 'name':
567 567
 						?>
568
-						<td class="module-title<?php echo ( $is_hidden ) ? ' hidden' : ''; ?>">
569
-							<strong><?php echo esc_html( $module_data['name'] ); ?></strong>
570
-							<?php echo $this->row_actions( $this->get_module_row_actions( $module_file, $module_data, $is_active ), true ); // XSS OK WPCS ?>
568
+						<td class="module-title<?php echo ($is_hidden) ? ' hidden' : ''; ?>">
569
+							<strong><?php echo esc_html($module_data['name']); ?></strong>
570
+							<?php echo $this->row_actions($this->get_module_row_actions($module_file, $module_data, $is_active), true); // XSS OK WPCS ?>
571 571
 						</td>
572 572
 						<?php
573 573
 					break;
574 574
 
575 575
 					case 'description':
576 576
 						?>
577
-						<td class="column-description desc<?php echo ( $is_hidden ) ? ' hidden' : ''; ?>">
577
+						<td class="column-description desc<?php echo ($is_hidden) ? ' hidden' : ''; ?>">
578 578
 							<div class="module-description">
579 579
 								<p>
580
-									<?php if ( ! empty( $module_data['description'] ) ) : ?>
581
-										<?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?>
580
+									<?php if ( ! empty($module_data['description'])) : ?>
581
+										<?php echo wp_kses($module_data['description'], 'wordpoints_module_description'); ?>
582 582
 									<?php else : ?>
583 583
 										&nbsp;
584 584
 									<?php endif; ?>
585 585
 								</p>
586 586
 							</div>
587
-							<div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri">
587
+							<div class="<?php echo esc_attr($class); ?> second module-version-author-uri">
588 588
 								<?php
589 589
 
590 590
 								$module_meta = array();
591 591
 
592
-								if ( ! empty( $module_data['version'] ) ) {
592
+								if ( ! empty($module_data['version'])) {
593 593
 									// translators: Module version.
594
-									$module_meta[] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data['version'] );
594
+									$module_meta[] = sprintf(esc_html__('Version %s', 'wordpoints'), $module_data['version']);
595 595
 								}
596 596
 
597
-								if ( ! empty( $module_data['author'] ) ) {
597
+								if ( ! empty($module_data['author'])) {
598 598
 
599 599
 									$author = $module_data['author'];
600 600
 
601
-									if ( ! empty( $module_data['author_uri'] ) ) {
602
-										$author = '<a href="' . esc_url( $module_data['author_uri'] ) . '">' . esc_html( $module_data['author'] ) . '</a>';
601
+									if ( ! empty($module_data['author_uri'])) {
602
+										$author = '<a href="' . esc_url($module_data['author_uri']) . '">' . esc_html($module_data['author']) . '</a>';
603 603
 									}
604 604
 
605 605
 									// translators: Author name.
606
-									$module_meta[] = sprintf( __( 'By %s', 'wordpoints' ), $author );
606
+									$module_meta[] = sprintf(__('By %s', 'wordpoints'), $author);
607 607
 								}
608 608
 
609
-								if ( ! empty( $module_data['module_uri'] ) ) {
610
-									$module_meta[] = '<a href="' . esc_url( $module_data['module_uri'] ) . '">' . esc_html__( 'Visit module site', 'wordpoints' ) . '</a>';
609
+								if ( ! empty($module_data['module_uri'])) {
610
+									$module_meta[] = '<a href="' . esc_url($module_data['module_uri']) . '">' . esc_html__('Visit module site', 'wordpoints') . '</a>';
611 611
 								}
612 612
 
613 613
 								/**
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 								 * @param array  $module_data The info about the module.
624 624
 								 * @param string $status      The module status being displayed.
625 625
 								 */
626
-								$module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_file, $module_data, $status );
626
+								$module_meta = apply_filters('wordpoints_module_row_meta', $module_meta, $module_file, $module_data, $status);
627 627
 
628
-								echo wp_kses( implode( ' | ', $module_meta ), 'data' );
628
+								echo wp_kses(implode(' | ', $module_meta), 'data');
629 629
 
630 630
 								?>
631 631
 							</div>
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 
636 636
 					default:
637 637
 						?>
638
-						<td class="<?php echo sanitize_html_class( $column_name ); ?> column-<?php echo sanitize_html_class( $column_name ); ?><?php echo ( $is_hidden ) ? ' hidden' : ''; ?>">
638
+						<td class="<?php echo sanitize_html_class($column_name); ?> column-<?php echo sanitize_html_class($column_name); ?><?php echo ($is_hidden) ? ' hidden' : ''; ?>">
639 639
 							<?php
640 640
 							/**
641 641
 							 * Display the row contents for a custom column in the module list table.
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 							 * @param string $module_file The main file of the current module.
647 647
 							 * @param array  $module_data The module's info.
648 648
 							 */
649
-							do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_file, $module_data );
649
+							do_action('wordpoints_manage_modules_custom_column', $column_name, $module_file, $module_data);
650 650
 							?>
651 651
 						</td>
652 652
 						<?php
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 		 * @param array  $module_data The module's info.
669 669
 		 * @param string $status      The status of the module's being displayed.
670 670
 		 */
671
-		do_action( 'wordpoints_after_module_row', $module_file, $module_data, $status );
671
+		do_action('wordpoints_after_module_row', $module_file, $module_data, $status);
672 672
 
673 673
 		/**
674 674
 		 * After row for a module is displayed in the list table.
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		 *
678 678
 		 * @since 1.1.0
679 679
 		 */
680
-		do_action( "wordpoints_after_module_row_{$module_file}", $module_file, $module_data, $status );
680
+		do_action("wordpoints_after_module_row_{$module_file}", $module_file, $module_data, $status);
681 681
 
682 682
 	} // function single_row()
683 683
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 *
693 693
 	 * @return string[] The action links for this module.
694 694
 	 */
695
-	private function get_module_row_actions( $module_file, $module_data, $is_active ) {
695
+	private function get_module_row_actions($module_file, $module_data, $is_active) {
696 696
 
697 697
 		global $page, $s, $status;
698 698
 
@@ -705,51 +705,51 @@  discard block
 block discarded – undo
705 705
 			'delete'     => '',
706 706
 		);
707 707
 
708
-		$url = self_admin_url( 'admin.php?page=wordpoints_modules&module=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s );
708
+		$url = self_admin_url('admin.php?page=wordpoints_modules&module=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s);
709 709
 
710
-		if ( $this->screen->in_admin( 'network' ) ) {
710
+		if ($this->screen->in_admin('network')) {
711 711
 
712
-			if ( $is_active ) {
712
+			if ($is_active) {
713 713
 
714
-				if ( current_user_can( 'manage_network_wordpoints_modules' ) ) {
714
+				if (current_user_can('manage_network_wordpoints_modules')) {
715 715
 					// translators: Module name.
716
-					$actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>';
716
+					$actions['deactivate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'deactivate', $url), "deactivate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Network deactivate %s', 'wordpoints'), $module_data['name'])) . '">' . esc_html__('Network Deactivate', 'wordpoints') . '</a>';
717 717
 				}
718 718
 
719 719
 			} else {
720 720
 
721
-				if ( current_user_can( 'manage_network_wordpoints_modules' ) ) {
721
+				if (current_user_can('manage_network_wordpoints_modules')) {
722 722
 					// translators: Module name.
723
-					$actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>';
723
+					$actions['activate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'activate', $url), "activate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Network activate %s', 'wordpoints'), $module_data['name'])) . '" class="edit">' . esc_html__('Network Activate', 'wordpoints') . '</a>';
724 724
 				}
725 725
 
726
-				if ( current_user_can( 'delete_wordpoints_modules' ) && ! is_wordpoints_module_active( $module_file ) ) {
726
+				if (current_user_can('delete_wordpoints_modules') && ! is_wordpoints_module_active($module_file)) {
727 727
 					// translators: Module name.
728
-					$actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&amp;checked[]=' . $module_file . '&amp;module_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>';
728
+					$actions['delete'] = '<a href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=delete-selected&amp;checked[]=' . $module_file . '&amp;module_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s), 'bulk-modules') . '" aria-label="' . esc_attr(sprintf(__('Delete %s', 'wordpoints'), $module_data['name'])) . '" class="delete">' . esc_html__('Delete', 'wordpoints') . '</a>';
729 729
 				}
730 730
 			}
731 731
 
732 732
 		} else {
733 733
 
734
-			if ( $is_active ) {
734
+			if ($is_active) {
735 735
 
736 736
 				// translators: Module name.
737
-				$actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>';
737
+				$actions['deactivate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'deactivate', $url), "deactivate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Deactivate %s', 'wordpoints'), $module_data['name'])) . '">' . esc_html__('Deactivate', 'wordpoints') . '</a>';
738 738
 
739 739
 			} else {
740 740
 
741 741
 				// translators: Module name.
742
-				$actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>';
742
+				$actions['activate'] = '<a href="' . wp_nonce_url(add_query_arg('action', 'activate', $url), "activate-module_{$module_file}") . '" aria-label="' . esc_attr(sprintf(__('Activate %s', 'wordpoints'), $module_data['name'])) . '" class="edit">' . esc_html__('Activate', 'wordpoints') . '</a>';
743 743
 
744
-				if ( ! is_multisite() && current_user_can( 'delete_wordpoints_modules' ) ) {
744
+				if ( ! is_multisite() && current_user_can('delete_wordpoints_modules')) {
745 745
 					// translators: Module name.
746
-					$actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&amp;checked[]=' . $module_file . '&amp;module_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>';
746
+					$actions['delete'] = '<a href="' . wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=delete-selected&amp;checked[]=' . $module_file . '&amp;module_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s), 'bulk-modules') . '" aria-label="' . esc_attr(sprintf(__('Delete %s', 'wordpoints'), $module_data['name'])) . '" class="delete">' . esc_html__('Delete', 'wordpoints') . '</a>';
747 747
 				}
748 748
 			}
749 749
 
750 750
 		} // End if ( network admin ) {} else {}.
751 751
 
752
-		$prefix = $this->screen->in_admin( 'network' ) ? 'network_admin_' : '';
752
+		$prefix = $this->screen->in_admin('network') ? 'network_admin_' : '';
753 753
 
754 754
 		/**
755 755
 		 * Filter the module action links.
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 		 * @param array  $module_data The module's info.
772 772
 		 * @param string $context     The status of the modules being displayed.
773 773
 		 */
774
-		$actions = apply_filters( $prefix . 'wordpoints_module_action_links', array_filter( $actions ), $module_file, $module_data, $context );
774
+		$actions = apply_filters($prefix . 'wordpoints_module_action_links', array_filter($actions), $module_file, $module_data, $context);
775 775
 
776 776
 		/**
777 777
 		 * Filter the action links for a specific module.
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 		 *
781 781
 		 * @since 1.1.0
782 782
 		 */
783
-		return apply_filters( $prefix . "wordpoints_module_action_links_{$module_file}", $actions, $module_file, $module_data, $context );
783
+		return apply_filters($prefix . "wordpoints_module_action_links_{$module_file}", $actions, $module_file, $module_data, $context);
784 784
 	}
785 785
 
786 786
 } // class WordPoints_Modules_List_Table
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -579,9 +579,12 @@
 block discarded – undo
579 579
 								<p>
580 580
 									<?php if ( ! empty( $module_data['description'] ) ) : ?>
581 581
 										<?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?>
582
-									<?php else : ?>
582
+									<?php else {
583
+	: ?>
583 584
 										&nbsp;
584
-									<?php endif; ?>
585
+									<?php endif;
586
+}
587
+?>
585 588
 								</p>
586 589
 							</div>
587 590
 							<div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri">
Please login to merge, or discard this patch.