@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function renderAssignedToMetabox( WP_Post $post ) |
| 121 | 121 | { |
| 122 | - if( !$this->isReviewPostType( $post ))return; |
|
| 122 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 123 | 123 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
| 124 | 124 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 125 | 125 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
| 126 | 126 | 'id' => $assignedTo, |
| 127 | 127 | 'template' => $this->buildAssignedToTemplate( $assignedTo, $post ), |
| 128 | - ]); |
|
| 128 | + ] ); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function renderDetailsMetaBox( WP_Post $post ) |
| 136 | 136 | { |
| 137 | - if( !$this->isReviewPostType( $post ))return; |
|
| 137 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 138 | 138 | $review = glsr( ReviewManager::class )->single( $post ); |
| 139 | 139 | glsr()->render( 'partials/editor/metabox-details', [ |
| 140 | 140 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
| 141 | 141 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
| 142 | - ]); |
|
| 142 | + ] ); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function renderPinnedInPublishMetaBox() |
| 150 | 150 | { |
| 151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 151 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
| 152 | 152 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
| 153 | 153 | 'context' => [ |
| 154 | 154 | 'no' => __( 'No', 'site-reviews' ), |
| 155 | 155 | 'yes' => __( 'Yes', 'site-reviews' ), |
| 156 | 156 | ], |
| 157 | - 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
| 158 | - ]); |
|
| 157 | + 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
| 158 | + ] ); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function renderResponseMetaBox( WP_Post $post ) |
| 166 | 166 | { |
| 167 | - if( !$this->isReviewPostType( $post ))return; |
|
| 167 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 168 | 168 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 169 | 169 | glsr()->render( 'partials/editor/metabox-response', [ |
| 170 | 170 | 'response' => get_post_meta( $post->ID, 'response', true ), |
| 171 | - ]); |
|
| 171 | + ] ); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 180 | 180 | { |
| 181 | - if( !$this->isReviewPostType( $post ))return; |
|
| 181 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 182 | 182 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 183 | 183 | 'post' => $post, |
| 184 | 184 | 'tax_name' => Application::TAXONOMY, |
| 185 | 185 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
| 186 | - ]); |
|
| 186 | + ] ); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function revertReview() |
| 195 | 195 | { |
| 196 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
| 196 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
| 197 | 197 | glsr( ReviewManager::class )->revert( $postId ); |
| 198 | 198 | $this->redirect( $postId, 52 ); |
| 199 | 199 | } |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
| 217 | 217 | { |
| 218 | 218 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
| 219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 219 | + if( !($assignedPost instanceof WP_Post) )return; |
|
| 220 | 220 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
| 221 | 221 | 'context' => [ |
| 222 | 222 | 'data.url' => (string)get_permalink( $assignedPost ), |
| 223 | 223 | 'data.title' => get_the_title( $assignedPost ), |
| 224 | 224 | ], |
| 225 | - ]); |
|
| 225 | + ] ); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | 'class' => 'button button-large', |
| 243 | 243 | 'href' => $revertUrl, |
| 244 | 244 | 'id' => 'revert', |
| 245 | - ]); |
|
| 245 | + ] ); |
|
| 246 | 246 | } |
| 247 | 247 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
| 248 | 248 | 'class' => 'button button-large', |
| 249 | 249 | 'disabled' => true, |
| 250 | 250 | 'id' => 'revert', |
| 251 | - ]); |
|
| 251 | + ] ); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
| 262 | 262 | ? glsr()->reviewTypes[$review->review_type] |
| 263 | 263 | : __( 'Unknown', 'site-reviews' ); |
| 264 | - if( !empty( $review->url )) { |
|
| 264 | + if( !empty($review->url) ) { |
|
| 265 | 265 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
| 266 | 266 | 'href' => $review->url, |
| 267 | 267 | 'target' => '_blank', |
| 268 | - ]); |
|
| 268 | + ] ); |
|
| 269 | 269 | } |
| 270 | 270 | return $reviewType; |
| 271 | 271 | } |
@@ -284,16 +284,16 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | protected function normalizeDetailsMetaBox( Review $review ) |
| 286 | 286 | { |
| 287 | - $user = empty( $review->user_id ) |
|
| 287 | + $user = empty($review->user_id) |
|
| 288 | 288 | ? __( 'Unregistered user', 'site-reviews' ) |
| 289 | 289 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
| 290 | 290 | 'href' => get_author_posts_url( $review->user_id ), |
| 291 | - ]); |
|
| 292 | - $email = empty( $review->email ) |
|
| 291 | + ] ); |
|
| 292 | + $email = empty($review->email) |
|
| 293 | 293 | ? '—' |
| 294 | 294 | : glsr( Builder::class )->a( $review->email, [ |
| 295 | 295 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
| 296 | - ]); |
|
| 296 | + ] ); |
|
| 297 | 297 | $metabox = [ |
| 298 | 298 | __( 'Rating', 'site-reviews' ) => glsr( Partial::class )->build( 'star-rating', ['rating' => $review->rating] ), |
| 299 | 299 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | __( 'IP Address', 'site-reviews' ) => $review->ip_address, |
| 305 | 305 | __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ), |
| 306 | 306 | ]; |
| 307 | - return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review )); |
|
| 307 | + return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) ); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $redirectUri = $hasReferer |
| 322 | 322 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
| 323 | 323 | : get_edit_post_link( $postId ); |
| 324 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
| 324 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
| 325 | 325 | exit; |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -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 | /** |
@@ -170,19 +170,19 @@ discard block |
||
| 170 | 170 | public function routerCountReviews() |
| 171 | 171 | { |
| 172 | 172 | $countManager = glsr( CountsManager::class ); |
| 173 | - $terms = get_terms([ |
|
| 173 | + $terms = get_terms( [ |
|
| 174 | 174 | 'hide_empty' => true, |
| 175 | 175 | 'taxonomy' => Application::TAXONOMY, |
| 176 | - ]); |
|
| 176 | + ] ); |
|
| 177 | 177 | foreach( $terms as $term ) { |
| 178 | - $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id )); |
|
| 178 | + $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) ); |
|
| 179 | 179 | } |
| 180 | 180 | $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' ); |
| 181 | 181 | foreach( $postIds as $postId ) { |
| 182 | - $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId )); |
|
| 182 | + $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) ); |
|
| 183 | 183 | } |
| 184 | 184 | $countManager->setCounts( $countManager->buildCounts() ); |
| 185 | - glsr( Notice::class )->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
| 185 | + glsr( Notice::class )->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -216,17 +216,17 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | $file = $_FILES['import-file']; |
| 218 | 218 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
| 219 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
| 219 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
| 220 | 220 | } |
| 221 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
| 222 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
| 221 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
| 222 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
| 223 | 223 | } |
| 224 | 224 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
| 225 | - if( empty( $settings )) { |
|
| 226 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
| 225 | + if( empty($settings) ) { |
|
| 226 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
| 227 | 227 | } |
| 228 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
| 229 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
| 228 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
| 229 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
| 245 | 245 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
| 246 | 246 | ]; |
| 247 | - return !isset( $errors[$errorCode] ) |
|
| 247 | + return !isset($errors[$errorCode]) |
|
| 248 | 248 | ? __( 'Unknown upload error.', 'site-reviews' ) |
| 249 | 249 | : $errors[$errorCode]; |
| 250 | 250 | } |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 28 | 'class' => 'pending-count', |
| 29 | - ]); |
|
| 29 | + ] ); |
|
| 30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
| 31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
| 32 | - ]); |
|
| 32 | + ] ); |
|
| 33 | 33 | $menu[$key][0] .= ' '.$awaitingModeration; |
| 34 | 34 | if( $typenow === Application::POST_TYPE ) { |
| 35 | - $menu[$key][4].= ' current'; |
|
| 35 | + $menu[$key][4] .= ' current'; |
|
| 36 | 36 | } |
| 37 | 37 | break; |
| 38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 50 | 50 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 51 | 51 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
| 52 | - ]); |
|
| 52 | + ] ); |
|
| 53 | 53 | foreach( $pages as $slug => $title ) { |
| 54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 56 | + if( !is_callable( $callback ) )continue; |
|
| 57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $this->renderPage( 'addons', [ |
| 69 | 69 | 'template' => glsr( Template::class ), |
| 70 | - ]); |
|
| 70 | + ] ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
| 84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | $this->renderPage( 'documentation', [ |
| 88 | 88 | 'tabs' => $tabs, |
| 89 | - ]); |
|
| 89 | + ] ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -104,18 +104,18 @@ discard block |
||
| 104 | 104 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 105 | 105 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 106 | 106 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 107 | - ]); |
|
| 108 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
| 109 | - unset( $tabs['addons'] ); |
|
| 107 | + ] ); |
|
| 108 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
| 109 | + unset($tabs['addons']); |
|
| 110 | 110 | } |
| 111 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
| 112 | - unset( $tabs['licenses'] ); |
|
| 111 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
| 112 | + unset($tabs['licenses']); |
|
| 113 | 113 | } |
| 114 | 114 | $this->renderPage( 'settings', [ |
| 115 | 115 | 'notices' => $this->getNotices(), |
| 116 | 116 | 'settings' => glsr( Settings::class ), |
| 117 | 117 | 'tabs' => $tabs, |
| 118 | - ]); |
|
| 118 | + ] ); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -130,23 +130,23 @@ discard block |
||
| 130 | 130 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
| 131 | 131 | 'console' => __( 'Console', 'site-reviews' ), |
| 132 | 132 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 133 | - ]); |
|
| 134 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
| 135 | - unset( $tabs['sync'] ); |
|
| 133 | + ] ); |
|
| 134 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
| 135 | + unset($tabs['sync']); |
|
| 136 | 136 | } |
| 137 | 137 | $this->renderPage( 'tools', [ |
| 138 | 138 | 'data' => [ |
| 139 | 139 | 'context' => [ |
| 140 | - 'console' => strval( glsr( Console::class )), |
|
| 140 | + 'console' => strval( glsr( Console::class ) ), |
|
| 141 | 141 | 'id' => Application::ID, |
| 142 | - 'system' => strval( glsr( System::class )), |
|
| 142 | + 'system' => strval( glsr( System::class ) ), |
|
| 143 | 143 | ], |
| 144 | 144 | 'sites' => apply_filters( 'site-reviews/addon/sync/sites', [] ), |
| 145 | 145 | ], |
| 146 | 146 | 'notices' => $this->getNotices(), |
| 147 | 147 | 'tabs' => $tabs, |
| 148 | 148 | 'template' => glsr( Template::class ), |
| 149 | - ]); |
|
| 149 | + ] ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
| 169 | 169 | 'id' => 'glsr-notices', |
| 170 | - ]); |
|
| 170 | + ] ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function renderTaxonomyFilter() |
| 37 | 37 | { |
| 38 | - if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return; |
|
| 38 | + if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ) )return; |
|
| 39 | 39 | echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [ |
| 40 | 40 | 'class' => 'screen-reader-text', |
| 41 | 41 | 'for' => Application::TAXONOMY, |
| 42 | - ]); |
|
| 43 | - wp_dropdown_categories([ |
|
| 42 | + ] ); |
|
| 43 | + wp_dropdown_categories( [ |
|
| 44 | 44 | 'depth' => 3, |
| 45 | 45 | 'hide_empty' => true, |
| 46 | 46 | 'hide_if_empty' => true, |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'show_option_all' => $this->getShowOptionAll(), |
| 53 | 53 | 'taxonomy' => Application::TAXONOMY, |
| 54 | 54 | 'value_field' => 'slug', |
| 55 | - ]); |
|
| 55 | + ] ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | protected function getSelected() |
| 62 | 62 | { |
| 63 | 63 | global $wp_query; |
| 64 | - return isset( $wp_query->query[Application::TAXONOMY] ) |
|
| 64 | + return isset($wp_query->query[Application::TAXONOMY]) |
|
| 65 | 65 | ? $wp_query->query[Application::TAXONOMY] |
| 66 | 66 | : ''; |
| 67 | 67 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $taxonomy = get_taxonomy( Application::TAXONOMY ); |
| 75 | 75 | return $taxonomy |
| 76 | - ? ucfirst( strtolower( $taxonomy->labels->all_items )) |
|
| 76 | + ? ucfirst( strtolower( $taxonomy->labels->all_items ) ) |
|
| 77 | 77 | : ''; |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) { |
| 23 | 23 | $column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [ |
| 24 | 24 | 'href' => (string)get_the_permalink( $assignedPost->ID ), |
| 25 | - ]); |
|
| 25 | + ] ); |
|
| 26 | 26 | } |
| 27 | 27 | return $column; |
| 28 | 28 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | $pinned = get_post_meta( $postId, 'pinned', true ) |
| 37 | 37 | ? 'pinned ' |
| 38 | 38 | : ''; |
| 39 | - return glsr( Builder::class )->i([ |
|
| 39 | + return glsr( Builder::class )->i( [ |
|
| 40 | 40 | 'class' => $pinned.'dashicons dashicons-sticky', |
| 41 | 41 | 'data-id' => $postId, |
| 42 | - ]); |
|
| 42 | + ] ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function buildColumnReviewer( $postId ) |
| 50 | 50 | { |
| 51 | - return strval( get_post_meta( $postId, 'author', true )); |
|
| 51 | + return strval( get_post_meta( $postId, 'author', true ) ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | public function buildColumnRating( $postId ) |
| 60 | 60 | { |
| 61 | 61 | return glsr( Partial::class )->build( 'star-rating', [ |
| 62 | - 'rating' => intval( get_post_meta( $postId, 'rating', true )), |
|
| 63 | - ]); |
|
| 62 | + 'rating' => intval( get_post_meta( $postId, 'rating', true ) ), |
|
| 63 | + ] ); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function renderFilters( $postType ) |
| 83 | 83 | { |
| 84 | 84 | if( $postType !== Application::POST_TYPE )return; |
| 85 | - if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
|
| 85 | + if( !($status = filter_input( INPUT_GET, 'post_status' )) ) { |
|
| 86 | 86 | $status = 'publish'; |
| 87 | 87 | } |
| 88 | 88 | $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status ); |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function renderFilterRatings( $ratings ) |
| 113 | 113 | { |
| 114 | - if( empty( $ratings ))return; |
|
| 115 | - $ratings = array_flip( array_reverse( $ratings )); |
|
| 114 | + if( empty($ratings) )return; |
|
| 115 | + $ratings = array_flip( array_reverse( $ratings ) ); |
|
| 116 | 116 | array_walk( $ratings, function( &$value, $key ) { |
| 117 | 117 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
| 118 | 118 | $value = sprintf( $label, $key ); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [ |
| 121 | 121 | 'class' => 'screen-reader-text', |
| 122 | 122 | 'for' => 'rating', |
| 123 | - ]); |
|
| 124 | - echo glsr( Builder::class )->select([ |
|
| 123 | + ] ); |
|
| 124 | + echo glsr( Builder::class )->select( [ |
|
| 125 | 125 | 'name' => 'rating', |
| 126 | 126 | 'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings, |
| 127 | 127 | 'value' => filter_input( INPUT_GET, 'rating' ), |
| 128 | - ]); |
|
| 128 | + ] ); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
| 139 | 139 | 'class' => 'screen-reader-text', |
| 140 | 140 | 'for' => 'review_type', |
| 141 | - ]); |
|
| 142 | - echo glsr( Builder::class )->select([ |
|
| 141 | + ] ); |
|
| 142 | + echo glsr( Builder::class )->select( [ |
|
| 143 | 143 | 'name' => 'review_type', |
| 144 | 144 | 'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes, |
| 145 | 145 | 'value' => filter_input( INPUT_GET, 'review_type' ), |
| 146 | - ]); |
|
| 146 | + ] ); |
|
| 147 | 147 | } |
| 148 | 148 | } |
@@ -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( Template::class )->render( '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 | |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | protected function getTranslations() |
| 294 | 294 | { |
| 295 | 295 | static $translations; |
| 296 | - if( empty( $translations )) { |
|
| 296 | + if( empty($translations) ) { |
|
| 297 | 297 | $settings = glsr( OptionManager::class )->get( 'settings' ); |
| 298 | - $translations = isset( $settings['strings'] ) |
|
| 299 | - ? $this->normalizeSettings( (array) $settings['strings'] ) |
|
| 298 | + $translations = isset($settings['strings']) |
|
| 299 | + ? $this->normalizeSettings( (array)$settings['strings'] ) |
|
| 300 | 300 | : []; |
| 301 | 301 | } |
| 302 | 302 | return $translations; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected function getTranslationStrings( $single, $plural ) |
| 311 | 311 | { |
| 312 | - return array_filter( $this->getTranslations(), function( $string ) use( $single, $plural ) { |
|
| 312 | + return array_filter( $this->getTranslations(), function( $string ) use($single, $plural) { |
|
| 313 | 313 | return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' ) |
| 314 | 314 | && $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' ); |
| 315 | 315 | }); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $keys = [ |
| 324 | 324 | 'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]', |
| 325 | 325 | ]; |
| 326 | - array_walk( $entries, function( &$entry ) use( $keys ) { |
|
| 326 | + array_walk( $entries, function( &$entry ) use($keys) { |
|
| 327 | 327 | foreach( $keys as $key ) { |
| 328 | 328 | $entry = $this->normalizeEntryString( $entry, $key ); |
| 329 | 329 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | protected function normalizeEntryString( array $entry, $key ) |
| 339 | 339 | { |
| 340 | - if( isset( $entry[$key] )) { |
|
| 340 | + if( isset($entry[$key]) ) { |
|
| 341 | 341 | $entry[$key] = $this->getEntryString( $entry, $key ); |
| 342 | 342 | } |
| 343 | 343 | return $entry; |
@@ -351,11 +351,11 @@ discard block |
||
| 351 | 351 | $defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' ); |
| 352 | 352 | $strings = array_filter( $strings, 'is_array' ); |
| 353 | 353 | foreach( $strings as &$string ) { |
| 354 | - $string['type'] = isset( $string['p1'] ) ? 'plural' : 'single'; |
|
| 354 | + $string['type'] = isset($string['p1']) ? 'plural' : 'single'; |
|
| 355 | 355 | $string = wp_parse_args( $string, $defaultString ); |
| 356 | 356 | } |
| 357 | 357 | return array_filter( $strings, function( $string ) { |
| 358 | - return !empty( $string['id'] ); |
|
| 358 | + return !empty($string['id']); |
|
| 359 | 359 | }); |
| 360 | 360 | } |
| 361 | 361 | |
@@ -379,10 +379,10 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | protected function translatePlural( $domain, array $string, array $args ) |
| 381 | 381 | { |
| 382 | - if( !empty( $string['s2'] )) { |
|
| 382 | + if( !empty($string['s2']) ) { |
|
| 383 | 383 | $args['single'] = $string['s2']; |
| 384 | 384 | } |
| 385 | - if( !empty( $string['p2'] )) { |
|
| 385 | + if( !empty($string['p2']) ) { |
|
| 386 | 386 | $args['plural'] = $string['p2']; |
| 387 | 387 | } |
| 388 | 388 | return get_translations_for_domain( $domain )->translate_plural( |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | protected function translateSingle( $domain, array $string, array $args ) |
| 401 | 401 | { |
| 402 | - if( !empty( $string['s2'] )) { |
|
| 402 | + if( !empty($string['s2']) ) { |
|
| 403 | 403 | $args['single'] = $string['s2']; |
| 404 | 404 | } |
| 405 | 405 | return get_translations_for_domain( $domain )->translate( |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | 'after_widget' => '</div>', |
| 23 | 23 | 'before_title' => '<h3 class="glsr-shortcode-title">', |
| 24 | 24 | 'after_title' => '</h3>', |
| 25 | - ]); |
|
| 25 | + ] ); |
|
| 26 | 26 | $instance = $this->normalize( $instance ); |
| 27 | 27 | $partial = glsr( Partial::class )->build( $shortcodePartial, $instance ); |
| 28 | - if( !empty( $instance['title'] )) { |
|
| 28 | + if( !empty($instance['title']) ) { |
|
| 29 | 29 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; |
| 30 | 30 | } |
| 31 | 31 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function normalize( $args ) |
| 70 | 70 | { |
| 71 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
|
| 71 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); |
|
| 72 | 72 | array_walk( $args, function( &$value, $key ) { |
| 73 | 73 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 74 | - if( !method_exists( $this, $methodName ))return; |
|
| 74 | + if( !method_exists( $this, $methodName ) )return; |
|
| 75 | 75 | $value = $this->$methodName( $value ); |
| 76 | 76 | }); |
| 77 | 77 | return $this->sanitize( $args ); |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function normalizeHide( $hide ) |
| 105 | 105 | { |
| 106 | - if( is_string( $hide )) { |
|
| 106 | + if( is_string( $hide ) ) { |
|
| 107 | 107 | $hide = explode( ',', $hide ); |
| 108 | 108 | } |
| 109 | 109 | $hiddenKeys = defined( 'static::HIDDEN_KEYS' ) |
| 110 | 110 | ? static::HIDDEN_KEYS |
| 111 | 111 | : []; |
| 112 | - return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hiddenKeys ) { |
|
| 112 | + return array_filter( array_map( 'trim', $hide ), function( $value ) use($hiddenKeys) { |
|
| 113 | 113 | return in_array( $value, $hiddenKeys ); |
| 114 | 114 | }); |
| 115 | 115 | } |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | __( 'Terrible', 'site-reviews' ), |
| 138 | 138 | ]; |
| 139 | 139 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
| 140 | - $labels = array_map( 'trim', explode( ',', $labels )); |
|
| 140 | + $labels = array_map( 'trim', explode( ',', $labels ) ); |
|
| 141 | 141 | foreach( $defaults as $i => $label ) { |
| 142 | - if( empty( $labels[$i] ))continue; |
|
| 142 | + if( empty($labels[$i]) )continue; |
|
| 143 | 143 | $defaults[$i] = $labels[$i]; |
| 144 | 144 | } |
| 145 | 145 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |