/** * getHTMLMessage * * @return string */ protected static function getHTMLMessage() { return '<table><tr><td><img src="' . \Includes\Utils\URLManager::getShopURL('skins/progress_indicator.gif') . '" alt="" /></td><td>' . static::getMessage() . '</td></tr></table>'; }
/** * getDefaultParams * * @return array */ protected function getDefaultParams() { $params = parent::getDefaultParams(); $params[\XLite\Controller\AController::RETURN_URL] = \Includes\Utils\URLManager::getSelfURI() . '&mode=search_featured_products'; return $params; }
/** * Check if LC is installed * * @return void */ public static function checkIsLCInstalled() { if (!\Includes\Utils\ConfigParser::getOptions(array('database_details', 'database'))) { $link = \Includes\Utils\URLManager::getShopURL('install.php'); $message = \Includes\Utils\ConfigParser::getInstallationLng() === 'ru' ? '<a href="' . $link . '">Запустите установку магазина</a>' : '<a href="' . $link . '">Click here</a> to run the installation wizard.'; static::showErrorPage(self::ERROR_NOT_INSTALLED, $message); } }
/** * Get authorization grant redirect url * * @return string */ protected function getRedirectUrl() { return \Includes\Utils\URLManager::getShopURL(\XLite\Core\Converter::buildURL('social_login', 'login', array('auth_provider' => $this->getName())), \XLite\Core\Request::getInstance()->isHTTPS(), array(), null, false); }
/** * Check and (if needed) set the return URL parameter * * @param array &$params Form params * * @return void */ protected function setReturnURLParam(array &$params) { $index = \XLite\Controller\AController::RETURN_URL; if (!isset($params[$index])) { $params[$index] = \Includes\Utils\URLManager::getSelfURI(); } }
/** * Get latest Snapshot URL * * @return string */ public static function getLatestSnapshotURL() { $params = array(self::PARAM_SAFE_MODE => true, self::PARAM_ACCESS_KEY => static::getAccessKey()); if (static::getLatestSnapshot()) { $latest = static::getLatestSnapshot(); $params[self::PARAM_RESTORE_DATE] = $latest['date']; } return \Includes\Utils\URLManager::getShopURL(\XLite\Core\Converter::buildURL('main', '', $params, \XLite::getAdminScript())); }
/** * Process CSS URL callback * * @param array $mathes Matches * @param string $filePrefix File prefix * * @return string */ public function processCSSURLHandler(array $mathes, $filePrefix) { $url = trim($mathes[1]); if (!preg_match('/^[\'"]?data:/Ss', $url)) { $first = substr($url, 0, 1); if ('"' == $first || '\'' == $first) { $url = stripslashes(substr($url, 1, -1)); } if (!preg_match('/^(?:https?:)?\\/\\//Ss', $url)) { if ('/' != substr($url, 0, 1)) { $url = $filePrefix . $url; } $url = \Includes\Utils\URLManager::getProtoRelativeShopURL($url, array(), \Includes\Utils\URLManager::URL_OUTPUT_SHORT); } if (preg_match('/[\'"]/Ss', $url)) { $url = '"' . addslashes($url) . '"'; } } return 'url(' . $url . ')'; }
/** * Return full URL for the resource * * @param string $url Url part to add OPTIONAL * @param boolean $isSecure Use HTTP or HTTPS OPTIONAL * @param array $params Optional URL params OPTIONAL * * @return string */ public function getShopURL($url = '', $isSecure = null, array $params = array()) { return \Includes\Utils\URLManager::getShopURL($url, $isSecure, $params); }
/** * Alters outbound URLs * * @param string &$path The outbound path to alter * @param array &$options A set of URL options * @param string $originalPath The original path, before being altered by any modules * * @return void */ public function translateOutboundURL(&$path, array &$options, $originalPath) { if (static::LANDING_LINK_PATH === $path) { $path = \Includes\Utils\URLManager::getShopURL('admin.php' . $this->getAdminAreaURLArgs()); $options['external'] = true; } elseif ($url = $this->getHandler()->getDrupalCleanURL($path, $options)) { $path = $url; } }
/** * Returns API URL * * @return string */ public function getApiURL() { $url = \Includes\Utils\URLManager::isValidURLHost(\XLite\Core\Config::getInstance()->CDev->USPS->server_url) ? \XLite\Core\Config::getInstance()->CDev->USPS->server_url : 'http://testing.shippingapis.com/ShippingAPI.dll'; return $url; }
/** * Get safe mode URL * * @param boolean $soft Soft reset flag OPTIONAL * * @return string */ public static function getResetURL($soft = false) { $params = array(self::PARAM_SAFE_MODE => true, self::PARAM_ACCESS_KEY => static::getAccessKey()); if ($soft) { $params[self::PARAM_SOFT_RESET] = true; } return \Includes\Utils\URLManager::getShopURL(\XLite\Core\Converter::buildURL('main', '', $params, \XLite::ADMIN_SELF)); }
/** * Refresh current page * * @param array $params Additional parameters OPTIONAL * * @return void */ public static function refresh($params = array()) { // Get current URL $url = \Includes\Utils\URLManager::getSelfURI(); $query = parse_url($url, PHP_URL_QUERY); $url = str_replace('?' . $query, '', $url); $fragment = parse_url($url, PHP_URL_FRAGMENT); $url = str_replace('#' . $fragment, '', $url); $parsedQuery = array(); parse_str($query, $parsedQuery); // Prepare additional URL parameters string foreach ($params as $k => $v) { if (isset($v)) { $parsedQuery[$k] = $v; } elseif (isset($parsedQuery[$k])) { unset($parsedQuery[$k]); } } if ($parsedQuery) { $url .= '?' . http_build_query($parsedQuery); } if ($fragment) { $url .= '#' . $fragment; } // Do redirection static::redirect($url); }
/** * Check for secure connection * * @return boolean */ public function isHTTPS() { return \Includes\Utils\URLManager::isHTTPS(); }
/** * Refresh current page * * @return void */ public static function refresh() { static::redirect(\Includes\Utils\URLManager::getSelfURI()); }
/** * Prepare resource URL * * @param string $url URL * @param string $outputType Output type * * @return string */ protected function prepareResourceURL($url, $outputType) { if ($url && self::WEB_PATH_OUTPUT_SHORT != $outputType) { $type = self::WEB_PATH_OUTPUT_FULL == $outputType ? \Includes\Utils\URLManager::URL_OUTPUT_SHORT : \Includes\Utils\URLManager::URL_OUTPUT_FULL; $url = \Includes\Utils\URLManager::getShopURL($url, \XLite\Core\Request::getInstance()->isHTTPS(), array(), $type, false); } return $url; }
/** * Get return URL for Purchase operation * * @return string */ protected function getReturnURL() { return \Includes\Utils\URLManager::getShopURL(\XLite\Core\Converter::buildURL()); }
/** * Prepares CSS cache to use. Main issue - replace url($resourcePath) construction with url($shopUrl/$resourcePath) * * @param string $filePath CSS cache file path * * @return string */ protected function prepareCSSCache($filePath) { return "\r\n" . '/***** AUTOGENERATED: ' . basename($filePath) . ' */' . str_replace('url(', 'url(' . \Includes\Utils\URLManager::getShopURL(str_replace(LC_DS, '/', dirname(substr($filePath, strlen(LC_DIR_ROOT)))), \XLite\Core\Request::getInstance()->isHTTPS(), array(), null, false) . '/', \Includes\Utils\FileManager::read($filePath)); }
/** * Get category clean URL by category id * * @param integer $id Category ID * @param array $params URL params OPTIONAL * * @return string|void */ protected function getCategoryCleanURL($id, array $params = array()) { $category = \XLite\Core\Database::getRepo('\\XLite\\Model\\Category')->find($id); return isset($category) && $category->getCleanURL() ? \Includes\Utils\URLManager::trimTrailingSlashes($category->getCleanURL()) . '/' . \Includes\Utils\Converter::buildQuery($params, '-', '/') : null; }
/** * Create the "web_dir_wo_slash" option * * @return void */ protected static function setWebDirWOSlash() { static::$options['host_details']['web_dir_wo_slash'] = \Includes\Utils\URLManager::trimTrailingSlashes(static::$options['host_details']['web_dir']); }
/** * Check if LC is installed * * @return void */ public static function checkIsLCInstalled() { if (!\Includes\Utils\ConfigParser::getOptions(array('database_details', 'database'))) { $message = 'Probably LC is not installed. Try to run '; $url = '<strong>install.php</strong>'; $link = \Includes\Utils\URLManager::getShopURL('install.php'); if (\Includes\Utils\FileManager::isFile($link)) { $url = '<a href="' . $link . '">' . $url . '</a>'; } static::showErrorPage('ERROR_LC_NOT_INSTALLED', $message . $url, LC_ERROR_PAGE_MESSAGE); } }