PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
wiloke-listing-tools
/
app
/
Framework
/
Helpers
<?php namespace WilokeListingTools\Framework\Helpers; use WILCITY_SC\SCHelpers; use WilokeListingTools\Controllers\ReviewController; use WilokeListingTools\Framework\Helpers\Collection\ArrayCollectionFactory; use WilokeListingTools\Frontend\BusinessHours; use WilokeListingTools\Frontend\SingleListing; use WilokeListingTools\Frontend\User; use WilokeListingTools\Models\FollowerModel; use WilokeListingTools\Models\ReviewMetaModel; use WilokeListingTools\Models\ReviewModel; use WilokeListingTools\Models\UserModel; final class ReviewSkeleton extends AbstractSkeleton { protected function getAuthor() { $oAuthorSkeleton = new AuthorSkeleton(); return $oAuthorSkeleton->getSkeleton($this->getPostAuthor(), ['ID', 'avatar', 'displayName', 'authorLink']); } protected function getMode(): int { return ReviewModel::getReviewMode(get_post_type($this->getParentID())); } protected function getID(): int { return abs($this->post->ID); } protected function getDetails(): array { if ($aReviewDetails = $this->getCache('review_details')) { return $aReviewDetails; } $postType = get_post_type($this->getParentID()); $aCategories = GetSettings::getOptions(General::getReviewKey('details', $postType)); if ($aCategories) { $aReviewDetails = ReviewMetaModel::getReviewDetailsScore($this->postID, $aCategories, false); $this->setCache('review_details', $aReviewDetails['oDetails']); return $aReviewDetails['oDetails']; } return []; } protected function getAverage(): float { if ($this->getCache('average')) { return $this->getCache('average'); } $aReviewDetails = $this->getDetails(); if (empty($aReviewDetails)) { return 0; } $totalReviewItems = count($aReviewDetails); $totalScore = array_reduce($aReviewDetails, function ($score, $aItem) { return $score + $aItem['score']; }, 0); $average = round($totalScore / $totalReviewItems, 1); $this->setCache('average', $average); return $average; } protected function getQuality(): ?string { if ($this->getCache('quality')) { return $this->getCache('quality'); } $average = $this->getAverage(); if (empty($average)) { return ''; } $reviewQuality = ReviewMetaModel::getReviewQualityString($average, get_post_type($this->getParentID())); $this->setCache('quality', $reviewQuality); return $reviewQuality; } protected function getIsLiked(): string { return ReviewModel::isLikedReview($this->getID(), true); } protected function getIsPinToTop(): string { return !empty($this->post->menu_order) ? 'yes' : 'no'; } protected function getIsParentAuthor(): string { return get_current_user_id() == get_post_field('post_author', $this->getParentID()) ? 'yes' : 'no'; } protected function getIsPintToTop(): string { return !empty($this->post->menu_order) ? 'yes' : 'no'; } protected function getCountLiked(): int { $aLikedReview = GetSettings::getPostMeta($this->postID, wilokeListingToolsRepository()->get('reviews:liked')); if (empty($aLikedReview)) { return 0; } return count($aLikedReview); } protected function getCountDiscussion(): int { return abs(ReviewModel::countDiscussion($this->postID)); } public function getSkeleton($post, $aPluck, $aAtts = []) { if (empty($aPluck)) { $aPluck = [ 'ID', 'title', 'permalink', ]; } else { $aPluck = is_array($aPluck) ? $aPluck : explode(',', $aPluck); $aPluck = array_map(function ($key) { return $key; }, $aPluck); } if (is_numeric($post)) { $post = get_post($post); } $this->setPost($post); $this->aAtts = $aAtts; /** * @hooked WilcityRedis\Controllers@removeCachingPluckItems */ $aPluck = apply_filters( 'wilcity/filter/wiloke-listing-tools/app/Framework/Helpers/ReviewSkeleton/pluck', $aPluck, $post, $this->aAtts ); $aReview = $this->pluck($aPluck); /** * @hooked WilcityRedis\Controllers@getPostSkeleton 5 * @hooked WilcityRedis\Controllers@setPostSkeleton 10 */ $aReview = apply_filters( 'wilcity/filter/wiloke-listing-tools/app/Framework/Helpers/ReviewSkeleton/review', $aReview, $post, $this->aAtts ); return $aReview; } }
[+]
..
[-] SearchFieldSkeleton.php
[edit]
[-] FileSystem.php
[edit]
[-] Response.php
[edit]
[-] GetWilokeSubmission.php
[edit]
[-] AbstractSkeleton.php
[edit]
[-] InheritCMB2Styles.php
[edit]
[-] ReviewSkeleton.php
[edit]
[-] RestaurantMenu.php
[edit]
[-] WooCommerce.php
[edit]
[-] MapHelpers.php
[edit]
[-] .DS_Store
[edit]
[-] Message.php
[edit]
[-] GetSettings.php
[edit]
[-] QueryHelper.php
[edit]
[+]
Collection
[-] Inc.php
[edit]
[-] UserSkeleton.php
[edit]
[-] Firebase.php
[edit]
[-] Repository.php
[edit]
[-] DebugStatus.php
[edit]
[-] MapFactory.php
[edit]
[-] SetSettings.php
[edit]
[-] AddListingFieldSkeleton.php
[edit]
[-] VideoHelper.php
[edit]
[-] SearchFormSkeleton.php
[edit]
[-] PostSkeleton.php
[edit]
[-] KCHelpers.php
[edit]
[-] ProductSkeleton.php
[edit]
[-] QRCodeGenerator.php
[edit]
[-] HTML.php
[edit]
[-] Time.php
[edit]
[-] PlanHelper.php
[edit]
[-] SemanticUi.php
[edit]
[-] AjaxMsg.php
[edit]
[-] Logger.php
[edit]
[-] Cookie.php
[edit]
[-] Validation.php
[edit]
[-] GalleryHelper.php
[edit]
[-] AuthorSkeleton.php
[edit]
[-] General.php
[edit]
[-] Submission.php
[edit]
[-] TermSetting.php
[edit]