Test Failed
Push — master ( 8dc102...1ef8c4 )
by Paul
03:41
created
plugin/Modules/Html/Builder.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$instance = new static;
57 57
 		$instance->setTagFromMethod( $method );
58
-		call_user_func_array( [$instance, 'normalize'], $args += ['',''] );
58
+		call_user_func_array( [$instance, 'normalize'], $args += ['', ''] );
59 59
 		$tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT );
60 60
 		do_action_ref_array( 'site-reviews/builder', [&$instance] );
61 61
 		$generatedTag = in_array( $instance->tag, $tags )
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 			'render' => 'is_bool',
80 80
 			'tag' => 'is_string',
81 81
 		];
82
-		if( !isset( $properties[$property] )
83
-			|| empty( array_filter( [$value], $properties[$property] ))
82
+		if( !isset($properties[$property])
83
+			|| empty(array_filter( [$value], $properties[$property] ))
84 84
 		)return;
85 85
 		$this->$property = $value;
86 86
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function getClosingTag()
92 92
 	{
93
-		if( empty( $this->tag ))return;
93
+		if( empty($this->tag) )return;
94 94
 		return '</'.$this->tag.'>';
95 95
 	}
96 96
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function getOpeningTag()
101 101
 	{
102
-		if( empty( $this->tag ))return;
103
-		$attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString();
102
+		if( empty($this->tag) )return;
103
+		$attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString();
104 104
 		return '<'.trim( $this->tag.' '.$attributes ).'>';
105 105
 	}
106 106
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function raw( array $field )
111 111
 	{
112
-		unset( $field['label'] );
113
-		return $this->{$field['type']}( $field );
112
+		unset($field['label']);
113
+		return $this->{$field['type']}($field);
114 114
 	}
115 115
 
116 116
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	protected function buildCustomField()
120 120
 	{
121 121
 		$className = $this->getCustomFieldClassName();
122
-		if( class_exists( $className )) {
122
+		if( class_exists( $className ) ) {
123 123
 			return (new $className( $this ))->build();
124 124
 		}
125 125
 		glsr_log()->error( 'Field missing: '.$className );
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected function buildDefaultTag( $text = '' )
132 132
 	{
133
-		if( empty( $text )) {
133
+		if( empty($text) ) {
134 134
 			$text = $this->args['text'];
135 135
 		}
136 136
 		return $this->getOpeningTag().$text.$this->getClosingTag();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function buildFieldDescription()
143 143
 	{
144
-		if( empty( $this->args['description'] ))return;
144
+		if( empty($this->args['description']) )return;
145 145
 		if( $this->args['is_widget'] ) {
146 146
 			return $this->small( $this->args['description'] );
147 147
 		}
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function buildFormInput()
155 155
 	{
156
-		if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) {
157
-			if( isset( $this->args['multiple'] )) {
158
-				$this->args['name'].= '[]';
156
+		if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) {
157
+			if( isset($this->args['multiple']) ) {
158
+				$this->args['name'] .= '[]';
159 159
 			}
160 160
 			return $this->buildFormLabel().$this->getOpeningTag();
161 161
 		}
162
-		return empty( $this->args['options'] )
162
+		return empty($this->args['options'])
163 163
 			? $this->buildFormInputChoice()
164 164
 			: $this->buildFormInputMultiChoice();
165 165
 	}
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function buildFormInputChoice()
171 171
 	{
172
-		if( !empty( $this->args['text'] )) {
172
+		if( !empty($this->args['text']) ) {
173 173
 			$this->args['label'] = $this->args['text'];
174 174
 		}
175
-		return $this->getOpeningTag().$this->buildFormLabel([
175
+		return $this->getOpeningTag().$this->buildFormLabel( [
176 176
 			'class' => 'glsr-'.$this->args['type'].'-label',
177 177
 			'text' => $this->args['label'].'<span></span>',
178
-		]);
178
+		] );
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,22 +184,22 @@  discard block
 block discarded – undo
184 184
 	protected function buildFormInputMultiChoice()
185 185
 	{
186 186
 		if( $this->args['type'] == 'checkbox' ) {
187
-			$this->args['name'].= '[]';
187
+			$this->args['name'] .= '[]';
188 188
 		}
189 189
 		$index = 0;
190
-		$options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) use( &$index ) {
190
+		$options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) use(&$index) {
191 191
 			return $carry.$this->li( $this->{$this->args['type']}([
192 192
 				'checked' => in_array( $key, (array)$this->args['value'] ),
193 193
 				'id' => $this->args['id'].'-'.$index++,
194 194
 				'name' => $this->args['name'],
195 195
 				'text' => $this->args['options'][$key],
196 196
 				'value' => $key,
197
-			]));
197
+			]) );
198 198
 		});
199 199
 		return $this->ul( $options, [
200 200
 			'class' => $this->args['class'],
201 201
 			'id' => $this->args['id'],
202
-		]);
202
+		] );
203 203
 	}
204 204
 
205 205
 	/**
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function buildFormLabel( array $customArgs = [] )
209 209
 	{
210
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
210
+		if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return;
211 211
 		return $this->label( wp_parse_args( $customArgs, [
212 212
 			'for' => $this->args['id'],
213 213
 			'is_public' => $this->args['is_public'],
214 214
 			'text' => $this->args['label'],
215 215
 			'type' => $this->args['type'],
216
-		]));
216
+		] ) );
217 217
 	}
218 218
 
219 219
 	/**
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	protected function buildFormSelectOptions()
231 231
 	{
232 232
 		return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
233
-			return $carry.$this->option([
233
+			return $carry.$this->option( [
234 234
 				'selected' => $this->args['value'] == $key,
235 235
 				'text' => $this->args['options'][$key],
236 236
 				'value' => $key,
237
-			]);
237
+			] );
238 238
 		});
239 239
 	}
240 240
 
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	protected function buildTag()
253 253
 	{
254 254
 		$this->mergeArgsWithRequiredDefaults();
255
-		if( in_array( $this->tag, static::TAGS_SINGLE )) {
255
+		if( in_array( $this->tag, static::TAGS_SINGLE ) ) {
256 256
 			return $this->getOpeningTag();
257 257
 		}
258
-		if( !in_array( $this->tag, static::TAGS_FORM )) {
258
+		if( !in_array( $this->tag, static::TAGS_FORM ) ) {
259 259
 			return $this->buildDefaultTag();
260 260
 		}
261 261
 		return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription();
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	protected function mergeArgsWithRequiredDefaults()
276 276
 	{
277 277
 		$className = $this->getCustomFieldClassName();
278
-		if( class_exists( $className )) {
278
+		if( class_exists( $className ) ) {
279 279
 			$this->args = array_merge(
280 280
 				wp_parse_args( $this->args, $className::defaults() ),
281 281
 				$className::required()
@@ -290,16 +290,16 @@  discard block
 block discarded – undo
290 290
 	 */
291 291
 	protected function normalize( ...$params )
292 292
 	{
293
-		if( is_string( $params[0] ) || is_numeric( $params[0] )) {
293
+		if( is_string( $params[0] ) || is_numeric( $params[0] ) ) {
294 294
 			$this->setNameOrTextAttributeForTag( $params[0] );
295 295
 		}
296
-		if( is_array( $params[0] )) {
296
+		if( is_array( $params[0] ) ) {
297 297
 			$this->args += $params[0];
298 298
 		}
299
-		else if( is_array( $params[1] )) {
299
+		else if( is_array( $params[1] ) ) {
300 300
 			$this->args += $params[1];
301 301
 		}
302
-		if( !isset( $this->args['is_public'] )) {
302
+		if( !isset($this->args['is_public']) ) {
303 303
 			$this->args['is_public'] = false;
304 304
 		}
305 305
 	}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	protected function setTagFromMethod( $method )
324 324
 	{
325 325
 		$this->tag = strtolower( $method );
326
-		if( in_array( $this->tag, static::INPUT_TYPES )) {
326
+		if( in_array( $this->tag, static::INPUT_TYPES ) ) {
327 327
 			$this->args['type'] = $this->tag;
328 328
 			$this->tag = 'input';
329 329
 		}
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 1 patch
Spacing   +4 added lines, -4 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
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function settings()
48 48
 	{
49
-		$settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ));
49
+		$settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) );
50 50
 		return $this->normalize( $settings );
51 51
 	}
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	protected function normalize( array $settings )
57 57
 	{
58 58
 		array_walk( $settings, function( &$setting ) {
59
-			if( isset( $setting['default'] ))return;
59
+			if( isset($setting['default']) )return;
60 60
 			$setting['default'] = '';
61 61
 		});
62 62
 		return $settings;
Please login to merge, or discard this patch.
plugin/Actions.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -48,55 +48,55 @@
 block discarded – undo
48 48
 	 */
49 49
 	public function run()
50 50
 	{
51
-		add_action( 'admin_enqueue_scripts',                        [$this->admin, 'enqueueAssets'] );
52
-		add_action( 'admin_init',                                   [$this->admin, 'registerShortcodeButtons'] );
53
-		add_action( 'edit_form_after_title',                        [$this->admin, 'renderReviewEditor'] );
54
-		add_action( 'edit_form_top',                                [$this->admin, 'renderReviewNotice'] );
55
-		add_action( 'media_buttons',                                [$this->admin, 'renderTinymceButton'], 11 );
56
-		add_action( 'plugins_loaded',                               [$this->app, 'getDefaults'], 11 );
57
-		add_action( 'plugins_loaded',                               [$this->app, 'registerAddons'] );
58
-		add_action( 'plugins_loaded',                               [$this->app, 'registerLanguages'] );
59
-		add_action( 'plugins_loaded',                               [$this->app, 'registerReviewTypes'] );
60
-		add_action( 'upgrader_process_complete',                    [$this->app, 'upgraded'], 10, 2 );
61
-		add_action( 'admin_enqueue_scripts',                        [$this->editor, 'customizePostStatusLabels'] );
62
-		add_action( 'before_delete_post',                           [$this->editor, 'onBeforeDeleteReview'] );
63
-		add_action( 'update_postmeta',                              [$this->editor, 'onBeforeUpdateReview'], 10, 4 );
64
-		add_action( 'site-reviews/create/review',                   [$this->editor, 'onCreateReview'], 10, 3 );
65
-		add_action( 'transition_post_status',                       [$this->editor, 'onReviewStatusChange'], 10, 3 );
66
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->editor, 'onSaveReview'], 20, 3 );
67
-		add_action( 'add_meta_boxes',                               [$this->editor, 'registerMetaBoxes'] );
68
-		add_action( 'admin_print_scripts',                          [$this->editor, 'removeAutosave'], 999 );
69
-		add_action( 'admin_menu',                                   [$this->editor, 'removeMetaBoxes'] );
70
-		add_action( 'post_submitbox_misc_actions',                  [$this->editor, 'renderPinnedInPublishMetaBox'] );
71
-		add_action( 'admin_action_revert',                          [$this->editor, 'revertReview'] );
72
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->editor, 'saveMetaboxes'] );
73
-		add_action( 'admin_action_approve',                         [$this->listtable, 'approve'] );
74
-		add_action( 'bulk_edit_custom_box',                         [$this->listtable, 'renderBulkEditFields'], 10, 2 );
75
-		add_action( 'restrict_manage_posts',                        [$this->listtable, 'renderColumnFilters'] );
76
-		add_action( 'manage_posts_custom_column',                   [$this->listtable, 'renderColumnValues'], 10, 2 );
77
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->listtable, 'saveBulkEditFields'] );
78
-		add_action( 'pre_get_posts',                                [$this->listtable, 'setQueryForColumn'] );
79
-		add_action( 'admin_action_unapprove',                       [$this->listtable, 'unapprove'] );
80
-		add_action( 'init',                                         [$this->main, 'registerPostType'], 8 );
81
-		add_action( 'init',                                         [$this->main, 'registerShortcodes'] );
82
-		add_action( 'init',                                         [$this->main, 'registerTaxonomy'] );
83
-		add_action( 'widgets_init',                                 [$this->main, 'registerWidgets'] );
84
-		add_action( 'admin_menu',                                   [$this->menu, 'registerMenuCount'] );
85
-		add_action( 'admin_menu',                                   [$this->menu, 'registerSubMenus'] );
86
-		add_action( 'admin_init',                                   [$this->menu, 'setCustomPermissions'], 999 );
87
-		add_action( 'wp_enqueue_scripts',                           [$this->public, 'enqueueAssets'], 999 );
88
-		add_filter( 'site-reviews/builder',                         [$this->public, 'modifyBuilder'] );
89
-		add_action( 'wp_footer',                                    [$this->public, 'renderSchema'] );
90
-		add_action( 'admin_init',                                   [$this->router, 'routeAdminPostRequest'] );
91
-		add_action( 'wp_ajax_'.Application::PREFIX.'action',        [$this->router, 'routeAjaxRequest'] );
51
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
52
+		add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] );
53
+		add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] );
54
+		add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] );
55
+		add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
56
+		add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
57
+		add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
58
+		add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
59
+		add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
60
+		add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
61
+		add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
62
+		add_action( 'before_delete_post', [$this->editor, 'onBeforeDeleteReview'] );
63
+		add_action( 'update_postmeta', [$this->editor, 'onBeforeUpdateReview'], 10, 4 );
64
+		add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 );
65
+		add_action( 'transition_post_status', [$this->editor, 'onReviewStatusChange'], 10, 3 );
66
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 3 );
67
+		add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] );
68
+		add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
69
+		add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
70
+		add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
71
+		add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
72
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
73
+		add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
74
+		add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
75
+		add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
76
+		add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 );
77
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
78
+		add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
79
+		add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
80
+		add_action( 'init', [$this->main, 'registerPostType'], 8 );
81
+		add_action( 'init', [$this->main, 'registerShortcodes'] );
82
+		add_action( 'init', [$this->main, 'registerTaxonomy'] );
83
+		add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
84
+		add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
85
+		add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
86
+		add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 );
87
+		add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 );
88
+		add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] );
89
+		add_action( 'wp_footer', [$this->public, 'renderSchema'] );
90
+		add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
91
+		add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
92 92
 		add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
93
-		add_action( 'init',                                         [$this->router, 'routePublicPostRequest'] );
94
-		add_action( 'site-reviews/schedule/session/purge',          [$this->session, 'deleteExpiredSessions'] );
95
-		add_action( 'admin_init',                                   [$this->settings, 'registerSettings'] );
96
-		add_action( Application::TAXONOMY.'_term_edit_form_top',    [$this->taxonomy, 'disableParents'] );
97
-		add_action( Application::TAXONOMY.'_term_new_form_tag',     [$this->taxonomy, 'disableParents'] );
98
-		add_action( Application::TAXONOMY.'_add_form_fields',       [$this->taxonomy, 'enableParents'] );
99
-		add_action( Application::TAXONOMY.'_edit_form',             [$this->taxonomy, 'enableParents'] );
100
-		add_action( 'restrict_manage_posts',                        [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
93
+		add_action( 'init', [$this->router, 'routePublicPostRequest'] );
94
+		add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] );
95
+		add_action( 'admin_init', [$this->settings, 'registerSettings'] );
96
+		add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] );
97
+		add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] );
98
+		add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] );
99
+		add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] );
100
+		add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
101 101
 	}
102 102
 }
Please login to merge, or discard this patch.
plugin/Modules/Style.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 			'templates/form/submit-button',
38 38
 			'templates/reviews-form',
39 39
 		];
40
-		if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) {
40
+		if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) {
41 41
 			return $view;
42 42
 		}
43 43
 		$views = $this->generatePossibleViews( $view );
44 44
 		foreach( $views as $possibleView ) {
45
-			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' )))continue;
45
+			if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' ) ) )continue;
46 46
 			return $possibleView;
47 47
 		}
48 48
 		return $view;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function modifyField( Builder $instance )
78 78
 	{
79
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->styles )))return;
79
+		if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->styles )) )return;
80 80
 		call_user_func_array( [$this, 'customize'], [&$instance] );
81 81
 	}
82 82
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	protected function customize( Builder $instance )
87 87
 	{
88
-		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
88
+		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) );
89 89
 		$key = $instance->tag.'_'.$args['type'];
90
-		$classes = !isset( $this->styles[$key] )
90
+		$classes = !isset($this->styles[$key])
91 91
 			? $this->styles[$instance->tag]
92 92
 			: $this->styles[$key];
93 93
 		$instance->args['class'] = trim( $args['class'].' '.$classes );
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$args = wp_parse_args( $instance->args, [
122 122
 			'is_public' => false,
123 123
 			'is_raw' => false,
124
-		]);
124
+		] );
125 125
 		if( is_admin() || !$args['is_public'] || $args['is_raw'] ) {
126 126
 			return false;
127 127
 		}
Please login to merge, or discard this patch.
compatibility.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) {
11 11
 	$scriptHandles[] = 'site-reviews/google-recaptcha';
12
-	return array_keys( array_flip( $scriptHandles ));
12
+	return array_keys( array_flip( $scriptHandles ) );
13 13
 });
14 14
 
15 15
 /**
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function enqueueAssets()
26 26
 	{
27
-		$command = new EnqueueAdminAssets([
27
+		$command = new EnqueueAdminAssets( [
28 28
 			'pointers' => [[
29 29
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
30 30
 				'id' => 'glsr-pointer-pinned',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				'target' => '#misc-pub-pinned',
37 37
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
38 38
 			]],
39
-		]);
39
+		] );
40 40
 		$this->execute( $command );
41 41
 	}
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		$links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
50 50
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
51
-		]);
51
+		] );
52 52
 		return $links;
53 53
 	}
54 54
 
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
 	public function filterDashboardGlanceItems( array $items )
60 60
 	{
61 61
 		$postCount = wp_count_posts( Application::POST_TYPE );
62
-		if( empty( $postCount->publish )) {
62
+		if( empty($postCount->publish) ) {
63 63
 			return $items;
64 64
 		}
65 65
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
66
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
66
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
67 67
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
68 68
 			? glsr( Builder::class )->a( $text, [
69 69
 				'class' => 'glsr-review-count',
70 70
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
71
-			])
71
+			] )
72 72
 			: glsr( Builder::class )->span( $text, [
73 73
 				'class' => 'glsr-review-count',
74
-			]);
74
+			] );
75 75
 		return $items;
76 76
 	}
77 77
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function filterTinymcePlugins( array $plugins )
83 83
 	{
84 84
 		if( user_can_richedit()
85
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
85
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
86 86
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
87 87
 		}
88 88
 		return $plugins;
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function registerShortcodeButtons()
96 96
 	{
97
-		$command = new RegisterShortcodeButtons([
97
+		$command = new RegisterShortcodeButtons( [
98 98
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
99 99
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
100 100
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
101
-		]);
101
+		] );
102 102
 		$this->execute( $command );
103 103
 	}
104 104
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function renderReviewEditor( WP_Post $post )
110 110
 	{
111
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
111
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
112 112
 		glsr()->render( 'partials/editor/review', [
113 113
 			'post' => $post,
114
-		]);
114
+		] );
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function renderReviewNotice( WP_Post $post )
122 122
 	{
123
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
124
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
123
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
124
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
125 125
 		glsr( Html::class )->renderTemplate( 'partials/editor/notice', [
126 126
 			'context' => [
127 127
 				'notices' => glsr( Notice::class )->get(),
128 128
 			],
129
-		]);
129
+		] );
130 130
 	}
131 131
 
132 132
 	/**
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 		if( glsr_current_screen()->base != 'post' )return;
139 139
 		$shortcodes = [];
140 140
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
141
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
141
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
142 142
 			$shortcodes[$shortcode] = $values;
143 143
 		}
144
-		if( empty( $shortcodes ))return;
144
+		if( empty($shortcodes) )return;
145 145
 		glsr()->render( 'partials/editor/tinymce', [
146 146
 			'shortcodes' => $shortcodes,
147
-		]);
147
+		] );
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	public function routerClearConsole()
154 154
 	{
155 155
 		glsr( Console::class )->clear();
156
-		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ));
156
+		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
157 157
 	}
158 158
 
159 159
 	/**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	{
164 164
 		$counts = glsr( CountsManager::class )->buildCounts();
165 165
 		glsr( OptionManager::class )->set( 'counts', $counts );
166
-		glsr( Notice::class )->addSuccess( __( 'Recalculated review counts.', 'site-reviews' ));
166
+		glsr( Notice::class )->addSuccess( __( 'Recalculated review counts.', 'site-reviews' ) );
167 167
 	}
168 168
 
169 169
 	/**
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 	{
198 198
 		$file = $_FILES['import-file'];
199 199
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
200
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
200
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
201 201
 		}
202
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
203
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
202
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
203
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
204 204
 		}
205 205
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
206
-		if( empty( $settings )) {
207
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
206
+		if( empty($settings) ) {
207
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
208 208
 		}
209
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
210
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
209
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
210
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
211 211
 	}
212 212
 
213 213
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
226 226
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
227 227
 		];
228
-		return !isset( $errors[$errorCode] )
228
+		return !isset($errors[$errorCode])
229 229
 			? __( 'Unknown upload error.', 'site-reviews' )
230 230
 			: $errors[$errorCode];
231 231
 	}
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function decrease( array $reviewCounts, $type, $rating )
48 48
 	{
49
-		if( isset( $reviewCounts[$type][$rating] )) {
49
+		if( isset($reviewCounts[$type][$rating]) ) {
50 50
 			$reviewCounts[$type][$rating] = max( 0, $reviewCounts[$type][$rating] - 1 );
51 51
 		}
52 52
 		return $reviewCounts;
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	public function flatten( array $reviewCounts )
59 59
 	{
60 60
 		$counts = [];
61
-		array_walk_recursive( $reviewCounts, function( $num, $index ) use( &$counts ) {
62
-			$counts[$index] = isset( $counts[$index] )
61
+		array_walk_recursive( $reviewCounts, function( $num, $index ) use(&$counts) {
62
+			$counts[$index] = isset($counts[$index])
63 63
 				? $num + $counts[$index]
64 64
 				: $num;
65 65
 		});
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function increase( array $reviewCounts, $type, $rating )
101 101
 	{
102
-		if( !array_key_exists( $type, glsr()->reviewTypes )) {
102
+		if( !array_key_exists( $type, glsr()->reviewTypes ) ) {
103 103
 			return $reviewCounts;
104 104
 		}
105
-		if( !array_key_exists( $type, $reviewCounts )) {
105
+		if( !array_key_exists( $type, $reviewCounts ) ) {
106 106
 			$reviewCounts[$type] = [];
107 107
 		}
108 108
 		$reviewCounts = $this->normalize( $reviewCounts );
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 		$counts = [];
120 120
 		$lastPostId = 0;
121
-		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
122
-			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
121
+		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit ) ) {
122
+			$types = array_keys( array_flip( array_column( $reviews, 'type' ) ) );
123 123
 			foreach( $types as $type ) {
124
-				if( isset( $counts[$type] ))continue;
124
+				if( isset($counts[$type]) )continue;
125 125
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
126 126
 			}
127 127
 			foreach( $reviews as $review ) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	{
140 140
 		foreach( $reviewCounts as &$counts ) {
141 141
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
142
-				if( isset( $counts[$index] ))continue;
142
+				if( isset($counts[$index]) )continue;
143 143
 				$counts[$index] = 0;
144 144
 			}
145 145
 			ksort( $counts );
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	protected function queryReviews( array $args = [], $lastPostId, $limit )
156 156
 	{
157
-		$args = wp_parse_args( $args, array_fill_keys( ['post_id', 'term_id'], '' ));
158
-		if( empty( array_filter( $args ))) {
157
+		$args = wp_parse_args( $args, array_fill_keys( ['post_id', 'term_id'], '' ) );
158
+		if( empty(array_filter( $args )) ) {
159 159
 			return glsr( SqlQueries::class )->getCounts( $lastPostId, $limit );
160 160
 		}
161
-		if( !empty( $args['post_id'] )) {
161
+		if( !empty($args['post_id']) ) {
162 162
 			return glsr( SqlQueries::class )->getPostCounts( $args['post_id'], $lastPostId, $limit );
163 163
 		}
164
-		if( !empty( $args['term_id'] )) {
164
+		if( !empty($args['term_id']) ) {
165 165
 			return glsr( SqlQueries::class )->getTermCounts( $args['term_id'], $lastPostId, $limit );
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.