Passed
Push — master ( 97923e...577901 )
by Paul
04:41
created
plugin/Filters.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@
 block discarded – undo
38 38
 	 */
39 39
 	public function run()
40 40
 	{
41
-		add_filter( 'mce_external_plugins',                                    [$this->admin, 'filterTinymcePlugins'], 15 );
42
-		add_filter( 'plugin_action_links_'.$this->basename,                    [$this->admin, 'filterActionLinks'] );
43
-		add_filter( 'dashboard_glance_items',                                  [$this->admin, 'filterDashboardGlanceItems'] );
44
-		add_filter( 'wp_editor_settings',                                      [$this->editor, 'filterEditorSettings'] );
45
-		add_filter( 'the_editor',                                              [$this->editor, 'filterEditorTextarea'] );
46
-		add_filter( 'gettext',                                                 [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47
-		add_filter( 'gettext_with_context',                                    [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48
-		add_filter( 'post_updated_messages',                                   [$this->editor, 'filterUpdateMessages'] );
49
-		add_filter( 'bulk_post_updated_messages',                              [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
-		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns',         [$this->listtable, 'filterColumnsForPostType'] );
51
-		add_filter( 'default_hidden_columns',                                  [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
52
-		add_filter( 'post_row_actions',                                        [$this->listtable, 'filterRowActions'], 10, 2 );
41
+		add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 );
42
+		add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] );
43
+		add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] );
44
+		add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] );
45
+		add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] );
46
+		add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47
+		add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48
+		add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] );
49
+		add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
+		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] );
51
+		add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
52
+		add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 );
53 53
 		add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] );
54
-		add_filter( 'ngettext',                                                [$this->listtable, 'filterStatusText'], 10, 5 );
54
+		add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 );
55 55
 		// add_filter( 'script_loader_tag',                                       [$this->public, 'filterEnqueuedScripts'], 10, 2 );
56 56
 		// add_filter( 'query_vars',                                              [$this->public, 'filterQueryVars'] );
57 57
 		// add_filter( 'gettext',                                                 [$this->translator, 'filterGettext'], 10, 3 );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function renderAssignedToMetabox( WP_Post $post )
148 148
 	{
149
-		if( !$this->isReviewPostType( $post ))return;
149
+		if( !$this->isReviewPostType( $post ) )return;
150 150
 		$assignedTo = get_post_meta( $post->ID, 'assigned_to', true );
151 151
 		$template = '';
152
-		if( $assignedPost = get_post( $assignedTo )) {
152
+		if( $assignedPost = get_post( $assignedTo ) ) {
153 153
 			ob_start();
154 154
 			glsr( Html::class )->renderTemplate( 'edit/assigned-post', [
155 155
 				'context' => [
156 156
 					'url' => (string)get_permalink( $assignedPost ),
157 157
 					'title' => get_the_title( $assignedPost ),
158 158
 				],
159
-			]);
159
+			] );
160 160
 			$template = ob_get_clean();
161 161
 		}
162 162
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
163 163
 		glsr()->render( 'edit/metabox-assigned-to', [
164 164
 			'id' => $assignedTo,
165 165
 			'template' => $template,
166
-		]);
166
+		] );
167 167
 	}
168 168
 
169 169
 	/**
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	public function renderDetailsMetaBox( WP_Post $post )
174 174
 	{
175
-		if( !$this->isReviewPostType( $post ))return;
175
+		if( !$this->isReviewPostType( $post ) )return;
176 176
 		$review = glsr( Database::class )->getReview( $post );
177 177
 		glsr()->render( 'edit/metabox-details', [
178 178
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
179 179
 			'metabox' => $this->buildDetailsMetaBox( $review ),
180
-		]);
180
+		] );
181 181
 	}
182 182
 
183 183
 	/**
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function renderPinnedInPublishMetaBox()
188 188
 	{
189
-		if( !$this->isReviewPostType( get_post() ))return;
189
+		if( !$this->isReviewPostType( get_post() ) )return;
190 190
 		$pinned = get_post_meta( get_the_ID(), 'pinned', true );
191 191
 		glsr()->render( 'edit/pinned', [
192 192
 			'pinned' => $pinned,
193
-		]);
193
+		] );
194 194
 	}
195 195
 
196 196
 	/**
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function renderResponseMetaBox( WP_Post $post )
201 201
 	{
202
-		if( !$this->isReviewPostType( $post ))return;
202
+		if( !$this->isReviewPostType( $post ) )return;
203 203
 		$review = glsr( Database::class )->getReview( $post );
204 204
 		wp_nonce_field( 'response', '_nonce-response', false );
205 205
 		glsr()->render( 'edit/metabox-response', [
206 206
 			'response' => $review->response,
207
-		]);
207
+		] );
208 208
 	}
209 209
 
210 210
 	/**
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function renderTaxonomyMetabox( WP_Post $post )
216 216
 	{
217
-		if( !$this->isReviewPostType( $post ))return;
217
+		if( !$this->isReviewPostType( $post ) )return;
218 218
 		glsr()->render( 'edit/metabox-categories', [
219 219
 			'post' => $post,
220 220
 			'tax_name' => esc_attr( Application::TAXONOMY ),
221 221
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
222
-		]);
222
+		] );
223 223
 	}
224 224
 
225 225
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function revertReview()
231 231
 	{
232
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
232
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
233 233
 		glsr( Database::class )->revertReview( $postId );
234 234
 		$this->redirect( $postId, 52 );
235 235
 	}
@@ -251,16 +251,16 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	protected function buildDetailsMetaBox( $review )
253 253
 	{
254
-		$reviewer = empty( $review->user_id )
254
+		$reviewer = empty($review->user_id)
255 255
 			? __( 'Unregistered user', 'site-reviews' )
256 256
 			: $this->generateLink( get_the_author_meta( 'display_name', $review->user_id ), [
257 257
 				'href' => get_author_posts_url( $review->user_id ),
258
-			]);
259
-		$email = empty( $review->email )
258
+			] );
259
+		$email = empty($review->email)
260 260
 			? '—'
261 261
 			: $this->generateLink( $review->email, [
262 262
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
263
-			]);
263
+			] );
264 264
 		$metabox = [
265 265
 			__( 'Rating', 'site-reviews' ) => glsr( Html::class )->renderPartial( 'star-rating', ['rating' => $review->rating] ),
266 266
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 			'revert-review_'.$post->ID
292 292
 		);
293 293
 		return !$modified
294
-			? sprintf( '<button id="revert" class="button button-large" disabled>%s</button>', __( 'Nothing to Revert', 'site-reviews' ))
295
-			: sprintf( '<a href="%s" id="revert" class="button button-large">%s</a>', $revertUrl, __( 'Revert Changes', 'site-reviews' ));
294
+			? sprintf( '<button id="revert" class="button button-large" disabled>%s</button>', __( 'Nothing to Revert', 'site-reviews' ) )
295
+			: sprintf( '<a href="%s" id="revert" class="button button-large">%s</a>', $revertUrl, __( 'Revert Changes', 'site-reviews' ) );
296 296
 	}
297 297
 
298 298
 	/**
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
 	protected function getReviewType( $review )
303 303
 	{
304 304
 		$reviewType = $review->review_type;
305
-		$reviewTypeFallback = !empty( $review->review_type )
305
+		$reviewTypeFallback = !empty($review->review_type)
306 306
 			? ucfirst( $review->review_type )
307 307
 			: __( 'Unknown', 'site-reviews' );
308
-		if( !empty( $review->url )) {
308
+		if( !empty($review->url) ) {
309 309
 			$reviewType = $this->generateLink( $reviewType, [
310 310
 				'href' => $review->url,
311 311
 				'target' => '_blank',
312
-			]);
312
+			] );
313 313
 		}
314 314
 		return sprintf( __( '%s review', 'site-reviews' ),
315 315
 			glsr( Strings::class )->review_types( $reviewType, $reviewTypeFallback )
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		$redirectUri = $hasReferer
340 340
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
341 341
 			: get_edit_post_link( $postId, false );
342
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
342
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
343 343
 		exit;
344 344
 	}
345 345
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -116,7 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function registerMetaBoxes( $postType )
118 118
 	{
119
-		if( $postType != Application::POST_TYPE )return;
119
+		if( $postType != Application::POST_TYPE ) {
120
+			return;
121
+		}
120 122
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
121 123
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
122 124
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
@@ -146,7 +148,9 @@  discard block
 block discarded – undo
146 148
 	 */
147 149
 	public function renderAssignedToMetabox( WP_Post $post )
148 150
 	{
149
-		if( !$this->isReviewPostType( $post ))return;
151
+		if( !$this->isReviewPostType( $post )) {
152
+			return;
153
+		}
150 154
 		$assignedTo = get_post_meta( $post->ID, 'assigned_to', true );
151 155
 		$template = '';
152 156
 		if( $assignedPost = get_post( $assignedTo )) {
@@ -172,7 +176,9 @@  discard block
 block discarded – undo
172 176
 	 */
173 177
 	public function renderDetailsMetaBox( WP_Post $post )
174 178
 	{
175
-		if( !$this->isReviewPostType( $post ))return;
179
+		if( !$this->isReviewPostType( $post )) {
180
+			return;
181
+		}
176 182
 		$review = glsr( Database::class )->getReview( $post );
177 183
 		glsr()->render( 'edit/metabox-details', [
178 184
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -186,7 +192,9 @@  discard block
 block discarded – undo
186 192
 	 */
187 193
 	public function renderPinnedInPublishMetaBox()
188 194
 	{
189
-		if( !$this->isReviewPostType( get_post() ))return;
195
+		if( !$this->isReviewPostType( get_post() )) {
196
+			return;
197
+		}
190 198
 		$pinned = get_post_meta( get_the_ID(), 'pinned', true );
191 199
 		glsr()->render( 'edit/pinned', [
192 200
 			'pinned' => $pinned,
@@ -199,7 +207,9 @@  discard block
 block discarded – undo
199 207
 	 */
200 208
 	public function renderResponseMetaBox( WP_Post $post )
201 209
 	{
202
-		if( !$this->isReviewPostType( $post ))return;
210
+		if( !$this->isReviewPostType( $post )) {
211
+			return;
212
+		}
203 213
 		$review = glsr( Database::class )->getReview( $post );
204 214
 		wp_nonce_field( 'response', '_nonce-response', false );
205 215
 		glsr()->render( 'edit/metabox-response', [
@@ -214,7 +224,9 @@  discard block
 block discarded – undo
214 224
 	 */
215 225
 	public function renderTaxonomyMetabox( WP_Post $post )
216 226
 	{
217
-		if( !$this->isReviewPostType( $post ))return;
227
+		if( !$this->isReviewPostType( $post )) {
228
+			return;
229
+		}
218 230
 		glsr()->render( 'edit/metabox-categories', [
219 231
 			'post' => $post,
220 232
 			'tax_name' => esc_attr( Application::TAXONOMY ),
Please login to merge, or discard this patch.
plugin/Actions.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -42,48 +42,48 @@
 block discarded – undo
42 42
 	 */
43 43
 	public function run()
44 44
 	{
45
-		add_action( 'admin_enqueue_scripts',                     [$this->admin, 'enqueueAssets'] );
46
-		add_action( 'admin_enqueue_scripts',                     [$this->admin, 'registerPointers'], 13 );
47
-		add_action( 'admin_init',                                [$this->admin, 'registerShortcodeButtons'] );
48
-		add_action( 'edit_form_after_title',                     [$this->admin, 'renderReviewEditor'] );
49
-		add_action( 'edit_form_top',                             [$this->admin, 'renderReviewNotice'] );
50
-		add_action( 'media_buttons',                             [$this->admin, 'renderTinymceButton'], 11 );
51
-		add_action( 'plugins_loaded',                            [$this->app, 'getDefaults'], 11 );
52
-		add_action( 'plugins_loaded',                            [$this->app, 'registerAddons'] );
53
-		add_action( 'plugins_loaded',                            [$this->app, 'registerLanguages'] );
54
-		add_action( 'plugins_loaded',                            [$this->app, 'registerReviewTypes'] );
55
-		add_action( 'upgrader_process_complete',                 [$this->app, 'upgraded'], 10, 2 );
56
-		add_action( 'admin_enqueue_scripts',                     [$this->editor, 'customizePostStatusLabels'] );
57
-		add_action( 'site-reviews/create/review',                [$this->editor, 'onCreateReview'], 10, 3 );
58
-		add_action( 'before_delete_post',                        [$this->editor, 'onDeleteReview'] );
59
-		add_action( 'save_post_'.Application::POST_TYPE,         [$this->editor, 'onSaveReview'], 20, 2 );
60
-		add_action( 'add_meta_boxes',                            [$this->editor, 'registerMetaBoxes'] );
61
-		add_action( 'admin_print_scripts',                       [$this->editor, 'removeAutosave'], 999 );
62
-		add_action( 'admin_menu',                                [$this->editor, 'removeMetaBoxes'] );
63
-		add_action( 'post_submitbox_misc_actions',               [$this->editor, 'renderPinnedInPublishMetaBox'] );
64
-		add_action( 'admin_action_revert',                       [$this->editor, 'revertReview'] );
65
-		add_action( 'save_post_'.Application::POST_TYPE,         [$this->editor, 'saveMetaboxes'] );
66
-		add_action( 'admin_action_approve',                      [$this->listtable, 'approve'] );
67
-		add_action( 'bulk_edit_custom_box',                      [$this->listtable, 'renderBulkEditFields'], 10, 2 );
68
-		add_action( 'restrict_manage_posts',                     [$this->listtable, 'renderColumnFilters'] );
69
-		add_action( 'manage_posts_custom_column',                [$this->listtable, 'renderColumnValues'] );
70
-		add_action( 'save_post_'.Application::POST_TYPE,         [$this->listtable, 'saveBulkEditFields'] );
71
-		add_action( 'pre_get_posts',                             [$this->listtable, 'setQueryForColumn'] );
72
-		add_action( 'admin_action_unapprove',                    [$this->listtable, 'unapprove'] );
73
-		add_action( 'init',                                      [$this->main, 'registerPostType'], 8 );
74
-		add_action( 'init',                                      [$this->main, 'registerShortcodes'] );
75
-		add_action( 'init',                                      [$this->main, 'registerTaxonomy'] );
76
-		add_action( 'widgets_init',                              [$this->main, 'registerWidgets'] );
77
-		add_action( 'wp_footer',                                 [$this->main, 'renderSchema'] );
78
-		add_action( 'admin_menu',                                [$this->menu, 'registerMenuCount'] );
79
-		add_action( 'admin_menu',                                [$this->menu, 'registerSubMenus'] );
45
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
46
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'registerPointers'], 13 );
47
+		add_action( 'admin_init', [$this->admin, 'registerShortcodeButtons'] );
48
+		add_action( 'edit_form_after_title', [$this->admin, 'renderReviewEditor'] );
49
+		add_action( 'edit_form_top', [$this->admin, 'renderReviewNotice'] );
50
+		add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
51
+		add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
52
+		add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
53
+		add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
54
+		add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
55
+		add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
56
+		add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
57
+		add_action( 'site-reviews/create/review', [$this->editor, 'onCreateReview'], 10, 3 );
58
+		add_action( 'before_delete_post', [$this->editor, 'onDeleteReview'] );
59
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'onSaveReview'], 20, 2 );
60
+		add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'] );
61
+		add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
62
+		add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
63
+		add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
64
+		add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
65
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
66
+		add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
67
+		add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
68
+		add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
69
+		add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'] );
70
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
71
+		add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
72
+		add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
73
+		add_action( 'init', [$this->main, 'registerPostType'], 8 );
74
+		add_action( 'init', [$this->main, 'registerShortcodes'] );
75
+		add_action( 'init', [$this->main, 'registerTaxonomy'] );
76
+		add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
77
+		add_action( 'wp_footer', [$this->main, 'renderSchema'] );
78
+		add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
79
+		add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
80 80
 		// add_action( 'admin_init',                                [$this->menu, 'setCustomPermissions'], 999 );
81 81
 		// add_action( 'wp_enqueue_scripts',                        [$this->public, 'enqueueAssets'], 999 );
82
-		add_action( 'admin_init',                                   [$this->router, 'routeAdminPostRequest'] );
83
-		add_action( 'wp_ajax_'.Application::PREFIX.'action',        [$this->router, 'routeAjaxRequest'] );
82
+		add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
83
+		add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
84 84
 		add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
85
-		add_action( 'init',                                         [$this->router, 'routePublicPostRequest'] );
86
-		add_action( 'admin_init',                                   [$this->router, 'routeWebhookRequest'] );
85
+		add_action( 'init', [$this->router, 'routePublicPostRequest'] );
86
+		add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] );
87 87
 		// add_action( 'admin_init',                                [$this->settings, 'registerSettings'] );
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
 	protected $router;
26 26
 	// protected $settings;
27 27
 
28
-	public function __construct( Application $app ) {
28
+	public function __construct( Application $app )
29
+	{
29 30
 		$this->app = $app;
30 31
 		$this->admin = $app->make( AdminController::class );
31 32
 		$this->editor = $app->make( EditorController::class );
Please login to merge, or discard this patch.
plugin/Modules/Editor/Labels.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 			'savePending' => __( 'Save as Unapproved', 'site-reviews' ),
18 18
 			'published' => __( 'Approved', 'site-reviews' ),
19 19
 		];
20
-		if( $this->canModifyTranslation() && isset( $wp_scripts->registered['post']->extra['data'] )) {
20
+		if( $this->canModifyTranslation() && isset($wp_scripts->registered['post']->extra['data']) ) {
21 21
 			$l10n = &$wp_scripts->registered['post']->extra['data'];
22 22
 			foreach( $strings as $search => $replace ) {
23 23
 				$l10n = preg_replace( '/("'.$search.'":")([^"]+)/', "$1".$replace, $l10n );
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function filterPostStatusLabels( $translation, $text, $domain )
35 35
 	{
36
-		if( $this->canModifyTranslation( $domain )) {
36
+		if( $this->canModifyTranslation( $domain ) ) {
37 37
 			$replacements = [
38 38
 				'Pending Review' => __( 'Unapproved', 'site-reviews' ),
39 39
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	public function filterUpdateMessages( array $messages )
56 56
 	{
57 57
 		$post = get_post();
58
-		if( !( $post instanceof WP_Post ))return;
58
+		if( !($post instanceof WP_Post) )return;
59 59
 		$strings = $this->getReviewLabels();
60 60
 		$restored = filter_input( INPUT_GET, 'revision' );
61
-		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) {
61
+		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) {
62 62
 			$restored = sprintf( $strings['restored'], $revisionTitle );
63 63
 		}
64
-		$scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ));
65
-		$messages[ Application::POST_TYPE ] = [
64
+		$scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) );
65
+		$messages[Application::POST_TYPE] = [
66 66
 			 1 => $strings['updated'],
67 67
 			 4 => $strings['updated'],
68 68
 			 5 => $restored,
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 				'Save as Pending' => __( 'Save as Unapproved', 'site-reviews' ),
43 43
 			];
44 44
 			foreach( $replacements as $search => $replacement ) {
45
-				if( $translation != $search )continue;
45
+				if( $translation != $search ) {
46
+					continue;
47
+				}
46 48
 				$translation = $replacement;
47 49
 			}
48 50
 		}
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 	public function filterUpdateMessages( array $messages )
56 58
 	{
57 59
 		$post = get_post();
58
-		if( !( $post instanceof WP_Post ))return;
60
+		if( !( $post instanceof WP_Post )) {
61
+			return;
62
+		}
59 63
 		$strings = $this->getReviewLabels();
60 64
 		$restored = filter_input( INPUT_GET, 'revision' );
61 65
 		if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) {
Please login to merge, or discard this patch.
plugin/Modules/Editor/Metaboxes.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function onCreateReview( $postData, $meta, $postId )
23 23
 	{
24
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
24
+		if( !$this->isReviewPostType( $review = get_post( $postId ) ) )return;
25 25
 		$this->updateAssignedToPost( $review );
26 26
 	}
27 27
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function onDeleteReview( $postId )
33 33
 	{
34
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
34
+		if( !$this->isReviewPostType( $review = get_post( $postId ) ) )return;
35 35
 		$review->post_status = 'deleted'; // important to change the post_status here first!
36 36
 		$this->updateAssignedToPost( $review );
37 37
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function saveAssignedToMetabox( $postId )
53 53
 	{
54
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return;
54
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ) )return;
55 55
 		$assignedTo = filter_input( INPUT_POST, 'assigned_to' );
56 56
 		$assignedTo || $assignedTo = '';
57 57
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function saveResponseMetabox( $postId )
68 68
 	{
69
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return;
69
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ) )return;
70 70
 		$response = filter_input( INPUT_POST, 'response' );
71 71
 		$response || $response = '';
72 72
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
73 73
 			'a' => ['href' => [], 'title' => []],
74 74
 			'em' => [],
75 75
 			'strong' => [],
76
-		])));
76
+		] ) ) );
77 77
 	}
78 78
 
79 79
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	protected function getAssignedToPostId( $postId )
84 84
 	{
85 85
 		$assignedTo = get_post_meta( $postId, 'assigned_to', true );
86
-		if(( $post = get_post( $assignedTo )) instanceof WP_Post ) {
86
+		if( ($post = get_post( $assignedTo )) instanceof WP_Post ) {
87 87
 			return $post->ID;
88 88
 		}
89 89
 		return false;
@@ -119,21 +119,21 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	protected function updateAssignedToPost( WP_Post $review )
121 121
 	{
122
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
122
+		if( !($postId = $this->getAssignedToPostId( $review->ID )) )return;
123 123
 		$reviewIds = get_post_meta( $postId, static::META_REVIEW_ID );
124
-		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
124
+		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) );
125 125
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
126
-		if( empty( $updatedReviewIds )) {
126
+		if( empty($updatedReviewIds) ) {
127 127
 			delete_post_meta( $postId, static::META_RANKING );
128 128
 			delete_post_meta( $postId, static::META_REVIEW_ID );
129 129
 		}
130
-		else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds )) {
131
-			$reviews = glsr( Database::class )->getReviews([
130
+		else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds ) ) {
131
+			$reviews = glsr( Database::class )->getReviews( [
132 132
 				'count' => -1,
133 133
 				'post__in' => $updatedReviewIds,
134
-			]);
135
-			update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ));
136
-			update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ));
134
+			] );
135
+			update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ) );
136
+			update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ) );
137 137
 		}
138 138
 	}
139 139
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		if( $review->post_status != 'publish' ) {
147 147
 			delete_post_meta( $postId, static::META_REVIEW_ID, $review->ID );
148 148
 		}
149
-		else if( !in_array( $review->ID, $reviewIds )) {
149
+		else if( !in_array( $review->ID, $reviewIds ) ) {
150 150
 			add_post_meta( $postId, static::META_REVIEW_ID, $review->ID );
151 151
 		}
152 152
 	}
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function onCreateReview( $postData, $meta, $postId )
23 23
 	{
24
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
24
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
25
+			return;
26
+		}
25 27
 		$this->updateAssignedToPost( $review );
26 28
 	}
27 29
 
@@ -31,7 +33,9 @@  discard block
 block discarded – undo
31 33
 	 */
32 34
 	public function onDeleteReview( $postId )
33 35
 	{
34
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
36
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
37
+			return;
38
+		}
35 39
 		$review->post_status = 'deleted'; // important to change the post_status here first!
36 40
 		$this->updateAssignedToPost( $review );
37 41
 	}
@@ -51,7 +55,9 @@  discard block
 block discarded – undo
51 55
 	 */
52 56
 	public function saveAssignedToMetabox( $postId )
53 57
 	{
54
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return;
58
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) {
59
+			return;
60
+		}
55 61
 		$assignedTo = filter_input( INPUT_POST, 'assigned_to' );
56 62
 		$assignedTo || $assignedTo = '';
57 63
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -66,7 +72,9 @@  discard block
 block discarded – undo
66 72
 	 */
67 73
 	public function saveResponseMetabox( $postId )
68 74
 	{
69
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return;
75
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) {
76
+			return;
77
+		}
70 78
 		$response = filter_input( INPUT_POST, 'response' );
71 79
 		$response || $response = '';
72 80
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
@@ -119,7 +127,9 @@  discard block
 block discarded – undo
119 127
 	 */
120 128
 	protected function updateAssignedToPost( WP_Post $review )
121 129
 	{
122
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
130
+		if( !( $postId = $this->getAssignedToPostId( $review->ID ))) {
131
+			return;
132
+		}
123 133
 		$reviewIds = get_post_meta( $postId, static::META_REVIEW_ID );
124 134
 		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
125 135
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
Please login to merge, or discard this patch.
plugin/Modules/Editor/Customization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	 */
58 58
 	protected function isReviewEditable()
59 59
 	{
60
-		$postId = intval( filter_input( INPUT_GET, 'post' ));
60
+		$postId = intval( filter_input( INPUT_GET, 'post' ) );
61 61
 		return $postId > 0
62 62
 			&& get_post_meta( $postId, 'review_type', true ) == 'local'
63 63
 			&& $this->isReviewEditor();
Please login to merge, or discard this patch.