PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
wiloke-listing-tools
/
app
/
Framework
/
Helpers
<?php namespace WilokeListingTools\Framework\Helpers; use WilokeListingTools\Models\BusinessHourMeta; class SetSettings { public static function setTransient($key, $val, $expiration) { set_transient($key, maybe_serialize($val), $expiration); } public static function deleteTransient($key) { delete_transient($key); } public static function setPrefix($metaKey, $prefix) { $prefix = empty($prefix) ? wilokeListingToolsRepository()->get('general:metaboxPrefix') : $prefix; $metaKey = strpos($metaKey, $prefix) === false ? $prefix.$metaKey : $metaKey; return $metaKey; } /** * We will use cache in the feature * * @param number $postID * @param string $metaKey * * @return mixed */ public static function setPostMeta($postID, $metaKey, $val, $prefix = null, $isFocusAdd = false) { $metaKey = self::setPrefix($metaKey, $prefix); if ($metaKey == 'wilcity_hourMode' || $metaKey == 'hourMode') { return BusinessHourMeta::update($postID, $metaKey, $val); } else { if ($isFocusAdd) { delete_post_meta($postID, $metaKey); return add_post_meta($postID, $metaKey, $val); } return update_post_meta($postID, $metaKey, $val); } } public static function addPostMeta($postID, $metaKey, $val, $prefix = null) { $metaKey = self::setPrefix($metaKey, $prefix); return add_post_meta($postID, $metaKey, $val); } public static function deletePostMeta($postID, $metaKey, $prefix = null) { $metaKey = self::setPrefix($metaKey, $prefix); if ($metaKey == 'wilcity_hourMode' || $metaKey == 'hourMode') { BusinessHourMeta::delete($postID, $metaKey); } else { delete_post_meta($postID, $metaKey); } } /** * Get User Meta * * @param number $userID * @param string $metaKey * * @return mixed */ public static function setUserMeta($userID, $metaKey, $value, $prefix = '') { $metaKey = self::setPrefix($metaKey, $prefix); update_user_meta($userID, $metaKey, $value); } public static function setCommentMeta($commentID, $metaKey, $value, $prefix = '') { $metaKey = self::setPrefix($metaKey, $prefix); update_comment_meta($commentID, $metaKey, $value); } public static function setPlanSettings($planID, $metaValue) { $postType = get_post_type($planID); $metaKey = 'add_'.$postType; return self::setPostMeta($planID, $metaKey, $metaValue); } public static function deleteUserPlan($userID) { $metaKey = wilokeListingToolsRepository()->get('user:userPlans'); delete_user_meta($userID, $metaKey); } public static function setUserPlans($userID, $value, $prefix = '') { $metaKey = wilokeListingToolsRepository()->get('user:userPlans'); self::setUserMeta($userID, $metaKey, $value, $prefix); } public static function deleteUserMeta($userID, $metaKey, $prefix = '') { $metaKey = self::setPrefix($metaKey, $prefix); delete_user_meta($userID, $metaKey); return true; } public static function deleteUserPlans($userID) { $metaKey = wilokeListingToolsRepository()->get('user:userPlans'); self::deleteUserMeta($userID, $metaKey); } public static function setOptions($key, $value) { update_option($key, maybe_serialize($value)); } public static function deleteOption($key) { delete_option($key); } public static function setTermsBelongsToPostType($postType, $taxonomy, $aTermIDs) { $key = $taxonomy.'_belongs_to_'.$postType; self::setOptions($key, $aTermIDs); } public static function updateTermsBelongsToPostType($postType, $taxonomy, $termID) { $aTermChildren = GetSettings::getTermsBelongsToPostType($postType, $taxonomy); $aTermChildren = empty($aTermChildren) ? [] : $aTermChildren; if (!in_array($termID, $aTermChildren)) { $aTermChildren[] = $termID; } self::setTermsBelongsToPostType($postType, $taxonomy, $aTermChildren); } public static function removeTermsFromDirectoryType($postType, $taxonomy, $termID) { $aTermChildren = GetSettings::getTermsBelongsToPostType($postType, $taxonomy, false, false, false); if (!empty($aTermChildren)) { $findKey = array_search($termID, $aTermChildren); unset($aTermChildren[$findKey]); } self::setTermsBelongsToPostType($postType, $taxonomy, $aTermChildren); } }
[+]
..
[-] 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]