@@ -53,7 +53,9 @@ |
||
| 53 | 53 | $arrayKeys = ['context', 'globals']; |
| 54 | 54 | $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
| 55 | 55 | foreach( $arrayKeys as $key ) { |
| 56 | - if( is_array( $data[$key] ))continue; |
|
| 56 | + if( is_array( $data[$key] )) { |
|
| 57 | + continue; |
|
| 58 | + } |
|
| 57 | 59 | $data[$key] = []; |
| 58 | 60 | } |
| 59 | 61 | return $data; |
@@ -54,7 +54,9 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
| 56 | 56 | foreach( $postTypeColumns as $key => &$value ) { |
| 57 | - if( !array_key_exists( $key, $columns ) || !empty( $value ))continue; |
|
| 57 | + if( !array_key_exists( $key, $columns ) || !empty( $value )) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 58 | 60 | $value = $columns[$key]; |
| 59 | 61 | } |
| 60 | 62 | if( count( glsr( Database::class )->getReviewsMeta( 'type' )) < 2 ) { |
@@ -92,7 +94,8 @@ discard block |
||
| 92 | 94 | * @return array |
| 93 | 95 | * @filter display_post_states |
| 94 | 96 | */ |
| 95 | - public function filterPostStates( array $postStates, WP_Post $post ) { |
|
| 97 | + public function filterPostStates( array $postStates, WP_Post $post ) |
|
| 98 | + { |
|
| 96 | 99 | if( $post->post_type == Application::POST_TYPE |
| 97 | 100 | && array_key_exists( 'pending', $postStates )) { |
| 98 | 101 | $postStates['pending'] = __( 'Unapproved', 'site-reviews' ); |
@@ -137,7 +140,9 @@ discard block |
||
| 137 | 140 | $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE]; |
| 138 | 141 | unset( $postTypeColumns['cb'] ); |
| 139 | 142 | foreach( $postTypeColumns as $key => $value ) { |
| 140 | - if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue; |
|
| 143 | + if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 141 | 146 | $columns[$key] = $key; |
| 142 | 147 | } |
| 143 | 148 | return $columns; |
@@ -161,7 +166,9 @@ discard block |
||
| 161 | 166 | 'Pending' => __( 'Unapproved', 'site-reviews' ), |
| 162 | 167 | ]; |
| 163 | 168 | foreach( $strings as $search => $replace ) { |
| 164 | - if( strpos( $single, $search ) === false )continue; |
|
| 169 | + if( strpos( $single, $search ) === false ) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 165 | 172 | $translation = $this->getTranslation([ |
| 166 | 173 | 'number' => $number, |
| 167 | 174 | 'plural' => str_replace( $search, $replace, $plural ), |
@@ -213,7 +220,9 @@ discard block |
||
| 213 | 220 | */ |
| 214 | 221 | public function saveBulkEditFields( $postId ) |
| 215 | 222 | { |
| 216 | - if( !current_user_can( 'edit_posts' ))return; |
|
| 223 | + if( !current_user_can( 'edit_posts' )) { |
|
| 224 | + return; |
|
| 225 | + } |
|
| 217 | 226 | $assignedTo = filter_input( INPUT_GET, 'assigned_to' ); |
| 218 | 227 | if( $assignedTo && get_post( $assignedTo )) { |
| 219 | 228 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
@@ -226,7 +235,9 @@ discard block |
||
| 226 | 235 | */ |
| 227 | 236 | public function setQueryForColumn( WP_Query $query ) |
| 228 | 237 | { |
| 229 | - if( !$this->hasPermission( $query ))return; |
|
| 238 | + if( !$this->hasPermission( $query )) { |
|
| 239 | + return; |
|
| 240 | + } |
|
| 230 | 241 | $this->setMetaQuery( $query, [ |
| 231 | 242 | 'rating', 'review_type', |
| 232 | 243 | ]); |
@@ -297,7 +308,9 @@ discard block |
||
| 297 | 308 | protected function setMetaQuery( WP_Query $query, array $metaKeys ) |
| 298 | 309 | { |
| 299 | 310 | foreach( $metaKeys as $key ) { |
| 300 | - if( !( $value = filter_input( INPUT_GET, $key )))continue; |
|
| 311 | + if( !( $value = filter_input( INPUT_GET, $key ))) { |
|
| 312 | + continue; |
|
| 313 | + } |
|
| 301 | 314 | $metaQuery = (array)$query->get( 'meta_query' ); |
| 302 | 315 | $metaQuery[] = [ |
| 303 | 316 | 'key' => $key, |
@@ -118,7 +118,9 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function registerMetaBoxes( $postType ) |
| 120 | 120 | { |
| 121 | - if( $postType != Application::POST_TYPE )return; |
|
| 121 | + if( $postType != Application::POST_TYPE ) { |
|
| 122 | + return; |
|
| 123 | + } |
|
| 122 | 124 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
| 123 | 125 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
| 124 | 126 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -148,7 +150,9 @@ discard block |
||
| 148 | 150 | */ |
| 149 | 151 | public function renderAssignedToMetabox( WP_Post $post ) |
| 150 | 152 | { |
| 151 | - if( !$this->isReviewPostType( $post ))return; |
|
| 153 | + if( !$this->isReviewPostType( $post )) { |
|
| 154 | + return; |
|
| 155 | + } |
|
| 152 | 156 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
| 153 | 157 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
| 154 | 158 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -163,7 +167,9 @@ discard block |
||
| 163 | 167 | */ |
| 164 | 168 | public function renderDetailsMetaBox( WP_Post $post ) |
| 165 | 169 | { |
| 166 | - if( !$this->isReviewPostType( $post ))return; |
|
| 170 | + if( !$this->isReviewPostType( $post )) { |
|
| 171 | + return; |
|
| 172 | + } |
|
| 167 | 173 | $review = glsr( Database::class )->getReview( $post ); |
| 168 | 174 | glsr()->render( 'partials/editor/metabox-details', [ |
| 169 | 175 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -177,7 +183,9 @@ discard block |
||
| 177 | 183 | */ |
| 178 | 184 | public function renderPinnedInPublishMetaBox() |
| 179 | 185 | { |
| 180 | - if( !$this->isReviewPostType( get_post() ))return; |
|
| 186 | + if( !$this->isReviewPostType( get_post() )) { |
|
| 187 | + return; |
|
| 188 | + } |
|
| 181 | 189 | glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [ |
| 182 | 190 | 'context' => [ |
| 183 | 191 | 'no' => __( 'No', 'site-reviews' ), |
@@ -193,7 +201,9 @@ discard block |
||
| 193 | 201 | */ |
| 194 | 202 | public function renderResponseMetaBox( WP_Post $post ) |
| 195 | 203 | { |
| 196 | - if( !$this->isReviewPostType( $post ))return; |
|
| 204 | + if( !$this->isReviewPostType( $post )) { |
|
| 205 | + return; |
|
| 206 | + } |
|
| 197 | 207 | wp_nonce_field( 'response', '_nonce-response', false ); |
| 198 | 208 | glsr()->render( 'partials/editor/metabox-response', [ |
| 199 | 209 | 'response' => glsr( Database::class )->getReview( $post )->response, |
@@ -207,7 +217,9 @@ discard block |
||
| 207 | 217 | */ |
| 208 | 218 | public function renderTaxonomyMetabox( WP_Post $post ) |
| 209 | 219 | { |
| 210 | - if( !$this->isReviewPostType( $post ))return; |
|
| 220 | + if( !$this->isReviewPostType( $post )) { |
|
| 221 | + return; |
|
| 222 | + } |
|
| 211 | 223 | glsr()->render( 'partials/editor/metabox-categories', [ |
| 212 | 224 | 'post' => $post, |
| 213 | 225 | 'tax_name' => Application::TAXONOMY, |
@@ -245,7 +257,9 @@ discard block |
||
| 245 | 257 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
| 246 | 258 | { |
| 247 | 259 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post, $assignedTo ); |
| 248 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
| 260 | + if( !( $assignedPost instanceof WP_Post )) { |
|
| 261 | + return; |
|
| 262 | + } |
|
| 249 | 263 | return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [ |
| 250 | 264 | 'context' => [ |
| 251 | 265 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -287,7 +301,9 @@ discard block |
||
| 287 | 301 | */ |
| 288 | 302 | protected function getReviewType( $review ) |
| 289 | 303 | { |
| 290 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
| 304 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
| 305 | + return; |
|
| 306 | + } |
|
| 291 | 307 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
| 292 | 308 | ? glsr()->reviewTypes[$review->review_type] |
| 293 | 309 | : __( 'Unknown', 'site-reviews' ); |
@@ -19,13 +19,17 @@ discard block |
||
| 19 | 19 | public function build( array $args = [] ) |
| 20 | 20 | { |
| 21 | 21 | $this->args = $this->normalize( $args ); |
| 22 | - if( $this->args['total'] < 2 )return; |
|
| 22 | + if( $this->args['total'] < 2 ) { |
|
| 23 | + return; |
|
| 24 | + } |
|
| 23 | 25 | $links = $this->buildLinksForDeprecatedThemes(); |
| 24 | 26 | if( empty( $links )) { |
| 25 | 27 | $links = $this->buildLinks(); |
| 26 | 28 | } |
| 27 | 29 | $links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args ); |
| 28 | - if( empty( $links ))return; |
|
| 30 | + if( empty( $links )) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 29 | 33 | return $this->buildTemplate( $links ); |
| 30 | 34 | } |
| 31 | 35 | |
@@ -55,7 +59,9 @@ discard block |
||
| 55 | 59 | protected function buildLinksForDeprecatedThemes() |
| 56 | 60 | { |
| 57 | 61 | $theme = wp_get_theme()->get( 'TextDomain' ); |
| 58 | - if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return; |
|
| 62 | + if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] )) { |
|
| 63 | + return; |
|
| 64 | + } |
|
| 59 | 65 | $links = ''; |
| 60 | 66 | if( $this->args['paged'] > 1 ) { |
| 61 | 67 | $links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
@@ -48,7 +48,9 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function enqueueRecaptchaScript() |
| 50 | 50 | { |
| 51 | - if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
|
| 51 | + if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' ) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 52 | 54 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
| 53 | 55 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
| 54 | 56 | 'hl' => $language, |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | ]; |
| 81 | 81 | if( !isset( $properties[$property] ) |
| 82 | 82 | || empty( array_filter( [$value], $properties[$property] )) |
| 83 | - )return; |
|
| 83 | + ) { |
|
| 84 | + return; |
|
| 85 | + } |
|
| 84 | 86 | $this->$property = $value; |
| 85 | 87 | } |
| 86 | 88 | |
@@ -129,7 +131,9 @@ discard block |
||
| 129 | 131 | */ |
| 130 | 132 | protected function buildFieldDescription() |
| 131 | 133 | { |
| 132 | - if( empty( $this->args['description'] ))return; |
|
| 134 | + if( empty( $this->args['description'] )) { |
|
| 135 | + return; |
|
| 136 | + } |
|
| 133 | 137 | if( $this->args['is_widget'] ) { |
| 134 | 138 | return $this->small( $this->args['description'] ); |
| 135 | 139 | } |
@@ -184,7 +188,9 @@ discard block |
||
| 184 | 188 | */ |
| 185 | 189 | protected function buildFormLabel() |
| 186 | 190 | { |
| 187 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 191 | + if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) { |
|
| 192 | + return; |
|
| 193 | + } |
|
| 188 | 194 | return $this->label([ |
| 189 | 195 | 'for' => $this->args['id'], |
| 190 | 196 | 'text' => $this->args['label'], |
@@ -36,7 +36,9 @@ discard block |
||
| 36 | 36 | [], |
| 37 | 37 | glsr()->version |
| 38 | 38 | ); |
| 39 | - if( !$this->isCurrentScreen() )return; |
|
| 39 | + if( !$this->isCurrentScreen() ) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 40 | 42 | wp_enqueue_script( |
| 41 | 43 | Application::ID, |
| 42 | 44 | glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
@@ -113,8 +115,12 @@ discard block |
||
| 113 | 115 | $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
| 114 | 116 | $generatedPointers = []; |
| 115 | 117 | foreach( $pointers as $pointer ) { |
| 116 | - if( $pointer['screen'] != glsr_current_screen()->id )continue; |
|
| 117 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
| 118 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
| 119 | + continue; |
|
| 120 | + } |
|
| 121 | + if( in_array( $pointer['id'], $dismissedPointers )) { |
|
| 122 | + continue; |
|
| 123 | + } |
|
| 118 | 124 | $generatedPointers[] = $this->generatePointer( $pointer ); |
| 119 | 125 | } |
| 120 | 126 | $this->pointers = $generatedPointers; |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | { |
| 141 | 147 | $variables = []; |
| 142 | 148 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
| 143 | - if( empty( $args['required'] ))continue; |
|
| 149 | + if( empty( $args['required'] )) { |
|
| 150 | + continue; |
|
| 151 | + } |
|
| 144 | 152 | $variables[$tag] = $args['required']; |
| 145 | 153 | } |
| 146 | 154 | return $variables; |
@@ -15,9 +15,13 @@ |
||
| 15 | 15 | ]; |
| 16 | 16 | foreach( $namespaces as $prefix => $baseDir ) { |
| 17 | 17 | $len = strlen( $prefix ); |
| 18 | - if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
|
| 18 | + if( strncmp( $prefix, $className, $len ) !== 0 ) { |
|
| 19 | + continue; |
|
| 20 | + } |
|
| 19 | 21 | $file = $baseDir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
| 20 | - if( !file_exists( $file ))continue; |
|
| 22 | + if( !file_exists( $file )) { |
|
| 23 | + continue; |
|
| 24 | + } |
|
| 21 | 25 | require $file; |
| 22 | 26 | break; |
| 23 | 27 | } |
@@ -64,7 +64,9 @@ discard block |
||
| 64 | 64 | public function getAssignedToPost( $post, $assignedTo = '' ) |
| 65 | 65 | { |
| 66 | 66 | $post = get_post( $post ); |
| 67 | - if( !( $post instanceof WP_Post ))return; |
|
| 67 | + if( !( $post instanceof WP_Post )) { |
|
| 68 | + return; |
|
| 69 | + } |
|
| 68 | 70 | if( empty( $assignedTo )) { |
| 69 | 71 | $assignedTo = get_post_meta( $post->ID, 'assigned_to', true ); |
| 70 | 72 | } |
@@ -82,7 +84,9 @@ discard block |
||
| 82 | 84 | */ |
| 83 | 85 | public function getReview( $post ) |
| 84 | 86 | { |
| 85 | - if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return; |
|
| 87 | + if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE ) { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 86 | 90 | $review = $this->getReviewMeta( $post->ID ); |
| 87 | 91 | $modified = $this->isReviewModified( $post, $review ); |
| 88 | 92 | $review->content = $post->post_content; |
@@ -256,7 +260,9 @@ discard block |
||
| 256 | 260 | $termIds = array_map( 'trim', explode( ',', $termIds )); |
| 257 | 261 | foreach( $termIds as $termId ) { |
| 258 | 262 | $term = term_exists( $termId, Application::TAXONOMY ); |
| 259 | - if( !isset( $term['term_id'] ))continue; |
|
| 263 | + if( !isset( $term['term_id'] )) { |
|
| 264 | + continue; |
|
| 265 | + } |
|
| 260 | 266 | $terms[] = intval( $term['term_id'] ); |
| 261 | 267 | } |
| 262 | 268 | return $terms; |
@@ -269,7 +275,9 @@ discard block |
||
| 269 | 275 | public function revertReview( $postId ) |
| 270 | 276 | { |
| 271 | 277 | $post = get_post( $postId ); |
| 272 | - if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return; |
|
| 278 | + if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE ) { |
|
| 279 | + return; |
|
| 280 | + } |
|
| 273 | 281 | delete_post_meta( $post->ID, '_edit_last' ); |
| 274 | 282 | $result = wp_update_post([ |
| 275 | 283 | 'ID' => $post->ID, |
@@ -304,7 +312,9 @@ discard block |
||
| 304 | 312 | add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 ); |
| 305 | 313 | $search = new WP_Query( $args ); |
| 306 | 314 | remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 ); |
| 307 | - if( !$search->have_posts() )return; |
|
| 315 | + if( !$search->have_posts() ) { |
|
| 316 | + return; |
|
| 317 | + } |
|
| 308 | 318 | $results = ''; |
| 309 | 319 | while( $search->have_posts() ) { |
| 310 | 320 | $search->the_post(); |
@@ -331,7 +341,9 @@ discard block |
||
| 331 | 341 | update_post_meta( $postId, $metaKey, $metaValue ); |
| 332 | 342 | } |
| 333 | 343 | $terms = $this->normalizeTerms( $termIds ); |
| 334 | - if( empty( $terms ))return; |
|
| 344 | + if( empty( $terms )) { |
|
| 345 | + return; |
|
| 346 | + } |
|
| 335 | 347 | $result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY ); |
| 336 | 348 | if( is_wp_error( $result )) { |
| 337 | 349 | glsr_log()->error( $result->get_error_message() ); |