Exemple #1
0
 /**
  * Build the full URL from the prefix ID and the rest.
  *
  * @param string $url
  * @param integer $prefixId
  * @return string
  */
 public static function reconstructNormalizedUrl($url, $prefixId)
 {
     $map = array_flip(self::$urlPrefixMap);
     if ($prefixId !== null && isset($map[$prefixId])) {
         $fullUrl = $map[$prefixId] . $url;
     } else {
         $fullUrl = $url;
     }
     // Clean up host & hash tags, for URLs
     $parsedUrl = @parse_url($fullUrl);
     $parsedUrl = PageUrl::cleanupHostAndHashTag($parsedUrl);
     $url = UrlHelper::getParseUrlReverse($parsedUrl);
     if (!empty($url)) {
         return $url;
     }
     return $fullUrl;
 }