@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function send( Review $review ) |
| 45 | 45 | { |
| 46 | - if( empty( $this->types ))return; |
|
| 46 | + if( empty( $this->types )) { |
|
| 47 | + return; |
|
| 48 | + } |
|
| 47 | 49 | $this->review = $review; |
| 48 | 50 | $args = [ |
| 49 | 51 | 'link' => $this->getLink(), |
@@ -158,7 +160,9 @@ discard block |
||
| 158 | 160 | */ |
| 159 | 161 | protected function sendToSlack( array $args ) |
| 160 | 162 | { |
| 161 | - if( !$this->slack )return; |
|
| 163 | + if( !$this->slack ) { |
|
| 164 | + return; |
|
| 165 | + } |
|
| 162 | 166 | $notification = $this->buildSlackNotification( $args ); |
| 163 | 167 | $result = $notification->send(); |
| 164 | 168 | if( is_wp_error( $result )) { |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $this->args = $args; |
| 36 | 36 | $this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args ); |
| 37 | - if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return; |
|
| 37 | + if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) { |
|
| 38 | + return; |
|
| 39 | + } |
|
| 38 | 40 | $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts ); |
| 39 | 41 | $this->generateSchema(); |
| 40 | 42 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -56,7 +58,9 @@ discard block |
||
| 56 | 58 | */ |
| 57 | 59 | protected function buildPercentage() |
| 58 | 60 | { |
| 59 | - if( $this->isHidden( 'bars' ))return; |
|
| 61 | + if( $this->isHidden( 'bars' )) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 60 | 64 | $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts )); |
| 61 | 65 | $bars = array_reduce( range( glsr()->constant( 'MAX_RATING', Rating::class ), 1 ), function( $carry, $level ) use( $percentages ) { |
| 62 | 66 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
@@ -109,7 +113,9 @@ discard block |
||
| 109 | 113 | */ |
| 110 | 114 | protected function buildRating() |
| 111 | 115 | { |
| 112 | - if( $this->isHidden( 'rating' ))return; |
|
| 116 | + if( $this->isHidden( 'rating' )) { |
|
| 117 | + return; |
|
| 118 | + } |
|
| 113 | 119 | return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' ); |
| 114 | 120 | } |
| 115 | 121 | |
@@ -118,7 +124,9 @@ discard block |
||
| 118 | 124 | */ |
| 119 | 125 | protected function buildStars() |
| 120 | 126 | { |
| 121 | - if( $this->isHidden( 'stars' ))return; |
|
| 127 | + if( $this->isHidden( 'stars' )) { |
|
| 128 | + return; |
|
| 129 | + } |
|
| 122 | 130 | $stars = glsr_star_rating( $this->averageRating ); |
| 123 | 131 | return $this->wrap( 'stars', $stars ); |
| 124 | 132 | } |
@@ -128,7 +136,9 @@ discard block |
||
| 128 | 136 | */ |
| 129 | 137 | protected function buildText() |
| 130 | 138 | { |
| 131 | - if( $this->isHidden( 'summary' ))return; |
|
| 139 | + if( $this->isHidden( 'summary' )) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 132 | 142 | $count = intval( array_sum( $this->ratingCounts )); |
| 133 | 143 | if( empty( $this->args['text'] )) { |
| 134 | 144 | // @todo document this change |
@@ -153,7 +163,9 @@ discard block |
||
| 153 | 163 | */ |
| 154 | 164 | protected function generateSchema() |
| 155 | 165 | { |
| 156 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 166 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 157 | 169 | glsr( Schema::class )->store( |
| 158 | 170 | glsr( Schema::class )->buildSummary( $this->args ) |
| 159 | 171 | ); |
@@ -107,7 +107,9 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function getMuPluginDetails() |
| 109 | 109 | { |
| 110 | - if( empty( $plugins = get_mu_plugins() ))return; |
|
| 110 | + if( empty( $plugins = get_mu_plugins() )) { |
|
| 111 | + return; |
|
| 112 | + } |
|
| 111 | 113 | return $this->normalizePluginList( $plugins ); |
| 112 | 114 | } |
| 113 | 115 | |
@@ -117,7 +119,9 @@ discard block |
||
| 117 | 119 | public function getMultisitePluginDetails() |
| 118 | 120 | { |
| 119 | 121 | $activePlugins = (array)get_site_option( 'active_sitewide_plugins', [] ); |
| 120 | - if( !is_multisite() || empty( $activePlugins ))return; |
|
| 122 | + if( !is_multisite() || empty( $activePlugins )) { |
|
| 123 | + return; |
|
| 124 | + } |
|
| 121 | 125 | return $this->normalizePluginList( array_intersect_key( get_plugins(), $activePlugins )); |
| 122 | 126 | } |
| 123 | 127 | |
@@ -201,7 +205,9 @@ discard block |
||
| 201 | 205 | ksort( $settings ); |
| 202 | 206 | $details = []; |
| 203 | 207 | foreach( $settings as $key => $value ) { |
| 204 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
| 208 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) { |
|
| 209 | + continue; |
|
| 210 | + } |
|
| 205 | 211 | $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
| 206 | 212 | $details[$key] = $value; |
| 207 | 213 | } |
@@ -277,7 +283,9 @@ discard block |
||
| 277 | 283 | 'WPE_APIKEY' => 'WP Engine', |
| 278 | 284 | ]; |
| 279 | 285 | foreach( $checks as $key => $value ) { |
| 280 | - if( !$this->isWebhostCheckValid( $key ))continue; |
|
| 286 | + if( !$this->isWebhostCheckValid( $key )) { |
|
| 287 | + continue; |
|
| 288 | + } |
|
| 281 | 289 | return $value; |
| 282 | 290 | } |
| 283 | 291 | return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] )); |
@@ -358,7 +366,9 @@ discard block |
||
| 358 | 366 | ]; |
| 359 | 367 | array_walk( $settings, function( &$value, $setting ) use( $keys ) { |
| 360 | 368 | foreach( $keys as $key ) { |
| 361 | - if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue; |
|
| 369 | + if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value )) { |
|
| 370 | + continue; |
|
| 371 | + } |
|
| 362 | 372 | $value = str_repeat( '•', 13 ); |
| 363 | 373 | return; |
| 364 | 374 | } |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | $types = array_unique( array_merge( ['local'], $types )); |
| 35 | 35 | foreach( $types as $type ) { |
| 36 | 36 | $type = $this->normalizeType( $type ); |
| 37 | - if( isset( $counts[$type] ))continue; |
|
| 37 | + if( isset( $counts[$type] )) { |
|
| 38 | + continue; |
|
| 39 | + } |
|
| 38 | 40 | $counts[$type] = array_fill_keys( range( 0, glsr()->constant( 'MAX_RATING', Rating::class )), 0 ); |
| 39 | 41 | } |
| 40 | 42 | foreach( $query->reviews as $review ) { |
@@ -109,7 +111,9 @@ discard block |
||
| 109 | 111 | */ |
| 110 | 112 | public function decreasePostCounts( Review $review ) |
| 111 | 113 | { |
| 112 | - if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return; |
|
| 114 | + if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) { |
|
| 115 | + return; |
|
| 116 | + } |
|
| 113 | 117 | $counts = $this->decreaseRating( $counts, $review->review_type, $review->rating ); |
| 114 | 118 | $this->setPostCounts( $review->assigned_to, $counts ); |
| 115 | 119 | } |
@@ -120,7 +124,9 @@ discard block |
||
| 120 | 124 | public function decreaseTermCounts( Review $review ) |
| 121 | 125 | { |
| 122 | 126 | foreach( $review->term_ids as $termId ) { |
| 123 | - if( empty( $counts = $this->getTermCounts( $termId )))continue; |
|
| 127 | + if( empty( $counts = $this->getTermCounts( $termId ))) { |
|
| 128 | + continue; |
|
| 129 | + } |
|
| 124 | 130 | $counts = $this->decreaseRating( $counts, $review->review_type, $review->rating ); |
| 125 | 131 | $this->setTermCounts( $termId, $counts ); |
| 126 | 132 | } |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | 'min' => glsr()->constant( 'MIN_RATING', Rating::class ), |
| 141 | 147 | ]); |
| 142 | 148 | foreach( $counts as $index => &$num ) { |
| 143 | - if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue; |
|
| 149 | + if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) { |
|
| 150 | + continue; |
|
| 151 | + } |
|
| 144 | 152 | $num = 0; |
| 145 | 153 | } |
| 146 | 154 | return $counts; |
@@ -229,7 +237,9 @@ discard block |
||
| 229 | 237 | */ |
| 230 | 238 | public function increasePostCounts( Review $review ) |
| 231 | 239 | { |
| 232 | - if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return; |
|
| 240 | + if( !( get_post( $review->assigned_to ) instanceof WP_Post )) { |
|
| 241 | + return; |
|
| 242 | + } |
|
| 233 | 243 | $counts = $this->getPostCounts( $review->assigned_to ); |
| 234 | 244 | $counts = empty( $counts ) |
| 235 | 245 | ? $this->buildPostCounts( $review->assigned_to ) |
@@ -279,7 +289,9 @@ discard block |
||
| 279 | 289 | public function setTermCounts( $termId, array $reviewCounts ) |
| 280 | 290 | { |
| 281 | 291 | $term = get_term( $termId, Application::TAXONOMY ); |
| 282 | - if( !isset( $term->term_id ))return; |
|
| 292 | + if( !isset( $term->term_id )) { |
|
| 293 | + return; |
|
| 294 | + } |
|
| 283 | 295 | $ratingCounts = $this->flatten( $reviewCounts ); |
| 284 | 296 | update_term_meta( $termId, static::META_COUNT, $reviewCounts ); |
| 285 | 297 | update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts )); |
@@ -335,7 +347,9 @@ discard block |
||
| 335 | 347 | } |
| 336 | 348 | foreach( $reviewCounts as &$counts ) { |
| 337 | 349 | foreach( range( 0, glsr()->constant( 'MAX_RATING', Rating::class )) as $index ) { |
| 338 | - if( isset( $counts[$index] ))continue; |
|
| 350 | + if( isset( $counts[$index] )) { |
|
| 351 | + continue; |
|
| 352 | + } |
|
| 339 | 353 | $counts[$index] = 0; |
| 340 | 354 | } |
| 341 | 355 | ksort( $counts ); |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | public function routeAdminPostRequest() |
| 30 | 30 | { |
| 31 | 31 | $request = $this->getRequest(); |
| 32 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 32 | + if( !$this->isValidPostRequest( $request )) { |
|
| 33 | + return; |
|
| 34 | + } |
|
| 33 | 35 | check_admin_referer( $request['_action'] ); |
| 34 | 36 | $this->routeRequest( 'admin', $request['_action'], $request ); |
| 35 | 37 | } |
@@ -51,10 +53,16 @@ discard block |
||
| 51 | 53 | */ |
| 52 | 54 | public function routePublicPostRequest() |
| 53 | 55 | { |
| 54 | - if( is_admin() )return; |
|
| 56 | + if( is_admin() ) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 55 | 59 | $request = $this->getRequest(); |
| 56 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 57 | - if( !$this->isValidPublicNonce( $request ))return; |
|
| 60 | + if( !$this->isValidPostRequest( $request )) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 63 | + if( !$this->isValidPublicNonce( $request )) { |
|
| 64 | + return; |
|
| 65 | + } |
|
| 58 | 66 | $this->routeRequest( 'public', $request['_action'], $request ); |
| 59 | 67 | } |
| 60 | 68 | |
@@ -65,7 +73,9 @@ discard block |
||
| 65 | 73 | { |
| 66 | 74 | if( !is_user_logged_in() |
| 67 | 75 | || in_array( glsr_get( $request, '_action' ), $this->unguardedActions ) |
| 68 | - )return; |
|
| 76 | + ) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 69 | 79 | if( !isset( $request['_nonce'] )) { |
| 70 | 80 | $this->sendAjaxError( 'request is missing a nonce', $request ); |
| 71 | 81 | } |
@@ -127,7 +127,9 @@ discard block |
||
| 127 | 127 | $atts = $this->getDefaults( $atts ); |
| 128 | 128 | array_walk( $atts, function( &$value, $key ) { |
| 129 | 129 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 130 | - if( !method_exists( $this, $methodName ))return; |
|
| 130 | + if( !method_exists( $this, $methodName )) { |
|
| 131 | + return; |
|
| 132 | + } |
|
| 131 | 133 | $value = $this->$methodName( $value ); |
| 132 | 134 | }); |
| 133 | 135 | return $atts; |
@@ -202,7 +204,9 @@ discard block |
||
| 202 | 204 | $defaults = array_pad( $defaults, glsr()->constant( 'MAX_RATING', Rating::class ), '' ); |
| 203 | 205 | $labels = array_map( 'trim', explode( ',', $labels )); |
| 204 | 206 | foreach( $defaults as $i => $label ) { |
| 205 | - if( empty( $labels[$i] ))continue; |
|
| 207 | + if( empty( $labels[$i] )) { |
|
| 208 | + continue; |
|
| 209 | + } |
|
| 206 | 210 | $defaults[$i] = $labels[$i]; |
| 207 | 211 | } |
| 208 | 212 | return array_combine( range( glsr()->constant( 'MAX_RATING', Rating::class ), 1 ), $defaults ); |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | foreach( glsr( ReviewManager::class )->get( $this->args ) as $review ) { |
| 36 | 36 | // Only include critic reviews that have been directly produced by your site, not reviews from third-party sites or syndicated reviews. |
| 37 | 37 | // @see https://developers.google.com/search/docs/data-types/review |
| 38 | - if( $review->review_type != 'local' )continue; |
|
| 38 | + if( $review->review_type != 'local' ) { |
|
| 39 | + continue; |
|
| 40 | + } |
|
| 39 | 41 | $reviews[] = $this->buildReview( $review ); |
| 40 | 42 | } |
| 41 | 43 | if( !empty( $reviews )) { |
@@ -80,7 +82,9 @@ discard block |
||
| 80 | 82 | */ |
| 81 | 83 | public function render() |
| 82 | 84 | { |
| 83 | - if( empty( glsr()->schemas ))return; |
|
| 85 | + if( empty( glsr()->schemas )) { |
|
| 86 | + return; |
|
| 87 | + } |
|
| 84 | 88 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 85 | 89 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 86 | 90 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
@@ -132,7 +136,9 @@ discard block |
||
| 132 | 136 | { |
| 133 | 137 | foreach( $values as $value ) { |
| 134 | 138 | $option = $this->getSchemaOptionValue( $value ); |
| 135 | - if( empty( $option ))continue; |
|
| 139 | + if( empty( $option )) { |
|
| 140 | + continue; |
|
| 141 | + } |
|
| 136 | 142 | $schema->$value( $option ); |
| 137 | 143 | } |
| 138 | 144 | return $schema; |
@@ -239,7 +245,9 @@ discard block |
||
| 239 | 245 | if( $value != $fallback ) { |
| 240 | 246 | return $value; |
| 241 | 247 | } |
| 242 | - if( !is_single() && !is_page() )return; |
|
| 248 | + if( !is_single() && !is_page() ) { |
|
| 249 | + return; |
|
| 250 | + } |
|
| 243 | 251 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
| 244 | 252 | if( method_exists( $this, $method )) { |
| 245 | 253 | return $this->$method(); |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function __call( $name, array $args = [] ) |
| 27 | 27 | { |
| 28 | - if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ))return; |
|
| 28 | + if( !method_exists( $this, $name ) || !in_array( $name, $this->callable )) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 29 | 31 | $defaults = call_user_func_array( [$this, $name], $args ); |
| 30 | 32 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
| 31 | 33 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -69,7 +71,9 @@ discard block |
||
| 69 | 71 | protected function flattenArray( array $values ) |
| 70 | 72 | { |
| 71 | 73 | array_walk( $values, function( &$value ) { |
| 72 | - if( !is_array( $value ))return; |
|
| 74 | + if( !is_array( $value )) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 73 | 77 | $value = implode( ',', $value ); |
| 74 | 78 | }); |
| 75 | 79 | return $values; |
@@ -31,7 +31,8 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @return mixed |
| 33 | 33 | */ |
| 34 | -function glsr( $alias = null ) { |
|
| 34 | +function glsr( $alias = null ) |
|
| 35 | +{ |
|
| 35 | 36 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 36 | 37 | return !empty( $alias ) |
| 37 | 38 | ? $app->make( $alias ) |
@@ -43,11 +44,14 @@ discard block |
||
| 43 | 44 | * @param $column string |
| 44 | 45 | * @return array |
| 45 | 46 | */ |
| 46 | -function glsr_array_column( array $array, $column ) { |
|
| 47 | +function glsr_array_column( array $array, $column ) |
|
| 48 | +{ |
|
| 47 | 49 | $result = array(); |
| 48 | 50 | foreach( $array as $subarray ) { |
| 49 | 51 | $subarray = (array)$subarray; |
| 50 | - if( !isset( $subarray[$column] ))continue; |
|
| 52 | + if( !isset( $subarray[$column] )) { |
|
| 53 | + continue; |
|
| 54 | + } |
|
| 51 | 55 | $result[] = $subarray[$column]; |
| 52 | 56 | } |
| 53 | 57 | return $result; |
@@ -56,7 +60,8 @@ discard block |
||
| 56 | 60 | /** |
| 57 | 61 | * @return void |
| 58 | 62 | */ |
| 59 | -function glsr_calculate_ratings() { |
|
| 63 | +function glsr_calculate_ratings() |
|
| 64 | +{ |
|
| 60 | 65 | glsr( 'Controllers\AdminController' )->routerCountReviews( false ); |
| 61 | 66 | glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' )); |
| 62 | 67 | } |
@@ -64,7 +69,8 @@ discard block |
||
| 64 | 69 | /** |
| 65 | 70 | * @return \GeminiLabs\SiteReviews\Review|false |
| 66 | 71 | */ |
| 67 | -function glsr_create_review( $reviewValues = array() ) { |
|
| 72 | +function glsr_create_review( $reviewValues = array() ) |
|
| 73 | +{ |
|
| 68 | 74 | $review = new \GeminiLabs\SiteReviews\Commands\CreateReview( |
| 69 | 75 | glsr( 'Helper' )->consolidateArray( $reviewValues ) |
| 70 | 76 | ); |
@@ -74,7 +80,8 @@ discard block |
||
| 74 | 80 | /** |
| 75 | 81 | * @return \WP_Screen|object |
| 76 | 82 | */ |
| 77 | -function glsr_current_screen() { |
|
| 83 | +function glsr_current_screen() |
|
| 84 | +{ |
|
| 78 | 85 | if( function_exists( 'get_current_screen' )) { |
| 79 | 86 | $screen = get_current_screen(); |
| 80 | 87 | } |
@@ -87,7 +94,8 @@ discard block |
||
| 87 | 94 | * @param mixed ...$vars |
| 88 | 95 | * @return void |
| 89 | 96 | */ |
| 90 | -function glsr_debug( ...$vars ) { |
|
| 97 | +function glsr_debug( ...$vars ) |
|
| 98 | +{ |
|
| 91 | 99 | if( count( $vars ) == 1 ) { |
| 92 | 100 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
| 93 | 101 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -107,7 +115,8 @@ discard block |
||
| 107 | 115 | * @param mixed $fallback |
| 108 | 116 | * @return mixed |
| 109 | 117 | */ |
| 110 | -function glsr_get( $array, $path = '', $fallback = '' ) { |
|
| 118 | +function glsr_get( $array, $path = '', $fallback = '' ) |
|
| 119 | +{ |
|
| 111 | 120 | return glsr( 'Helper' )->dataGet( $array, $path, $fallback ); |
| 112 | 121 | } |
| 113 | 122 | |
@@ -116,7 +125,8 @@ discard block |
||
| 116 | 125 | * @param mixed $fallback |
| 117 | 126 | * @return string|array |
| 118 | 127 | */ |
| 119 | -function glsr_get_option( $path = '', $fallback = '' ) { |
|
| 128 | +function glsr_get_option( $path = '', $fallback = '' ) |
|
| 129 | +{ |
|
| 120 | 130 | return is_string( $path ) |
| 121 | 131 | ? glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback ) |
| 122 | 132 | : $fallback; |
@@ -125,7 +135,8 @@ discard block |
||
| 125 | 135 | /** |
| 126 | 136 | * @return array |
| 127 | 137 | */ |
| 128 | -function glsr_get_options() { |
|
| 138 | +function glsr_get_options() |
|
| 139 | +{ |
|
| 129 | 140 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
| 130 | 141 | } |
| 131 | 142 | |
@@ -133,7 +144,8 @@ discard block |
||
| 133 | 144 | * @param int $post_id |
| 134 | 145 | * @return \GeminiLabs\SiteReviews\Review |
| 135 | 146 | */ |
| 136 | -function glsr_get_review( $post_id ) { |
|
| 147 | +function glsr_get_review( $post_id ) |
|
| 148 | +{ |
|
| 137 | 149 | $post = null; |
| 138 | 150 | if( is_numeric( $post_id )) { |
| 139 | 151 | $post = get_post( $post_id ); |
@@ -147,14 +159,16 @@ discard block |
||
| 147 | 159 | /** |
| 148 | 160 | * @return array |
| 149 | 161 | */ |
| 150 | -function glsr_get_reviews( $args = array() ) { |
|
| 162 | +function glsr_get_reviews( $args = array() ) |
|
| 163 | +{ |
|
| 151 | 164 | return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args )); |
| 152 | 165 | } |
| 153 | 166 | |
| 154 | 167 | /** |
| 155 | 168 | * @return \GeminiLabs\SiteReviews\Modules\Console |
| 156 | 169 | */ |
| 157 | -function glsr_log() { |
|
| 170 | +function glsr_log() |
|
| 171 | +{ |
|
| 158 | 172 | $args = func_get_args(); |
| 159 | 173 | $console = glsr( 'Modules\Console' ); |
| 160 | 174 | if( $value = glsr_get( $args, '0' )) { |
@@ -166,6 +180,7 @@ discard block |
||
| 166 | 180 | /** |
| 167 | 181 | * @return string |
| 168 | 182 | */ |
| 169 | -function glsr_star_rating( $rating ) { |
|
| 183 | +function glsr_star_rating( $rating ) |
|
| 184 | +{ |
|
| 170 | 185 | return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] ); |
| 171 | 186 | } |