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


PHP Logger::getInstance方法代码示例

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


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

示例1: send

 /**
  * Send message
  *
  * @return boolean
  */
 public function send()
 {
     if (\XLite\Core\Config::getInstance()->XC->WebmasterKit->logMail) {
         \XLite\Logger::getInstance()->logCustom('mail-messages', 'From: ' . $this->mail->From . PHP_EOL . 'To: ' . $this->get('to') . PHP_EOL . 'Subject: ' . $this->mail->Subject . PHP_EOL . $this->mail->Body . PHP_EOL . PHP_EOL);
     }
     return parent::send();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:Mailer.php

示例2: __construct

 /**
  * Constructor
  * Creates directory for locks if needed
  */
 public function __construct()
 {
     if (!\Includes\Utils\FileManager::isExists(rtrim(static::LOCK_DIR, LC_DS))) {
         \Includes\Utils\FileManager::mkdirRecursive(rtrim(static::LOCK_DIR, LC_DS));
     }
     if (!\Includes\Utils\FileManager::isReadable(static::LOCK_DIR) || !\Includes\Utils\FileManager::isWriteable(static::LOCK_DIR)) {
         \XLite\Logger::getInstance()->log('Cannot create lock for keys', LOG_DEBUG);
     }
     parent::__construct();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:14,代码来源:FileLock.php

示例3: startEntityManager

 /**
  * Start Doctrine entity manager
  *
  * @return void
  */
 public function startEntityManager()
 {
     parent::startEntityManager();
     if (!defined('LC_CACHE_BUILDING')) {
         if (\XLite\Module\XC\WebmasterKit\Core\Profiler::getInstance()->enabled) {
             static::$em->getConnection()->getConfiguration()->setSQLLogger(\XLite\Module\XC\WebmasterKit\Core\Profiler::getInstance());
         } elseif (\XLite\Core\Config::getInstance()->XC->WebmasterKit->logSQL) {
             static::$em->getConnection()->getConfiguration()->setSQLLogger(\XLite\Logger::getInstance());
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:Database.php

示例4: getModule

 /**
  * Return current module object
  *
  * @return \XLite\Model\Module
  * @throws \Exception
  */
 public function getModule()
 {
     if (!isset($this->module)) {
         $this->module = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->find($this->getModuleID());
         if (!$this->module) {
             \XLite\Core\TopMessage::addError('Add-on does not exist.');
             \XLite\Logger::getInstance()->log('Add-on does not exist (ID: ' . $this->getModuleID() . ')', LOG_ERR);
             $this->redirect($this->buildURL('addons_list_installed'));
         }
     }
     return $this->module;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:Module.php

示例5: doActionCallback

 /**
  * Process callback
  *
  * @return void
  */
 protected function doActionCallback()
 {
     $transaction = $this->detectTransaction();
     if ($transaction) {
         $this->transaction = $transaction;
         $transaction->getPaymentMethod()->getProcessor()->processCallback($transaction);
         $cart = $transaction->getOrder();
         if ($cart instanceof \XLite\Model\Cart) {
             $cart->tryClose();
         }
         $transaction->getOrder()->setPaymentStatusByTransaction($transaction);
         $transaction->getOrder()->update();
         \XLite\Core\Database::getEM()->flush();
     } else {
         \XLite\Logger::getInstance()->log('Request callback with undefined payment transaction' . PHP_EOL . 'Data: ' . var_export(\XLite\Core\Request::getInstance()->getData(), true), LOG_ERR);
     }
     $this->set('silent', true);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:23,代码来源:CallbackAbstract.php

示例6: getRequestData

 /**
  * Get request data
  *
  * @return mixed
  */
 public function getRequestData()
 {
     $data = null;
     $validator = $this->getValidator();
     try {
         $validator->validate(\XLite\Core\Request::getInstance()->getData());
         $data = $validator->sanitize(\XLite\Core\Request::getInstance()->getData());
     } catch (\XLite\Core\Validator\Exception $exception) {
         $message = static::t($exception->getMessage(), $exception->getLabelArguments());
         if ($exception->isInternal()) {
             \XLite\Logger::getInstance()->log($message, LOG_ERR);
         } else {
             \XLite\Core\Event::invalidElement($exception->getPath(), $message);
         }
         $this->validationMessage = ($exception->getPublicName() ? static::t($exception->getPublicName()) . ': ' : '') . $message;
     }
     return $data;
 }
开发者ID:kingsj,项目名称:core,代码行数:23,代码来源:AForm.php

示例7: processItem

 /**
  * Process item
  *
  * @param mixed $item Item
  *
  * @return boolean
  */
 protected function processItem($item)
 {
     $result = false;
     $path = tempnam(LC_DIR_TMP, 'migrate_file');
     file_put_contents($path, $item->getBody());
     if (\Includes\Utils\FileManager::isExists($path)) {
         $localPath = $item->isURL() ? null : $item->getStoragePath();
         $result = $item->loadFromLocalFile($path, $item->getFileName() ?: basename($item->getPath()));
         if ($result && $localPath && \Includes\Utils\FileManager::isExists($localPath)) {
             \Includes\Utils\FileManager::deleteFile($localPath);
         }
         \Includes\Utils\FileManager::deleteFile($path);
     }
     if (!$result) {
         if (!isset($this->record['s3_error_count'])) {
             $this->record['s3_error_count'] = 0;
         }
         $this->record['s3_error_count']++;
         \XLite\Logger::getInstance()->log('Couldn\'t move image ' . $item->getPath() . ' (local file system to Amazon S3)', LOG_ERR);
     }
     return true;
 }
开发者ID:kingsj,项目名称:core,代码行数:29,代码来源:MigrateToS3.php

示例8: processItem

 /**
  * Process item
  *
  * @param mixed $item Item
  *
  * @return boolean
  */
 protected function processItem($item)
 {
     $result = false;
     $path = tempnam(LC_DIR_TMP, 'migrate_file');
     file_put_contents($path, $item->getBody());
     if (file_exists($path)) {
         $item->setS3Forbid(true);
         $localPath = $item->getStoragePath();
         $result = $item->loadFromLocalFile($path, $item->getFileName() ?: basename($item->getPath()));
         if ($localPath) {
             \XLite\Module\CDev\AmazonS3Images\Core\S3::getInstance()->delete($localPath);
         }
         unlink($path);
     }
     if (!$result) {
         if (!isset($this->record['s3_error_count'])) {
             $this->record['s3_error_count'] = 0;
         }
         $this->record['s3_error_count']++;
         \XLite\Logger::getInstance()->log('Couldn\'t move image ' . $item->getPath() . ' (Amazon S3 to local file system)', LOG_ERR);
     }
     return true;
 }
开发者ID:kingsj,项目名称:core,代码行数:30,代码来源:MigrateFromS3.php

示例9: callAction

 /**
  * Call controller action
  *
  * @return void
  */
 protected function callAction()
 {
     $action = $this->getAction();
     $method = 'doAction' . \Includes\Utils\Converter::convertToPascalCase($action);
     if (method_exists($this, $method)) {
         // Call method doAction<action-name-in-camel-case>
         $this->{$method}();
     } else {
         \XLite\Logger::getInstance()->log('Handler for the action "' . $action . '" is not defined for the "' . get_class($this) . '" class');
     }
     $this->actionPostprocess($action);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:AController.php

示例10: doActionCallback

 /**
  * Process callback
  *
  * @return void
  */
 protected function doActionCallback()
 {
     $txn = null;
     $txnIdName = 'txnId';
     if (isset(\XLite\Core\Request::getInstance()->txn_id_name)) {
         /**
          * some of gateways can't accept return url on run-time and
          * use the one set in merchant account, so we can't pass
          * 'order_id' in run-time, instead pass the order id parameter name
          */
         $txnIdName = \XLite\Core\Request::getInstance()->txn_id_name;
     }
     if (isset(\XLite\Core\Request::getInstance()->{$txnIdName})) {
         $txn = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Transaction')->find(\XLite\Core\Request::getInstance()->{$txnIdName});
     }
     if (!$txn) {
         $methods = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Method')->findAllActive();
         foreach ($methods as $method) {
             if (method_exists($method->getProcessor(), 'getCallbackOwnerTransaction')) {
                 $txn = $method->getProcessor()->getCallbackOwnerTransaction();
                 if ($txn) {
                     break;
                 }
             }
         }
     }
     if ($txn) {
         $txn->getPaymentMethod()->getProcessor()->processCallback($txn);
         $cart = $txn->getOrder();
         if (!$cart->isOpen()) {
             // TODO: move it to \XLite\Controller\ACustomer
             if ($cart->isPayed()) {
                 $status = $txn->isCaptured() ? \XLite\Model\Order::STATUS_PROCESSED : \XLite\Model\Order::STATUS_AUTHORIZED;
             } else {
                 if ($txn->isRefunded()) {
                     $status = \XLite\Model\Order::STATUS_DECLINED;
                 } elseif ($txn->isFailed()) {
                     $status = \XLite\Model\Order::STATUS_FAILED;
                 } else {
                     $status = \XLite\Model\Order::STATUS_QUEUED;
                 }
             }
             $cart->setStatus($status);
         }
     } else {
         \XLite\Logger::getInstance()->log('Request callback with undefined payment transaction' . PHP_EOL . 'Data: ' . var_export(\XLite\Core\Request::getInstance()->getData(), true), LOG_ERR);
     }
     \XLite\Core\Database::getEM()->flush();
     $this->set('silent', true);
 }
开发者ID:kingsj,项目名称:core,代码行数:55,代码来源:Callback.php

示例11: doActionSelectUploadLanguageFile

 /**
  * "Upload" handler for category images.
  *
  * @return void
  */
 protected function doActionSelectUploadLanguageFile()
 {
     $result = null;
     $error = null;
     $message = null;
     $key = 'uploaded_file';
     $cell = isset($_FILES[$key]) ? $_FILES[$key] : null;
     if ($cell) {
         $size = null;
         switch ($cell['error']) {
             case UPLOAD_ERR_OK:
                 $path = \Includes\Utils\FileManager::getUniquePath(LC_DIR_TMP, $cell['name']);
                 if (move_uploaded_file($cell['tmp_name'], $path)) {
                     $result = $path;
                 }
                 break;
             case UPLOAD_ERR_INI_SIZE:
                 $size = ini_get('upload_max_filesize');
             case UPLOAD_ERR_FORM_SIZE:
                 $size = $size ?: \XLite\Core\Request::getInstance()->MAX_FILE_SIZE;
                 $error = 'File size exceeds the maximum size (' . $size . ')';
                 $size = \XLite\Core\Converter::convertShortSizeToHumanReadable($size);
                 $message = \XLite\Core\Translation::lbl('File size exceeds the maximum size', array('size' => $size));
                 break;
             case UPLOAD_ERR_PARTIAL:
                 $error = 'The uploaded file was only partially uploaded';
             case UPLOAD_ERR_NO_FILE:
                 $error = $error ?: 'No file was uploaded';
             case UPLOAD_ERR_NO_TMP_DIR:
                 $error = $error ?: 'Missing a temporary folder';
             case UPLOAD_ERR_CANT_WRITE:
                 $error = $error ?: 'Failed to write file to disk';
             case UPLOAD_ERR_EXTENSION:
                 $message = \XLite\Core\Translation::lbl('The file was not loaded because of a failure on the server.');
                 $error = $error ?: 'File upload stopped by extension';
                 break;
             default:
         }
     }
     if ($result && $message) {
         \XLite\Logger::getInstance()->log('Upload file error: ' . $error ?: $message, LOG_ERR);
     }
     $this->doActionSelectLanguageFile($result, $message);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:49,代码来源:SelectFileAbstract.php

示例12: uninstallModule

 /**
  * Uninstall module
  *
  * @param \XLite\Model\Module $module    Module object
  * @param array               &$messages Messages list
  *
  * @return boolean
  */
 public function uninstallModule(\XLite\Model\Module $module, &$messages)
 {
     $result = false;
     // Get module pack
     $pack = new \XLite\Core\Pack\Module($module);
     $dirs = $pack->getDirs();
     $nonWritableDirs = array();
     // Check module directories permissions
     foreach ($dirs as $dir) {
         if (\Includes\Utils\FileManager::isExists($dir) && !\Includes\Utils\FileManager::isDirWriteable($dir)) {
             $nonWritableDirs[] = \Includes\Utils\FileManager::getRelativePath($dir, LC_DIR_ROOT);
         }
     }
     $params = array('name' => sprintf('%s v%s (%s)', $module->getModuleName(), $module->getVersion(), $module->getAuthorName()));
     if (empty($nonWritableDirs)) {
         $yamlData = array();
         $yamlFiles = \Includes\Utils\ModulesManager::getModuleYAMLFiles($module->getAuthor(), $module->getName());
         foreach ($yamlFiles as $yamlFile) {
             $yamlData[] = \Includes\Utils\FileManager::read($yamlFile);
         }
         if (!$module->checkModuleMainClass()) {
             $classFile = LC_DIR_CLASSES . \Includes\Utils\Converter::getClassFile($module->getMainClass());
             if (\Includes\Utils\FileManager::isFileReadable($classFile)) {
                 require_once $classFile;
             }
         }
         // Call uninstall event method
         $r = $module->callModuleMethod('callUninstallEvent', 111);
         if (111 == $r) {
             \XLite\Logger::getInstance()->log($module->getActualName() . ': Method callUninstallEvent() was not called');
         }
         // Remove from FS
         foreach ($dirs as $dir) {
             \Includes\Utils\FileManager::unlinkRecursive($dir);
         }
         \Includes\Utils\ModulesManager::disableModule($module->getActualName());
         \Includes\Utils\ModulesManager::removeModuleFromDisabledStructure($module->getActualName());
         // Remove module from DB
         try {
             // Refresh module entity as it was changed by disableModule() method above
             $module = $this->find($module->getModuleID());
             $this->delete($module);
         } catch (\Exception $e) {
             $messages[] = $e->getMessage();
         }
         if ($module->getModuleID()) {
             $messages[] = \XLite\Core\Translation::getInstance()->translate('A DB error occured while uninstalling the module X', $params);
         } else {
             if (!empty($yamlData)) {
                 foreach ($yamlData as $yaml) {
                     \XLite\Core\Database::getInstance()->unloadFixturesFromYaml($yaml);
                 }
             }
             $messages[] = \XLite\Core\Translation::getInstance()->translate('The module X has been uninstalled successfully', $params);
             $result = true;
         }
     } else {
         $messages[] = \XLite\Core\Translation::getInstance()->translate('Unable to delete module X files: some dirs have no writable permissions: Y', $params + array('dirs' => implode(', ', $nonWritableDirs)));
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:69,代码来源:Module.php

示例13: getCallbackOwnerTransaction

 /**
  * Get callback request owner transaction or null
  *
  * @return \XLite\Model\Payment\Transaction
  */
 public function getCallbackOwnerTransaction()
 {
     if ($this->detectedTransaction) {
         return $this->detectedTransaction;
     }
     $request = \XLite\Core\Request::getInstance();
     if (!$request->xpcBackReference || !$request->txnId) {
         // This is not X-Payments callback
         return null;
     }
     $logMessage = $parentId = $updateData = '';
     do {
         // Check IP address
         if (!$this->checkIpAddress()) {
             $logMessage = self::getIncorrectIpAddrressError();
             $this->detectedTransaction = $transaction;
             break;
         }
         // Search transaction by back reference from request
         $transaction = $this->searchTransactionByBackReference($request->xpcBackReference);
         if (!$transaction) {
             $logMessage = 'Cannot detect transaction';
             $this->detectedTransaction = null;
             break;
         }
         if ($request->action == 'check_cart') {
             // This is check cart callback request
             $logMessage = 'Check cart callback request received';
             $this->detectedTransaction = $transaction;
             break;
         }
         try {
             // Extract decrypted data into array (exception can be thrown here)
             $updateData = $this->client->processApiResponse($request->updateData);
             // Save decrypted and parsed data
             $this->updateData = $updateData;
         } catch (\XLite\Module\CDev\XPaymentsConnector\Core\XpcResponseException $exception) {
             // Error extracting the data from callback request
             $logMessage = $exception->getMessage();
             $this->detectedTransaction = null;
             break;
         }
         if (!isset($updateData['parentId'])) {
             // Parent ID is not received
             // This is calback of X-Payments payment method
             $logMessage = 'Card present payment method callback request';
             $this->detectedTransaction = $transaction;
             break;
         }
         $parentId = $updateData['parentId'];
         if ($this->isSavedCardsPaymentMethod()) {
             if ($transaction->getDataCell('is_recharge') && 'Y' == $transaction->getDataCell('is_recharge')->getValue()) {
                 // This transaction is recharge for AOM
                 $logMessage = 'Recharge transaction for AOM found';
                 $this->detectedTransaction = $transaction;
             } else {
                 // Search Saved Card transaction in profile.
                 // Order is now being placed by customer.
                 $this->detectedTransaction = $this->searchSavedCardTransaction($transaction, $logMessage);
             }
             break;
         }
         if (!$this->isSavedCardTransaction($transaction)) {
             // Try to find a transaction with the same txnId received from X-Payments.
             // If it exists, it means that it was created by recharge callback from X-Payments.
             // And this request is a secondary action: capture/void/refund
             $secondaryTransactionForExtrnalRecharge = $this->searchTransactionByTxnId($request->txnId);
             if ($secondaryTransactionForExtrnalRecharge) {
                 // Use the already existing transaction
                 $this->detectedTransaction = $secondaryTransactionForExtrnalRecharge;
                 $logMessage = 'Found a transaction for which this is a secondary action';
             } else {
                 // Create new order for subscription/recharge created on X-Payments side
                 // by the original card present transaction passed by backreference
                 $this->detectedTransaction = $this->createChildTransaction($transaction, $updateData);
                 $logMessage = 'Create new transaction in the order callback request';
             }
             break;
             // Just in case
         }
     } while (false);
     // So it can in break
     $logMessage = $logMessage . PHP_EOL . 'Callback Backreference: ' . var_export($request->xpcBackReference, true) . PHP_EOL . 'Callback txnId: ' . var_export($request->txnId, true) . PHP_EOL . 'Transaction ID: ' . ($transaction ? $transaction->getTransactionId() : 'n/a') . PHP_EOL . 'Parent ID: ' . ($parentId ? $parentId : 'n/a') . PHP_EOL . 'Data: ' . ($updateData ? var_export($updateData, true) : 'n/a');
     \XLite\Logger::getInstance()->logCustom(static::LOG_FILE_NAME, $logMessage);
     return $this->detectedTransaction;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:91,代码来源:AXPayments.php

示例14: logTransaction

 /**
  * Write transaction log
  * 
  * @return void
  */
 public function logTransaction()
 {
     \XLite\Logger::getInstance()->log($this->getLogMessage());
 }
开发者ID:kingsj,项目名称:core,代码行数:9,代码来源:AProcessor.php

示例15: doActionReturn

 /**
  * Process return
  *
  * @return void
  */
 protected function doActionReturn()
 {
     $txn = $this->detectTransaction();
     if ($txn) {
         $txn->getPaymentMethod()->getProcessor()->processReturn($txn);
         $txn->registerTransactionInOrderHistory('web');
         $urlParams = array();
         $urlParams['order_id'] = $txn->getOrder()->getOrderId();
         if ($txn->getNote()) {
             $urlParams['txnNote'] = base64_encode(static::t($txn->getNote()));
             $urlParams['txnNoteType'] = $txn->isFailed() ? \XLite\Core\TopMessage::ERROR : \XLite\Core\TopMessage::INFO;
         }
         \XLite\Core\Database::getEM()->flush();
         $url = $this->getShopURL($this->buildURL('checkout', 'return', $urlParams), \XLite\Core\Request::getInstance()->isHTTPS() || \XLite\Core\Config::getInstance()->Security->customer_security);
         switch ($txn->getPaymentMethod()->getProcessor()->getReturnType()) {
             case \XLite\Model\Payment\Base\WebBased::RETURN_TYPE_HTML_REDIRECT:
                 $this->doHTMLRedirect($url);
                 break;
             case \XLite\Model\Payment\Base\WebBased::RETURN_TYPE_HTML_REDIRECT_WITH_IFRAME_DESTROYING:
                 $this->doHTMLRedirectWithIframeDestroying($url);
                 break;
             case \XLite\Model\Payment\Base\WebBased::RETURN_TYPE_CUSTOM:
                 $txn->getPaymentMethod()->getProcessor()->doCustomReturnRedirect();
                 break;
             default:
                 $this->setReturnURL($url);
         }
     } else {
         // Log error
         \XLite\Logger::getInstance()->log('Requested payment return page with undefined payment transaction' . PHP_EOL . 'IP address: ' . $_SERVER['REMOTE_ADDR'] . PHP_EOL . 'Data: ' . var_export(\XLite\Core\Request::getInstance()->getData(), true), LOG_ERR);
         // Add top message
         \XLite\Core\TopMessage::addWarning('Unknown payment. If you see this message after returning from the payment page, please contact the store administrator for information about the status of your payment.');
         // Set return URL
         $url = $this->buildURL('');
         // Make redirect with destroying iframe (as it's unknown whether payment was via iframe method or not)
         $this->doHTMLRedirectWithIframeDestroying($url);
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:43,代码来源:PaymentReturn.php


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