Chora::url PHP Méthode

url() public static méthode

Generate a URL that links into Chora.
public static url ( string $script, string $uri = '', array $args = [], string $anchor = '' ) : string
$script string Name of the Chora script to link into.
$uri string The path being browsed.
$args array Key/value pair of any GET parameters to append.
$anchor string Anchor entity name.
Résultat string The URL, with session information if necessary.
    public static function url($script, $uri = '', $args = array(), $anchor = '')
    {
        $arglist = self::_getArgList($GLOBALS['acts'], $GLOBALS['defaultActs'], $args);
        $script .= '.php';
        if ($GLOBALS['conf']['options']['urls'] == 'rewrite') {
            switch ($script) {
                case 'browsefile.php':
                case 'browsedir.php':
                    if (substr($uri, 0, 1) == '/') {
                        $script = "browse{$uri}";
                    } else {
                        $script = "browse/{$uri}";
                    }
                    $script = urlencode(isset($args['rt']) ? $args['rt'] : $GLOBALS['acts']['rt']) . "/-/{$script}";
                    unset($arglist['rt']);
                    break;
                case 'patchsets.php':
                    if (!empty($args['ps'])) {
                        $script = urlencode(isset($args['rt']) ? $args['rt'] : $GLOBALS['acts']['rt']) . '/-/commit/' . $args['ps'];
                        unset($arglist['ps']);
                    } else {
                        $script .= '/' . $uri;
                    }
                    break;
                default:
                    $script .= '/' . $uri;
            }
        } elseif (!empty($uri)) {
            $arglist['f'] = $uri;
        }
        return Horde::url($script)->add($arglist)->setAnchor($anchor);
    }

Usage Example

Exemple #1
0
    if (!isset($title)) {
        $title = _("Commits to:");
    }
}
try {
    $ps = $VC->getPatchset($ps_opts);
    $patchsets = $ps->getPatchsets();
} catch (Horde_Vcs_Exception $e) {
    Chora::fatal($e);
}
if (empty($patchsets)) {
    Chora::fatal(_("Commit Not Found"), '404 Not Found');
}
$page_output->addScriptFile('tables.js', 'horde');
$page_output->addScriptFile('quickfinder.js', 'horde');
Chora::header($title);
echo Chora::getHistoryViews($where)->render('patchsets');
require CHORA_TEMPLATES . '/patchsets/header_table.inc';
$diff_img = Horde::img('diff.png', _("Diff"));
reset($patchsets);
while (list($id, $patchset) = each($patchsets)) {
    $patchset_link = Chora::url('commit', $where, array('commit' => $id))->link(array('title' => $id)) . htmlspecialchars($VC->abbrev($id)) . '</a>';
    $commitDate = Chora::formatDate($patchset['date']);
    $readableDate = Chora::readableTime($patchset['date'], true);
    $author = Chora::showAuthorName($patchset['author'], true);
    $logMessage = Chora::formatLogMessage($patchset['log']);
    $tags = array_merge($patchset['branch'], $patchset['tags']);
    require CHORA_TEMPLATES . '/patchsets/ps.inc';
}
require CHORA_TEMPLATES . '/patchsets/footer.inc';
$page_output->footer();
All Usage Examples Of Chora::url