PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
wiloke-listing-tools
/
app
/
Controllers
<?php namespace WilokeListingTools\Controllers; use WilokeListingTools\AlterTable\AlterTablePaymentHistory; use WilokeListingTools\AlterTable\AlterTablePaymentMeta; use WilokeListingTools\Framework\Helpers\GetSettings; use WilokeListingTools\Framework\Helpers\SetSettings; use WilokeListingTools\Framework\Routing\Controller; use WilokeListingTools\Framework\Store\Session; use WilokeListingTools\Models\PaymentMetaModel; class RunUpdateDBToLatestVersionController extends Controller { private $optionKey = 'updated_db'; private $nonceAction = 'wilcity_update_db_nonce'; private $action = 'wilcity_update_db'; public function __construct() { add_action('admin_init', [$this, 'convertingStripeSubscriptionIDToSubscriptionID']); add_action('admin_notices', [$this, 'requireUpdateAnnouncement']); } public function requireUpdateAnnouncement() { $updatedDBVersion = GetSettings::getOptions($this->optionKey); if ($updatedDBVersion != WILOKE_LISTING_TOOL_VERSION): $url = add_query_arg( [ 'page' => 'wiloke-submission', 'security' => wp_create_nonce($this->nonceAction), 'action' => $this->action ], admin_url('admin.php') ); ?> <div class="notice notice-error is-dismissible" style="margin-top: 20px; margin-bottom: 20px"> <p><strong style="color: red">If you upgraded from Wilcity 1.1.7.6 or smaller version to Wilcity 1.2.x, You have to migrate data from the old version to the 1.2.0. To migrate the data, please read <a href="https://wilcityservice.com/how-can-i-update-to-wilcity-1-2-0/" target="_blank">How can I update to Wilcity 1.2.0? ->Converting data to Wilcity 1.2.0 </a></strong></p> <a href="<?php echo esc_url($url); ?>">I did it</a> </div> <?php else: if (Session::getSession('updated_db') == 'yes') : ?> <div class="notice notice-success is-dismissible" style="margin-top: 20px; margin-bottom: 20px"> <p>Thank for updating to the latest version of Wiloke Listing Tools</p> </div> <?php endif; endif; if (class_exists('Classic_Editor') || class_exists('DisableGutenberg')) { ?> <p><strong style="color: red">Warning: Classic Editor and Disable Gutenberg are not allowed in Wilcity. Please disable these plugins by clicking on Plugins from admin sidebar -> Disable Classic Editor / Disable Gutenberg</strong></p> <?php } } private function convertStripeSubscriptionIDToSubscriptionID() { global $wpdb; $paymentTbl = $wpdb->prefix.AlterTablePaymentHistory::$tblName; $aStripePaymentIDs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $paymentTbl WHERE gateway=%s AND billingType=%s ORDER BY ID DESC LIMIT 3000", 'stripe', 'RecurringPayment' ), ARRAY_A ); if (!empty($aStripePaymentIDs)) { foreach ($aStripePaymentIDs as $aPayment) { $stripeSubscriptionID = PaymentMetaModel::get($aPayment['ID'], 'stripe_subscription_ID'); if (!empty($stripeSubscriptionID)) { PaymentMetaModel::setPaymentSubscriptionID($aPayment['ID'], $stripeSubscriptionID); PaymentMetaModel::delete($aPayment['ID'], 'stripe_subscription_ID'); } } } return true; } private function convertPayPalTokenAndStoreDataToPaymentTokenID() { global $wpdb; $paymentTbl = $wpdb->prefix.AlterTablePaymentHistory::$tblName; $aPaymentIDs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $paymentTbl WHERE gateway=%s ORDER BY ID DESC LIMIT 3000", 'paypal' ), ARRAY_A ); if (!empty($aPaymentIDs)) { foreach ($aPaymentIDs as $aPayment) { $token = PaymentMetaModel::get($aPayment['ID'], 'paypal_token_id_relationship'); if (!empty($token)) { PaymentMetaModel::setPaymentToken($aPayment['ID'], $token); PaymentMetaModel::delete($aPayment['ID'], 'paypal_token_id_relationship'); } } } return true; } private function convertPayPalPaymentIDToIntentID() { global $wpdb; $paymentTbl = $wpdb->prefix.AlterTablePaymentHistory::$tblName; $aPaymentIDs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $paymentTbl WHERE gateway=%s AND billingType = %s ORDER BY ID DESC LIMIT 3000", 'paypal', 'NonRecurringPayment' ), ARRAY_A ); if (!empty($aPaymentIDs)) { foreach ($aPaymentIDs as $aPayment) { $intentID = PaymentMetaModel::get($aPayment['ID'], 'paypal_payment_id'); if (!empty($intentID)) { PaymentMetaModel::setPaymentIntentID($aPayment['ID'], $intentID); PaymentMetaModel::delete($aPayment['ID'], 'paypal_payment_id'); } } } return true; } public function convertingStripeSubscriptionIDToSubscriptionID() { if (isset($_REQUEST['action']) && $_REQUEST['action'] == $this->action) { if (wp_verify_nonce($_REQUEST['security'], $this->nonceAction)) { if (current_user_can('administrator')) { $this->convertStripeSubscriptionIDToSubscriptionID(); $this->convertPayPalTokenAndStoreDataToPaymentTokenID(); $this->convertPayPalPaymentIDToIntentID(); SetSettings::setOptions($this->optionKey, WILOKE_LISTING_TOOL_VERSION); Session::setSession('updated_db', 'yes'); } } } } }
[+]
..
[-] 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]