@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'inactive-plugin' => 'Inactive Plugins', |
38 | 38 | 'setting' => 'Plugin Settings', |
39 | 39 | ]; |
40 | - $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) { |
|
40 | + $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) { |
|
41 | 41 | $methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' ); |
42 | 42 | if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) { |
43 | 43 | return $carry.$this->implode( $details[$key], $systemDetails ); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | { |
55 | 55 | $plugins = get_plugins(); |
56 | 56 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
57 | - $inactive = array_diff_key( $plugins, array_flip( $activePlugins )); |
|
58 | - return $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
57 | + $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) ); |
|
58 | + return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function getInactivePluginDetails() |
80 | 80 | { |
81 | 81 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
82 | - return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ))); |
|
82 | + return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | { |
90 | 90 | $plugins = array_merge( |
91 | 91 | get_mu_plugins(), |
92 | - get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
|
92 | + get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) ) |
|
93 | 93 | ); |
94 | - if( empty( $plugins ))return; |
|
94 | + if( empty($plugins) )return; |
|
95 | 95 | return $this->normalizePluginList( $plugins ); |
96 | 96 | } |
97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function getMultisitePluginDetails() |
102 | 102 | { |
103 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
103 | + if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return; |
|
104 | 104 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
105 | 105 | } |
106 | 106 | |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | 'Max Input Vars' => ini_get( 'max_input_vars' ), |
123 | 123 | 'Memory Limit' => ini_get( 'memory_limit' ), |
124 | 124 | 'Post Max Size' => ini_get( 'post_max_size' ), |
125 | - 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )), |
|
126 | - 'Session Name' => esc_html( ini_get( 'session.name' )), |
|
127 | - 'Session Save Path' => esc_html( ini_get( 'session.save_path' )), |
|
128 | - 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ), |
|
129 | - 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ), |
|
125 | + 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ), |
|
126 | + 'Session Name' => esc_html( ini_get( 'session.name' ) ), |
|
127 | + 'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ), |
|
128 | + 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ), |
|
129 | + 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ), |
|
130 | 130 | 'Upload Max Filesize' => ini_get( 'upload_max_filesize' ), |
131 | 131 | ]; |
132 | 132 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | $settings = glsr( OptionManager::class )->get( 'settings', [] ); |
155 | 155 | $settings = $helper->flattenArray( $settings ); |
156 | 156 | foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) { |
157 | - if( empty( $settings[$key] ))continue; |
|
157 | + if( empty($settings[$key]) )continue; |
|
158 | 158 | $settings[$key] = str_repeat( '*', 10 ); |
159 | 159 | } |
160 | 160 | $details = []; |
161 | 161 | foreach( $settings as $key => $value ) { |
162 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
163 | - $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
|
162 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue; |
|
163 | + $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' ); |
|
164 | 164 | $details[$key] = $value; |
165 | 165 | } |
166 | 166 | return $details; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | return $value; |
241 | 241 | } |
242 | 242 | } |
243 | - return implode( ',', array_filter( [DB_HOST, $serverName] )); |
|
243 | + return implode( ',', array_filter( [DB_HOST, $serverName] ) ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | { |
262 | 262 | $plugins = get_plugins(); |
263 | 263 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
264 | - $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ))); |
|
265 | - $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
264 | + $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) ); |
|
265 | + $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
266 | 266 | return $active + $inactive; |
267 | 267 | } |
268 | 268 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | protected function implode( $title, array $details ) |
274 | 274 | { |
275 | 275 | $strings = ['['.$title.']']; |
276 | - $padding = max( array_map( 'strlen', array_keys( $details )) ); |
|
276 | + $padding = max( array_map( 'strlen', array_keys( $details ) ) ); |
|
277 | 277 | $padding = max( [$padding, static::PAD] ); |
278 | 278 | foreach( $details as $key => $value ) { |
279 | 279 | $strings[] = is_string( $key ) |
@@ -91,7 +91,9 @@ discard block |
||
91 | 91 | get_mu_plugins(), |
92 | 92 | get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
93 | 93 | ); |
94 | - if( empty( $plugins ))return; |
|
94 | + if( empty( $plugins )) { |
|
95 | + return; |
|
96 | + } |
|
95 | 97 | return $this->normalizePluginList( $plugins ); |
96 | 98 | } |
97 | 99 | |
@@ -100,7 +102,9 @@ discard block |
||
100 | 102 | */ |
101 | 103 | public function getMultisitePluginDetails() |
102 | 104 | { |
103 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
105 | + if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) { |
|
106 | + return; |
|
107 | + } |
|
104 | 108 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
105 | 109 | } |
106 | 110 | |
@@ -154,12 +158,16 @@ discard block |
||
154 | 158 | $settings = glsr( OptionManager::class )->get( 'settings', [] ); |
155 | 159 | $settings = $helper->flattenArray( $settings ); |
156 | 160 | foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) { |
157 | - if( empty( $settings[$key] ))continue; |
|
161 | + if( empty( $settings[$key] )) { |
|
162 | + continue; |
|
163 | + } |
|
158 | 164 | $settings[$key] = str_repeat( '*', 10 ); |
159 | 165 | } |
160 | 166 | $details = []; |
161 | 167 | foreach( $settings as $key => $value ) { |
162 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
168 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) { |
|
169 | + continue; |
|
170 | + } |
|
163 | 171 | $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
164 | 172 | $details[$key] = $value; |
165 | 173 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $translations = $this->getTranslations(); |
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->getTranslations(); |
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 ); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | return $this->translate( $translation, $domain, [ |
101 | 101 | 'single' => $text, |
102 | - ]); |
|
102 | + ] ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return $this->translate( $translation, $domain, [ |
115 | 115 | 'context' => $context, |
116 | 116 | 'single' => $text, |
117 | - ]); |
|
117 | + ] ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | 'number' => $number, |
132 | 132 | 'plural' => $plural, |
133 | 133 | 'single' => $single, |
134 | - ]); |
|
134 | + ] ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'number' => $number, |
151 | 151 | 'plural' => $plural, |
152 | 152 | 'single' => $single, |
153 | - ]); |
|
153 | + ] ); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | public function render( $template, array $entry ) |
161 | 161 | { |
162 | 162 | $data = array_combine( |
163 | - array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )), |
|
163 | + array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ), |
|
164 | 164 | $entry |
165 | 165 | ); |
166 | 166 | ob_start(); |
167 | 167 | glsr( Html::class )->renderTemplate( 'partials/translations/'.$template, [ |
168 | 168 | 'context' => $data, |
169 | - ]); |
|
169 | + ] ); |
|
170 | 170 | return ob_get_clean(); |
171 | 171 | } |
172 | 172 | |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | 'p1' => $this->getEntryString( $entry, 'msgid_plural' ), |
200 | 200 | 's1' => $this->getEntryString( $entry, 'msgid' ), |
201 | 201 | ]; |
202 | - $text = !empty( $data['p1'] ) |
|
202 | + $text = !empty($data['p1']) |
|
203 | 203 | ? sprintf( '%s | %s', $data['s1'], $data['p1'] ) |
204 | 204 | : $data['s1']; |
205 | 205 | $rendered .= $this->render( 'result', [ |
206 | 206 | 'entry' => wp_json_encode( $data ), |
207 | 207 | 'text' => wp_strip_all_tags( $text ), |
208 | - ]); |
|
208 | + ] ); |
|
209 | 209 | } |
210 | 210 | if( $resetAfterRender ) { |
211 | 211 | $this->reset(); |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | public function search( $needle = '' ) |
239 | 239 | { |
240 | 240 | $this->reset(); |
241 | - $needle = trim( strtolower( $needle )); |
|
241 | + $needle = trim( strtolower( $needle ) ); |
|
242 | 242 | foreach( $this->entries() as $key => $entry ) { |
243 | - $single = strtolower( $this->getEntryString( $entry, 'msgid' )); |
|
244 | - $plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' )); |
|
243 | + $single = strtolower( $this->getEntryString( $entry, 'msgid' ) ); |
|
244 | + $plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) ); |
|
245 | 245 | if( strlen( $needle ) < static::SEARCH_THRESHOLD ) { |
246 | - if( in_array( $needle, [$single, $plural] )) { |
|
246 | + if( in_array( $needle, [$single, $plural] ) ) { |
|
247 | 247 | $this->results[$key] = $entry; |
248 | 248 | } |
249 | 249 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | $args = $this->normalizeTranslationArgs( $args ); |
268 | 268 | $strings = $this->getTranslationStrings( $args['single'], $args['plural'] ); |
269 | - if( empty( $strings )) { |
|
269 | + if( empty($strings) ) { |
|
270 | 270 | return $original; |
271 | 271 | } |
272 | 272 | $string = current( $strings ); |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | */ |
282 | 282 | protected function getEntryString( array $entry, $key ) |
283 | 283 | { |
284 | - return isset( $entry[$key] ) |
|
285 | - ? implode( '', (array) $entry[$key] ) |
|
284 | + return isset($entry[$key]) |
|
285 | + ? implode( '', (array)$entry[$key] ) |
|
286 | 286 | : ''; |
287 | 287 | } |
288 | 288 | |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | protected function getTranslations() |
293 | 293 | { |
294 | 294 | $settings = glsr( OptionManager::class )->get( 'settings' ); |
295 | - return isset( $settings['strings'] ) |
|
296 | - ? $this->normalizeSettings( (array) $settings['strings'] ) |
|
295 | + return isset($settings['strings']) |
|
296 | + ? $this->normalizeSettings( (array)$settings['strings'] ) |
|
297 | 297 | : []; |
298 | 298 | } |
299 | 299 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | protected function getTranslationStrings( $single, $plural ) |
306 | 306 | { |
307 | - return array_filter( $this->getTranslations(), function( $string ) use( $single, $plural ) { |
|
307 | + return array_filter( $this->getTranslations(), function( $string ) use($single, $plural) { |
|
308 | 308 | return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' ) |
309 | 309 | && $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' ); |
310 | 310 | }); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $keys = [ |
319 | 319 | 'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]', |
320 | 320 | ]; |
321 | - array_walk( $entries, function( &$entry ) use( $keys ) { |
|
321 | + array_walk( $entries, function( &$entry ) use($keys) { |
|
322 | 322 | foreach( $keys as $key ) { |
323 | 323 | $entry = $this->normalizeEntryString( $entry, $key ); |
324 | 324 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | protected function normalizeEntryString( array $entry, $key ) |
334 | 334 | { |
335 | - if( isset( $entry[$key] )) { |
|
335 | + if( isset($entry[$key]) ) { |
|
336 | 336 | $entry[$key] = $this->getEntryString( $entry, $key ); |
337 | 337 | } |
338 | 338 | return $entry; |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | $defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' ); |
347 | 347 | $strings = array_filter( $strings, 'is_array' ); |
348 | 348 | foreach( $strings as &$string ) { |
349 | - $string['type'] = isset( $string['p1'] ) ? 'plural' : 'single'; |
|
349 | + $string['type'] = isset($string['p1']) ? 'plural' : 'single'; |
|
350 | 350 | $string = wp_parse_args( $string, $defaultString ); |
351 | 351 | } |
352 | 352 | return array_filter( $strings, function( $string ) { |
353 | - return !empty( $string['id'] ); |
|
353 | + return !empty($string['id']); |
|
354 | 354 | }); |
355 | 355 | } |
356 | 356 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | */ |
375 | 375 | protected function translatePlural( $domain, array $string, array $args ) |
376 | 376 | { |
377 | - if( !empty( $string['p2'] )) { |
|
377 | + if( !empty($string['p2']) ) { |
|
378 | 378 | $args['plural'] = $string['p2']; |
379 | 379 | } |
380 | 380 | return get_translations_for_domain( $domain )->translate_plural( |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | protected function translateSingle( $domain, array $string, array $args ) |
393 | 393 | { |
394 | - if( !empty( $string['s2'] )) { |
|
394 | + if( !empty($string['s2']) ) { |
|
395 | 395 | $args['single'] = $string['s2']; |
396 | 396 | } |
397 | 397 | return get_translations_for_domain( $domain )->translate( |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | : $this->$method( $id ); |
24 | 24 | glsr( Template::class )->render( 'pages/settings/'.$id, [ |
25 | 25 | 'context' => $context, |
26 | - ]); |
|
26 | + ] ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function getSettingFields( $path ) |
33 | 33 | { |
34 | 34 | $settings = glsr( DefaultsManager::class )->settings(); |
35 | - return array_filter( $settings, function( $key ) use( $path ) { |
|
35 | + return array_filter( $settings, function( $key ) use($path) { |
|
36 | 36 | return glsr( Helper::class )->startsWith( $path, $key ); |
37 | 37 | }, ARRAY_FILTER_USE_KEY ); |
38 | 38 | } |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function getTemplateContext( $id ) |
45 | 45 | { |
46 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
46 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
47 | 47 | $rows = ''; |
48 | 48 | foreach( $fields as $name => $field ) { |
49 | 49 | $field = wp_parse_args( $field, ['name' => $name] ); |
50 | - $rows.= (new Field( $field ))->build(); |
|
50 | + $rows .= (new Field( $field ))->build(); |
|
51 | 51 | } |
52 | 52 | return [ |
53 | 53 | 'rows' => $rows, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | protected function getTemplateContextForTranslations() |
61 | 61 | { |
62 | 62 | $translations = glsr( Translator::class )->renderAll(); |
63 | - $class = empty( $translations ) |
|
63 | + $class = empty($translations) |
|
64 | 64 | ? 'glsr-hidden' |
65 | 65 | : ''; |
66 | 66 | return [ |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | return $input; |
22 | 22 | } |
23 | 23 | $triggered = true; |
24 | - if( !is_array( $input )) { |
|
24 | + if( !is_array( $input ) ) { |
|
25 | 25 | $input = ['settings' => []]; |
26 | 26 | } |
27 | 27 | if( key( $input ) == 'settings' ) { |
28 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
28 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
29 | 29 | } |
30 | 30 | $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input ); |
31 | 31 | $options = $this->sanitizeSubmissions( $input, $options ); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
43 | 43 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
44 | - ]); |
|
44 | + ] ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function sanitizeSubmissions( array $input, array $options ) |
51 | 51 | { |
52 | - if( isset( $input['settings']['submissions'] )) { |
|
52 | + if( isset($input['settings']['submissions']) ) { |
|
53 | 53 | $inputForm = $input['settings']['submissions']; |
54 | - $options['settings']['submissions']['required'] = isset( $inputForm['required'] ) |
|
54 | + $options['settings']['submissions']['required'] = isset($inputForm['required']) |
|
55 | 55 | ? $inputForm['required'] |
56 | 56 | : []; |
57 | 57 | } |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function sanitizeTranslations( array $input, array $options ) |
65 | 65 | { |
66 | - if( isset( $input['settings']['strings'] )) { |
|
67 | - $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] )); |
|
66 | + if( isset($input['settings']['strings']) ) { |
|
67 | + $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) ); |
|
68 | 68 | array_walk( $options['settings']['strings'], function( &$string ) { |
69 | - if( isset( $string['s2'] )) { |
|
69 | + if( isset($string['s2']) ) { |
|
70 | 70 | $string['s2'] = wp_strip_all_tags( $string['s2'] ); |
71 | 71 | } |
72 | - if( isset( $string['p2'] )) { |
|
72 | + if( isset($string['p2']) ) { |
|
73 | 73 | $string['p2'] = wp_strip_all_tags( $string['p2'] ); |
74 | 74 | } |
75 | 75 | }); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | wp_send_json( glsr( Html::class )->renderPartial( 'link', [ |
25 | 25 | 'post_id' => $request['ID'], |
26 | - ])); |
|
26 | + ] ) ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function changeReviewStatus( array $request ) |
33 | 33 | { |
34 | - wp_send_json( $this->execute( new ChangeStatus( $request ))); |
|
34 | + wp_send_json( $this->execute( new ChangeStatus( $request ) ) ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | public function clearLog() |
41 | 41 | { |
42 | 42 | glsr( AdminController::class )->routerClearLog(); |
43 | - wp_send_json([ |
|
43 | + wp_send_json( [ |
|
44 | 44 | 'logger' => glsr( Logger::class )->get(), |
45 | 45 | 'notices' => glsr( Notice::class )->get(), |
46 | - ]); |
|
46 | + ] ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | { |
54 | 54 | $shortcode = $request['shortcode']; |
55 | 55 | $response = false; |
56 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
56 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
57 | 57 | $data = glsr()->mceShortcodes[$shortcode]; |
58 | - if( !empty( $data['errors'] )) { |
|
58 | + if( !empty($data['errors']) ) { |
|
59 | 59 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
60 | 60 | } |
61 | 61 | $response = [ |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | public function searchPosts( array $request ) |
76 | 76 | { |
77 | 77 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
78 | - wp_send_json_success([ |
|
78 | + wp_send_json_success( [ |
|
79 | 79 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
80 | 80 | 'items' => $results, |
81 | - ]); |
|
81 | + ] ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function searchTranslations( array $request ) |
88 | 88 | { |
89 | - if( empty( $request['exclude'] )) { |
|
89 | + if( empty($request['exclude']) ) { |
|
90 | 90 | $request['exclude'] = []; |
91 | 91 | } |
92 | 92 | $results = glsr( Translator::class ) |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | ->exclude() |
95 | 95 | ->exclude( $request['exclude'] ) |
96 | 96 | ->renderResults(); |
97 | - wp_send_json_success([ |
|
97 | + wp_send_json_success( [ |
|
98 | 98 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
99 | 99 | 'items' => $results, |
100 | - ]); |
|
100 | + ] ); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | { |
108 | 108 | $response = glsr( PublicController::class )->routerCreateReview( $request ); |
109 | 109 | $session = glsr( Session::class ); |
110 | - wp_send_json([ |
|
110 | + wp_send_json( [ |
|
111 | 111 | 'errors' => $session->get( $request['form_id'].'-errors', false, true ), |
112 | 112 | 'message' => $response, |
113 | 113 | 'recaptcha' => $session->get( $request['form_id'].'-recaptcha', false, true ), |
114 | - ]); |
|
114 | + ] ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function togglePinned( array $request ) |
121 | 121 | { |
122 | - wp_send_json([ |
|
122 | + wp_send_json( [ |
|
123 | 123 | 'notices' => glsr( Notice::class )->get(), |
124 | - 'pinned' => $this->execute( new TogglePinned( $request )), |
|
125 | - ]); |
|
124 | + 'pinned' => $this->execute( new TogglePinned( $request ) ), |
|
125 | + ] ); |
|
126 | 126 | } |
127 | 127 | } |