/** * @deprecated: use the direct call to the tools method */ function removeLeadingSlash($str) { return $this->tools->removeLeadingSlash($str); }
/** * Generates an absolute link. * This function generates an absolute link from a relative link * that is submitted as parameter. * For this, the config.baseURL property is used. If this property * is not set, the absolute URL will be determined using the * $_ENV[HTTP_HOST] variable. * This function was introduced due to problems with some realUrl * configuration. * * @param string $link A relative link * @return string The submitted string converted into an absolute link * @author Martin Helmich <*****@*****.**> * @deprecated */ static function getAbsoluteUrl($link) { if (substr($link, 0, 7) == 'http://' || substr($link, 0, 8) == 'https://') { return $link; } if (isset($GLOBALS['TSFE']->config['config']['baseURL'])) { $baseUrl = $GLOBALS['TSFE']->config['config']['baseURL']; if (substr($baseUrl, -1, 1) != '/') { $baseUrl .= '/'; } $result = $baseUrl; } else { $useSSL = GeneralUtility::getIndpEnv('SERVER_PORT') == 443; $dirname = dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')); // on windows, dirname returns a backslash for the root directory, replace it with a forward slash $dirname = $dirname == '\\' ? '/' : $dirname; $dirname = tx_mmforum_tools::appendTrailingSlash($dirname); $dirname = tx_mmforum_tools::removeLeadingSlash($dirname); if ($dirname == '/') { $dirname = ''; } $host = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); $host = tx_mmforum_tools::appendTrailingSlash($host); if (substr($host, 0, 8) != 'https://' && substr($host, 0, 7) != 'http://') { $host = ($useSSL ? 'https' : 'http') . '://' . $host; } $result = $host . $dirname; } $link = tx_mmforum_tools::removeLeadingSlash($link); return $result . $link; }