@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | public function defaults() |
14 | 14 | { |
15 | 15 | $settings = $this->settings(); |
16 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
16 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
17 | 17 | return wp_parse_args( $defaults, [ |
18 | 18 | 'version' => '', |
19 | 19 | 'version_upgraded_from' => '', |
20 | - ]); |
|
20 | + ] ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | protected function normalize( array $settings ) |
58 | 58 | { |
59 | 59 | array_walk( $settings, function( &$setting ) { |
60 | - if( isset( $setting['default'] ))return; |
|
60 | + if( isset($setting['default']) )return; |
|
61 | 61 | $setting['default'] = ''; |
62 | 62 | }); |
63 | 63 | return $settings; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function download( $filename, $content ) |
17 | 17 | { |
18 | - if( !current_user_can( Application::CAPABILITY ))return; |
|
18 | + if( !current_user_can( Application::CAPABILITY ) )return; |
|
19 | 19 | nocache_headers(); |
20 | 20 | header( 'Content-Type: text/plain' ); |
21 | 21 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function execute( $command ) |
32 | 32 | { |
33 | - $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command )); |
|
34 | - if( !class_exists( $handlerClass )) { |
|
33 | + $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) ); |
|
34 | + if( !class_exists( $handlerClass ) ) { |
|
35 | 35 | throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' ); |
36 | 36 | } |
37 | 37 | try { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | catch( Exception $e ) { |
41 | 41 | status_header( 400 ); |
42 | - glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() )); |
|
42 | + glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) ); |
|
43 | 43 | glsr_log()->error( $e->getMessage() ); |
44 | 44 | } |
45 | 45 | } |
@@ -49,6 +49,6 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function getPostId() |
51 | 51 | { |
52 | - return intval( filter_input( INPUT_GET, 'post' )); |
|
52 | + return intval( filter_input( INPUT_GET, 'post' ) ); |
|
53 | 53 | } |
54 | 54 | } |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | public function routeAdminPostRequest() |
17 | 17 | { |
18 | 18 | $request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
19 | - if( !isset( $request['action'] ))return; |
|
19 | + if( !isset( $request['action'] )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | $this->checkNonce( $request['action'] ); |
21 | 23 | $this->routeRequest( 'admin', $request['action'], $request ); |
22 | 24 | } |
@@ -71,7 +73,9 @@ discard block |
||
71 | 73 | public function routeWebhookRequest() |
72 | 74 | { |
73 | 75 | $request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID )); |
74 | - if( !$request )return; |
|
76 | + if( !$request ) { |
|
77 | + return; |
|
78 | + } |
|
75 | 79 | // @todo manage webhook here |
76 | 80 | } |
77 | 81 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function routeAdminPostRequest() |
17 | 17 | { |
18 | 18 | $request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
19 | - if( !isset( $request['action'] ))return; |
|
19 | + if( !isset($request['action']) )return; |
|
20 | 20 | $this->checkNonce( $request['action'] ); |
21 | 21 | $this->routeRequest( 'admin', $request['action'], $request ); |
22 | 22 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function routeAjaxRequest() |
28 | 28 | { |
29 | 29 | $request = $this->normalizeAjaxRequest(); |
30 | - if( !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
30 | + if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
31 | 31 | glsr_log()->error( 'Nonce check failed for ajax request' )->info( $request ); |
32 | 32 | wp_die( -1, 403 ); |
33 | 33 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function routeRequest( $type, $action, array $request = [] ) |
54 | 54 | { |
55 | - $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' )); |
|
55 | + $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) ); |
|
56 | 56 | $method = glsr( Helper::class )->buildMethodName( $action, 'router' ); |
57 | - if( is_callable( [$controller, $method] )) { |
|
57 | + if( is_callable( [$controller, $method] ) ) { |
|
58 | 58 | call_user_func( [$controller, $method], $request ); |
59 | 59 | return; |
60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function routeWebhookRequest() |
72 | 72 | { |
73 | - $request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID )); |
|
73 | + $request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ) ); |
|
74 | 74 | if( !$request )return; |
75 | 75 | // @todo manage webhook here |
76 | 76 | } |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | protected function normalizeAjaxRequest() |
110 | 110 | { |
111 | 111 | $request = filter_input( INPUT_POST, 'request', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
112 | - if( isset( $request[Application::ID]['action'] )) { |
|
112 | + if( isset($request[Application::ID]['action']) ) { |
|
113 | 113 | $request = $request[Application::ID]; |
114 | 114 | } |
115 | - if( !isset( $request['action'] )) { |
|
115 | + if( !isset($request['action']) ) { |
|
116 | 116 | glsr_log()->error( 'The AJAX request must include an action' )->info( $request ); |
117 | 117 | wp_die(); |
118 | 118 | } |
119 | - if( !isset( $request['nonce'] )) { |
|
119 | + if( !isset($request['nonce']) ) { |
|
120 | 120 | glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request ); |
121 | 121 | wp_die(); |
122 | 122 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function all() |
25 | 25 | { |
26 | 26 | $options = get_option( static::databaseKey(), [] ); |
27 | - if( !is_array( $options )) { |
|
27 | + if( !is_array( $options ) ) { |
|
28 | 28 | delete_option( static::databaseKey() ); |
29 | 29 | $options = ['settings' => []]; |
30 | 30 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | $options = $this->all(); |
43 | 43 | $pointer = &$options; |
44 | 44 | foreach( $keys as $key ) { |
45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
45 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
46 | 46 | $pointer = &$pointer[$key]; |
47 | 47 | } |
48 | - unset( $pointer[$last] ); |
|
48 | + unset($pointer[$last]); |
|
49 | 49 | return $this->set( $options ); |
50 | 50 | } |
51 | 51 | |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | glsr( DefaultsManager::class )->defaults() |
78 | 78 | ); |
79 | 79 | array_walk( $options, function( &$value ) { |
80 | - if( !is_string( $value ))return; |
|
81 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
80 | + if( !is_string( $value ) )return; |
|
81 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
82 | 82 | }); |
83 | 83 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function set( $pathOrOptions, $value = '' ) |
92 | 92 | { |
93 | - if( is_string( $pathOrOptions )) { |
|
93 | + if( is_string( $pathOrOptions ) ) { |
|
94 | 94 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
95 | 95 | } |
96 | 96 | return update_option( static::databaseKey(), (array)$pathOrOptions ); |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | $options = $this->all(); |
43 | 43 | $pointer = &$options; |
44 | 44 | foreach( $keys as $key ) { |
45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
45 | + if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) { |
|
46 | + continue; |
|
47 | + } |
|
46 | 48 | $pointer = &$pointer[$key]; |
47 | 49 | } |
48 | 50 | unset( $pointer[$last] ); |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | glsr( DefaultsManager::class )->defaults() |
78 | 80 | ); |
79 | 81 | array_walk( $options, function( &$value ) { |
80 | - if( !is_string( $value ))return; |
|
82 | + if( !is_string( $value )) { |
|
83 | + return; |
|
84 | + } |
|
81 | 85 | $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
82 | 86 | }); |
83 | 87 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function buildClassName( $name, $path = '' ) |
16 | 16 | { |
17 | - $className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name )); |
|
17 | + $className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name ) ); |
|
18 | 18 | $className = array_map( 'ucfirst', $className ); |
19 | 19 | $className = implode( '', $className ); |
20 | 20 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); |
21 | - return !empty( $path ) |
|
21 | + return !empty($path) |
|
22 | 22 | ? __NAMESPACE__.'\\'.$path.'\\'.$className |
23 | 23 | : $className; |
24 | 24 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function buildMethodName( $name, $prefix = '' ) |
32 | 32 | { |
33 | - return lcfirst( $prefix.$this->buildClassName( $name )); |
|
33 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function buildPropertyName( $name ) |
41 | 41 | { |
42 | - return lcfirst( $this->buildClassName( $name )); |
|
42 | + return lcfirst( $this->buildClassName( $name ) ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $levels = explode( '.', $path ); |
83 | 83 | return array_reduce( $levels, function( $result, $value ) { |
84 | - return $result.= '['.$value.']'; |
|
84 | + return $result .= '['.$value.']'; |
|
85 | 85 | }, $prefix ); |
86 | 86 | } |
87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function dashCase( $string ) |
93 | 93 | { |
94 | - return str_replace( '_', '-', $this->snakeCase( $string )); |
|
94 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | $result = []; |
118 | 118 | foreach( $array as $key => $value ) { |
119 | 119 | $newKey = ltrim( $prefix.'.'.$key, '.' ); |
120 | - if( $this->isIndexedFlatArray( $value )) { |
|
120 | + if( $this->isIndexedFlatArray( $value ) ) { |
|
121 | 121 | if( $flattenValue ) { |
122 | 122 | $value = '['.implode( ', ', $value ).']'; |
123 | 123 | } |
124 | 124 | } |
125 | - else if( is_array( $value )) { |
|
126 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); |
|
125 | + else if( is_array( $value ) ) { |
|
126 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | $result[$newKey] = $value; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | Whip::IPV4 => $cloudflareIps['v4'], |
143 | 143 | Whip::IPV6 => $cloudflareIps['v6'], |
144 | 144 | ], |
145 | - ]))->getValidIpAddress(); |
|
145 | + ] ))->getValidIpAddress(); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $keys = explode( '.', $path ); |
157 | 157 | foreach( $keys as $key ) { |
158 | - if( !isset( $values[$key] )) { |
|
158 | + if( !isset($values[$key]) ) { |
|
159 | 159 | return $fallback; |
160 | 160 | } |
161 | 161 | $values = $values[$key]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function isIndexedArray( $array ) |
171 | 171 | { |
172 | - if( !is_array( $array )) { |
|
172 | + if( !is_array( $array ) ) { |
|
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | $current = 0; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function isIndexedFlatArray( $array ) |
190 | 190 | { |
191 | - if( !is_array( $array ) || array_filter( $array, 'is_array' )) { |
|
191 | + if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | return $this->isIndexedArray( $array ); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function prefixString( $string, $prefix = '' ) |
203 | 203 | { |
204 | - return $prefix.str_replace( $prefix, '', trim( $string )); |
|
204 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function snakeCase( $string ) |
249 | 249 | { |
250 | - if( !ctype_lower( $string )) { |
|
250 | + if( !ctype_lower( $string ) ) { |
|
251 | 251 | $string = preg_replace( '/\s+/u', '', $string ); |
252 | 252 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
253 | 253 | $string = mb_strtolower( $string, 'UTF-8' ); |
@@ -262,6 +262,6 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function startsWith( $needle, $haystack ) |
264 | 264 | { |
265 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
265 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
266 | 266 | } |
267 | 267 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
36 | 36 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
37 | - ]); |
|
37 | + ] ); |
|
38 | 38 | return $links; |
39 | 39 | } |
40 | 40 | |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | public function filterDashboardGlanceItems( array $items ) |
46 | 46 | { |
47 | 47 | $postCount = wp_count_posts( Application::POST_TYPE ); |
48 | - if( empty( $postCount->publish )) { |
|
48 | + if( empty($postCount->publish) ) { |
|
49 | 49 | return $items; |
50 | 50 | } |
51 | 51 | $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' ); |
52 | - $text = sprintf( $text, number_format_i18n( $postCount->publish )); |
|
52 | + $text = sprintf( $text, number_format_i18n( $postCount->publish ) ); |
|
53 | 53 | $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts ) |
54 | 54 | ? glsr( Builder::class )->a( $text, [ |
55 | 55 | 'class' => 'glsr-review-count', |
56 | 56 | 'href' => 'edit.php?post_type='.Application::POST_TYPE, |
57 | - ]) |
|
57 | + ] ) |
|
58 | 58 | : glsr( Builder::class )->span( $text, [ |
59 | 59 | 'class' => 'glsr-review-count', |
60 | - ]); |
|
60 | + ] ); |
|
61 | 61 | return $items; |
62 | 62 | } |
63 | 63 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function filterTinymcePlugins( array $plugins ) |
69 | 69 | { |
70 | 70 | if( user_can_richedit() |
71 | - && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) { |
|
71 | + && (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) { |
|
72 | 72 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
73 | 73 | } |
74 | 74 | return $plugins; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function registerPointers() |
82 | 82 | { |
83 | - $command = new RegisterPointers([[ |
|
83 | + $command = new RegisterPointers( [[ |
|
84 | 84 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
85 | 85 | 'id' => 'glsr-pointer-pinned', |
86 | 86 | 'position' => [ |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'screen' => Application::POST_TYPE, |
91 | 91 | 'target' => '#misc-pub-pinned', |
92 | 92 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
93 | - ]]); |
|
93 | + ]] ); |
|
94 | 94 | $this->execute( $command ); |
95 | 95 | } |
96 | 96 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function registerShortcodeButtons() |
102 | 102 | { |
103 | - $command = new RegisterShortcodeButtons([ |
|
103 | + $command = new RegisterShortcodeButtons( [ |
|
104 | 104 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
105 | 105 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
106 | 106 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
107 | - ]); |
|
107 | + ] ); |
|
108 | 108 | $this->execute( $command ); |
109 | 109 | } |
110 | 110 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if( !$this->isReviewEditable( $post ) )return; |
118 | 118 | glsr()->render( 'partials/editor/review', [ |
119 | 119 | 'post' => $post, |
120 | - ]); |
|
120 | + ] ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function renderReviewNotice( WP_Post $post ) |
128 | 128 | { |
129 | 129 | if( !$this->isReviewEditable( $post ) )return; |
130 | - glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
|
130 | + glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) ); |
|
131 | 131 | glsr()->render( 'partials/editor/notice' ); |
132 | 132 | } |
133 | 133 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | if( glsr_current_screen()->base != 'post' )return; |
141 | 141 | $shortcodes = []; |
142 | 142 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
143 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
143 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue; |
|
144 | 144 | $shortcodes[$shortcode] = $values; |
145 | 145 | } |
146 | - if( empty( $shortcodes ))return; |
|
146 | + if( empty($shortcodes) )return; |
|
147 | 147 | glsr()->render( 'partials/editor/tinymce', [ |
148 | 148 | 'shortcodes' => $shortcodes, |
149 | - ]); |
|
149 | + ] ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function routerClearLog() |
156 | 156 | { |
157 | 157 | glsr( Logger::class )->clear(); |
158 | - glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' )); |
|
158 | + glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | { |
190 | 190 | $file = $_FILES['import-file']; |
191 | 191 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
192 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
192 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
193 | 193 | } |
194 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
195 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
194 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
195 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
196 | 196 | } |
197 | 197 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
198 | - if( empty( $settings )) { |
|
199 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
198 | + if( empty($settings) ) { |
|
199 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
200 | 200 | } |
201 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
202 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
201 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
202 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
218 | 218 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
219 | 219 | ]; |
220 | - return !isset( $errors[$errorCode] ) |
|
220 | + return !isset($errors[$errorCode]) |
|
221 | 221 | ? __( 'Unknown upload error.', 'site-reviews' ) |
222 | 222 | : $errors[$errorCode]; |
223 | 223 | } |