@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | public function file( $view ) |
| 82 | 82 | { |
| 83 | 83 | $file = ''; |
| 84 | - if( glsr( Helper::class )->startsWith( 'templates/', $view )) { |
|
| 84 | + if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) { |
|
| 85 | 85 | $file = str_replace( 'templates/', 'site-reviews/', $view ).'.php'; |
| 86 | 86 | $file = get_stylesheet_directory().'/'.$file; |
| 87 | - if( !file_exists( $file )) { |
|
| 87 | + if( !file_exists( $file ) ) { |
|
| 88 | 88 | $file = $this->path( $view.'.php' ); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | - if( !file_exists( $file )) { |
|
| 91 | + if( !file_exists( $file ) ) { |
|
| 92 | 92 | $file = $this->path( 'views/'.$view.'.php' ); |
| 93 | 93 | } |
| 94 | 94 | return $file; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function getDefaults() |
| 101 | 101 | { |
| 102 | - if( empty( $this->defaults )) { |
|
| 102 | + if( empty($this->defaults) ) { |
|
| 103 | 103 | $this->defaults = $this->make( DefaultsManager::class )->get(); |
| 104 | 104 | $this->upgrade(); |
| 105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function hasPermission() |
| 113 | 113 | { |
| 114 | 114 | $isAdmin = $this->isAdmin(); |
| 115 | - return !$isAdmin || ( $isAdmin && current_user_can( static::CAPABILITY )); |
|
| 115 | + return !$isAdmin || ($isAdmin && current_user_can( static::CAPABILITY )); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $types = apply_filters( 'site-reviews/addon/types', [] ); |
| 169 | 169 | $this->reviewTypes = wp_parse_args( $types, [ |
| 170 | 170 | 'local' => __( 'Local', 'site-reviews' ), |
| 171 | - ]); |
|
| 171 | + ] ); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | $view = apply_filters( 'site-reviews/render/view', $view, $data ); |
| 181 | 181 | $file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data ); |
| 182 | - if( !file_exists( $file )) { |
|
| 182 | + if( !file_exists( $file ) ) { |
|
| 183 | 183 | glsr_log()->error( 'File not found: '.$file ); |
| 184 | 184 | return; |
| 185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function scheduleCronJob() |
| 195 | 195 | { |
| 196 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 196 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; |
|
| 197 | 197 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function unscheduleCronJob() |
| 204 | 204 | { |
| 205 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); |
|
| 205 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function url( $path = '' ) |
| 236 | 236 | { |
| 237 | - $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
| 237 | + $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
| 238 | 238 | return apply_filters( 'site-reviews/url', $url, $path ); |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -60,7 +60,9 @@ discard block |
||
| 60 | 60 | public function catchFatalError() |
| 61 | 61 | { |
| 62 | 62 | $error = error_get_last(); |
| 63 | - if( $error['type'] !== E_ERROR )return; |
|
| 63 | + if( $error['type'] !== E_ERROR ) { |
|
| 64 | + return; |
|
| 65 | + } |
|
| 64 | 66 | glsr_log()->error( $error['message'] ); |
| 65 | 67 | } |
| 66 | 68 | |
@@ -204,7 +206,9 @@ discard block |
||
| 204 | 206 | */ |
| 205 | 207 | public function scheduleCronJob() |
| 206 | 208 | { |
| 207 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 209 | + if( wp_next_scheduled( static::CRON_EVENT )) { |
|
| 210 | + return; |
|
| 211 | + } |
|
| 208 | 212 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 209 | 213 | } |
| 210 | 214 | |
@@ -235,7 +239,9 @@ discard block |
||
| 235 | 239 | || !in_array( plugin_basename( $this->file ), $data['plugins'] ) |
| 236 | 240 | || $data['action'] != 'update' |
| 237 | 241 | || $data['type'] != 'plugin' |
| 238 | - )return; |
|
| 242 | + ) { |
|
| 243 | + return; |
|
| 244 | + } |
|
| 239 | 245 | $this->upgrade(); |
| 240 | 246 | } |
| 241 | 247 | |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | public function getPost( $postId ) |
| 14 | 14 | { |
| 15 | 15 | if( $this->isEnabled() ) { |
| 16 | - $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() )); |
|
| 16 | + $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() ) ); |
|
| 17 | 17 | } |
| 18 | - if( !empty( $polylangPostId )) { |
|
| 18 | + if( !empty($polylangPostId) ) { |
|
| 19 | 19 | $postId = $polylangPostId; |
| 20 | 20 | } |
| 21 | - return get_post( intval( $postId )); |
|
| 21 | + return get_post( intval( $postId ) ); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | foreach( $this->cleanIds( $postIds ) as $postId ) { |
| 34 | 34 | $newPostIds = array_merge( |
| 35 | 35 | $newPostIds, |
| 36 | - array_values( pll_get_post_translations( $postId )) |
|
| 36 | + array_values( pll_get_post_translations( $postId ) ) |
|
| 37 | 37 | ); |
| 38 | 38 | } |
| 39 | 39 | return $this->cleanIds( $newPostIds ); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | protected function cleanIds( array $postIds ) |
| 75 | 75 | { |
| 76 | - return array_filter( array_unique( $postIds )); |
|
| 76 | + return array_filter( array_unique( $postIds ) ); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | 'templates/form/submit-button', |
| 51 | 51 | 'templates/reviews-form', |
| 52 | 52 | ]; |
| 53 | - if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) { |
|
| 53 | + if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) { |
|
| 54 | 54 | return $view; |
| 55 | 55 | } |
| 56 | 56 | $views = $this->generatePossibleViews( $view ); |
| 57 | 57 | foreach( $views as $possibleView ) { |
| 58 | - if( !file_exists( glsr()->path( $possibleView.'.php' )))continue; |
|
| 58 | + if( !file_exists( glsr()->path( $possibleView.'.php' ) ) )continue; |
|
| 59 | 59 | return $possibleView; |
| 60 | 60 | } |
| 61 | 61 | return $view; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function modifyField( Builder $instance ) |
| 90 | 90 | { |
| 91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
| 91 | + if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return; |
|
| 92 | 92 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | protected function customize( Builder $instance ) |
| 107 | 107 | { |
| 108 | - $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' )); |
|
| 108 | + $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) ); |
|
| 109 | 109 | $key = $instance->tag.'_'.$args['type']; |
| 110 | - $classes = !isset( $this->fields[$key] ) |
|
| 110 | + $classes = !isset($this->fields[$key]) |
|
| 111 | 111 | ? $this->fields[$instance->tag] |
| 112 | 112 | : $this->fields[$key]; |
| 113 | 113 | $instance->args['class'] = trim( $args['class'].' '.$classes ); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $args = wp_parse_args( $instance->args, [ |
| 142 | 142 | 'is_public' => false, |
| 143 | 143 | 'is_raw' => false, |
| 144 | - ]); |
|
| 144 | + ] ); |
|
| 145 | 145 | if( is_admin() || !$args['is_public'] || $args['is_raw'] ) { |
| 146 | 146 | return false; |
| 147 | 147 | } |
@@ -55,7 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | $views = $this->generatePossibleViews( $view ); |
| 57 | 57 | foreach( $views as $possibleView ) { |
| 58 | - if( !file_exists( glsr()->path( $possibleView.'.php' )))continue; |
|
| 58 | + if( !file_exists( glsr()->path( $possibleView.'.php' ))) { |
|
| 59 | + continue; |
|
| 60 | + } |
|
| 59 | 61 | return $possibleView; |
| 60 | 62 | } |
| 61 | 63 | return $view; |
@@ -88,7 +90,9 @@ discard block |
||
| 88 | 90 | */ |
| 89 | 91 | public function modifyField( Builder $instance ) |
| 90 | 92 | { |
| 91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
| 93 | + if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) { |
|
| 94 | + return; |
|
| 95 | + } |
|
| 92 | 96 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
| 93 | 97 | } |
| 94 | 98 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | array_walk( $filenames, function( $file ) { |
| 27 | 27 | $className = str_replace( '.php', '', $file ); |
| 28 | 28 | $version = str_replace( 'Upgrade_', '', $className ); |
| 29 | - if( version_compare( glsr()->version, $version, '<' ))return; |
|
| 29 | + if( version_compare( glsr()->version, $version, '<' ) )return; |
|
| 30 | 30 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 31 | 31 | }); |
| 32 | 32 | $this->updateVersion(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function updateVersion() |
| 39 | 39 | { |
| 40 | 40 | $currentVersion = glsr( OptionManager::class )->get( 'version' ); |
| 41 | - if( version_compare( $currentVersion, glsr()->version, '<' )) { |
|
| 41 | + if( version_compare( $currentVersion, glsr()->version, '<' ) ) { |
|
| 42 | 42 | glsr( OptionManager::class )->set( 'version', glsr()->version ); |
| 43 | 43 | } |
| 44 | 44 | if( $currentVersion != glsr()->version ) { |
@@ -19,14 +19,18 @@ |
||
| 19 | 19 | $filenames = []; |
| 20 | 20 | $iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' ); |
| 21 | 21 | foreach( $iterator as $fileinfo ) { |
| 22 | - if( !$fileinfo->isFile() )continue; |
|
| 22 | + if( !$fileinfo->isFile() ) { |
|
| 23 | + continue; |
|
| 24 | + } |
|
| 23 | 25 | $filenames[] = $fileinfo->getFilename(); |
| 24 | 26 | } |
| 25 | 27 | natsort( $filenames ); |
| 26 | 28 | array_walk( $filenames, function( $file ) { |
| 27 | 29 | $className = str_replace( '.php', '', $file ); |
| 28 | 30 | $version = str_replace( 'Upgrade_', '', $className ); |
| 29 | - if( version_compare( glsr()->version, $version, '<' ))return; |
|
| 31 | + if( version_compare( glsr()->version, $version, '<' )) { |
|
| 32 | + return; |
|
| 33 | + } |
|
| 30 | 34 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 31 | 35 | }); |
| 32 | 36 | $this->updateVersion(); |
@@ -87,7 +87,9 @@ |
||
| 87 | 87 | 'webhook' => 'slack', |
| 88 | 88 | ]; |
| 89 | 89 | foreach( $notifications as $old => $new ) { |
| 90 | - if( $this->oldSettings['settings.general.notification'] != $old )continue; |
|
| 90 | + if( $this->oldSettings['settings.general.notification'] != $old ) { |
|
| 91 | + continue; |
|
| 92 | + } |
|
| 91 | 93 | $this->newSettings['settings.general.notifications'][] = $new; |
| 92 | 94 | } |
| 93 | 95 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $this->newSettings['settings.submissions'][] = 'terms'; |
| 44 | 44 | $this->migrateNotificationSettings(); |
| 45 | 45 | $this->migrateRecaptchaSettings(); |
| 46 | - glsr( OptionManager::class )->set( glsr( Helper::class )->convertDotNotationArray( $this->newSettings )); |
|
| 46 | + glsr( OptionManager::class )->set( glsr( Helper::class )->convertDotNotationArray( $this->newSettings ) ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function getOldSettings() |
| 63 | 63 | { |
| 64 | - $settings = glsr( Helper::class )->flattenArray( get_option( Application::ID.'-v2', [] )); |
|
| 64 | + $settings = glsr( Helper::class )->flattenArray( get_option( Application::ID.'-v2', [] ) ); |
|
| 65 | 65 | return wp_parse_args( $settings, [ |
| 66 | 66 | 'settings.general.notification' => '', |
| 67 | 67 | 'settings.general.webhook_url' => '', |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'settings.reviews-form.recaptcha.key' => $this->newSettings['submissions.recaptcha.key'], |
| 75 | 75 | 'settings.reviews-form.recaptcha.secret' => $this->newSettings['submissions.recaptcha.secret'], |
| 76 | 76 | 'settings.reviews-form.recaptcha.position' => $this->newSettings['submissions.recaptcha.position'], |
| 77 | - ]); |
|
| 77 | + ] ); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | protected function migrateRecaptchaSettings() |
| 100 | 100 | { |
| 101 | - if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) { |
|
| 101 | + if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) { |
|
| 102 | 102 | $this->newSettings['settings.submissions.recaptcha.integration'] == 'all'; |
| 103 | 103 | } |
| 104 | 104 | if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'BadgePosition' => $this->oldSettings['settings.reviews-form.recaptcha.position'], |
| 107 | 107 | 'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'], |
| 108 | 108 | 'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'], |
| 109 | - ]); |
|
| 109 | + ] ); |
|
| 110 | 110 | $this->newSettings['settings.submissions.recaptcha.key'] = $invisibleRecaptchaOptions['SiteKey']; |
| 111 | 111 | $this->newSettings['settings.submissions.recaptcha.secret'] = $invisibleRecaptchaOptions['SecretKey']; |
| 112 | 112 | $this->newSettings['settings.submissions.recaptcha.position'] = $invisibleRecaptchaOptions['BadgePosition']; |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | public function build( array $args = [] ) |
| 35 | 35 | { |
| 36 | 36 | $this->args = $args; |
| 37 | - $counts = glsr( CountsManager::class )->get([ |
|
| 37 | + $counts = glsr( CountsManager::class )->get( [ |
|
| 38 | 38 | 'post_ids' => glsr( Helper::class )->convertStringToArray( $args['assigned_to'] ), |
| 39 | 39 | 'term_ids' => glsr( Helper::class )->convertStringToArray( $args['category'] ), |
| 40 | - ]); |
|
| 40 | + ] ); |
|
| 41 | 41 | $this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [ |
| 42 | 42 | 'min' => $args['rating'], |
| 43 | - ]); |
|
| 44 | - if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return; |
|
| 43 | + ] ); |
|
| 44 | + if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ) )return; |
|
| 45 | 45 | $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts ); |
| 46 | 46 | $this->generateSchema(); |
| 47 | 47 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'stars' => $this->buildStars(), |
| 54 | 54 | 'text' => $this->buildText(), |
| 55 | 55 | ], |
| 56 | - ]); |
|
| 56 | + ] ); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function buildPercentage() |
| 63 | 63 | { |
| 64 | - if( $this->isHidden( 'bars' ))return; |
|
| 65 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts )); |
|
| 66 | - $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) { |
|
| 64 | + if( $this->isHidden( 'bars' ) )return; |
|
| 65 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ) ); |
|
| 66 | + $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use($percentages) { |
|
| 67 | 67 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
| 68 | 68 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
| 69 | 69 | $percent = $this->buildPercentagePercent( $percentages[$level] ); |
| 70 | 70 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
| 71 | 71 | 'class' => 'glsr-bar', |
| 72 | - ]); |
|
| 72 | + ] ); |
|
| 73 | 73 | }); |
| 74 | 74 | return $this->wrap( 'percentage', $bars ); |
| 75 | 75 | } |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function buildPercentageBackground( $percent ) |
| 82 | 82 | { |
| 83 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
| 83 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
| 84 | 84 | 'class' => 'glsr-bar-background-percent', |
| 85 | 85 | 'style' => 'width:'.$percent, |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>'; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function buildRating() |
| 112 | 112 | { |
| 113 | - if( $this->isHidden( 'rating' ))return; |
|
| 113 | + if( $this->isHidden( 'rating' ) )return; |
|
| 114 | 114 | return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' ); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function buildStars() |
| 121 | 121 | { |
| 122 | - if( $this->isHidden( 'stars' ))return; |
|
| 122 | + if( $this->isHidden( 'stars' ) )return; |
|
| 123 | 123 | $stars = glsr( Partial::class )->build( 'star-rating', ['rating' => $this->averageRating] ); |
| 124 | 124 | return $this->wrap( 'stars', $stars ); |
| 125 | 125 | } |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | protected function buildText() |
| 131 | 131 | { |
| 132 | - if( $this->isHidden( 'summary' ))return; |
|
| 133 | - $count = intval( array_sum( $this->ratingCounts )); |
|
| 134 | - if( empty( $this->args['text'] )) { |
|
| 132 | + if( $this->isHidden( 'summary' ) )return; |
|
| 133 | + $count = intval( array_sum( $this->ratingCounts ) ); |
|
| 134 | + if( empty($this->args['text']) ) { |
|
| 135 | 135 | // @todo document this change |
| 136 | 136 | $this->args['text'] = _nx( |
| 137 | 137 | '{rating} out of {max} stars (based on {num} review)', |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | $summary = str_replace( |
| 145 | - ['{rating}','{max}', '{num}'], |
|
| 145 | + ['{rating}', '{max}', '{num}'], |
|
| 146 | 146 | [$this->averageRating, Rating::MAX_RATING, $count], |
| 147 | 147 | $this->args['text'] |
| 148 | 148 | ); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function generateSchema() |
| 156 | 156 | { |
| 157 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 157 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
| 158 | 158 | glsr( Schema::class )->store( |
| 159 | 159 | glsr( Schema::class )->buildSummary( $this->args ) |
| 160 | 160 | ); |
@@ -186,6 +186,6 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | return glsr( Builder::class )->div( $value, [ |
| 188 | 188 | 'class' => 'glsr-summary-'.$key, |
| 189 | - ]); |
|
| 189 | + ] ); |
|
| 190 | 190 | } |
| 191 | 191 | } |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | $this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [ |
| 42 | 42 | 'min' => $args['rating'], |
| 43 | 43 | ]); |
| 44 | - if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return; |
|
| 44 | + if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts ); |
| 46 | 48 | $this->generateSchema(); |
| 47 | 49 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -61,7 +63,9 @@ discard block |
||
| 61 | 63 | */ |
| 62 | 64 | protected function buildPercentage() |
| 63 | 65 | { |
| 64 | - if( $this->isHidden( 'bars' ))return; |
|
| 66 | + if( $this->isHidden( 'bars' )) { |
|
| 67 | + return; |
|
| 68 | + } |
|
| 65 | 69 | $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts )); |
| 66 | 70 | $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) { |
| 67 | 71 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
@@ -110,7 +114,9 @@ discard block |
||
| 110 | 114 | */ |
| 111 | 115 | protected function buildRating() |
| 112 | 116 | { |
| 113 | - if( $this->isHidden( 'rating' ))return; |
|
| 117 | + if( $this->isHidden( 'rating' )) { |
|
| 118 | + return; |
|
| 119 | + } |
|
| 114 | 120 | return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' ); |
| 115 | 121 | } |
| 116 | 122 | |
@@ -119,7 +125,9 @@ discard block |
||
| 119 | 125 | */ |
| 120 | 126 | protected function buildStars() |
| 121 | 127 | { |
| 122 | - if( $this->isHidden( 'stars' ))return; |
|
| 128 | + if( $this->isHidden( 'stars' )) { |
|
| 129 | + return; |
|
| 130 | + } |
|
| 123 | 131 | $stars = glsr( Partial::class )->build( 'star-rating', ['rating' => $this->averageRating] ); |
| 124 | 132 | return $this->wrap( 'stars', $stars ); |
| 125 | 133 | } |
@@ -129,7 +137,9 @@ discard block |
||
| 129 | 137 | */ |
| 130 | 138 | protected function buildText() |
| 131 | 139 | { |
| 132 | - if( $this->isHidden( 'summary' ))return; |
|
| 140 | + if( $this->isHidden( 'summary' )) { |
|
| 141 | + return; |
|
| 142 | + } |
|
| 133 | 143 | $count = intval( array_sum( $this->ratingCounts )); |
| 134 | 144 | if( empty( $this->args['text'] )) { |
| 135 | 145 | // @todo document this change |
@@ -154,7 +164,9 @@ discard block |
||
| 154 | 164 | */ |
| 155 | 165 | protected function generateSchema() |
| 156 | 166 | { |
| 157 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 167 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
| 168 | + return; |
|
| 169 | + } |
|
| 158 | 170 | glsr( Schema::class )->store( |
| 159 | 171 | glsr( Schema::class )->buildSummary( $this->args ) |
| 160 | 172 | ); |
@@ -20,7 +20,9 @@ |
||
| 20 | 20 | public function build( array $args = [] ) |
| 21 | 21 | { |
| 22 | 22 | $this->args = $this->normalize( $args ); |
| 23 | - if( $this->args['total'] < 2 )return; |
|
| 23 | + if( $this->args['total'] < 2 ) { |
|
| 24 | + return; |
|
| 25 | + } |
|
| 24 | 26 | return glsr( Template::class )->build( 'templates/pagination', [ |
| 25 | 27 | 'context' => [ |
| 26 | 28 | 'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ), |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | 'loader' => '<div class="glsr-loader"></div>', |
| 28 | 28 | 'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ), |
| 29 | 29 | ], |
| 30 | - ]); |
|
| 30 | + ] ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function buildLinks() |
| 37 | 37 | { |
| 38 | - $args = glsr( Style::class )->paginationArgs([ |
|
| 38 | + $args = glsr( Style::class )->paginationArgs( [ |
|
| 39 | 39 | 'current' => $this->args['paged'], |
| 40 | 40 | 'total' => $this->args['total'], |
| 41 | - ]); |
|
| 41 | + ] ); |
|
| 42 | 42 | if( is_front_page() ) { |
| 43 | - unset( $args['format'] ); |
|
| 43 | + unset($args['format']); |
|
| 44 | 44 | } |
| 45 | 45 | if( $args['type'] == 'array' ) { |
| 46 | 46 | $args['type'] = 'plain'; |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | return wp_parse_args( $args, [ |
| 57 | 57 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
| 58 | 58 | 'total' => 1, |
| 59 | - ]); |
|
| 59 | + ] ); |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | 'navigation' => $navigation, |
| 58 | 58 | 'reviews' => $this->buildReviews(), |
| 59 | 59 | ], |
| 60 | - ]); |
|
| 60 | + ] ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | $reviews = ''; |
| 69 | 69 | foreach( $this->reviews->results as $index => $result ) { |
| 70 | 70 | $this->current = $index; |
| 71 | - $reviews.= glsr( Template::class )->build( 'templates/review', [ |
|
| 71 | + $reviews .= glsr( Template::class )->build( 'templates/review', [ |
|
| 72 | 72 | 'context' => $this->buildReview( $result )->values, |
| 73 | - ]); |
|
| 73 | + ] ); |
|
| 74 | 74 | } |
| 75 | 75 | return $reviews; |
| 76 | 76 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $renderedFields = []; |
| 86 | 86 | foreach( $review as $key => $value ) { |
| 87 | 87 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
| 88 | - if( !method_exists( $this, $method ))continue; |
|
| 88 | + if( !method_exists( $this, $method ) )continue; |
|
| 89 | 89 | $renderedFields[$key] = $this->$method( $key, $value ); |
| 90 | 90 | } |
| 91 | 91 | $renderedFields = apply_filters( 'site-reviews/review/build/after', (array)$renderedFields ); |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | protected function buildOptionAssignedTo( $key, $value ) |
| 101 | 101 | { |
| 102 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
| 102 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return; |
|
| 103 | 103 | $post = glsr( Polylang::class )->getPost( $value ); |
| 104 | - if( !( $post instanceof WP_Post ))return; |
|
| 104 | + if( !($post instanceof WP_Post) )return; |
|
| 105 | 105 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 106 | 106 | 'href' => get_the_permalink( $post->ID ), |
| 107 | - ]); |
|
| 107 | + ] ); |
|
| 108 | 108 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
| 109 | 109 | return $this->wrap( $key, '<span>'.$assignedTo.'</span>' ); |
| 110 | 110 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | protected function buildOptionAuthor( $key, $value ) |
| 118 | 118 | { |
| 119 | - if( $this->isHidden( $key ))return; |
|
| 119 | + if( $this->isHidden( $key ) )return; |
|
| 120 | 120 | return $this->wrap( $key, '<span>'.$value.'</span>' ); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function buildOptionAvatar( $key, $value ) |
| 129 | 129 | { |
| 130 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
| 130 | + if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return; |
|
| 131 | 131 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
| 132 | - return $this->wrap( $key, glsr( Builder::class )->img([ |
|
| 132 | + return $this->wrap( $key, glsr( Builder::class )->img( [ |
|
| 133 | 133 | 'src' => $this->generateAvatar( $value ), |
| 134 | 134 | 'height' => $size, |
| 135 | 135 | 'width' => $size, |
| 136 | - ])); |
|
| 136 | + ] ) ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | protected function buildOptionContent( $key, $value ) |
| 145 | 145 | { |
| 146 | 146 | $text = $this->normalizeText( $value ); |
| 147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 147 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
| 148 | 148 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected function buildOptionDate( $key, $value ) |
| 157 | 157 | { |
| 158 | - if( $this->isHidden( $key ))return; |
|
| 158 | + if( $this->isHidden( $key ) )return; |
|
| 159 | 159 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 160 | 160 | if( $dateFormat == 'relative' ) { |
| 161 | 161 | $date = glsr( Date::class )->relative( $value ); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $format = $dateFormat == 'custom' |
| 165 | 165 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
| 166 | 166 | : (string)get_option( 'date_format' ); |
| 167 | - $date = date_i18n( $format, strtotime( $value )); |
|
| 167 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
| 168 | 168 | } |
| 169 | 169 | return $this->wrap( $key, '<span>'.$date.'</span>' ); |
| 170 | 170 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function buildOptionRating( $key, $value ) |
| 178 | 178 | { |
| 179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 179 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
| 180 | 180 | $rating = glsr( Partial::class )->build( 'star-rating', [ |
| 181 | 181 | 'rating' => $value, |
| 182 | - ]); |
|
| 182 | + ] ); |
|
| 183 | 183 | return $this->wrap( $key, $rating ); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | protected function buildOptionResponse( $key, $value ) |
| 192 | 192 | { |
| 193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 194 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
| 193 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
| 194 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
| 195 | 195 | $text = $this->normalizeText( $value ); |
| 196 | 196 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
| 197 | 197 | return $this->wrap( $key, |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function buildOptionTitle( $key, $value ) |
| 209 | 209 | { |
| 210 | - if( $this->isHidden( $key ))return; |
|
| 211 | - if( empty( $value )) { |
|
| 210 | + if( $this->isHidden( $key ) )return; |
|
| 211 | + if( empty($value) ) { |
|
| 212 | 212 | $value = __( 'No Title', 'site-reviews' ); |
| 213 | 213 | } |
| 214 | 214 | return $this->wrap( $key, '<h3>'.$value.'</h3>' ); |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | return $avatarUrl; |
| 226 | 226 | } |
| 227 | 227 | $authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id ); |
| 228 | - if( empty( $authorIdOrEmail )) { |
|
| 228 | + if( empty($authorIdOrEmail) ) { |
|
| 229 | 229 | $authorIdOrEmail = $review->email; |
| 230 | 230 | } |
| 231 | - if( $newAvatar = get_avatar_url( $authorIdOrEmail )) { |
|
| 231 | + if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) { |
|
| 232 | 232 | return $newAvatar; |
| 233 | 233 | } |
| 234 | 234 | return $avatarUrl; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | protected function generateSchema() |
| 241 | 241 | { |
| 242 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 242 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
| 243 | 243 | glsr( Schema::class )->store( |
| 244 | 244 | glsr( Schema::class )->build( $this->args ) |
| 245 | 245 | ); |
@@ -262,18 +262,18 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | protected function getExcerpt( $text ) |
| 264 | 264 | { |
| 265 | - $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 )); |
|
| 265 | + $limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) ); |
|
| 266 | 266 | $split = extension_loaded( 'intl' ) |
| 267 | 267 | ? $this->getExcerptIntlSplit( $text, $limit ) |
| 268 | 268 | : $this->getExcerptSplit( $text, $limit ); |
| 269 | 269 | $hiddenText = substr( $text, $split ); |
| 270 | - if( !empty( $hiddenText )) { |
|
| 270 | + if( !empty($hiddenText) ) { |
|
| 271 | 271 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
| 272 | 272 | 'class' => 'glsr-hidden glsr-hidden-text', |
| 273 | 273 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
| 274 | 274 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
| 275 | - ]); |
|
| 276 | - $text = ltrim( substr( $text, 0, $split )).$showMore; |
|
| 275 | + ] ); |
|
| 276 | + $text = ltrim( substr( $text, 0, $split ) ).$showMore; |
|
| 277 | 277 | } |
| 278 | 278 | return nl2br( $text ); |
| 279 | 279 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $words = IntlRuleBasedBreakIterator::createWordInstance( '' ); |
| 289 | 289 | $words->setText( $text ); |
| 290 | 290 | $count = 0; |
| 291 | - foreach( $words as $offset ){ |
|
| 291 | + foreach( $words as $offset ) { |
|
| 292 | 292 | if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
| 293 | 293 | $count++; |
| 294 | 294 | if( $count != $limit )continue; |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | protected function getExcerptSplit( $text, $limit ) |
| 306 | 306 | { |
| 307 | 307 | if( str_word_count( $text, 0 ) > $limit ) { |
| 308 | - $words = array_keys( str_word_count( $text, 2 )); |
|
| 308 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
| 309 | 309 | return $words[$limit]; |
| 310 | 310 | } |
| 311 | 311 | return strlen( $text ); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | protected function getOption( $path, $fallback = '' ) |
| 320 | 320 | { |
| 321 | - if( array_key_exists( $path, $this->options )) { |
|
| 321 | + if( array_key_exists( $path, $this->options ) ) { |
|
| 322 | 322 | return $this->options[$path]; |
| 323 | 323 | } |
| 324 | 324 | return $fallback; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | protected function isHidden( $key, $path = '' ) |
| 333 | 333 | { |
| 334 | - $isOptionEnabled = !empty( $path ) |
|
| 334 | + $isOptionEnabled = !empty($path) |
|
| 335 | 335 | ? $this->isOptionEnabled( $path ) |
| 336 | 336 | : true; |
| 337 | 337 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | protected function isHiddenOrEmpty( $key, $value ) |
| 346 | 346 | { |
| 347 | - return $this->isHidden( $key ) || empty( $value ); |
|
| 347 | + return $this->isHidden( $key ) || empty($value); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | protected function normalizeText( $text ) |
| 364 | 364 | { |
| 365 | 365 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
| 366 | - $text = convert_smilies( strip_shortcodes( $text )); |
|
| 366 | + $text = convert_smilies( strip_shortcodes( $text ) ); |
|
| 367 | 367 | $text = str_replace( ']]>', ']]>', $text ); |
| 368 | 368 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
| 369 | - if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) { |
|
| 369 | + if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) { |
|
| 370 | 370 | $text = $this->getExcerpt( $text ); |
| 371 | 371 | } |
| 372 | 372 | return wptexturize( $text ); |
@@ -381,6 +381,6 @@ discard block |
||
| 381 | 381 | { |
| 382 | 382 | return glsr( Builder::class )->div( $value, [ |
| 383 | 383 | 'class' => 'glsr-review-'.$key, |
| 384 | - ]); |
|
| 384 | + ] ); |
|
| 385 | 385 | } |
| 386 | 386 | } |
@@ -85,7 +85,9 @@ discard block |
||
| 85 | 85 | $renderedFields = []; |
| 86 | 86 | foreach( $review as $key => $value ) { |
| 87 | 87 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
| 88 | - if( !method_exists( $this, $method ))continue; |
|
| 88 | + if( !method_exists( $this, $method )) { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 89 | 91 | $renderedFields[$key] = $this->$method( $key, $value ); |
| 90 | 92 | } |
| 91 | 93 | $renderedFields = apply_filters( 'site-reviews/review/build/after', (array)$renderedFields ); |
@@ -99,9 +101,13 @@ discard block |
||
| 99 | 101 | */ |
| 100 | 102 | protected function buildOptionAssignedTo( $key, $value ) |
| 101 | 103 | { |
| 102 | - if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return; |
|
| 104 | + if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) { |
|
| 105 | + return; |
|
| 106 | + } |
|
| 103 | 107 | $post = glsr( Polylang::class )->getPost( $value ); |
| 104 | - if( !( $post instanceof WP_Post ))return; |
|
| 108 | + if( !( $post instanceof WP_Post )) { |
|
| 109 | + return; |
|
| 110 | + } |
|
| 105 | 111 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
| 106 | 112 | 'href' => get_the_permalink( $post->ID ), |
| 107 | 113 | ]); |
@@ -116,7 +122,9 @@ discard block |
||
| 116 | 122 | */ |
| 117 | 123 | protected function buildOptionAuthor( $key, $value ) |
| 118 | 124 | { |
| 119 | - if( $this->isHidden( $key ))return; |
|
| 125 | + if( $this->isHidden( $key )) { |
|
| 126 | + return; |
|
| 127 | + } |
|
| 120 | 128 | return $this->wrap( $key, '<span>'.$value.'</span>' ); |
| 121 | 129 | } |
| 122 | 130 | |
@@ -127,7 +135,9 @@ discard block |
||
| 127 | 135 | */ |
| 128 | 136 | protected function buildOptionAvatar( $key, $value ) |
| 129 | 137 | { |
| 130 | - if( $this->isHidden( $key, 'settings.reviews.avatars' ))return; |
|
| 138 | + if( $this->isHidden( $key, 'settings.reviews.avatars' )) { |
|
| 139 | + return; |
|
| 140 | + } |
|
| 131 | 141 | $size = $this->getOption( 'settings.reviews.avatars_size', 40 ); |
| 132 | 142 | return $this->wrap( $key, glsr( Builder::class )->img([ |
| 133 | 143 | 'src' => $this->generateAvatar( $value ), |
@@ -144,7 +154,9 @@ discard block |
||
| 144 | 154 | protected function buildOptionContent( $key, $value ) |
| 145 | 155 | { |
| 146 | 156 | $text = $this->normalizeText( $value ); |
| 147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
| 157 | + if( $this->isHiddenOrEmpty( $key, $text )) { |
|
| 158 | + return; |
|
| 159 | + } |
|
| 148 | 160 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
| 149 | 161 | } |
| 150 | 162 | |
@@ -155,7 +167,9 @@ discard block |
||
| 155 | 167 | */ |
| 156 | 168 | protected function buildOptionDate( $key, $value ) |
| 157 | 169 | { |
| 158 | - if( $this->isHidden( $key ))return; |
|
| 170 | + if( $this->isHidden( $key )) { |
|
| 171 | + return; |
|
| 172 | + } |
|
| 159 | 173 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
| 160 | 174 | if( $dateFormat == 'relative' ) { |
| 161 | 175 | $date = glsr( Date::class )->relative( $value ); |
@@ -176,7 +190,9 @@ discard block |
||
| 176 | 190 | */ |
| 177 | 191 | protected function buildOptionRating( $key, $value ) |
| 178 | 192 | { |
| 179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 193 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 194 | + return; |
|
| 195 | + } |
|
| 180 | 196 | $rating = glsr( Partial::class )->build( 'star-rating', [ |
| 181 | 197 | 'rating' => $value, |
| 182 | 198 | ]); |
@@ -190,7 +206,9 @@ discard block |
||
| 190 | 206 | */ |
| 191 | 207 | protected function buildOptionResponse( $key, $value ) |
| 192 | 208 | { |
| 193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
| 209 | + if( $this->isHiddenOrEmpty( $key, $value )) { |
|
| 210 | + return; |
|
| 211 | + } |
|
| 194 | 212 | $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
| 195 | 213 | $text = $this->normalizeText( $value ); |
| 196 | 214 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
@@ -207,7 +225,9 @@ discard block |
||
| 207 | 225 | */ |
| 208 | 226 | protected function buildOptionTitle( $key, $value ) |
| 209 | 227 | { |
| 210 | - if( $this->isHidden( $key ))return; |
|
| 228 | + if( $this->isHidden( $key )) { |
|
| 229 | + return; |
|
| 230 | + } |
|
| 211 | 231 | if( empty( $value )) { |
| 212 | 232 | $value = __( 'No Title', 'site-reviews' ); |
| 213 | 233 | } |
@@ -239,7 +259,9 @@ discard block |
||
| 239 | 259 | */ |
| 240 | 260 | protected function generateSchema() |
| 241 | 261 | { |
| 242 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
| 262 | + if( !wp_validate_boolean( $this->args['schema'] )) { |
|
| 263 | + return; |
|
| 264 | + } |
|
| 243 | 265 | glsr( Schema::class )->store( |
| 244 | 266 | glsr( Schema::class )->build( $this->args ) |
| 245 | 267 | ); |
@@ -289,9 +311,13 @@ discard block |
||
| 289 | 311 | $words->setText( $text ); |
| 290 | 312 | $count = 0; |
| 291 | 313 | foreach( $words as $offset ){ |
| 292 | - if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue; |
|
| 314 | + if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) { |
|
| 315 | + continue; |
|
| 316 | + } |
|
| 293 | 317 | $count++; |
| 294 | - if( $count != $limit )continue; |
|
| 318 | + if( $count != $limit ) { |
|
| 319 | + continue; |
|
| 320 | + } |
|
| 295 | 321 | return $offset; |
| 296 | 322 | } |
| 297 | 323 | return strlen( $text ); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | 'avatar' => '', |
| 19 | 19 | 'content' => '', |
| 20 | 20 | 'custom' => '', |
| 21 | - 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )), |
|
| 21 | + 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) ), |
|
| 22 | 22 | 'email' => '', |
| 23 | 23 | 'ip_address' => glsr( Helper::class )->getIpAddress(), |
| 24 | 24 | 'pinned' => false, |