当前位置: 首页>>代码示例>>PHP>>正文


PHP Core\Request类代码示例

本文整理汇总了PHP中XLite\Core\Request的典型用法代码示例。如果您正苦于以下问题:PHP Request类的具体用法?PHP Request怎么用?PHP Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processCallback

 public function processCallback(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processCallback($transaction);
     $request = \XLite\Core\Request::getInstance();
     $json = file_get_contents('php://input');
     //\XLite\Logger::logCustom('pmt', var_export($json,1), '');
     $temp = json_decode($json, true);
     if ($this->getSetting('test')) {
         $this->public_key = $this->getSetting('testPublicKey');
         $this->secret_key = $this->getSetting('testSecretKey');
     } else {
         $this->public_key = $this->getSetting('realPublicKey');
         $this->secret_key = $this->getSetting('realSecretKey');
     }
     $signature_check = sha1($this->secret_key . $temp['account_id'] . $temp['api_version'] . $temp['event'] . $temp['data']['id']);
     $signature_check_sha512 = hash('sha512', $this->secret_key . $temp['account_id'] . $temp['api_version'] . $temp['event'] . $temp['data']['id']);
     if ($signature_check != $temp['signature'] && $signature_check_sha512 != $temp['signature']) {
         //hack detected
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('verification', 'Verification failed', 'Verification');
         $this->transaction->setNote('Verification failed');
     } else {
         $status = $transaction::STATUS_SUCCESS;
         $this->setDetail('result', 'Accept', 'Result');
     }
     $this->transaction->setStatus($status);
 }
开发者ID:pagantis,项目名称:pagamastarde-x-cart,代码行数:27,代码来源:PagaMasTarde.php

示例2: updateProfile

 /**
  * Update profile
  * FIXME
  *
  * @return void
  */
 protected function updateProfile()
 {
     if ($this->isCreateProfile()) {
         $error = user_validate_name(\XLite\Core\Request::getInstance()->username);
         if ($error) {
             // Username validation error
             $this->valid = false;
             \XLite\Core\Event::invalidElement('username', $error);
         } elseif (user_load_by_name(\XLite\Core\Request::getInstance()->username)) {
             // Username is already exists
             $this->valid = false;
             $label = static::t('This user name is used for an existing account. Enter another user name or sign in', array('URL' => $this->getLoginURL()));
             \XLite\Core\Event::invalidElement('username', $label);
         } elseif (\XLite\Core\Request::getInstance()->email && user_load_multiple(array(), array('mail' => \XLite\Core\Request::getInstance()->email))) {
             // E-mail is already exists in Drupal DB
             $this->valid = false;
             $label = static::t('This email address is used for an existing account. Enter another user name or sign in', array('URL' => $this->getLoginURL()));
             \XLite\Core\Event::invalidElement('email', $label);
         }
     }
     parent::updateProfile();
     if ($this->isCreateProfile() && $this->valid) {
         // Save username is session (temporary, wait place order procedure)
         \XLite\Core\Session::getInstance()->order_username = \XLite\Core\Request::getInstance()->create_profile ? \XLite\Core\Request::getInstance()->username : false;
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:32,代码来源:Checkout.php

示例3: processReturn

 /**
  * Process return
  *
  * @param \XLite\Model\Payment\Transaction $transaction Return-owner transaction
  *
  * @return void
  */
 public function processReturn(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processReturn($transaction);
     $request = \XLite\Core\Request::getInstance();
     if ($request->isPost() && isset($request->trans_result)) {
         $status = 'APPROVED' == $request->trans_result ? $transaction::STATUS_SUCCESS : $transaction::STATUS_FAILED;
         $this->saveDataFromRequest();
         // Amount checking
         if (isset($request->amount) && !$this->checkTotal($request->amount)) {
             $status = $transaction::STATUS_FAILED;
         }
         if (isset($request->decline_reason)) {
             $this->transaction->setNote($request->decline_reason);
         }
         // MD5 hash checking
         if ($status == $transaction::STATUS_SUCCESS && isset($request->md5_hash)) {
             $order = $this->getOrder();
             $amount = $order->getCurrency()->roundValue($this->transaction->getValue());
             $hash = md5(strval($this->getSetting('hash')) . $this->getSetting('login') . $request->transID . number_format($amount, 2) . ('Y' == $this->getSetting('include_response') ? $request->trans_result : ''));
             if ($hash != $request->md5_hash) {
                 $status = $transaction::STATUS_FAILED;
                 $this->setDetail('hash_checking', 'failed', 'MD5 hash checking');
             }
         }
         $this->transaction->setStatus($status);
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:34,代码来源:Quantum.php

示例4: doActionUpdate

 /**
  * Do action update
  *
  * @return void
  */
 protected function doActionUpdate()
 {
     if (\XLite\Core\Request::getInstance()->delete) {
         \XLite\Core\Database::getRepo('XLite\\Model\\Category')->removeProductFilterCache();
     }
     parent::doActionUpdate();
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:12,代码来源:ProductList.php

示例5: checkFieldValidity

 /**
  * Check field validity
  *
  * @return boolean
  */
 protected function checkFieldValidity()
 {
     $result = parent::checkFieldValidity();
     if ($result && $this->getValue()) {
         $length = strlen($this->getValue());
         // Check size
         if (static::MIN_SIZE > $length) {
             // Too small
             $result = false;
             $this->errorMessage = static::t('The length of X field must be greater than Y', array('name' => $this->getLabel(), 'min' => static::MIN_SIZE));
         } elseif (static::MAX_SIZE < $length) {
             // Too big
             $result = false;
             $this->errorMessage = static::t('The length of X field must be less than Y', array('name' => $this->getLabel(), 'max' => static::MAX_SIZE));
         } else {
             // Check duplicate
             $modelId = \XLite\Core\Request::getInstance()->id;
             $model = $modelId ? \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Coupons\\Model\\Coupon')->find($modelId) : null;
             $duplicates = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Coupons\\Model\\Coupon')->findDuplicates($this->getValue(), $model);
             if ($duplicates) {
                 $result = false;
                 $this->errorMessage = static::t('X code is already used for other coupon, please specify a different code', array('code' => $this->getValue()));
             }
         }
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:32,代码来源:Code.php

示例6: setReturnURL

 /**
  * Set return URL
  *
  * @param string $url URL to set
  *
  * @return void
  */
 public function setReturnURL($url)
 {
     if (\XLite\Module\CDev\Paypal\Main::isExpressCheckoutEnabled() && \XLite\Module\CDev\Paypal\Main::isInContextCheckoutAvailable() && \XLite\Core\Request::getInstance()->cancelUrl) {
         $url = $this->getShopURL(\XLite\Core\Request::getInstance()->cancelUrl, \XLite\Core\Config::getInstance()->Security->customer_security);
     }
     parent::setReturnURL($url);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:PaymentReturn.php

示例7: getOrder

 /**
  * Get order
  *
  * @return \XLite\Model\Order
  */
 public function getOrder()
 {
     if (!isset($this->order)) {
         $this->order = \XLite\Core\Database::getRepo('XLite\\Model\\Order')->find(\XLite\Core\Request::getInstance()->order_id);
     }
     return $this->order;
 }
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:CheckoutSuccess.php

示例8: init

 /**
  * init
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     if (\XLite\Core\Request::getInstance()->id) {
         $this->tabs['featured_products'] = array('title' => 'Featured products', 'template' => 'modules/CDev/FeaturedProducts/featured_products.tpl');
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:Category.php

示例9: doActionExpressCheckoutReturn

 /**
  * doExpressCheckoutReturn 
  * 
  * @return void
  */
 protected function doActionExpressCheckoutReturn()
 {
     $request = \XLite\Core\Request::getInstance();
     $cart = $this->getCart();
     \XLite\Module\CDev\Paypal\Main::addLog('doExpressCheckoutReturn()', $request->getData());
     if (isset($request->cancel)) {
         \XLite\Core\Session::getInstance()->ec_token = null;
         \XLite\Core\Session::getInstance()->ec_date = null;
         \XLite\Core\Session::getInstance()->ec_payer_id = null;
         \XLite\Core\Session::getInstance()->ec_type = null;
         $cart->unsetPaymentMethod();
         \XLite\Core\TopMessage::getInstance()->addWarning('Express Checkout process stopped.');
     } elseif (!isset($request->token) || $request->token != \XLite\Core\Session::getInstance()->ec_token) {
         \XLite\Core\TopMessage::getInstance()->addError('Wrong token of Express Checkout.');
     } elseif (!isset($request->PayerID)) {
         \XLite\Core\TopMessage::getInstance()->addError('PayerID value was not returned by PayPal.');
     } else {
         // Express Checkout shortcut flow processing
         \XLite\Core\Session::getInstance()->ec_type = \XLite\Module\CDev\Paypal\Model\Payment\Processor\ExpressCheckout::EC_TYPE_SHORTCUT;
         \XLite\Core\Session::getInstance()->ec_payer_id = $request->PayerID;
         $paymentMethod = $this->getExpressCheckoutPaymentMethod();
         $buyerData = $paymentMethod->getProcessor()->doGetExpressCheckoutDetails($paymentMethod, $request->token);
         if (empty($buyerData)) {
             \XLite\Core\TopMessage::getInstance()->addError('Your address data was not received from PayPal.');
         } else {
             // Fill the cart with data received from Paypal
             $this->requestData = $this->prepareBuyerData($buyerData);
             $this->updateProfile();
             $this->requestData['billingAddress'] = $this->requestData['shippingAddress'];
             $this->requestData['same_address'] = true;
             $this->updateShippingAddress();
             $this->updateBillingAddress();
         }
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:40,代码来源:Checkout.php

示例10: processReturn

 /**
  * Process return
  *
  * @param \XLite\Model\Payment\Transaction $transaction Return-owner transaction
  *
  * @return void
  */
 public function processReturn(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processReturn($transaction);
     $request = \XLite\Core\Request::getInstance();
     $status = 1 == $request->x_response_code ? $transaction::STATUS_SUCCESS : $transaction::STATUS_FAILED;
     if (isset($request->x_response_reason_text)) {
         $this->setDetail('response', $request->x_response_reason_text, 'Response');
         $this->transaction->setNote($request->x_response_reason_text);
     } elseif (isset($this->err[$request->x_response_reason_code])) {
         $this->setDetail('response', $this->err[$request->x_response_reason_code], 'Response');
         $this->transaction->setNote($this->err[$request->x_response_reason_code]);
     }
     if ($request->x_auth_code) {
         $this->setDetail('authCode', $request->x_auth_code, 'Auth code');
     }
     if ($request->x_trans_id) {
         $this->setDetail('transId', $request->x_trans_id, 'Transaction ID');
     }
     if ($request->x_response_subcode) {
         $this->setDetail('responseSubcode', $request->x_response_subcode, 'Response subcode');
     }
     if (isset($request->x_avs_code) && isset($this->avserr[$request->x_avs_code])) {
         $this->setDetail('avs', $this->avserr[$request->x_avs_code], 'AVS status');
     }
     if (isset($request->x_CVV2_Resp_Code) && isset($this->cvverr[$request->x_CVV2_Resp_Code])) {
         $this->setDetail('cvv', $this->cvverr[$request->x_CVV2_Resp_Code], 'CVV status');
     }
     if (!$this->checkTotal($request->x_amount)) {
         $status = $transaction::STATUS_FAILED;
     }
     $this->transaction->setStatus($status);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:39,代码来源:AuthorizeNetSIM.php

示例11: getDefaultParams

 /**
  * getDefaultParams
  *
  * @return array
  */
 protected function getDefaultParams()
 {
     $result = parent::getDefaultParams();
     $result['target'] = \XLite\Core\Request::getInstance()->target;
     $result['action'] = 'modify';
     return $result;
 }
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:Currency.php

示例12: doActionRegisterKey

 /**
  * Action of license key registration
  *
  * @return void
  */
 protected function doActionRegisterKey()
 {
     $key = \XLite\Core\Request::getInstance()->key;
     $addonsInfo = \XLite\Core\Marketplace::getInstance()->checkAddonKey($key);
     if ($addonsInfo && $addonsInfo[$key]) {
         $addonsInfo = $addonsInfo[$key];
         $repo = \XLite\Core\Database::getRepo('\\XLite\\Model\\ModuleKey');
         foreach ($addonsInfo as $info) {
             $module = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->findOneBy(array('author' => $info['author'], 'name' => $info['name']));
             if ($module) {
                 $entity = $repo->findKey($info['author'], $info['name']);
                 if ($entity) {
                     $entity->setKeyValue($key);
                     $repo->update($entity);
                 } else {
                     $entity = $repo->insert($info + array('keyValue' => $key));
                 }
                 \XLite\Core\Database::getEM()->flush();
                 // Clear cache for proper installation
                 \XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
                 $this->showInfo(__FUNCTION__, 'License key has been successfully verified for "{{name}}" module by "{{author}}" author', array('name' => $module->getModuleName(), 'author' => $module->getAuthorName()));
             } else {
                 $this->showError(__FUNCTION__, 'Key is validated, but the module [' . implode(',', $info) . '] was not found');
             }
         }
     } else {
         $error = \XLite\Core\Marketplace::getInstance()->getError();
         if ($error) {
             $this->showError(__FUNCTION__, 'Response from marketplace: ' . $error);
         } else {
             $this->showError(__FUNCTION__, 'Response from marketplace is not received');
         }
     }
     $this->setReturnURL($this->buildURL('addons_list_marketplace'));
 }
开发者ID:kingsj,项目名称:core,代码行数:40,代码来源:ModuleKey.php

示例13: doActionUpdate

 /**
  * Update model
  *
  * @return void
  */
 protected function doActionUpdate()
 {
     $this->getModelForm()->performAction('modify');
     if (!\XLite\Core\Request::getInstance()->id) {
         $this->setReturnURL($this->buildURL('page', '', array('id' => $this->getModelForm()->getModelObject()->getId())));
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:Page.php

示例14: handleRequest

 /**
  * Handle request 
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Request::getInstance()->action != 'add' && \XLite\Module\CDev\XPaymentsConnector\Core\Settings::getInstance()->checkUpdateAllowedModules()) {
         \XLite\Module\CDev\XPaymentsConnector\Core\Settings::getInstance()->importAllowedModules();
     }
     parent::handleRequest();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:PaymentSettings.php

示例15: doActionUpdate

 /**
  * Update payment method
  *
  * @return void
  */
 protected function doActionUpdate()
 {
     $settings = \XLite\Core\Request::getInstance()->settings;
     $method = $this->getPaymentMethod();
     if (!$method) {
         \XLite\Core\TopMessage::addError('An attempt to update settings of unknown payment method');
     } else {
         if (is_array($settings)) {
             foreach ($settings as $name => $value) {
                 $method->setSetting($name, trim($value));
             }
         }
         $properties = \XLite\Core\Request::getInstance()->properties;
         if (is_array($properties) && !empty($properties)) {
             $method->map($properties);
         }
         \XLite\Core\Database::getRepo('\\XLite\\Model\\Payment\\Method')->update($method);
         // If "just added" method is configured and can be enabled then we enable it
         if (\XLite\Core\Request::getInstance()->just_added && $method->isConfigured() && $method->canEnable()) {
             $method->setEnabled(true);
             \XLite\Core\Database::getEM()->flush();
         }
         if ($method->isConfigured()) {
             \XLite\Core\TopMessage::addInfo('The settings of payment method successfully updated');
             $this->setReturnURL($this->buildURL('payment_settings'));
         } else {
             \XLite\Core\TopMessage::addWarning('Payment method has not been configured properly');
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:35,代码来源:PaymentMethod.php


注:本文中的XLite\Core\Request类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。