Esempio n. 1
0
<?php

if (isset($_POST["mm_captcha_public_key"])) {
    require_once MM_PLUGIN_ABSPATH . '/lib/recaptcha/autoload.php';
    $publicKey = $_POST["mm_captcha_public_key"];
    $privateKey = $_POST["mm_captcha_private_key"];
    // validate the public key
    if (empty($publicKey)) {
        MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_KEY, $publicKey);
    } else {
        $contents = MM_Utils::sendRequest('http://www.google.com/recaptcha/api/challenge?k=' . $publicKey, "", 0);
        if (preg_match("/(invalid)|(input error)/", strtolower($contents))) {
            $error = "The Captcha site key provided is invalid. Please try again.";
        } else {
            MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_KEY, $publicKey);
        }
    }
    MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_PRIVATE_KEY, $privateKey);
}
$siteKey = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_KEY);
$privateKey = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_PRIVATE_KEY);
?>
<div class="mm-wrap">
    <p class="mm-header-text">Captcha Settings <span style="font-size:12px;"><a href="https://membermouse.uservoice.com/knowledgebase/articles/319226-add-captcha-validation-to-the-checkout-page" target="_blank">Learn more</a></span></p>
	<div style="margin-bottom:10px;">
		<img src="https://dl.dropboxusercontent.com/u/265387542/plugin_images/logos/recaptcha_v2.png" style="vertical-align:middle; margin-right:10px;" />
		<a target="_blank" href="https://www.google.com/recaptcha/" class="mm-ui-button green">Create a Free Account</a> 
		<a target="_blank" href="https://www.google.com/recaptcha/admin" class="mm-ui-button">Access Existing Account</a>
	</div>
	
	<table>
Esempio n. 2
0
     if ($queuedEvent->command == MM_ScheduledEvent::$QUEUE_COMMAND_UPDATE) {
         $updates[$queuedEvent->event_id] = $queuedEvent->scheduled_date;
     } else {
         if ($queuedEvent->command == MM_ScheduledEvent::$QUEUE_COMMAND_DELETE) {
             $deletes[] = $queuedEvent->event_id;
         }
     }
 }
 if (count($updates) > 0 || count($deletes) > 0) {
     //construct JSON message and send to server
     $schedulerCommand = "BATCH_SYNC";
     $license = new MM_License("", false);
     MM_MemberMouseService::getLicense($license);
     $messageArray = array("api_key" => $license->getApiKey(), "api_secret" => $license->getApiSecret(), "command" => $schedulerCommand, "updates" => $updates, "deletes" => $deletes);
     $message = json_encode($messageArray);
     $response = MM_Utils::sendRequest(MM_SCHEDULING_SERVER_URL, $message);
     if ($response === false) {
         //can't contact the scheduling server, throw an exception and let the next sync pick up this batch after it expires
         throw new Exception("Scheduler sync: Error communicating with scheduling server");
     }
     //decode response and determine if its ok, partial_error, or error status, then delete records from queue accordingly
     $response = json_decode($response);
     if (is_null($response)) {
         throw new Exception("Scheduler sync: Invalid response received from server during sync operation");
     } else {
         //There is a valid response from the server, determine the status and respond appropriately
         if ($response->status == "ok") {
             //all updates were successful, delete the successes from the que table and exit
             $wpdb->query("DELETE FROM {$queTable} WHERE batch_id = '{$batchIdentifier}'");
         } else {
             if ($response->status == "partial_error" && is_array($response->message)) {