@@ -13,7 +13,7 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $defaults = wp_parse_args( $this->defaults(), [ |
| 15 | 15 | 'name' => $this->builder->args['text'], |
| 16 | - ]); |
|
| 16 | + ] ); |
|
| 17 | 17 | $this->builder->args = wp_parse_args( $this->builder->args, $defaults ); |
| 18 | 18 | $this->builder->tag = 'input'; |
| 19 | 19 | return $this->builder->getOpeningTag(); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | 'name' => 'tripadvisor', |
| 13 | 13 | 'title' => 'Tripadvisor Reviews', |
| 14 | 14 | ], |
| 15 | - ]); |
|
| 15 | + ] ); |
|
| 16 | 16 | $template->render( 'partials/addons/addon', [ |
| 17 | 17 | 'context' => [ |
| 18 | 18 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'name' => 'yelp', |
| 21 | 21 | 'title' => 'Yelp Reviews', |
| 22 | 22 | ], |
| 23 | - ]); |
|
| 23 | + ] ); |
|
| 24 | 24 | ?> |
| 25 | 25 | </div> |
| 26 | 26 | </div> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | <p>{{ data.s1 }}</p> |
| 4 | 4 | <p>{{ data.p1 }}</p> |
| 5 | 5 | <p class="row-actions"> |
| 6 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 6 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 7 | 7 | </p> |
| 8 | 8 | <button type="button" class="toggle-row"> |
| 9 | 9 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | <td class="glsr-string-td1 column-primary"> |
| 3 | 3 | <p>{{ data.s1 }}</p> |
| 4 | 4 | <p class="row-actions"> |
| 5 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 5 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 6 | 6 | </p> |
| 7 | 7 | <button type="button" class="toggle-row"> |
| 8 | 8 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | </ul> |
| 21 | 21 | </div> |
| 22 | 22 | |
| 23 | - <?php if( current_user_can( $taxonomy->cap->edit_terms )) : ?> |
|
| 23 | + <?php if( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
|
| 24 | 24 | <div id="<?= $tax_name; ?>-adder" class="wp-hidden-children"> |
| 25 | 25 | <a id="<?= $tax_name; ?>-add-toggle" href="#<?= $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
| 26 | 26 | <?= sprintf( '+ %s', $taxonomy->labels->add_new_item ); ?> |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | <label class="screen-reader-text" for="new<?= $tax_name; ?>"><?= $taxonomy->labels->add_new_item; ?></label> |
| 30 | 30 | <input type="text" name="new<?= $tax_name; ?>" id="new<?= $tax_name; ?>" class="form-required form-input-tip" value="<?= esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
| 31 | 31 | <input type="button" id="<?= $tax_name; ?>-add-submit" data-wp-lists="add:<?= $tax_name; ?>checklist:<?= $tax_name; ?>-add" class="button category-add-submit" value="<?= esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
| 32 | - <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
| 32 | + <?php wp_nonce_field( 'add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false ); ?> |
|
| 33 | 33 | <span id="<?= $tax_name; ?>-ajax-response"></span> |
| 34 | 34 | </div> |
| 35 | 35 | </div> |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | <html> |
| 5 | 5 | <head> |
| 6 | 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 7 | - <title><?= wp_specialchars_decode( (string) get_option( 'blogname', '' ), ENT_QUOTES ); ?></title> |
|
| 7 | + <title><?= wp_specialchars_decode( (string)get_option( 'blogname', '' ), ENT_QUOTES ); ?></title> |
|
| 8 | 8 | </head> |
| 9 | 9 | <body> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php defined( 'WPINC' ) || die; |
| 2 | 2 | |
| 3 | -include trailingslashit(__DIR__).'header.php'; |
|
| 4 | -include trailingslashit(__DIR__).'body.php'; |
|
| 5 | -include trailingslashit(__DIR__).'footer.php'; |
|
| 3 | +include trailingslashit( __DIR__ ).'header.php'; |
|
| 4 | +include trailingslashit( __DIR__ ).'body.php'; |
|
| 5 | +include trailingslashit( __DIR__ ).'footer.php'; |
|
@@ -109,7 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function renderReviewEditor( WP_Post $post ) |
| 111 | 111 | { |
| 112 | - if( !$this->isReviewEditable( $post ) )return; |
|
| 112 | + if( !$this->isReviewEditable( $post ) ) { |
|
| 113 | + return; |
|
| 114 | + } |
|
| 113 | 115 | glsr()->render( 'partials/editor/review', [ |
| 114 | 116 | 'post' => $post, |
| 115 | 117 | ]); |
@@ -121,7 +123,9 @@ discard block |
||
| 121 | 123 | */ |
| 122 | 124 | public function renderReviewNotice( WP_Post $post ) |
| 123 | 125 | { |
| 124 | - if( !$this->isReviewEditable( $post ) )return; |
|
| 126 | + if( !$this->isReviewEditable( $post ) ) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
| 126 | 130 | glsr()->render( 'partials/editor/notice' ); |
| 127 | 131 | } |
@@ -132,13 +136,19 @@ discard block |
||
| 132 | 136 | */ |
| 133 | 137 | public function renderTinymceButton() |
| 134 | 138 | { |
| 135 | - if( glsr_current_screen()->base != 'post' )return; |
|
| 139 | + if( glsr_current_screen()->base != 'post' ) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 136 | 142 | $shortcodes = []; |
| 137 | 143 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
| 138 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
| 144 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) { |
|
| 145 | + continue; |
|
| 146 | + } |
|
| 139 | 147 | $shortcodes[$shortcode] = $values; |
| 140 | 148 | } |
| 141 | - if( empty( $shortcodes ))return; |
|
| 149 | + if( empty( $shortcodes )) { |
|
| 150 | + return; |
|
| 151 | + } |
|
| 142 | 152 | glsr()->render( 'partials/editor/tinymce', [ |
| 143 | 153 | 'shortcodes' => $shortcodes, |
| 144 | 154 | ]); |
@@ -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 | } |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function renderAssignedToMetabox( WP_Post $post ) |
| 149 | 149 | { |
| 150 | - if( !$this->isReviewPostType( $post ))return; |
|
| 151 | - $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true )); |
|
| 150 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 151 | + $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true ) ); |
|
| 152 | 152 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 153 | 153 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
| 154 | 154 | 'id' => $assignedTo, |
| 155 | 155 | 'template' => $this->buildAssignedToTemplate( $assignedTo ), |
| 156 | - ]); |
|
| 156 | + ] ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function renderDetailsMetaBox( WP_Post $post ) |
| 164 | 164 | { |
| 165 | - if( !$this->isReviewPostType( $post ))return; |
|
| 165 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 166 | 166 | $review = glsr( Database::class )->getReview( $post ); |
| 167 | 167 | glsr()->render( 'partials/editor/metabox-details', [ |
| 168 | 168 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
| 169 | 169 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
| 170 | - ]); |
|
| 170 | + ] ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function renderPinnedInPublishMetaBox() |
| 178 | 178 | { |
| 179 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 179 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
| 180 | 180 | glsr()->render( 'partials/editor/pinned', [ |
| 181 | - 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
| 182 | - ]); |
|
| 181 | + 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
| 182 | + ] ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function renderResponseMetaBox( WP_Post $post ) |
| 190 | 190 | { |
| 191 | - if( !$this->isReviewPostType( $post ))return; |
|
| 191 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 192 | 192 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 193 | 193 | glsr()->render( 'partials/editor/metabox-response', [ |
| 194 | 194 | 'response' => glsr( Database::class )->getReview( $post )->response, |
| 195 | - ]); |
|
| 195 | + ] ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 204 | 204 | { |
| 205 | - if( !$this->isReviewPostType( $post ))return; |
|
| 205 | + if( !$this->isReviewPostType( $post ) )return; |
|
| 206 | 206 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 207 | 207 | 'post' => $post, |
| 208 | 208 | 'tax_name' => Application::TAXONOMY, |
| 209 | 209 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
| 210 | - ]); |
|
| 210 | + ] ); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function revertReview() |
| 219 | 219 | { |
| 220 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
| 220 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
| 221 | 221 | glsr( Database::class )->revertReview( $postId ); |
| 222 | 222 | $this->redirect( $postId, 52 ); |
| 223 | 223 | } |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | protected function buildAssignedToTemplate( $assignedTo ) |
| 241 | 241 | { |
| 242 | 242 | $assignedPost = get_post( $assignedTo ); |
| 243 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 243 | + if( !($assignedPost instanceof WP_Post) )return; |
|
| 244 | 244 | return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [ |
| 245 | 245 | 'context' => [ |
| 246 | 246 | 'url' => (string)get_permalink( $assignedPost ), |
| 247 | 247 | 'title' => get_the_title( $assignedPost ), |
| 248 | 248 | ], |
| 249 | - ]); |
|
| 249 | + ] ); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -267,13 +267,13 @@ discard block |
||
| 267 | 267 | 'class' => 'button button-large', |
| 268 | 268 | 'href' => $revertUrl, |
| 269 | 269 | 'id' => 'revert', |
| 270 | - ]); |
|
| 270 | + ] ); |
|
| 271 | 271 | } |
| 272 | 272 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
| 273 | 273 | 'class' => 'button button-large', |
| 274 | 274 | 'disabled' => true, |
| 275 | 275 | 'id' => 'revert', |
| 276 | - ]); |
|
| 276 | + ] ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | protected function getReviewType( $review ) |
| 284 | 284 | { |
| 285 | 285 | $reviewType = $review->review_type; |
| 286 | - if( !empty( $review->url )) { |
|
| 286 | + if( !empty($review->url) ) { |
|
| 287 | 287 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
| 288 | 288 | 'href' => $review->url, |
| 289 | 289 | 'target' => '_blank', |
| 290 | - ]); |
|
| 290 | + ] ); |
|
| 291 | 291 | } |
| 292 | 292 | return in_array( $reviewType, glsr()->reviewTypes ) |
| 293 | 293 | ? glsr()->reviewTypes[$reviewType] |
@@ -309,16 +309,16 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected function normalizeDetailsMetaBox( $review ) |
| 311 | 311 | { |
| 312 | - $reviewer = empty( $review->user_id ) |
|
| 312 | + $reviewer = empty($review->user_id) |
|
| 313 | 313 | ? __( 'Unregistered user', 'site-reviews' ) |
| 314 | 314 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
| 315 | 315 | 'href' => get_author_posts_url( $review->user_id ), |
| 316 | - ]); |
|
| 317 | - $email = empty( $review->email ) |
|
| 316 | + ] ); |
|
| 317 | + $email = empty($review->email) |
|
| 318 | 318 | ? '—' |
| 319 | 319 | : glsr( Builder::class )->a( $review->email, [ |
| 320 | 320 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
| 321 | - ]); |
|
| 321 | + ] ); |
|
| 322 | 322 | $metabox = [ |
| 323 | 323 | __( 'Rating', 'site-reviews' ) => glsr( Html::class )->renderPartial( 'star-rating', ['rating' => $review->rating] ), |
| 324 | 324 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $redirectUri = $hasReferer |
| 347 | 347 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
| 348 | 348 | : get_edit_post_link( $postId ); |
| 349 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
| 349 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
| 350 | 350 | exit; |
| 351 | 351 | } |
| 352 | 352 | } |
@@ -117,7 +117,9 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function registerMetaBoxes( $postType ) |
| 119 | 119 | { |
| 120 | - if( $postType != Application::POST_TYPE )return; |
|
| 120 | + if( $postType != Application::POST_TYPE ) { |
|
| 121 | + return; |
|
| 122 | + } |
|
| 121 | 123 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
| 122 | 124 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
| 123 | 125 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -147,7 +149,9 @@ discard block |
||
| 147 | 149 | */ |
| 148 | 150 | public function renderAssignedToMetabox( WP_Post $post ) |
| 149 | 151 | { |
| 150 | - if( !$this->isReviewPostType( $post ))return; |
|
| 152 | + if( !$this->isReviewPostType( $post )) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 151 | 155 | $assignedTo = intval( get_post_meta( $post->ID, 'assigned_to', true )); |
| 152 | 156 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 153 | 157 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -162,7 +166,9 @@ discard block |
||
| 162 | 166 | */ |
| 163 | 167 | public function renderDetailsMetaBox( WP_Post $post ) |
| 164 | 168 | { |
| 165 | - if( !$this->isReviewPostType( $post ))return; |
|
| 169 | + if( !$this->isReviewPostType( $post )) { |
|
| 170 | + return; |
|
| 171 | + } |
|
| 166 | 172 | $review = glsr( Database::class )->getReview( $post ); |
| 167 | 173 | glsr()->render( 'partials/editor/metabox-details', [ |
| 168 | 174 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -176,7 +182,9 @@ discard block |
||
| 176 | 182 | */ |
| 177 | 183 | public function renderPinnedInPublishMetaBox() |
| 178 | 184 | { |
| 179 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 185 | + if( !$this->isReviewPostType( get_post() )) { |
|
| 186 | + return; |
|
| 187 | + } |
|
| 180 | 188 | glsr()->render( 'partials/editor/pinned', [ |
| 181 | 189 | 'pinned' => boolval( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
| 182 | 190 | ]); |
@@ -188,7 +196,9 @@ discard block |
||
| 188 | 196 | */ |
| 189 | 197 | public function renderResponseMetaBox( WP_Post $post ) |
| 190 | 198 | { |
| 191 | - if( !$this->isReviewPostType( $post ))return; |
|
| 199 | + if( !$this->isReviewPostType( $post )) { |
|
| 200 | + return; |
|
| 201 | + } |
|
| 192 | 202 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 193 | 203 | glsr()->render( 'partials/editor/metabox-response', [ |
| 194 | 204 | 'response' => glsr( Database::class )->getReview( $post )->response, |
@@ -202,7 +212,9 @@ discard block |
||
| 202 | 212 | */ |
| 203 | 213 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 204 | 214 | { |
| 205 | - if( !$this->isReviewPostType( $post ))return; |
|
| 215 | + if( !$this->isReviewPostType( $post )) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 206 | 218 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 207 | 219 | 'post' => $post, |
| 208 | 220 | 'tax_name' => Application::TAXONOMY, |
@@ -240,7 +252,9 @@ discard block |
||
| 240 | 252 | protected function buildAssignedToTemplate( $assignedTo ) |
| 241 | 253 | { |
| 242 | 254 | $assignedPost = get_post( $assignedTo ); |
| 243 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 255 | + if( !( $assignedPost instanceof WP_Post )) { |
|
| 256 | + return; |
|
| 257 | + } |
|
| 244 | 258 | return glsr( Html::class )->buildTemplate( 'edit/assigned-post', [ |
| 245 | 259 | 'context' => [ |
| 246 | 260 | 'url' => (string)get_permalink( $assignedPost ), |