本文整理汇总了PHP中Cart66Common::postVal方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::postVal方法的具体用法?PHP Cart66Common::postVal怎么用?PHP Cart66Common::postVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::postVal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: section_main_settings
public function section_main_settings()
{
$successMessage = '';
$versionInfo = false;
$orderNumberFailed = '';
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if ($_POST['cart66-action'] == 'saveOrderNumber' && CART66_PRO) {
$orderNumber = trim(Cart66Common::postVal('order_number'));
Cart66Setting::setValue('order_number', $orderNumber);
$versionInfo = get_transient('_cart66_version_request');
if (!$versionInfo) {
$versionInfo = Cart66ProCommon::getVersionInfo();
set_transient('_cart66_version_request', $versionInfo, 43200);
}
if ($versionInfo) {
$successMessage = __("Thank you! Cart66 has been activated", "cart66");
} else {
Cart66Setting::setValue('order_number', '');
$orderNumberFailed = true;
}
}
}
$data = array('success_message' => $successMessage, 'version_info' => $versionInfo, 'order_number_failed' => $orderNumberFailed);
echo Cart66Common::getView('admin/settings/main.php', $data, false);
}
示例2: mijirehCheckout
public function mijirehCheckout()
{
if (Cart66Session::get('Cart66Cart')->countItems() > 0) {
$gatewayName = Cart66Common::postVal('cart66-gateway-name');
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $gatewayName != 'Cart66Mijireh') {
return $gatewayName == "Cart66ManualGateway" ? $this->manualCheckout() : "";
}
if (!Cart66Session::get('Cart66Cart')->hasPayPalSubscriptions()) {
require_once CART66_PATH . "/gateways/Cart66Mijireh.php";
if (Cart66Session::get('Cart66Cart')->getGrandTotal() > 0 || Cart66Session::get('Cart66Cart')->hasSpreedlySubscriptions()) {
try {
$mj = new Cart66Mijireh();
$view = $this->_buildCheckoutView($mj);
} catch (Cart66Exception $e) {
$exception = Cart66Exception::exceptionMessages($e->getCode(), $e->getMessage());
$view = Cart66Common::getView('views/error-messages.php', $exception);
}
return $view;
} elseif (Cart66Session::get('Cart66Cart')->countItems() > 0) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Displaying manual checkout instead of Mijireh Checkout because the cart value is \$0.00");
return $this->manualCheckout();
}
} else {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Not rendering Mijireh checkout form because the cart contains a PayPal subscription");
}
}
}
示例3: Cart66Product
<?php
$product = new Cart66Product();
$adminUrl = get_bloginfo('wpurl') . '/wp-admin/admin.php';
$errorMessage = false;
if ($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['cart66-action'] == 'save product') {
$_POST['product']['price'] = isset($_POST['product']['price']) ? Cart66Common::convert_currency_to_number($_POST['product']['price']) : '';
try {
$product->handleFileUpload();
$product->setData(Cart66Common::postVal('product'));
$product->save();
$product->clear();
} catch (Cart66Exception $e) {
$errorCode = $e->getCode();
if ($errorCode == 66102) {
// Product save failed
$errors = $product->getErrors();
$errorMessage = Cart66Common::showErrors($errors, "<p><b>" . __("The product could not be saved for the following reasons", "cart66") . ":</b></p>");
} elseif ($errorCode == 66101) {
// File upload failed
$errors = $product->getErrors();
$errorMessage = Cart66Common::showErrors($errors, "<p><b>" . __("The file upload failed", "cart66") . ":</b></p>");
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Product save failed ({$errorCode}): " . strip_tags($errorMessage));
}
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$product->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'delete' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$product->load($id);
示例4: elseif
}
} else {
$intlCodes[] = -1;
}
$method->pruneCarrierMethods('capost_intl', $intlCodes);
$tab = 5;
} elseif ($_POST['cart66-action'] == 'enable live rates') {
Cart66Setting::setValue('use_live_rates', 1);
} elseif ($_POST['cart66-action'] == 'disable live rates') {
Cart66Setting::setValue('use_live_rates', '');
} elseif ($_POST['cart66-action'] == 'save rate tweak') {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Saving a rate tweak");
$factor = Cart66Common::postVal('rate_tweak_factor');
if (is_numeric($factor)) {
Cart66Setting::setValue('rate_tweak_factor', $factor);
Cart66Setting::setValue('rate_tweak_type', Cart66Common::postVal('rate_tweak_type'));
} else {
Cart66Setting::setValue('rate_tweak_factor', '');
Cart66Setting::setValue('rate_tweak_type', '');
}
$tab = 7;
}
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$rule->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit_method' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$method->load($id);
} elseif (isset($_GET['task']) && $_GET['task'] == 'edit_rate' && isset($_GET['id']) && $_GET['id'] > 0) {
$id = Cart66Common::getVal('id');
$rate->load($id);
示例5: accountsPage
public static function accountsPage()
{
$data = array();
if (CART66_PRO) {
$data['plan'] = new Cart66AccountSubscription();
$data['activeUntil'] = '';
$account = new Cart66Account();
if (isset($_REQUEST['cart66-action']) && $_REQUEST['cart66-action'] == 'delete_account') {
// Look for delete request
if (isset($_REQUEST['accountId']) && is_numeric($_REQUEST['accountId'])) {
$account = new Cart66Account($_REQUEST['accountId']);
$account->deleteMe();
$account->clear();
}
} elseif (isset($_REQUEST['accountId']) && is_numeric($_REQUEST['accountId'])) {
if (isset($_REQUEST['opt_out'])) {
$account = new Cart66Account();
$account->load($_REQUEST['accountId']);
$data = array('opt_out' => $_REQUEST['opt_out']);
$account->setData($data);
$account->save();
$account->clear();
}
// Look in query string for account id
$account = new Cart66Account();
$account->load($_REQUEST['accountId']);
$id = $account->getCurrentAccountSubscriptionId(true);
$data['plan'] = new Cart66AccountSubscription($id);
// Return even if plan is expired
if (date('Y', strtotime($data['plan']->activeUntil)) <= 1970) {
$data['activeUntil'] = '';
} else {
$data['activeUntil'] = date('m/d/Y', strtotime($data['plan']->activeUntil));
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'save account') {
$acctData = $_POST['account'];
// Format or unset password
if (empty($acctData['password'])) {
unset($acctData['password']);
} else {
$acctData['password'] = md5($acctData['password']);
}
// Strip HTML tags on notes field
$acctData['notes'] = strip_tags($acctData['notes'], '<a><strong><em>');
$planData = $_POST['plan'];
$planData['active_until'] = date('Y-m-d 00:00:00', strtotime($planData['active_until']));
// Updating an existing account
if ($acctData['id'] > 0) {
$account = new Cart66Account($acctData['id']);
$account->setData($acctData);
$account_errors = $account->validate();
$sub = new Cart66AccountSubscription($planData['id']);
if ($planData['product_id'] != 'spreedly_subscription') {
$sub->setData($planData);
$subscription_product = new Cart66Product($sub->product_id);
$sub->subscription_plan_name = $subscription_product->name;
$sub->feature_level = $subscription_product->feature_level;
$sub->subscriber_token = '';
} else {
unset($planData['product_id']);
$sub->setData($planData);
}
$subscription_errors = $sub->validate();
$errors = array_merge($account_errors, $subscription_errors);
if (count($errors) == 0) {
$account->save();
$sub->save();
$account->clear();
$sub->clear();
} else {
$data['errors'] = $errors;
$data['plan'] = $sub;
$data['activeUntil'] = date('m/d/Y', strtotime($sub->activeUntil));
}
} else {
// Creating a new account
$account = new Cart66Account();
$account->setData($acctData);
$account_errors = $account->validate();
if (count($account_errors) == 0) {
$sub = new Cart66AccountSubscription();
$sub->setData($planData);
$subscription_errors = $sub->validate();
if (count($subscription_errors) == 0) {
$account->save();
$sub->billingFirstName = $account->firstName;
$sub->billingLastName = $account->lastName;
$sub->billingInterval = 'Manual';
$sub->account_id = $account->id;
$subscription_product = new Cart66Product($sub->product_id);
$sub->subscription_plan_name = $subscription_product->name;
$sub->feature_level = $subscription_product->feature_level;
$sub->save();
$account->clear();
$data['just_saved'] = true;
} else {
$data['errors'] = $subscription_errors;
}
} else {
//.........这里部分代码省略.........
示例6: elseif
if (Cart66Common::isLoggedIn() && $account->isPayPalAccount()) {
// Expire the current subscription and attach a new subscription
$account->cancelSubscription('Your subscription has been canceled because you changed to a new subscription.', true);
}
$activeUntil = $plan->getStartTimeFormula();
$account->attachPayPalSubscription($details, $paypalPaymentProfileId, $plan, $activeUntil);
}
} elseif ($cartItem = Cart66Session::get('Cart66Cart')->getMembershipProductItem()) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Got membership product from the cart after a PayPal transaction.");
$product = new Cart66Product($cartItem->getProductId());
$account->attachMembershipProduct($product, $details['FIRSTNAME'], $details['LASTNAME']);
}
// Save the order
if ('FAILURE' != strtoupper($profileResponse['ACK'])) {
$token = Cart66Common::postVal('token');
$payerId = Cart66Common::postVal('PayerID');
$opts = Cart66Setting::getValue('status_options');
$status = '';
if (!empty($opts)) {
$opts = explode(',', $opts);
$status = trim($opts[0]);
}
$transId = isset($response['TRANSACTIONID']) ? $response['TRANSACTIONID'] : '';
$promo = Cart66Session::get('Cart66PromotionCode');
$promoMsg = "none";
if ($promo) {
$promoMsg = $promo . ' (-' . Cart66Common::currency(Cart66Session::get('Cart66Promotion')->getDiscountAmount(Cart66Session::get('Cart66Cart'))) . ')';
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Details:\n" . print_r($details, true));
list($shipFirstName, $shipLastName) = explode(' ', $details['SHIPTONAME'], 2);
$orderInfo['ship_first_name'] = $shipFirstName;
示例7: elseif
}
}
// An account should be created and the account data is valid
}
}
}
$gatewayName = Cart66Common::postVal('cart66-gateway-name');
if (in_array($gatewayName, $supportedGateways)) {
$gateway->validateCartForCheckout();
$gateway->setBilling(Cart66Common::postVal('billing'));
$gateway->setPayment(Cart66Common::postVal('payment'));
// Note that mijireh does not have a "same as billing" checkbox
if (isset($_POST['sameAsBilling'])) {
$gateway->setShipping(Cart66Common::postVal('billing'), true);
} elseif (isset($_POST['shipping'])) {
$gateway->setShipping(Cart66Common::postVal('shipping'));
}
$s = $gateway->getShipping();
if ($s['state'] && $s['zip']) {
$taxLocation = $gateway->getTaxLocation();
$tax = $gateway->getTaxAmount();
$rate = $gateway->getTaxRate();
Cart66Session::set('Cart66Tax', $tax);
Cart66Session::set('Cart66TaxRate', Cart66Common::tax($rate));
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Tax PreCalculated: \$" . $tax);
}
if (count($errors) == 0) {
$errors = $gateway->getErrors();
// Error info for server side error code
if (count($errors)) {
try {
示例8: pageSlurp
public static function pageSlurp()
{
require_once CART66_PATH . "/models/Pest.php";
require_once CART66_PATH . "/models/PestJSON.php";
$page_id = Cart66Common::postVal('page_id');
$page = get_page($page_id);
$slurp_url = get_permalink($page->ID);
$html = false;
$job_id = $slurp_url;
if (wp_update_post(array('ID' => $page->ID, 'post_status' => 'publish'))) {
$access_key = Cart66Setting::getValue('mijireh_access_key');
$rest = new PestJSON(MIJIREH_CHECKOUT);
$rest->setupAuth($access_key, '');
$data = array('url' => $slurp_url, 'page_id' => $page->ID, 'return_url' => add_query_arg('task', 'mijireh_page_slurp', $slurp_url));
try {
$response = $rest->post('/api/1/slurps', $data);
$job_id = $response['job_id'];
} catch (Pest_Unauthorized $e) {
header('Bad Request', true, 400);
die;
}
} else {
$job_id = 'did not update post successfully';
}
echo $job_id;
die;
}
示例9: removeTrackingNumber
public static function removeTrackingNumber($order)
{
$tracking = explode(',', $order->tracking_number);
if (in_array(Cart66Common::postVal('remove'), $tracking)) {
$key = array_search(Cart66Common::postVal('remove'), $tracking);
unset($tracking[$key]);
}
$tracking = implode(',', $tracking);
if ($tracking == '') {
$order->updateTracking(null);
} else {
$order->updateTracking($tracking);
}
}
示例10: basename
<?php
// Look for sendy opt-in
$mcIds = Cart66Common::postVal('sendy_subscribe_id');
if ($mcIds == 1) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Trying to register for Sendy newsletter");
$sendy_url = Cart66Setting::getValue('sendy_url');
$sendy_id = Cart66Setting::getValue('sendy_id');
if (isset($_POST['payment']) && isset($_POST['billing'])) {
// Process from on-site checkout forms
$email = $_POST['payment']['email'];
$name = $_POST['billing']['firstName'] . " " . $_POST['billing']['lastName'];
} elseif (isset($_POST['mailchimp_email']) && isset($_POST['mailchimp_first_name']) && isset($_POST['mailchimp_last_name'])) {
// Process from PayPal Express Checkout
$email = Cart66Common::postVal('mailchimp_email');
$extraFields = array('FirstName' => $_POST['mailchimp_first_name'], 'LastName' => $_POST['mailchimp_last_name']);
$name = $_POST['billing']['firstName'] . " " . $_POST['billing']['lastName'];
}
$Sendy = new Cart66Sendy();
$status = $Sendy->listSubscribe($sendy_url, $sendy_id, $email, $name);
if ($status != "true" && $status != "1") {
$logmsg = "Unable to subscribe!\n";
$logmsg .= "\tError=" . $status . "\n";
} else {
// We've got an error of some sort
$logmsg = "Subscribed Status:" . $status . " Fields: " . $email . "," . $sendy_id . "," . $name . "\n";
}
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] {$logmsg}");
} else {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Sendy User opted out of subscribing.");
}
示例11: Cart66Account
<?php
$create_account = false;
// Set up a new Cart66Account and start by pre-populating the data or load the logged in account
if ($accountId = Cart66Common::isLoggedIn()) {
$account = new Cart66Account($accountId);
} else {
$account = new Cart66Account();
if (isset($_POST['account'])) {
$acctData = Cart66Common::postVal('account');
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] New Account Data: " . print_r($acctData, true));
$account->firstName = $acctData['first_name'];
$account->lastName = $acctData['last_name'];
$account->email = $acctData['email'];
$account->username = $acctData['username'];
$account->password = md5($acctData['password']);
$errors = $account->validate();
$jqErrors = $account->getJqErrors();
if ($acctData['password'] != $acctData['password2']) {
$errors[] = __("Passwords do not match", "cart66");
$jqErrors[] = 'account-password';
$jqErrors[] = 'account-password2';
}
if (count($errors) == 0) {
$create_account = true;
} else {
if (count($errors)) {
try {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Unable to process order: " . print_r($errors, true));
throw new Cart66Exception(__('Your order could not be processed for the following reasons:', 'cart66'), 66500);
} catch (Cart66Exception $e) {
示例12: forceDownload
/**
* Force downloads for
* -- Cart66 reports (admin)
* -- Downloading the debuggin log file (admin)
* -- Downloading digital product files
*/
public function forceDownload()
{
ob_end_clean();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'export_csv') {
require_once CART66_PATH . "/models/Cart66Exporter.php";
$start = str_replace(';', '', $_POST['start_date']);
$end = str_replace(';', '', $_POST['end_date']);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Date parameters for report: START {$start} and END {$end}");
$report = Cart66Exporter::exportOrders($start, $end);
header('Content-Type: application/csv');
header('Content-Disposition: inline; filename="Cart66Report.csv"');
echo $report;
die;
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'download log file') {
$logFilePath = Cart66Log::getLogFilePath();
if (file_exists($logFilePath)) {
$logData = file_get_contents($logFilePath);
$cartSettings = Cart66Log::getCartSettings();
header('Content-Description: File Transfer');
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename=Cart66LogFile.txt');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
echo $cartSettings . "\n\n";
echo $logData;
die;
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'clear log file') {
Cart66Common::clearLog();
}
}
示例13: _setPromoFromPost
protected function _setPromoFromPost()
{
if (isset($_POST['couponCode']) && $_POST['couponCode'] != '') {
$couponCode = Cart66Common::postVal('couponCode');
$this->applyPromotion($couponCode);
} else {
if (Cart66Session::get('Cart66Promotion')) {
$currentPromotionCode = Cart66Session::get('Cart66PromotionCode');
$isAutoPromo = Cart66Session::get('Cart66Promotion')->auto_apply == 1 ? true : false;
$this->applyPromotion($currentPromotionCode, $isAutoPromo);
if (!Cart66Session::get('Cart66Promotion')) {
$this->_setAutoPromoFromPost();
}
} else {
$this->clearPromotion();
$this->_setAutoPromoFromPost();
}
}
}
示例14: cart66_recent_orders_setup
public static function cart66_recent_orders_setup()
{
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['widget_id']) && 'cart66_recent_orders_widget' == $_POST['widget_id']) {
$dashboardOrderLimit = Cart66Common::postVal('dashboard_order_limit');
Cart66Setting::setValue('dashboard_order_limit', $dashboardOrderLimit);
$dashboard_display_status = Cart66Common::postVal('dashboard_display_status');
Cart66Setting::setValue('dashboard_display_status', $dashboard_display_status);
$order_number_column = Cart66Common::postVal('dashboard_display_order_number');
Cart66Setting::setValue('dashboard_display_order_number', $order_number_column);
$dashboard_display_delivery = Cart66Common::postVal('dashboard_display_delivery');
Cart66Setting::setValue('dashboard_display_delivery', $dashboard_display_delivery);
}
$dashboardOrderLimit = Cart66Setting::getValue('dashboard_order_limit') ? Cart66Setting::getValue('dashboard_order_limit') : 10;
?>
<div class="optionsDiv">
<p>
<label for="dashboardOrderLimit"><?php
_e('How many recent orders would you like to display?', 'cart66');
?>
<input type='text' name='dashboard_order_limit' id='dashboard_order_limit' style='width: 50px;' value="<?php
echo $dashboardOrderLimit;
?>
" />
</label>
</p>
<p>
<label for="dashboard_display_status"><input type="checkbox" name='dashboard_display_status' id='dashboard_display_status' value="1" <?php
echo Cart66Setting::getValue('dashboard_display_status') == 1 ? 'checked="checked"' : '';
?>
/>
<?php
_e('Display Status Column', 'cart66');
?>
</label>
</p>
<p>
<label for="dashboard_display_order_number"><input type="checkbox" name='dashboard_display_order_number' id='dashboard_display_order_number' value="1" <?php
echo Cart66Setting::getValue('dashboard_display_order_number') == 1 ? 'checked="checked"' : '';
?>
/>
<?php
_e('Display Order Number Column', 'cart66');
?>
</label>
</p>
<p>
<label for="dashboard_display_delivery"><input type="checkbox" name='dashboard_display_delivery' id='dashboard_display_delivery' value="1" <?php
echo Cart66Setting::getValue('dashboard_display_delivery') == 1 ? 'checked="checked"' : '';
?>
/>
<?php
_e('Display Delivery Column', 'cart66');
?>
</label>
</p>
</div>
<?php
}
示例15: updateInventoryFromPost2
public function updateInventoryFromPost2($ikey)
{
$inventory = Cart66Common::getTableName('inventory');
$track = Cart66Common::postVal("track_{$ikey}");
$qty = Cart66Common::postVal("qty_{$ikey}");
$sql = "UPDATE {$inventory} set track=%d, quantity=%d where ikey=%s";
$sql = $this->_db->prepare($sql, $track, $qty, $ikey);
$this->_db->query($sql);
}