PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
wiloke-listing-tools
/
app
/
Framework
/
Helpers
<?php namespace WilokeListingTools\Framework\Helpers; use WilokeListingTools\Framework\Helpers\Collection\ArrayCollection; class SearchFormSkeleton { private $postType; private $searchKey; private $aCacheFields = []; private $aSearchFields; private $aCustomSearchFields; private $aCustomTaxonomies; public function __construct($postType) { $this->postType = $postType; $this->setSearchKey(); $this->setFields(); } private function rebuildSearchFields($aFields) { $oCollection = new ArrayCollection($aFields); return $oCollection->magicKeyGroup('key')->output(); } private function setSearchKey() { $this->searchKey = General::getSearchFieldsKey($this->postType); } private function setFields(): void { if (!isset($this->aCacheFields[$this->postType])) { $aSearchForm = GetSettings::getOptions($this->searchKey); if (empty($aSearchForm)) { $this->aCacheFields[$this->postType] = []; } else { $this->aCacheFields[$this->postType] = $aSearchForm; } } $this->aSearchFields = $this->rebuildSearchFields($this->aCacheFields[$this->postType]); } public function getFields(): ?array { return $this->aSearchFields; } public function getCustomDropdowns() { if (!isset($this->aCustomSearchFields[$this->postType])) { $this->aCustomSearchFields[$this->postType] = array_filter($this->aSearchFields, function ($aItem) { return isset($aItem['originalKey']) && $aItem['originalKey'] === 'custom_dropdown'; }); } return $this->aCustomSearchFields[$this->postType]; } public function getCustomTaxonomies() { if (!isset($this->aCustomTaxonomies[$this->postType])) { $this->aCustomTaxonomies[$this->postType] = array_filter($this->aSearchFields, function ($aItem) { return isset($aItem['group']) && $aItem['group'] === 'term' && !in_array($aItem['group'], ['listing_cat', 'listing_location', 'listing_tag']); }); } return $this->aCustomTaxonomies[$this->postType]; } public function getCustomDropdownKeys() { $aCustomFields = $this->getCustomDropdowns(); if (empty($aCustomFields)) { return []; } return array_reduce($aCustomFields, function ($aCarry, $aField) { array_push($aCarry, $aField['key']); return $aCarry; }, []); } public function getCustomTaxonomiesKeys() { $aCustomFields = $this->getCustomTaxonomies(); if (empty($aCustomFields)) { return []; } return array_reduce($aCustomFields, function ($aCarry, $aField) { return $aCarry + [$aField['key']]; }, []); } /** * @param $fieldKey * * @return array|null */ public function getField($fieldKey): ?array { return isset($this->aSearchFields[$fieldKey]) ? $this->aSearchFields[$fieldKey] : null; } public function getFieldParam($fieldKey, $param) { $aField = $this->getField($fieldKey); if (empty($aField)) { return null; } $oCollection = new ArrayCollection($aField); return $oCollection->deepPluck($param)->output(); } }
[+]
..
[-] 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]