Пример #1
0
 /**
  * @see t3lib_div::linkThisScript
  * @see \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript
  *
  * @param boolean $encode
  * @return string
  */
 protected function getLinkThisScript($encode = TRUE)
 {
     $location = tx_rnbase_util_Link::linkThisScript(array('CB' => '', 'SET' => '', 'cmd' => '', 'popViewId' => ''));
     if ($encode) {
         $location = str_replace('%20', '', rawurlencode($location));
     }
     return $location;
 }
 /**
  * forces a schema for a url.
  * if there is already a schema in the url, the schema will be replaced.
  *
  * @param string $url
  * @param string $schema
  * @return string
  */
 public static function parseAbsUrl($url, $schema = FALSE)
 {
     if (!$schema) {
         $schema = tx_rnbase_util_Misc::getIndpEnv('TYPO3_REQUEST_DIR');
     }
     // check if we have a A-Tag with href attribute or a IMG-Tag with src attribute
     if (@simplexml_load_string($url)) {
         return preg_replace_callback('/(href="|src=")(.+)"/', function ($match) use($schema) {
             // $match[1] contains 'href="' or 'src="'
             // $match[2] contains the url '/service/contact.html'
             return $match[1] . tx_rnbase_util_Link::parseAbsUrl($match[2], $schema) . '"';
         }, ltrim($url, '/'));
     }
     // else, we have only a url to rebuild
     // rebuild the url without schema
     $urlParts = parse_url(self::addDefaultSchemaIfRequired($url));
     $urlPath = isset($urlParts['path']) ? $urlParts['path'] : '';
     $urlPath .= isset($urlParts['query']) ? '?' . $urlParts['query'] : '';
     $urlPath .= isset($urlParts['fragment']) ? '#' . $urlParts['fragment'] : '';
     return rtrim($schema, '/') . '/' . ltrim($urlPath, '/');
 }