@@ -115,7 +115,9 @@ discard block |
||
115 | 115 | protected function sendNotification( $post_id, Command $command ) |
116 | 116 | { |
117 | 117 | $notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' ); |
118 | - if( !in_array( $notificationType, ['default','custom','webhook'] ))return; |
|
118 | + if( !in_array( $notificationType, ['default','custom','webhook'] )) { |
|
119 | + return; |
|
120 | + } |
|
119 | 121 | $assignedToTitle = get_the_title( (int) $command->assignedTo ); |
120 | 122 | $notificationSubject = _nx( |
121 | 123 | 'New %s-star review', |
@@ -162,7 +164,9 @@ discard block |
||
162 | 164 | */ |
163 | 165 | protected function sendWebhookNotification( Command $command, array $args ) |
164 | 166 | { |
165 | - if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return; |
|
167 | + if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) { |
|
168 | + return; |
|
169 | + } |
|
166 | 170 | $notification = $this->createWebhookNotification( $command, $args ); |
167 | 171 | $result = wp_remote_post( $endpoint, [ |
168 | 172 | 'method' => 'POST', |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | protected function createWebhookNotification( Command $command, array $args ) |
64 | 64 | { |
65 | 65 | $fields = []; |
66 | - $fields[] = ['title' => str_repeat( ':star:', (int) $command->rating )]; |
|
66 | + $fields[] = ['title' => str_repeat( ':star:', (int)$command->rating )]; |
|
67 | 67 | if( $command->title ) { |
68 | 68 | $fields[] = ['title' => $command->title]; |
69 | 69 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | if( $command->author ) { |
77 | 77 | $fields[] = ['value' => trim( $command->author.$command->email.' - '.$command->ipAddress )]; |
78 | 78 | } |
79 | - $fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ))]; |
|
80 | - return json_encode([ |
|
79 | + $fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ) )]; |
|
80 | + return json_encode( [ |
|
81 | 81 | 'icon_url' => glsr()->url.'assets/img/icon.png', |
82 | 82 | 'username' => glsr()->name, |
83 | 83 | 'attachments' => [[ |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'fallback' => $this->createEmailNotification( $command, $args )->read( 'plaintext' ), |
87 | 87 | 'fields' => $fields, |
88 | 88 | ]], |
89 | - ]); |
|
89 | + ] ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | protected function sendNotification( $post_id, Command $command ) |
116 | 116 | { |
117 | 117 | $notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' ); |
118 | - if( !in_array( $notificationType, ['default','custom','webhook'] ))return; |
|
119 | - $assignedToTitle = get_the_title( (int) $command->assignedTo ); |
|
118 | + if( !in_array( $notificationType, ['default', 'custom', 'webhook'] ) )return; |
|
119 | + $assignedToTitle = get_the_title( (int)$command->assignedTo ); |
|
120 | 120 | $notificationSubject = _nx( |
121 | 121 | 'New %s-star review', |
122 | 122 | 'New %s-star review of: %s', |
123 | - (int) empty( $assignedToTitle ), |
|
123 | + (int)empty($assignedToTitle), |
|
124 | 124 | 'The text is different depending on whether or not the review has been assigned to a post.', |
125 | 125 | 'site-reviews' |
126 | 126 | ); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | sprintf( $notificationSubject, $command->rating, $assignedToTitle ) |
130 | 130 | ); |
131 | 131 | $args = [ |
132 | - 'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $post_id ))), |
|
132 | + 'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $post_id ) ) ), |
|
133 | 133 | 'notification_title' => $notificationTitle, |
134 | 134 | 'notification_type' => $notificationType, |
135 | 135 | ]; |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $args['recipient'] = $args['notification_type'] === 'default' |
148 | 148 | ? get_option( 'admin_email' ) |
149 | 149 | : glsr( OptionManager::class )->get( 'settings.general.notification_email' ); |
150 | - $result = !empty( $args['recipient'] ) |
|
150 | + $result = !empty($args['recipient']) |
|
151 | 151 | ? $this->createEmailNotification( $command, $args )->send() |
152 | 152 | : false; |
153 | - if( !is_bool( $result )) { |
|
154 | - glsr_log()->error( __( 'Email notification was not sent: missing email, subject, or message.', 'site-reviews' )); |
|
153 | + if( !is_bool( $result ) ) { |
|
154 | + glsr_log()->error( __( 'Email notification was not sent: missing email, subject, or message.', 'site-reviews' ) ); |
|
155 | 155 | } |
156 | 156 | if( $result === false ) { |
157 | - glsr_log()->error( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' )); |
|
157 | + glsr_log()->error( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' ) ); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function sendWebhookNotification( Command $command, array $args ) |
165 | 165 | { |
166 | - if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return; |
|
166 | + if( !($endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )) )return; |
|
167 | 167 | $notification = $this->createWebhookNotification( $command, $args ); |
168 | 168 | $result = wp_remote_post( $endpoint, [ |
169 | 169 | 'method' => 'POST', |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | 'sslverify' => false, |
175 | 175 | 'headers' => ['Content-Type' => 'application/json'], |
176 | 176 | 'body' => apply_filters( 'site-reviews/webhook/notification', $notification, $command ), |
177 | - ]); |
|
178 | - if( is_wp_error( $result )) { |
|
177 | + ] ); |
|
178 | + if( is_wp_error( $result ) ) { |
|
179 | 179 | glsr_log()->error( $result->get_error_message() ); |
180 | 180 | } |
181 | 181 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'label' => '['.$tag.']', |
48 | 48 | 'required' => $this->required, |
49 | 49 | 'title' => esc_html__( 'Shortcode', 'site-reviews' ), |
50 | - ]); |
|
50 | + ] ); |
|
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 | |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | protected function generateFields( array $fields ) |
58 | 58 | { |
59 | 59 | $generatedFields = array_map( function( $field ) { |
60 | - if( empty( $field ))return; |
|
60 | + if( empty($field) )return; |
|
61 | 61 | $field = $this->normalize( $field ); |
62 | - if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return; |
|
62 | + if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return; |
|
63 | 63 | return $this->$method( $field ); |
64 | 64 | }, $fields ); |
65 | - return array_values( array_filter( $generatedFields )); |
|
65 | + return array_values( array_filter( $generatedFields ) ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | protected function getFields() |
72 | 72 | { |
73 | 73 | $fields = $this->generateFields( $this->fields() ); |
74 | - if( !empty( $this->errors )) { |
|
74 | + if( !empty($this->errors) ) { |
|
75 | 75 | $errors = []; |
76 | 76 | foreach( $this->required as $name => $alert ) { |
77 | - if( false !== array_search( $name, array_column( $fields, 'name' )))continue; |
|
77 | + if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue; |
|
78 | 78 | $errors[] = $this->errors[$name]; |
79 | 79 | } |
80 | 80 | $this->errors = $errors; |
81 | 81 | } |
82 | - return empty( $this->errors ) |
|
82 | + return empty($this->errors) |
|
83 | 83 | ? $fields |
84 | 84 | : $this->errors; |
85 | 85 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return wp_parse_args( $field, [ |
93 | 93 | 'items' => [], |
94 | 94 | 'type' => '', |
95 | - ]); |
|
95 | + ] ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'tooltip' => '', |
111 | 111 | 'type' => '', |
112 | 112 | 'value' => '', |
113 | - ]); |
|
113 | + ] ); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function normalizeContainer( array $field ) |
120 | 120 | { |
121 | - if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return; |
|
121 | + if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return; |
|
122 | 122 | $field['items'] = $this->generateFields( $field['items'] ); |
123 | 123 | return $field; |
124 | 124 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function normalizeField( array $field, array $defaults ) |
130 | 130 | { |
131 | - if( !$this->validate( $field ))return; |
|
131 | + if( !$this->validate( $field ) )return; |
|
132 | 132 | return array_filter( shortcode_atts( $defaults, $field ), function( $value ) { |
133 | 133 | return $value !== ''; |
134 | 134 | }); |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | 'tooltip' => '', |
149 | 149 | 'type' => '', |
150 | 150 | 'value' => '', |
151 | - ]); |
|
152 | - if( !is_array( $listbox ))return; |
|
153 | - if( !array_key_exists( '', $listbox['options'] )) { |
|
151 | + ] ); |
|
152 | + if( !is_array( $listbox ) )return; |
|
153 | + if( !array_key_exists( '', $listbox['options'] ) ) { |
|
154 | 154 | $listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options']; |
155 | 155 | } |
156 | 156 | foreach( $listbox['options'] as $value => $text ) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function normalizePost( array $field ) |
169 | 169 | { |
170 | - if( !is_array( $field['query_args'] )) { |
|
170 | + if( !is_array( $field['query_args'] ) ) { |
|
171 | 171 | $field['query_args'] = []; |
172 | 172 | } |
173 | 173 | $posts = get_posts( wp_parse_args( $field['query_args'], [ |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | 'orderby' => 'title', |
176 | 176 | 'post_type' => 'post', |
177 | 177 | 'posts_per_page' => 30, |
178 | - ])); |
|
179 | - if( !empty( $posts )) { |
|
178 | + ] ) ); |
|
179 | + if( !empty($posts) ) { |
|
180 | 180 | $options = []; |
181 | 181 | foreach( $posts as $post ) { |
182 | 182 | $options[$post->ID] = esc_html( $post->post_title ); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | 'tooltip' => '', |
207 | 207 | 'type' => '', |
208 | 208 | 'value' => '', |
209 | - ]); |
|
209 | + ] ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | protected function validate( array $field ) |
216 | 216 | { |
217 | - $args = shortcode_atts([ |
|
217 | + $args = shortcode_atts( [ |
|
218 | 218 | 'label' => '', |
219 | 219 | 'name' => false, |
220 | 220 | 'required' => false, |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | */ |
231 | 231 | protected function validateErrors( array $args ) |
232 | 232 | { |
233 | - if( !isset( $args['required']['error'] )) { |
|
233 | + if( !isset($args['required']['error']) ) { |
|
234 | 234 | return true; |
235 | 235 | } |
236 | - $this->errors[$args['name']] = $this->normalizeContainer([ |
|
236 | + $this->errors[$args['name']] = $this->normalizeContainer( [ |
|
237 | 237 | 'html' => $args['required']['error'], |
238 | 238 | 'type' => 'container', |
239 | - ]); |
|
239 | + ] ); |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | return true; |
250 | 250 | } |
251 | 251 | $alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' ); |
252 | - if( isset( $args['required']['alert'] )) { |
|
252 | + if( isset($args['required']['alert']) ) { |
|
253 | 253 | $alert = $args['required']['alert']; |
254 | 254 | } |
255 | - else if( !empty( $args['label'] )) { |
|
255 | + else if( !empty($args['label']) ) { |
|
256 | 256 | $alert = sprintf( |
257 | 257 | esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ), |
258 | 258 | str_replace( ':', '', $args['label'] ) |
@@ -57,9 +57,13 @@ discard block |
||
57 | 57 | protected function generateFields( array $fields ) |
58 | 58 | { |
59 | 59 | $generatedFields = array_map( function( $field ) { |
60 | - if( empty( $field ))return; |
|
60 | + if( empty( $field )) { |
|
61 | + return; |
|
62 | + } |
|
61 | 63 | $field = $this->normalize( $field ); |
62 | - if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return; |
|
64 | + if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) { |
|
65 | + return; |
|
66 | + } |
|
63 | 67 | return $this->$method( $field ); |
64 | 68 | }, $fields ); |
65 | 69 | return array_values( array_filter( $generatedFields )); |
@@ -74,7 +78,9 @@ discard block |
||
74 | 78 | if( !empty( $this->errors )) { |
75 | 79 | $errors = []; |
76 | 80 | foreach( $this->required as $name => $alert ) { |
77 | - if( false !== array_search( $name, array_column( $fields, 'name' )))continue; |
|
81 | + if( false !== array_search( $name, array_column( $fields, 'name' ))) { |
|
82 | + continue; |
|
83 | + } |
|
78 | 84 | $errors[] = $this->errors[$name]; |
79 | 85 | } |
80 | 86 | $this->errors = $errors; |
@@ -118,7 +124,9 @@ discard block |
||
118 | 124 | */ |
119 | 125 | protected function normalizeContainer( array $field ) |
120 | 126 | { |
121 | - if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return; |
|
127 | + if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) { |
|
128 | + return; |
|
129 | + } |
|
122 | 130 | $field['items'] = $this->generateFields( $field['items'] ); |
123 | 131 | return $field; |
124 | 132 | } |
@@ -128,7 +136,9 @@ discard block |
||
128 | 136 | */ |
129 | 137 | protected function normalizeField( array $field, array $defaults ) |
130 | 138 | { |
131 | - if( !$this->validate( $field ))return; |
|
139 | + if( !$this->validate( $field )) { |
|
140 | + return; |
|
141 | + } |
|
132 | 142 | return array_filter( shortcode_atts( $defaults, $field ), function( $value ) { |
133 | 143 | return $value !== ''; |
134 | 144 | }); |
@@ -149,7 +159,9 @@ discard block |
||
149 | 159 | 'type' => '', |
150 | 160 | 'value' => '', |
151 | 161 | ]); |
152 | - if( !is_array( $listbox ))return; |
|
162 | + if( !is_array( $listbox )) { |
|
163 | + return; |
|
164 | + } |
|
153 | 165 | if( !array_key_exists( '', $listbox['options'] )) { |
154 | 166 | $listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options']; |
155 | 167 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $diff = time() - strtotime( $date ); |
32 | 32 | foreach( static::$TIME_PERIODS as $i => $timePeriod ) { |
33 | 33 | if( $diff > $timePeriod[0] )continue; |
34 | - $unit = intval( floor( $diff / $timePeriod[1] )); |
|
34 | + $unit = intval( floor( $diff / $timePeriod[1] ) ); |
|
35 | 35 | $relativeDates = [ |
36 | 36 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
37 | 37 | _n( '%s minute ago', '%s minutes ago', $unit, 'site-reviews' ), |
@@ -30,7 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | $diff = time() - strtotime( $date ); |
32 | 32 | foreach( static::$TIME_PERIODS as $i => $timePeriod ) { |
33 | - if( $diff > $timePeriod[0] )continue; |
|
33 | + if( $diff > $timePeriod[0] ) { |
|
34 | + continue; |
|
35 | + } |
|
34 | 36 | $unit = intval( floor( $diff / $timePeriod[1] )); |
35 | 37 | $relativeDates = [ |
36 | 38 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | natsort( $routines ); |
17 | 17 | array_walk( $routines, function( $routine ) { |
18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
19 | + if( version_compare( glsr()->version, $version, '>=' ) )return; |
|
20 | 20 | call_user_func( [$this, $routine] ); |
21 | 21 | }); |
22 | 22 | $this->updateVersion(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function updateVersion() |
29 | 29 | { |
30 | 30 | $currentVersion = glsr( OptionManager::class )->get( 'version' ); |
31 | - if( version_compare( $currentVersion, glsr()->version, '<' )) { |
|
31 | + if( version_compare( $currentVersion, glsr()->version, '<' ) ) { |
|
32 | 32 | glsr( OptionManager::class )->set( 'version', glsr()->version ); |
33 | 33 | } |
34 | 34 | if( $currentVersion != glsr()->version ) { |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | natsort( $routines ); |
17 | 17 | array_walk( $routines, function( $routine ) { |
18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
19 | + if( version_compare( glsr()->version, $version, '>=' )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | call_user_func( [$this, $routine] ); |
21 | 23 | }); |
22 | 24 | $this->updateVersion(); |
@@ -37,5 +39,6 @@ discard block |
||
37 | 39 | } |
38 | 40 | |
39 | 41 | protected function upgrade_3_0_0() |
40 | - {} |
|
42 | + { |
|
43 | +} |
|
41 | 44 | } |
@@ -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 | } |
@@ -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' ); |
@@ -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 ); |
@@ -38,27 +38,27 @@ |
||
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( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | - add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | - add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | - 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( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | + add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | + add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | + add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
55 | 55 | add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
56 | - add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | - add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | - add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | - add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | - add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | - add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | - add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
56 | + add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | + add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | + add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | + add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | + add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | + add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
63 | 63 | } |
64 | 64 | } |
@@ -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 ); |
@@ -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'], 10, 2 ); |
|
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'], 10, 2 ); |
|
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 | } |