Passed
Push — master ( 3384db...78f140 )
by Paul
04:58
created
autoload.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,9 +15,13 @@
 block discarded – undo
15 15
 	];
16 16
 	foreach( $namespaces as $prefix => $base_dir ) {
17 17
 		$len = strlen( $prefix );
18
-		if( strncmp( $prefix, $className, $len ) !== 0 )continue;
18
+		if( strncmp( $prefix, $className, $len ) !== 0 ) {
19
+			continue;
20
+		}
19 21
 		$file = $base_dir.str_replace( '\\', '/', substr( $className, $len )).'.php';
20
-		if( !file_exists( $file ))continue;
22
+		if( !file_exists( $file )) {
23
+			continue;
24
+		}
21 25
 		require $file;
22 26
 		break;
23 27
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 defined( 'WPINC' ) || die;
4 4
 
5
-require_once( ABSPATH.WPINC.'/class-phpass.php' );
5
+require_once(ABSPATH.WPINC.'/class-phpass.php');
6 6
 
7 7
 spl_autoload_register( function( $className ) {
8 8
 	$namespaces = [
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	foreach( $namespaces as $prefix => $base_dir ) {
17 17
 		$len = strlen( $prefix );
18 18
 		if( strncmp( $prefix, $className, $len ) !== 0 )continue;
19
-		$file = $base_dir.str_replace( '\\', '/', substr( $className, $len )).'.php';
20
-		if( !file_exists( $file ))continue;
19
+		$file = $base_dir.str_replace( '\\', '/', substr( $className, $len ) ).'.php';
20
+		if( !file_exists( $file ) )continue;
21 21
 		require $file;
22 22
 		break;
23 23
 	}
Please login to merge, or discard this patch.
site-reviews.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 if( !class_exists( 'GL_Plugin_Check_v1' )) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return;
24
+if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ))) {
25
+	return;
26
+}
25 27
 
26 28
 require_once __DIR__.'/autoload.php';
27 29
 require_once __DIR__.'/helpers.php';
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v1' )) {
21
+if( !class_exists( 'GL_Plugin_Check_v1' ) ) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return;
24
+if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ) ) )return;
25 25
 
26 26
 require_once __DIR__.'/autoload.php';
27 27
 require_once __DIR__.'/helpers.php';
28 28
 
29 29
 $app = new GeminiLabs\SiteReviews\Application;
30 30
 $app->make( 'Provider' )->register( $app );
31
-register_activation_hook( __FILE__, array( $app, 'activate' ));
32
-register_deactivation_hook( __FILE__, array( $app, 'deactivate' ));
31
+register_activation_hook( __FILE__, array( $app, 'activate' ) );
32
+register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
33 33
 $app->init();
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAdminAssets.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 			[],
28 28
 			glsr()->version
29 29
 		);
30
-		if( !$this->isCurrentScreen() )return;
30
+		if( !$this->isCurrentScreen() ) {
31
+			return;
32
+		}
31 33
 		wp_enqueue_script(
32 34
 			Application::ID,
33 35
 			glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ),
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 	{
87 89
 		$variables = [];
88 90
 		foreach( glsr()->mceShortcodes as $tag => $args ) {
89
-			if( empty( $args['required'] ))continue;
91
+			if( empty( $args['required'] )) {
92
+				continue;
93
+			}
90 94
 			$variables[$tag] = $args['required'];
91 95
 		}
92 96
 		return $variables;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		$dependencies = []; //glsr( Html::class )->getDependencies();
63 63
 		$dependencies = array_merge( $dependencies, [
64 64
 			'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
65
-		]);
65
+		] );
66 66
 		return $dependencies;
67 67
 	}
68 68
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	protected function isCurrentScreen()
73 73
 	{
74 74
 		$screen = glsr_current_screen();
75
-		return $screen && ( $screen->post_type == Application::POST_TYPE
75
+		return $screen && ($screen->post_type == Application::POST_TYPE
76 76
 			|| $screen->base == 'post'
77 77
 			|| $screen->id == 'dashboard'
78 78
 			|| $screen->id == 'widgets'
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	{
87 87
 		$variables = [];
88 88
 		foreach( glsr()->mceShortcodes as $tag => $args ) {
89
-			if( empty( $args['required'] ))continue;
89
+			if( empty($args['required']) )continue;
90 90
 			$variables[$tag] = $args['required'];
91 91
 		}
92 92
 		return $variables;
Please login to merge, or discard this patch.
plugin/Handlers/RegisterPostType.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
 	 */
12 12
 	public function handle( Command $command )
13 13
 	{
14
-		if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return;
14
+		if( in_array( $command->postType, get_post_types( ['_builtin' => true] ))) {
15
+			return;
16
+		}
15 17
 		register_post_type( $command->postType, $command->args );
16 18
 		glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [
17 19
 			$command->postType => $command->columns,
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 	 */
12 12
 	public function handle( Command $command )
13 13
 	{
14
-		if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return;
14
+		if( in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) )return;
15 15
 		register_post_type( $command->postType, $command->args );
16 16
 		glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [
17 17
 			$command->postType => $command->columns,
18
-		]);
18
+		] );
19 19
 	}
20 20
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterTaxonomy.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@
 block discarded – undo
57 57
 		global $wp_query;
58 58
 		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )
59 59
 			|| apply_filters( 'site-reviews/disable/filter/category', false )
60
-		)return;
60
+		) {
61
+			return;
62
+		}
61 63
 		printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' ));
62 64
 		$selected = isset( $wp_query->query[Application::TAXONOMY] )
63 65
 			? $wp_query->query[Application::TAXONOMY]
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 		register_taxonomy_for_object_type( Application::TAXONOMY, Application::POST_TYPE );
17 17
 
18 18
 		add_action( Application::TAXONOMY.'_term_edit_form_top', [$this, 'disableParents'] );
19
-		add_action( Application::TAXONOMY.'_term_new_form_tag',  [$this, 'disableParents'] );
20
-		add_action( Application::TAXONOMY.'_add_form_fields',    [$this, 'enableParents'] );
21
-		add_action( Application::TAXONOMY.'_edit_form',          [$this, 'enableParents'] );
22
-		add_action( 'restrict_manage_posts',                     [$this, 'renderFilterTaxonomy'], 9 );
19
+		add_action( Application::TAXONOMY.'_term_new_form_tag', [$this, 'disableParents'] );
20
+		add_action( Application::TAXONOMY.'_add_form_fields', [$this, 'enableParents'] );
21
+		add_action( Application::TAXONOMY.'_edit_form', [$this, 'enableParents'] );
22
+		add_action( 'restrict_manage_posts', [$this, 'renderFilterTaxonomy'], 9 );
23 23
 	}
24 24
 
25 25
 	/**
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )
59 59
 			|| apply_filters( 'site-reviews/disable/filter/category', false )
60 60
 		)return;
61
-		printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' ));
62
-		$selected = isset( $wp_query->query[Application::TAXONOMY] )
61
+		printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' ) );
62
+		$selected = isset($wp_query->query[Application::TAXONOMY])
63 63
 			? $wp_query->query[Application::TAXONOMY]
64 64
 			: '';
65 65
 		$taxonomy = get_taxonomy( Application::TAXONOMY );
66 66
 		$showOptionAll = $taxonomy
67
-			? ucfirst( strtolower( $taxonomy->labels->all_items ))
67
+			? ucfirst( strtolower( $taxonomy->labels->all_items ) )
68 68
 			: '';
69
-		wp_dropdown_categories([
69
+		wp_dropdown_categories( [
70 70
 			'depth' => 3,
71 71
 			'hide_empty' => true,
72 72
 			'hide_if_empty' => true,
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
 			'show_option_all' => $showOptionAll,
79 79
 			'taxonomy' => Application::TAXONOMY,
80 80
 			'value_field' => 'slug',
81
-		]);
81
+		] );
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterPointers.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 		wp_localize_script( Application::ID, 'site_reviews_pointers', [
18 18
 			'pointers' => $pointers,
19 19
 		]);
20
-		if( empty( $pointers ))return;
20
+		if( empty( $pointers )) {
21
+			return;
22
+		}
21 23
 		wp_enqueue_style( 'wp-pointer' );
22 24
 		wp_enqueue_script( 'wp-pointer' );
23 25
 	}
@@ -31,8 +33,12 @@  discard block
 block discarded – undo
31 33
 		$dismissedPointers = explode( ',', (string)$dismissedPointers );
32 34
 		$generatedPointers = [];
33 35
 		foreach( $pointers as $pointer ) {
34
-			if( $pointer['screen'] != glsr_current_screen()->id )continue;
35
-			if( in_array( $pointer['id'], $dismissedPointers ))continue;
36
+			if( $pointer['screen'] != glsr_current_screen()->id ) {
37
+				continue;
38
+			}
39
+			if( in_array( $pointer['id'], $dismissedPointers )) {
40
+				continue;
41
+			}
36 42
 			$generatedPointers[] = $this->generatePointer( $pointer );
37 43
 		}
38 44
 		return $generatedPointers;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$pointers = $this->generatePointers( $command->pointers );
17 17
 		wp_localize_script( Application::ID, 'site_reviews_pointers', [
18 18
 			'pointers' => $pointers,
19
-		]);
20
-		if( empty( $pointers ))return;
19
+		] );
20
+		if( empty($pointers) )return;
21 21
 		wp_enqueue_style( 'wp-pointer' );
22 22
 		wp_enqueue_script( 'wp-pointer' );
23 23
 	}
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		$generatedPointers = [];
33 33
 		foreach( $pointers as $pointer ) {
34 34
 			if( $pointer['screen'] != glsr_current_screen()->id )continue;
35
-			if( in_array( $pointer['id'], $dismissedPointers ))continue;
35
+			if( in_array( $pointer['id'], $dismissedPointers ) )continue;
36 36
 			$generatedPointers[] = $this->generatePointer( $pointer );
37 37
 		}
38 38
 		return $generatedPointers;
Please login to merge, or discard this patch.
plugin/Controllers/MainController.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function registerPostType()
21 21
 	{
22
-		if( !glsr()->hasPermission() )return;
22
+		if( !glsr()->hasPermission() ) {
23
+			return;
24
+		}
23 25
 		$command = new RegisterPostType([
24 26
 			'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE],
25 27
 			'columns' => [
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	public function registerPostType()
21 21
 	{
22 22
 		if( !glsr()->hasPermission() )return;
23
-		$command = new RegisterPostType([
23
+		$command = new RegisterPostType( [
24 24
 			'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE],
25 25
 			'columns' => [
26 26
 				'title' => '',
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			'plural' => __( 'Reviews', 'site-reviews' ),
39 39
 			'post_type' => Application::POST_TYPE,
40 40
 			'single' => __( 'Review', 'site-reviews' ),
41
-		]);
41
+		] );
42 42
 		$this->execute( $command );
43 43
 	}
44 44
 
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function registerShortcodes()
50 50
 	{
51
-		$command = new RegisterShortcodes([
51
+		$command = new RegisterShortcodes( [
52 52
 			'site_reviews',
53 53
 			'site_reviews_form',
54 54
 			'site_reviews_summary',
55
-		]);
55
+		] );
56 56
 		$this->execute( $command );
57 57
 	}
58 58
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function registerTaxonomy()
64 64
 	{
65
-		$command = new RegisterTaxonomy([
65
+		$command = new RegisterTaxonomy( [
66 66
 			'hierarchical' => true,
67 67
 			'meta_box_cb' => 'glsr_categories_meta_box',
68 68
 			'public' => false,
69 69
 			'show_admin_column' => true,
70 70
 			'show_ui' => true,
71
-		]);
71
+		] );
72 72
 		$this->execute( $command );
73 73
 	}
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function registerWidgets()
80 80
 	{
81
-		$command = new RegisterWidgets([
81
+		$command = new RegisterWidgets( [
82 82
 			'site-reviews' => [
83 83
 				'class' => 'glsr-widget glsr-widget-site-reviews',
84 84
 				'description' => __( 'Your site’s most recent reviews.', 'site-reviews' ),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 				'description' => __( 'A summary of your site’s reviews.', 'site-reviews' ),
95 95
 				'title' => __( 'Summary of Reviews', 'site-reviews' ),
96 96
 			],
97
-		]);
97
+		] );
98 98
 		$this->execute( $command );
99 99
 	}
100 100
 
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 2 patches
Braces   +30 added lines, -10 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 ),
@@ -166,7 +172,9 @@  discard block
 block discarded – undo
166 172
 	 */
167 173
 	public function renderColumnFilters( $post_type )
168 174
 	{
169
-		if( $post_type !== Application::POST_TYPE )return;
175
+		if( $post_type !== Application::POST_TYPE ) {
176
+			return;
177
+		}
170 178
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
171 179
 			$status = 'publish';
172 180
 		}
@@ -183,7 +191,9 @@  discard block
 block discarded – undo
183 191
 	 */
184 192
 	public function renderColumnValues( $column, $postId )
185 193
 	{
186
-		if( glsr_current_screen()->id != Application::POST_TYPE )return;
194
+		if( glsr_current_screen()->id != Application::POST_TYPE ) {
195
+			return;
196
+		}
187 197
 		global $wp_version;
188 198
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
189 199
 		echo method_exists( $this, $method )
@@ -198,7 +208,9 @@  discard block
 block discarded – undo
198 208
 	 */
199 209
 	public function saveBulkEditFields( $postId )
200 210
 	{
201
-		if( !current_user_can( 'edit_posts' ))return;
211
+		if( !current_user_can( 'edit_posts' )) {
212
+			return;
213
+		}
202 214
 		if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo )) {
203 215
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
204 216
 		}
@@ -210,7 +222,9 @@  discard block
 block discarded – undo
210 222
 	 */
211 223
 	public function setQueryForColumn( WP_Query $query )
212 224
 	{
213
-		if( !$this->hasPermission( $query ))return;
225
+		if( !$this->hasPermission( $query )) {
226
+			return;
227
+		}
214 228
 		$this->setMetaQuery( $query, [
215 229
 			'rating', 'review_type',
216 230
 		]);
@@ -345,7 +359,9 @@  discard block
 block discarded – undo
345 359
 	{
346 360
 		if( empty( $ratings )
347 361
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
348
-		)return;
362
+		) {
363
+			return;
364
+		}
349 365
 		$ratings = array_flip( array_reverse( $ratings ));
350 366
 		array_walk( $ratings, function( &$value, $key ) {
351 367
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -368,7 +384,9 @@  discard block
 block discarded – undo
368 384
 		if( count( $types ) < 1
369 385
 			|| ( count( $types ) == 1 && $types[0] == 'local' )
370 386
 			|| apply_filters( 'site-reviews/disable/filter/types', false )
371
-		)return;
387
+		) {
388
+			return;
389
+		}
372 390
 		$reviewTypes = [__( 'All types', 'site-reviews' )];
373 391
 		foreach( $types as $type ) {
374 392
 			$reviewTypes[$type] = glsr( Strings::class )->review_types( $type, ucfirst( $type ));
@@ -386,7 +404,9 @@  discard block
 block discarded – undo
386 404
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
387 405
 	{
388 406
 		foreach( $metaKeys as $key ) {
389
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
407
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
408
+				continue;
409
+			}
390 410
 			$metaQuery = (array)$query->get( 'meta_query' );
391 411
 			$metaQuery[] = [
392 412
 				'key' => $key,
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 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;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	public function renderColumnFilters( $post_type )
168 168
 	{
169 169
 		if( $post_type !== Application::POST_TYPE )return;
170
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
170
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
171 171
 			$status = 'publish';
172 172
 		}
173 173
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function saveBulkEditFields( $postId )
200 200
 	{
201
-		if( !current_user_can( 'edit_posts' ))return;
202
-		if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo )) {
201
+		if( !current_user_can( 'edit_posts' ) )return;
202
+		if( $assignedTo = filter_input( INPUT_GET, 'assigned_to' ) && get_post( $assignedTo ) ) {
203 203
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
204 204
 		}
205 205
 	}
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function setQueryForColumn( WP_Query $query )
212 212
 	{
213
-		if( !$this->hasPermission( $query ))return;
213
+		if( !$this->hasPermission( $query ) )return;
214 214
 		$this->setMetaQuery( $query, [
215 215
 			'rating', 'review_type',
216
-		]);
216
+		] );
217 217
 		$this->setOrderby( $query );
218 218
 	}
219 219
 
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function unapprove()
225 225
 	{
226
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
227
-		wp_update_post([
226
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
227
+		wp_update_post( [
228 228
 			'ID' => $postId,
229 229
 			'post_status' => 'pending',
230
-		]);
230
+		] );
231 231
 		wp_safe_redirect( wp_get_referer() );
232 232
 		exit;
233 233
 	}
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 	protected function buildColumnAssignedTo( $postId )
240 240
 	{
241 241
 		$post = get_post( glsr( Database::class )->getReviewMeta( $postId )->assigned_to );
242
-		if( !( $post instanceof WP_Post ) || $post->post_status != 'publish' ) {
242
+		if( !($post instanceof WP_Post) || $post->post_status != 'publish' ) {
243 243
 			return '&mdash;';
244 244
 		}
245 245
 		return glsr( Builder::class )->a( get_the_title( $post->ID ), [
246 246
 			'href' => (string)get_the_permalink( $post->ID ),
247
-		]);
247
+		] );
248 248
 	}
249 249
 
250 250
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	protected function buildColumnReviewer( $postId )
255 255
 	{
256
-		return glsr( Database::class )->getReviewMeta(  $postId  )->author;
256
+		return glsr( Database::class )->getReviewMeta( $postId )->author;
257 257
 	}
258 258
 
259 259
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	{
265 265
 		return glsr( Html::class )->buildPartial( 'star-rating', [
266 266
 			'rating' => glsr( Database::class )->getReviewMeta( $postId )->rating,
267
-		]);
267
+		] );
268 268
 	}
269 269
 
270 270
 	/**
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 		$pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned
277 277
 			? ' pinned'
278 278
 			: '';
279
-		return glsr( Builder::class )->i([
279
+		return glsr( Builder::class )->i( [
280 280
 			'class' => trim( 'dashicons dashicons-sticky '.$pinned ),
281 281
 			'data-id' => $postId,
282
-		]);
282
+		] );
283 283
 	}
284 284
 
285 285
 	/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	protected function buildColumnType( $postId )
290 290
 	{
291 291
 		$reviewMeta = glsr( Database::class )->getReviewMeta( $postId );
292
-		return isset( glsr()->reviewTypes[$reviewMeta->review_type] )
292
+		return isset(glsr()->reviewTypes[$reviewMeta->review_type])
293 293
 			? glsr()->reviewTypes[$reviewMeta->review_type]
294 294
 			: $reviewMeta->review_type;
295 295
 	}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			'single' => '',
319 319
 			'text' => '',
320 320
 		];
321
-		$args = (object) wp_parse_args( $args, $defaults );
321
+		$args = (object)wp_parse_args( $args, $defaults );
322 322
 		$translations = get_translations_for_domain( Application::ID );
323 323
 		return $args->text
324 324
 			? $translations->translate( $args->text )
@@ -343,20 +343,20 @@  discard block
 block discarded – undo
343 343
 	 */
344 344
 	protected function renderFilterRatings( $ratings )
345 345
 	{
346
-		if( empty( $ratings )
346
+		if( empty($ratings)
347 347
 			|| apply_filters( 'site-reviews/disable/filter/ratings', false )
348 348
 		)return;
349
-		$ratings = array_flip( array_reverse( $ratings ));
349
+		$ratings = array_flip( array_reverse( $ratings ) );
350 350
 		array_walk( $ratings, function( &$value, $key ) {
351 351
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
352 352
 			$value = sprintf( $label, $key );
353 353
 		});
354 354
 		$ratings = [__( 'All ratings', 'site-reviews' )] + $ratings;
355
-		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ));
355
+		printf( '<label class="screen-reader-text" for="rating">%s</label>', __( 'Filter by rating', 'site-reviews' ) );
356 356
 		glsr( Html::class )->renderPartial( 'filterby', [
357 357
 			'name' => 'rating',
358 358
 			'values' => $ratings,
359
-		]);
359
+		] );
360 360
 	}
361 361
 
362 362
 	/**
@@ -366,18 +366,18 @@  discard block
 block discarded – undo
366 366
 	protected function renderFilterTypes( $types )
367 367
 	{
368 368
 		if( count( $types ) < 1
369
-			|| ( count( $types ) == 1 && $types[0] == 'local' )
369
+			|| (count( $types ) == 1 && $types[0] == 'local')
370 370
 			|| apply_filters( 'site-reviews/disable/filter/types', false )
371 371
 		)return;
372 372
 		$reviewTypes = [__( 'All types', 'site-reviews' )];
373 373
 		foreach( $types as $type ) {
374
-			$reviewTypes[$type] = glsr( Strings::class )->review_types( $type, ucfirst( $type ));
374
+			$reviewTypes[$type] = glsr( Strings::class )->review_types( $type, ucfirst( $type ) );
375 375
 		}
376
-		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ));
376
+		printf( '<label class="screen-reader-text" for="type">%s</label>', __( 'Filter by type', 'site-reviews' ) );
377 377
 		glsr( Html::class )->renderPartial( 'filterby', [
378 378
 			'name' => 'review_type',
379 379
 			'values' => $reviewTypes,
380
-		]);
380
+		] );
381 381
 	}
382 382
 
383 383
 	/**
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
387 387
 	{
388 388
 		foreach( $metaKeys as $key ) {
389
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
389
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
390 390
 			$metaQuery = (array)$query->get( 'meta_query' );
391 391
 			$metaQuery[] = [
392 392
 				'key' => $key,
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 	{
404 404
 		$orderby = $query->get( 'orderby' );
405 405
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
406
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
407
-		if( in_array( $orderby, array_keys( $columns ))) {
406
+		unset($columns['cb'], $columns['title'], $columns['date']);
407
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
408 408
 			$query->set( 'meta_key', $orderby );
409 409
 			$query->set( 'orderby', 'meta_value' );
410 410
 		}
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -109,7 +109,9 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function renderReviewEditor( WP_Post $post )
111 111
 	{
112
-		if( !$this->isReviewEditable( $post ) )return;
112
+		if( !$this->isReviewEditable( $post ) ) {
113
+			return;
114
+		}
113 115
 		glsr()->render( 'editor/review', [
114 116
 			'post' => $post,
115 117
 		]);
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 	 */
122 124
 	public function renderReviewNotice( WP_Post $post )
123 125
 	{
124
-		if( !$this->isReviewEditable( $post ) )return;
126
+		if( !$this->isReviewEditable( $post ) ) {
127
+			return;
128
+		}
125 129
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
126 130
 		glsr()->render( 'editor/notice' );
127 131
 	}
@@ -132,13 +136,19 @@  discard block
 block discarded – undo
132 136
 	 */
133 137
 	public function renderTinymceButton()
134 138
 	{
135
-		if( glsr_current_screen()->base != 'post' )return;
139
+		if( glsr_current_screen()->base != 'post' ) {
140
+			return;
141
+		}
136 142
 		$shortcodes = [];
137 143
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
138
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
144
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) {
145
+				continue;
146
+			}
139 147
 			$shortcodes[$shortcode] = $values;
140 148
 		}
141
-		if( empty( $shortcodes ))return;
149
+		if( empty( $shortcodes )) {
150
+			return;
151
+		}
142 152
 		glsr()->render( 'editor/tinymce', [
143 153
 			'shortcodes' => $shortcodes,
144 154
 		]);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		$links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
34 34
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
35
-		]);
35
+		] );
36 36
 		return $links;
37 37
 	}
38 38
 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	{
45 45
 		$postType = Application::POST_TYPE;
46 46
 		$postCount = wp_count_posts( $postType );
47
-		if( !isset( $postCount->publish ) || !$postCount->publish ) {
47
+		if( !isset($postCount->publish) || !$postCount->publish ) {
48 48
 			return $items;
49 49
 		}
50 50
 		$postTypeObject = get_post_type_object( $postType );
51 51
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
52
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
52
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
53 53
 		$items[] = $postTypeObject && current_user_can( $postTypeObject->cap->edit_posts )
54 54
 			? sprintf( '<a class="glsr-review-count" href="edit.php?post_type=%s">%s</a>', $postType, $text )
55 55
 			: sprintf( '<span class="glsr-review-count">%s</span>', $text );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public function filterTinymcePlugins( array $plugins )
64 64
 	{
65 65
 		if( user_can_richedit()
66
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
66
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
67 67
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
68 68
 		}
69 69
 		return $plugins;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function registerPointers()
77 77
 	{
78
-		$command = new RegisterPointers([[
78
+		$command = new RegisterPointers( [[
79 79
 			'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
80 80
 			'id' => 'glsr-pointer-pinned',
81 81
 			'position' => [
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			'screen' => Application::POST_TYPE,
86 86
 			'target' => '#misc-pub-pinned',
87 87
 			'title' => __( 'Pin Your Reviews', 'site-reviews' ),
88
-		]]);
88
+		]] );
89 89
 		$this->execute( $command );
90 90
 	}
91 91
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function registerShortcodeButtons()
97 97
 	{
98
-		$command = new RegisterShortcodeButtons([
98
+		$command = new RegisterShortcodeButtons( [
99 99
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
100 100
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
101 101
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
102
-		]);
102
+		] );
103 103
 		$this->execute( $command );
104 104
 	}
105 105
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if( !$this->isReviewEditable( $post ) )return;
113 113
 		glsr()->render( 'editor/review', [
114 114
 			'post' => $post,
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function renderReviewNotice( WP_Post $post )
123 123
 	{
124 124
 		if( !$this->isReviewEditable( $post ) )return;
125
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
125
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
126 126
 		glsr()->render( 'editor/notice' );
127 127
 	}
128 128
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 		if( glsr_current_screen()->base != 'post' )return;
136 136
 		$shortcodes = [];
137 137
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
138
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
138
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
139 139
 			$shortcodes[$shortcode] = $values;
140 140
 		}
141
-		if( empty( $shortcodes ))return;
141
+		if( empty($shortcodes) )return;
142 142
 		glsr()->render( 'editor/tinymce', [
143 143
 			'shortcodes' => $shortcodes,
144
-		]);
144
+		] );
145 145
 	}
146 146
 
147 147
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	public function routerClearLog()
151 151
 	{
152 152
 		glsr( Logger::class )->clear();
153
-		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ));
153
+		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) );
154 154
 	}
155 155
 
156 156
 	/**
Please login to merge, or discard this patch.