/** * Generates a valid URL given this server's scheme, host, port, path * and servlet name. * * @param string $servlet Servlet name * @param array $params Additional URL parameters to attach to the end of the URL * @return string Servlet URL */ protected function _constructUrl($servlet, $params = array()) { $url = parent::_constructUrl($servlet, $params); if (!(strpos($url, $this->_scheme) === 0)) { $parsedUrl = parse_url($url); // unfortunately can't use str_replace as it replaces all // occurrences of $needle and can't be limited to replace only once $url = $this->_scheme . substr($url, strlen($parsedUrl['scheme'])); } return $url; }
/** * Return a valid http URL given this server's scheme, host, port, and path * and a provided servlet name. * * @param string $servlet Servlet name * @param array $params Additional URL parameters to attach to the end of the URL * @return string Servlet URL */ protected function _constructUrl($servlet, $params = array()) { $url = parent::_constructUrl($servlet, $params); if (!\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($url, $this->_scheme)) { $parsedUrl = parse_url($url); // unfortunately can't use str_replace as it replace all // occurrences of $needle and can't be limited to replace only once $url = $this->_scheme . substr($url, strlen($parsedUrl['scheme'])); } return $url; }