Passed
Push — master ( c272a3...f1c4a0 )
by Paul
07:09
created
uninstall.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/site-reviews.php';
6
-if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return;
6
+if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ) ) )return;
7 7
 
8 8
 delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() );
9 9
 delete_option( 'widget_'.glsr()->id.'_site-reviews' );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,9 @@
 block discarded – undo
3 3
 defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 require_once __DIR__.'/site-reviews.php';
6
-if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return;
6
+if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ))) {
7
+	return;
8
+}
7 9
 
8 10
 delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() );
9 11
 delete_option( 'widget_'.glsr()->id.'_site-reviews' );
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 	protected function normalize( array $settings )
54 54
 	{
55 55
 		array_walk( $settings, function( &$setting ) {
56
-			if( isset( $setting['default'] ))return;
56
+			if( isset( $setting['default'] )) {
57
+				return;
58
+			}
57 59
 			$setting['default'] = '';
58 60
 		});
59 61
 		return $settings;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	public function defaults()
14 14
 	{
15 15
 		$settings = $this->settings();
16
-		$defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ));
16
+		$defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) );
17 17
 		return wp_parse_args( $defaults, [
18 18
 			'version' => '',
19 19
 			'version_upgraded_from' => '',
20
-		]);
20
+		] );
21 21
 	}
22 22
 
23 23
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	protected function normalize( array $settings )
58 58
 	{
59 59
 		array_walk( $settings, function( &$setting ) {
60
-			if( isset( $setting['default'] ))return;
60
+			if( isset($setting['default']) )return;
61 61
 			$setting['default'] = '';
62 62
 		});
63 63
 		return $settings;
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 			return $input;
22 22
 		}
23 23
 		$triggered = true;
24
-		if( !is_array( $input )) {
24
+		if( !is_array( $input ) ) {
25 25
 			$input = ['settings' => []];
26 26
 		}
27 27
 		if( key( $input ) == 'settings' ) {
28
-			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
28
+			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
29 29
 		}
30 30
 		$options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
31 31
 		$options = $this->sanitizeSubmissions( $input, $options );
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
43 43
 			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
44
-		]);
44
+		] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function sanitizeSubmissions( array $input, array $options )
51 51
 	{
52
-		if( isset( $input['settings']['submissions'] )) {
52
+		if( isset($input['settings']['submissions']) ) {
53 53
 			$inputForm = $input['settings']['submissions'];
54
-			$options['settings']['submissions']['required'] = isset( $inputForm['required'] )
54
+			$options['settings']['submissions']['required'] = isset($inputForm['required'])
55 55
 				? $inputForm['required']
56 56
 				: [];
57 57
 		}
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	protected function sanitizeTranslations( array $input, array $options )
65 65
 	{
66
-		if( isset( $input['settings']['strings'] )) {
67
-			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ));
66
+		if( isset($input['settings']['strings']) ) {
67
+			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
68 68
 			array_walk( $options['settings']['strings'], function( &$string ) {
69
-				if( isset( $string['s2'] )) {
69
+				if( isset($string['s2']) ) {
70 70
 					$string['s2'] = wp_strip_all_tags( $string['s2'] );
71 71
 				}
72
-				if( isset( $string['p2'] )) {
72
+				if( isset($string['p2']) ) {
73 73
 					$string['p2'] = wp_strip_all_tags( $string['p2'] );
74 74
 				}
75 75
 			});
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	public function all()
25 25
 	{
26 26
 		$options = get_option( static::databaseKey(), [] );
27
-		if( !is_array( $options )) {
27
+		if( !is_array( $options ) ) {
28 28
 			delete_option( static::databaseKey() );
29 29
 			$options = ['settings' => []];
30 30
 		}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue;
46 46
 			$pointer = &$pointer[$key];
47 47
 		}
48
-		unset( $pointer[$last] );
48
+		unset($pointer[$last]);
49 49
 		return $this->set( $options );
50 50
 	}
51 51
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 			glsr( DefaultsManager::class )->defaults()
78 78
 		);
79 79
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
81
-			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
80
+			if( !is_string( $value ) )return;
81
+			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
82 82
 		});
83 83
 		return glsr( Helper::class )->convertDotNotationArray( $options );
84 84
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function set( $pathOrOptions, $value = '' )
92 92
 	{
93
-		if( is_string( $pathOrOptions )) {
93
+		if( is_string( $pathOrOptions ) ) {
94 94
 			$pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() );
95 95
 		}
96 96
 		return update_option( static::databaseKey(), (array)$pathOrOptions );
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) {
46
+				continue;
47
+			}
46 48
 			$pointer = &$pointer[$key];
47 49
 		}
48 50
 		unset( $pointer[$last] );
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
 			glsr( DefaultsManager::class )->defaults()
78 80
 		);
79 81
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
82
+			if( !is_string( $value )) {
83
+				return;
84
+			}
81 85
 			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
82 86
 		});
83 87
 		return glsr( Helper::class )->convertDotNotationArray( $options );
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function handle( Command $command )
14 14
 	{
15
-		$postId = wp_update_post([
15
+		$postId = wp_update_post( [
16 16
 			'ID' => $command->id,
17 17
 			'post_status' => $command->status,
18
-		]);
19
-		if( is_wp_error( $postId )) {
18
+		] );
19
+		if( is_wp_error( $postId ) ) {
20 20
 			glsr_log()->error( $postId->get_error_message() );
21 21
 			return [];
22 22
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')',
38 38
 			'class' => 'row-title',
39 39
 			'href' => get_edit_post_link( $postId ),
40
-		]);
40
+		] );
41 41
 	}
42 42
 
43 43
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	protected function getPostState( $postId )
48 48
 	{
49 49
 		ob_start();
50
-		_post_states( get_post( $postId ));
50
+		_post_states( get_post( $postId ) );
51 51
 		return ob_get_clean();
52 52
 	}
53 53
 }
Please login to merge, or discard this patch.
plugin/Modules/ListTable/Columns.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function renderFilters( $postType )
88 88
 	{
89
-		if( $postType !== Application::POST_TYPE )return;
89
+		if( $postType !== Application::POST_TYPE ) {
90
+			return;
91
+		}
90 92
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
91 93
 			$status = 'publish';
92 94
 		}
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	 */
104 106
 	public function renderValues( $column, $postId )
105 107
 	{
106
-		if( glsr_current_screen()->post_type != Application::POST_TYPE )return;
108
+		if( glsr_current_screen()->post_type != Application::POST_TYPE ) {
109
+			return;
110
+		}
107 111
 		$method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' );
108 112
 		echo method_exists( $this, $method )
109 113
 			? call_user_func( [$this, $method], $postId )
@@ -116,7 +120,9 @@  discard block
 block discarded – undo
116 120
 	 */
117 121
 	protected function renderFilterRatings( $ratings )
118 122
 	{
119
-		if( empty( $ratings ))return;
123
+		if( empty( $ratings )) {
124
+			return;
125
+		}
120 126
 		$ratings = array_flip( array_reverse( $ratings ));
121 127
 		array_walk( $ratings, function( &$value, $key ) {
122 128
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -139,7 +145,9 @@  discard block
 block discarded – undo
139 145
 	 */
140 146
 	protected function renderFilterTypes( $types )
141 147
 	{
142
-		if( count( glsr()->reviewTypes ) < 2 )return;
148
+		if( count( glsr()->reviewTypes ) < 2 ) {
149
+			return;
150
+		}
143 151
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
144 152
 			'class' => 'screen-reader-text',
145 153
 			'for' => 'review_type',
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) {
23 23
 			$column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
24 24
 				'href' => (string)get_the_permalink( $assignedPost->ID ),
25
-			]);
25
+			] );
26 26
 		}
27 27
 		return $column;
28 28
 	}
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 		$pinned = glsr( Database::class )->getReviewMeta( $postId )->pinned
37 37
 			? 'pinned '
38 38
 			: '';
39
-		return glsr( Builder::class )->i([
39
+		return glsr( Builder::class )->i( [
40 40
 			'class' => $pinned.'dashicons dashicons-sticky',
41 41
 			'data-id' => $postId,
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		return glsr( Html::class )->buildPartial( 'star-rating', [
62 62
 			'rating' => glsr( Database::class )->getReviewMeta( $postId )->rating,
63
-		]);
63
+		] );
64 64
 	}
65 65
 
66 66
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	public function buildColumnType( $postId )
71 71
 	{
72 72
 		$reviewMeta = glsr( Database::class )->getReviewMeta( $postId );
73
-		return isset( glsr()->reviewTypes[$reviewMeta->review_type] )
73
+		return isset(glsr()->reviewTypes[$reviewMeta->review_type])
74 74
 			? glsr()->reviewTypes[$reviewMeta->review_type]
75 75
 			: $reviewMeta->review_type;
76 76
 	}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function renderFilters( $postType )
83 83
 	{
84 84
 		if( $postType !== Application::POST_TYPE )return;
85
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
85
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
86 86
 			$status = 'publish';
87 87
 		}
88 88
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function renderFilterRatings( $ratings )
113 113
 	{
114
-		if( empty( $ratings ))return;
115
-		$ratings = array_flip( array_reverse( $ratings ));
114
+		if( empty($ratings) )return;
115
+		$ratings = array_flip( array_reverse( $ratings ) );
116 116
 		array_walk( $ratings, function( &$value, $key ) {
117 117
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
118 118
 			$value = sprintf( $label, $key );
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 		echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
121 121
 			'class' => 'screen-reader-text',
122 122
 			'for' => 'rating',
123
-		]);
124
-		echo glsr( Builder::class )->select([
123
+		] );
124
+		echo glsr( Builder::class )->select( [
125 125
 			'name' => 'rating',
126 126
 			'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
127 127
 			'value' => filter_input( INPUT_GET, 'rating' ),
128
-		]);
128
+		] );
129 129
 	}
130 130
 
131 131
 	/**
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
139 139
 			'class' => 'screen-reader-text',
140 140
 			'for' => 'review_type',
141
-		]);
142
-		echo glsr( Builder::class )->select([
141
+		] );
142
+		echo glsr( Builder::class )->select( [
143 143
 			'name' => 'review_type',
144 144
 			'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
145 145
 			'value' => filter_input( INPUT_GET, 'review_type' ),
146
-		]);
146
+		] );
147 147
 	}
148 148
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@
 block discarded – undo
51 51
 	protected function normalize( array $data )
52 52
 	{
53 53
 		$arrayKeys = ['context', 'globals'];
54
-		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ));
54
+		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) );
55 55
 		foreach( $arrayKeys as $key ) {
56
-			if( is_array( $data[$key] ))continue;
56
+			if( is_array( $data[$key] ) )continue;
57 57
 			$data[$key] = [];
58 58
 		}
59 59
 		return $data;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 		$arrayKeys = ['context', 'globals'];
54 54
 		$data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ));
55 55
 		foreach( $arrayKeys as $key ) {
56
-			if( is_array( $data[$key] ))continue;
56
+			if( is_array( $data[$key] )) {
57
+				continue;
58
+			}
57 59
 			$data[$key] = [];
58 60
 		}
59 61
 		return $data;
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
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function renderReviewEditor( WP_Post $post )
117 117
 	{
118
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
118
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
119
+			return;
120
+		}
119 121
 		glsr()->render( 'partials/editor/review', [
120 122
 			'post' => $post,
121 123
 		]);
@@ -127,7 +129,9 @@  discard block
 block discarded – undo
127 129
 	 */
128 130
 	public function renderReviewNotice( WP_Post $post )
129 131
 	{
130
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
132
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
133
+			return;
134
+		}
131 135
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
132 136
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
133 137
 			'context' => [
@@ -142,13 +146,19 @@  discard block
 block discarded – undo
142 146
 	 */
143 147
 	public function renderTinymceButton()
144 148
 	{
145
-		if( glsr_current_screen()->base != 'post' )return;
149
+		if( glsr_current_screen()->base != 'post' ) {
150
+			return;
151
+		}
146 152
 		$shortcodes = [];
147 153
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
148
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
154
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) {
155
+				continue;
156
+			}
149 157
 			$shortcodes[$shortcode] = $values;
150 158
 		}
151
-		if( empty( $shortcodes ))return;
159
+		if( empty( $shortcodes )) {
160
+			return;
161
+		}
152 162
 		glsr()->render( 'partials/editor/tinymce', [
153 163
 			'shortcodes' => $shortcodes,
154 164
 		]);
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function enqueueAssets()
25 25
 	{
26
-		$command = new EnqueueAdminAssets([
26
+		$command = new EnqueueAdminAssets( [
27 27
 			'pointers' => [[
28 28
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
29 29
 				'id' => 'glsr-pointer-pinned',
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 				'target' => '#misc-pub-pinned',
36 36
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
37 37
 			]],
38
-		]);
38
+		] );
39 39
 		$this->execute( $command );
40 40
 	}
41 41
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
49 49
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
50
-		]);
50
+		] );
51 51
 		return $links;
52 52
 	}
53 53
 
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
 	public function filterDashboardGlanceItems( array $items )
59 59
 	{
60 60
 		$postCount = wp_count_posts( Application::POST_TYPE );
61
-		if( empty( $postCount->publish )) {
61
+		if( empty($postCount->publish) ) {
62 62
 			return $items;
63 63
 		}
64 64
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
65
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
65
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
66 66
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
67 67
 			? glsr( Builder::class )->a( $text, [
68 68
 				'class' => 'glsr-review-count',
69 69
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
70
-			])
70
+			] )
71 71
 			: glsr( Builder::class )->span( $text, [
72 72
 				'class' => 'glsr-review-count',
73
-			]);
73
+			] );
74 74
 		return $items;
75 75
 	}
76 76
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	public function filterTinymcePlugins( array $plugins )
82 82
 	{
83 83
 		if( user_can_richedit()
84
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
84
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
85 85
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
86 86
 		}
87 87
 		return $plugins;
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function registerShortcodeButtons()
95 95
 	{
96
-		$command = new RegisterShortcodeButtons([
96
+		$command = new RegisterShortcodeButtons( [
97 97
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
98 98
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
99 99
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
100
-		]);
100
+		] );
101 101
 		$this->execute( $command );
102 102
 	}
103 103
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
111 111
 		glsr()->render( 'partials/editor/review', [
112 112
 			'post' => $post,
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function renderReviewNotice( WP_Post $post )
121 121
 	{
122
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
123
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
122
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
123
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
124 124
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
125 125
 			'context' => [
126 126
 				'notices' => glsr( Notice::class )->get(),
127 127
 			],
128
-		]);
128
+		] );
129 129
 	}
130 130
 
131 131
 	/**
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 		if( glsr_current_screen()->base != 'post' )return;
138 138
 		$shortcodes = [];
139 139
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
140
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
140
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
141 141
 			$shortcodes[$shortcode] = $values;
142 142
 		}
143
-		if( empty( $shortcodes ))return;
143
+		if( empty($shortcodes) )return;
144 144
 		glsr()->render( 'partials/editor/tinymce', [
145 145
 			'shortcodes' => $shortcodes,
146
-		]);
146
+		] );
147 147
 	}
148 148
 
149 149
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	public function routerClearLog()
153 153
 	{
154 154
 		glsr( Logger::class )->clear();
155
-		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ));
155
+		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) );
156 156
 	}
157 157
 
158 158
 	/**
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
 	{
187 187
 		$file = $_FILES['import-file'];
188 188
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
189
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
189
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
190 190
 		}
191
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
192
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
191
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
192
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
193 193
 		}
194 194
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
195
-		if( empty( $settings )) {
196
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
195
+		if( empty($settings) ) {
196
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
197 197
 		}
198
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
199
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
198
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
199
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
200 200
 	}
201 201
 
202 202
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
215 215
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
216 216
 		];
217
-		return !isset( $errors[$errorCode] )
217
+		return !isset($errors[$errorCode])
218 218
 			? __( 'Unknown upload error.', 'site-reviews' )
219 219
 			: $errors[$errorCode];
220 220
 	}
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 2 patches
Spacing   +25 added lines, -25 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
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function filterPostStates( array $postStates, WP_Post $post ) {
96 96
 		if( $post->post_type == Application::POST_TYPE
97
-			&& array_key_exists( 'pending', $postStates )) {
97
+			&& array_key_exists( 'pending', $postStates ) ) {
98 98
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
99 99
 		}
100 100
 		return $postStates;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) {
110 110
 			return $actions;
111 111
 		}
112
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
112
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
113 113
 		$rowActions = [
114 114
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
115 115
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key ),
124 124
 					$key.'-review_'.$post->ID
125 125
 				),
126
-			]);
126
+			] );
127 127
 		}
128 128
 		return $newActions + $actions;
129 129
 	}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	public function filterSortableColumns( array $columns )
136 136
 	{
137 137
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
138
-		unset( $postTypeColumns['cb'] );
138
+		unset($postTypeColumns['cb']);
139 139
 		foreach( $postTypeColumns as $key => $value ) {
140
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
140
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
141 141
 			$columns[$key] = $key;
142 142
 		}
143 143
 		return $columns;
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
157 157
 	{
158
-		if( $this->canModifyTranslation( $domain )) {
158
+		if( $this->canModifyTranslation( $domain ) ) {
159 159
 			$strings = [
160 160
 				'Published' => __( 'Approved', 'site-reviews' ),
161 161
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
162 162
 			];
163 163
 			foreach( $strings as $search => $replace ) {
164 164
 				if( strpos( $single, $search ) === false )continue;
165
-				$translation = $this->getTranslation([
165
+				$translation = $this->getTranslation( [
166 166
 					'number' => $number,
167 167
 					'plural' => str_replace( $search, $replace, $plural ),
168 168
 					'single' => str_replace( $search, $replace, $single ),
169
-				]);
169
+				] );
170 170
 			}
171 171
 		}
172 172
 		return $translation;
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public function saveBulkEditFields( $postId )
215 215
 	{
216
-		if( !current_user_can( 'edit_posts' ))return;
216
+		if( !current_user_can( 'edit_posts' ) )return;
217 217
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
218
-		if( $assignedTo && get_post( $assignedTo )) {
218
+		if( $assignedTo && get_post( $assignedTo ) ) {
219 219
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
220 220
 		}
221 221
 	}
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function setQueryForColumn( WP_Query $query )
228 228
 	{
229
-		if( !$this->hasPermission( $query ))return;
229
+		if( !$this->hasPermission( $query ) )return;
230 230
 		$this->setMetaQuery( $query, [
231 231
 			'rating', 'review_type',
232
-		]);
232
+		] );
233 233
 		$this->setOrderby( $query );
234 234
 	}
235 235
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function unapprove()
241 241
 	{
242
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
243
-		wp_update_post([
242
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
243
+		wp_update_post( [
244 244
 			'ID' => $postId,
245 245
 			'post_status' => 'pending',
246
-		]);
246
+		] );
247 247
 		wp_safe_redirect( wp_get_referer() );
248 248
 		exit;
249 249
 	}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			'single' => '',
273 273
 			'text' => '',
274 274
 		];
275
-		$args = (object) wp_parse_args( $args, $defaults );
275
+		$args = (object)wp_parse_args( $args, $defaults );
276 276
 		$translations = get_translations_for_domain( Application::ID );
277 277
 		return $args->text
278 278
 			? $translations->translate( $args->text )
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
298 298
 	{
299 299
 		foreach( $metaKeys as $key ) {
300
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
300
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
301 301
 			$metaQuery = (array)$query->get( 'meta_query' );
302 302
 			$metaQuery[] = [
303 303
 				'key' => $key,
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	{
315 315
 		$orderby = $query->get( 'orderby' );
316 316
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
317
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
318
-		if( in_array( $orderby, array_keys( $columns ))) {
317
+		unset($columns['cb'], $columns['title'], $columns['date']);
318
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
319 319
 			$query->set( 'meta_key', $orderby );
320 320
 			$query->set( 'orderby', 'meta_value' );
321 321
 		}
Please login to merge, or discard this patch.
Braces   +20 added lines, -7 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 ) {
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
 	 * @return array
93 95
 	 * @filter display_post_states
94 96
 	 */
95
-	public function filterPostStates( array $postStates, WP_Post $post ) {
97
+	public function filterPostStates( array $postStates, WP_Post $post )
98
+	{
96 99
 		if( $post->post_type == Application::POST_TYPE
97 100
 			&& array_key_exists( 'pending', $postStates )) {
98 101
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
@@ -137,7 +140,9 @@  discard block
 block discarded – undo
137 140
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
138 141
 		unset( $postTypeColumns['cb'] );
139 142
 		foreach( $postTypeColumns as $key => $value ) {
140
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
143
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) {
144
+				continue;
145
+			}
141 146
 			$columns[$key] = $key;
142 147
 		}
143 148
 		return $columns;
@@ -161,7 +166,9 @@  discard block
 block discarded – undo
161 166
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
162 167
 			];
163 168
 			foreach( $strings as $search => $replace ) {
164
-				if( strpos( $single, $search ) === false )continue;
169
+				if( strpos( $single, $search ) === false ) {
170
+					continue;
171
+				}
165 172
 				$translation = $this->getTranslation([
166 173
 					'number' => $number,
167 174
 					'plural' => str_replace( $search, $replace, $plural ),
@@ -213,7 +220,9 @@  discard block
 block discarded – undo
213 220
 	 */
214 221
 	public function saveBulkEditFields( $postId )
215 222
 	{
216
-		if( !current_user_can( 'edit_posts' ))return;
223
+		if( !current_user_can( 'edit_posts' )) {
224
+			return;
225
+		}
217 226
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
218 227
 		if( $assignedTo && get_post( $assignedTo )) {
219 228
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -226,7 +235,9 @@  discard block
 block discarded – undo
226 235
 	 */
227 236
 	public function setQueryForColumn( WP_Query $query )
228 237
 	{
229
-		if( !$this->hasPermission( $query ))return;
238
+		if( !$this->hasPermission( $query )) {
239
+			return;
240
+		}
230 241
 		$this->setMetaQuery( $query, [
231 242
 			'rating', 'review_type',
232 243
 		]);
@@ -297,7 +308,9 @@  discard block
 block discarded – undo
297 308
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
298 309
 	{
299 310
 		foreach( $metaKeys as $key ) {
300
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
311
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
312
+				continue;
313
+			}
301 314
 			$metaQuery = (array)$query->get( 'meta_query' );
302 315
 			$metaQuery[] = [
303 316
 				'key' => $key,
Please login to merge, or discard this patch.