PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
wiloke-listing-tools
/
app
/
Framework
/
Helpers
<?php namespace WilokeListingTools\Framework\Helpers; class SearchFieldSkeleton { protected $aFields; protected $oAddListingFields; protected $postType; /** * @param array $aFields * * @return $this */ public function setFields(array $aFields) { $this->aFields = $aFields; return $this; } /** * @param $postType * * @return $this */ public function setPostType($postType) { $this->postType = $postType; return $this; } private function generateFunction($key) { $aParse = explode('_', $key); $aParse = array_map(function ($item) { return ucfirst($item); }, $aParse); return 'get'.implode('', $aParse); } protected function getPostType($aField) { $aTypes = General::getPostTypes(false); foreach ($aTypes as $directoryType => $aType) { $aOption['label'] = $aType['name']; $aOption['id'] = $directoryType; $aField['options'][] = $aOption; } $aField['loadOptionMode'] = 'default'; return $aField; } protected function getEventFilter($aField) { $aAllEventFilters = wilokeListingToolsRepository() ->get('listing-settings:searchFields', true) ->sub('event_filter', true) ->sub('options', false) ; $aOptions = []; foreach ($aField['options'] as $option) { $aOptions[] = [ 'label' => $aAllEventFilters[$option], 'id' => $option ]; } $aField['options'] = $aOptions; $aField['loadOptionMode'] = 'default'; return $aField; } private function getCustomSearchFieldOptions($aSearchField, $postType) { if (empty($this->oAddListingFields)) { $this->oAddListingFields = new AddListingFieldSkeleton($postType); } $options = $this->oAddListingFields->getFieldParam($aSearchField['key'], 'fieldGroups->settings->options'); if (empty($options)) { return null; } return General::parseSelectFieldOptions($options, 'wil-select-tree'); } protected function getCustomDropdown($aField) { $aField['options'] = $this->getCustomSearchFieldOptions($aField, $this->postType); $aField['childType'] = 'wil-checkbox'; return $aField; } /** * @param $aField * * @return mixed */ protected function getOrderby($aField) { if (!empty($aField['options'])) { $aOrderBy = wilokeListingToolsRepository()->get('listing-settings:orderby', false); $aOptions = []; foreach ($aField['options'] as $option) { $aOptions[] = [ 'label' => $aOrderBy[$option], 'id' => $option ]; } $aField['options'] = $aOptions; $aField['loadOptionMode'] = 'default'; } return $aField; } protected function getOrder($aField) { if (!isset($aField['options'])) { $aField['options'] = [ [ 'label' => esc_html__('DESC', 'wiloke-listing-tools'), 'id' => 'DESC' ], [ 'label' => esc_html__('ASC', 'wiloke-listing-tools'), 'id' => 'ASC' ] ]; $aField['loadOptionMode'] = 'default'; } return $aField; } protected function getPriceRange($aField) { foreach (wilokeListingToolsRepository()->get('general:priceRange') as $rangeKey => $rangeName) { $aOptions['label'] = $rangeName; $aOptions['id'] = $rangeKey; $aField['options'][] = $aOptions; } return $aField; } public function getField($aField) { if (isset($aField['originalKey'])) { $originalKey = $aField['originalKey']; } else { $originalKey = $aField['key']; } $method = $this->generateFunction($originalKey); if (method_exists(__CLASS__, $method)) { return $this->{$method}($aField); } return false; } }
[+]
..
[-] 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]