@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $translations = $this->translations(); |
32 | 32 | $entries = $this->filter( $translations, $this->entries() )->results(); |
33 | - array_walk( $translations, function( &$entry ) use( $entries ) { |
|
33 | + array_walk( $translations, function( &$entry ) use($entries) { |
|
34 | 34 | $entry['desc'] = array_key_exists( $entry['id'], $entries ) |
35 | 35 | ? $this->getEntryString( $entries[$entry['id']], 'msgctxt' ) |
36 | 36 | : ''; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function entries() |
45 | 45 | { |
46 | - if( !isset( $this->entries )) { |
|
46 | + if( !isset($this->entries) ) { |
|
47 | 47 | try { |
48 | 48 | $potFile = glsr()->path( glsr()->languages.'/'.Application::ID.'.pot' ); |
49 | 49 | $entries = $this->normalize( Parser::parseFile( $potFile )->getEntries() ); |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function filter( $filterWith = null, $entries = null, $intersect = true ) |
78 | 78 | { |
79 | - if( !is_array( $entries )) { |
|
79 | + if( !is_array( $entries ) ) { |
|
80 | 80 | $entries = $this->results; |
81 | 81 | } |
82 | - if( !is_array( $filterWith )) { |
|
82 | + if( !is_array( $filterWith ) ) { |
|
83 | 83 | $filterWith = $this->translations(); |
84 | 84 | } |
85 | - $keys = array_flip( array_column( $filterWith, 'id' )); |
|
85 | + $keys = array_flip( array_column( $filterWith, 'id' ) ); |
|
86 | 86 | $this->results = $intersect |
87 | 87 | ? array_intersect_key( $entries, $keys ) |
88 | 88 | : array_diff_key( $entries, $keys ); |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | public function render( $template, array $entry ) |
97 | 97 | { |
98 | 98 | $data = array_combine( |
99 | - array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )), |
|
99 | + array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ), |
|
100 | 100 | $entry |
101 | 101 | ); |
102 | 102 | $data['data.class'] = $data['data.error'] = ''; |
103 | - if( array_search( $entry['s1'], array_column( $this->entries(), 'msgid' )) === false ) { |
|
103 | + if( array_search( $entry['s1'], array_column( $this->entries(), 'msgid' ) ) === false ) { |
|
104 | 104 | $data['data.class'] = 'is-invalid'; |
105 | 105 | $data['data.error'] = __( 'This custom translation is no longer valid as the original text has been changed or removed.', 'site-reviews' ); |
106 | 106 | } |
107 | 107 | return glsr( Template::class )->build( 'partials/translations/'.$template, [ |
108 | 108 | 'context' => $data, |
109 | - ]); |
|
109 | + ] ); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | 'p1' => $this->getEntryString( $entry, 'msgid_plural' ), |
139 | 139 | 's1' => $this->getEntryString( $entry, 'msgid' ), |
140 | 140 | ]; |
141 | - $text = !empty( $data['p1'] ) |
|
141 | + $text = !empty($data['p1']) |
|
142 | 142 | ? sprintf( '%s | %s', $data['s1'], $data['p1'] ) |
143 | 143 | : $data['s1']; |
144 | 144 | $rendered .= $this->render( 'result', [ |
145 | - 'entry' => json_encode( $data, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ), |
|
145 | + 'entry' => json_encode( $data, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), |
|
146 | 146 | 'text' => wp_strip_all_tags( $text ), |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | if( $resetAfterRender ) { |
150 | 150 | $this->reset(); |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | public function search( $needle = '' ) |
178 | 178 | { |
179 | 179 | $this->reset(); |
180 | - $needle = trim( strtolower( $needle )); |
|
180 | + $needle = trim( strtolower( $needle ) ); |
|
181 | 181 | foreach( $this->entries() as $key => $entry ) { |
182 | - $single = strtolower( $this->getEntryString( $entry, 'msgid' )); |
|
183 | - $plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' )); |
|
182 | + $single = strtolower( $this->getEntryString( $entry, 'msgid' ) ); |
|
183 | + $plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) ); |
|
184 | 184 | if( strlen( $needle ) < static::SEARCH_THRESHOLD ) { |
185 | - if( in_array( $needle, [$single, $plural] )) { |
|
185 | + if( in_array( $needle, [$single, $plural] ) ) { |
|
186 | 186 | $this->results[$key] = $entry; |
187 | 187 | } |
188 | 188 | } |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | public function translations() |
201 | 201 | { |
202 | 202 | static $translations; |
203 | - if( empty( $translations )) { |
|
203 | + if( empty($translations) ) { |
|
204 | 204 | $settings = glsr( OptionManager::class )->get( 'settings' ); |
205 | - $translations = isset( $settings['strings'] ) |
|
206 | - ? $this->normalizeSettings( (array) $settings['strings'] ) |
|
205 | + $translations = isset($settings['strings']) |
|
206 | + ? $this->normalizeSettings( (array)$settings['strings'] ) |
|
207 | 207 | : []; |
208 | 208 | } |
209 | 209 | return $translations; |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function getEntryString( array $entry, $key ) |
217 | 217 | { |
218 | - return isset( $entry[$key] ) |
|
219 | - ? implode( '', (array) $entry[$key] ) |
|
218 | + return isset($entry[$key]) |
|
219 | + ? implode( '', (array)$entry[$key] ) |
|
220 | 220 | : ''; |
221 | 221 | } |
222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $keys = [ |
229 | 229 | 'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]', |
230 | 230 | ]; |
231 | - array_walk( $entries, function( &$entry ) use( $keys ) { |
|
231 | + array_walk( $entries, function( &$entry ) use($keys) { |
|
232 | 232 | foreach( $keys as $key ) { |
233 | 233 | $entry = $this->normalizeEntryString( $entry, $key ); |
234 | 234 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | protected function normalizeEntryString( array $entry, $key ) |
244 | 244 | { |
245 | - if( isset( $entry[$key] )) { |
|
245 | + if( isset($entry[$key]) ) { |
|
246 | 246 | $entry[$key] = $this->getEntryString( $entry, $key ); |
247 | 247 | } |
248 | 248 | return $entry; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | $defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' ); |
257 | 257 | $strings = array_filter( $strings, 'is_array' ); |
258 | 258 | foreach( $strings as &$string ) { |
259 | - $string['type'] = isset( $string['p1'] ) ? 'plural' : 'single'; |
|
259 | + $string['type'] = isset($string['p1']) ? 'plural' : 'single'; |
|
260 | 260 | $string = wp_parse_args( $string, $defaultString ); |
261 | 261 | } |
262 | 262 | return array_filter( $strings, function( $string ) { |
263 | - return !empty( $string['id'] ); |
|
263 | + return !empty($string['id']); |
|
264 | 264 | }); |
265 | 265 | } |
266 | 266 | } |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->newSettings = $this->getNewSettings(); |
76 | 76 | $this->oldSettings = $this->getOldSettings(); |
77 | - if( empty( $this->oldSettings ))return; |
|
77 | + if( empty($this->oldSettings) )return; |
|
78 | 78 | foreach( static::MAPPED_SETTINGS as $old => $new ) { |
79 | - if( empty( $this->oldSettings[$old] ))continue; |
|
79 | + if( empty($this->oldSettings[$old]) )continue; |
|
80 | 80 | $this->newSettings[$new] = $this->oldSettings[$old]; |
81 | 81 | } |
82 | 82 | $this->migrateNotificationSettings(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->migrateRequiredSettings(); |
85 | 85 | $oldSettings = glsr( Helper::class )->convertDotNotationArray( $this->oldSettings ); |
86 | 86 | $newSettings = glsr( Helper::class )->convertDotNotationArray( $this->newSettings ); |
87 | - if( isset( $oldSettings['settings']['strings'] ) && is_array( $oldSettings['settings']['strings'] )) { |
|
87 | + if( isset($oldSettings['settings']['strings']) && is_array( $oldSettings['settings']['strings'] ) ) { |
|
88 | 88 | $newSettings['settings']['strings'] = $oldSettings['settings']['strings']; |
89 | 89 | } |
90 | 90 | glsr( OptionManager::class )->set( $newSettings ); |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | protected function getOldSettings() |
118 | 118 | { |
119 | 119 | $defaults = array_fill_keys( array_keys( static::MAPPED_SETTINGS ), '' ); |
120 | - $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] )); |
|
121 | - if( !empty( $settings )) { |
|
120 | + $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] ) ); |
|
121 | + if( !empty($settings) ) { |
|
122 | 122 | $settings = wp_parse_args( $settings, $defaults ); |
123 | 123 | } |
124 | 124 | return $settings; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'], |
152 | 152 | 'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'], |
153 | 153 | ]; |
154 | - if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) { |
|
154 | + if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) { |
|
155 | 155 | $this->newSettings['settings.submissions.recaptcha.integration'] = 'all'; |
156 | 156 | } |
157 | 157 | if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function enqueueAssets() |
27 | 27 | { |
28 | - $command = new EnqueueAdminAssets([ |
|
28 | + $command = new EnqueueAdminAssets( [ |
|
29 | 29 | 'pointers' => [[ |
30 | 30 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
31 | 31 | 'id' => 'glsr-pointer-pinned', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'target' => '#misc-pub-pinned', |
38 | 38 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
39 | 39 | ]], |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | $this->execute( $command ); |
42 | 42 | } |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | { |
50 | 50 | $links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
51 | 51 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
52 | - ]); |
|
52 | + ] ); |
|
53 | 53 | return $links; |
54 | 54 | } |
55 | 55 | |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | public function filterDashboardGlanceItems( array $items ) |
61 | 61 | { |
62 | 62 | $postCount = wp_count_posts( Application::POST_TYPE ); |
63 | - if( empty( $postCount->publish )) { |
|
63 | + if( empty($postCount->publish) ) { |
|
64 | 64 | return $items; |
65 | 65 | } |
66 | 66 | $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' ); |
67 | - $text = sprintf( $text, number_format_i18n( $postCount->publish )); |
|
67 | + $text = sprintf( $text, number_format_i18n( $postCount->publish ) ); |
|
68 | 68 | $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts ) |
69 | 69 | ? glsr( Builder::class )->a( $text, [ |
70 | 70 | 'class' => 'glsr-review-count', |
71 | 71 | 'href' => 'edit.php?post_type='.Application::POST_TYPE, |
72 | - ]) |
|
72 | + ] ) |
|
73 | 73 | : glsr( Builder::class )->span( $text, [ |
74 | 74 | 'class' => 'glsr-review-count', |
75 | - ]); |
|
75 | + ] ); |
|
76 | 76 | return $items; |
77 | 77 | } |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function filterTinymcePlugins( array $plugins ) |
84 | 84 | { |
85 | 85 | if( user_can_richedit() |
86 | - && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) { |
|
86 | + && (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) { |
|
87 | 87 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
88 | 88 | } |
89 | 89 | return $plugins; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function registerShortcodeButtons() |
97 | 97 | { |
98 | - $command = new RegisterShortcodeButtons([ |
|
98 | + $command = new RegisterShortcodeButtons( [ |
|
99 | 99 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
100 | 100 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
101 | 101 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
102 | - ]); |
|
102 | + ] ); |
|
103 | 103 | $this->execute( $command ); |
104 | 104 | } |
105 | 105 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function renderReviewEditor( WP_Post $post ) |
111 | 111 | { |
112 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
112 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
|
113 | 113 | glsr()->render( 'partials/editor/review', [ |
114 | 114 | 'post' => $post, |
115 | - ]); |
|
115 | + ] ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function renderReviewNotice( WP_Post $post ) |
123 | 123 | { |
124 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
125 | - glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
|
124 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
|
125 | + glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) ); |
|
126 | 126 | glsr( Template::class )->render( 'partials/editor/notice', [ |
127 | 127 | 'context' => [ |
128 | 128 | 'notices' => glsr( Notice::class )->get(), |
129 | 129 | ], |
130 | - ]); |
|
130 | + ] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
142 | 142 | $shortcodes[$shortcode] = $values; |
143 | 143 | } |
144 | - if( empty( $shortcodes ))return; |
|
144 | + if( empty($shortcodes) )return; |
|
145 | 145 | glsr()->render( 'partials/editor/tinymce', [ |
146 | 146 | 'shortcodes' => $shortcodes, |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function routerClearConsole() |
154 | 154 | { |
155 | 155 | glsr( Console::class )->clear(); |
156 | - glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' )); |
|
156 | + glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) ); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function routerFetchConsole() |
163 | 163 | { |
164 | - glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' )); |
|
164 | + glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | public function routerCountReviews( $showNotice = true ) |
172 | 172 | { |
173 | 173 | $countManager = glsr( CountsManager::class ); |
174 | - $terms = get_terms([ |
|
174 | + $terms = get_terms( [ |
|
175 | 175 | 'hide_empty' => true, |
176 | 176 | 'taxonomy' => Application::TAXONOMY, |
177 | - ]); |
|
177 | + ] ); |
|
178 | 178 | foreach( $terms as $term ) { |
179 | - $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id )); |
|
179 | + $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) ); |
|
180 | 180 | } |
181 | 181 | $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' ); |
182 | 182 | foreach( $postIds as $postId ) { |
183 | - $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId )); |
|
183 | + $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) ); |
|
184 | 184 | } |
185 | 185 | $countManager->setCounts( $countManager->buildCounts() ); |
186 | 186 | if( $showNotice ) { |
187 | - glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
187 | + glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | { |
220 | 220 | $file = $_FILES['import-file']; |
221 | 221 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
222 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
222 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
223 | 223 | } |
224 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
225 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
224 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
225 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
226 | 226 | } |
227 | 227 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
228 | - if( empty( $settings )) { |
|
229 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
228 | + if( empty($settings) ) { |
|
229 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
230 | 230 | } |
231 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
232 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
231 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
232 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
248 | 248 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
249 | 249 | ]; |
250 | - return !isset( $errors[$errorCode] ) |
|
250 | + return !isset($errors[$errorCode]) |
|
251 | 251 | ? __( 'Unknown upload error.', 'site-reviews' ) |
252 | 252 | : $errors[$errorCode]; |
253 | 253 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function routerChangeStatus( array $request ) |
24 | 24 | { |
25 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
25 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | public function routerClearConsole() |
32 | 32 | { |
33 | 33 | glsr( AdminController::class )->routerClearConsole(); |
34 | - wp_send_json_success([ |
|
34 | + wp_send_json_success( [ |
|
35 | 35 | 'console' => glsr( Console::class )->get(), |
36 | 36 | 'notices' => glsr( Notice::class )->get(), |
37 | - ]); |
|
37 | + ] ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | public function routerCountReviews() |
44 | 44 | { |
45 | 45 | glsr( AdminController::class )->routerCountReviews(); |
46 | - wp_send_json_success([ |
|
46 | + wp_send_json_success( [ |
|
47 | 47 | 'notices' => glsr( Notice::class )->get(), |
48 | - ]); |
|
48 | + ] ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | $shortcode = $request['shortcode']; |
57 | 57 | $response = false; |
58 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
58 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
59 | 59 | $data = glsr()->mceShortcodes[$shortcode]; |
60 | - if( !empty( $data['errors'] )) { |
|
60 | + if( !empty($data['errors']) ) { |
|
61 | 61 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
62 | 62 | } |
63 | 63 | $response = [ |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function routerFetchConsole() |
78 | 78 | { |
79 | 79 | glsr( AdminController::class )->routerFetchConsole(); |
80 | - wp_send_json_success([ |
|
80 | + wp_send_json_success( [ |
|
81 | 81 | 'console' => glsr( Console::class )->get(), |
82 | 82 | 'notices' => glsr( Notice::class )->get(), |
83 | - ]); |
|
83 | + ] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public function routerSearchPosts( array $request ) |
90 | 90 | { |
91 | 91 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
92 | - wp_send_json_success([ |
|
92 | + wp_send_json_success( [ |
|
93 | 93 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
94 | 94 | 'items' => $results, |
95 | - ]); |
|
95 | + ] ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function routerSearchTranslations( array $request ) |
102 | 102 | { |
103 | - if( empty( $request['exclude'] )) { |
|
103 | + if( empty($request['exclude']) ) { |
|
104 | 104 | $request['exclude'] = []; |
105 | 105 | } |
106 | 106 | $results = glsr( Translation::class ) |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | ->exclude() |
109 | 109 | ->exclude( $request['exclude'] ) |
110 | 110 | ->renderResults(); |
111 | - wp_send_json_success([ |
|
111 | + wp_send_json_success( [ |
|
112 | 112 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
113 | 113 | 'items' => $results, |
114 | - ]); |
|
114 | + ] ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | 'errors' => glsr( Session::class )->get( $request['form_id'].'errors', false, true ), |
125 | 125 | 'message' => glsr( Session::class )->get( $request['form_id'].'message', '', true ), |
126 | 126 | 'recaptcha' => glsr( Session::class )->get( $request['form_id'].'recaptcha', false, true ), |
127 | - 'redirect' => trim( strval( get_post_meta( intval( $request['post_id'] ), 'redirect_to', true ))), |
|
127 | + 'redirect' => trim( strval( get_post_meta( intval( $request['post_id'] ), 'redirect_to', true ) ) ), |
|
128 | 128 | ]; |
129 | - if( !wp_validate_boolean( $data['errors'] )) { |
|
129 | + if( !wp_validate_boolean( $data['errors'] ) ) { |
|
130 | 130 | glsr( Session::class )->clear(); |
131 | 131 | wp_send_json_success( $data ); |
132 | 132 | } |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function routerTogglePinned( array $request ) |
140 | 140 | { |
141 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
142 | - wp_send_json_success([ |
|
141 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
142 | + wp_send_json_success( [ |
|
143 | 143 | 'notices' => glsr( Notice::class )->get(), |
144 | 144 | 'pinned' => $isPinned, |
145 | - ]); |
|
145 | + ] ); |
|
146 | 146 | } |
147 | 147 | } |