_routeConfig = $routeConfig; $this->_locale = $locale; $this->_backendUrl = $backendUrl; $this->_auth = $auth; $this->_frontNameResolver = $frontNameResolver; $this->mathRandom = $mathRandom; } /** * @return string */ public function getPageHelpUrl() { if (!$this->_pageHelpUrl) { $this->setPageHelpUrl(); } return $this->_pageHelpUrl; } /** * @param string|null $url * @return $this */ public function setPageHelpUrl($url = null) { if ($url === null) { $request = $this->_request; $frontModule = $request->getControllerModule(); if (!$frontModule) { $frontModule = $this->_routeConfig->getModulesByFrontName($request->getModuleName()); if (empty($frontModule) === false) { $frontModule = $frontModule[0]; } else { $frontModule = null; } } $url = 'http://www.magentocommerce.com/gethelp/'; $url .= $this->_locale->getLocale() . '/'; $url .= $frontModule . '/'; $url .= $request->getControllerName() . '/'; $url .= $request->getActionName() . '/'; $this->_pageHelpUrl = $url; } $this->_pageHelpUrl = $url; return $this; } /** * @param string $suffix * @return $this */ public function addPageHelpUrl($suffix) { $this->_pageHelpUrl = $this->getPageHelpUrl() . $suffix; return $this; } /** * @param string $route * @param array $params * @return string */ public function getUrl($route = '', $params = []) { return $this->_backendUrl->getUrl($route, $params); } /** * @return int|bool */ public function getCurrentUserId() { if ($this->_auth->getUser()) { return $this->_auth->getUser()->getId(); } return false; } /** * Decode filter string * * @param string $filterString * @return array */ public function prepareFilterString($filterString) { $data = []; $filterString = base64_decode($filterString); parse_str($filterString, $data); array_walk_recursive( $data, // @codingStandardsIgnoreStart /** * Decodes URL-encoded string and trims whitespaces from the beginning and end of a string * * @param string $value */ // @codingStandardsIgnoreEnd function (&$value) { $value = trim(rawurldecode($value)); } ); return $data; } /** * Generate unique token for reset password confirmation link * * @return string */ public function generateResetPasswordLinkToken() { return $this->mathRandom->getUniqueHash(); } /** * Get backend start page URL * * @return string */ public function getHomePageUrl() { return $this->_backendUrl->getRouteUrl('adminhtml'); } /** * Return Backend area front name * * @param bool $checkHost * @return bool|string */ public function getAreaFrontName($checkHost = false) { return $this->_frontNameResolver->getFrontName($checkHost); } }