Passed
Push — master ( ed8579...f866b8 )
by Paul
05:30
created
helpers.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 function glsr( $alias = null ) {
8 8
 	$app = \GeminiLabs\SiteReviews\Application::load();
9
-	return !empty( $alias )
9
+	return !empty($alias)
10 10
 		? $app->make( $alias )
11 11
 		: $app;
12 12
 }
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @return false|\GeminiLabs\SiteReviews\Review
16 16
  */
17 17
 function glsr_create_review( array $reviewValues = [] ) {
18
-	if( empty( $reviewValues )) {
18
+	if( empty($reviewValues) ) {
19 19
 		return false;
20 20
 	}
21 21
 	$review = new \GeminiLabs\SiteReviews\Commands\CreateReview( $reviewValues );
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
  * @return \WP_Screen|object
27 27
  */
28 28
 function glsr_current_screen() {
29
-	if( function_exists( 'get_current_screen' )) {
29
+	if( function_exists( 'get_current_screen' ) ) {
30 30
 		$screen = get_current_screen();
31 31
 	}
32
-	return empty( $screen )
32
+	return empty($screen)
33 33
 		? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
34 34
 		: $screen;
35 35
 }
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
  */
93 93
 function glsr_log() {
94 94
 	$args = func_get_args();
95
-	$context = isset( $args[1] )
95
+	$context = isset($args[1])
96 96
 		? $args[1]
97 97
 		: [];
98 98
 	$console = glsr( 'Modules\Console' );
99
-	return !empty( $args )
99
+	return !empty($args)
100 100
 		? $console->log( 'debug', $args[0], $context )
101 101
 		: $console;
102 102
 }
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
@@ -51,55 +51,55 @@
 block discarded – undo
51 51
 	 */
52 52
 	public function run()
53 53
 	{
54
-		add_action( 'admin_enqueue_scripts',                        [$this->admin, 'enqueueAssets'] );
55
-		add_action( 'admin_init',                                   [$this->admin, 'registerTinymcePopups'] );
56
-		add_action( 'edit_form_after_title',                        [$this->admin, 'renderReviewEditor'] );
57
-		add_action( 'edit_form_top',                                [$this->admin, 'renderReviewNotice'] );
58
-		add_action( 'media_buttons',                                [$this->admin, 'renderTinymceButton'], 11 );
59
-		add_action( 'plugins_loaded',                               [$this->app, 'getDefaults'], 11 );
60
-		add_action( 'plugins_loaded',                               [$this->app, 'registerAddons'] );
61
-		add_action( 'plugins_loaded',                               [$this->app, 'registerLanguages'] );
62
-		add_action( 'plugins_loaded',                               [$this->app, 'registerReviewTypes'] );
63
-		add_action( 'upgrader_process_complete',                    [$this->app, 'upgraded'], 10, 2 );
64
-		add_action( 'admin_enqueue_scripts',                        [$this->editor, 'customizePostStatusLabels'] );
65
-		add_action( 'add_meta_boxes',                               [$this->editor, 'registerMetaBoxes'] );
66
-		add_action( 'admin_print_scripts',                          [$this->editor, 'removeAutosave'], 999 );
67
-		add_action( 'admin_menu',                                   [$this->editor, 'removeMetaBoxes'] );
68
-		add_action( 'post_submitbox_misc_actions',                  [$this->editor, 'renderPinnedInPublishMetaBox'] );
69
-		add_action( 'admin_action_revert',                          [$this->editor, 'revertReview'] );
70
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->editor, 'saveMetaboxes'] );
71
-		add_action( 'admin_action_approve',                         [$this->listtable, 'approve'] );
72
-		add_action( 'bulk_edit_custom_box',                         [$this->listtable, 'renderBulkEditFields'], 10, 2 );
73
-		add_action( 'restrict_manage_posts',                        [$this->listtable, 'renderColumnFilters'] );
74
-		add_action( 'manage_posts_custom_column',                   [$this->listtable, 'renderColumnValues'], 10, 2 );
75
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->listtable, 'saveBulkEditFields'] );
76
-		add_action( 'pre_get_posts',                                [$this->listtable, 'setQueryForColumn'] );
77
-		add_action( 'admin_action_unapprove',                       [$this->listtable, 'unapprove'] );
78
-		add_action( 'init',                                         [$this->main, 'registerPostType'], 8 );
79
-		add_action( 'init',                                         [$this->main, 'registerShortcodes'] );
80
-		add_action( 'init',                                         [$this->main, 'registerTaxonomy'] );
81
-		add_action( 'widgets_init',                                 [$this->main, 'registerWidgets'] );
82
-		add_action( 'admin_menu',                                   [$this->menu, 'registerMenuCount'] );
83
-		add_action( 'admin_menu',                                   [$this->menu, 'registerSubMenus'] );
84
-		add_action( 'admin_init',                                   [$this->menu, 'setCustomPermissions'], 999 );
85
-		add_action( 'wp_enqueue_scripts',                           [$this->public, 'enqueueAssets'], 999 );
86
-		add_filter( 'site-reviews/builder',                         [$this->public, 'modifyBuilder'] );
87
-		add_action( 'wp_footer',                                    [$this->public, 'renderSchema'] );
88
-		add_action( 'set_object_terms',                             [$this->review, 'onAfterChangeCategory'], 10, 6 );
89
-		add_action( 'site-reviews/create/review',                   [$this->review, 'onAfterCreate'], 10, 3 );
90
-		add_action( 'before_delete_post',                           [$this->review, 'onBeforeDelete'] );
91
-		add_action( 'update_postmeta',                              [$this->review, 'onBeforeUpdate'], 10, 4 );
92
-		add_action( 'transition_post_status',                       [$this->review, 'onChangeStatus'], 10, 3 );
93
-		add_action( 'admin_init',                                   [$this->router, 'routeAdminPostRequest'] );
94
-		add_action( 'wp_ajax_'.Application::PREFIX.'action',        [$this->router, 'routeAjaxRequest'] );
54
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
55
+		add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] );
56
+		add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] );
57
+		add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] );
58
+		add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
59
+		add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
60
+		add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
61
+		add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
62
+		add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
63
+		add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
64
+		add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
65
+		add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] );
66
+		add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
67
+		add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
68
+		add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
69
+		add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
70
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
71
+		add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
72
+		add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
73
+		add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
74
+		add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 );
75
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
76
+		add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
77
+		add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
78
+		add_action( 'init', [$this->main, 'registerPostType'], 8 );
79
+		add_action( 'init', [$this->main, 'registerShortcodes'] );
80
+		add_action( 'init', [$this->main, 'registerTaxonomy'] );
81
+		add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
82
+		add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
83
+		add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
84
+		add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 );
85
+		add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 );
86
+		add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] );
87
+		add_action( 'wp_footer', [$this->public, 'renderSchema'] );
88
+		add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 );
89
+		add_action( 'site-reviews/create/review', [$this->review, 'onAfterCreate'], 10, 3 );
90
+		add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] );
91
+		add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 );
92
+		add_action( 'transition_post_status', [$this->review, 'onChangeStatus'], 10, 3 );
93
+		add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
94
+		add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
95 95
 		add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
96
-		add_action( 'init',                                         [$this->router, 'routePublicPostRequest'] );
97
-		add_action( 'site-reviews/schedule/session/purge',          [$this->session, 'deleteExpiredSessions'] );
98
-		add_action( 'admin_init',                                   [$this->settings, 'registerSettings'] );
99
-		add_action( Application::TAXONOMY.'_term_edit_form_top',    [$this->taxonomy, 'disableParents'] );
100
-		add_action( Application::TAXONOMY.'_term_new_form_tag',     [$this->taxonomy, 'disableParents'] );
101
-		add_action( Application::TAXONOMY.'_add_form_fields',       [$this->taxonomy, 'enableParents'] );
102
-		add_action( Application::TAXONOMY.'_edit_form',             [$this->taxonomy, 'enableParents'] );
103
-		add_action( 'restrict_manage_posts',                        [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
96
+		add_action( 'init', [$this->router, 'routePublicPostRequest'] );
97
+		add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] );
98
+		add_action( 'admin_init', [$this->settings, 'registerSettings'] );
99
+		add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] );
100
+		add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] );
101
+		add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] );
102
+		add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] );
103
+		add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
104 104
 	}
105 105
 }
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function enqueueAssets()
27 27
 	{
28
-		$command = new EnqueueAdminAssets([
28
+		$command = new EnqueueAdminAssets( [
29 29
 			'pointers' => [[
30 30
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
31 31
 				'id' => 'glsr-pointer-pinned',
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				'target' => '#misc-pub-pinned',
38 38
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
39 39
 			]],
40
-		]);
40
+		] );
41 41
 		$this->execute( $command );
42 42
 	}
43 43
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	{
50 50
 		$links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
51 51
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
52
-		]);
52
+		] );
53 53
 		return $links;
54 54
 	}
55 55
 
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
 	public function filterDashboardGlanceItems( array $items )
61 61
 	{
62 62
 		$postCount = wp_count_posts( Application::POST_TYPE );
63
-		if( empty( $postCount->publish )) {
63
+		if( empty($postCount->publish) ) {
64 64
 			return $items;
65 65
 		}
66 66
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
67
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
67
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
68 68
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
69 69
 			? glsr( Builder::class )->a( $text, [
70 70
 				'class' => 'glsr-review-count',
71 71
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
72
-			])
72
+			] )
73 73
 			: glsr( Builder::class )->span( $text, [
74 74
 				'class' => 'glsr-review-count',
75
-			]);
75
+			] );
76 76
 		return $items;
77 77
 	}
78 78
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function filterTinymcePlugins( array $plugins )
84 84
 	{
85
-		if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) {
85
+		if( 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 registerTinymcePopups()
96 96
 	{
97
-		$command = new RegisterTinymcePopups([
97
+		$command = new RegisterTinymcePopups( [
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( Template::class )->render( 'partials/editor/notice', [
126 126
 			'context' => [
127 127
 				'notices' => glsr( Notice::class )->get(),
128 128
 			],
129
-		]);
129
+		] );
130 130
 	}
131 131
 
132 132
 	/**
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
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 routerClearConsole()
153 153
 	{
154 154
 		glsr( Console::class )->clear();
155
-		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ));
155
+		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
156 156
 	}
157 157
 
158 158
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function routerFetchConsole()
162 162
 	{
163
-		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ));
163
+		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) );
164 164
 	}
165 165
 
166 166
 	/**
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
 	public function routerCountReviews( $showNotice = true )
171 171
 	{
172 172
 		$countManager = glsr( CountsManager::class );
173
-		$terms = get_terms([
173
+		$terms = get_terms( [
174 174
 			'hide_empty' => true,
175 175
 			'taxonomy' => Application::TAXONOMY,
176
-		]);
176
+		] );
177 177
 		foreach( $terms as $term ) {
178
-			$countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ));
178
+			$countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) );
179 179
 		}
180 180
 		$postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
181 181
 		foreach( $postIds as $postId ) {
182
-			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ));
182
+			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) );
183 183
 		}
184 184
 		$countManager->setCounts( $countManager->buildCounts() );
185 185
 		if( $showNotice ) {
186
-			glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ));
186
+			glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) );
187 187
 		}
188 188
 	}
189 189
 
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
 	{
219 219
 		$file = $_FILES['import-file'];
220 220
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
221
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
221
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
222 222
 		}
223
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
224
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
223
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
224
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
225 225
 		}
226 226
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
227
-		if( empty( $settings )) {
228
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
227
+		if( empty($settings) ) {
228
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
229 229
 		}
230
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
231
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
230
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
231
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
232 232
 	}
233 233
 
234 234
 	/**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
247 247
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
248 248
 		];
249
-		return !isset( $errors[$errorCode] )
249
+		return !isset($errors[$errorCode])
250 250
 			? __( 'Unknown upload error.', 'site-reviews' )
251 251
 			: $errors[$errorCode];
252 252
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsPopup.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	public function fields()
14 14
 	{
15 15
 		return [[
16
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
16
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
17 17
 			'minWidth' => 320,
18 18
 			'type' => 'container',
19
-		],[
19
+		], [
20 20
 			'label' => esc_html__( 'Title', 'site-reviews' ),
21 21
 			'name' => 'title',
22 22
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
23 23
 			'type' => 'textbox',
24
-		],[
24
+		], [
25 25
 			'label' => esc_html__( 'Count', 'site-reviews' ),
26 26
 			'maxLength' => 5,
27 27
 			'name' => 'count',
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 			'text' => '10',
30 30
 			'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
31 31
 			'type' => 'textbox',
32
-		],[
32
+		], [
33 33
 			'label' => esc_html__( 'Rating', 'site-reviews' ),
34 34
 			'name' => 'rating',
35 35
 			'options' => [
36
-				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )),
37
-				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )),
38
-				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )),
39
-				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )),
40
-				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )),
41
-				'0' => esc_html( __( 'Unrated', 'site-reviews' )),
36
+				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
37
+				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
38
+				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
39
+				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
40
+				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
41
+				'0' => esc_html( __( 'Unrated', 'site-reviews' ) ),
42 42
 			],
43 43
 			'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
44 44
 			'type' => 'listbox',
45
-		],[
45
+		], [
46 46
 			'label' => esc_html__( 'Pagination', 'site-reviews' ),
47 47
 			'name' => 'pagination',
48 48
 			'options' => [
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			'name' => 'assigned_to',
61 61
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ),
62 62
 			'type' => 'textbox',
63
-		],[
63
+		], [
64 64
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
65 65
 			'name' => 'schema',
66 66
 			'options' => [
@@ -69,49 +69,49 @@  discard block
 block discarded – undo
69 69
 			],
70 70
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
71 71
 			'type' => 'listbox',
72
-		],[
72
+		], [
73 73
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
74 74
 			'name' => 'class',
75 75
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
76 76
 			'type' => 'textbox',
77
-		],[
77
+		], [
78 78
 			'columns' => 2,
79 79
 			'items' => [[
80 80
 				'name' => 'hide_assigned_to',
81 81
 				'text' => esc_html__( 'Assigned To', 'site-reviews' ),
82 82
 				'tooltip' => __( 'Hide the assigned to link?', 'site-reviews' ),
83 83
 				'type' => 'checkbox',
84
-			],[
84
+			], [
85 85
 				'name' => 'hide_author',
86 86
 				'text' => esc_html__( 'Author', 'site-reviews' ),
87 87
 				'tooltip' => __( 'Hide the review author?', 'site-reviews' ),
88 88
 				'type' => 'checkbox',
89
-			],[
89
+			], [
90 90
 				'name' => 'hide_avatar',
91 91
 				'text' => esc_html__( 'Avatar', 'site-reviews' ),
92 92
 				'tooltip' => __( 'Hide the reviewer avatar if shown?', 'site-reviews' ),
93 93
 				'type' => 'checkbox',
94
-			],[
94
+			], [
95 95
 				'name' => 'hide_content',
96 96
 				'text' => esc_html__( 'Content', 'site-reviews' ),
97 97
 				'tooltip' => __( 'Hide the review content?', 'site-reviews' ),
98 98
 				'type' => 'checkbox',
99
-			],[
99
+			], [
100 100
 				'name' => 'hide_date',
101 101
 				'text' => esc_html__( 'Date', 'site-reviews' ),
102 102
 				'tooltip' => __( 'Hide the review date?', 'site-reviews' ),
103 103
 				'type' => 'checkbox',
104
-			],[
104
+			], [
105 105
 				'name' => 'hide_rating',
106 106
 				'text' => esc_html__( 'Rating', 'site-reviews' ),
107 107
 				'tooltip' => __( 'Hide the review rating?', 'site-reviews' ),
108 108
 				'type' => 'checkbox',
109
-			],[
109
+			], [
110 110
 				'name' => 'hide_response',
111 111
 				'text' => esc_html__( 'Response', 'site-reviews' ),
112 112
 				'tooltip' => __( 'Hide the review response?', 'site-reviews' ),
113 113
 				'type' => 'checkbox',
114
-			],[
114
+			], [
115 115
 				'name' => 'hide_title',
116 116
 				'text' => esc_html__( 'Title', 'site-reviews' ),
117 117
 				'tooltip' => __( 'Hide the review title?', 'site-reviews' ),
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			'label' => esc_html__( 'Hide', 'site-reviews' ),
122 122
 			'spacing' => 5,
123 123
 			'type' => 'container',
124
-		],[
124
+		], [
125 125
 			'hidden' => true,
126 126
 			'name' => 'id',
127 127
 			'type' => 'textbox',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	public function getTerms()
135 135
 	{
136 136
 		$terms = glsr( Database::class )->getTerms();
137
-		if( empty( $terms )) {
137
+		if( empty($terms) ) {
138 138
 			return [];
139 139
 		}
140 140
 		return [
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormPopup.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 		return [[
16 16
 			'type' => 'container',
17 17
 			'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>',
18
-		],[
18
+		], [
19 19
 			'label' => esc_html__( 'Title', 'site-reviews' ),
20 20
 			'name' => 'title',
21 21
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
22 22
 			'type' => 'textbox',
23
-		],[
23
+		], [
24 24
 			'label' => esc_html__( 'Description', 'site-reviews' ),
25 25
 			'minHeight' => 60,
26 26
 			'minWidth' => 240,
@@ -35,39 +35,39 @@  discard block
 block discarded – undo
35 35
 			'name' => 'assign_to',
36 36
 			'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ),
37 37
 			'type' => 'textbox',
38
-		],[
38
+		], [
39 39
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
40 40
 			'name' => 'class',
41 41
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
42 42
 			'type' => 'textbox',
43
-		],[
43
+		], [
44 44
 			'columns' => 2,
45 45
 			'items' => [[
46 46
 				'name' => 'hide_content',
47 47
 				'text' => esc_html__( 'Content', 'site-reviews' ),
48 48
 				'tooltip' => __( 'Hide the content field?', 'site-reviews' ),
49 49
 				'type' => 'checkbox',
50
-			],[
50
+			], [
51 51
 				'name' => 'hide_email',
52 52
 				'text' => esc_html__( 'Email', 'site-reviews' ),
53 53
 				'tooltip' => __( 'Hide the email field?', 'site-reviews' ),
54 54
 				'type' => 'checkbox',
55
-			],[
55
+			], [
56 56
 				'name' => 'hide_name',
57 57
 				'text' => esc_html__( 'Name', 'site-reviews' ),
58 58
 				'tooltip' => __( 'Hide the name field?', 'site-reviews' ),
59 59
 				'type' => 'checkbox',
60
-			],[
60
+			], [
61 61
 				'name' => 'hide_rating',
62 62
 				'text' => esc_html__( 'Rating', 'site-reviews' ),
63 63
 				'tooltip' => __( 'Hide the rating field?', 'site-reviews' ),
64 64
 				'type' => 'checkbox',
65
-			],[
65
+			], [
66 66
 				'name' => 'hide_terms',
67 67
 				'text' => esc_html__( 'Terms', 'site-reviews' ),
68 68
 				'tooltip' => __( 'Hide the terms field?', 'site-reviews' ),
69 69
 				'type' => 'checkbox',
70
-			],[
70
+			], [
71 71
 				'name' => 'hide_title',
72 72
 				'text' => esc_html__( 'Title', 'site-reviews' ),
73 73
 				'tooltip' => __( 'Hide the title field?', 'site-reviews' ),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			'layout' => 'grid',
78 78
 			'spacing' => 5,
79 79
 			'type' => 'container',
80
-		],[
80
+		], [
81 81
 			'hidden' => true,
82 82
 			'name' => 'id',
83 83
 			'type' => 'textbox',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	public function getTerms()
91 91
 	{
92 92
 		$terms = glsr( Database::class )->getTerms();
93
-		if( empty( $terms )) {
93
+		if( empty($terms) ) {
94 94
 			return [];
95 95
 		}
96 96
 		return [
Please login to merge, or discard this patch.
plugin/Shortcodes/TinymcePopupGenerator.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			'label' => '['.$tag.']',
48 48
 			'required' => $this->required,
49 49
 			'title' => esc_html__( 'Shortcode', 'site-reviews' ),
50
-		]);
50
+		] );
51 51
 		return $this;
52 52
 	}
53 53
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty($field) )return;
61 61
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
62
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return;
63 63
 			return $this->$method( $field );
64 64
 		}, $fields );
65
-		return array_values( array_filter( $generatedFields ));
65
+		return array_values( array_filter( $generatedFields ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	protected function getFields()
72 72
 	{
73 73
 		$fields = $this->generateFields( $this->fields() );
74
-		if( !empty( $this->errors )) {
74
+		if( !empty($this->errors) ) {
75 75
 			$errors = [];
76 76
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
77
+				if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue;
78 78
 				$errors[] = $this->errors[$name];
79 79
 			}
80 80
 			$this->errors = $errors;
81 81
 		}
82
-		return empty( $this->errors )
82
+		return empty($this->errors)
83 83
 			? $fields
84 84
 			: $this->errors;
85 85
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return wp_parse_args( $field, [
93 93
 			'items' => [],
94 94
 			'type' => '',
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'tooltip' => '',
111 111
 			'type' => '',
112 112
 			'value' => '',
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function normalizeContainer( array $field )
120 120
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
121
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return;
122 122
 		$field['items'] = $this->generateFields( $field['items'] );
123 123
 		return $field;
124 124
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function normalizeField( array $field, array $defaults )
130 130
 	{
131
-		if( !$this->validate( $field ))return;
131
+		if( !$this->validate( $field ) )return;
132 132
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 133
 			return $value !== '';
134 134
 		});
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			'tooltip' => '',
149 149
 			'type' => '',
150 150
 			'value' => '',
151
-		]);
152
-		if( !is_array( $listbox ))return;
153
-		if( !array_key_exists( '', $listbox['options'] )) {
151
+		] );
152
+		if( !is_array( $listbox ) )return;
153
+		if( !array_key_exists( '', $listbox['options'] ) ) {
154 154
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 155
 		}
156 156
 		foreach( $listbox['options'] as $value => $text ) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function normalizePost( array $field )
169 169
 	{
170
-		if( !is_array( $field['query_args'] )) {
170
+		if( !is_array( $field['query_args'] ) ) {
171 171
 			$field['query_args'] = [];
172 172
 		}
173 173
 		$posts = get_posts( wp_parse_args( $field['query_args'], [
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'orderby' => 'title',
176 176
 			'post_type' => 'post',
177 177
 			'posts_per_page' => 30,
178
-		]));
179
-		if( !empty( $posts )) {
178
+		] ) );
179
+		if( !empty($posts) ) {
180 180
 			$options = [];
181 181
 			foreach( $posts as $post ) {
182 182
 				$options[$post->ID] = esc_html( $post->post_title );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			'tooltip' => '',
207 207
 			'type' => '',
208 208
 			'value' => '',
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validate( array $field )
216 216
 	{
217
-		$args = shortcode_atts([
217
+		$args = shortcode_atts( [
218 218
 			'label' => '',
219 219
 			'name' => false,
220 220
 			'required' => false,
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function validateErrors( array $args )
232 232
 	{
233
-		if( !isset( $args['required']['error'] )) {
233
+		if( !isset($args['required']['error']) ) {
234 234
 			return true;
235 235
 		}
236
-		$this->errors[$args['name']] = $this->normalizeContainer([
236
+		$this->errors[$args['name']] = $this->normalizeContainer( [
237 237
 			'html' => $args['required']['error'],
238 238
 			'type' => 'container',
239
-		]);
239
+		] );
240 240
 		return false;
241 241
 	}
242 242
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			return true;
250 250
 		}
251 251
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252
-		if( isset( $args['required']['alert'] )) {
252
+		if( isset($args['required']['alert']) ) {
253 253
 			$alert = $args['required']['alert'];
254 254
 		}
255
-		else if( !empty( $args['label'] )) {
255
+		else if( !empty($args['label']) ) {
256 256
 			$alert = sprintf(
257 257
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 258
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryPopup.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	public function fields()
13 13
 	{
14 14
 		return [[
15
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
15
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
16 16
 			'minWidth' => 320,
17 17
 			'type' => 'container',
18
-		],[
18
+		], [
19 19
 			'label' => esc_html__( 'Title', 'site-reviews' ),
20 20
 			'name' => 'title',
21 21
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'name' => 'assigned_to',
29 29
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ),
30 30
 			'type' => 'textbox',
31
-		],[
31
+		], [
32 32
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
33 33
 			'name' => 'schema',
34 34
 			'options' => [
@@ -37,34 +37,34 @@  discard block
 block discarded – undo
37 37
 			],
38 38
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
39 39
 			'type' => 'listbox',
40
-		],[
40
+		], [
41 41
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
42 42
 			'name' => 'class',
43 43
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
44 44
 			'type' => 'textbox',
45
-		],[
45
+		], [
46 46
 			'columns' => 2,
47 47
 			'items' => [[
48 48
 				'type' => 'checkbox',
49 49
 				'name' => 'hide_bars',
50 50
 				'text' => esc_html__( 'Bars', 'site-reviews' ),
51 51
 				'tooltip' => __( 'Hide the percentage bars?', 'site-reviews' ),
52
-			],[
52
+			], [
53 53
 				'type' => 'checkbox',
54 54
 				'name' => 'hide_if_empty',
55 55
 				'text' => esc_html__( 'If Empty', 'site-reviews' ),
56 56
 				'tooltip' => __( 'Hide the summary if no reviews are found?', 'site-reviews' ),
57
-			],[
57
+			], [
58 58
 				'type' => 'checkbox',
59 59
 				'name' => 'hide_rating',
60 60
 				'text' => esc_html__( 'Rating', 'site-reviews' ),
61 61
 				'tooltip' => __( 'Hide the rating?', 'site-reviews' ),
62
-			],[
62
+			], [
63 63
 				'type' => 'checkbox',
64 64
 				'name' => 'hide_stars',
65 65
 				'text' => esc_html__( 'Stars', 'site-reviews' ),
66 66
 				'tooltip' => __( 'Hide the stars?', 'site-reviews' ),
67
-			],[
67
+			], [
68 68
 				'type' => 'checkbox',
69 69
 				'name' => 'hide_summary',
70 70
 				'text' => esc_html__( 'Summary', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$this->validateBlacklist();
68 68
 		$this->validateAkismet();
69 69
 		$this->validateRecaptcha();
70
-		if( !empty( $this->error )) {
70
+		if( !empty($this->error) ) {
71 71
 			$this->setSessionValues( 'message', $this->error );
72 72
 		}
73 73
 		return $this;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
92 92
 			return static::RECAPTCHA_DISABLED;
93 93
 		}
94
-		if( empty( $this->request['recaptcha-token'] )) {
95
-			return $this->request['counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ))
94
+		if( empty($this->request['recaptcha-token']) ) {
95
+			return $this->request['counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ) )
96 96
 				? static::RECAPTCHA_EMPTY
97 97
 				: static::RECAPTCHA_FAILED;
98 98
 		}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function getRecaptchaTokenStatus()
106 106
 	{
107
-		$endpoint = add_query_arg([
107
+		$endpoint = add_query_arg( [
108 108
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
109 109
 			'response' => $this->request['recaptcha-token'],
110 110
 			'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ),
111 111
 		], static::RECAPTCHA_ENDPOINT );
112
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
112
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
113 113
 			glsr_log()->error( $response->get_error_message() );
114 114
 			return static::RECAPTCHA_FAILED;
115 115
 		}
116
-		$response = json_decode( wp_remote_retrieve_body( $response ));
117
-		if( !empty( $response->success )) {
116
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
117
+		if( !empty($response->success) ) {
118 118
 			return boolval( $response->success )
119 119
 				? static::RECAPTCHA_VALID
120 120
 				: static::RECAPTCHA_INVALID;
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		$rules = array_intersect_key(
134 134
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES, $request ),
135
-			array_flip( $this->getOption( 'settings.submissions.required', [] ))
135
+			array_flip( $this->getOption( 'settings.submissions.required', [] ) )
136 136
 		);
137
-		$excluded = isset( $request['excluded'] )
137
+		$excluded = isset($request['excluded'])
138 138
 			? explode( ',', $request['excluded'] )
139 139
 			: [];
140
-		return array_diff_key( $rules, array_flip( $excluded ));
140
+		return array_diff_key( $rules, array_flip( $excluded ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		$rules = $this->getValidationRules( $request );
149 149
 		$errors = glsr( Validator::class )->validate( $request, $rules );
150
-		if( empty( $errors )) {
150
+		if( empty($errors) ) {
151 151
 			return true;
152 152
 		}
153 153
 		$this->setSessionValues( 'errors', $errors );
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
165 165
 	{
166 166
 		glsr( Session::class )->set( $this->form_id.$type, $value );
167
-		if( !empty( $loggedMessage )) {
167
+		if( !empty($loggedMessage) ) {
168 168
 			glsr_log()->warning( $loggedMessage );
169 169
 			glsr_log()->warning( $this->request );
170 170
 		}
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function validateAkismet()
177 177
 	{
178
-		if( !empty( $this->error ))return;
179
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
178
+		if( !empty($this->error) )return;
179
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
180 180
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' );
181 181
 		$this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' );
182 182
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	protected function validateBlacklist()
188 188
 	{
189
-		if( !empty( $this->error ))return;
190
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
189
+		if( !empty($this->error) )return;
190
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
191 191
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
192 192
 		if( $blacklistAction == 'reject' ) {
193 193
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function validateCustom()
204 204
 	{
205
-		if( !empty( $this->error ))return;
205
+		if( !empty($this->error) )return;
206 206
 		$validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
207 207
 		if( $validated === true )return;
208 208
 		$this->setSessionValues( 'errors', [] );
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	protected function validateHoneyPot()
219 219
 	{
220
-		if( !empty( $this->error ))return;
221
-		if( empty( $this->request['gotcha'] ))return;
220
+		if( !empty($this->error) )return;
221
+		if( empty($this->request['gotcha']) )return;
222 222
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
223 223
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
224 224
 	}
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	protected function validateRecaptcha()
230 230
 	{
231
-		if( !empty( $this->error ))return;
231
+		if( !empty($this->error) )return;
232 232
 		$status = $this->getRecaptchaStatus();
233
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
233
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ) )return;
234 234
 		if( $status == static::RECAPTCHA_EMPTY ) {
235 235
 			$this->setSessionValues( 'recaptcha', 'unset' );
236 236
 			$this->recaptchaIsUnset = true;
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	protected function validateRequest( array $request )
252 252
 	{
253
-		if( !$this->isRequestValid( $request )) {
253
+		if( !$this->isRequestValid( $request ) ) {
254 254
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
255 255
 			return $request;
256 256
 		}
257
-		if( empty( $request['title'] )) {
257
+		if( empty($request['title']) ) {
258 258
 			$request['title'] = __( 'No Title', 'site-reviews' );
259 259
 		}
260 260
 		return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				'response' => $this->buildResponse(),
66 66
 				'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(),
67 67
 			],
68
-		]);
68
+		] );
69 69
 	}
70 70
 
71 71
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			'context' => [
78 78
 				'text' => trim( $this->getLoginText().' '.$this->getRegisterText() ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	protected function buildRecaptcha()
87 87
 	{
88 88
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
89
-		return glsr( Builder::class )->div([
89
+		return glsr( Builder::class )->div( [
90 90
 			'class' => 'glsr-recaptcha-holder',
91 91
 			'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ),
92
-			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )),
92
+			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ),
93 93
 			'data-size' => 'invisible',
94
-		]);
94
+		] );
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function buildResponse()
101 101
 	{
102
-		$classes = !empty( $this->errors )
102
+		$classes = !empty($this->errors)
103 103
 			? glsr( StyleValidationDefaults::class )->defaults()['message_error_class']
104 104
 			: '';
105 105
 		return glsr( Template::class )->build( 'templates/form/response', [
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 				'class' => $classes,
108 108
 				'message' => wpautop( $this->message ),
109 109
 			],
110
-			'has_errors' => !empty( $this->errors ),
111
-		]);
110
+			'has_errors' => !empty($this->errors),
111
+		] );
112 112
 	}
113 113
 
114 114
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			'context' => [
121 121
 				'text' => __( 'Submit your review', 'site-reviews' ),
122 122
 			],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$fields = array_merge(
140 140
 			$this->getHiddenFields(),
141 141
 			[$this->getHoneypotField()],
142
-			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ))
142
+			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) )
143 143
 		);
144 144
 		return $fields;
145 145
 	}
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function getLoginText()
151 151
 	{
152
-		$loginLink = glsr( Builder::class )->a([
153
-			'href' => wp_login_url( strval( get_permalink() )),
152
+		$loginLink = glsr( Builder::class )->a( [
153
+			'href' => wp_login_url( strval( get_permalink() ) ),
154 154
 			'text' => __( 'logged in', 'site-reviews' ),
155
-		]);
155
+		] );
156 156
 		return sprintf( __( 'You must be %s to submit a review.', 'site-reviews' ), $loginLink );
157 157
 	}
158 158
 
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	protected function getRegisterText()
163 163
 	{
164 164
 		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
165
-		$registerLink = glsr( Builder::class )->a([
165
+		$registerLink = glsr( Builder::class )->a( [
166 166
 			'href' => wp_registration_url(),
167 167
 			'text' => __( 'register', 'site-reviews' ),
168
-		]);
168
+		] );
169 169
 		return sprintf( __( 'You may also %s for an account.', 'site-reviews' ), $registerLink );
170 170
 	}
171 171
 
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
 		$fields = [[
178 178
 			'name' => 'action',
179 179
 			'value' => 'submit-review',
180
-		],[
180
+		], [
181 181
 			'name' => 'assign_to',
182 182
 			'value' => $this->args['assign_to'],
183
-		],[
183
+		], [
184 184
 			'name' => 'category',
185 185
 			'value' => $this->args['category'],
186
-		],[
186
+		], [
187 187
 			'name' => 'counter',
188
-		],[
188
+		], [
189 189
 			'name' => 'excluded',
190 190
 			'value' => $this->args['hide'],
191
-		],[
191
+		], [
192 192
 			'name' => 'form_id',
193 193
 			'value' => $this->args['id'],
194
-		],[
194
+		], [
195 195
 			'name' => 'nonce',
196 196
 			'value' => wp_create_nonce( 'submit-review' ),
197
-		],[
197
+		], [
198 198
 			'name' => 'post_id',
199 199
 			'value' => get_the_ID(),
200
-		],[
200
+		], [
201 201
 			'name' => 'referer',
202
-			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )),
202
+			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ),
203 203
 		]];
204 204
 		return array_map( function( $field ) {
205
-			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ));
205
+			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) );
206 206
 		}, $fields );
207 207
 	}
208 208
 
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function getHoneypotField()
213 213
 	{
214
-		return new Field([
214
+		return new Field( [
215 215
 			'name' => 'gotcha',
216 216
 			'type' => 'honeypot',
217
-		]);
217
+		] );
218 218
 	}
219 219
 
220 220
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function normalizeFieldClass( Field &$field )
224 224
 	{
225
-		if( !isset( $field->field['class'] )) {
225
+		if( !isset($field->field['class']) ) {
226 226
 			$field->field['class'] = '';
227 227
 		}
228 228
 		$field->field['class'] = trim( $field->field['class'].' glsr-field-control' );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	protected function normalizeFieldErrors( Field &$field )
235 235
 	{
236
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
236
+		if( !array_key_exists( $field->field['path'], $this->errors ) )return;
237 237
 		$field->field['errors'] = $this->errors[$field->field['path']];
238 238
 	}
239 239
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function normalizeFieldRequired( Field &$field )
244 244
 	{
245
-		if( !in_array( $field->field['path'], $this->required ))return;
245
+		if( !in_array( $field->field['path'], $this->required ) )return;
246 246
 		$field->field['required'] = true;
247 247
 	}
248 248
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	{
254 254
 		$normalizedFields = [];
255 255
 		foreach( $fields as $field ) {
256
-			if( in_array( $field->field['path'], $this->args['hide'] ))continue;
256
+			if( in_array( $field->field['path'], $this->args['hide'] ) )continue;
257 257
 			$field->field['is_public'] = true;
258 258
 			$this->normalizeFieldClass( $field );
259 259
 			$this->normalizeFieldErrors( $field );
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	protected function normalizeFieldValue( Field &$field )
271 271
 	{
272
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
273
-		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
272
+		if( !array_key_exists( $field->field['path'], $this->values ) )return;
273
+		if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) {
274 274
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
275 275
 		}
276 276
 		else {
Please login to merge, or discard this patch.