Passed
Push — master ( 36836d...ee0da0 )
by Paul
04:21
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/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/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.
plugin/Modules/Editor/Metaboxes.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function onCreateReview( $postData, $meta, $postId )
24 24
 	{
25
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
25
+		if( !$this->isReviewPostType( $review = get_post( $postId ) ) )return;
26 26
 		$this->updateAssignedToPost( $review );
27 27
 	}
28 28
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function onDeleteReview( $postId )
34 34
 	{
35
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
35
+		if( !$this->isReviewPostType( $review = get_post( $postId ) ) )return;
36 36
 		$review->post_status = 'deleted'; // important to change the post_status here first!
37 37
 		$this->updateAssignedToPost( $review );
38 38
 	}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function saveAssignedToMetabox( $postId )
54 54
 	{
55
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return;
55
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ) )return;
56 56
 		$assignedTo = filter_input( INPUT_POST, 'assigned_to' );
57 57
 		$assignedTo || $assignedTo = '';
58 58
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function saveResponseMetabox( $postId )
69 69
 	{
70
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return;
70
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ) )return;
71 71
 		$response = filter_input( INPUT_POST, 'response' );
72 72
 		$response || $response = '';
73 73
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
74 74
 			'a' => ['href' => [], 'title' => []],
75 75
 			'em' => [],
76 76
 			'strong' => [],
77
-		])));
77
+		] ) ) );
78 78
 	}
79 79
 
80 80
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	protected function getAssignedToPostId( $postId )
85 85
 	{
86 86
 		$assignedTo = get_post_meta( $postId, 'assigned_to', true );
87
-		if(( $post = get_post( $assignedTo )) instanceof WP_Post ) {
87
+		if( ($post = get_post( $assignedTo )) instanceof WP_Post ) {
88 88
 			return $post->ID;
89 89
 		}
90 90
 		return false;
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function updateAssignedToPost( WP_Post $review )
122 122
 	{
123
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
124
-		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
125
-		if( empty( $reviewIds ))return;
123
+		if( !($postId = $this->getAssignedToPostId( $review->ID )) )return;
124
+		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) );
125
+		if( empty($reviewIds) )return;
126 126
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
127
-		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
128
-		if( empty( $updatedReviewIds )) {
127
+		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ) );
128
+		if( empty($updatedReviewIds) ) {
129 129
 			delete_post_meta( $postId, static::META_RANKING );
130 130
 			delete_post_meta( $postId, static::META_REVIEW_ID );
131 131
 		}
132
-		else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds )) {
133
-			$reviews = glsr( Database::class )->getReviews([
132
+		else if( !glsr( Helper::class )->compareArrays( $reviewIds, $updatedReviewIds ) ) {
133
+			$reviews = glsr( Database::class )->getReviews( [
134 134
 				'count' => -1,
135 135
 				'post__in' => $updatedReviewIds,
136
-			]);
137
-			update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ));
138
-			update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ));
136
+			] );
137
+			update_post_meta( $postId, static::META_AVERAGE, $this->recalculatePostAverage( $reviews->results ) );
138
+			update_post_meta( $postId, static::META_RANKING, $this->recalculatePostRanking( $reviews->results ) );
139 139
 		}
140 140
 	}
141 141
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		if( $review->post_status != 'publish' ) {
149 149
 			delete_post_meta( $postId, static::META_REVIEW_ID, $review->ID );
150 150
 		}
151
-		else if( !in_array( $review->ID, $reviewIds )) {
151
+		else if( !in_array( $review->ID, $reviewIds ) ) {
152 152
 			add_post_meta( $postId, static::META_REVIEW_ID, $review->ID );
153 153
 		}
154 154
 	}
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function onCreateReview( $postData, $meta, $postId )
24 24
 	{
25
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
25
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
26
+			return;
27
+		}
26 28
 		$this->updateAssignedToPost( $review );
27 29
 	}
28 30
 
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 	 */
33 35
 	public function onDeleteReview( $postId )
34 36
 	{
35
-		if( !$this->isReviewPostType( $review = get_post( $postId )))return;
37
+		if( !$this->isReviewPostType( $review = get_post( $postId ))) {
38
+			return;
39
+		}
36 40
 		$review->post_status = 'deleted'; // important to change the post_status here first!
37 41
 		$this->updateAssignedToPost( $review );
38 42
 	}
@@ -52,7 +56,9 @@  discard block
 block discarded – undo
52 56
 	 */
53 57
 	public function saveAssignedToMetabox( $postId )
54 58
 	{
55
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' ))return;
59
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-assigned-to' ), 'assigned_to' )) {
60
+			return;
61
+		}
56 62
 		$assignedTo = filter_input( INPUT_POST, 'assigned_to' );
57 63
 		$assignedTo || $assignedTo = '';
58 64
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -67,7 +73,9 @@  discard block
 block discarded – undo
67 73
 	 */
68 74
 	public function saveResponseMetabox( $postId )
69 75
 	{
70
-		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' ))return;
76
+		if( !wp_verify_nonce( filter_input( INPUT_POST, '_nonce-response' ), 'response' )) {
77
+			return;
78
+		}
71 79
 		$response = filter_input( INPUT_POST, 'response' );
72 80
 		$response || $response = '';
73 81
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
@@ -120,9 +128,13 @@  discard block
 block discarded – undo
120 128
 	 */
121 129
 	protected function updateAssignedToPost( WP_Post $review )
122 130
 	{
123
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
131
+		if( !( $postId = $this->getAssignedToPostId( $review->ID ))) {
132
+			return;
133
+		}
124 134
 		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
125
-		if( empty( $reviewIds ))return;
135
+		if( empty( $reviewIds )) {
136
+			return;
137
+		}
126 138
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
127 139
 		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
128 140
 		if( empty( $updatedReviewIds )) {
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function renderAssignedToMetabox( WP_Post $post )
149 149
 	{
150
-		if( !$this->isReviewPostType( $post ))return;
151
-		$assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ));
150
+		if( !$this->isReviewPostType( $post ) )return;
151
+		$assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ) );
152 152
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
153 153
 		glsr()->render( 'edit/metabox-assigned-to', [
154 154
 			'id' => $assignedTo,
155 155
 			'template' => $this->buildAssignedToTemplate( $assignedTo ),
156
-		]);
156
+		] );
157 157
 	}
158 158
 
159 159
 	/**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function renderDetailsMetaBox( WP_Post $post )
164 164
 	{
165
-		if( !$this->isReviewPostType( $post ))return;
165
+		if( !$this->isReviewPostType( $post ) )return;
166 166
 		$review = glsr( Database::class )->getReview( $post );
167 167
 		glsr()->render( 'edit/metabox-details', [
168 168
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
169 169
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
170
-		]);
170
+		] );
171 171
 	}
172 172
 
173 173
 	/**
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function renderPinnedInPublishMetaBox()
178 178
 	{
179
-		if( !$this->isReviewPostType( get_post() ))return;
179
+		if( !$this->isReviewPostType( get_post() ) )return;
180 180
 		glsr()->render( 'edit/pinned', [
181
-			'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
182
-		]);
181
+			'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
182
+		] );
183 183
 	}
184 184
 
185 185
 	/**
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function renderResponseMetaBox( WP_Post $post )
190 190
 	{
191
-		if( !$this->isReviewPostType( $post ))return;
191
+		if( !$this->isReviewPostType( $post ) )return;
192 192
 		wp_nonce_field( 'response', '_nonce-response', false );
193 193
 		glsr()->render( 'edit/metabox-response', [
194 194
 			'response' => glsr( Database::class )->getReview( $post )->response,
195
-		]);
195
+		] );
196 196
 	}
197 197
 
198 198
 	/**
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function renderTaxonomyMetabox( WP_Post $post )
204 204
 	{
205
-		if( !$this->isReviewPostType( $post ))return;
205
+		if( !$this->isReviewPostType( $post ) )return;
206 206
 		glsr()->render( 'edit/metabox-categories', [
207 207
 			'post' => $post,
208 208
 			'tax_name' => Application::TAXONOMY,
209 209
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
210
-		]);
210
+		] );
211 211
 	}
212 212
 
213 213
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function revertReview()
219 219
 	{
220
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
220
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
221 221
 		glsr( Database::class )->revertReview( $postId );
222 222
 		$this->redirect( $postId, 52 );
223 223
 	}
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
 	protected function buildAssignedToTemplate( $assignedTo )
241 241
 	{
242 242
 		$assignedPost = get_post( $assignedTo );
243
-		if( !( $assignedPost instanceof WP_Post ))return;
243
+		if( !($assignedPost instanceof WP_Post) )return;
244 244
 		return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [
245 245
 			'context' => [
246 246
 				'url' => (string)get_permalink( $assignedPost ),
247 247
 				'title' => get_the_title( $assignedPost ),
248 248
 			],
249
-		]);
249
+		] );
250 250
 	}
251 251
 
252 252
 	/**
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 				'class' => 'button button-large',
268 268
 				'href' => $revertUrl,
269 269
 				'id' => 'revert',
270
-			]);
270
+			] );
271 271
 		}
272 272
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
273 273
 			'class' => 'button button-large',
274 274
 			'disabled' => true,
275 275
 			'id' => 'revert',
276
-		]);
276
+		] );
277 277
 	}
278 278
 
279 279
 	/**
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 	protected function getReviewType( $review )
284 284
 	{
285 285
 		$reviewType = $review->review_type;
286
-		if( !empty( $review->url )) {
286
+		if( !empty($review->url) ) {
287 287
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
288 288
 				'href' => $review->url,
289 289
 				'target' => '_blank',
290
-			]);
290
+			] );
291 291
 		}
292 292
 		return in_array( $reviewType, glsr()->reviewTypes )
293 293
 			? glsr()->reviewTypes[$reviewType]
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	protected function normalizeDetailsMetaBox( $review )
311 311
 	{
312
-		$reviewer = empty( $review->user_id )
312
+		$reviewer = empty($review->user_id)
313 313
 			? __( 'Unregistered user', 'site-reviews' )
314 314
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
315 315
 				'href' => get_author_posts_url( $review->user_id ),
316
-			]);
317
-		$email = empty( $review->email )
316
+			] );
317
+		$email = empty($review->email)
318 318
 			? '—'
319 319
 			: glsr( Builder::class )->a( $review->email, [
320 320
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
321
-			]);
321
+			] );
322 322
 		$metabox = [
323 323
 			__( 'Rating', 'site-reviews' ) => glsr( Html::class )->renderPartial( 'star-rating', ['rating' => $review->rating] ),
324 324
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		$redirectUri = $hasReferer
347 347
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
348 348
 			: get_edit_post_link( $postId, false );
349
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
349
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
350 350
 		exit;
351 351
 	}
352 352
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -117,7 +117,9 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function registerMetaBoxes( $postType )
119 119
 	{
120
-		if( $postType != Application::POST_TYPE )return;
120
+		if( $postType != Application::POST_TYPE ) {
121
+			return;
122
+		}
121 123
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
122 124
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
123 125
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
@@ -147,7 +149,9 @@  discard block
 block discarded – undo
147 149
 	 */
148 150
 	public function renderAssignedToMetabox( WP_Post $post )
149 151
 	{
150
-		if( !$this->isReviewPostType( $post ))return;
152
+		if( !$this->isReviewPostType( $post )) {
153
+			return;
154
+		}
151 155
 		$assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ));
152 156
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
153 157
 		glsr()->render( 'edit/metabox-assigned-to', [
@@ -162,7 +166,9 @@  discard block
 block discarded – undo
162 166
 	 */
163 167
 	public function renderDetailsMetaBox( WP_Post $post )
164 168
 	{
165
-		if( !$this->isReviewPostType( $post ))return;
169
+		if( !$this->isReviewPostType( $post )) {
170
+			return;
171
+		}
166 172
 		$review = glsr( Database::class )->getReview( $post );
167 173
 		glsr()->render( 'edit/metabox-details', [
168 174
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -176,7 +182,9 @@  discard block
 block discarded – undo
176 182
 	 */
177 183
 	public function renderPinnedInPublishMetaBox()
178 184
 	{
179
-		if( !$this->isReviewPostType( get_post() ))return;
185
+		if( !$this->isReviewPostType( get_post() )) {
186
+			return;
187
+		}
180 188
 		glsr()->render( 'edit/pinned', [
181 189
 			'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
182 190
 		]);
@@ -188,7 +196,9 @@  discard block
 block discarded – undo
188 196
 	 */
189 197
 	public function renderResponseMetaBox( WP_Post $post )
190 198
 	{
191
-		if( !$this->isReviewPostType( $post ))return;
199
+		if( !$this->isReviewPostType( $post )) {
200
+			return;
201
+		}
192 202
 		wp_nonce_field( 'response', '_nonce-response', false );
193 203
 		glsr()->render( 'edit/metabox-response', [
194 204
 			'response' => glsr( Database::class )->getReview( $post )->response,
@@ -202,7 +212,9 @@  discard block
 block discarded – undo
202 212
 	 */
203 213
 	public function renderTaxonomyMetabox( WP_Post $post )
204 214
 	{
205
-		if( !$this->isReviewPostType( $post ))return;
215
+		if( !$this->isReviewPostType( $post )) {
216
+			return;
217
+		}
206 218
 		glsr()->render( 'edit/metabox-categories', [
207 219
 			'post' => $post,
208 220
 			'tax_name' => Application::TAXONOMY,
@@ -240,7 +252,9 @@  discard block
 block discarded – undo
240 252
 	protected function buildAssignedToTemplate( $assignedTo )
241 253
 	{
242 254
 		$assignedPost = get_post( $assignedTo );
243
-		if( !( $assignedPost instanceof WP_Post ))return;
255
+		if( !( $assignedPost instanceof WP_Post )) {
256
+			return;
257
+		}
244 258
 		return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [
245 259
 			'context' => [
246 260
 				'url' => (string)get_permalink( $assignedPost ),
Please login to merge, or discard this patch.