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


PHP TopMessage::getInstance方法代码示例

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


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

示例1: handleRequest

 /**
  * handleRequest
  *
  * @return void
  */
 public function handleRequest()
 {
     if ($this->getModuleID() && 'CDev\\AmazonS3Images' == $this->getModule()->getActualName() && \XLite\Core\Request::getInstance()->isGet() && !\XLite\Core\TopMessage::getInstance()->getPreviousMessages()) {
         $this->checkAmazonS3Settings();
     }
     parent::handleRequest();
 }
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:Module.php

示例2: capostValidateMerchant

 /**
  * Validate return from Canada Post merchant registration process
  *
  * @return void
  */
 protected function capostValidateMerchant()
 {
     $token = \XLite\Core\Request::getInstance()->{'token-id'};
     $status = \XLite\Core\Request::getInstance()->{'registration-status'};
     if (\XLite\Module\XC\CanadaPost\Core\Service\Platforms::REG_STATUS_SUCCESS === $status) {
         // Registration is complete
         // Send request to Canada Post server to retrieve merchant details
         $data = \XLite\Module\XC\CanadaPost\Core\Service\Platforms::getInstance()->callGetMerchantRegistrationInfoByToken($token);
         if (isset($data->merchantInfo)) {
             // Update Canada Post settings
             $this->updateCapostMerchantSettings($data->merchantInfo);
             // Disable wizard
             $this->disableCapostWizard();
             \XLite\Core\TopMessage::getInstance()->addInfo('Registration process has been completed successfully.');
         } else {
             foreach ($data->errors as $err) {
                 \XLite\Core\TopMessage::getInstance()->addError('ERROR: [' . $err->code . '] ' . $err->description);
             }
         }
     } else {
         // An error occurred
         if (\XLite\Module\XC\CanadaPost\Core\Service\Platforms::REG_STATUS_CANCELLED === $status) {
             \XLite\Core\TopMessage::getInstance()->addError('Registration process has been canceled.');
         } else {
             \XLite\Core\TopMessage::getInstance()->addError('Failure to finish registration process.');
         }
     }
     // Remove token from the session
     \XLite\Core\Session::getInstance()->capost_token_id = null;
     \XLite\Core\Session::getInstance()->capost_token_ts = null;
     // Redirect back to the Canada Post settings page
     $this->setReturnURL($this->buildURL('capost'));
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:38,代码来源:Main.php

示例3: __construct

 /**
  * X-Cart Wrapper for BitPay Library
  * @param \XLite\Model\Payment\Method $method
  */
 public function __construct($method)
 {
     $this->method = $method;
     // Load up the BitPay library
     $autoloader = LC_DIR_MODULES . 'BitPay' . LC_DS . 'BitPay' . LC_DS . 'lib' . LC_DS . 'Bitpay' . LC_DS . 'xcartAutoloader.php';
     if (true === file_exists($autoloader) && true === is_readable($autoloader)) {
         require_once $autoloader;
         \Bitpay\xcartAutoloader::register();
     } else {
         \XLite\Core\TopMessage::getInstance()->addError('[Error] Unable to load BitPay library');
     }
 }
开发者ID:bitpay,项目名称:xcart-plugin,代码行数:16,代码来源:XcartWrapper.php

示例4: doActionUpdate

 public function doActionUpdate()
 {
     $request = \XLite\Core\Request::getInstance();
     $result = false;
     if ($request->delete_token) {
         try {
             $condition = array('id' => $request->delete_token);
             $repo = $this->getModelRepo();
             $token = $repo->findOneBy($condition);
             $this->getEM()->remove($token);
             $this->getEM()->flush();
             $result = true;
         } catch (Exception $e) {
         }
     }
     if ($result) {
         \XLite\Core\TopMessage::getInstance()->addInfo('Operation successfull');
     }
 }
开发者ID:hps,项目名称:heartland-x-cart5-plugin,代码行数:19,代码来源:SecuresubmitCreditCards.php

示例5: getTokenId

 /**
  * Get Canada Post merchant registration token
  *
  * @return string
  */
 public function getTokenId()
 {
     $token = null;
     if (!$this->isTokenValid()) {
         // Send request to Canada Post server to retrieve token
         $data = \XLite\Module\XC\CanadaPost\Core\Service\Platforms::getInstance()->callGetMerchantRegistrationToken();
         if (isset($data->token)) {
             $token = $data->token->tokenId;
             \XLite\Core\Session::getInstance()->capost_token_id = $token;
             \XLite\Core\Session::getInstance()->capost_token_ts = \XLite\Core\Converter::time();
             \XLite\Core\Session::getInstance()->capost_developer_mode = \XLite\Core\Config::getInstance()->XC->CanadaPost->developer_mode;
         } else {
             // TODO: print real error message returned by the request
             \XLite\Core\TopMessage::getInstance()->addError('Failure to get token ID.');
         }
     } else {
         // Get token from the session
         $token = \XLite\Core\Session::getInstance()->capost_token_id;
     }
     return $token;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:26,代码来源:Settings.php

示例6: isWrongLocation

 /**
  * isWrongLocation 
  * 
  * @return boolean
  */
 protected function isWrongLocation()
 {
     $result = false;
     // Counter of checkings
     $counter = isset(\XLite\Core\Config::getInstance()->Internal->check_location) ? intval(\XLite\Core\Config::getInstance()->Internal->check_location) : 1;
     // Check location each 10 visits of the admin dashboard page
     if (0 < $counter) {
         // Prepare new value for counter
         $newCounterValue = 10 == $counter ? 1 : $counter + 1;
         if (1 === $counter) {
             // Check directory location
             $result = preg_match('/modules\\/lc_connector/', __DIR__);
             if ($result) {
                 // Generate top message
                 \XLite\Core\TopMessage::getInstance()->addWarning('Warning: LiteCommerce is installed within the "LC Connector" module directory. It is strongly recommended to move LiteCommerce directory from that location to avoid the problem, described <a href="http://www.facebook.com/litecommerce/posts/440928792599823">here</a>. You can find the instructions on how to do it <a href="https://github.com/litecommerce/core/wiki/Moving-LiteCommerce-subdirectory-to-the-Drupal-directory" target="new">here</a>. If you find it difficult to follow the instruction yourself, please contact <a href="mailto:xlite@litecommerce.com">xlite@litecommerce.com</a> or create a ticket at <a href="http://bt.litecommerce.com/">Bugtracker</a>.');
             } else {
                 $newCounterValue = 0;
             }
         }
         // Create/Update option with new counter value
         \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('name' => 'check_location', 'category' => 'Internal', 'value' => $newCounterValue));
     }
     return $result;
 }
开发者ID:kingsj,项目名称:core,代码行数:29,代码来源:CheckLocation.php

示例7: doRecharge

 /**
  * Do Recharge the difference request.
  * Returns false on failure or redirects admin back to the order page
  * the necessary actions with the backend transaction are taken in the
  * Callback request processing
  *
  * @param \XLite\Model\Order $order Order which is recharged
  * @param \XLite\Model\Payment\Transaction $parentCardTransaction Trandaction with saved card
  * @param float $amount Amount to recharge
  *
  * @return boolean
  */
 public function doRecharge(\XLite\Model\Order $order, \XLite\Model\Payment\Transaction $parentCardTransaction, $amount)
 {
     $newTransaction = new \XLite\Model\Payment\Transaction();
     $newTransaction->setPaymentMethod($this->getSavedCardsPaymentMethod());
     $newTransaction->setStatus(\XLite\Model\Payment\Transaction::STATUS_INPROGRESS);
     $newTransaction->setDataCell('is_recharge', 'Y', null, 'C');
     $newTransaction->setValue($amount);
     $order->addPaymentTransactions($newTransaction);
     $newTransaction->setOrder($order);
     foreach ($this->paymentSettingsToSave as $field) {
         $key = 'xpc_can_do_' . $field;
         if ($parentCardTransaction->getDataCell($key) && $parentCardTransaction->getDataCell($key)->getValue()) {
             $newTransaction->setDataCell($key, $parentCardTransaction->getDataCell($key)->getValue(), null, 'C');
         }
     }
     $this->copyMaskedCard($parentCardTransaction, $newTransaction);
     $recharge = $this->client->requestPaymentRecharge($parentCardTransaction->getDataCell('xpc_txnid')->getValue(), $newTransaction);
     if ($recharge->isSuccess()) {
         $response = $recharge->getResponse();
         if (self::STATUS_AUTH == $response['status'] || self::STATUS_CHARGED == $response['status']) {
             \XLite\Core\TopMessage::getInstance()->addInfo($response['message'] ? $response['message'] : 'Operation successfull');
             if ($response['transaction_id']) {
                 $newTransaction->setDataCell('xpc_txnid', $response['transaction_id'], 'X-Payments transaction ID', 'C');
             }
         } else {
             \XLite\Core\TopMessage::getInstance()->addError($response['error'] ? $response['error'] : 'Operation failed');
             $newTransaction->setStatus(\XLite\Model\Payment\Transaction::STATUS_FAILED);
         }
     } else {
         $message = 'Operation failed';
         if ($recharge->getError()) {
             $message .= '. ' . $recharge->getError();
         }
         \XLite\Core\TopMessage::getInstance()->addError($message);
         $newTransaction->setStatus(\XLite\Model\Payment\Transaction::STATUS_FAILED);
     }
     \XLite\Core\Database::getEM()->flush();
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:50,代码来源:AXPayments.php

示例8: prepareInlineWidget

 /**
  * Prepare and validate inline widget
  *
  * @param \XLite\View\FormField\Inline\AInline $widget Widget
  *
  * @return boolean
  */
 protected function prepareInlineWidget(\XLite\View\FormField\Inline\AInline $widget)
 {
     $widget->setValueFromRequest();
     list($flag, $message) = $widget->validate();
     if (!$flag) {
         \XLite\Core\TopMessage::getInstance()->addError($message);
     }
     return $flag;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:Model.php

示例9: postprocessImport

 /**
  * Add diagnostic messages after importing is finished
  *
  * @return void
  */
 protected function postprocessImport()
 {
     $this->importCell['old'] = \XLite\Core\Database::getRepo('XLite\\Model\\Product')->countLastUpdated($this->importCell['start']);
     $this->importCell['old'] -= $this->importCell['new'];
     $this->importCell['old'] = max(0, $this->importCell['old']);
     $label = null;
     if ($this->importCell['new'] && $this->importCell['old']) {
         $label = 'Occurred X add product events and Y update product events';
     } elseif ($this->importCell['new']) {
         $label = 'Occurred X add product events';
     } elseif ($this->importCell['old']) {
         $label = 'Occurred Y update product events';
     }
     if ($label) {
         \XLite\Core\TopMessage::getInstance()->add($label, array('new' => $this->importCell['new'], 'old' => $this->importCell['old']), null, \XLite\Core\TopMessage::INFO, false, false);
     }
     if (0 < $this->importCell['warning_count']) {
         \XLite\Core\TopMessage::getInstance()->add('During the import was recorded X errors. You can get them by downloading the log files.', array('count' => $this->importCell['warning_count'], 'url' => \XLite\Logger::getInstance()->getCustomLogURL('import')), null, \XLite\Core\TopMessage::WARNING, false, false);
         \XLite\Core\TopMessage::getInstance()->add('Some products could have been imported incorrectly', array(), null, \XLite\Core\TopMessage::WARNING, false, false);
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:26,代码来源:ImportExport.php

示例10: postprocessErrorAction

 /**
  * Perform some actions on error
  *
  * @return void
  */
 protected function postprocessErrorAction()
 {
     \XLite\Core\TopMessage::getInstance()->addBatch($this->getErrorMessages(), \XLite\Core\TopMessage::ERROR);
     $method = __FUNCTION__ . ucfirst($this->currentAction);
     if (method_exists($this, $method)) {
         // Run corresponded function
         $this->{$method}();
     }
     $this->setActionError();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:AModel.php

示例11: getTopMessages

 /**
  * Get top messages
  *
  * @return array
  */
 protected function getTopMessages()
 {
     if (!isset($this->messages)) {
         $this->messages = \XLite\Core\TopMessage::getInstance()->unloadPreviousMessages();
     }
     return $this->messages;
 }
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:TopMessage.php

示例12: process

 /**
  * Process
  *
  * @return void
  */
 public function process()
 {
     if ($this->preValidateAction()) {
         parent::process();
         $items = \XLite\Core\Database::getRepo('XLite\\Model\\OrderItem')->search($this->getSearchCondition());
         foreach ($items as $item) {
             $item->calculate();
         }
     } else {
         \XLite\Core\TopMessage::getInstance()->addError(static::t('All items cannot be removed from the order.'));
         $this->setActionError();
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:OrderItem.php

示例13: processRefundTransactionResponse

 /**
  * Process DoCapture response
  *
  * @param \XLite\Model\Payment\BackendTransaction $transaction  Transaction
  * @param string                                  $responseData Response data OPTIONAL
  *
  * @return boolean
  */
 protected function processRefundTransactionResponse(\XLite\Model\Payment\BackendTransaction $transaction, $responseData = null)
 {
     $result = false;
     if (!empty($responseData)) {
         $status = \XLite\Model\Payment\Transaction::STATUS_FAILED;
         if ('Success' === $responseData['ACK']) {
             $result = true;
             $status = \XLite\Model\Payment\Transaction::STATUS_SUCCESS;
             $transaction->getPaymentTransaction()->getOrder()->setPaymentStatus(\XLite\Model\Order\Status\Payment::STATUS_REFUNDED);
             // save transaction id for IPN
             $transaction->setDataCell('PPREF', $responseData['REFUNDTRANSACTIONID'], 'Unique PayPal transaction ID (REFUNDTRANSACTIONID)');
             \XLite\Core\TopMessage::getInstance()->addInfo('Payment has bes refunded successfully');
         } else {
             \XLite\Core\TopMessage::getInstance()->addError('Transaction failure. PayPal response: ' . $responseData['L_LONGMESSAGE0']);
         }
         $transaction->setStatus($status);
         $transaction->update();
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:28,代码来源:ExpressCheckoutMerchantAPI.php

示例14: setModelProperties

 /**
  * Populate model object properties by the passed data
  *
  * @param array $data Data to set
  *
  * @return void
  */
 protected function setModelProperties(array $data)
 {
     if (isset($data['enabled']) && !$data['enabled']) {
         $data = array('enabled' => '0');
     }
     foreach ($data as $name => $value) {
         switch ($name) {
             case 'agreement':
                 $value = !empty($value);
                 break;
             case 'email':
                 $publisherId = $this->getModelObject()->getSetting('publisherId');
                 $email = $this->getModelObject()->getSetting('email');
                 if (empty($publisherId) || $email !== $value) {
                     $publisherId = Paypal\Core\PaypalCredit::getInstance()->getPublisherId($value);
                     if (empty($publisherId)) {
                         \XLite\Core\TopMessage::getInstance()->addWarning('Unable to retrieve Publisher ID for specified PayPal account. Banners are now disabled.');
                     }
                     $this->getModelObject()->setSetting('publisherId', $publisherId);
                 }
                 break;
             default:
                 break;
         }
         $this->getModelObject()->setSetting($name, $value);
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:34,代码来源:PaypalCredit.php

示例15: processUpdateWarnings

 /**
  * Process errors
  *
  * @return void
  */
 protected function processUpdateWarnings()
 {
     $warnings = $this->getWarningMessages();
     if ($warnings) {
         \XLite\Core\TopMessage::getInstance()->addBatch($warnings, \XLite\Core\TopMessage::WARNING);
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:12,代码来源:AModel.php


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