Passed
Push — master ( 0de278...836c6f )
by Paul
04:15
created
plugin/Controllers/ListTableController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function approve()
23 23
 	{
24
-		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
25
-		wp_update_post([
24
+		check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
25
+		wp_update_post( [
26 26
 			'ID' => $postId,
27 27
 			'post_status' => 'publish',
28
-		]);
28
+		] );
29 29
 		wp_safe_redirect( wp_get_referer() );
30 30
 		exit;
31 31
 	}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty($value) )continue;
58 58
 			$value = $columns[$key];
59 59
 		}
60
-		if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) {
61
-			unset( $postTypeColumns['review_type'] );
60
+		if( count( glsr( Database::class )->getReviewsMeta( 'type' ) ) < 2 ) {
61
+			unset($postTypeColumns['review_type']);
62 62
 		}
63 63
 		return array_filter( $postTypeColumns, 'strlen' );
64 64
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) {
85 85
 			return $actions;
86 86
 		}
87
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
87
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
88 88
 		$rowActions = [
89 89
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
90 90
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key ),
98 98
 					$key.'-review_'.$post->ID
99 99
 				),
100
-			]);
100
+			] );
101 101
 		}
102 102
 		return $actions;
103 103
 	}
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 	public function filterSortableColumns( array $columns )
110 110
 	{
111 111
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
112
-		unset( $postTypeColumns['cb'] );
112
+		unset($postTypeColumns['cb']);
113 113
 		foreach( $postTypeColumns as $key => $value ) {
114
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
114
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
115 115
 			$columns[$key] = $key;
116 116
 		}
117 117
 		return $columns;
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
131 131
 	{
132
-		if( $this->canModifyTranslation( $domain )) {
132
+		if( $this->canModifyTranslation( $domain ) ) {
133 133
 			$strings = [
134 134
 				'Published' => __( 'Approved', 'site-reviews' ),
135 135
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
136 136
 			];
137 137
 			foreach( $strings as $search => $replace ) {
138 138
 				if( strpos( $single, $search ) === false )continue;
139
-				$translation = $this->getTranslation([
139
+				$translation = $this->getTranslation( [
140 140
 					'number' => $number,
141 141
 					'plural' => str_replace( $search, $replace, $plural ),
142 142
 					'single' => str_replace( $search, $replace, $single ),
143
-				]);
143
+				] );
144 144
 			}
145 145
 		}
146 146
 		return $translation;
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function saveBulkEditFields( $postId )
188 188
 	{
189
-		if( !current_user_can( 'edit_posts' ))return;
190
-		if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo )) {
189
+		if( !current_user_can( 'edit_posts' ) )return;
190
+		if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo ) ) {
191 191
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
192 192
 		}
193 193
 	}
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function setQueryForColumn( WP_Query $query )
200 200
 	{
201
-		if( !$this->hasPermission( $query ))return;
201
+		if( !$this->hasPermission( $query ) )return;
202 202
 		$this->setMetaQuery( $query, [
203 203
 			'rating', 'review_type',
204
-		]);
204
+		] );
205 205
 		$this->setOrderby( $query );
206 206
 	}
207 207
 
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function unapprove()
213 213
 	{
214
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
215
-		wp_update_post([
214
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
215
+		wp_update_post( [
216 216
 			'ID' => $postId,
217 217
 			'post_status' => 'pending',
218
-		]);
218
+		] );
219 219
 		wp_safe_redirect( wp_get_referer() );
220 220
 		exit;
221 221
 	}
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			'single' => '',
245 245
 			'text' => '',
246 246
 		];
247
-		$args = (object) wp_parse_args( $args, $defaults );
247
+		$args = (object)wp_parse_args( $args, $defaults );
248 248
 		$translations = get_translations_for_domain( Application::ID );
249 249
 		return $args->text
250 250
 			? $translations->translate( $args->text )
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
270 270
 	{
271 271
 		foreach( $metaKeys as $key ) {
272
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
272
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
273 273
 			$metaQuery = (array)$query->get( 'meta_query' );
274 274
 			$metaQuery[] = [
275 275
 				'key' => $key,
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	{
287 287
 		$orderby = $query->get( 'orderby' );
288 288
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
289
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
290
-		if( in_array( $orderby, array_keys( $columns ))) {
289
+		unset($columns['cb'], $columns['title'], $columns['date']);
290
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
291 291
 			$query->set( 'meta_key', $orderby );
292 292
 			$query->set( 'orderby', 'meta_value' );
293 293
 		}
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty( $value )) {
58
+				continue;
59
+			}
58 60
 			$value = $columns[$key];
59 61
 		}
60 62
 		if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) {
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
112 114
 		unset( $postTypeColumns['cb'] );
113 115
 		foreach( $postTypeColumns as $key => $value ) {
114
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
116
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) {
117
+				continue;
118
+			}
115 119
 			$columns[$key] = $key;
116 120
 		}
117 121
 		return $columns;
@@ -135,7 +139,9 @@  discard block
 block discarded – undo
135 139
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
136 140
 			];
137 141
 			foreach( $strings as $search => $replace ) {
138
-				if( strpos( $single, $search ) === false )continue;
142
+				if( strpos( $single, $search ) === false ) {
143
+					continue;
144
+				}
139 145
 				$translation = $this->getTranslation([
140 146
 					'number' => $number,
141 147
 					'plural' => str_replace( $search, $replace, $plural ),
@@ -186,7 +192,9 @@  discard block
 block discarded – undo
186 192
 	 */
187 193
 	public function saveBulkEditFields( $postId )
188 194
 	{
189
-		if( !current_user_can( 'edit_posts' ))return;
195
+		if( !current_user_can( 'edit_posts' )) {
196
+			return;
197
+		}
190 198
 		if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo )) {
191 199
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
192 200
 		}
@@ -198,7 +206,9 @@  discard block
 block discarded – undo
198 206
 	 */
199 207
 	public function setQueryForColumn( WP_Query $query )
200 208
 	{
201
-		if( !$this->hasPermission( $query ))return;
209
+		if( !$this->hasPermission( $query )) {
210
+			return;
211
+		}
202 212
 		$this->setMetaQuery( $query, [
203 213
 			'rating', 'review_type',
204 214
 		]);
@@ -269,7 +279,9 @@  discard block
 block discarded – undo
269 279
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
270 280
 	{
271 281
 		foreach( $metaKeys as $key ) {
272
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
282
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
283
+				continue;
284
+			}
273 285
 			$metaQuery = (array)$query->get( 'meta_query' );
274 286
 			$metaQuery[] = [
275 287
 				'key' => $key,
Please login to merge, or discard this patch.
plugin/Modules/ListTable/Columns.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	public function renderFilters( $postType )
16 16
 	{
17 17
 		if( $postType !== Application::POST_TYPE )return;
18
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
18
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
19 19
 			$status = 'publish';
20 20
 		}
21 21
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	protected function buildColumnAssignedTo( $postId )
46 46
 	{
47 47
 		$post = get_post( glsr( Database::class )->getReviewMeta( $postId )->assigned_to );
48
-		if( !( $post instanceof WP_Post ) || $post->post_status != 'publish' ) {
48
+		if( !($post instanceof WP_Post) || $post->post_status != 'publish' ) {
49 49
 			return '&mdash;';
50 50
 		}
51 51
 		return glsr( Builder::class )->a( get_the_title( $post->ID ), [
52 52
 			'href' => (string)get_the_permalink( $post->ID ),
53
-		]);
53
+		] );
54 54
 	}
55 55
 
56 56
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		return glsr( Html::class )->buildPartial( 'star-rating', [
72 72
 			'rating' => glsr( Database::class )->getReviewMeta( $postId )->rating,
73
-		]);
73
+		] );
74 74
 	}
75 75
 
76 76
 	/**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 		$pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned
83 83
 			? ' pinned'
84 84
 			: '';
85
-		return glsr( Builder::class )->i([
85
+		return glsr( Builder::class )->i( [
86 86
 			'class' => trim( 'dashicons dashicons-sticky '.$pinned ),
87 87
 			'data-id' => $postId,
88
-		]);
88
+		] );
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	protected function buildColumnType( $postId )
96 96
 	{
97 97
 		$reviewMeta = glsr( Database::class )->getReviewMeta( $postId );
98
-		return isset( glsr()->reviewTypes[$reviewMeta->review_type] )
98
+		return isset(glsr()->reviewTypes[$reviewMeta->review_type])
99 99
 			? glsr()->reviewTypes[$reviewMeta->review_type]
100 100
 			: $reviewMeta->review_type;
101 101
 	}
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function renderFilterRatings( $ratings )
108 108
 	{
109
-		if( empty( $ratings )
109
+		if( empty($ratings)
110 110
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
111 111
 		)return;
112
-		$ratings = array_flip( array_reverse( $ratings ));
112
+		$ratings = array_flip( array_reverse( $ratings ) );
113 113
 		array_walk( $ratings, function( &$value, $key ) {
114 114
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
115 115
 			$value = sprintf( $label, $key );
116 116
 		});
117 117
 		$ratings = [__( 'All ratings', 'site-reviews' )] + $ratings;
118
-		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ));
118
+		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ) );
119 119
 		glsr( Html::class )->renderPartial( 'filterby', [
120 120
 			'name' => 'rating',
121 121
 			'values' => $ratings,
122
-		]);
122
+		] );
123 123
 	}
124 124
 
125 125
 	/**
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	{
131 131
 		if( count( glsr()->reviewTypes ) < 2 )return;
132 132
 		$reviewTypes = ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes;
133
-		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ));
133
+		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ) );
134 134
 		glsr( Html::class )->renderPartial( 'filterby', [
135 135
 			'name' => 'review_type',
136 136
 			'options' => $reviewTypes,
137
-		]);
137
+		] );
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public function renderFilters( $postType )
16 16
 	{
17
-		if( $postType !== Application::POST_TYPE )return;
17
+		if( $postType !== Application::POST_TYPE ) {
18
+			return;
19
+		}
18 20
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
19 21
 			$status = 'publish';
20 22
 		}
@@ -31,7 +33,9 @@  discard block
 block discarded – undo
31 33
 	 */
32 34
 	public function renderValues( $column, $postId )
33 35
 	{
34
-		if( glsr_current_screen()->id != Application::POST_TYPE )return;
36
+		if( glsr_current_screen()->id != Application::POST_TYPE ) {
37
+			return;
38
+		}
35 39
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
36 40
 		echo method_exists( $this, $method )
37 41
 			? call_user_func( [$this, $method], $postId )
@@ -108,7 +112,9 @@  discard block
 block discarded – undo
108 112
 	{
109 113
 		if( empty( $ratings )
110 114
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
111
-		)return;
115
+		) {
116
+			return;
117
+		}
112 118
 		$ratings = array_flip( array_reverse( $ratings ));
113 119
 		array_walk( $ratings, function( &$value, $key ) {
114 120
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -128,7 +134,9 @@  discard block
 block discarded – undo
128 134
 	 */
129 135
 	protected function renderFilterTypes( $types )
130 136
 	{
131
-		if( count( glsr()->reviewTypes ) < 2 )return;
137
+		if( count( glsr()->reviewTypes ) < 2 ) {
138
+			return;
139
+		}
132 140
 		$reviewTypes = ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes;
133 141
 		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ));
134 142
 		glsr( Html::class )->renderPartial( 'filterby', [
Please login to merge, or discard this patch.