本文整理汇总了PHP中Cart66Setting::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Setting::getValue方法的具体用法?PHP Cart66Setting::getValue怎么用?PHP Cart66Setting::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Setting
的用法示例。
在下文中一共展示了Cart66Setting::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initCheckout
public function initCheckout($total)
{
$p = $this->getPayment();
$b = $this->getBilling();
Cart66Common::log("Payment info for checkout: " . print_r($p, true));
$expDate = $p['cardExpirationMonth'] . substr($p['cardExpirationYear'], 2);
$this->addField('Description', 'Your shopping cart');
$this->addField('method', 'processCard');
$this->addField('transactionAmount', number_format($total, 2, '.', ''));
$this->addField('transactionCurrency', Cart66Setting::getValue('mwarrior_currency'));
$this->addField('transactionProduct', '12345');
$this->addField('merchantUUID', $this->_apiData['MERCHANTUUID']);
$this->addField('apiKey', $this->_apiData['APIKEY']);
$this->addField('customerName', $b['firstName'] . ' ' . $b['lastName']);
$this->addField('customerCountry', $b['country']);
$this->addField('customerAddress', $b['address']);
$this->addField('customerCity', $b['city']);
$this->addField('customerState', $b['state']);
$this->addField('customerPostCode', $b['zip']);
$this->addField('customerPhone', $p['phone']);
$this->addField('customerEmail', $p['email']);
$this->addField('paymentCardNumber', $p['cardNumber']);
$this->addField('paymentCardExpiry', $expDate);
$this->addField('paymentCardCSC', $p['securityId']);
$this->addField('paymentCardName', $b['firstName'] . ' ' . $b['lastName']);
$this->addField('customerIP', self::getRemoteIP());
$this->addField('hash', self::calculateHash($this->fields));
}
示例2: login
public static function login(Cart66Account $account)
{
$name = $account->firstName . ' ' . $account->lastName;
$email = $account->email;
$externalId = $account->id;
$organization = Cart66Setting::getValue('zendesk_organization');
$key = Cart66Setting::getValue('zendesk_token');
$prefix = Cart66Setting::getValue('zendesk_prefix');
if (Cart66Setting::getValue('zendesk_jwt')) {
$now = time();
$token = array("jti" => md5($now . rand()), "iat" => $now, "name" => $name, "email" => $email);
include_once CART66_PATH . "/pro/models/JWT.php";
$jwt = JWT::encode($token, $key);
// Redirect
header("Location: https://" . $prefix . ".zendesk.com/access/jwt?jwt=" . $jwt);
exit;
} else {
/* Build the message */
$ts = isset($_GET['timestamp']) ? $_GET['timestamp'] : time();
$message = $name . '|' . $email . '|' . $externalId . '|' . $organization . '|||' . $key . '|' . $ts;
$hash = MD5($message);
$remoteAuthUrl = 'http://' . $prefix . '.zendesk.com/access/remoteauth/';
$arguments = array('name' => $name, 'email' => $email, 'external_id' => $externalId, 'organization' => $organization, 'timestamp' => $ts, 'hash' => $hash);
$url = add_query_arg($arguments, $remoteAuthUrl);
header("Location: " . $url);
exit;
}
}
示例3: resendEmailFromLog
public static function resendEmailFromLog($id)
{
$resendEmail = false;
global $wpdb;
$tableName = Cart66Common::getTableName('email_log');
$sql = "SELECT * from {$tableName} where id = {$id}";
$results = $wpdb->get_results($sql);
if ($results) {
foreach ($results as $r) {
$resendEmail = Cart66Notifications::mail($r->to_email, $r->subject, $r->body, $r->headers);
$email = new Cart66EmailLog();
$email_data = array('from_email' => $r->from_email, 'from_name' => $r->from_name, 'to_email' => $r->to_email, 'to_name' => $r->to_name, 'head' => array('headers' => $r->headers), 'subject' => $r->subject, 'msg' => $r->body, 'attachments' => $r->attachments, 'order_id' => $r->order_id);
if (!$resendEmail) {
if (Cart66Setting::getValue('log_resent_emails')) {
$email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND FAILED');
}
} else {
if (Cart66Setting::getValue('log_resent_emails')) {
$email->saveEmailLog($email_data, $r->email_type, $r->copy, 'RESEND SUCCESSFUL');
}
}
}
}
return $resendEmail;
}
示例4: __construct
public function __construct()
{
$setting = new Cart66Setting();
$this->username = Cart66Setting::getValue('capost_username');
$this->password = Cart66Setting::getValue('capost_password');
$this->customer_number = Cart66Setting::getValue('capost_customer_number');
$this->fromZip = Cart66Setting::getValue('capost_ship_from_zip');
$this->credentials = 1;
}
示例5: setPayment
public function setPayment($p)
{
$this->_payment = $p;
$skip = array('email', 'phone', 'custom-field');
$custom_payment_fields = apply_filters('cart66_after_payment_form', '');
if (is_array($custom_payment_fields)) {
foreach ($custom_payment_fields as $key => $payment_field) {
if (!$payment_field['required']) {
$skip[] = $payment_field['slug'];
}
if (isset($payment_field['validator']) && $payment_field['validator'] != '') {
if (function_exists($payment_field['validator'])) {
$skip[] = $payment_field['slug'];
$data_to_validate = isset($p[$payment_field['slug']]) ? $p[$payment_field['slug']] : '';
$validated = call_user_func($payment_field['validator'], $data_to_validate);
if (!$validated['valid']) {
foreach ($validated['errors'] as $key => $error) {
$this->_errors['Payment ' . $payment_field['slug'] . $key] = $error;
$this->_jqErrors[] = 'payment-' . $payment_field['slug'];
}
}
}
}
}
}
foreach ($p as $key => $value) {
if (!in_array($key, $skip)) {
$value = trim($value);
if ($value == '') {
$keyName = ucwords(preg_replace('/([A-Z])/', " \$1", $key));
$this->_errors['Payment ' . $keyName] = __('Payment ', 'cart66') . $keyName . __(' required', 'cart66');
$this->_jqErrors[] = "payment-{$key}";
}
}
}
if ($p['email'] == '') {
$this->_errors['Email address'] = __('Email address is required', 'cart66');
$this->_jqErrors[] = "payment-email";
}
if ($p['phone'] == '') {
$this->_errors['Phone'] = __('Phone number is required', 'cart66');
$this->_jqErrors[] = "payment-phone";
}
if (!Cart66Common::isValidEmail($p['email'])) {
$this->_errors['Email'] = __("Email address is not valid", "cart66");
$this->_jqErrors[] = 'payment-email';
}
if (Cart66Setting::getValue('checkout_custom_field_display') == 'required' && $p['custom-field'] == '') {
$this->_errors['Custom Field'] = Cart66Setting::getValue('checkout_custom_field_error_label') ? Cart66Setting::getValue('checkout_custom_field_error_label') : __('The Special Instructions Field is required', 'cart66');
$this->_jqErrors[] = 'checkout-custom-field-multi';
$this->_jqErrors[] = 'checkout-custom-field-single';
}
}
示例6: initCheckout
public function initCheckout($total)
{
$p = $this->getPayment();
$b = $this->getBilling();
Cart66Common::log("Payment info for checkout: " . print_r($p, true));
// Load gateway url from Cart66 settings
$gatewayUrl = Cart66Setting::getValue('auth_url');
$this->gateway_url = $gatewayUrl;
$b['address2'] = $b['address2'] == "" ? null : $b['address2'];
$cardData = array('number' => $p['cardNumber'], 'exp_month' => $p['cardExpirationMonth'], 'exp_year' => $p['cardExpirationYear'], 'cvc' => $p['securityId'], 'name' => $b['firstName'] . ' ' . $b['lastName'], 'address_line1' => $b['address'], 'address_line2' => $b['address2'], 'address_zip' => $b['zip'], 'address_state' => $b['state'], 'address_country' => $b['country']);
$this->params = array('card' => $cardData, 'amount' => number_format($total, 2, '', ''), 'currency' => Cart66Setting::getValue('stripe_currency_code') ? Cart66Setting::getValue('stripe_currency_code') : strtolower(Cart66Setting::getValue('currency_code')), 'description' => '');
}
示例7: prepareS3Url
public static function prepareS3Url($bucket, $file, $duration = '5 minutes')
{
$awsKeyId = Cart66Setting::getValue('amazons3_id');
$awsSecretKey = Cart66Setting::getValue('amazons3_key');
$file = rawurlencode($file);
$file = str_replace('%2F', '/', $file);
$path = $bucket . '/' . $file;
$expires = strtotime("+ {$duration}", current_time('timestamp', 1));
$stringToSign = self::getStringToSign('GET', $expires, "/{$path}");
$signature = self::encodeSignature($stringToSign, $awsSecretKey);
$url = "http://{$bucket}.s3.amazonaws.com/{$file}";
$url .= '?AWSAccessKeyId=' . $awsKeyId . '&Expires=' . $expires . '&Signature=' . $signature;
return $url;
}
示例8: getAddToCartImagePath
/**
* Return the image path for the add to cart button or false if no path is available
*/
public static function getAddToCartImagePath($attrs)
{
$path = false;
if (isset($attrs['img'])) {
// Look for custom image for this instance of the button
$path = $attrs['img'];
} else {
// Look for common images
$cartImgPath = Cart66Setting::getValue('cart_images_url');
if ($cartImgPath) {
$cartImgPath = Cart66Common::endSlashPath($cartImgPath);
$path = $cartImgPath . 'add-to-cart.png';
}
}
return $path;
}
示例9: getRemoteRequestParams
public static function getRemoteRequestParams()
{
$params = false;
$setting = new Cart66Setting();
$orderNumber = Cart66Setting::getValue('order_number');
if (!$orderNumber) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Order number not available");
}
$version = Cart66Setting::getValue('version');
if (!$version) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Version number not available");
}
if ($orderNumber && $version) {
global $wpdb;
$versionName = 'pro';
$params = sprintf("task=getLatestVersion&pn=Cart66&key=%s&v=%s&vnm=%s&wp=%s&php=%s&mysql=%s&ws=%s", urlencode($orderNumber), urlencode($version), urlencode($versionName), urlencode(get_bloginfo("version")), urlencode(phpversion()), urlencode($wpdb->db_version()), urlencode(get_bloginfo("url")));
}
return $params;
}
示例10: getRate
/**
* Return the monetary value of the shipping rate or false on failure.
*/
public function getRate($PostalCode, $dest_zip, $dest_country_code, $service, $weight, $length = 0, $width = 0, $height = 0)
{
$setting = new Cart66Setting();
$countryCode = array_shift(explode('~', Cart66Setting::getValue('home_country')));
$pickupCode = Cart66Setting::getValue('ups_pickup_code') ? Cart66Setting::getValue('ups_pickup_code') : "03";
$ResidentialAddressIndicator = Cart66Setting::getValue('ups_only_ship_commercial') ? "" : "\n <ResidentialAddressIndicator/>";
if ($this->credentials != 1) {
print 'Please set your credentials with the setCredentials function';
die;
}
$data = "<?xml version=\"1.0\"?> \n <AccessRequest xml:lang=\"en-US\"> \n <AccessLicenseNumber>" . urlencode(trim($this->AccessLicenseNumber)) . "</AccessLicenseNumber> \n <UserId>" . urlencode($this->UserID) . "</UserId> \n <Password>" . urlencode($this->Password) . "</Password> \n </AccessRequest> \n <?xml version=\"1.0\"?> \n <RatingServiceSelectionRequest xml:lang=\"en-US\"> \n <Request> \n <TransactionReference> \n <CustomerContext>Rating and Service</CustomerContext> \n <XpciVersion>1.0001</XpciVersion> \n </TransactionReference> \n <RequestAction>Rate</RequestAction> \n <RequestOption>Rate</RequestOption> \n </Request> \n <PickupType> \n <Code>{$pickupCode}</Code> \n </PickupType> \n <Shipment> \n <Shipper> \n <Address> \n <PostalCode>{$PostalCode}</PostalCode> \n <CountryCode>{$countryCode}</CountryCode> \n </Address> \n <ShipperNumber>{$this->shipperNumber}</ShipperNumber> \n </Shipper> \n <ShipTo> \n <Address> \n <PostalCode>{$dest_zip}</PostalCode> \n <CountryCode>{$dest_country_code}</CountryCode>{$ResidentialAddressIndicator} \n </Address> \n </ShipTo> \n <ShipFrom> \n <Address> \n <PostalCode>{$PostalCode}</PostalCode> \n <CountryCode>{$countryCode}</CountryCode> \n </Address> \n </ShipFrom> \n <Service> \n <Code>{$service}</Code> \n </Service> \n <Package> \n <PackagingType> \n <Code>02</Code> \n </PackagingType> \n <Dimensions> \n <UnitOfMeasurement> \n <Code>{$this->dimensionsUnits}</Code> \n </UnitOfMeasurement> \n <Length>{$length}</Length> \n <Width>{$width}</Width> \n <Height>{$height}</Height> \n </Dimensions> \n <PackageWeight> \n <UnitOfMeasurement> \n <Code>{$this->weightUnits}</Code> \n </UnitOfMeasurement> \n <Weight>{$weight}</Weight> \n </PackageWeight> \n </Package> \n </Shipment> \n </RatingServiceSelectionRequest>";
$ch = curl_init("https://onlinetools.ups.com/ups.app/xml/Rate");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
$xml = substr($result, strpos($result, '<RatingServiceSelectionResponse'));
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] UPS XML REQUEST: \n{$data}");
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] UPS XML RESULT: \n{$xml}");
try {
$xml = new SimpleXmlElement($xml);
} catch (Exception $e) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Cart66 Exception caught when trying to get UPS XML Response: " . $e->getMessage() . " \n");
$rate = false;
}
$responseDescription = $xml->Response->ResponseStatusDescription;
$errorDescription = $xml->Response->Error->ErrorDescription;
// Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Response Description: (Service: $service) $responseDescription $errorDescription");
if ($responseDescription == "Failure") {
$rate = false;
} else {
//$rate = $xml->RatedShipment->RatedPackage->TotalCharges->MonetaryValue;
$rate = $xml->RatedShipment->TotalCharges->MonetaryValue;
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] RATE ===> {$rate}");
return $rate;
}
示例11: getCreditCardTypes
/**
* Return an array of accepted credit card types where the keys are the diplay values and the values are the gateway values
*
* @return array
*/
public function getCreditCardTypes()
{
$cardTypes = array();
$setting = new Cart66Setting();
$cards = Cart66Setting::getValue('auth_card_types');
if ($cards) {
$cards = explode('~', $cards);
if (in_array('mastercard', $cards)) {
$cardTypes['MasterCard'] = 'mastercard';
}
if (in_array('visa', $cards)) {
$cardTypes['Visa'] = 'visa';
}
if (in_array('amex', $cards)) {
$cardTypes['American Express'] = 'amex';
}
if (in_array('discover', $cards)) {
$cardTypes['Discover'] = 'discover';
}
}
return $cardTypes;
}
示例12: elseif
} elseif (empty($ack)) {
echo '<pre>Failed to connect via curl to PayPal. The most likely cause is that your PHP installation failed to verify that the CA cert is OK</pre>';
} else {
try {
throw new Cart66Exception(ucwords($response['L_SHORTMESSAGE0']), 66503);
} catch (Cart66Exception $e) {
$exception = Cart66Exception::exceptionMessages($e->getCode(), $e->getMessage(), array('Error Number: ' . $response['L_ERRORCODE0'], $response['L_LONGMESSAGE0']));
echo Cart66Common::getView('views/error-messages.php', $exception);
}
}
}
?>
<?php
if ($settingsOk) {
?>
<form action="" method='post' id="paypalexpresscheckout">
<input type='hidden' name='cart66-action' value='paypalexpresscheckout'>
<?php
$paypalImageUrl = 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif';
if (CART66_PRO && Cart66Setting::getValue('custom_paypal_express_image')) {
$paypalImageUrl = Cart66Setting::getValue('custom_paypal_express_image');
}
?>
<input type="image" id='PayPalExpressCheckoutButton' src="<?php
echo $paypalImageUrl;
?>
" value="PayPal Express Checkout" name="PayPal Express Checkout" />
</form>
<?php
}
示例13: toggleLifeTime
$('#product-lifetime_membership').click(function() {
toggleLifeTime();
});
$('#viewLocalDeliverInfo').click(function() {
$('#localDeliveryInfo').toggle();
return false;
});
$('#amazons3ForceDownload').click(function() {
$('#amazons3ForceDownloadAnswer').toggle();
return false;
});
<?php
if (Cart66Setting::getValue('amazons3_id')) {
?>
validateS3BucketName();
<?php
}
?>
$("#product-s3_bucket, #product-s3_file").blur(function(){
validateS3BucketName();
})
})
$(document).on('click', '.delete', function(e) {
return confirm('Are you sure you want to delete this item?');
});
function toggleLifeTime() {
if($('#product-lifetime_membership').is(':checked')) {
$('#product-billing_interval').val('');
示例14: SetExpressCheckout
public function SetExpressCheckout()
{
$this->_requestFields = array('METHOD' => 'SetExpressCheckout', 'PAYMENTACTION' => 'Sale');
if (!Cart66Setting::getValue('disable_landing_page')) {
$this->_requestFields['LANDINGPAGE'] = 'Billing';
}
if (Cart66Setting::getValue('express_force_paypal')) {
$this->_requestFields['SOLUTIONTYPE'] = 'Sole';
}
$nvp = $this->_buildNvpStr();
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Set Express Checkout Request NVP: " . str_replace('&', "\n", $nvp));
$result = $this->_decodeNvp($this->_sendRequest($this->_apiEndPoint, $nvp));
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] SetExpressCheckout result: " . print_r($result, true));
return $result;
}
示例15: explode
}
}
if (isset($_REQUEST['newsletter'])) {
if ($_REQUEST['newsletter'] == 1) {
?>
<form action="" method='post' id="newsletter_form" class="phorm2">
<?php
if ($lists) {
?>
<ul id="<?php
echo $service_name;
?>
">
<li>
<?php
if (!($optInMessage = Cart66Setting::getValue($service_name . '_opt_in_message'))) {
$optInMessage = 'Yes, I would like to subscribe to:';
}
echo "<p>{$optInMessage}</p>";
$lists = explode('~', $lists);
echo '<ul class="Cart66NewsletterList">';
foreach ($lists as $list) {
list($id, $name) = explode('::', $list);
echo "<li><input class=\"Cart66CheckboxList\" type=\"checkbox\" name=\"" . $service_name . "_subscribe_ids[]\" value=\"{$id}\" /> {$name}</li>";
}
echo '</ul>';
?>
</li>
</ul>
<?php
}