@@ -1,22 +1,22 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <textarea id="log-file" class="large-text code glsr-code glsr-code-large" rows="20" readonly>{{ console }}</textarea> |
4 | 4 | <form method="post" class="glsr-float-left"> |
5 | 5 | <input type="hidden" name="{{ id }}[_action]" value="download-console"> |
6 | - <?php wp_nonce_field('download-console'); ?> |
|
7 | - <?php submit_button(__('Download Console', 'site-reviews'), 'primary', '', false); ?> |
|
6 | + <?php wp_nonce_field( 'download-console' ); ?> |
|
7 | + <?php submit_button( __( 'Download Console', 'site-reviews' ), 'primary', '', false ); ?> |
|
8 | 8 | </form> |
9 | 9 | <form method="post" class="glsr-float-left"> |
10 | 10 | <input type="hidden" name="{{ id }}[_action]" value="fetch-console"> |
11 | - <?php wp_nonce_field('fetch-console'); ?> |
|
11 | + <?php wp_nonce_field( 'fetch-console' ); ?> |
|
12 | 12 | <button type="submit" class="glsr-button button" id="fetch-console"> |
13 | - <span data-loading="<?= __('Reloading...', 'site-reviews'); ?>"><?= __('Reload', 'site-reviews'); ?></span> |
|
13 | + <span data-loading="<?= __( 'Reloading...', 'site-reviews' ); ?>"><?= __( 'Reload', 'site-reviews' ); ?></span> |
|
14 | 14 | </button> |
15 | 15 | </form> |
16 | 16 | <form method="post"> |
17 | 17 | <input type="hidden" name="{{ id }}[_action]" value="clear-console"> |
18 | - <?php wp_nonce_field('clear-console'); ?> |
|
18 | + <?php wp_nonce_field( 'clear-console' ); ?> |
|
19 | 19 | <button type="submit" class="glsr-button button" id="clear-console"> |
20 | - <span data-loading="<?= __('Clearing...', 'site-reviews'); ?>"><?= __('Clear', 'site-reviews'); ?></span> |
|
20 | + <span data-loading="<?= __( 'Clearing...', 'site-reviews' ); ?>"><?= __( 'Clear', 'site-reviews' ); ?></span> |
|
21 | 21 | </button> |
22 | 22 | </form> |
@@ -10,158 +10,158 @@ |
||
10 | 10 | |
11 | 11 | class EnqueueAdminAssets |
12 | 12 | { |
13 | - /** |
|
14 | - * @var array |
|
15 | - */ |
|
16 | - protected $pointers; |
|
13 | + /** |
|
14 | + * @var array |
|
15 | + */ |
|
16 | + protected $pointers; |
|
17 | 17 | |
18 | - /** |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function handle(Command $command) |
|
22 | - { |
|
23 | - $this->generatePointers($command->pointers); |
|
24 | - $this->enqueueAssets(); |
|
25 | - $this->localizeAssets(); |
|
26 | - } |
|
18 | + /** |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function handle(Command $command) |
|
22 | + { |
|
23 | + $this->generatePointers($command->pointers); |
|
24 | + $this->enqueueAssets(); |
|
25 | + $this->localizeAssets(); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function enqueueAssets() |
|
32 | - { |
|
33 | - if (!$this->isCurrentScreen()) { |
|
34 | - return; |
|
35 | - } |
|
36 | - wp_enqueue_style( |
|
37 | - Application::ID, |
|
38 | - glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
39 | - [], |
|
40 | - glsr()->version |
|
41 | - ); |
|
42 | - wp_enqueue_script( |
|
43 | - Application::ID, |
|
44 | - glsr()->url('assets/scripts/'.Application::ID.'-admin.js'), |
|
45 | - $this->getDependencies(), |
|
46 | - glsr()->version, |
|
47 | - true |
|
48 | - ); |
|
49 | - if (!empty($this->pointers)) { |
|
50 | - wp_enqueue_style('wp-pointer'); |
|
51 | - wp_enqueue_script('wp-pointer'); |
|
52 | - } |
|
53 | - } |
|
28 | + /** |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function enqueueAssets() |
|
32 | + { |
|
33 | + if (!$this->isCurrentScreen()) { |
|
34 | + return; |
|
35 | + } |
|
36 | + wp_enqueue_style( |
|
37 | + Application::ID, |
|
38 | + glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
39 | + [], |
|
40 | + glsr()->version |
|
41 | + ); |
|
42 | + wp_enqueue_script( |
|
43 | + Application::ID, |
|
44 | + glsr()->url('assets/scripts/'.Application::ID.'-admin.js'), |
|
45 | + $this->getDependencies(), |
|
46 | + glsr()->version, |
|
47 | + true |
|
48 | + ); |
|
49 | + if (!empty($this->pointers)) { |
|
50 | + wp_enqueue_style('wp-pointer'); |
|
51 | + wp_enqueue_script('wp-pointer'); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return void |
|
57 | - */ |
|
58 | - public function localizeAssets() |
|
59 | - { |
|
60 | - $variables = [ |
|
61 | - 'action' => Application::PREFIX.'action', |
|
62 | - 'addons' => [], |
|
63 | - 'ajaxurl' => admin_url('admin-ajax.php'), |
|
64 | - 'hideoptions' => [ |
|
65 | - 'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(), |
|
66 | - 'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(), |
|
67 | - 'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(), |
|
68 | - ], |
|
69 | - 'nameprefix' => Application::ID, |
|
70 | - 'nonce' => [ |
|
71 | - 'change-status' => wp_create_nonce('change-status'), |
|
72 | - 'clear-console' => wp_create_nonce('clear-console'), |
|
73 | - 'count-reviews' => wp_create_nonce('count-reviews'), |
|
74 | - 'fetch-console' => wp_create_nonce('fetch-console'), |
|
75 | - 'mce-shortcode' => wp_create_nonce('mce-shortcode'), |
|
76 | - 'sync-reviews' => wp_create_nonce('sync-reviews'), |
|
77 | - 'toggle-pinned' => wp_create_nonce('toggle-pinned'), |
|
78 | - ], |
|
79 | - 'pointers' => $this->pointers, |
|
80 | - 'shortcodes' => [], |
|
81 | - 'tinymce' => [ |
|
82 | - 'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'), |
|
83 | - ], |
|
84 | - ]; |
|
85 | - if (user_can_richedit()) { |
|
86 | - $variables['shortcodes'] = $this->localizeShortcodes(); |
|
87 | - } |
|
88 | - $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables); |
|
89 | - wp_localize_script(Application::ID, 'GLSR', $variables); |
|
90 | - } |
|
55 | + /** |
|
56 | + * @return void |
|
57 | + */ |
|
58 | + public function localizeAssets() |
|
59 | + { |
|
60 | + $variables = [ |
|
61 | + 'action' => Application::PREFIX.'action', |
|
62 | + 'addons' => [], |
|
63 | + 'ajaxurl' => admin_url('admin-ajax.php'), |
|
64 | + 'hideoptions' => [ |
|
65 | + 'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(), |
|
66 | + 'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(), |
|
67 | + 'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(), |
|
68 | + ], |
|
69 | + 'nameprefix' => Application::ID, |
|
70 | + 'nonce' => [ |
|
71 | + 'change-status' => wp_create_nonce('change-status'), |
|
72 | + 'clear-console' => wp_create_nonce('clear-console'), |
|
73 | + 'count-reviews' => wp_create_nonce('count-reviews'), |
|
74 | + 'fetch-console' => wp_create_nonce('fetch-console'), |
|
75 | + 'mce-shortcode' => wp_create_nonce('mce-shortcode'), |
|
76 | + 'sync-reviews' => wp_create_nonce('sync-reviews'), |
|
77 | + 'toggle-pinned' => wp_create_nonce('toggle-pinned'), |
|
78 | + ], |
|
79 | + 'pointers' => $this->pointers, |
|
80 | + 'shortcodes' => [], |
|
81 | + 'tinymce' => [ |
|
82 | + 'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'), |
|
83 | + ], |
|
84 | + ]; |
|
85 | + if (user_can_richedit()) { |
|
86 | + $variables['shortcodes'] = $this->localizeShortcodes(); |
|
87 | + } |
|
88 | + $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables); |
|
89 | + wp_localize_script(Application::ID, 'GLSR', $variables); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * @return array |
|
94 | - */ |
|
95 | - protected function getDependencies() |
|
96 | - { |
|
97 | - $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []); |
|
98 | - $dependencies = array_merge($dependencies, [ |
|
99 | - 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
|
100 | - ]); |
|
101 | - return $dependencies; |
|
102 | - } |
|
92 | + /** |
|
93 | + * @return array |
|
94 | + */ |
|
95 | + protected function getDependencies() |
|
96 | + { |
|
97 | + $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []); |
|
98 | + $dependencies = array_merge($dependencies, [ |
|
99 | + 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
|
100 | + ]); |
|
101 | + return $dependencies; |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * @return array |
|
106 | - */ |
|
107 | - protected function generatePointer(array $pointer) |
|
108 | - { |
|
109 | - return [ |
|
110 | - 'id' => $pointer['id'], |
|
111 | - 'options' => [ |
|
112 | - 'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>', |
|
113 | - 'position' => $pointer['position'], |
|
114 | - ], |
|
115 | - 'screen' => $pointer['screen'], |
|
116 | - 'target' => $pointer['target'], |
|
117 | - ]; |
|
118 | - } |
|
104 | + /** |
|
105 | + * @return array |
|
106 | + */ |
|
107 | + protected function generatePointer(array $pointer) |
|
108 | + { |
|
109 | + return [ |
|
110 | + 'id' => $pointer['id'], |
|
111 | + 'options' => [ |
|
112 | + 'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>', |
|
113 | + 'position' => $pointer['position'], |
|
114 | + ], |
|
115 | + 'screen' => $pointer['screen'], |
|
116 | + 'target' => $pointer['target'], |
|
117 | + ]; |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * @return void |
|
122 | - */ |
|
123 | - protected function generatePointers(array $pointers) |
|
124 | - { |
|
125 | - $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true); |
|
126 | - $dismissedPointers = explode(',', (string) $dismissedPointers); |
|
127 | - $generatedPointers = []; |
|
128 | - foreach ($pointers as $pointer) { |
|
129 | - if ($pointer['screen'] != glsr_current_screen()->id) { |
|
130 | - continue; |
|
131 | - } |
|
132 | - if (in_array($pointer['id'], $dismissedPointers)) { |
|
133 | - continue; |
|
134 | - } |
|
135 | - $generatedPointers[] = $this->generatePointer($pointer); |
|
136 | - } |
|
137 | - $this->pointers = $generatedPointers; |
|
138 | - } |
|
120 | + /** |
|
121 | + * @return void |
|
122 | + */ |
|
123 | + protected function generatePointers(array $pointers) |
|
124 | + { |
|
125 | + $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true); |
|
126 | + $dismissedPointers = explode(',', (string) $dismissedPointers); |
|
127 | + $generatedPointers = []; |
|
128 | + foreach ($pointers as $pointer) { |
|
129 | + if ($pointer['screen'] != glsr_current_screen()->id) { |
|
130 | + continue; |
|
131 | + } |
|
132 | + if (in_array($pointer['id'], $dismissedPointers)) { |
|
133 | + continue; |
|
134 | + } |
|
135 | + $generatedPointers[] = $this->generatePointer($pointer); |
|
136 | + } |
|
137 | + $this->pointers = $generatedPointers; |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * @return bool |
|
142 | - */ |
|
143 | - protected function isCurrentScreen() |
|
144 | - { |
|
145 | - $screen = glsr_current_screen(); |
|
146 | - return Application::POST_TYPE == $screen->post_type |
|
147 | - || 'dashboard' == $screen->id |
|
148 | - || 'plugins_page_'.Application::ID == $screen->id |
|
149 | - || 'post' == $screen->base |
|
150 | - || 'widgets' == $screen->id; |
|
151 | - } |
|
140 | + /** |
|
141 | + * @return bool |
|
142 | + */ |
|
143 | + protected function isCurrentScreen() |
|
144 | + { |
|
145 | + $screen = glsr_current_screen(); |
|
146 | + return Application::POST_TYPE == $screen->post_type |
|
147 | + || 'dashboard' == $screen->id |
|
148 | + || 'plugins_page_'.Application::ID == $screen->id |
|
149 | + || 'post' == $screen->base |
|
150 | + || 'widgets' == $screen->id; |
|
151 | + } |
|
152 | 152 | |
153 | - /** |
|
154 | - * @return array |
|
155 | - */ |
|
156 | - protected function localizeShortcodes() |
|
157 | - { |
|
158 | - $variables = []; |
|
159 | - foreach (glsr()->mceShortcodes as $tag => $args) { |
|
160 | - if (empty($args['required'])) { |
|
161 | - continue; |
|
162 | - } |
|
163 | - $variables[$tag] = $args['required']; |
|
164 | - } |
|
165 | - return $variables; |
|
166 | - } |
|
153 | + /** |
|
154 | + * @return array |
|
155 | + */ |
|
156 | + protected function localizeShortcodes() |
|
157 | + { |
|
158 | + $variables = []; |
|
159 | + foreach (glsr()->mceShortcodes as $tag => $args) { |
|
160 | + if (empty($args['required'])) { |
|
161 | + continue; |
|
162 | + } |
|
163 | + $variables[$tag] = $args['required']; |
|
164 | + } |
|
165 | + return $variables; |
|
166 | + } |
|
167 | 167 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * @return void |
20 | 20 | */ |
21 | - public function handle(Command $command) |
|
21 | + public function handle( Command $command ) |
|
22 | 22 | { |
23 | - $this->generatePointers($command->pointers); |
|
23 | + $this->generatePointers( $command->pointers ); |
|
24 | 24 | $this->enqueueAssets(); |
25 | 25 | $this->localizeAssets(); |
26 | 26 | } |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function enqueueAssets() |
32 | 32 | { |
33 | - if (!$this->isCurrentScreen()) { |
|
33 | + if( !$this->isCurrentScreen() ) { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | wp_enqueue_style( |
37 | 37 | Application::ID, |
38 | - glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
38 | + glsr()->url( 'assets/styles/'.Application::ID.'-admin.css' ), |
|
39 | 39 | [], |
40 | 40 | glsr()->version |
41 | 41 | ); |
42 | 42 | wp_enqueue_script( |
43 | 43 | Application::ID, |
44 | - glsr()->url('assets/scripts/'.Application::ID.'-admin.js'), |
|
44 | + glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
|
45 | 45 | $this->getDependencies(), |
46 | 46 | glsr()->version, |
47 | 47 | true |
48 | 48 | ); |
49 | - if (!empty($this->pointers)) { |
|
50 | - wp_enqueue_style('wp-pointer'); |
|
51 | - wp_enqueue_script('wp-pointer'); |
|
49 | + if( !empty($this->pointers) ) { |
|
50 | + wp_enqueue_style( 'wp-pointer' ); |
|
51 | + wp_enqueue_script( 'wp-pointer' ); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -60,33 +60,33 @@ discard block |
||
60 | 60 | $variables = [ |
61 | 61 | 'action' => Application::PREFIX.'action', |
62 | 62 | 'addons' => [], |
63 | - 'ajaxurl' => admin_url('admin-ajax.php'), |
|
63 | + 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
64 | 64 | 'hideoptions' => [ |
65 | - 'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(), |
|
66 | - 'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(), |
|
67 | - 'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(), |
|
65 | + 'site_reviews' => glsr( SiteReviewsShortcode::class )->getHideOptions(), |
|
66 | + 'site_reviews_form' => glsr( SiteReviewsFormShortcode::class )->getHideOptions(), |
|
67 | + 'site_reviews_summary' => glsr( SiteReviewsSummaryShortcode::class )->getHideOptions(), |
|
68 | 68 | ], |
69 | 69 | 'nameprefix' => Application::ID, |
70 | 70 | 'nonce' => [ |
71 | - 'change-status' => wp_create_nonce('change-status'), |
|
72 | - 'clear-console' => wp_create_nonce('clear-console'), |
|
73 | - 'count-reviews' => wp_create_nonce('count-reviews'), |
|
74 | - 'fetch-console' => wp_create_nonce('fetch-console'), |
|
75 | - 'mce-shortcode' => wp_create_nonce('mce-shortcode'), |
|
76 | - 'sync-reviews' => wp_create_nonce('sync-reviews'), |
|
77 | - 'toggle-pinned' => wp_create_nonce('toggle-pinned'), |
|
71 | + 'change-status' => wp_create_nonce( 'change-status' ), |
|
72 | + 'clear-console' => wp_create_nonce( 'clear-console' ), |
|
73 | + 'count-reviews' => wp_create_nonce( 'count-reviews' ), |
|
74 | + 'fetch-console' => wp_create_nonce( 'fetch-console' ), |
|
75 | + 'mce-shortcode' => wp_create_nonce( 'mce-shortcode' ), |
|
76 | + 'sync-reviews' => wp_create_nonce( 'sync-reviews' ), |
|
77 | + 'toggle-pinned' => wp_create_nonce( 'toggle-pinned' ), |
|
78 | 78 | ], |
79 | 79 | 'pointers' => $this->pointers, |
80 | 80 | 'shortcodes' => [], |
81 | 81 | 'tinymce' => [ |
82 | - 'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'), |
|
82 | + 'glsr_shortcode' => glsr()->url( 'assets/scripts/mce-plugin.js' ), |
|
83 | 83 | ], |
84 | 84 | ]; |
85 | - if (user_can_richedit()) { |
|
85 | + if( user_can_richedit() ) { |
|
86 | 86 | $variables['shortcodes'] = $this->localizeShortcodes(); |
87 | 87 | } |
88 | - $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables); |
|
89 | - wp_localize_script(Application::ID, 'GLSR', $variables); |
|
88 | + $variables = apply_filters( 'site-reviews/enqueue/admin/localize', $variables ); |
|
89 | + wp_localize_script( Application::ID, 'GLSR', $variables ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | */ |
95 | 95 | protected function getDependencies() |
96 | 96 | { |
97 | - $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []); |
|
98 | - $dependencies = array_merge($dependencies, [ |
|
97 | + $dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] ); |
|
98 | + $dependencies = array_merge( $dependencies, [ |
|
99 | 99 | 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
100 | - ]); |
|
100 | + ] ); |
|
101 | 101 | return $dependencies; |
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @return array |
106 | 106 | */ |
107 | - protected function generatePointer(array $pointer) |
|
107 | + protected function generatePointer( array $pointer ) |
|
108 | 108 | { |
109 | 109 | return [ |
110 | 110 | 'id' => $pointer['id'], |
@@ -120,19 +120,19 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return void |
122 | 122 | */ |
123 | - protected function generatePointers(array $pointers) |
|
123 | + protected function generatePointers( array $pointers ) |
|
124 | 124 | { |
125 | - $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true); |
|
126 | - $dismissedPointers = explode(',', (string) $dismissedPointers); |
|
125 | + $dismissedPointers = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); |
|
126 | + $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
|
127 | 127 | $generatedPointers = []; |
128 | - foreach ($pointers as $pointer) { |
|
129 | - if ($pointer['screen'] != glsr_current_screen()->id) { |
|
128 | + foreach( $pointers as $pointer ) { |
|
129 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
130 | 130 | continue; |
131 | 131 | } |
132 | - if (in_array($pointer['id'], $dismissedPointers)) { |
|
132 | + if( in_array( $pointer['id'], $dismissedPointers ) ) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | - $generatedPointers[] = $this->generatePointer($pointer); |
|
135 | + $generatedPointers[] = $this->generatePointer( $pointer ); |
|
136 | 136 | } |
137 | 137 | $this->pointers = $generatedPointers; |
138 | 138 | } |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | protected function localizeShortcodes() |
157 | 157 | { |
158 | 158 | $variables = []; |
159 | - foreach (glsr()->mceShortcodes as $tag => $args) { |
|
160 | - if (empty($args['required'])) { |
|
159 | + foreach( glsr()->mceShortcodes as $tag => $args ) { |
|
160 | + if( empty($args['required']) ) { |
|
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | $variables[$tag] = $args['required']; |
@@ -14,169 +14,169 @@ |
||
14 | 14 | |
15 | 15 | class AjaxController extends Controller |
16 | 16 | { |
17 | - /** |
|
18 | - * @return void |
|
19 | - */ |
|
20 | - public function routerChangeStatus(array $request) |
|
21 | - { |
|
22 | - wp_send_json_success($this->execute(new ChangeStatus($request))); |
|
23 | - } |
|
17 | + /** |
|
18 | + * @return void |
|
19 | + */ |
|
20 | + public function routerChangeStatus(array $request) |
|
21 | + { |
|
22 | + wp_send_json_success($this->execute(new ChangeStatus($request))); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function routerClearConsole() |
|
29 | - { |
|
30 | - glsr(AdminController::class)->routerClearConsole(); |
|
31 | - wp_send_json_success([ |
|
32 | - 'console' => glsr(Console::class)->get(), |
|
33 | - 'notices' => glsr(Notice::class)->get(), |
|
34 | - ]); |
|
35 | - } |
|
25 | + /** |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function routerClearConsole() |
|
29 | + { |
|
30 | + glsr(AdminController::class)->routerClearConsole(); |
|
31 | + wp_send_json_success([ |
|
32 | + 'console' => glsr(Console::class)->get(), |
|
33 | + 'notices' => glsr(Notice::class)->get(), |
|
34 | + ]); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - public function routerCountReviews() |
|
41 | - { |
|
42 | - glsr(AdminController::class)->routerCountReviews(); |
|
43 | - wp_send_json_success([ |
|
44 | - 'notices' => glsr(Notice::class)->get(), |
|
45 | - ]); |
|
46 | - } |
|
37 | + /** |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + public function routerCountReviews() |
|
41 | + { |
|
42 | + glsr(AdminController::class)->routerCountReviews(); |
|
43 | + wp_send_json_success([ |
|
44 | + 'notices' => glsr(Notice::class)->get(), |
|
45 | + ]); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function routerDismissNotice(array $request) |
|
52 | - { |
|
53 | - glsr(NoticeController::class)->routerDismissNotice($request); |
|
54 | - wp_send_json_success(); |
|
55 | - } |
|
48 | + /** |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function routerDismissNotice(array $request) |
|
52 | + { |
|
53 | + glsr(NoticeController::class)->routerDismissNotice($request); |
|
54 | + wp_send_json_success(); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public function routerMceShortcode(array $request) |
|
61 | - { |
|
62 | - $shortcode = $request['shortcode']; |
|
63 | - $response = false; |
|
64 | - if (array_key_exists($shortcode, glsr()->mceShortcodes)) { |
|
65 | - $data = glsr()->mceShortcodes[$shortcode]; |
|
66 | - if (!empty($data['errors'])) { |
|
67 | - $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')]; |
|
68 | - } |
|
69 | - $response = [ |
|
70 | - 'body' => $data['fields'], |
|
71 | - 'close' => $data['btn_close'], |
|
72 | - 'ok' => $data['btn_okay'], |
|
73 | - 'shortcode' => $shortcode, |
|
74 | - 'title' => $data['title'], |
|
75 | - ]; |
|
76 | - } |
|
77 | - wp_send_json_success($response); |
|
78 | - } |
|
57 | + /** |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public function routerMceShortcode(array $request) |
|
61 | + { |
|
62 | + $shortcode = $request['shortcode']; |
|
63 | + $response = false; |
|
64 | + if (array_key_exists($shortcode, glsr()->mceShortcodes)) { |
|
65 | + $data = glsr()->mceShortcodes[$shortcode]; |
|
66 | + if (!empty($data['errors'])) { |
|
67 | + $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')]; |
|
68 | + } |
|
69 | + $response = [ |
|
70 | + 'body' => $data['fields'], |
|
71 | + 'close' => $data['btn_close'], |
|
72 | + 'ok' => $data['btn_okay'], |
|
73 | + 'shortcode' => $shortcode, |
|
74 | + 'title' => $data['title'], |
|
75 | + ]; |
|
76 | + } |
|
77 | + wp_send_json_success($response); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return void |
|
82 | - */ |
|
83 | - public function routerFetchConsole() |
|
84 | - { |
|
85 | - glsr(AdminController::class)->routerFetchConsole(); |
|
86 | - wp_send_json_success([ |
|
87 | - 'console' => glsr(Console::class)->get(), |
|
88 | - 'notices' => glsr(Notice::class)->get(), |
|
89 | - ]); |
|
90 | - } |
|
80 | + /** |
|
81 | + * @return void |
|
82 | + */ |
|
83 | + public function routerFetchConsole() |
|
84 | + { |
|
85 | + glsr(AdminController::class)->routerFetchConsole(); |
|
86 | + wp_send_json_success([ |
|
87 | + 'console' => glsr(Console::class)->get(), |
|
88 | + 'notices' => glsr(Notice::class)->get(), |
|
89 | + ]); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * @return void |
|
94 | - */ |
|
95 | - public function routerSearchPosts(array $request) |
|
96 | - { |
|
97 | - $results = glsr(Database::class)->searchPosts($request['search']); |
|
98 | - wp_send_json_success([ |
|
99 | - 'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>', |
|
100 | - 'items' => $results, |
|
101 | - ]); |
|
102 | - } |
|
92 | + /** |
|
93 | + * @return void |
|
94 | + */ |
|
95 | + public function routerSearchPosts(array $request) |
|
96 | + { |
|
97 | + $results = glsr(Database::class)->searchPosts($request['search']); |
|
98 | + wp_send_json_success([ |
|
99 | + 'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>', |
|
100 | + 'items' => $results, |
|
101 | + ]); |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * @return void |
|
106 | - */ |
|
107 | - public function routerSearchTranslations(array $request) |
|
108 | - { |
|
109 | - if (empty($request['exclude'])) { |
|
110 | - $request['exclude'] = []; |
|
111 | - } |
|
112 | - $results = glsr(Translation::class) |
|
113 | - ->search($request['search']) |
|
114 | - ->exclude() |
|
115 | - ->exclude($request['exclude']) |
|
116 | - ->renderResults(); |
|
117 | - wp_send_json_success([ |
|
118 | - 'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>', |
|
119 | - 'items' => $results, |
|
120 | - ]); |
|
121 | - } |
|
104 | + /** |
|
105 | + * @return void |
|
106 | + */ |
|
107 | + public function routerSearchTranslations(array $request) |
|
108 | + { |
|
109 | + if (empty($request['exclude'])) { |
|
110 | + $request['exclude'] = []; |
|
111 | + } |
|
112 | + $results = glsr(Translation::class) |
|
113 | + ->search($request['search']) |
|
114 | + ->exclude() |
|
115 | + ->exclude($request['exclude']) |
|
116 | + ->renderResults(); |
|
117 | + wp_send_json_success([ |
|
118 | + 'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>', |
|
119 | + 'items' => $results, |
|
120 | + ]); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * @return void |
|
125 | - */ |
|
126 | - public function routerSubmitReview(array $request) |
|
127 | - { |
|
128 | - $command = glsr(PublicController::class)->routerSubmitReview($request); |
|
129 | - $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true))); |
|
130 | - $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command); |
|
131 | - $data = [ |
|
132 | - 'errors' => glsr()->sessionGet($command->form_id.'errors', false), |
|
133 | - 'message' => glsr()->sessionGet($command->form_id.'message', ''), |
|
134 | - 'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false), |
|
135 | - 'redirect' => $redirect, |
|
136 | - ]; |
|
137 | - if (false === $data['errors']) { |
|
138 | - glsr()->sessionClear(); |
|
139 | - wp_send_json_success($data); |
|
140 | - } |
|
141 | - wp_send_json_error($data); |
|
142 | - } |
|
123 | + /** |
|
124 | + * @return void |
|
125 | + */ |
|
126 | + public function routerSubmitReview(array $request) |
|
127 | + { |
|
128 | + $command = glsr(PublicController::class)->routerSubmitReview($request); |
|
129 | + $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true))); |
|
130 | + $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command); |
|
131 | + $data = [ |
|
132 | + 'errors' => glsr()->sessionGet($command->form_id.'errors', false), |
|
133 | + 'message' => glsr()->sessionGet($command->form_id.'message', ''), |
|
134 | + 'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false), |
|
135 | + 'redirect' => $redirect, |
|
136 | + ]; |
|
137 | + if (false === $data['errors']) { |
|
138 | + glsr()->sessionClear(); |
|
139 | + wp_send_json_success($data); |
|
140 | + } |
|
141 | + wp_send_json_error($data); |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * @return void |
|
146 | - */ |
|
147 | - public function routerFetchPagedReviews(array $request) |
|
148 | - { |
|
149 | - $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH)); |
|
150 | - $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH)); |
|
151 | - $urlQuery = []; |
|
152 | - parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery); |
|
153 | - $pagedUrl = $homePath === $urlPath |
|
154 | - ? home_url() |
|
155 | - : home_url($urlPath); |
|
156 | - $args = [ |
|
157 | - 'paged' => (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1), |
|
158 | - 'pagedUrl' => trailingslashit($pagedUrl), |
|
159 | - 'pagination' => 'ajax', |
|
160 | - 'schema' => false, |
|
161 | - ]; |
|
162 | - $atts = (array) json_decode(Arr::get($request, 'atts')); |
|
163 | - $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts); |
|
164 | - $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts)); |
|
165 | - return wp_send_json_success([ |
|
166 | - 'pagination' => $html->getPagination(), |
|
167 | - 'reviews' => $html->getReviews(), |
|
168 | - ]); |
|
169 | - } |
|
144 | + /** |
|
145 | + * @return void |
|
146 | + */ |
|
147 | + public function routerFetchPagedReviews(array $request) |
|
148 | + { |
|
149 | + $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH)); |
|
150 | + $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH)); |
|
151 | + $urlQuery = []; |
|
152 | + parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery); |
|
153 | + $pagedUrl = $homePath === $urlPath |
|
154 | + ? home_url() |
|
155 | + : home_url($urlPath); |
|
156 | + $args = [ |
|
157 | + 'paged' => (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1), |
|
158 | + 'pagedUrl' => trailingslashit($pagedUrl), |
|
159 | + 'pagination' => 'ajax', |
|
160 | + 'schema' => false, |
|
161 | + ]; |
|
162 | + $atts = (array) json_decode(Arr::get($request, 'atts')); |
|
163 | + $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts); |
|
164 | + $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts)); |
|
165 | + return wp_send_json_success([ |
|
166 | + 'pagination' => $html->getPagination(), |
|
167 | + 'reviews' => $html->getReviews(), |
|
168 | + ]); |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
172 | - * @return void |
|
173 | - */ |
|
174 | - public function routerTogglePinned(array $request) |
|
175 | - { |
|
176 | - $isPinned = $this->execute(new TogglePinned($request)); |
|
177 | - wp_send_json_success([ |
|
178 | - 'notices' => glsr(Notice::class)->get(), |
|
179 | - 'pinned' => $isPinned, |
|
180 | - ]); |
|
181 | - } |
|
171 | + /** |
|
172 | + * @return void |
|
173 | + */ |
|
174 | + public function routerTogglePinned(array $request) |
|
175 | + { |
|
176 | + $isPinned = $this->execute(new TogglePinned($request)); |
|
177 | + wp_send_json_success([ |
|
178 | + 'notices' => glsr(Notice::class)->get(), |
|
179 | + 'pinned' => $isPinned, |
|
180 | + ]); |
|
181 | + } |
|
182 | 182 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @return void |
19 | 19 | */ |
20 | - public function routerChangeStatus(array $request) |
|
20 | + public function routerChangeStatus( array $request ) |
|
21 | 21 | { |
22 | - wp_send_json_success($this->execute(new ChangeStatus($request))); |
|
22 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function routerClearConsole() |
29 | 29 | { |
30 | - glsr(AdminController::class)->routerClearConsole(); |
|
31 | - wp_send_json_success([ |
|
32 | - 'console' => glsr(Console::class)->get(), |
|
33 | - 'notices' => glsr(Notice::class)->get(), |
|
34 | - ]); |
|
30 | + glsr( AdminController::class )->routerClearConsole(); |
|
31 | + wp_send_json_success( [ |
|
32 | + 'console' => glsr( Console::class )->get(), |
|
33 | + 'notices' => glsr( Notice::class )->get(), |
|
34 | + ] ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,32 +39,32 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function routerCountReviews() |
41 | 41 | { |
42 | - glsr(AdminController::class)->routerCountReviews(); |
|
43 | - wp_send_json_success([ |
|
44 | - 'notices' => glsr(Notice::class)->get(), |
|
45 | - ]); |
|
42 | + glsr( AdminController::class )->routerCountReviews(); |
|
43 | + wp_send_json_success( [ |
|
44 | + 'notices' => glsr( Notice::class )->get(), |
|
45 | + ] ); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function routerDismissNotice(array $request) |
|
51 | + public function routerDismissNotice( array $request ) |
|
52 | 52 | { |
53 | - glsr(NoticeController::class)->routerDismissNotice($request); |
|
53 | + glsr( NoticeController::class )->routerDismissNotice( $request ); |
|
54 | 54 | wp_send_json_success(); |
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @return void |
59 | 59 | */ |
60 | - public function routerMceShortcode(array $request) |
|
60 | + public function routerMceShortcode( array $request ) |
|
61 | 61 | { |
62 | 62 | $shortcode = $request['shortcode']; |
63 | 63 | $response = false; |
64 | - if (array_key_exists($shortcode, glsr()->mceShortcodes)) { |
|
64 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
65 | 65 | $data = glsr()->mceShortcodes[$shortcode]; |
66 | - if (!empty($data['errors'])) { |
|
67 | - $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')]; |
|
66 | + if( !empty($data['errors']) ) { |
|
67 | + $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
|
68 | 68 | } |
69 | 69 | $response = [ |
70 | 70 | 'body' => $data['fields'], |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'title' => $data['title'], |
75 | 75 | ]; |
76 | 76 | } |
77 | - wp_send_json_success($response); |
|
77 | + wp_send_json_success( $response ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,101 +82,101 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function routerFetchConsole() |
84 | 84 | { |
85 | - glsr(AdminController::class)->routerFetchConsole(); |
|
86 | - wp_send_json_success([ |
|
87 | - 'console' => glsr(Console::class)->get(), |
|
88 | - 'notices' => glsr(Notice::class)->get(), |
|
89 | - ]); |
|
85 | + glsr( AdminController::class )->routerFetchConsole(); |
|
86 | + wp_send_json_success( [ |
|
87 | + 'console' => glsr( Console::class )->get(), |
|
88 | + 'notices' => glsr( Notice::class )->get(), |
|
89 | + ] ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @return void |
94 | 94 | */ |
95 | - public function routerSearchPosts(array $request) |
|
95 | + public function routerSearchPosts( array $request ) |
|
96 | 96 | { |
97 | - $results = glsr(Database::class)->searchPosts($request['search']); |
|
98 | - wp_send_json_success([ |
|
99 | - 'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>', |
|
97 | + $results = glsr( Database::class )->searchPosts( $request['search'] ); |
|
98 | + wp_send_json_success( [ |
|
99 | + 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
|
100 | 100 | 'items' => $results, |
101 | - ]); |
|
101 | + ] ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @return void |
106 | 106 | */ |
107 | - public function routerSearchTranslations(array $request) |
|
107 | + public function routerSearchTranslations( array $request ) |
|
108 | 108 | { |
109 | - if (empty($request['exclude'])) { |
|
109 | + if( empty($request['exclude']) ) { |
|
110 | 110 | $request['exclude'] = []; |
111 | 111 | } |
112 | - $results = glsr(Translation::class) |
|
113 | - ->search($request['search']) |
|
112 | + $results = glsr( Translation::class ) |
|
113 | + ->search( $request['search'] ) |
|
114 | 114 | ->exclude() |
115 | - ->exclude($request['exclude']) |
|
115 | + ->exclude( $request['exclude'] ) |
|
116 | 116 | ->renderResults(); |
117 | - wp_send_json_success([ |
|
118 | - 'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>', |
|
117 | + wp_send_json_success( [ |
|
118 | + 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
|
119 | 119 | 'items' => $results, |
120 | - ]); |
|
120 | + ] ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
124 | 124 | * @return void |
125 | 125 | */ |
126 | - public function routerSubmitReview(array $request) |
|
126 | + public function routerSubmitReview( array $request ) |
|
127 | 127 | { |
128 | - $command = glsr(PublicController::class)->routerSubmitReview($request); |
|
129 | - $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true))); |
|
130 | - $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command); |
|
128 | + $command = glsr( PublicController::class )->routerSubmitReview( $request ); |
|
129 | + $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
130 | + $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command ); |
|
131 | 131 | $data = [ |
132 | - 'errors' => glsr()->sessionGet($command->form_id.'errors', false), |
|
133 | - 'message' => glsr()->sessionGet($command->form_id.'message', ''), |
|
134 | - 'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false), |
|
132 | + 'errors' => glsr()->sessionGet( $command->form_id.'errors', false ), |
|
133 | + 'message' => glsr()->sessionGet( $command->form_id.'message', '' ), |
|
134 | + 'recaptcha' => glsr()->sessionGet( $command->form_id.'recaptcha', false ), |
|
135 | 135 | 'redirect' => $redirect, |
136 | 136 | ]; |
137 | - if (false === $data['errors']) { |
|
137 | + if( false === $data['errors'] ) { |
|
138 | 138 | glsr()->sessionClear(); |
139 | - wp_send_json_success($data); |
|
139 | + wp_send_json_success( $data ); |
|
140 | 140 | } |
141 | - wp_send_json_error($data); |
|
141 | + wp_send_json_error( $data ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | 145 | * @return void |
146 | 146 | */ |
147 | - public function routerFetchPagedReviews(array $request) |
|
147 | + public function routerFetchPagedReviews( array $request ) |
|
148 | 148 | { |
149 | - $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH)); |
|
150 | - $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH)); |
|
149 | + $homePath = untrailingslashit( parse_url( home_url(), PHP_URL_PATH ) ); |
|
150 | + $urlPath = untrailingslashit( parse_url( Arr::get( $request, 'url' ), PHP_URL_PATH ) ); |
|
151 | 151 | $urlQuery = []; |
152 | - parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery); |
|
152 | + parse_str( parse_url( Arr::get( $request, 'url' ), PHP_URL_QUERY ), $urlQuery ); |
|
153 | 153 | $pagedUrl = $homePath === $urlPath |
154 | 154 | ? home_url() |
155 | - : home_url($urlPath); |
|
155 | + : home_url( $urlPath ); |
|
156 | 156 | $args = [ |
157 | - 'paged' => (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1), |
|
158 | - 'pagedUrl' => trailingslashit($pagedUrl), |
|
157 | + 'paged' => (int)Arr::get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 ), |
|
158 | + 'pagedUrl' => trailingslashit( $pagedUrl ), |
|
159 | 159 | 'pagination' => 'ajax', |
160 | 160 | 'schema' => false, |
161 | 161 | ]; |
162 | - $atts = (array) json_decode(Arr::get($request, 'atts')); |
|
163 | - $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts); |
|
164 | - $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts)); |
|
165 | - return wp_send_json_success([ |
|
162 | + $atts = (array)json_decode( Arr::get( $request, 'atts' ) ); |
|
163 | + $atts = glsr( SiteReviewsShortcode::class )->normalizeAtts( $atts ); |
|
164 | + $html = glsr( SiteReviewsPartial::class )->build( wp_parse_args( $args, $atts ) ); |
|
165 | + return wp_send_json_success( [ |
|
166 | 166 | 'pagination' => $html->getPagination(), |
167 | 167 | 'reviews' => $html->getReviews(), |
168 | - ]); |
|
168 | + ] ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | 172 | * @return void |
173 | 173 | */ |
174 | - public function routerTogglePinned(array $request) |
|
174 | + public function routerTogglePinned( array $request ) |
|
175 | 175 | { |
176 | - $isPinned = $this->execute(new TogglePinned($request)); |
|
177 | - wp_send_json_success([ |
|
178 | - 'notices' => glsr(Notice::class)->get(), |
|
176 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
177 | + wp_send_json_success( [ |
|
178 | + 'notices' => glsr( Notice::class )->get(), |
|
179 | 179 | 'pinned' => $isPinned, |
180 | - ]); |
|
180 | + ] ); |
|
181 | 181 | } |
182 | 182 | } |