PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
wiloke-listing-tools
/
app
/
Controllers
<?php namespace WilokeListingTools\Controllers; use WilokeListingTools\AlterTable\AlterTableFollower; use WilokeListingTools\Framework\Helpers\General; use WilokeListingTools\Framework\Helpers\HTML; use WilokeListingTools\Framework\Helpers\Time; use WilokeListingTools\Framework\Routing\Controller; use WilokeListingTools\Frontend\User; use WilokeListingTools\Models\FollowerModel; class FollowController extends Controller { public static $isIamFollowing = null; public function __construct() { add_action('wp_ajax_wilcity_update_following', [$this, 'updateFollow']); } public static function toggleFollow() { global $wiloke; return $wiloke->aThemeOptions['general_toggle_follow'] == 'enable'; } public static function isIamFollowing($authorID) { if (!is_user_logged_in()) { return false; } if (self::$isIamFollowing !== null) { return self::$isIamFollowing; } global $wpdb; $followTbl = $wpdb->prefix.AlterTableFollower::$tblName; self::$isIamFollowing = $wpdb->get_var( $wpdb->prepare( "SELECT followerID FROM $followTbl WHERE authorID=%d AND followerID=%d", $authorID, get_current_user_id() ) ); return self::$isIamFollowing; } public static function insertFollower($authorID) { global $wpdb; $followTbl = $wpdb->prefix.AlterTableFollower::$tblName; return $wpdb->insert( $followTbl, [ 'authorID' => $authorID, 'followerID' => get_current_user_id(), 'date' => Time::mysqlDateTime() ], [ '%d', '%d', '%s' ] ); } public static function deleteFollower($authorID) { global $wpdb; $followTbl = $wpdb->prefix.AlterTableFollower::$tblName; return $wpdb->delete( $followTbl, [ 'authorID' => $authorID, 'followerID' => get_current_user_id() ], [ '%d', '%d' ] ); } public static function countFollowings($authorID = null, $isStyleNumber = false) { return FollowerModel::countFollowings($authorID, $isStyleNumber); } public static function countFollowers($authorID = null, $isStyleNumber = false) { return FollowerModel::countFollowers($authorID, $isStyleNumber); } public function updateFollow() { if (!is_user_logged_in()) { wp_send_json_error([ 'msg' => esc_html__('Please log into your account before following', 'wiloke-listing-tool') ]); } if (!isset($_POST['authorID']) || empty($_POST['authorID'])) { wp_send_json_error([ 'msg' => esc_html__('The author data is required.', 'wiloke-listing-tool') ]); } if (get_current_user_id() == $_POST['authorID']) { wp_send_json_error([ 'msg' => esc_html__('You can not follow yourself.', 'wiloke-listing-tool') ]); } $status = self::isIamFollowing($_POST['authorID']); if ($status) { self::deleteFollower($_POST['authorID']); } else { self::insertFollower($_POST['authorID']); do_action('wilcity/wiloke-listing-tools/app/Controllers/FollowController/new-follower', User::getCurrentUserID(), $_POST['authorID']); } $total = self::countFollowers($_POST['authorID']); wp_send_json_success(HTML::reStyleText($total)); } }
[+]
..
[-] WebhookController.php
[edit]
[-] SetCoupon.php
[edit]
[-] TermController.php
[edit]
[-] PostController.php
[edit]
[-] SetMyPosts.php
[edit]
[-] NotificationsController.php
[edit]
[-] AjaxUploadImgController.php
[edit]
[-] TaxonomiesControllers.php
[edit]
[-] FavoriteStatisticController.php
[edit]
[-] BelongsToCustomTaxonomies.php
[edit]
[-] DashboardController.php
[edit]
[-] ModifyQueryController.php
[edit]
[-] SetCustomGroup.php
[edit]
[+]
Map
[-] TraitHostedBy.php
[edit]
[-] SearchFormController.php
[edit]
[-] InsertFeaturedImg.php
[edit]
[-] PaymentGatewaysController.php
[edit]
[-] PaymentController.php
[edit]
[-] DokanController.php
[edit]
[-] SchemaController.php
[edit]
[-] UserController.php
[edit]
[-] BelongsToLocation.php
[edit]
[-] WooCommerceBookingController.php
[edit]
[-] IsMyPaymentID.php
[edit]
[-] StripeController.php
[edit]
[-] ContactFormController.php
[edit]
[-] AddListingButtonController.php
[edit]
[-] Validation.php
[edit]
[-] GalleryController.php
[edit]
[-] SetListingRelationship.php
[edit]
[-] AddListingController.php
[edit]
[-] MergingSettingValues.php
[edit]
[-] GoogleReCaptchaController.php
[edit]
[-] CouponController.php
[edit]
[-] InvoiceController.php
[edit]
[-] SingleJsonSkeleton.php
[edit]
[-] SingleController.php
[edit]
[-] InsertImg.php
[edit]
[-] EmailController.php
[edit]
[-] BelongsToCategories.php
[edit]
[-] ReviewController.php
[edit]
[-] SetSinglePrice.php
[edit]
[-] PrintSidebarItems.php
[edit]
[-] SetPlanRelationship.php
[edit]
[-] BookingComController.php
[edit]
[-] WooCommerceController.php
[edit]
[-] FacebookLoginController.php
[edit]
[-] EventController.php
[edit]
[-] SetRestaurantMenu.php
[edit]
[-] SetProductsToListing.php
[edit]
[-] UserPlanController.php
[edit]
[-] FollowController.php
[edit]
[+]
Retrieve
[-] SetGeneral.php
[edit]
[-] VerifyPurchaseCode.php
[edit]
[-] PlanRelationshipController.php
[edit]
[-] FreePlanController.php
[edit]
[-] AddBookingComBannerCreator.php
[edit]
[-] ReportController.php
[edit]
[-] RetrieveController.php
[edit]
[-] SetCustomButton.php
[edit]
[-] GetWilokeToolSettings.php
[edit]
[-] PaymentMetaController.php
[edit]
[-] RegisterLoginController.php
[edit]
[-] TermsAndPolicyController.php
[edit]
[-] AppleLoginController.php
[edit]
[-] ChangePlanStatusController.php
[edit]
[-] NextBillingPaymentController.php
[edit]
[-] AddListingPaymentController.php
[edit]
[-] PromotionController.php
[edit]
[-] PrintAddListingSettings.php
[edit]
[-] PayPalExecuteAddListingPayment.php
[edit]
[-] ClaimController.php
[edit]
[-] ViewStatisticController.php
[edit]
[-] SessionController.php
[edit]
[-] SharesStatisticController.php
[edit]
[-] TraitSetEventData.php
[edit]
[-] PrintAddListingFields.php
[edit]
[-] GuardController.php
[edit]
[+]
TransformAddListingData
[-] MessageController.php
[edit]
[-] OptimizeScripts.php
[edit]
[-] InsertLogo.php
[edit]
[-] SetPostDuration.php
[edit]
[-] GridItemController.php
[edit]
[-] SetVideo.php
[edit]
[-] AddMorePhotosVideosController.php
[edit]
[-] TraitAddListingSettings.php
[edit]
[-] InsertGallery.php
[edit]
[-] BillingControllers.php
[edit]
[-] GetSingleImage.php
[edit]
[-] BelongsToTags.php
[edit]
[-] PermalinksController.php
[edit]
[-] RunUpdateDBToLatestVersionController.php
[edit]
[-] SetListingBelongsToPlanID.php
[edit]
[-] NoticeController.php
[edit]
[-] DirectBankTransferController.php
[edit]
[-] SetPriceRange.php
[edit]
[-] TagsBelongsToCatController.php
[edit]
[-] PayPalController.php
[edit]
[-] InsertAddress.php
[edit]
[-] MapListingController.php
[edit]
[-] ListingController.php
[edit]
[-] AuthorPageController.php
[edit]
[-] RestaurantMenuController.php
[edit]
[-] PaymentStatusController.php
[edit]
[-] SetSocialNetworks.php
[edit]
[-] SetCustomSections.php
[edit]
[-] TranslationController.php
[edit]
[-] IconController.php
[edit]
[-] SetGroupData.php
[edit]
[-] SetContactInfo.php
[edit]
[-] ProfileController.php
[edit]
[-] ShareController.php
[edit]
[-] InsertCoverImage.php
[edit]
[-] HandleSubmit.php
[edit]
[-] SetMyRoom.php
[edit]
[-] ModalController.php
[edit]