@@ -11,247 +11,247 @@ |
||
11 | 11 | |
12 | 12 | class TranslationController |
13 | 13 | { |
14 | - /** |
|
15 | - * @var Translator |
|
16 | - */ |
|
17 | - public $translator; |
|
14 | + /** |
|
15 | + * @var Translator |
|
16 | + */ |
|
17 | + public $translator; |
|
18 | 18 | |
19 | - public function __construct(Translator $translator) |
|
20 | - { |
|
21 | - $this->translator = $translator; |
|
22 | - } |
|
19 | + public function __construct(Translator $translator) |
|
20 | + { |
|
21 | + $this->translator = $translator; |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * @return void |
|
26 | - * @action plugins_loaded |
|
27 | - */ |
|
28 | - public function addTranslationFilters() |
|
29 | - { |
|
30 | - if (empty(glsr(Translation::class)->translations())) { |
|
31 | - return; |
|
32 | - } |
|
33 | - add_filter('gettext', [$this, 'filterGettext'], 9, 3); |
|
34 | - add_filter('site-reviews/gettext/site-reviews', [$this, 'filterGettextSiteReviews'], 10, 2); |
|
35 | - add_filter('gettext_with_context', [$this, 'filterGettextWithContext'], 9, 4); |
|
36 | - add_filter('site-reviews/gettext_with_context/site-reviews', [$this, 'filterGettextWithContextSiteReviews'], 10, 3); |
|
37 | - add_filter('ngettext', [$this, 'filterNgettext'], 9, 5); |
|
38 | - add_filter('site-reviews/ngettext/site-reviews', [$this, 'filterNgettextSiteReviews'], 10, 4); |
|
39 | - add_filter('ngettext_with_context', [$this, 'filterNgettextWithContext'], 9, 6); |
|
40 | - add_filter('site-reviews/ngettext_with_context/site-reviews', [$this, 'filterNgettextWithContextSiteReviews'], 10, 5); |
|
41 | - } |
|
24 | + /** |
|
25 | + * @return void |
|
26 | + * @action plugins_loaded |
|
27 | + */ |
|
28 | + public function addTranslationFilters() |
|
29 | + { |
|
30 | + if (empty(glsr(Translation::class)->translations())) { |
|
31 | + return; |
|
32 | + } |
|
33 | + add_filter('gettext', [$this, 'filterGettext'], 9, 3); |
|
34 | + add_filter('site-reviews/gettext/site-reviews', [$this, 'filterGettextSiteReviews'], 10, 2); |
|
35 | + add_filter('gettext_with_context', [$this, 'filterGettextWithContext'], 9, 4); |
|
36 | + add_filter('site-reviews/gettext_with_context/site-reviews', [$this, 'filterGettextWithContextSiteReviews'], 10, 3); |
|
37 | + add_filter('ngettext', [$this, 'filterNgettext'], 9, 5); |
|
38 | + add_filter('site-reviews/ngettext/site-reviews', [$this, 'filterNgettextSiteReviews'], 10, 4); |
|
39 | + add_filter('ngettext_with_context', [$this, 'filterNgettextWithContext'], 9, 6); |
|
40 | + add_filter('site-reviews/ngettext_with_context/site-reviews', [$this, 'filterNgettextWithContextSiteReviews'], 10, 5); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param array $messages |
|
45 | - * @return array |
|
46 | - * @filter bulk_post_updated_messages |
|
47 | - */ |
|
48 | - public function filterBulkUpdateMessages($messages, array $counts) |
|
49 | - { |
|
50 | - $messages = Arr::consolidateArray($messages); |
|
51 | - $messages[Application::POST_TYPE] = [ |
|
52 | - 'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'), |
|
53 | - 'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'), |
|
54 | - 'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'), |
|
55 | - 'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'), |
|
56 | - 'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'), |
|
57 | - ]; |
|
58 | - return $messages; |
|
59 | - } |
|
43 | + /** |
|
44 | + * @param array $messages |
|
45 | + * @return array |
|
46 | + * @filter bulk_post_updated_messages |
|
47 | + */ |
|
48 | + public function filterBulkUpdateMessages($messages, array $counts) |
|
49 | + { |
|
50 | + $messages = Arr::consolidateArray($messages); |
|
51 | + $messages[Application::POST_TYPE] = [ |
|
52 | + 'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'), |
|
53 | + 'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'), |
|
54 | + 'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'), |
|
55 | + 'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'), |
|
56 | + 'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'), |
|
57 | + ]; |
|
58 | + return $messages; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param string $translation |
|
63 | - * @param string $text |
|
64 | - * @param string $domain |
|
65 | - * @return string |
|
66 | - * @filter gettext |
|
67 | - */ |
|
68 | - public function filterGettext($translation, $text, $domain) |
|
69 | - { |
|
70 | - return apply_filters('site-reviews/gettext/'.$domain, $translation, $text); |
|
71 | - } |
|
61 | + /** |
|
62 | + * @param string $translation |
|
63 | + * @param string $text |
|
64 | + * @param string $domain |
|
65 | + * @return string |
|
66 | + * @filter gettext |
|
67 | + */ |
|
68 | + public function filterGettext($translation, $text, $domain) |
|
69 | + { |
|
70 | + return apply_filters('site-reviews/gettext/'.$domain, $translation, $text); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @param string $translation |
|
75 | - * @param string $text |
|
76 | - * @return string |
|
77 | - * @filter site-reviews/gettext/site-reviews |
|
78 | - */ |
|
79 | - public function filterGettextSiteReviews($translation, $text) |
|
80 | - { |
|
81 | - return $this->translator->translate($translation, Application::ID, [ |
|
82 | - 'single' => $text, |
|
83 | - ]); |
|
84 | - } |
|
73 | + /** |
|
74 | + * @param string $translation |
|
75 | + * @param string $text |
|
76 | + * @return string |
|
77 | + * @filter site-reviews/gettext/site-reviews |
|
78 | + */ |
|
79 | + public function filterGettextSiteReviews($translation, $text) |
|
80 | + { |
|
81 | + return $this->translator->translate($translation, Application::ID, [ |
|
82 | + 'single' => $text, |
|
83 | + ]); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param string $translation |
|
88 | - * @param string $text |
|
89 | - * @param string $context |
|
90 | - * @param string $domain |
|
91 | - * @return string |
|
92 | - * @filter gettext_with_context |
|
93 | - */ |
|
94 | - public function filterGettextWithContext($translation, $text, $context, $domain) |
|
95 | - { |
|
96 | - return apply_filters('site-reviews/gettext_with_context/'.$domain, $translation, $text, $context); |
|
97 | - } |
|
86 | + /** |
|
87 | + * @param string $translation |
|
88 | + * @param string $text |
|
89 | + * @param string $context |
|
90 | + * @param string $domain |
|
91 | + * @return string |
|
92 | + * @filter gettext_with_context |
|
93 | + */ |
|
94 | + public function filterGettextWithContext($translation, $text, $context, $domain) |
|
95 | + { |
|
96 | + return apply_filters('site-reviews/gettext_with_context/'.$domain, $translation, $text, $context); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @param string $translation |
|
101 | - * @param string $text |
|
102 | - * @param string $context |
|
103 | - * @return string |
|
104 | - * @filter site-reviews/gettext_with_context/site-reviews |
|
105 | - */ |
|
106 | - public function filterGettextWithContextSiteReviews($translation, $text, $context) |
|
107 | - { |
|
108 | - return $this->translator->translate($translation, Application::ID, [ |
|
109 | - 'context' => $context, |
|
110 | - 'single' => $text, |
|
111 | - ]); |
|
112 | - } |
|
99 | + /** |
|
100 | + * @param string $translation |
|
101 | + * @param string $text |
|
102 | + * @param string $context |
|
103 | + * @return string |
|
104 | + * @filter site-reviews/gettext_with_context/site-reviews |
|
105 | + */ |
|
106 | + public function filterGettextWithContextSiteReviews($translation, $text, $context) |
|
107 | + { |
|
108 | + return $this->translator->translate($translation, Application::ID, [ |
|
109 | + 'context' => $context, |
|
110 | + 'single' => $text, |
|
111 | + ]); |
|
112 | + } |
|
113 | 113 | |
114 | - /** |
|
115 | - * @param string $translation |
|
116 | - * @param string $single |
|
117 | - * @param string $plural |
|
118 | - * @param int $number |
|
119 | - * @param string $domain |
|
120 | - * @return string |
|
121 | - * @filter ngettext |
|
122 | - */ |
|
123 | - public function filterNgettext($translation, $single, $plural, $number, $domain) |
|
124 | - { |
|
125 | - return apply_filters('site-reviews/ngettext/'.$domain, $translation, $single, $plural, $number); |
|
126 | - } |
|
114 | + /** |
|
115 | + * @param string $translation |
|
116 | + * @param string $single |
|
117 | + * @param string $plural |
|
118 | + * @param int $number |
|
119 | + * @param string $domain |
|
120 | + * @return string |
|
121 | + * @filter ngettext |
|
122 | + */ |
|
123 | + public function filterNgettext($translation, $single, $plural, $number, $domain) |
|
124 | + { |
|
125 | + return apply_filters('site-reviews/ngettext/'.$domain, $translation, $single, $plural, $number); |
|
126 | + } |
|
127 | 127 | |
128 | - /** |
|
129 | - * @param string $translation |
|
130 | - * @param string $single |
|
131 | - * @param string $plural |
|
132 | - * @param int $number |
|
133 | - * @return string |
|
134 | - * @filter site-reviews/ngettext/site-reviews |
|
135 | - */ |
|
136 | - public function filterNgettextSiteReviews($translation, $single, $plural, $number) |
|
137 | - { |
|
138 | - return $this->translator->translate($translation, Application::ID, [ |
|
139 | - 'number' => $number, |
|
140 | - 'plural' => $plural, |
|
141 | - 'single' => $single, |
|
142 | - ]); |
|
143 | - } |
|
128 | + /** |
|
129 | + * @param string $translation |
|
130 | + * @param string $single |
|
131 | + * @param string $plural |
|
132 | + * @param int $number |
|
133 | + * @return string |
|
134 | + * @filter site-reviews/ngettext/site-reviews |
|
135 | + */ |
|
136 | + public function filterNgettextSiteReviews($translation, $single, $plural, $number) |
|
137 | + { |
|
138 | + return $this->translator->translate($translation, Application::ID, [ |
|
139 | + 'number' => $number, |
|
140 | + 'plural' => $plural, |
|
141 | + 'single' => $single, |
|
142 | + ]); |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * @param string $translation |
|
147 | - * @param string $single |
|
148 | - * @param string $plural |
|
149 | - * @param int $number |
|
150 | - * @param string $context |
|
151 | - * @param string $domain |
|
152 | - * @return string |
|
153 | - * @filter ngettext_with_context |
|
154 | - */ |
|
155 | - public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain) |
|
156 | - { |
|
157 | - return apply_filters('site-reviews/ngettext_with_context/'.$domain, $translation, $single, $plural, $number, $context); |
|
158 | - } |
|
145 | + /** |
|
146 | + * @param string $translation |
|
147 | + * @param string $single |
|
148 | + * @param string $plural |
|
149 | + * @param int $number |
|
150 | + * @param string $context |
|
151 | + * @param string $domain |
|
152 | + * @return string |
|
153 | + * @filter ngettext_with_context |
|
154 | + */ |
|
155 | + public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain) |
|
156 | + { |
|
157 | + return apply_filters('site-reviews/ngettext_with_context/'.$domain, $translation, $single, $plural, $number, $context); |
|
158 | + } |
|
159 | 159 | |
160 | - /** |
|
161 | - * @param string $translation |
|
162 | - * @param string $single |
|
163 | - * @param string $plural |
|
164 | - * @param int $number |
|
165 | - * @param string $context |
|
166 | - * @return string |
|
167 | - * @filter site-reviews/ngettext_with_context/site-reviews |
|
168 | - */ |
|
169 | - public function filterNgettextWithContextSiteReviews($translation, $single, $plural, $number, $context) |
|
170 | - { |
|
171 | - return $this->translator->translate($translation, Application::ID, [ |
|
172 | - 'context' => $context, |
|
173 | - 'number' => $number, |
|
174 | - 'plural' => $plural, |
|
175 | - 'single' => $single, |
|
176 | - ]); |
|
177 | - } |
|
160 | + /** |
|
161 | + * @param string $translation |
|
162 | + * @param string $single |
|
163 | + * @param string $plural |
|
164 | + * @param int $number |
|
165 | + * @param string $context |
|
166 | + * @return string |
|
167 | + * @filter site-reviews/ngettext_with_context/site-reviews |
|
168 | + */ |
|
169 | + public function filterNgettextWithContextSiteReviews($translation, $single, $plural, $number, $context) |
|
170 | + { |
|
171 | + return $this->translator->translate($translation, Application::ID, [ |
|
172 | + 'context' => $context, |
|
173 | + 'number' => $number, |
|
174 | + 'plural' => $plural, |
|
175 | + 'single' => $single, |
|
176 | + ]); |
|
177 | + } |
|
178 | 178 | |
179 | - /** |
|
180 | - * @param array $postStates |
|
181 | - * @param \WP_Post $post |
|
182 | - * @return array |
|
183 | - * @filter display_post_states |
|
184 | - */ |
|
185 | - public function filterPostStates($postStates, $post) |
|
186 | - { |
|
187 | - $postStates = Arr::consolidateArray($postStates); |
|
188 | - if (Application::POST_TYPE == Arr::get($post, 'post_type') && array_key_exists('pending', $postStates)) { |
|
189 | - $postStates['pending'] = __('Unapproved', 'site-reviews'); |
|
190 | - } |
|
191 | - return $postStates; |
|
192 | - } |
|
179 | + /** |
|
180 | + * @param array $postStates |
|
181 | + * @param \WP_Post $post |
|
182 | + * @return array |
|
183 | + * @filter display_post_states |
|
184 | + */ |
|
185 | + public function filterPostStates($postStates, $post) |
|
186 | + { |
|
187 | + $postStates = Arr::consolidateArray($postStates); |
|
188 | + if (Application::POST_TYPE == Arr::get($post, 'post_type') && array_key_exists('pending', $postStates)) { |
|
189 | + $postStates['pending'] = __('Unapproved', 'site-reviews'); |
|
190 | + } |
|
191 | + return $postStates; |
|
192 | + } |
|
193 | 193 | |
194 | - /** |
|
195 | - * @param string $translation |
|
196 | - * @param string $text |
|
197 | - * @return string |
|
198 | - * @filter site-reviews/gettext/default |
|
199 | - * @filter site-reviews/gettext_with_context/default |
|
200 | - */ |
|
201 | - public function filterPostStatusLabels($translation, $text) |
|
202 | - { |
|
203 | - return $this->canModifyTranslation() |
|
204 | - ? glsr(Labels::class)->filterPostStatusLabels($translation, $text) |
|
205 | - : $translation; |
|
206 | - } |
|
194 | + /** |
|
195 | + * @param string $translation |
|
196 | + * @param string $text |
|
197 | + * @return string |
|
198 | + * @filter site-reviews/gettext/default |
|
199 | + * @filter site-reviews/gettext_with_context/default |
|
200 | + */ |
|
201 | + public function filterPostStatusLabels($translation, $text) |
|
202 | + { |
|
203 | + return $this->canModifyTranslation() |
|
204 | + ? glsr(Labels::class)->filterPostStatusLabels($translation, $text) |
|
205 | + : $translation; |
|
206 | + } |
|
207 | 207 | |
208 | - /** |
|
209 | - * @param string $translation |
|
210 | - * @param string $single |
|
211 | - * @param string $plural |
|
212 | - * @param int $number |
|
213 | - * @return string |
|
214 | - * @filter site-reviews/ngettext/default |
|
215 | - */ |
|
216 | - public function filterPostStatusText($translation, $single, $plural, $number) |
|
217 | - { |
|
218 | - if ($this->canModifyTranslation()) { |
|
219 | - $strings = [ |
|
220 | - 'Published' => __('Approved', 'site-reviews'), |
|
221 | - 'Pending' => __('Unapproved', 'site-reviews'), |
|
222 | - ]; |
|
223 | - foreach ($strings as $search => $replace) { |
|
224 | - if (!Str::contains($single, $search)) { |
|
225 | - continue; |
|
226 | - } |
|
227 | - return $this->translator->getTranslation([ |
|
228 | - 'number' => $number, |
|
229 | - 'plural' => str_replace($search, $replace, $plural), |
|
230 | - 'single' => str_replace($search, $replace, $single), |
|
231 | - ]); |
|
232 | - } |
|
233 | - } |
|
234 | - return $translation; |
|
235 | - } |
|
208 | + /** |
|
209 | + * @param string $translation |
|
210 | + * @param string $single |
|
211 | + * @param string $plural |
|
212 | + * @param int $number |
|
213 | + * @return string |
|
214 | + * @filter site-reviews/ngettext/default |
|
215 | + */ |
|
216 | + public function filterPostStatusText($translation, $single, $plural, $number) |
|
217 | + { |
|
218 | + if ($this->canModifyTranslation()) { |
|
219 | + $strings = [ |
|
220 | + 'Published' => __('Approved', 'site-reviews'), |
|
221 | + 'Pending' => __('Unapproved', 'site-reviews'), |
|
222 | + ]; |
|
223 | + foreach ($strings as $search => $replace) { |
|
224 | + if (!Str::contains($single, $search)) { |
|
225 | + continue; |
|
226 | + } |
|
227 | + return $this->translator->getTranslation([ |
|
228 | + 'number' => $number, |
|
229 | + 'plural' => str_replace($search, $replace, $plural), |
|
230 | + 'single' => str_replace($search, $replace, $single), |
|
231 | + ]); |
|
232 | + } |
|
233 | + } |
|
234 | + return $translation; |
|
235 | + } |
|
236 | 236 | |
237 | - /** |
|
238 | - * @return void |
|
239 | - * @action admin_enqueue_scripts |
|
240 | - */ |
|
241 | - public function translatePostStatusLabels() |
|
242 | - { |
|
243 | - if ($this->canModifyTranslation()) { |
|
244 | - glsr(Labels::class)->translatePostStatusLabels(); |
|
245 | - } |
|
246 | - } |
|
237 | + /** |
|
238 | + * @return void |
|
239 | + * @action admin_enqueue_scripts |
|
240 | + */ |
|
241 | + public function translatePostStatusLabels() |
|
242 | + { |
|
243 | + if ($this->canModifyTranslation()) { |
|
244 | + glsr(Labels::class)->translatePostStatusLabels(); |
|
245 | + } |
|
246 | + } |
|
247 | 247 | |
248 | - /** |
|
249 | - * @return bool |
|
250 | - */ |
|
251 | - protected function canModifyTranslation() |
|
252 | - { |
|
253 | - $screen = glsr_current_screen(); |
|
254 | - return Application::POST_TYPE == $screen->post_type |
|
255 | - && in_array($screen->base, ['edit', 'post']); |
|
256 | - } |
|
248 | + /** |
|
249 | + * @return bool |
|
250 | + */ |
|
251 | + protected function canModifyTranslation() |
|
252 | + { |
|
253 | + $screen = glsr_current_screen(); |
|
254 | + return Application::POST_TYPE == $screen->post_type |
|
255 | + && in_array($screen->base, ['edit', 'post']); |
|
256 | + } |
|
257 | 257 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public $translator; |
18 | 18 | |
19 | - public function __construct(Translator $translator) |
|
19 | + public function __construct( Translator $translator ) |
|
20 | 20 | { |
21 | 21 | $this->translator = $translator; |
22 | 22 | } |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function addTranslationFilters() |
29 | 29 | { |
30 | - if (empty(glsr(Translation::class)->translations())) { |
|
30 | + if( empty(glsr( Translation::class )->translations()) ) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | - add_filter('gettext', [$this, 'filterGettext'], 9, 3); |
|
34 | - add_filter('site-reviews/gettext/site-reviews', [$this, 'filterGettextSiteReviews'], 10, 2); |
|
35 | - add_filter('gettext_with_context', [$this, 'filterGettextWithContext'], 9, 4); |
|
36 | - add_filter('site-reviews/gettext_with_context/site-reviews', [$this, 'filterGettextWithContextSiteReviews'], 10, 3); |
|
37 | - add_filter('ngettext', [$this, 'filterNgettext'], 9, 5); |
|
38 | - add_filter('site-reviews/ngettext/site-reviews', [$this, 'filterNgettextSiteReviews'], 10, 4); |
|
39 | - add_filter('ngettext_with_context', [$this, 'filterNgettextWithContext'], 9, 6); |
|
40 | - add_filter('site-reviews/ngettext_with_context/site-reviews', [$this, 'filterNgettextWithContextSiteReviews'], 10, 5); |
|
33 | + add_filter( 'gettext', [$this, 'filterGettext'], 9, 3 ); |
|
34 | + add_filter( 'site-reviews/gettext/site-reviews', [$this, 'filterGettextSiteReviews'], 10, 2 ); |
|
35 | + add_filter( 'gettext_with_context', [$this, 'filterGettextWithContext'], 9, 4 ); |
|
36 | + add_filter( 'site-reviews/gettext_with_context/site-reviews', [$this, 'filterGettextWithContextSiteReviews'], 10, 3 ); |
|
37 | + add_filter( 'ngettext', [$this, 'filterNgettext'], 9, 5 ); |
|
38 | + add_filter( 'site-reviews/ngettext/site-reviews', [$this, 'filterNgettextSiteReviews'], 10, 4 ); |
|
39 | + add_filter( 'ngettext_with_context', [$this, 'filterNgettextWithContext'], 9, 6 ); |
|
40 | + add_filter( 'site-reviews/ngettext_with_context/site-reviews', [$this, 'filterNgettextWithContextSiteReviews'], 10, 5 ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | * @return array |
46 | 46 | * @filter bulk_post_updated_messages |
47 | 47 | */ |
48 | - public function filterBulkUpdateMessages($messages, array $counts) |
|
48 | + public function filterBulkUpdateMessages( $messages, array $counts ) |
|
49 | 49 | { |
50 | - $messages = Arr::consolidateArray($messages); |
|
50 | + $messages = Arr::consolidateArray( $messages ); |
|
51 | 51 | $messages[Application::POST_TYPE] = [ |
52 | - 'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'), |
|
53 | - 'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'), |
|
54 | - 'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'), |
|
55 | - 'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'), |
|
56 | - 'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'), |
|
52 | + 'updated' => _n( '%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews' ), |
|
53 | + 'locked' => _n( '%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews' ), |
|
54 | + 'deleted' => _n( '%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews' ), |
|
55 | + 'trashed' => _n( '%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews' ), |
|
56 | + 'untrashed' => _n( '%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews' ), |
|
57 | 57 | ]; |
58 | 58 | return $messages; |
59 | 59 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * @return string |
66 | 66 | * @filter gettext |
67 | 67 | */ |
68 | - public function filterGettext($translation, $text, $domain) |
|
68 | + public function filterGettext( $translation, $text, $domain ) |
|
69 | 69 | { |
70 | - return apply_filters('site-reviews/gettext/'.$domain, $translation, $text); |
|
70 | + return apply_filters( 'site-reviews/gettext/'.$domain, $translation, $text ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | * @return string |
77 | 77 | * @filter site-reviews/gettext/site-reviews |
78 | 78 | */ |
79 | - public function filterGettextSiteReviews($translation, $text) |
|
79 | + public function filterGettextSiteReviews( $translation, $text ) |
|
80 | 80 | { |
81 | - return $this->translator->translate($translation, Application::ID, [ |
|
81 | + return $this->translator->translate( $translation, Application::ID, [ |
|
82 | 82 | 'single' => $text, |
83 | - ]); |
|
83 | + ] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | * @return string |
92 | 92 | * @filter gettext_with_context |
93 | 93 | */ |
94 | - public function filterGettextWithContext($translation, $text, $context, $domain) |
|
94 | + public function filterGettextWithContext( $translation, $text, $context, $domain ) |
|
95 | 95 | { |
96 | - return apply_filters('site-reviews/gettext_with_context/'.$domain, $translation, $text, $context); |
|
96 | + return apply_filters( 'site-reviews/gettext_with_context/'.$domain, $translation, $text, $context ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | * @return string |
104 | 104 | * @filter site-reviews/gettext_with_context/site-reviews |
105 | 105 | */ |
106 | - public function filterGettextWithContextSiteReviews($translation, $text, $context) |
|
106 | + public function filterGettextWithContextSiteReviews( $translation, $text, $context ) |
|
107 | 107 | { |
108 | - return $this->translator->translate($translation, Application::ID, [ |
|
108 | + return $this->translator->translate( $translation, Application::ID, [ |
|
109 | 109 | 'context' => $context, |
110 | 110 | 'single' => $text, |
111 | - ]); |
|
111 | + ] ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * @return string |
121 | 121 | * @filter ngettext |
122 | 122 | */ |
123 | - public function filterNgettext($translation, $single, $plural, $number, $domain) |
|
123 | + public function filterNgettext( $translation, $single, $plural, $number, $domain ) |
|
124 | 124 | { |
125 | - return apply_filters('site-reviews/ngettext/'.$domain, $translation, $single, $plural, $number); |
|
125 | + return apply_filters( 'site-reviews/ngettext/'.$domain, $translation, $single, $plural, $number ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @return string |
134 | 134 | * @filter site-reviews/ngettext/site-reviews |
135 | 135 | */ |
136 | - public function filterNgettextSiteReviews($translation, $single, $plural, $number) |
|
136 | + public function filterNgettextSiteReviews( $translation, $single, $plural, $number ) |
|
137 | 137 | { |
138 | - return $this->translator->translate($translation, Application::ID, [ |
|
138 | + return $this->translator->translate( $translation, Application::ID, [ |
|
139 | 139 | 'number' => $number, |
140 | 140 | 'plural' => $plural, |
141 | 141 | 'single' => $single, |
142 | - ]); |
|
142 | + ] ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @return string |
153 | 153 | * @filter ngettext_with_context |
154 | 154 | */ |
155 | - public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain) |
|
155 | + public function filterNgettextWithContext( $translation, $single, $plural, $number, $context, $domain ) |
|
156 | 156 | { |
157 | - return apply_filters('site-reviews/ngettext_with_context/'.$domain, $translation, $single, $plural, $number, $context); |
|
157 | + return apply_filters( 'site-reviews/ngettext_with_context/'.$domain, $translation, $single, $plural, $number, $context ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | * @return string |
167 | 167 | * @filter site-reviews/ngettext_with_context/site-reviews |
168 | 168 | */ |
169 | - public function filterNgettextWithContextSiteReviews($translation, $single, $plural, $number, $context) |
|
169 | + public function filterNgettextWithContextSiteReviews( $translation, $single, $plural, $number, $context ) |
|
170 | 170 | { |
171 | - return $this->translator->translate($translation, Application::ID, [ |
|
171 | + return $this->translator->translate( $translation, Application::ID, [ |
|
172 | 172 | 'context' => $context, |
173 | 173 | 'number' => $number, |
174 | 174 | 'plural' => $plural, |
175 | 175 | 'single' => $single, |
176 | - ]); |
|
176 | + ] ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | * @return array |
183 | 183 | * @filter display_post_states |
184 | 184 | */ |
185 | - public function filterPostStates($postStates, $post) |
|
185 | + public function filterPostStates( $postStates, $post ) |
|
186 | 186 | { |
187 | - $postStates = Arr::consolidateArray($postStates); |
|
188 | - if (Application::POST_TYPE == Arr::get($post, 'post_type') && array_key_exists('pending', $postStates)) { |
|
189 | - $postStates['pending'] = __('Unapproved', 'site-reviews'); |
|
187 | + $postStates = Arr::consolidateArray( $postStates ); |
|
188 | + if( Application::POST_TYPE == Arr::get( $post, 'post_type' ) && array_key_exists( 'pending', $postStates ) ) { |
|
189 | + $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
|
190 | 190 | } |
191 | 191 | return $postStates; |
192 | 192 | } |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | * @filter site-reviews/gettext/default |
199 | 199 | * @filter site-reviews/gettext_with_context/default |
200 | 200 | */ |
201 | - public function filterPostStatusLabels($translation, $text) |
|
201 | + public function filterPostStatusLabels( $translation, $text ) |
|
202 | 202 | { |
203 | 203 | return $this->canModifyTranslation() |
204 | - ? glsr(Labels::class)->filterPostStatusLabels($translation, $text) |
|
204 | + ? glsr( Labels::class )->filterPostStatusLabels( $translation, $text ) |
|
205 | 205 | : $translation; |
206 | 206 | } |
207 | 207 | |
@@ -213,22 +213,22 @@ discard block |
||
213 | 213 | * @return string |
214 | 214 | * @filter site-reviews/ngettext/default |
215 | 215 | */ |
216 | - public function filterPostStatusText($translation, $single, $plural, $number) |
|
216 | + public function filterPostStatusText( $translation, $single, $plural, $number ) |
|
217 | 217 | { |
218 | - if ($this->canModifyTranslation()) { |
|
218 | + if( $this->canModifyTranslation() ) { |
|
219 | 219 | $strings = [ |
220 | - 'Published' => __('Approved', 'site-reviews'), |
|
221 | - 'Pending' => __('Unapproved', 'site-reviews'), |
|
220 | + 'Published' => __( 'Approved', 'site-reviews' ), |
|
221 | + 'Pending' => __( 'Unapproved', 'site-reviews' ), |
|
222 | 222 | ]; |
223 | - foreach ($strings as $search => $replace) { |
|
224 | - if (!Str::contains($single, $search)) { |
|
223 | + foreach( $strings as $search => $replace ) { |
|
224 | + if( !Str::contains( $single, $search ) ) { |
|
225 | 225 | continue; |
226 | 226 | } |
227 | - return $this->translator->getTranslation([ |
|
227 | + return $this->translator->getTranslation( [ |
|
228 | 228 | 'number' => $number, |
229 | - 'plural' => str_replace($search, $replace, $plural), |
|
230 | - 'single' => str_replace($search, $replace, $single), |
|
231 | - ]); |
|
229 | + 'plural' => str_replace( $search, $replace, $plural ), |
|
230 | + 'single' => str_replace( $search, $replace, $single ), |
|
231 | + ] ); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | return $translation; |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function translatePostStatusLabels() |
242 | 242 | { |
243 | - if ($this->canModifyTranslation()) { |
|
244 | - glsr(Labels::class)->translatePostStatusLabels(); |
|
243 | + if( $this->canModifyTranslation() ) { |
|
244 | + glsr( Labels::class )->translatePostStatusLabels(); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
@@ -252,6 +252,6 @@ discard block |
||
252 | 252 | { |
253 | 253 | $screen = glsr_current_screen(); |
254 | 254 | return Application::POST_TYPE == $screen->post_type |
255 | - && in_array($screen->base, ['edit', 'post']); |
|
255 | + && in_array( $screen->base, ['edit', 'post'] ); |
|
256 | 256 | } |
257 | 257 | } |
@@ -21,112 +21,112 @@ |
||
21 | 21 | |
22 | 22 | class Actions implements HooksContract |
23 | 23 | { |
24 | - protected $about; |
|
25 | - protected $admin; |
|
26 | - protected $app; |
|
27 | - protected $blocks; |
|
28 | - protected $console; |
|
29 | - protected $editor; |
|
30 | - protected $listtable; |
|
31 | - protected $menu; |
|
32 | - protected $main; |
|
33 | - protected $notices; |
|
34 | - protected $public; |
|
35 | - protected $review; |
|
36 | - protected $router; |
|
37 | - protected $settings; |
|
38 | - protected $taxonomy; |
|
39 | - protected $translator; |
|
40 | - protected $trustalyze; |
|
41 | - protected $welcome; |
|
24 | + protected $about; |
|
25 | + protected $admin; |
|
26 | + protected $app; |
|
27 | + protected $blocks; |
|
28 | + protected $console; |
|
29 | + protected $editor; |
|
30 | + protected $listtable; |
|
31 | + protected $menu; |
|
32 | + protected $main; |
|
33 | + protected $notices; |
|
34 | + protected $public; |
|
35 | + protected $review; |
|
36 | + protected $router; |
|
37 | + protected $settings; |
|
38 | + protected $taxonomy; |
|
39 | + protected $translator; |
|
40 | + protected $trustalyze; |
|
41 | + protected $welcome; |
|
42 | 42 | |
43 | - public function __construct(Application $app ) { |
|
44 | - $this->app = $app; |
|
45 | - $this->admin = $app->make(AdminController::class); |
|
46 | - $this->blocks = $app->make(BlocksController::class); |
|
47 | - $this->console = $app->make(Console::class); |
|
48 | - $this->editor = $app->make(EditorController::class); |
|
49 | - $this->listtable = $app->make(ListTableController::class); |
|
50 | - $this->main = $app->make(MainController::class); |
|
51 | - $this->menu = $app->make(MenuController::class); |
|
52 | - $this->notices = $app->make(NoticeController::class); |
|
53 | - $this->public = $app->make(PublicController::class); |
|
54 | - $this->review = $app->make(ReviewController::class); |
|
55 | - $this->router = $app->make(Router::class); |
|
56 | - $this->settings = $app->make(SettingsController::class); |
|
57 | - $this->taxonomy = $app->make(TaxonomyController::class); |
|
58 | - $this->translator = $app->make(TranslationController::class); |
|
59 | - $this->trustalyze = $app->make(TrustalyzeController::class); |
|
60 | - $this->welcome = $app->make(WelcomeController::class); |
|
61 | - } |
|
43 | + public function __construct(Application $app ) { |
|
44 | + $this->app = $app; |
|
45 | + $this->admin = $app->make(AdminController::class); |
|
46 | + $this->blocks = $app->make(BlocksController::class); |
|
47 | + $this->console = $app->make(Console::class); |
|
48 | + $this->editor = $app->make(EditorController::class); |
|
49 | + $this->listtable = $app->make(ListTableController::class); |
|
50 | + $this->main = $app->make(MainController::class); |
|
51 | + $this->menu = $app->make(MenuController::class); |
|
52 | + $this->notices = $app->make(NoticeController::class); |
|
53 | + $this->public = $app->make(PublicController::class); |
|
54 | + $this->review = $app->make(ReviewController::class); |
|
55 | + $this->router = $app->make(Router::class); |
|
56 | + $this->settings = $app->make(SettingsController::class); |
|
57 | + $this->taxonomy = $app->make(TaxonomyController::class); |
|
58 | + $this->translator = $app->make(TranslationController::class); |
|
59 | + $this->trustalyze = $app->make(TrustalyzeController::class); |
|
60 | + $this->welcome = $app->make(WelcomeController::class); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function run() |
|
67 | - { |
|
68 | - add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
69 | - add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
70 | - add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
71 | - add_action('admin_init', [$this->admin, 'runMigrations']); |
|
72 | - add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
73 | - add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
74 | - add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
75 | - add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
76 | - add_action('admin_init', [$this->app, 'setDefaults']); |
|
77 | - add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
78 | - add_action('init', [$this->blocks, 'registerBlocks']); |
|
79 | - add_action('admin_footer', [$this->console, 'logOnce']); |
|
80 | - add_action('wp_footer', [$this->console, 'logOnce']); |
|
81 | - add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
82 | - add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
83 | - add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
84 | - add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
85 | - add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
86 | - add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
87 | - add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
88 | - add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'], 10, 3); |
|
89 | - add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
90 | - add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
91 | - add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
92 | - add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
93 | - add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
94 | - add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
95 | - add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
96 | - add_action('init', [$this->main, 'registerPostType'], 8); |
|
97 | - add_action('init', [$this->main, 'registerShortcodes']); |
|
98 | - add_action('init', [$this->main, 'registerTaxonomy']); |
|
99 | - add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
100 | - add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
101 | - add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
102 | - add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
103 | - add_action('admin_notices', [$this->notices, 'filterAdminNotices']); |
|
104 | - add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
105 | - add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
106 | - add_action('wp_footer', [$this->public, 'renderSchema']); |
|
107 | - add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
108 | - add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
109 | - add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
110 | - add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
111 | - add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
112 | - add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
113 | - add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
114 | - add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
115 | - add_action('init', [$this->router, 'routePublicPostRequest']); |
|
116 | - add_action('admin_init', [$this->settings, 'registerSettings']); |
|
117 | - add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
118 | - add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
119 | - add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
120 | - add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
121 | - add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
122 | - add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
123 | - add_action('plugins_loaded', [$this->translator, 'addTranslationFilters']); |
|
124 | - add_action('admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels']); |
|
125 | - add_action('site-reviews/review/created', [$this->trustalyze, 'onCreated']); |
|
126 | - add_action('site-reviews/review/reverted', [$this->trustalyze, 'onReverted']); |
|
127 | - add_action('site-reviews/review/saved', [$this->trustalyze, 'onSaved']); |
|
128 | - add_action('updated_postmeta', [$this->trustalyze, 'onUpdatedMeta'], 10, 3); |
|
129 | - add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
130 | - add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
131 | - } |
|
63 | + /** |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function run() |
|
67 | + { |
|
68 | + add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
69 | + add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
70 | + add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
71 | + add_action('admin_init', [$this->admin, 'runMigrations']); |
|
72 | + add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
73 | + add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
74 | + add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
75 | + add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
76 | + add_action('admin_init', [$this->app, 'setDefaults']); |
|
77 | + add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
78 | + add_action('init', [$this->blocks, 'registerBlocks']); |
|
79 | + add_action('admin_footer', [$this->console, 'logOnce']); |
|
80 | + add_action('wp_footer', [$this->console, 'logOnce']); |
|
81 | + add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
82 | + add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
83 | + add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
84 | + add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
85 | + add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
86 | + add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
87 | + add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
88 | + add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'], 10, 3); |
|
89 | + add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
90 | + add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
91 | + add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
92 | + add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
93 | + add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
94 | + add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
95 | + add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
96 | + add_action('init', [$this->main, 'registerPostType'], 8); |
|
97 | + add_action('init', [$this->main, 'registerShortcodes']); |
|
98 | + add_action('init', [$this->main, 'registerTaxonomy']); |
|
99 | + add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
100 | + add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
101 | + add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
102 | + add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
103 | + add_action('admin_notices', [$this->notices, 'filterAdminNotices']); |
|
104 | + add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
105 | + add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
106 | + add_action('wp_footer', [$this->public, 'renderSchema']); |
|
107 | + add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
108 | + add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
109 | + add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
110 | + add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
111 | + add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
112 | + add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
113 | + add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
114 | + add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
115 | + add_action('init', [$this->router, 'routePublicPostRequest']); |
|
116 | + add_action('admin_init', [$this->settings, 'registerSettings']); |
|
117 | + add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
118 | + add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
119 | + add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
120 | + add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
121 | + add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
122 | + add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
123 | + add_action('plugins_loaded', [$this->translator, 'addTranslationFilters']); |
|
124 | + add_action('admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels']); |
|
125 | + add_action('site-reviews/review/created', [$this->trustalyze, 'onCreated']); |
|
126 | + add_action('site-reviews/review/reverted', [$this->trustalyze, 'onReverted']); |
|
127 | + add_action('site-reviews/review/saved', [$this->trustalyze, 'onSaved']); |
|
128 | + add_action('updated_postmeta', [$this->trustalyze, 'onUpdatedMeta'], 10, 3); |
|
129 | + add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
130 | + add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
131 | + } |
|
132 | 132 | } |
@@ -40,24 +40,24 @@ discard block |
||
40 | 40 | protected $trustalyze; |
41 | 41 | protected $welcome; |
42 | 42 | |
43 | - public function __construct(Application $app ) { |
|
43 | + public function __construct( Application $app ) { |
|
44 | 44 | $this->app = $app; |
45 | - $this->admin = $app->make(AdminController::class); |
|
46 | - $this->blocks = $app->make(BlocksController::class); |
|
47 | - $this->console = $app->make(Console::class); |
|
48 | - $this->editor = $app->make(EditorController::class); |
|
49 | - $this->listtable = $app->make(ListTableController::class); |
|
50 | - $this->main = $app->make(MainController::class); |
|
51 | - $this->menu = $app->make(MenuController::class); |
|
52 | - $this->notices = $app->make(NoticeController::class); |
|
53 | - $this->public = $app->make(PublicController::class); |
|
54 | - $this->review = $app->make(ReviewController::class); |
|
55 | - $this->router = $app->make(Router::class); |
|
56 | - $this->settings = $app->make(SettingsController::class); |
|
57 | - $this->taxonomy = $app->make(TaxonomyController::class); |
|
58 | - $this->translator = $app->make(TranslationController::class); |
|
59 | - $this->trustalyze = $app->make(TrustalyzeController::class); |
|
60 | - $this->welcome = $app->make(WelcomeController::class); |
|
45 | + $this->admin = $app->make( AdminController::class ); |
|
46 | + $this->blocks = $app->make( BlocksController::class ); |
|
47 | + $this->console = $app->make( Console::class ); |
|
48 | + $this->editor = $app->make( EditorController::class ); |
|
49 | + $this->listtable = $app->make( ListTableController::class ); |
|
50 | + $this->main = $app->make( MainController::class ); |
|
51 | + $this->menu = $app->make( MenuController::class ); |
|
52 | + $this->notices = $app->make( NoticeController::class ); |
|
53 | + $this->public = $app->make( PublicController::class ); |
|
54 | + $this->review = $app->make( ReviewController::class ); |
|
55 | + $this->router = $app->make( Router::class ); |
|
56 | + $this->settings = $app->make( SettingsController::class ); |
|
57 | + $this->taxonomy = $app->make( TaxonomyController::class ); |
|
58 | + $this->translator = $app->make( TranslationController::class ); |
|
59 | + $this->trustalyze = $app->make( TrustalyzeController::class ); |
|
60 | + $this->welcome = $app->make( WelcomeController::class ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -65,68 +65,68 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function run() |
67 | 67 | { |
68 | - add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
69 | - add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
70 | - add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
71 | - add_action('admin_init', [$this->admin, 'runMigrations']); |
|
72 | - add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
73 | - add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
74 | - add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
75 | - add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
76 | - add_action('admin_init', [$this->app, 'setDefaults']); |
|
77 | - add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
78 | - add_action('init', [$this->blocks, 'registerBlocks']); |
|
79 | - add_action('admin_footer', [$this->console, 'logOnce']); |
|
80 | - add_action('wp_footer', [$this->console, 'logOnce']); |
|
81 | - add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
82 | - add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
83 | - add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
84 | - add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
85 | - add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
86 | - add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
87 | - add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
88 | - add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'], 10, 3); |
|
89 | - add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
90 | - add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
91 | - add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
92 | - add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
93 | - add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
94 | - add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
95 | - add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
96 | - add_action('init', [$this->main, 'registerPostType'], 8); |
|
97 | - add_action('init', [$this->main, 'registerShortcodes']); |
|
98 | - add_action('init', [$this->main, 'registerTaxonomy']); |
|
99 | - add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
100 | - add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
101 | - add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
102 | - add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
103 | - add_action('admin_notices', [$this->notices, 'filterAdminNotices']); |
|
104 | - add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
105 | - add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
106 | - add_action('wp_footer', [$this->public, 'renderSchema']); |
|
107 | - add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
108 | - add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
109 | - add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
110 | - add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
111 | - add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
112 | - add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
113 | - add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
114 | - add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
115 | - add_action('init', [$this->router, 'routePublicPostRequest']); |
|
116 | - add_action('admin_init', [$this->settings, 'registerSettings']); |
|
117 | - add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
118 | - add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
119 | - add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
120 | - add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
121 | - add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
122 | - add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
123 | - add_action('plugins_loaded', [$this->translator, 'addTranslationFilters']); |
|
124 | - add_action('admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels']); |
|
125 | - add_action('site-reviews/review/created', [$this->trustalyze, 'onCreated']); |
|
126 | - add_action('site-reviews/review/reverted', [$this->trustalyze, 'onReverted']); |
|
127 | - add_action('site-reviews/review/saved', [$this->trustalyze, 'onSaved']); |
|
128 | - add_action('updated_postmeta', [$this->trustalyze, 'onUpdatedMeta'], 10, 3); |
|
129 | - add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
130 | - add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
68 | + add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
69 | + add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] ); |
|
70 | + add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
71 | + add_action( 'admin_init', [$this->admin, 'runMigrations'] ); |
|
72 | + add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
73 | + add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
74 | + add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
75 | + add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
76 | + add_action( 'admin_init', [$this->app, 'setDefaults'] ); |
|
77 | + add_action( 'init', [$this->blocks, 'registerAssets'], 9 ); |
|
78 | + add_action( 'init', [$this->blocks, 'registerBlocks'] ); |
|
79 | + add_action( 'admin_footer', [$this->console, 'logOnce'] ); |
|
80 | + add_action( 'wp_footer', [$this->console, 'logOnce'] ); |
|
81 | + add_action( 'add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes'] ); |
|
82 | + add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
83 | + add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
84 | + add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] ); |
|
85 | + add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
86 | + add_action( 'admin_head', [$this->editor, 'renderReviewFields'] ); |
|
87 | + add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
88 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'], 10, 3 ); |
|
89 | + add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
90 | + add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
91 | + add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
92 | + add_action( 'manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
93 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
94 | + add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
95 | + add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
96 | + add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
97 | + add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
98 | + add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
99 | + add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
100 | + add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
101 | + add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
102 | + add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
103 | + add_action( 'admin_notices', [$this->notices, 'filterAdminNotices'] ); |
|
104 | + add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
105 | + add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] ); |
|
106 | + add_action( 'wp_footer', [$this->public, 'renderSchema'] ); |
|
107 | + add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 ); |
|
108 | + add_action( 'transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3 ); |
|
109 | + add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] ); |
|
110 | + add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] ); |
|
111 | + add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 ); |
|
112 | + add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
113 | + add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
114 | + add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
115 | + add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
116 | + add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
117 | + add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] ); |
|
118 | + add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] ); |
|
119 | + add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] ); |
|
120 | + add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] ); |
|
121 | + add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 ); |
|
122 | + add_action( 'set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6 ); |
|
123 | + add_action( 'plugins_loaded', [$this->translator, 'addTranslationFilters'] ); |
|
124 | + add_action( 'admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels'] ); |
|
125 | + add_action( 'site-reviews/review/created', [$this->trustalyze, 'onCreated'] ); |
|
126 | + add_action( 'site-reviews/review/reverted', [$this->trustalyze, 'onReverted'] ); |
|
127 | + add_action( 'site-reviews/review/saved', [$this->trustalyze, 'onSaved'] ); |
|
128 | + add_action( 'updated_postmeta', [$this->trustalyze, 'onUpdatedMeta'], 10, 3 ); |
|
129 | + add_action( 'activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2 ); |
|
130 | + add_action( 'admin_menu', [$this->welcome, 'registerPage'] ); |
|
131 | 131 | } |
132 | 132 | } |
@@ -15,64 +15,64 @@ |
||
15 | 15 | |
16 | 16 | class Filters implements HooksContract |
17 | 17 | { |
18 | - protected $admin; |
|
19 | - protected $app; |
|
20 | - protected $basename; |
|
21 | - protected $blocks; |
|
22 | - protected $editor; |
|
23 | - protected $listtable; |
|
24 | - protected $public; |
|
25 | - protected $translator; |
|
26 | - protected $trustalyze; |
|
27 | - protected $welcome; |
|
18 | + protected $admin; |
|
19 | + protected $app; |
|
20 | + protected $basename; |
|
21 | + protected $blocks; |
|
22 | + protected $editor; |
|
23 | + protected $listtable; |
|
24 | + protected $public; |
|
25 | + protected $translator; |
|
26 | + protected $trustalyze; |
|
27 | + protected $welcome; |
|
28 | 28 | |
29 | - public function __construct(Application $app) |
|
30 | - { |
|
31 | - $this->app = $app; |
|
32 | - $this->admin = $app->make(AdminController::class); |
|
33 | - $this->basename = plugin_basename($app->file); |
|
34 | - $this->blocks = $app->make(BlocksController::class); |
|
35 | - $this->editor = $app->make(EditorController::class); |
|
36 | - $this->listtable = $app->make(ListTableController::class); |
|
37 | - $this->public = $app->make(PublicController::class); |
|
38 | - $this->translator = $app->make(TranslationController::class); |
|
39 | - $this->trustalyze = $app->make(TrustalyzeController::class); |
|
40 | - $this->welcome = $app->make(WelcomeController::class); |
|
41 | - } |
|
29 | + public function __construct(Application $app) |
|
30 | + { |
|
31 | + $this->app = $app; |
|
32 | + $this->admin = $app->make(AdminController::class); |
|
33 | + $this->basename = plugin_basename($app->file); |
|
34 | + $this->blocks = $app->make(BlocksController::class); |
|
35 | + $this->editor = $app->make(EditorController::class); |
|
36 | + $this->listtable = $app->make(ListTableController::class); |
|
37 | + $this->public = $app->make(PublicController::class); |
|
38 | + $this->translator = $app->make(TranslationController::class); |
|
39 | + $this->trustalyze = $app->make(TrustalyzeController::class); |
|
40 | + $this->welcome = $app->make(WelcomeController::class); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - public function run() |
|
47 | - { |
|
48 | - add_filter('map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2); |
|
49 | - add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
50 | - add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
51 | - add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
52 | - add_filter('block_categories', [$this->blocks, 'filterBlockCategories']); |
|
53 | - add_filter('classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2); |
|
54 | - add_filter('use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2); |
|
55 | - add_filter('wp_editor_settings', [$this->editor, 'filterEditorSettings']); |
|
56 | - add_filter('the_editor', [$this->editor, 'filterEditorTextarea']); |
|
57 | - add_filter('is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3); |
|
58 | - add_filter('post_updated_messages', [$this->editor, 'filterUpdateMessages']); |
|
59 | - add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
60 | - add_filter('post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2); |
|
61 | - add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
62 | - add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
63 | - add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
64 | - add_filter('script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2); |
|
65 | - add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11); |
|
66 | - add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']); |
|
67 | - add_filter('bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2); |
|
68 | - add_filter('display_post_states', [$this->translator, 'filterPostStates'], 10, 2); |
|
69 | - add_filter('site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
70 | - add_filter('site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
71 | - add_filter('site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4); |
|
72 | - add_filter('site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback']); |
|
73 | - add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3); |
|
74 | - add_filter('plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9); |
|
75 | - add_filter('admin_title', [$this->welcome, 'filterAdminTitle']); |
|
76 | - add_filter('admin_footer_text', [$this->welcome, 'filterFooterText']); |
|
77 | - } |
|
43 | + /** |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + public function run() |
|
47 | + { |
|
48 | + add_filter('map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2); |
|
49 | + add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
50 | + add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
51 | + add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
52 | + add_filter('block_categories', [$this->blocks, 'filterBlockCategories']); |
|
53 | + add_filter('classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2); |
|
54 | + add_filter('use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2); |
|
55 | + add_filter('wp_editor_settings', [$this->editor, 'filterEditorSettings']); |
|
56 | + add_filter('the_editor', [$this->editor, 'filterEditorTextarea']); |
|
57 | + add_filter('is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3); |
|
58 | + add_filter('post_updated_messages', [$this->editor, 'filterUpdateMessages']); |
|
59 | + add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
60 | + add_filter('post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2); |
|
61 | + add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
62 | + add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
63 | + add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
64 | + add_filter('script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2); |
|
65 | + add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11); |
|
66 | + add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']); |
|
67 | + add_filter('bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2); |
|
68 | + add_filter('display_post_states', [$this->translator, 'filterPostStates'], 10, 2); |
|
69 | + add_filter('site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
70 | + add_filter('site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
71 | + add_filter('site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4); |
|
72 | + add_filter('site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback']); |
|
73 | + add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3); |
|
74 | + add_filter('plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9); |
|
75 | + add_filter('admin_title', [$this->welcome, 'filterAdminTitle']); |
|
76 | + add_filter('admin_footer_text', [$this->welcome, 'filterFooterText']); |
|
77 | + } |
|
78 | 78 | } |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | protected $trustalyze; |
27 | 27 | protected $welcome; |
28 | 28 | |
29 | - public function __construct(Application $app) |
|
29 | + public function __construct( Application $app ) |
|
30 | 30 | { |
31 | 31 | $this->app = $app; |
32 | - $this->admin = $app->make(AdminController::class); |
|
33 | - $this->basename = plugin_basename($app->file); |
|
34 | - $this->blocks = $app->make(BlocksController::class); |
|
35 | - $this->editor = $app->make(EditorController::class); |
|
36 | - $this->listtable = $app->make(ListTableController::class); |
|
37 | - $this->public = $app->make(PublicController::class); |
|
38 | - $this->translator = $app->make(TranslationController::class); |
|
39 | - $this->trustalyze = $app->make(TrustalyzeController::class); |
|
40 | - $this->welcome = $app->make(WelcomeController::class); |
|
32 | + $this->admin = $app->make( AdminController::class ); |
|
33 | + $this->basename = plugin_basename( $app->file ); |
|
34 | + $this->blocks = $app->make( BlocksController::class ); |
|
35 | + $this->editor = $app->make( EditorController::class ); |
|
36 | + $this->listtable = $app->make( ListTableController::class ); |
|
37 | + $this->public = $app->make( PublicController::class ); |
|
38 | + $this->translator = $app->make( TranslationController::class ); |
|
39 | + $this->trustalyze = $app->make( TrustalyzeController::class ); |
|
40 | + $this->welcome = $app->make( WelcomeController::class ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,34 +45,34 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function run() |
47 | 47 | { |
48 | - add_filter('map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2); |
|
49 | - add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
50 | - add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
51 | - add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
52 | - add_filter('block_categories', [$this->blocks, 'filterBlockCategories']); |
|
53 | - add_filter('classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2); |
|
54 | - add_filter('use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2); |
|
55 | - add_filter('wp_editor_settings', [$this->editor, 'filterEditorSettings']); |
|
56 | - add_filter('the_editor', [$this->editor, 'filterEditorTextarea']); |
|
57 | - add_filter('is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3); |
|
58 | - add_filter('post_updated_messages', [$this->editor, 'filterUpdateMessages']); |
|
59 | - add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
60 | - add_filter('post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2); |
|
61 | - add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
62 | - add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
63 | - add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
64 | - add_filter('script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2); |
|
65 | - add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11); |
|
66 | - add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']); |
|
67 | - add_filter('bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2); |
|
68 | - add_filter('display_post_states', [$this->translator, 'filterPostStates'], 10, 2); |
|
69 | - add_filter('site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
70 | - add_filter('site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
71 | - add_filter('site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4); |
|
72 | - add_filter('site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback']); |
|
73 | - add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3); |
|
74 | - add_filter('plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9); |
|
75 | - add_filter('admin_title', [$this->welcome, 'filterAdminTitle']); |
|
76 | - add_filter('admin_footer_text', [$this->welcome, 'filterFooterText']); |
|
48 | + add_filter( 'map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2 ); |
|
49 | + add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
50 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
51 | + add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
52 | + add_filter( 'block_categories', [$this->blocks, 'filterBlockCategories'] ); |
|
53 | + add_filter( 'classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2 ); |
|
54 | + add_filter( 'use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2 ); |
|
55 | + add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
56 | + add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
57 | + add_filter( 'is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3 ); |
|
58 | + add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
59 | + add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
60 | + add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
61 | + add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
62 | + add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
63 | + add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
|
64 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
65 | + add_filter( 'site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11 ); |
|
66 | + add_filter( 'site-reviews/render/view', [$this->public, 'filterRenderView'] ); |
|
67 | + add_filter( 'bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2 ); |
|
68 | + add_filter( 'display_post_states', [$this->translator, 'filterPostStates'], 10, 2 ); |
|
69 | + add_filter( 'site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2 ); |
|
70 | + add_filter( 'site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2 ); |
|
71 | + add_filter( 'site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4 ); |
|
72 | + add_filter( 'site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback'] ); |
|
73 | + add_filter( 'site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3 ); |
|
74 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9 ); |
|
75 | + add_filter( 'admin_title', [$this->welcome, 'filterAdminTitle'] ); |
|
76 | + add_filter( 'admin_footer_text', [$this->welcome, 'filterFooterText'] ); |
|
77 | 77 | } |
78 | 78 | } |