コード例 #1
0
ファイル: Chora.php プロジェクト: Artea/freebeer
 /**
  * Generate a URL that links into Chora.
  *
  * @param string $script  Name of the Chora script to link into
  * @param string $uri     Any PATH_INFO portion that should be included
  * @param array  $args    Key/value pair of any GET parameters to append
  * @param string $anchor  Anchor entity name
  *
  * @return string  The URL, with session information if necessary.
  */
 function url($script, $uri = '', $args = array(), $anchor = '')
 {
     global $conf;
     $arglist = array_merge(Chora::differingVars(), $args);
     $script = $script . '.php';
     if ($conf['options']['use_path_info']) {
         if (substr($uri, 0, 1) != '/') {
             $script .= '/';
         }
         $script .= $uri;
     } else {
         $arglist['f'] = $uri;
     }
     $url = Horde::applicationUrl($script);
     foreach ($arglist as $key => $val) {
         if (!empty($val) || $val === 0) {
             $url = Util::addParameter($url, $key, $val);
         }
     }
     if (!empty($anchor)) {
         $url .= "#{$anchor}";
     }
     return $url;
 }