cvs: pearweb /include pear-format-html.php

From: Date: Sat, 05 Apr 2008 22:11:50 +0000
Subject: cvs: pearweb /include pear-format-html.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7436@lists.php.net to get a copy of this message
dufuz Sat Apr 5 22:11:50 2008 UTC Modified files: /pearweb/include pear-format-html.php Log: clean up the menu systems a bit and kill make_utc_date http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html.php?r1=1.266&r2=1.267&diff_format=u Index: pearweb/include/pear-format-html.php diff -u pearweb/include/pear-format-html.php:1.266 pearweb/include/pear-format-html.php:1.267 --- pearweb/include/pear-format-html.php:1.266 Sun Mar 30 22:33:53 2008 +++ pearweb/include/pear-format-html.php Sat Apr 5 22:11:50 2008 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: pear-format-html.php,v 1.266 2008/03/30 22:33:53 dufuz Exp $ + $Id: pear-format-html.php,v 1.267 2008/04/05 22:11:50 dufuz Exp $ */ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler'); @@ -759,19 +759,14 @@ function print_tabbed_navigation($items) { global $self; - $page = basename($self); echo '<div id="nav">' . "\n"; echo " <ul>\n"; foreach ($items as $title => $item) { echo " <li>"; - echo '<a href="' . $item['url'] - . '" title="' . $item['title'] . '"'; - if ($page == $item['url']) { - echo ' class="active"'; - } - echo '>' . $title . "</a>"; + $css = $page == $item['url'] ? ' class="current"' : ''; + echo make_link($item['url'], $title, '', $css, $item['title']); echo "</li>\n"; } echo " </ul>\n"; @@ -791,9 +786,9 @@ { global $auth_user; - $nav_items = array( + $items = array( 'Main' => array('url' => '', - 'title' => ''), + 'title' => 'Main view'), 'Download' => array('url' => 'download', 'title' => 'Download releases of this package'), 'Documentation' => array('url' => 'docs', @@ -811,34 +806,33 @@ (user::maintains($auth_user->handle, $pacid, 'lead') || user::isAdmin($auth_user->handle) || user::isQA($auth_user->handle)) - ) { - $nav_items['Edit'] = array('url' => '/package-edit.php?id='.$pacid, + ) { + $items['Edit'] = array('url' => '/package-edit.php?id='.$pacid, 'title' => 'Edit this package'); - $nav_items['Edit Maintainers'] = array('url' => '/admin/package-maintainers.php?pid='.$pacid, + $items['Edit Maintainers'] = array('url' => '/admin/package-maintainers.php?pid='.$pacid, 'title' => 'Edit the maintainers of this package'); } - if (isset($auth_user) && is_object($auth_user) && - ($auth_user->isAdmin() || $auth_user->isQA()) - ) { - $nav_items['Delete'] = array('url' => '/package-delete.php?id='.$pacid, + + if (isset($auth_user) && is_object($auth_user) + && ($auth_user->isAdmin() || $auth_user->isQA()) + ) { + $items['Delete'] = array('url' => '/package-delete.php?id='.$pacid, 'title' => 'Delete this package'); } - echo '<div id="nav">'; - foreach ($nav_items as $title => $item) { + //echo print_tabbed_navigation($nav_items); + + echo '<div id="nav">' . "\n"; + foreach ($items as $title => $item) { if (!empty($item['url']) && $item['url']{0} == '/') { $url = $item['url']; } else { $url = '/package/' . htmlspecialchars($name) . '/' . $item['url']; } - echo '<a href="' . $url . '"' - . ' title="' . $item['title'] . '" ' - . ($action == $item['url'] ? ' class="current" ' : '') - . '>' - . $title - . '</a> '; + $css = $action == $item['url'] ? ' class="current" ' : ''; + echo make_link($url, $title, '', $css, $item['title']); } - echo '</div>'; + echo '</div>' . "\n"; } /** @@ -875,21 +869,6 @@ return $text; } - -/** - * Converts a Unix timestamp to a date() formatted string in the UTC time zone - * - * @param int $ts a Unix timestamp from the local machine. If none - * is provided the current time is used. - * @param string $format a format string, as per http://php.net/date - * - * @return string the time formatted time - */ -function make_utc_date($ts = null, $format = 'Y-m-d H:i e') -{ - return format_date($ts, $format); -} - /** * Turns a unix timestamp into a uniformly formatted date * If the date is during the current year, the year is omitted.

« previous php.pear.core (#7436) next »