Example #1
0
 /**
  * {@inheritdoc}
  */
 public function log($message, $level)
 {
     $message .= ' ' . $this->request->getRequestUri();
     if ($this->logLevel >= $level) {
         switch ($level) {
             case self::EMERGENCY:
                 $this->logger->emergency($message);
                 break;
             case self::ALERT:
                 $this->logger->alert($message);
                 break;
             case self::CRITICAL:
                 $this->logger->critical($message);
                 break;
             case self::ERROR:
                 $this->logger->error($message);
                 break;
             case self::WARNING:
                 $this->logger->warning($message);
                 break;
             case self::NOTICE:
                 $this->logger->notice($message);
                 break;
             case self::INFO:
                 $this->logger->info($message);
                 break;
             default:
                 $this->logger->debug($message);
         }
     }
 }
 /**
  * Check if base url enabled
  *
  * @param array $uri
  * @param \Magento\Framework\App\Request\Http $request
  * @return bool
  */
 protected function _isBaseUrlCorrect($uri, $request)
 {
     $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
     return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false);
 }
Example #3
0
 /**
  * @param \Magento\Framework\App\Request\Http $request
  */
 public function __construct(\Magento\Framework\App\Request\Http $request)
 {
     $data = [$request->isSecure(), $request->getRequestUri(), $request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING)];
     $this->value = md5(serialize($data));
 }
Example #4
0
 /**
  * Performs verification.
  *
  * @param array $uri
  * @param \Magento\Framework\App\Request\Http $request
  * @return bool
  */
 public function execute($uri, $request)
 {
     $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
     return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false);
 }