@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | foreach( array_keys( $ipAddresses ) as $version ) { |
21 | 21 | $url = 'https://www.cloudflare.com/ips-'.$version; |
22 | 22 | $response = wp_remote_get( $url ); |
23 | - if( is_wp_error( $response )) { |
|
23 | + if( is_wp_error( $response ) ) { |
|
24 | 24 | glsr_log()->error( $response->get_error_message() ); |
25 | 25 | continue; |
26 | 26 | } |
27 | - if(( $statusCode = wp_remote_retrieve_response_code( $response )) != '200' ) { |
|
27 | + if( ($statusCode = wp_remote_retrieve_response_code( $response )) != '200' ) { |
|
28 | 28 | glsr_log()->error( 'Unable to connect to '.$url.' ['.$statusCode.']' ); |
29 | 29 | continue; |
30 | 30 | } |
31 | 31 | $ipAddresses[$version] = array_filter( |
32 | - (array)preg_split( '/\R/', wp_remote_retrieve_body( $response )) |
|
32 | + (array)preg_split( '/\R/', wp_remote_retrieve_body( $response ) ) |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if( $test === false ) { |
65 | 65 | $response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' ); |
66 | 66 | $test = !is_wp_error( $response ) |
67 | - && in_array( $response['response']['code'], range( 200, 299 )) |
|
67 | + && in_array( $response['response']['code'], range( 200, 299 ) ) |
|
68 | 68 | ? 'Works' |
69 | 69 | : 'Does not work'; |
70 | 70 | set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME ); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function __construct( array $values = [] ) |
16 | 16 | { |
17 | 17 | $this->values = $values; |
18 | - parent::__construct( $values, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
18 | + parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __toString() |
35 | 35 | { |
36 | - if( empty( $this->values ))return; |
|
36 | + if( empty($this->values) )return; |
|
37 | 37 | return glsr( Template::class )->build( 'templates/review', [ |
38 | 38 | 'context' => $this->values, |
39 | - ]); |
|
39 | + ] ); |
|
40 | 40 | } |
41 | 41 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $this->args = $args; |
30 | 30 | $this->max_num_pages = $maxPageCount; |
31 | 31 | $this->results = $reviews; |
32 | - parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
32 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function build( array $args = [] ) |
70 | 70 | { |
71 | - if( empty( $this->ID )) { |
|
71 | + if( empty($this->ID) ) { |
|
72 | 72 | return new ReviewHtml; |
73 | 73 | } |
74 | 74 | $partial = glsr( SiteReviewsPartial::class ); |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function offsetGet( $key ) |
94 | 94 | { |
95 | - if( property_exists( $this, $key )) { |
|
95 | + if( property_exists( $this, $key ) ) { |
|
96 | 96 | return $this->$key; |
97 | 97 | } |
98 | - if( array_key_exists( $key, (array)$this->custom )) { |
|
98 | + if( array_key_exists( $key, (array)$this->custom ) ) { |
|
99 | 99 | return $this->custom[$key]; |
100 | 100 | } |
101 | 101 | return null; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function offsetSet( $key, $value ) |
110 | 110 | { |
111 | - if( property_exists( $this, $key )) { |
|
111 | + if( property_exists( $this, $key ) ) { |
|
112 | 112 | $this->$key = $value; |
113 | 113 | return; |
114 | 114 | } |
115 | - if( !is_array( $this->custom )) { |
|
115 | + if( !is_array( $this->custom ) ) { |
|
116 | 116 | $this->custom = array_filter( (array)$this->custom ); |
117 | 117 | } |
118 | 118 | $this->custom[$key] = $value; |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | 'review_type' => 'local', |
158 | 158 | ]; |
159 | 159 | $meta = array_filter( |
160 | - array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))), |
|
160 | + array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ), |
|
161 | 161 | 'strlen' |
162 | 162 | ); |
163 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
163 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
164 | 164 | $this->modified = $this->isModified( $properties ); |
165 | 165 | array_walk( $properties, function( $value, $key ) { |
166 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
166 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
167 | 167 | $this->$key = maybe_unserialize( $value ); |
168 | 168 | }); |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | protected function setTermIds( WP_Post $post ) |
175 | 175 | { |
176 | 176 | $this->term_ids = []; |
177 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
177 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return; |
|
178 | 178 | foreach( $terms as $term ) { |
179 | 179 | $this->term_ids[] = $term->term_id; |
180 | 180 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function enqueueAssets() |
26 | 26 | { |
27 | - $command = new EnqueueAdminAssets([ |
|
27 | + $command = new EnqueueAdminAssets( [ |
|
28 | 28 | 'pointers' => [[ |
29 | 29 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
30 | 30 | 'id' => 'glsr-pointer-pinned', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'target' => '#misc-pub-pinned', |
37 | 37 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
38 | 38 | ]], |
39 | - ]); |
|
39 | + ] ); |
|
40 | 40 | $this->execute( $command ); |
41 | 41 | } |
42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
50 | 50 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
51 | - ]); |
|
51 | + ] ); |
|
52 | 52 | return $links; |
53 | 53 | } |
54 | 54 | |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | public function filterDashboardGlanceItems( $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 = glsr( Helper::class )->consolidateArray( $items ); |
69 | 69 | $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts ) |
70 | 70 | ? glsr( Builder::class )->a( $text, [ |
71 | 71 | 'class' => 'glsr-review-count', |
72 | 72 | 'href' => 'edit.php?post_type='.Application::POST_TYPE, |
73 | - ]) |
|
73 | + ] ) |
|
74 | 74 | : glsr( Builder::class )->span( $text, [ |
75 | 75 | 'class' => 'glsr-review-count', |
76 | - ]); |
|
76 | + ] ); |
|
77 | 77 | return $items; |
78 | 78 | } |
79 | 79 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function filterTinymcePlugins( $plugins ) |
86 | 86 | { |
87 | - if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) { |
|
87 | + if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) { |
|
88 | 88 | $plugins = glsr( Helper::class )->consolidateArray( $plugins ); |
89 | 89 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
90 | 90 | } |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function registerTinymcePopups() |
99 | 99 | { |
100 | - $command = new RegisterTinymcePopups([ |
|
100 | + $command = new RegisterTinymcePopups( [ |
|
101 | 101 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
102 | 102 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
103 | 103 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
104 | - ]); |
|
104 | + ] ); |
|
105 | 105 | $this->execute( $command ); |
106 | 106 | } |
107 | 107 | |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | public function renderTinymceButton( $editorId ) |
114 | 114 | { |
115 | 115 | $allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'], $editorId ); |
116 | - if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return; |
|
116 | + if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ) )return; |
|
117 | 117 | $shortcodes = []; |
118 | 118 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
119 | 119 | $shortcodes[$shortcode] = $values; |
120 | 120 | } |
121 | - if( empty( $shortcodes ))return; |
|
121 | + if( empty($shortcodes) )return; |
|
122 | 122 | glsr()->render( 'partials/editor/tinymce', [ |
123 | 123 | 'shortcodes' => $shortcodes, |
124 | - ]); |
|
124 | + ] ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | public function routerClearConsole() |
131 | 131 | { |
132 | 132 | glsr( Console::class )->clear(); |
133 | - glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' )); |
|
133 | + glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function routerFetchConsole() |
140 | 140 | { |
141 | - glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' )); |
|
141 | + glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | } |
158 | 158 | $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' ); |
159 | 159 | foreach( $postIds as $postId ) { |
160 | - $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId )); |
|
160 | + $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) ); |
|
161 | 161 | } |
162 | 162 | $countManager->setCounts( $countManager->buildCounts() ); |
163 | 163 | if( $showNotice ) { |
164 | - glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
164 | + glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
165 | 165 | } |
166 | - glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' )); |
|
166 | + glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ) ); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | { |
198 | 198 | $file = $_FILES['import-file']; |
199 | 199 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
200 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
200 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
201 | 201 | } |
202 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
203 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
202 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
203 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
204 | 204 | } |
205 | 205 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
206 | - if( empty( $settings )) { |
|
207 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
206 | + if( empty($settings) ) { |
|
207 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
208 | 208 | } |
209 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
210 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
209 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
210 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
226 | 226 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
227 | 227 | ]; |
228 | - return !isset( $errors[$errorCode] ) |
|
228 | + return !isset($errors[$errorCode]) |
|
229 | 229 | ? __( 'Unknown upload error.', 'site-reviews' ) |
230 | 230 | : $errors[$errorCode]; |
231 | 231 | } |
@@ -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 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function routerSubmitReview( array $request ) |
121 | 121 | { |
122 | 122 | $command = glsr( PublicController::class )->routerSubmitReview( $request ); |
123 | - $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
123 | + $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
124 | 124 | $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command ); |
125 | 125 | $data = [ |
126 | 126 | 'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ), |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function routerTogglePinned( array $request ) |
142 | 142 | { |
143 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
144 | - wp_send_json_success([ |
|
143 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
144 | + wp_send_json_success( [ |
|
145 | 145 | 'notices' => glsr( Notice::class )->get(), |
146 | 146 | 'pinned' => $isPinned, |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | public function filterEnqueuedScripts( $tag, $handle ) |
34 | 34 | { |
35 | 35 | $scripts = [Application::ID.'/google-recaptcha']; |
36 | - if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) { |
|
36 | + if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) { |
|
37 | 37 | $tag = str_replace( ' src=', ' async src=', $tag ); |
38 | 38 | } |
39 | - if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) { |
|
39 | + if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) { |
|
40 | 40 | $tag = str_replace( ' src=', ' defer src=', $tag ); |
41 | 41 | } |
42 | 42 | return $tag; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function filterFieldOrder( array $config ) |
51 | 51 | { |
52 | - $order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config )); |
|
52 | + $order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) ); |
|
53 | 53 | return array_intersect_key( array_merge( array_flip( $order ), $config ), $config ); |
54 | 54 | } |
55 | 55 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | $validated = glsr( ValidateReview::class )->validate( $request ); |
102 | 102 | $command = new CreateReview( $validated->request ); |
103 | - if( empty( $validated->error ) && !$validated->recaptchaIsUnset ) { |
|
103 | + if( empty($validated->error) && !$validated->recaptchaIsUnset ) { |
|
104 | 104 | $this->execute( $command ); |
105 | 105 | } |
106 | 106 | return $command; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
18 | 18 | if( !$review ) { |
19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
21 | 21 | return; |
22 | 22 | } |
23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | if( $command->ajax_request )return; |
26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function getReferer( Command $command ) |
34 | 34 | { |
35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
36 | 36 | $referer = apply_filters( 'site-reviews/review/redirect', $referer, $command ); |
37 | - if( empty( $referer )) { |
|
37 | + if( empty($referer) ) { |
|
38 | 38 | $referer = $command->referer; |
39 | 39 | } |
40 | - if( empty( $referer )) { |
|
40 | + if( empty($referer) ) { |
|
41 | 41 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
42 | 42 | $referer = home_url(); |
43 | 43 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'setting' => 'Plugin Settings', |
41 | 41 | 'reviews' => 'Review Counts', |
42 | 42 | ]; |
43 | - $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) { |
|
43 | + $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) { |
|
44 | 44 | $methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' ); |
45 | 45 | if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) { |
46 | 46 | return $carry.$this->implode( |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | { |
61 | 61 | $plugins = get_plugins(); |
62 | 62 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
63 | - $inactive = array_diff_key( $plugins, array_flip( $activePlugins )); |
|
64 | - return $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
63 | + $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) ); |
|
64 | + return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function getInactivePluginDetails() |
96 | 96 | { |
97 | 97 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
98 | - return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ))); |
|
98 | + return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | { |
106 | 106 | $plugins = array_merge( |
107 | 107 | get_mu_plugins(), |
108 | - get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
|
108 | + get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) ) |
|
109 | 109 | ); |
110 | - if( empty( $plugins ))return; |
|
110 | + if( empty($plugins) )return; |
|
111 | 111 | return $this->normalizePluginList( $plugins ); |
112 | 112 | } |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getMultisitePluginDetails() |
118 | 118 | { |
119 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
119 | + if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return; |
|
120 | 120 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
121 | 121 | } |
122 | 122 | |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | 'Memory Limit' => ini_get( 'memory_limit' ), |
145 | 145 | 'Post Max Size' => ini_get( 'post_max_size' ), |
146 | 146 | 'Sendmail Path' => ini_get( 'sendmail_path' ), |
147 | - 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )), |
|
148 | - 'Session Name' => esc_html( ini_get( 'session.name' )), |
|
149 | - 'Session Save Path' => esc_html( ini_get( 'session.save_path' )), |
|
150 | - 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ), |
|
151 | - 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ), |
|
147 | + 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ), |
|
148 | + 'Session Name' => esc_html( ini_get( 'session.name' ) ), |
|
149 | + 'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ), |
|
150 | + 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ), |
|
151 | + 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ), |
|
152 | 152 | 'Upload Max Filesize' => ini_get( 'upload_max_filesize' ), |
153 | 153 | ]; |
154 | 154 | } |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | { |
161 | 161 | $counts = glsr( CountsManager::class )->getCounts(); |
162 | 162 | $counts = glsr( Helper::class )->flattenArray( $counts ); |
163 | - array_walk( $counts, function( &$ratings ) use( $counts ) { |
|
164 | - if( !is_array( $ratings )) { |
|
163 | + array_walk( $counts, function( &$ratings ) use($counts) { |
|
164 | + if( !is_array( $ratings ) ) { |
|
165 | 165 | glsr_log() |
166 | 166 | ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' ) |
167 | 167 | ->debug( $ratings ) |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | ksort( $settings ); |
201 | 201 | $details = []; |
202 | 202 | foreach( $settings as $key => $value ) { |
203 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
204 | - $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
|
203 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue; |
|
204 | + $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' ); |
|
205 | 205 | $details[$key] = $value; |
206 | 206 | } |
207 | 207 | return $details; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | { |
215 | 215 | return [ |
216 | 216 | 'Console size' => glsr( Console::class )->humanSize( '0' ), |
217 | - 'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' )), |
|
217 | + 'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' ) ), |
|
218 | 218 | 'Version (current)' => glsr()->version, |
219 | 219 | 'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ), |
220 | 220 | ]; |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | 'WPE_APIKEY' => 'WP Engine', |
275 | 275 | ]; |
276 | 276 | foreach( $checks as $key => $value ) { |
277 | - if( !$this->isWebhostCheckValid( $key ))continue; |
|
277 | + if( !$this->isWebhostCheckValid( $key ) )continue; |
|
278 | 278 | return $value; |
279 | 279 | } |
280 | - return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] )); |
|
280 | + return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) ); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | { |
299 | 299 | $plugins = get_plugins(); |
300 | 300 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
301 | - $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ))); |
|
302 | - $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
301 | + $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) ); |
|
302 | + $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
303 | 303 | return $active + $inactive; |
304 | 304 | } |
305 | 305 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | protected function implode( $title, array $details ) |
311 | 311 | { |
312 | 312 | $strings = ['['.$title.']']; |
313 | - $padding = max( array_map( 'strlen', array_keys( $details )) ); |
|
313 | + $padding = max( array_map( 'strlen', array_keys( $details ) ) ); |
|
314 | 314 | $padding = max( [$padding, static::PAD] ); |
315 | 315 | foreach( $details as $key => $value ) { |
316 | 316 | $strings[] = is_string( $key ) |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | $keys = [ |
354 | 354 | 'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret', |
355 | 355 | ]; |
356 | - array_walk( $settings, function( &$value, $setting ) use( $keys ) { |
|
356 | + array_walk( $settings, function( &$value, $setting ) use($keys) { |
|
357 | 357 | foreach( $keys as $key ) { |
358 | - if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue; |
|
358 | + if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue; |
|
359 | 359 | $value = str_repeat( '•', 13 ); |
360 | 360 | return; |
361 | 361 | } |