Completed
Push — develop ( 9aa69a...b20875 )
by J.D.
03:27
created
src/components/points/includes/hooks/periodic.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 
86 86
 			if (
87 87
 				! isset( $last_visit[ $points_type ] )
88
-				|| (int) ( $last_visit[ $points_type ] / $instance['period'] ) < (int) ( $now / $instance['period'] )
88
+				|| (int) ( $last_visit[ $points_type ] / $instance[ 'period' ] ) < (int) ( $now / $instance[ 'period' ] )
89 89
 			) {
90 90
 
91 91
 				wordpoints_add_points(
92 92
 					$user_id
93
-					, $instance['points']
93
+					, $instance[ 'points' ]
94 94
 					, $points_type
95 95
 					, 'periodic'
96
-					, array( 'period' => $instance['period'] )
96
+					, array( 'period' => $instance[ 'period' ] )
97 97
 				);
98 98
 
99 99
 				$last_visit[ $points_type ] = $now;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function logs( $text, $points, $points_type, $user_id, $log_type, $meta ) {
135 135
 
136
-		switch ( $meta['period'] ) {
136
+		switch ( $meta[ 'period' ] ) {
137 137
 
138 138
 			case HOUR_IN_SECONDS:
139 139
 				$message = _x( 'Hourly points.', 'points log description', 'wordpoints' );
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function generate_description( $instance = array() ) {
171 171
 
172
-		if ( ! empty( $instance['period'] ) ) {
172
+		if ( ! empty( $instance[ 'period' ] ) ) {
173 173
 
174
-			switch ( $instance['period'] ) {
174
+			switch ( $instance[ 'period' ] ) {
175 175
 
176 176
 				case HOUR_IN_SECONDS:
177 177
 					return __( 'Visiting the site at least once in an hour.', 'wordpoints' );
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$new_instance = array_merge( $this->defaults, $old_instance, $new_instance );
209 209
 
210
-		wordpoints_posint( $new_instance['points'] );
211
-		wordpoints_posint( $new_instance['period'] );
210
+		wordpoints_posint( $new_instance[ 'points' ] );
211
+		wordpoints_posint( $new_instance[ 'period' ] );
212 212
 
213 213
 		return $new_instance;
214 214
 	}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$instance = array_merge( $this->defaults, $instance );
228 228
 
229 229
 		$dropdown_args = array(
230
-			'selected' => $instance['period'],
230
+			'selected' => $instance[ 'period' ],
231 231
 			'id'       => $this->get_field_id( 'period' ),
232 232
 			'name'     => $this->get_field_name( 'period' ),
233 233
 			'class'    => 'widefat wordpoints-append-to-hook-title',
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 	protected function get_periods() {
262 262
 
263 263
 		$periods = array(
264
-			HOUR_IN_SECONDS     => __( 'hourly' , 'wordpoints' ),
265
-			DAY_IN_SECONDS      => __( 'daily'  , 'wordpoints' ),
266
-			WEEK_IN_SECONDS     => __( 'weekly' , 'wordpoints' ),
264
+			HOUR_IN_SECONDS     => __( 'hourly', 'wordpoints' ),
265
+			DAY_IN_SECONDS      => __( 'daily', 'wordpoints' ),
266
+			WEEK_IN_SECONDS     => __( 'weekly', 'wordpoints' ),
267 267
 			30 * DAY_IN_SECONDS => __( 'monthly', 'wordpoints' ),
268 268
 		);
269 269
 
Please login to merge, or discard this patch.
src/admin/classes/list/table/extensions.php 2 patches
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		parent::__construct(
50 50
 			array(
51 51
 				'plural' => 'wordpoints-extensions',
52
-				'screen' => ( isset( $args['screen'] ) ) ? $args['screen'] : null,
52
+				'screen' => ( isset( $args[ 'screen' ] ) ) ? $args[ 'screen' ] : null,
53 53
 			)
54 54
 		);
55 55
 
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 		 */
77 77
 		$module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses );
78 78
 
79
-		if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK.
80
-			$status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK.
79
+		if ( isset( $_REQUEST[ 'module_status' ] ) && in_array( wp_unslash( $_REQUEST[ 'module_status' ] ), $module_statuses, true ) ) { // WPCS: CSRF OK.
80
+			$status = sanitize_key( $_REQUEST[ 'module_status' ] ); // WPCS: CSRF OK.
81 81
 		}
82 82
 
83
-		if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK.
84
-			$_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK.
83
+		if ( isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK.
84
+			$_SERVER[ 'REQUEST_URI' ] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) ); // WPCS: CSRF OK.
85 85
 		}
86 86
 
87 87
 		$page = $this->get_pagenum();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function get_table_classes() {
98 98
 
99
-		return array( 'widefat', $this->_args['plural'], 'modules', 'plugins' );
99
+		return array( 'widefat', $this->_args[ 'plural' ], 'modules', 'plugins' );
100 100
 	}
101 101
 
102 102
 	/**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 		} // End if ( not network admin ).
204 204
 
205
-		foreach ( (array) $modules['all'] as $module_file => $module_data ) {
205
+		foreach ( (array) $modules[ 'all' ] as $module_file => $module_data ) {
206 206
 
207 207
 			// Filter into individual sections.
208 208
 			if (
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 			) {
213 213
 
214 214
 				if ( $show_network_active ) {
215
-					$modules['inactive'][ $module_file ] = $module_data;
215
+					$modules[ 'inactive' ][ $module_file ] = $module_data;
216 216
 				} else {
217
-					unset( $modules['all'][ $module_file ] );
217
+					unset( $modules[ 'all' ][ $module_file ] );
218 218
 				}
219 219
 
220 220
 			} elseif (
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 			) {
224 224
 
225 225
 				if ( $show_network_active ) {
226
-					$modules['active'][ $module_file ] = $module_data;
226
+					$modules[ 'active' ][ $module_file ] = $module_data;
227 227
 				} else {
228
-					unset( $modules['all'][ $module_file ] );
228
+					unset( $modules[ 'all' ][ $module_file ] );
229 229
 				}
230 230
 
231 231
 			} elseif (
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 				)
239 239
 			) {
240 240
 
241
-				$modules['active'][ $module_file ] = $module_data;
241
+				$modules[ 'active' ][ $module_file ] = $module_data;
242 242
 
243 243
 			} else {
244 244
 
245 245
 				// Was the module recently activated?
246 246
 				if ( ! $this->screen->in_admin( 'network' ) && isset( $recently_activated[ $module_file ] ) ) {
247
-					$modules['recently_activated'][ $module_file ] = $module_data;
247
+					$modules[ 'recently_activated' ][ $module_file ] = $module_data;
248 248
 				}
249 249
 
250
-				$modules['inactive'][ $module_file ] = $module_data;
250
+				$modules[ 'inactive' ][ $module_file ] = $module_data;
251 251
 
252 252
 			} // End if ().
253 253
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			 * for modules that have an available update.
257 257
 			 */
258 258
 			if ( $user_can_update && $updates->has_update( $module_file ) ) {
259
-				$modules['upgrade'][ $module_file ] = $modules['all'][ $module_file ];
259
+				$modules[ 'upgrade' ][ $module_file ] = $modules[ 'all' ][ $module_file ];
260 260
 			}
261 261
 
262 262
 		} // End foreach ( modules ).
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		if ( $s ) {
265 265
 
266 266
 			$status            = 'search';
267
-			$modules['search'] = array_filter( $modules['all'], array( $this, 'search_callback' ) );
267
+			$modules[ 'search' ] = array_filter( $modules[ 'all' ], array( $this, 'search_callback' ) );
268 268
 		}
269 269
 
270 270
 		/**
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
 
343 343
 		static $term;
344 344
 
345
-		if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK.
346
-			$term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK.
345
+		if ( is_null( $term ) && isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK.
346
+			$term = sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ); // WPCS: CSRF OK.
347 347
 		}
348 348
 
349 349
 		foreach ( $module_data as $value ) {
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
 		global $modules;
397 397
 
398
-		if ( ! empty( $modules['all'] ) ) {
398
+		if ( ! empty( $modules[ 'all' ] ) ) {
399 399
 			esc_html_e( 'No extensions found.', 'wordpoints' );
400 400
 		} else {
401 401
 			esc_html_e( 'There are not any extensions installed.', 'wordpoints' );
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 		$actions = array();
515 515
 
516 516
 		if ( 'active' !== $status ) {
517
-			$actions['activate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' );
517
+			$actions[ 'activate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' );
518 518
 		}
519 519
 
520 520
 		if ( 'inactive' !== $status && 'recent' !== $status ) {
521
-			$actions['deactivate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' );
521
+			$actions[ 'deactivate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' );
522 522
 		}
523 523
 
524 524
 		if (
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
 			&& current_user_can( 'delete_wordpoints_extensions' )
527 527
 			&& 'active' !== $status
528 528
 		) {
529
-			$actions['delete-selected'] = esc_html__( 'Delete', 'wordpoints' );
529
+			$actions[ 'delete-selected' ] = esc_html__( 'Delete', 'wordpoints' );
530 530
 		}
531 531
 
532 532
 		if (
533 533
 			( ! is_multisite() || is_network_admin() )
534 534
 			&& current_user_can( 'update_wordpoints_extensions' )
535 535
 		) {
536
-			$actions['update-selected'] = esc_html__( 'Update', 'wordpoints' );
536
+			$actions[ 'update-selected' ] = esc_html__( 'Update', 'wordpoints' );
537 537
 		}
538 538
 
539 539
 		/**
@@ -555,11 +555,11 @@  discard block
 block discarded – undo
555 555
 	protected function display_tablenav( $which ) {
556 556
 
557 557
 		// Back-compat for the old nonce name.
558
-		$this->_args['plural'] = 'modules';
558
+		$this->_args[ 'plural' ] = 'modules';
559 559
 
560 560
 		parent::display_tablenav( $which );
561 561
 
562
-		$this->_args['plural'] = 'wordpoints-extensions';
562
+		$this->_args[ 'plural' ] = 'wordpoints-extensions';
563 563
 	}
564 564
 
565 565
 	/**
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 		$class = apply_filters( 'wordpoints_module_list_row_class', $class, $module_file, $module_data, $context );
644 644
 
645 645
 		?>
646
-		<tr id="<?php echo esc_attr( sanitize_title( $module_data['name'] ) ); ?>" class="<?php echo esc_attr( $class ); ?>">
646
+		<tr id="<?php echo esc_attr( sanitize_title( $module_data[ 'name' ] ) ); ?>" class="<?php echo esc_attr( $class ); ?>">
647 647
 			<?php $this->single_row_columns( $item, $class, $is_active ); ?>
648 648
 		</tr>
649 649
 		<?php
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
 		list( $module_file, $module_data ) = $item;
685 685
 
686
-		$module_data['extra']['module_file'] = $module_file;
686
+		$module_data[ 'extra' ][ 'module_file' ] = $module_file;
687 687
 
688 688
 		if ( $this->screen->in_admin( 'network' ) ) {
689 689
 
@@ -696,11 +696,11 @@  discard block
 block discarded – undo
696 696
 			$restricted_network_only   = ( is_multisite() && is_network_only_wordpoints_module( $module_file ) && ! $is_active );
697 697
 		}
698 698
 
699
-		$module_data['extra']['is_active'] = $is_active;
700
-		$module_data['extra']['restricted_network_active'] = $restricted_network_active;
701
-		$module_data['extra']['restricted_network_only']   = $restricted_network_only;
699
+		$module_data[ 'extra' ][ 'is_active' ] = $is_active;
700
+		$module_data[ 'extra' ][ 'restricted_network_active' ] = $restricted_network_active;
701
+		$module_data[ 'extra' ][ 'restricted_network_only' ]   = $restricted_network_only;
702 702
 
703
-		list( $columns, $hidden, , $primary ) = $this->get_column_info();
703
+		list( $columns, $hidden,, $primary ) = $this->get_column_info();
704 704
 
705 705
 		foreach ( $columns as $column_name => $column_display_name ) {
706 706
 
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	protected function column_cb( $module_data ) {
739 739
 
740
-		$checkbox_id = 'checkbox_' . sanitize_key( $module_data['extra']['module_file'] );
740
+		$checkbox_id = 'checkbox_' . sanitize_key( $module_data[ 'extra' ][ 'module_file' ] );
741 741
 
742 742
 		?>
743 743
 		<th scope="row" class="check-column">
744
-			<?php if ( ! $module_data['extra']['restricted_network_active'] && ! $module_data['extra']['restricted_network_only'] ) : ?>
744
+			<?php if ( ! $module_data[ 'extra' ][ 'restricted_network_active' ] && ! $module_data[ 'extra' ][ 'restricted_network_only' ] ) : ?>
745 745
 				<label class="screen-reader-text" for="<?php echo esc_attr( $checkbox_id ); ?>">
746 746
 					<?php
747 747
 
@@ -749,13 +749,13 @@  discard block
 block discarded – undo
749 749
 						sprintf(
750 750
 							// translators: Extension name.
751 751
 							__( 'Select %s', 'wordpoints' )
752
-							, $module_data['name']
752
+							, $module_data[ 'name' ]
753 753
 						)
754 754
 					);
755 755
 
756 756
 					?>
757 757
 				</label>
758
-				<input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data['extra']['module_file'] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" />
758
+				<input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data[ 'extra' ][ 'module_file' ] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" />
759 759
 			<?php endif; ?>
760 760
 		</th>
761 761
 		<?php
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
 		?>
776 776
 		<td class="module-title<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>">
777
-			<strong><?php echo esc_html( $module_data['name'] ); ?></strong>
777
+			<strong><?php echo esc_html( $module_data[ 'name' ] ); ?></strong>
778 778
 			<?php if ( $is_primary ) : ?>
779 779
 				<?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); /* WPCS XSS OK. */ ?>
780 780
 			<?php endif; ?>
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 		<td class="column-description desc<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>">
801 801
 			<div class="module-description">
802 802
 				<p>
803
-					<?php if ( ! empty( $module_data['description'] ) ) : ?>
804
-						<?php echo wp_kses( $module_data['description'], 'wordpoints_module_description' ); ?>
803
+					<?php if ( ! empty( $module_data[ 'description' ] ) ) : ?>
804
+						<?php echo wp_kses( $module_data[ 'description' ], 'wordpoints_module_description' ); ?>
805 805
 					<?php else : ?>
806 806
 						&nbsp;
807 807
 					<?php endif; ?>
@@ -812,25 +812,25 @@  discard block
 block discarded – undo
812 812
 
813 813
 				$module_meta = array();
814 814
 
815
-				if ( ! empty( $module_data['version'] ) ) {
815
+				if ( ! empty( $module_data[ 'version' ] ) ) {
816 816
 					// translators: Extension version.
817
-					$module_meta[] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data['version'] );
817
+					$module_meta[ ] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data[ 'version' ] );
818 818
 				}
819 819
 
820
-				if ( ! empty( $module_data['author'] ) ) {
820
+				if ( ! empty( $module_data[ 'author' ] ) ) {
821 821
 
822
-					$author = $module_data['author'];
822
+					$author = $module_data[ 'author' ];
823 823
 
824
-					if ( ! empty( $module_data['author_uri'] ) ) {
825
-						$author = '<a href="' . esc_url( $module_data['author_uri'] ) . '">' . esc_html( $module_data['author'] ) . '</a>';
824
+					if ( ! empty( $module_data[ 'author_uri' ] ) ) {
825
+						$author = '<a href="' . esc_url( $module_data[ 'author_uri' ] ) . '">' . esc_html( $module_data[ 'author' ] ) . '</a>';
826 826
 					}
827 827
 
828 828
 					// translators: Author name.
829
-					$module_meta[] = sprintf( __( 'By %s', 'wordpoints' ), $author );
829
+					$module_meta[ ] = sprintf( __( 'By %s', 'wordpoints' ), $author );
830 830
 				}
831 831
 
832
-				if ( ! empty( $module_data['uri'] ) ) {
833
-					$module_meta[] = '<a href="' . esc_url( $module_data['uri'] ) . '">' . esc_html__( 'Visit extension site', 'wordpoints' ) . '</a>';
832
+				if ( ! empty( $module_data[ 'uri' ] ) ) {
833
+					$module_meta[ ] = '<a href="' . esc_url( $module_data[ 'uri' ] ) . '">' . esc_html__( 'Visit extension site', 'wordpoints' ) . '</a>';
834 834
 				}
835 835
 
836 836
 				/**
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 				 * @param array  $module_data The info about the module.
847 847
 				 * @param string $status      The module status being displayed.
848 848
 				 */
849
-				$module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data['extra']['module_file'], $module_data, $status );
849
+				$module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data[ 'extra' ][ 'module_file' ], $module_data, $status );
850 850
 
851 851
 				echo wp_kses( implode( ' | ', $module_meta ), 'data' );
852 852
 
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 			 * @param string $module_file The main file of the current module.
884 884
 			 * @param array  $module_data The module's info.
885 885
 			 */
886
-			do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data['module_file'], $module_data );
886
+			do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data[ 'module_file' ], $module_data );
887 887
 			?>
888 888
 			<?php if ( $is_primary ) : ?>
889 889
 				<?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); /* WPCS XSS OK. */ ?>
@@ -912,8 +912,8 @@  discard block
 block discarded – undo
912 912
 
913 913
 		$context = $status;
914 914
 
915
-		$module_file = $module_data['extra']['module_file'];
916
-		$args        = $module_data['extra'];
915
+		$module_file = $module_data[ 'extra' ][ 'module_file' ];
916
+		$args        = $module_data[ 'extra' ];
917 917
 
918 918
 		// Pre-order.
919 919
 		$actions = array(
@@ -926,49 +926,49 @@  discard block
 block discarded – undo
926 926
 
927 927
 		if ( $this->screen->in_admin( 'network' ) ) {
928 928
 
929
-			if ( $args['is_active'] ) {
929
+			if ( $args[ 'is_active' ] ) {
930 930
 
931 931
 				if ( current_user_can( 'manage_network_wordpoints_extensions' ) ) {
932 932
 					// translators: Extension name.
933
-					$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>';
933
+					$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>';
934 934
 				}
935 935
 
936 936
 			} else {
937 937
 
938 938
 				if ( current_user_can( 'manage_network_wordpoints_extensions' ) ) {
939 939
 					// translators: Extension name.
940
-					$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>';
940
+					$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>';
941 941
 				}
942 942
 
943 943
 				if ( current_user_can( 'delete_wordpoints_extensions' ) && ! is_wordpoints_module_active( $module_file ) ) {
944 944
 					// translators: Extension name.
945
-					$actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&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>';
945
+					$actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&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>';
946 946
 				}
947 947
 			}
948 948
 
949 949
 		} else {
950 950
 
951
-			if ( $args['restricted_network_active'] ) {
951
+			if ( $args[ 'restricted_network_active' ] ) {
952 952
 
953 953
 				$actions = array( 'network_active' => __( 'Network Active', 'wordpoints' ) );
954 954
 
955
-			} elseif ( $args['restricted_network_only'] ) {
955
+			} elseif ( $args[ 'restricted_network_only' ] ) {
956 956
 
957 957
 				$actions = array( 'network_only' => __( 'Network Only', 'wordpoints' ) );
958 958
 
959
-			} elseif ( $args['is_active'] ) {
959
+			} elseif ( $args[ 'is_active' ] ) {
960 960
 
961 961
 				// translators: Extension name.
962
-				$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>';
962
+				$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>';
963 963
 
964 964
 			} else {
965 965
 
966 966
 				// translators: Extension name.
967
-				$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>';
967
+				$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>';
968 968
 
969 969
 				if ( ! is_multisite() && current_user_can( 'delete_wordpoints_extensions' ) ) {
970 970
 					// translators: Extension name.
971
-					$actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&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>';
971
+					$actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&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>';
972 972
 				}
973 973
 			}
974 974
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,11 +76,13 @@  discard block
 block discarded – undo
76 76
 		 */
77 77
 		$module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses );
78 78
 
79
-		if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK.
79
+		if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) {
80
+// WPCS: CSRF OK.
80 81
 			$status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK.
81 82
 		}
82 83
 
83
-		if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK.
84
+		if ( isset( $_REQUEST['s'] ) ) {
85
+// WPCS: CSRF OK.
84 86
 			$_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK.
85 87
 		}
86 88
 
@@ -342,7 +344,8 @@  discard block
 block discarded – undo
342 344
 
343 345
 		static $term;
344 346
 
345
-		if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK.
347
+		if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) {
348
+// WPCS: CSRF OK.
346 349
 			$term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK.
347 350
 		}
348 351
 
@@ -802,9 +805,12 @@  discard block
 block discarded – undo
802 805
 				<p>
803 806
 					<?php if ( ! empty( $module_data['description'] ) ) : ?>
804 807
 						<?php echo wp_kses( $module_data['description'], 'wordpoints_module_description' ); ?>
805
-					<?php else : ?>
808
+					<?php else {
809
+	: ?>
806 810
 						&nbsp;
807
-					<?php endif; ?>
811
+					<?php endif;
812
+}
813
+?>
808 814
 				</p>
809 815
 			</div>
810 816
 			<div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri">
Please login to merge, or discard this patch.
src/includes/modules.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 	$module_data = wordpoints_get_module_data( wordpoints_extensions_dir() . '/' . $module );
90 90
 
91
-	return $module_data['network'];
91
+	return $module_data[ 'network' ];
92 92
 }
93 93
 
94 94
 /**
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	if (
210 210
 		get_site_option( 'wordpoints_legacy_extensions_dir' )
211 211
 		|| (
212
-			isset( $wordpoints_data['version'] )
213
-			&& version_compare( $wordpoints_data['version'], '2.4.0-alpha-3', '<' )
212
+			isset( $wordpoints_data[ 'version' ] )
213
+			&& version_compare( $wordpoints_data[ 'version' ], '2.4.0-alpha-3', '<' )
214 214
 		)
215 215
 	) {
216 216
 		$path = str_replace(
@@ -430,36 +430,36 @@  discard block
 block discarded – undo
430 430
 
431 431
 	$module_data = WordPoints_Modules::get_data( $module_file );
432 432
 
433
-	if ( $module_data && wp_normalize_path( $module_file ) === $module_data['raw_file'] ) {
434
-		unset( $module_data['raw'], $module_data['raw_file'] );
433
+	if ( $module_data && wp_normalize_path( $module_file ) === $module_data[ 'raw_file' ] ) {
434
+		unset( $module_data[ 'raw' ], $module_data[ 'raw_file' ] );
435 435
 	} else {
436 436
 		$module_data = get_file_data( $module_file, $default_headers, 'wordpoints_module' );
437 437
 	}
438 438
 
439
-	if ( ! empty( $module_data['update_api'] ) ) {
439
+	if ( ! empty( $module_data[ 'update_api' ] ) ) {
440 440
 		_deprecated_argument( __FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Server".' );
441 441
 	}
442 442
 
443
-	if ( ! empty( $module_data['channel'] ) ) {
443
+	if ( ! empty( $module_data[ 'channel' ] ) ) {
444 444
 		_deprecated_argument( __FUNCTION__, '2.4.0', 'The "Channel" extension header has been deprecated in favor of "Server".' );
445
-		$module_data['server'] = $module_data['channel'];
445
+		$module_data[ 'server' ] = $module_data[ 'channel' ];
446 446
 	}
447 447
 
448
-	if ( ! empty( $module_data['module_name'] ) ) {
448
+	if ( ! empty( $module_data[ 'module_name' ] ) ) {
449 449
 		_deprecated_argument( __FUNCTION__, '2.4.0', 'The "Module Name" extension header has been deprecated in favor of "Extension Name".' );
450
-		$module_data['name'] = $module_data['module_name'];
450
+		$module_data[ 'name' ] = $module_data[ 'module_name' ];
451 451
 	}
452 452
 
453
-	unset( $module_data['module_name'] );
453
+	unset( $module_data[ 'module_name' ] );
454 454
 
455
-	if ( ! empty( $module_data['module_uri'] ) ) {
455
+	if ( ! empty( $module_data[ 'module_uri' ] ) ) {
456 456
 		_deprecated_argument( __FUNCTION__, '2.4.0', 'The "Module URI" extension header has been deprecated in favor of "Extension URI".' );
457
-		$module_data['uri'] = $module_data['module_uri'];
457
+		$module_data[ 'uri' ] = $module_data[ 'module_uri' ];
458 458
 	} else {
459
-		$module_data['module_uri'] = $module_data['uri'];
459
+		$module_data[ 'module_uri' ] = $module_data[ 'uri' ];
460 460
 	}
461 461
 
462
-	$module_data['network'] = ( 'true' === strtolower( $module_data['network'] ) );
462
+	$module_data[ 'network' ] = ( 'true' === strtolower( $module_data[ 'network' ] ) );
463 463
 
464 464
 	/**
465 465
 	 * Filters the header data for an extension.
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		// Translate fields
480 480
 		if ( $translate ) {
481 481
 
482
-			$textdomain = $module_data['text_domain'];
482
+			$textdomain = $module_data[ 'text_domain' ];
483 483
 
484 484
 			if ( $textdomain ) {
485 485
 
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
 
488 488
 					$domain_path = dirname( $module_file );
489 489
 
490
-					if ( $module_data['domain_path'] ) {
491
-						$domain_path .= $module_data['domain_path'];
490
+					if ( $module_data[ 'domain_path' ] ) {
491
+						$domain_path .= $module_data[ 'domain_path' ];
492 492
 					}
493 493
 
494 494
 					wordpoints_load_module_textdomain( $textdomain, $domain_path );
@@ -511,49 +511,49 @@  discard block
 block discarded – undo
511 511
 		);
512 512
 
513 513
 		$allowed_tags      = $allowed_tags_in_links;
514
-		$allowed_tags['a'] = array( 'href' => true, 'title' => true );
514
+		$allowed_tags[ 'a' ] = array( 'href' => true, 'title' => true );
515 515
 
516 516
 		// Name and author ar marked up inside <a> tags. Don't allow these.
517
-		$module_data['name']   = wp_kses( $module_data['name']  , $allowed_tags_in_links );
518
-		$module_data['author'] = wp_kses( $module_data['author'], $allowed_tags_in_links );
517
+		$module_data[ 'name' ]   = wp_kses( $module_data[ 'name' ], $allowed_tags_in_links );
518
+		$module_data[ 'author' ] = wp_kses( $module_data[ 'author' ], $allowed_tags_in_links );
519 519
 
520
-		$module_data['description'] = wp_kses( $module_data['description'], $allowed_tags );
521
-		$module_data['version']     = wp_kses( $module_data['version']    , $allowed_tags );
520
+		$module_data[ 'description' ] = wp_kses( $module_data[ 'description' ], $allowed_tags );
521
+		$module_data[ 'version' ]     = wp_kses( $module_data[ 'version' ], $allowed_tags );
522 522
 
523
-		$module_data['uri']        = esc_url( $module_data['uri'] );
524
-		$module_data['module_uri'] = esc_url( $module_data['module_uri'] );
525
-		$module_data['author_uri'] = esc_url( $module_data['author_uri'] );
523
+		$module_data[ 'uri' ]        = esc_url( $module_data[ 'uri' ] );
524
+		$module_data[ 'module_uri' ] = esc_url( $module_data[ 'module_uri' ] );
525
+		$module_data[ 'author_uri' ] = esc_url( $module_data[ 'author_uri' ] );
526 526
 
527
-		$module_data['title']       = $module_data['name'];
528
-		$module_data['author_name'] = $module_data['author'];
527
+		$module_data[ 'title' ]       = $module_data[ 'name' ];
528
+		$module_data[ 'author_name' ] = $module_data[ 'author' ];
529 529
 
530 530
 		// Apply markup.
531 531
 		if ( $markup ) {
532 532
 
533
-			if ( $module_data['uri'] && $module_data['name'] ) {
534
-				$module_data['title'] = '<a href="' . $module_data['uri']
535
-					. '">' . $module_data['name'] . '</a>';
533
+			if ( $module_data[ 'uri' ] && $module_data[ 'name' ] ) {
534
+				$module_data[ 'title' ] = '<a href="' . $module_data[ 'uri' ]
535
+					. '">' . $module_data[ 'name' ] . '</a>';
536 536
 			}
537 537
 
538
-			if ( $module_data['author_uri'] && $module_data['author'] ) {
539
-				$module_data['author'] = '<a href="' . $module_data['author_uri']
540
-					. '">' . $module_data['author'] . '</a>';
538
+			if ( $module_data[ 'author_uri' ] && $module_data[ 'author' ] ) {
539
+				$module_data[ 'author' ] = '<a href="' . $module_data[ 'author_uri' ]
540
+					. '">' . $module_data[ 'author' ] . '</a>';
541 541
 			}
542 542
 
543
-			$module_data['description'] = wptexturize( $module_data['description'] );
543
+			$module_data[ 'description' ] = wptexturize( $module_data[ 'description' ] );
544 544
 
545
-			if ( $module_data['author'] ) {
546
-				$module_data['description'] .= ' <cite>'
545
+			if ( $module_data[ 'author' ] ) {
546
+				$module_data[ 'description' ] .= ' <cite>'
547 547
 					// translators: Author name.
548
-					. sprintf( __( 'By %s.', 'wordpoints' ), $module_data['author'] )
548
+					. sprintf( __( 'By %s.', 'wordpoints' ), $module_data[ 'author' ] )
549 549
 					. '</cite>';
550 550
 			}
551 551
 		}
552 552
 
553 553
 	} else {
554 554
 
555
-		$module_data['title']       = $module_data['name'];
556
-		$module_data['author_name'] = $module_data['author'];
555
+		$module_data[ 'title' ]       = $module_data[ 'name' ];
556
+		$module_data[ 'author_name' ] = $module_data[ 'author' ];
557 557
 
558 558
 	} // End if ( $markup || $translate ) else.
559 559
 
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 
575 575
 	$server = false;
576 576
 
577
-	if ( isset( $extension['server'] ) ) {
578
-		$server = $extension['server'];
577
+	if ( isset( $extension[ 'server' ] ) ) {
578
+		$server = $extension[ 'server' ];
579 579
 	}
580 580
 
581 581
 	/**
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 
729 729
 		$module_data = wordpoints_get_module_data( $module_file, $markup, $translate );
730 730
 
731
-		if ( empty( $module_data['name'] ) ) {
731
+		if ( empty( $module_data[ 'name' ] ) ) {
732 732
 			continue;
733 733
 		}
734 734
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
  */
828 828
 function _wordpoints_sort_uname_callback( $a, $b ) {
829 829
 
830
-	return strnatcasecmp( $a['name'], $b['name'] );
830
+	return strnatcasecmp( $a[ 'name' ], $b[ 'name' ] );
831 831
 }
832 832
 
833 833
 /**
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 
952 952
 	} else {
953 953
 
954
-		$current[] = $module;
954
+		$current[ ] = $module;
955 955
 		sort( $current );
956 956
 		update_option( 'wordpoints_active_modules', $current );
957 957
 	}
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	$checked = array();
1118 1118
 
1119 1119
 	foreach ( $modules as $module ) {
1120
-		$checked[] = 'checked[]=' . $module;
1120
+		$checked[ ] = 'checked[]=' . $module;
1121 1121
 	}
1122 1122
 
1123 1123
 	ob_start();
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		$validate = wordpoints_validate_module( $module_file );
1183 1183
 
1184 1184
 		if ( is_wp_error( $validate ) ) {
1185
-			$errors[] = $module_file;
1185
+			$errors[ ] = $module_file;
1186 1186
 			continue;
1187 1187
 		}
1188 1188
 
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 		}
1202 1202
 
1203 1203
 		if ( ! $deleted ) {
1204
-			$errors[] = $module_file;
1204
+			$errors[ ] = $module_file;
1205 1205
 		}
1206 1206
 	}
1207 1207
 
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 		$slug = WordPoints_Modules::get_slug( $module );
1266 1266
 		$data = wordpoints_get_module_data( $module_file, false, false );
1267 1267
 
1268
-		$class = "WordPoints_{$data['namespace']}_Installable";
1268
+		$class = "WordPoints_{$data[ 'namespace' ]}_Installable";
1269 1269
 
1270 1270
 		$uninstaller = new WordPoints_Uninstaller( new $class( $slug ) );
1271 1271
 		$uninstaller->run();
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
  */
1500 1500
 function wordpoints_recheck_for_extension_updates_after_upgrade( $upgrader, $data ) {
1501 1501
 
1502
-	if ( isset( $data['type'] ) && 'translation' === $data['type'] ) {
1502
+	if ( isset( $data[ 'type' ] ) && 'translation' === $data[ 'type' ] ) {
1503 1503
 		return;
1504 1504
 	}
1505 1505
 
@@ -1555,34 +1555,34 @@  discard block
 block discarded – undo
1555 1555
  */
1556 1556
 function wordpoints_extension_update_counts( $update_data ) {
1557 1557
 
1558
-	$update_data['counts']['wordpoints_extensions'] = 0;
1558
+	$update_data[ 'counts' ][ 'wordpoints_extensions' ] = 0;
1559 1559
 
1560 1560
 	if ( current_user_can( 'update_wordpoints_extensions' ) ) {
1561 1561
 		$extension_updates = wordpoints_get_extension_updates()->get_new_versions();
1562 1562
 
1563 1563
 		if ( ! empty( $extension_updates ) ) {
1564
-			$update_data['counts']['wordpoints_extensions'] = count( $extension_updates );
1564
+			$update_data[ 'counts' ][ 'wordpoints_extensions' ] = count( $extension_updates );
1565 1565
 
1566 1566
 			$title = sprintf(
1567 1567
 				// translators: Number of updates.
1568 1568
 				_n(
1569 1569
 					'%d WordPoints Extension Update'
1570 1570
 					, '%d WordPoints Extension Updates'
1571
-					, $update_data['counts']['wordpoints_extensions']
1571
+					, $update_data[ 'counts' ][ 'wordpoints_extensions' ]
1572 1572
 					, 'wordpoints'
1573 1573
 				)
1574
-				, $update_data['counts']['wordpoints_extensions']
1574
+				, $update_data[ 'counts' ][ 'wordpoints_extensions' ]
1575 1575
 			);
1576 1576
 
1577
-			if ( ! empty( $update_data['title'] ) ) {
1578
-				$update_data['title'] .= ', ';
1577
+			if ( ! empty( $update_data[ 'title' ] ) ) {
1578
+				$update_data[ 'title' ] .= ', ';
1579 1579
 			}
1580 1580
 
1581
-			$update_data['title'] .= esc_attr( $title );
1581
+			$update_data[ 'title' ] .= esc_attr( $title );
1582 1582
 		}
1583 1583
 	}
1584 1584
 
1585
-	$update_data['counts']['total'] += $update_data['counts']['wordpoints_extensions'];
1585
+	$update_data[ 'counts' ][ 'total' ] += $update_data[ 'counts' ][ 'wordpoints_extensions' ];
1586 1586
 
1587 1587
 	return $update_data;
1588 1588
 }
@@ -1614,12 +1614,12 @@  discard block
 block discarded – undo
1614 1614
 	);
1615 1615
 
1616 1616
 	if (
1617
-		empty( $data['ID'] )
1618
-		&& ( 'J.D. Grimes' === $data['author'] || 'WordPoints' === $data['author'] )
1619
-		&& isset( $missing_headers[ $data['name'] ] )
1617
+		empty( $data[ 'ID' ] )
1618
+		&& ( 'J.D. Grimes' === $data[ 'author' ] || 'WordPoints' === $data[ 'author' ] )
1619
+		&& isset( $missing_headers[ $data[ 'name' ] ] )
1620 1620
 	) {
1621
-		$data['server'] = 'wordpoints.org';
1622
-		$data['ID']     = $missing_headers[ $data['name'] ];
1621
+		$data[ 'server' ] = 'wordpoints.org';
1622
+		$data[ 'ID' ]     = $missing_headers[ $data[ 'name' ] ];
1623 1623
 	}
1624 1624
 
1625 1625
 	return $data;
Please login to merge, or discard this patch.