Passed
Push — master ( 3e60cb...36c2a1 )
by Paul
07:09 queued 03:38
created
plugin/Controllers/SettingsController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	public function callbackRegisterSettings( $input )
19 19
 	{
20
-		if( !is_array( $input )) {
20
+		if( !is_array( $input ) ) {
21 21
 			$input = ['settings' => []];
22 22
 		}
23 23
 		if( key( $input ) == 'settings' ) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			$options = $this->sanitizeSubmissions( $input, $options );
27 27
 			$options = $this->sanitizeTranslations( $input, $options );
28 28
 			if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
29
-				glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
29
+				glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
30 30
 			}
31 31
 			return $options;
32 32
 		}
@@ -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
 	/**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		if( trim( $inputForm['notification_message'] ) == '' ) {
57 57
 			$options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
58 58
 		}
59
-		$options['settings']['general']['notifications'] = isset( $inputForm['notifications'] )
59
+		$options['settings']['general']['notifications'] = isset($inputForm['notifications'])
60 60
 			? $inputForm['notifications']
61 61
 			: [];
62 62
 		return $options;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	protected function sanitizeSubmissions( array $input, array $options )
69 69
 	{
70 70
 		$inputForm = $input['settings']['submissions'];
71
-		$options['settings']['submissions']['required'] = isset( $inputForm['required'] )
71
+		$options['settings']['submissions']['required'] = isset($inputForm['required'])
72 72
 			? $inputForm['required']
73 73
 			: [];
74 74
 		return $options;
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	protected function sanitizeTranslations( array $input, array $options )
81 81
 	{
82
-		if( isset( $input['settings']['strings'] )) {
83
-			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ));
82
+		if( isset($input['settings']['strings']) ) {
83
+			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
84 84
 			$allowedTags = [
85 85
 				'a' => ['class' => [], 'href' => [], 'target' => []],
86 86
 				'span' => ['class' => []],
87 87
 			];
88
-			array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) {
89
-				if( isset( $string['s2'] )) {
88
+			array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) {
89
+				if( isset($string['s2']) ) {
90 90
 					$string['s2'] = wp_kses( $string['s2'], $allowedTags );
91 91
 				}
92
-				if( isset( $string['p2'] )) {
92
+				if( isset($string['p2']) ) {
93 93
 					$string['p2'] = wp_kses( $string['p2'], $allowedTags );
94 94
 				}
95 95
 			});
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	protected function isPolylangActiveAndSupported()
104 104
 	{
105 105
 		if( !glsr( Polylang::class )->isActive() ) {
106
-			glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ));
106
+			glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) );
107 107
 			return false;
108 108
 		}
109 109
 		else if( !glsr( Polylang::class )->isSupported() ) {
110
-			glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ));
110
+			glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) );
111 111
 			return false;
112 112
 		}
113 113
 		return true;
Please login to merge, or discard this patch.
plugin/Application.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		static::$instance = $this;
36
-		$this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' );
36
+		$this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = 'static::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function file( $view )
105 105
 	{
106
-		$view.= '.php';
106
+		$view .= '.php';
107 107
 		$filePaths = [];
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110 110
 		}
111 111
 		$filePaths[] = $this->path( $view );
112 112
 		$filePaths[] = $this->path( 'views/'.$view );
113 113
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
114
+			if( !file_exists( $file ) )continue;
115 115
 			return $file;
116 116
 		}
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getDefaults()
123 123
 	{
124
-		if( empty( $this->defaults )) {
124
+		if( empty($this->defaults) ) {
125 125
 			$this->defaults = $this->make( DefaultsManager::class )->get();
126 126
 			$this->upgrade();
127 127
 		}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	public function hasPermission()
135 135
 	{
136 136
 		$isAdmin = $this->isAdmin();
137
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->constant( 'CAPABILITY' )));
137
+		return !$isAdmin || ($isAdmin && current_user_can( $this->constant( 'CAPABILITY' ) ));
138 138
 	}
139 139
 
140 140
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		$types = apply_filters( 'site-reviews/addon/types', [] );
191 191
 		$this->reviewTypes = wp_parse_args( $types, [
192 192
 			'local' => __( 'Local', 'site-reviews' ),
193
-		]);
193
+		] );
194 194
 	}
195 195
 
196 196
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	{
202 202
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
203 203
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
204
-		if( !file_exists( $file )) {
204
+		if( !file_exists( $file ) ) {
205 205
 			glsr_log()->error( 'File not found: '.$file );
206 206
 			return;
207 207
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function scheduleCronJob()
217 217
 	{
218
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
218
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
219 219
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
220 220
 	}
221 221
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function unscheduleCronJob()
235 235
 	{
236
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
236
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
237 237
 	}
238 238
 
239 239
 	/**
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public function url( $path = '' )
267 267
 	{
268
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
268
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
269 269
 		return apply_filters( 'site-reviews/url', $url, $path );
270 270
 	}
271 271
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
 	public function catchFatalError()
61 61
 	{
62 62
 		$error = error_get_last();
63
-		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false )return;
63
+		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false ) {
64
+			return;
65
+		}
64 66
 		glsr_log()->error( $error['message'] );
65 67
 	}
66 68
 
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
 		$filePaths[] = $this->path( $view );
112 114
 		$filePaths[] = $this->path( 'views/'.$view );
113 115
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
116
+			if( !file_exists( $file )) {
117
+				continue;
118
+			}
115 119
 			return $file;
116 120
 		}
117 121
 	}
@@ -215,7 +219,9 @@  discard block
 block discarded – undo
215 219
 	 */
216 220
 	public function scheduleCronJob()
217 221
 	{
218
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
222
+		if( wp_next_scheduled( static::CRON_EVENT )) {
223
+			return;
224
+		}
219 225
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
220 226
 	}
221 227
 
@@ -255,7 +261,9 @@  discard block
 block discarded – undo
255 261
 			|| !in_array( plugin_basename( $this->file ), $data['plugins'] )
256 262
 			|| $data['action'] != 'update'
257 263
 			|| $data['type'] != 'plugin'
258
-		)return;
264
+		) {
265
+			return;
266
+		}
259 267
 		$this->upgrade();
260 268
 	}
261 269
 
Please login to merge, or discard this patch.
plugin/Modules/Style.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 			'templates/form/submit-button',
51 51
 			'templates/reviews-form',
52 52
 		];
53
-		if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) {
53
+		if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) {
54 54
 			return $view;
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->file( $possibleView )))continue;
58
+			if( !file_exists( glsr()->file( $possibleView ) ) )continue;
59 59
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 60
 		}
61 61
 		return $view;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function modifyField( Builder $instance )
90 90
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
91
+		if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return;
92 92
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 93
 	}
94 94
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function customize( Builder $instance )
107 107
 	{
108
-		if( !array_key_exists( $instance->tag, $this->fields ))return;
109
-		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
108
+		if( !array_key_exists( $instance->tag, $this->fields ) )return;
109
+		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) );
110 110
 		$key = $instance->tag.'_'.$args['type'];
111
-		$classes = !isset( $this->fields[$key] )
111
+		$classes = !isset($this->fields[$key])
112 112
 			? $this->fields[$instance->tag]
113 113
 			: $this->fields[$key];
114 114
 		$instance->args['class'] = trim( $args['class'].' '.$classes );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$args = wp_parse_args( $instance->args, [
143 143
 			'is_public' => false,
144 144
 			'is_raw' => false,
145
-		]);
145
+		] );
146 146
 		if( is_admin() || !$args['is_public'] || $args['is_raw'] ) {
147 147
 			return false;
148 148
 		}
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->file( $possibleView )))continue;
58
+			if( !file_exists( glsr()->file( $possibleView ))) {
59
+				continue;
60
+			}
59 61
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 62
 		}
61 63
 		return $view;
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 	 */
89 91
 	public function modifyField( Builder $instance )
90 92
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
93
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) {
94
+			return;
95
+		}
92 96
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 97
 	}
94 98
 
@@ -105,7 +109,9 @@  discard block
 block discarded – undo
105 109
 	 */
106 110
 	protected function customize( Builder $instance )
107 111
 	{
108
-		if( !array_key_exists( $instance->tag, $this->fields ))return;
112
+		if( !array_key_exists( $instance->tag, $this->fields )) {
113
+			return;
114
+		}
109 115
 		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
110 116
 		$key = $instance->tag.'_'.$args['type'];
111 117
 		$classes = !isset( $this->fields[$key] )
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	public function __construct( array $values = [] )
16 16
 	{
17 17
 		$this->values = $values;
18
-		parent::__construct( $values, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
18
+		parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
19 19
 	}
20 20
 
21 21
 	/**
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __toString()
35 35
 	{
36
-		if( empty( $this->values ))return;
36
+		if( empty($this->values) )return;
37 37
 		return glsr( Template::class )->build( 'templates/review', [
38 38
 			'context' => $this->values,
39
-		]);
39
+		] );
40 40
 	}
41 41
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
 	 */
34 34
 	public function __toString()
35 35
 	{
36
-		if( empty( $this->values ))return;
36
+		if( empty( $this->values )) {
37
+			return;
38
+		}
37 39
 		return glsr( Template::class )->build( 'templates/review', [
38 40
 			'context' => $this->values,
39 41
 		]);
Please login to merge, or discard this patch.
plugin/Reviews.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 		$this->args = $args;
30 30
 		$this->max_num_pages = $maxPageCount;
31 31
 		$this->results = $reviews;
32
-		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
32
+		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
 	}
34 34
 
35 35
 	/**
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function build( array $args = [] )
70 70
 	{
71
-		if( empty( $this->ID )) {
71
+		if( empty($this->ID) ) {
72 72
 			return new ReviewHtml;
73 73
 		}
74 74
 		$partial = glsr( SiteReviewsPartial::class );
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function offsetGet( $key )
94 94
 	{
95
-		if( property_exists( $this, $key )) {
95
+		if( property_exists( $this, $key ) ) {
96 96
 			return $this->$key;
97 97
 		}
98
-		if( array_key_exists( $key, (array)$this->custom )) {
98
+		if( array_key_exists( $key, (array)$this->custom ) ) {
99 99
 			return $this->custom[$key];
100 100
 		}
101 101
 		return null;
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function offsetSet( $key, $value )
110 110
 	{
111
-		if( property_exists( $this, $key )) {
111
+		if( property_exists( $this, $key ) ) {
112 112
 			$this->$key = $value;
113 113
 			return;
114 114
 		}
115
-		if( !is_array( $this->custom )) {
115
+		if( !is_array( $this->custom ) ) {
116 116
 			$this->custom = array_filter( (array)$this->custom );
117 117
 		}
118 118
 		$this->custom[$key] = $value;
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 			'review_type' => 'local',
158 158
 		];
159 159
 		$meta = array_filter(
160
-			array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))),
160
+			array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ),
161 161
 			'strlen'
162 162
 		);
163
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
163
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
164 164
 		$this->modified = $this->isModified( $properties );
165 165
 		array_walk( $properties, function( $value, $key ) {
166
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
166
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
167 167
 			$this->$key = maybe_unserialize( $value );
168 168
 		});
169 169
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	protected function setTermIds( WP_Post $post )
175 175
 	{
176 176
 		$this->term_ids = [];
177
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
177
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
178 178
 		foreach( $terms as $term ) {
179 179
 			$this->term_ids[] = $term->term_id;
180 180
 		}
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function __construct( WP_Post $post )
38 38
 	{
39
-		if( $post->post_type != Application::POST_TYPE )return;
39
+		if( $post->post_type != Application::POST_TYPE ) {
40
+			return;
41
+		}
40 42
 		$this->content = $post->post_content;
41 43
 		$this->date = $post->post_date;
42 44
 		$this->ID = intval( $post->ID );
@@ -163,7 +165,9 @@  discard block
 block discarded – undo
163 165
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
164 166
 		$this->modified = $this->isModified( $properties );
165 167
 		array_walk( $properties, function( $value, $key ) {
166
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
168
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
169
+				return;
170
+			}
167 171
 			$this->$key = maybe_unserialize( $value );
168 172
 		});
169 173
 	}
@@ -174,7 +178,9 @@  discard block
 block discarded – undo
174 178
 	protected function setTermIds( WP_Post $post )
175 179
 	{
176 180
 		$this->term_ids = [];
177
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
181
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
182
+			return;
183
+		}
178 184
 		foreach( $terms as $term ) {
179 185
 			$this->term_ids[] = $term->term_id;
180 186
 		}
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function routerChangeStatus( array $request )
24 24
 	{
25
-		wp_send_json_success( $this->execute( new ChangeStatus( $request )));
25
+		wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	public function routerClearConsole()
32 32
 	{
33 33
 		glsr( AdminController::class )->routerClearConsole();
34
-		wp_send_json_success([
34
+		wp_send_json_success( [
35 35
 			'console' => glsr( Console::class )->get(),
36 36
 			'notices' => glsr( Notice::class )->get(),
37
-		]);
37
+		] );
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	public function routerCountReviews()
44 44
 	{
45 45
 		glsr( AdminController::class )->routerCountReviews();
46
-		wp_send_json_success([
46
+		wp_send_json_success( [
47 47
 			'notices' => glsr( Notice::class )->get(),
48
-		]);
48
+		] );
49 49
 	}
50 50
 
51 51
 	/**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$shortcode = $request['shortcode'];
57 57
 		$response = false;
58
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
58
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
59 59
 			$data = glsr()->mceShortcodes[$shortcode];
60
-			if( !empty( $data['errors'] )) {
60
+			if( !empty($data['errors']) ) {
61 61
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
62 62
 			}
63 63
 			$response = [
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	public function routerFetchConsole()
78 78
 	{
79 79
 		glsr( AdminController::class )->routerFetchConsole();
80
-		wp_send_json_success([
80
+		wp_send_json_success( [
81 81
 			'console' => glsr( Console::class )->get(),
82 82
 			'notices' => glsr( Notice::class )->get(),
83
-		]);
83
+		] );
84 84
 	}
85 85
 
86 86
 	/**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	public function routerSearchPosts( array $request )
90 90
 	{
91 91
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
92
-		wp_send_json_success([
92
+		wp_send_json_success( [
93 93
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
94 94
 			'items' => $results,
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function routerSearchTranslations( array $request )
102 102
 	{
103
-		if( empty( $request['exclude'] )) {
103
+		if( empty($request['exclude']) ) {
104 104
 			$request['exclude'] = [];
105 105
 		}
106 106
 		$results = glsr( Translation::class )
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 			->exclude()
109 109
 			->exclude( $request['exclude'] )
110 110
 			->renderResults();
111
-		wp_send_json_success([
111
+		wp_send_json_success( [
112 112
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
113 113
 			'items' => $results,
114
-		]);
114
+		] );
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	public function routerSubmitReview( array $request )
121 121
 	{
122 122
 		$command = glsr( PublicController::class )->routerSubmitReview( $request );
123
-		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
123
+		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
124 124
 		$redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command );
125 125
 		$data = [
126 126
 			'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function routerTogglePinned( array $request )
142 142
 	{
143
-		$isPinned = $this->execute( new TogglePinned( $request ));
144
-		wp_send_json_success([
143
+		$isPinned = $this->execute( new TogglePinned( $request ) );
144
+		wp_send_json_success( [
145 145
 			'notices' => glsr( Notice::class )->get(),
146 146
 			'pinned' => $isPinned,
147
-		]);
147
+		] );
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.
plugin/Controllers/PublicController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	public function filterEnqueuedScripts( $tag, $handle )
34 34
 	{
35 35
 		$scripts = [Application::ID.'/google-recaptcha'];
36
-		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) {
36
+		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) {
37 37
 			$tag = str_replace( ' src=', ' async src=', $tag );
38 38
 		}
39
-		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) {
39
+		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) {
40 40
 			$tag = str_replace( ' src=', ' defer src=', $tag );
41 41
 		}
42 42
 		return $tag;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function filterFieldOrder( array $config )
51 51
 	{
52
-		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ));
52
+		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) );
53 53
 		return array_intersect_key( array_merge( array_flip( $order ), $config ), $config );
54 54
 	}
55 55
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$validated = glsr( ValidateReview::class )->validate( $request );
102 102
 		$command = new CreateReview( $validated->request );
103
-		if( empty( $validated->error ) && !$validated->recaptchaIsUnset ) {
103
+		if( empty($validated->error) && !$validated->recaptchaIsUnset ) {
104 104
 			$this->execute( $command );
105 105
 		}
106 106
 		return $command;
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 2 patches
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function approve()
23 23
 	{
24
-		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
24
+		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID ) {
25
+			return;
26
+		}
25 27
 		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
26 28
 		wp_update_post([
27 29
 			'ID' => $postId,
@@ -59,7 +61,9 @@  discard block
 block discarded – undo
59 61
 		$columns = glsr( Helper::class )->consolidateArray( $columns );
60 62
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
61 63
 		foreach( $postTypeColumns as $key => &$value ) {
62
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
64
+			if( !array_key_exists( $key, $columns ) || !empty( $value )) {
65
+				continue;
66
+			}
63 67
 			$value = $columns[$key];
64 68
 		}
65 69
 		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) {
@@ -100,7 +104,8 @@  discard block
 block discarded – undo
100 104
 	 * @return array
101 105
 	 * @filter display_post_states
102 106
 	 */
103
-	public function filterPostStates( $postStates, WP_Post $post ) {
107
+	public function filterPostStates( $postStates, WP_Post $post )
108
+	{
104 109
 		$postStates = glsr( Helper::class )->consolidateArray( $postStates );
105 110
 		if( $post->post_type == Application::POST_TYPE && array_key_exists( 'pending', $postStates )) {
106 111
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
@@ -148,7 +153,9 @@  discard block
 block discarded – undo
148 153
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
149 154
 		unset( $postTypeColumns['cb'] );
150 155
 		foreach( $postTypeColumns as $key => $value ) {
151
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
156
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) {
157
+				continue;
158
+			}
152 159
 			$columns[$key] = $key;
153 160
 		}
154 161
 		return $columns;
@@ -172,7 +179,9 @@  discard block
 block discarded – undo
172 179
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
173 180
 			];
174 181
 			foreach( $strings as $search => $replace ) {
175
-				if( strpos( $single, $search ) === false )continue;
182
+				if( strpos( $single, $search ) === false ) {
183
+					continue;
184
+				}
176 185
 				$translation = $this->getTranslation([
177 186
 					'number' => $number,
178 187
 					'plural' => str_replace( $search, $replace, $plural ),
@@ -224,7 +233,9 @@  discard block
 block discarded – undo
224 233
 	 */
225 234
 	public function saveBulkEditFields( $postId )
226 235
 	{
227
-		if( !current_user_can( 'edit_posts' ))return;
236
+		if( !current_user_can( 'edit_posts' )) {
237
+			return;
238
+		}
228 239
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
229 240
 		if( $assignedTo && get_post( $assignedTo )) {
230 241
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -237,7 +248,9 @@  discard block
 block discarded – undo
237 248
 	 */
238 249
 	public function setQueryForColumn( WP_Query $query )
239 250
 	{
240
-		if( !$this->hasPermission( $query ))return;
251
+		if( !$this->hasPermission( $query )) {
252
+			return;
253
+		}
241 254
 		$this->setMetaQuery( $query, [
242 255
 			'rating', 'review_type',
243 256
 		]);
@@ -250,7 +263,9 @@  discard block
 block discarded – undo
250 263
 	 */
251 264
 	public function unapprove()
252 265
 	{
253
-		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
266
+		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID ) {
267
+			return;
268
+		}
254 269
 		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
255 270
 		wp_update_post([
256 271
 			'ID' => $postId,
@@ -310,7 +325,9 @@  discard block
 block discarded – undo
310 325
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
311 326
 	{
312 327
 		foreach( $metaKeys as $key ) {
313
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
328
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
329
+				continue;
330
+			}
314 331
 			$metaQuery = (array)$query->get( 'meta_query' );
315 332
 			$metaQuery[] = [
316 333
 				'key' => $key,
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	public function approve()
23 23
 	{
24 24
 		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
25
-		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
26
-		wp_update_post([
25
+		check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
26
+		wp_update_post( [
27 27
 			'ID' => $postId,
28 28
 			'post_status' => 'publish',
29
-		]);
29
+		] );
30 30
 		wp_safe_redirect( wp_get_referer() );
31 31
 		exit;
32 32
 	}
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 		$columns = glsr( Helper::class )->consolidateArray( $columns );
60 60
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
61 61
 		foreach( $postTypeColumns as $key => &$value ) {
62
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
62
+			if( !array_key_exists( $key, $columns ) || !empty($value) )continue;
63 63
 			$value = $columns[$key];
64 64
 		}
65
-		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) {
66
-			unset( $postTypeColumns['review_type'] );
65
+		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) {
66
+			unset($postTypeColumns['review_type']);
67 67
 		}
68 68
 		return array_filter( $postTypeColumns, 'strlen' );
69 69
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function filterPostStates( $postStates, WP_Post $post ) {
104 104
 		$postStates = glsr( Helper::class )->consolidateArray( $postStates );
105
-		if( $post->post_type == Application::POST_TYPE && array_key_exists( 'pending', $postStates )) {
105
+		if( $post->post_type == Application::POST_TYPE && array_key_exists( 'pending', $postStates ) ) {
106 106
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
107 107
 		}
108 108
 		return $postStates;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) {
119 119
 			return $actions;
120 120
 		}
121
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
121
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
122 122
 		$rowActions = [
123 123
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
124 124
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID ),
133 133
 					$key.'-review_'.$post->ID
134 134
 				),
135
-			]);
135
+			] );
136 136
 		}
137 137
 		return $newActions + glsr( Helper::class )->consolidateArray( $actions );
138 138
 	}
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	{
147 147
 		$columns = glsr( Helper::class )->consolidateArray( $columns );
148 148
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
149
-		unset( $postTypeColumns['cb'] );
149
+		unset($postTypeColumns['cb']);
150 150
 		foreach( $postTypeColumns as $key => $value ) {
151
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
151
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
152 152
 			$columns[$key] = $key;
153 153
 		}
154 154
 		return $columns;
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
168 168
 	{
169
-		if( $this->canModifyTranslation( $domain )) {
169
+		if( $this->canModifyTranslation( $domain ) ) {
170 170
 			$strings = [
171 171
 				'Published' => __( 'Approved', 'site-reviews' ),
172 172
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
173 173
 			];
174 174
 			foreach( $strings as $search => $replace ) {
175 175
 				if( strpos( $single, $search ) === false )continue;
176
-				$translation = $this->getTranslation([
176
+				$translation = $this->getTranslation( [
177 177
 					'number' => $number,
178 178
 					'plural' => str_replace( $search, $replace, $plural ),
179 179
 					'single' => str_replace( $search, $replace, $single ),
180
-				]);
180
+				] );
181 181
 			}
182 182
 		}
183 183
 		return $translation;
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	public function saveBulkEditFields( $postId )
226 226
 	{
227
-		if( !current_user_can( 'edit_posts' ))return;
227
+		if( !current_user_can( 'edit_posts' ) )return;
228 228
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
229
-		if( $assignedTo && get_post( $assignedTo )) {
229
+		if( $assignedTo && get_post( $assignedTo ) ) {
230 230
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
231 231
 		}
232 232
 	}
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function setQueryForColumn( WP_Query $query )
239 239
 	{
240
-		if( !$this->hasPermission( $query ))return;
240
+		if( !$this->hasPermission( $query ) )return;
241 241
 		$this->setMetaQuery( $query, [
242 242
 			'rating', 'review_type',
243
-		]);
243
+		] );
244 244
 		$this->setOrderby( $query );
245 245
 	}
246 246
 
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 	public function unapprove()
252 252
 	{
253 253
 		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
254
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
255
-		wp_update_post([
254
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
255
+		wp_update_post( [
256 256
 			'ID' => $postId,
257 257
 			'post_status' => 'pending',
258
-		]);
258
+		] );
259 259
 		wp_safe_redirect( wp_get_referer() );
260 260
 		exit;
261 261
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			'single' => '',
286 286
 			'text' => '',
287 287
 		];
288
-		$args = (object) wp_parse_args( $args, $defaults );
288
+		$args = (object)wp_parse_args( $args, $defaults );
289 289
 		$translations = get_translations_for_domain( Application::ID );
290 290
 		return $args->text
291 291
 			? $translations->translate( $args->text )
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
311 311
 	{
312 312
 		foreach( $metaKeys as $key ) {
313
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
313
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
314 314
 			$metaQuery = (array)$query->get( 'meta_query' );
315 315
 			$metaQuery[] = [
316 316
 				'key' => $key,
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	{
328 328
 		$orderby = $query->get( 'orderby' );
329 329
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
330
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
331
-		if( in_array( $orderby, array_keys( $columns ))) {
330
+		unset($columns['cb'], $columns['title'], $columns['date']);
331
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
332 332
 			if( $orderby == 'reviewer' ) {
333 333
 				$orderby = 'author';
334 334
 			}
Please login to merge, or discard this patch.