예제 #1
0
/**
 * Stands for MemberMouse Override Format [of Currency] - formats a currency value into a locale appropriate string, using any
 * supplied settings to override the defaults
 *
 * @param float $amount The currency value to format
 * @param string $currencyCode (optional) The iso code of the currency
 * @param array $currencySettings (optional) The settings to use when overriding the defaults
 *        	
 * @return string The formatted value
 *        
 */
function _mmof($amount, $currencyCode = "", $currencySettings = "")
{
    $currencyCode = empty($currencyCode) ? MM_CurrencyUtil::getActiveCurrency() : $currencyCode;
    return MM_CurrencyUtil::format("%n", $amount, $currencyCode, $currencySettings);
}
예제 #2
0
		</td>
	</tr>
	<tr>
		<td></td>
		<td>
			<div id='mm_has_trial_row' style='display:none;'>
				<p style="margin:5px 0px 0px 0px;">
					Trial Price 
					<input type='text' id='mm-trial_amount' value='<?php 
echo $product->getTrialAmount(false);
?>
'  style='margin-left: 10px; width: 125px;' <?php 
echo $hasBeenPurchased ? "disabled" : "";
?>
/> <?php 
echo MM_CurrencyUtil::getActiveCurrency();
?>
				</p>
				<p style="margin:5px 0px 5px 0px;">
					Trial Period
					<input type='text' id='mm-trial_duration' value='<?php 
echo $product->getTrialDuration();
?>
'  style='margin-left: 10px; width: 50px;' <?php 
echo $hasBeenPurchased ? "disabled" : "";
?>
/> 
					<select id='mm-trial_frequency' style='width:100px;' <?php 
echo $hasBeenPurchased ? "disabled" : "";
?>
>
예제 #3
0
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
if (isset($_POST["mm_selected_currency"])) {
    //update default currency
    if (in_array($_POST['mm_selected_currency'], array_keys(MM_CurrencyUtil::getSupportedCurrencies()))) {
        MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_CURRENCY, $_POST["mm_selected_currency"]);
    }
    if (isset($_POST["mm_postfix_iso_to_currency"]) && $_POST["mm_postfix_iso_to_currency"] == "1") {
        MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_CURRENCY_FORMAT_POSTFIX_ISO, true);
    } else {
        MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_CURRENCY_FORMAT_POSTFIX_ISO, false);
    }
}
$currentCurrency = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CURRENCY);
$postfixIsoToCurrency = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CURRENCY_FORMAT_POSTFIX_ISO);
$postfixIsoToCurrency = empty($postfixIsoToCurrency) ? false : $postfixIsoToCurrency;
//check the support of the active payment services for the currently selected currency
$activePaymentServices = MM_PaymentServiceFactory::getAvailablePaymentServices();
$unsupportedPaymentServices = array();
foreach ($activePaymentServices as $aps) {
    if (!$aps->isSupportedCurrency($currentCurrency)) {
        $unsupportedPaymentServices[] = $aps->getName();
    }
}
$warningMsg = "";
$warningBox = "";
예제 #4
0
    $testService = $availablePaymentServices[MM_PaymentService::$TEST_SERVICE_TOKEN];
    unset($availablePaymentServices[MM_PaymentService::$TEST_SERVICE_TOKEN]);
}
foreach ($availablePaymentServices as $currentoken => $aService) {
    if ($aService->supportsFeature(MM_PaymentServiceFeatures::OFFSITE_SERVICE)) {
        $offsiteServices[$currentoken] = $aService;
    } else {
        //assume services that fail the feature check are onsite, ie. only one onsite at a time can be active
        $onsiteServices[$currentoken] = $aService;
        if (!$onsiteSelected && $aService->isActive()) {
            $onsiteSelected = true;
            //if no onsite services are selected, this will indicate to check the 'none' option
        }
    }
}
$currentCurrency = MM_CurrencyUtil::getActiveCurrency();
$unsupportedCurrencyWarning = "<div style='background-color: #ff0000; color: #ffffff;'>" . "This payment service does not support the configured currency. " . "To change the configured currency click " . "<a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_CHECKOUT_OTHER_SETTINGS) . "'>here</a></div>";
?>
<style>
.mm-payment-service-box {
  margin-bottom: 5px;
}
</style>
<form method='post'>
<div class="mm-wrap" id="mm-form-container">
	<div style='padding-left: 10px;'>
	    <div style='width:650px'>
			<p>
			With MemberMouse you can configure two types of payment methods: onsite and offsite. Onsite payment methods allow
			you to collect credit card information right from your site which means that customers can complete the entire
			checkout process without leaving your site. Authorize.net and Stripe are examples of onsite payment methods.
예제 #5
0
파일: index.php 프로젝트: huynp/Critical
 public function loadJavascript($module = "")
 {
     $isAdminArea = is_admin();
     $url = MM_OptionUtils::getOption("siteurl");
     $adminUrl = admin_url();
     if (isset($_SERVER["HTTP_HOST"])) {
         $thisUrl = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
         if (strpos($thisUrl, "http") === false) {
             $thisUrl = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? "https://{$thisUrl}" : "http://{$thisUrl}";
         }
     }
     if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" || strpos($thisUrl, "https") !== false) {
         $url = str_replace("http:", "https:", $url);
         $adminUrl = str_replace("http:", "https:", $adminUrl);
     }
     //first include global script
     $version = self::getPluginVersion();
     //use plugin major version to control caching
     wp_enqueue_script("membermouse-global", plugins_url("/resources/js/global.js", __FILE__), array('jquery'), $version);
     $javascriptData = array("jsIsAdmin" => $isAdminArea, "adminUrl" => $adminUrl, "globalurl" => MM_PLUGIN_URL, "checkoutProcessingPaidMessage" => MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CHECKOUT_PAID_MESSAGE), "checkoutProcessingFreeMessage" => MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CHECKOUT_FREE_MESSAGE), "checkoutProcessingMessageCSS" => MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CHECKOUT_MESSAGE_CSS));
     if (class_exists("MM_CurrencyUtil")) {
         $javascriptData["currencyInfo"] = MM_CurrencyUtil::getActiveCurrencyMetadata();
     }
     wp_localize_script("membermouse-global", "MemberMouseGlobal", $javascriptData);
     $jsFiles = array();
     $userJSDir = "/resources/js/user/";
     $adminJSDir = "/resources/js/admin/";
     $commonJSDir = "/resources/js/common/";
     if (isLocalInstall() && file_exists(MM_PLUGIN_ABSPATH . "{$commonJSDir}class.js") || !file_exists(MM_PLUGIN_ABSPATH . "{$commonJSDir}mm-common-core.js")) {
         $commonJsFiles = array('jquery.bgiframe-3.0.1.js' => array(), 'jquery.ajaxfileupload.js' => array(), 'class.js' => array(), 'mm-cache.js' => array(), 'mm-main.js' => array(), 'class.ajax.js' => array('class.js'), 'mm-dialog.js' => array('class.js'), 'mm-core.js' => array('class.js'), 'class.form.js' => array('class.js'), 'mm-smarttag_library.js' => array('mm-core.js', 'mm-dialog.js'), 'mm-payment_utils.js' => array('mm-core.js'));
     } else {
         $commonJsFiles = array('mm-common-core.js' => array());
     }
     $useJQueryUI = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_USE_JQUERY_UI);
     $wordPressjQueryUiHandles = array();
     if ($useJQueryUI == "1" || is_admin()) {
         $wordPressjQueryUiHandles[] = 'jquery-ui-accordion';
         $wordPressjQueryUiHandles[] = 'jquery-ui-button';
         $wordPressjQueryUiHandles[] = 'jquery-ui-datepicker';
         $wordPressjQueryUiHandles[] = 'jquery-ui-dialog';
         $wordPressjQueryUiHandles[] = 'jquery-ui-draggable';
         $wordPressjQueryUiHandles[] = 'jquery-ui-droppable';
         $wordPressjQueryUiHandles[] = 'jquery-ui-mouse';
         $wordPressjQueryUiHandles[] = 'jquery-ui-position';
         $wordPressjQueryUiHandles[] = 'jquery-ui-progressbar';
         $wordPressjQueryUiHandles[] = 'jquery-ui-resizable';
         $wordPressjQueryUiHandles[] = 'jquery-ui-selectable';
         $wordPressjQueryUiHandles[] = 'jquery-ui-sortable';
         $wordPressjQueryUiHandles[] = 'jquery-ui-widget';
     }
     foreach ($commonJsFiles as $file => $dependencies) {
         if (file_exists(MM_PLUGIN_ABSPATH . "{$commonJSDir}{$file}")) {
             $jsFiles[plugins_url("{$commonJSDir}{$file}", __FILE__)] = $dependencies;
         }
     }
     if (!$isAdminArea) {
         $userFiles = array('mm-preview.js');
         foreach ($userFiles as $file) {
             if (file_exists(MM_PLUGIN_ABSPATH . "{$userJSDir}{$file}")) {
                 $jsFiles[plugins_url("{$userJSDir}{$file}", __FILE__)] = array();
             }
         }
     } else {
         // load UserVoice SDK
         $jsFiles["//widget.uservoice.com/xCTpbo1WnzFyomHpkrBryQ.js"] = array();
         $jsFiles[plugins_url("{$adminJSDir}mm-corepages.js", __FILE__)] = array();
         $jsFiles[plugins_url("{$adminJSDir}mm-accessrights.js", __FILE__)] = array();
         if (!empty($module)) {
             // load JavaScript classes dynamically based on the module
             $moduleJSDir = $adminJSDir;
             $jsFileName = $module;
             if ($module == MM_MODULE_REPORTING) {
                 $jsFiles[plugins_url("{$adminJSDir}mm-reportjsbase.js", __FILE__)] = array();
                 $moduleJSDir .= "/reports/";
                 $jsFileName = MM_ModuleUtils::getPage();
             }
             if (file_exists(MM_PLUGIN_ABSPATH . "{$moduleJSDir}mm-{$jsFileName}.js")) {
                 $jsFiles[plugins_url("{$moduleJSDir}mm-{$jsFileName}.js", __FILE__)] = array();
             }
         }
     }
     foreach ($jsFiles as $file_to_include => $dependencies) {
         $scriptname = basename($file_to_include);
         $allDependencies = is_array($dependencies) ? $dependencies : array($dependencies);
         $allDependencies = array_merge(array('membermouse-global'), $allDependencies);
         wp_enqueue_script($scriptname, $file_to_include, $allDependencies, $version);
     }
     foreach ($wordPressjQueryUiHandles as $handle) {
         wp_enqueue_script($handle);
     }
 }