/** * Load data for current scope * * @return void */ protected function _loadScopedData() { $scope = $this->_configScope->getCurrentScope(); if (false == isset($this->_loadedScopes[$scope])) { if (false == in_array($scope, $this->_scopePriorityScheme)) { $this->_scopePriorityScheme[] = $scope; } foreach ($this->_scopePriorityScheme as $scopeCode) { if (false == isset($this->_loadedScopes[$scopeCode])) { if ($scopeCode !== 'primary' && ($data = $this->_cache->load($scopeCode . '::' . $this->_cacheId))) { $data = unserialize($data); } else { $data = $this->_reader->read($scopeCode); if ($scopeCode !== 'primary') { $this->_cache->save(serialize($data), $scopeCode . '::' . $this->_cacheId); } } $this->merge($data); $this->_loadedScopes[$scopeCode] = true; } if ($scopeCode == $scope) { break; } } } }
/** * {@inheritDoc} * * @return string */ protected function getXmlPathPrefix() { if ($this->scope->getCurrentScope() == \Magento\Framework\App\Area::AREA_ADMINHTML) { return self::XML_PATH_ADMIN_AREA; } return self::XML_PATH_FRONTED_AREA; }
/** * Fetch routes from configs by area code and router id * * @param string $scope * @return array */ protected function _getRoutes($scope = null) { $scope = $scope ?: $this->_configScope->getCurrentScope(); if (isset($this->_routes[$scope])) { return $this->_routes[$scope]; } $cacheId = $scope . '::' . $this->_cacheId; $cachedRoutes = unserialize($this->_cache->load($cacheId)); if (is_array($cachedRoutes)) { $this->_routes[$scope] = $cachedRoutes; return $cachedRoutes; } $routers = $this->_reader->read($scope); $routes = $routers[$this->_areaList->getDefaultRouter($scope)]['routes']; $this->_cache->save(serialize($routes), $cacheId); $this->_routes[$scope] = $routes; return $routes; }
/** * Modify pathInfo: strip down the front name and query parameters. * * @param \Magento\Framework\App\AreaList $areaList * @param \Magento\Framework\Config\ScopeInterface $configScope * @param null|string|\Zend_Uri $uri */ public function __construct(\Magento\Framework\App\AreaList $areaList, \Magento\Framework\Config\ScopeInterface $configScope, $uri = null) { parent::__construct($uri); $areaFrontName = $areaList->getFrontName($configScope->getCurrentScope()); $this->_pathInfo = $this->_requestUri; /** Remove base url and area from path */ $this->_pathInfo = preg_replace("#.*?/{$areaFrontName}/?#", '/', $this->_pathInfo); /** Remove GET parameters from path */ $this->_pathInfo = preg_replace('#\\?.*#', '', $this->_pathInfo); }
/** * Modify pathInfo: strip down the front name and query parameters. * * @param AreaList $areaList * @param ScopeInterface $configScope * @param CookieReaderInterface $cookieReader * @param null|string|\Zend_Uri $uri */ public function __construct(CookieReaderInterface $cookieReader, AreaList $areaList, ScopeInterface $configScope, $uri = null) { parent::__construct($cookieReader, $uri); $pathInfo = $this->getRequestUri(); /** Remove base url and area from path */ $areaFrontName = $areaList->getFrontName($configScope->getCurrentScope()); $pathInfo = preg_replace("#.*?/{$areaFrontName}/?#", '/', $pathInfo); /** Remove GET parameters from path */ $pathInfo = preg_replace('#\\?.*#', '', $pathInfo); $this->setPathInfo($pathInfo); }
/** * Generate URI of SOAP endpoint. * * @return string */ public function getEndpointUri() { $storeCode = $this->_storeManager->getStore()->getCode() === \Magento\Store\Model\Store::ADMIN_CODE ? \Magento\Webapi\Controller\PathProcessor::ALL_STORE_CODE : $this->_storeManager->getStore()->getCode(); return $this->_storeManager->getStore()->getBaseUrl() . $this->_areaList->getFrontName($this->_configScope->getCurrentScope()) . '/' . $storeCode; }
/** * Generate URI of SOAP endpoint. * * @return string */ public function getEndpointUri() { return $this->_storeManager->getStore()->getBaseUrl() . $this->_areaList->getFrontName($this->_configScope->getCurrentScope()) . '/' . $this->_storeManager->getStore()->getCode(); }