Esempio n. 1
0
 /**
  * Returns the resolved base URL.
  * This is prepended to internal URLs generated by routing.
  * @see vB_Route::getURL()
  *
  * return string
  */
 public static function getBaseRoutingURL($class_segment, $for_path = true, $method = false)
 {
     if (!self::$base_url) {
         if (vB::$vbulletin->options['vbcms_url']) {
             self::$base_url = trim(normalize_path(vB::$vbulletin->options['vbcms_url']), '/\\');
         } else {
             // don't use relative url if we're forcing bburl as the basepath
             $relative_url = (self::$relative_url and !vB::$vbulletin->options['bburl_basepath']) ? self::$relative_url : false;
             self::$base_url = trim(vB::$vbulletin->input->fetch_basepath($relative_url), '/\\');
         }
     }
     $base_url = self::$base_url;
     $method = false === $method ? vB::$vbulletin->options['friendlyurl'] : $method;
     switch ($method) {
         case self::METHOD_REQUEST:
             $base_url .= '/' . $class_segment . '.php' . ($for_path ? '?' : '');
             break;
         case self::METHOD_GET:
             $base_url .= '/' . $class_segment . '.php' . ($for_path ? '?' . vB::$vbulletin->options['route_requestvar'] . '=' : '');
             break;
         case self::METHOD_PATHINFO:
             $base_url .= '/' . $class_segment . '.php';
         case self::METHOD_REWRITE:
         default:
             $base_url .= '/';
             break;
     }
     return $base_url;
 }