@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function approve() |
23 | 23 | { |
24 | - check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() )); |
|
25 | - wp_update_post([ |
|
24 | + check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) ); |
|
25 | + wp_update_post( [ |
|
26 | 26 | 'ID' => $postId, |
27 | 27 | 'post_status' => 'publish', |
28 | - ]); |
|
28 | + ] ); |
|
29 | 29 | wp_safe_redirect( wp_get_referer() ); |
30 | 30 | exit; |
31 | 31 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | { |
55 | 55 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
56 | 56 | foreach( $postTypeColumns as $key => &$value ) { |
57 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
57 | + if( !array_key_exists( $key, $columns ) || !empty($value) )continue; |
|
58 | 58 | $value = $columns[$key]; |
59 | 59 | } |
60 | - if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) { |
|
61 | - unset( $postTypeColumns['review_type'] ); |
|
60 | + if( count( glsr( Database::class )->getReviewsMeta( 'type' ) ) < 2 ) { |
|
61 | + unset($postTypeColumns['review_type']); |
|
62 | 62 | } |
63 | 63 | return array_filter( $postTypeColumns, 'strlen' ); |
64 | 64 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) { |
85 | 85 | return $actions; |
86 | 86 | } |
87 | - unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit |
|
87 | + unset($actions['inline hide-if-no-js']); //Remove Quick-edit |
|
88 | 88 | $rowActions = [ |
89 | 89 | 'approve' => esc_attr__( 'Approve', 'site-reviews' ), |
90 | 90 | 'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ), |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | admin_url( 'post.php?post='.$post->ID.'&action='.$key ), |
98 | 98 | $key.'-review_'.$post->ID |
99 | 99 | ), |
100 | - ]); |
|
100 | + ] ); |
|
101 | 101 | } |
102 | 102 | return $actions; |
103 | 103 | } |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | public function filterSortableColumns( array $columns ) |
110 | 110 | { |
111 | 111 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
112 | - unset( $postTypeColumns['cb'] ); |
|
112 | + unset($postTypeColumns['cb']); |
|
113 | 113 | foreach( $postTypeColumns as $key => $value ) { |
114 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
114 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue; |
|
115 | 115 | $columns[$key] = $key; |
116 | 116 | } |
117 | 117 | return $columns; |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function filterStatusText( $translation, $single, $plural, $number, $domain ) |
131 | 131 | { |
132 | - if( $this->canModifyTranslation( $domain )) { |
|
132 | + if( $this->canModifyTranslation( $domain ) ) { |
|
133 | 133 | $strings = [ |
134 | 134 | 'Published' => __( 'Approved', 'site-reviews' ), |
135 | 135 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
136 | 136 | ]; |
137 | 137 | foreach( $strings as $search => $replace ) { |
138 | 138 | if( strpos( $single, $search ) === false )continue; |
139 | - $translation = $this->getTranslation([ |
|
139 | + $translation = $this->getTranslation( [ |
|
140 | 140 | 'number' => $number, |
141 | 141 | 'plural' => str_replace( $search, $replace, $plural ), |
142 | 142 | 'single' => str_replace( $search, $replace, $single ), |
143 | - ]); |
|
143 | + ] ); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | return $translation; |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function saveBulkEditFields( $postId ) |
188 | 188 | { |
189 | - if( !current_user_can( 'edit_posts' ))return; |
|
189 | + if( !current_user_can( 'edit_posts' ) )return; |
|
190 | 190 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
191 | - if( $assignedTo && get_post( $assignedTo )) { |
|
191 | + if( $assignedTo && get_post( $assignedTo ) ) { |
|
192 | 192 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
193 | 193 | } |
194 | 194 | } |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function setQueryForColumn( WP_Query $query ) |
201 | 201 | { |
202 | - if( !$this->hasPermission( $query ))return; |
|
202 | + if( !$this->hasPermission( $query ) )return; |
|
203 | 203 | $this->setMetaQuery( $query, [ |
204 | 204 | 'rating', 'review_type', |
205 | - ]); |
|
205 | + ] ); |
|
206 | 206 | $this->setOrderby( $query ); |
207 | 207 | } |
208 | 208 | |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function unapprove() |
214 | 214 | { |
215 | - check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() )); |
|
216 | - wp_update_post([ |
|
215 | + check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) ); |
|
216 | + wp_update_post( [ |
|
217 | 217 | 'ID' => $postId, |
218 | 218 | 'post_status' => 'pending', |
219 | - ]); |
|
219 | + ] ); |
|
220 | 220 | wp_safe_redirect( wp_get_referer() ); |
221 | 221 | exit; |
222 | 222 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | 'single' => '', |
246 | 246 | 'text' => '', |
247 | 247 | ]; |
248 | - $args = (object) wp_parse_args( $args, $defaults ); |
|
248 | + $args = (object)wp_parse_args( $args, $defaults ); |
|
249 | 249 | $translations = get_translations_for_domain( Application::ID ); |
250 | 250 | return $args->text |
251 | 251 | ? $translations->translate( $args->text ) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
271 | 271 | { |
272 | 272 | foreach( $metaKeys as $key ) { |
273 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
273 | + if( !($value = filter_input( INPUT_GET, $key )) )continue; |
|
274 | 274 | $metaQuery = (array)$query->get( 'meta_query' ); |
275 | 275 | $metaQuery[] = [ |
276 | 276 | 'key' => $key, |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | { |
288 | 288 | $orderby = $query->get( 'orderby' ); |
289 | 289 | $columns = glsr()->postTypeColumns[Application::POST_TYPE]; |
290 | - unset( $columns['cb'], $columns['title'], $columns['date'] ); |
|
291 | - if( in_array( $orderby, array_keys( $columns ))) { |
|
290 | + unset($columns['cb'], $columns['title'], $columns['date']); |
|
291 | + if( in_array( $orderby, array_keys( $columns ) ) ) { |
|
292 | 292 | $query->set( 'meta_key', $orderby ); |
293 | 293 | $query->set( 'orderby', 'meta_value' ); |
294 | 294 | } |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | { |
55 | 55 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
56 | 56 | foreach( $postTypeColumns as $key => &$value ) { |
57 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
57 | + if( !array_key_exists( $key, $columns ) || !empty( $value )) { |
|
58 | + continue; |
|
59 | + } |
|
58 | 60 | $value = $columns[$key]; |
59 | 61 | } |
60 | 62 | if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) { |
@@ -111,7 +113,9 @@ discard block |
||
111 | 113 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
112 | 114 | unset( $postTypeColumns['cb'] ); |
113 | 115 | foreach( $postTypeColumns as $key => $value ) { |
114 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
116 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) { |
|
117 | + continue; |
|
118 | + } |
|
115 | 119 | $columns[$key] = $key; |
116 | 120 | } |
117 | 121 | return $columns; |
@@ -135,7 +139,9 @@ discard block |
||
135 | 139 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
136 | 140 | ]; |
137 | 141 | foreach( $strings as $search => $replace ) { |
138 | - if( strpos( $single, $search ) === false )continue; |
|
142 | + if( strpos( $single, $search ) === false ) { |
|
143 | + continue; |
|
144 | + } |
|
139 | 145 | $translation = $this->getTranslation([ |
140 | 146 | 'number' => $number, |
141 | 147 | 'plural' => str_replace( $search, $replace, $plural ), |
@@ -186,7 +192,9 @@ discard block |
||
186 | 192 | */ |
187 | 193 | public function saveBulkEditFields( $postId ) |
188 | 194 | { |
189 | - if( !current_user_can( 'edit_posts' ))return; |
|
195 | + if( !current_user_can( 'edit_posts' )) { |
|
196 | + return; |
|
197 | + } |
|
190 | 198 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
191 | 199 | if( $assignedTo && get_post( $assignedTo )) { |
192 | 200 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
@@ -199,7 +207,9 @@ discard block |
||
199 | 207 | */ |
200 | 208 | public function setQueryForColumn( WP_Query $query ) |
201 | 209 | { |
202 | - if( !$this->hasPermission( $query ))return; |
|
210 | + if( !$this->hasPermission( $query )) { |
|
211 | + return; |
|
212 | + } |
|
203 | 213 | $this->setMetaQuery( $query, [ |
204 | 214 | 'rating', 'review_type', |
205 | 215 | ]); |
@@ -270,7 +280,9 @@ discard block |
||
270 | 280 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
271 | 281 | { |
272 | 282 | foreach( $metaKeys as $key ) { |
273 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
283 | + if( !( $value = filter_input( INPUT_GET, $key ))) { |
|
284 | + continue; |
|
285 | + } |
|
274 | 286 | $metaQuery = (array)$query->get( 'meta_query' ); |
275 | 287 | $metaQuery[] = [ |
276 | 288 | 'key' => $key, |
@@ -17,7 +17,7 @@ discard block |
||
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 |
||
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 |
||
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, |
@@ -42,7 +42,9 @@ discard block |
||
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 |
||
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 )) { |
@@ -57,7 +57,7 @@ |
||
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(); |
@@ -22,7 +22,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 )) { |
@@ -22,7 +22,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function getAssignedToPostId( $postId ) |
85 | 85 | { |
86 | - $assignedTo = intval( get_post_meta( $postId, 'assigned_to', true )); |
|
87 | - if(( $post = get_post( $assignedTo )) instanceof WP_Post ) { |
|
86 | + $assignedTo = intval( get_post_meta( $postId, 'assigned_to', true ) ); |
|
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 |
||
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 |
||
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 | } |
@@ -117,7 +117,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 ), |
@@ -147,13 +147,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
346 | 346 | $redirectUri = $hasReferer |
347 | 347 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
348 | 348 | : get_edit_post_link( $postId ); |
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 | } |
@@ -47,7 +47,9 @@ |
||
47 | 47 | */ |
48 | 48 | public function enqueueRecaptchaScript() |
49 | 49 | { |
50 | - if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
|
50 | + if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' ) { |
|
51 | + return; |
|
52 | + } |
|
51 | 53 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
52 | 54 | 'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ), |
53 | 55 | 'onload' => 'glsr_render_recaptcha', |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function enqueueAssets() |
25 | 25 | { |
26 | - if( apply_filters( 'site-reviews/assets/css', true )) { |
|
26 | + if( apply_filters( 'site-reviews/assets/css', true ) ) { |
|
27 | 27 | wp_enqueue_style( |
28 | 28 | Application::ID, |
29 | 29 | $this->getStylesheet(), |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | glsr()->version |
32 | 32 | ); |
33 | 33 | } |
34 | - if( apply_filters( 'site-reviews/assets/js', true )) { |
|
34 | + if( apply_filters( 'site-reviews/assets/js', true ) ) { |
|
35 | 35 | wp_enqueue_script( |
36 | 36 | Application::ID, |
37 | 37 | glsr()->url( 'assets/scripts/'.Application::ID.'.js' ), |
38 | - [],//glsr( Html::class )->getDependencies(), |
|
38 | + [], //glsr( Html::class )->getDependencies(), |
|
39 | 39 | glsr()->version, |
40 | 40 | true |
41 | 41 | ); |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | public function enqueueRecaptchaScript() |
49 | 49 | { |
50 | 50 | if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
51 | - wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
|
51 | + wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [ |
|
52 | 52 | 'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ), |
53 | 53 | 'onload' => 'glsr_render_recaptcha', |
54 | 54 | 'render' => 'explicit', |
55 | - ], 'https://www.google.com/recaptcha/api.js' )); |
|
56 | - $inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' )); |
|
55 | + ], 'https://www.google.com/recaptcha/api.js' ) ); |
|
56 | + $inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ) ); |
|
57 | 57 | wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' ); |
58 | 58 | } |
59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $variables = [ |
66 | 66 | 'action' => Application::PREFIX.'action', |
67 | 67 | 'ajaxnonce' => wp_create_nonce( Application::ID.'-ajax-nonce' ), |
68 | - 'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'], |
|
68 | + 'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'], |
|
69 | 69 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
70 | 70 | ]; |
71 | 71 | $variables = apply_filters( 'site-reviews/enqueue/localize', $variables ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function getStylesheet() |
79 | 79 | { |
80 | - $currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' )); |
|
80 | + $currentTheme = sanitize_title( (string)wp_get_theme()->get( 'Name' ) ); |
|
81 | 81 | return file_exists( glsr()->path.'assets/styles/'.$currentTheme.'.css' ) |
82 | 82 | ? glsr()->url( 'assets/styles/'.$currentTheme.'.css' ) |
83 | 83 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
@@ -38,25 +38,25 @@ |
||
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 ); |
|
55 | - add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
56 | - add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
57 | - add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
58 | - add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
59 | - add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
60 | - add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
54 | + add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
55 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
56 | + add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
57 | + add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
58 | + add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
59 | + add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
60 | + add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
61 | 61 | } |
62 | 62 | } |
@@ -22,7 +22,8 @@ |
||
22 | 22 | protected $public; |
23 | 23 | protected $translator; |
24 | 24 | |
25 | - public function __construct( Application $app ) { |
|
25 | + public function __construct( Application $app ) |
|
26 | + { |
|
26 | 27 | $this->app = $app; |
27 | 28 | $this->admin = $app->make( AdminController::class ); |
28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | return $input; |
22 | 22 | } |
23 | 23 | $triggered = true; |
24 | - if( !is_array( $input )) { |
|
24 | + if( !is_array( $input ) ) { |
|
25 | 25 | $input = ['settings' => []]; |
26 | 26 | } |
27 | 27 | if( key( $input ) == 'settings' ) { |
28 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
28 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
29 | 29 | } |
30 | 30 | $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input ); |
31 | 31 | $options = $this->sanitizeSubmissions( $input, $options ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | foreach( $settings as $setting ) { |
44 | 44 | register_setting( Application::ID.'-'.$setting, OptionManager::databaseKey(), [ |
45 | 45 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
46 | - ]); |
|
46 | + ] ); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function sanitizeSubmissions( array $input, array $options ) |
54 | 54 | { |
55 | - if( isset( $input['settings']['submissions'] )) { |
|
55 | + if( isset($input['settings']['submissions']) ) { |
|
56 | 56 | $inputForm = $input['settings']['submissions']; |
57 | - $options['settings']['submissions']['required'] = isset( $inputForm['required'] ) |
|
57 | + $options['settings']['submissions']['required'] = isset($inputForm['required']) |
|
58 | 58 | ? $inputForm['required'] |
59 | 59 | : []; |
60 | 60 | } |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected function sanitizeTranslations( array $input, array $options ) |
68 | 68 | { |
69 | - if( isset( $input['settings']['translations'] )) { |
|
70 | - $options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] )); |
|
69 | + if( isset($input['settings']['translations']) ) { |
|
70 | + $options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] ) ); |
|
71 | 71 | array_walk( $options['settings']['translations'], function( &$string ) { |
72 | - if( isset( $string['s2'] )) { |
|
72 | + if( isset($string['s2']) ) { |
|
73 | 73 | $string['s2'] = wp_strip_all_tags( $string['s2'] ); |
74 | 74 | } |
75 | - if( isset( $string['p2'] )) { |
|
75 | + if( isset($string['p2']) ) { |
|
76 | 76 | $string['p2'] = wp_strip_all_tags( $string['p2'] ); |
77 | 77 | } |
78 | 78 | }); |
@@ -42,48 +42,48 @@ |
||
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'] ); |
|
80 | - add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
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'] ); |
|
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 | + add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
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'] ); |
|
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'] ); |
|
87 | - add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
85 | + add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
86 | + add_action( 'admin_init', [$this->router, 'routeWebhookRequest'] ); |
|
87 | + add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
88 | 88 | } |
89 | 89 | } |
@@ -25,7 +25,8 @@ |
||
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 ); |