wez Sun May 23 04:58:01 2004 EDT
Added files:
/livedocs/themes/default vers5.png
/livedocs/themes/php.net vers5.png
Modified files:
/livedocs common.php mk_phpdoc.php mkindex.php mktoc.php
style_mapping.php
/livedocs/themes/default html_format.php
/livedocs/themes/php.net html_format.php
/livedocs/themes/smarty html_format.php
Log:
Patch by Nuno, modified a bit.
Implements the "latest version" graphic to highlight new functions.
Introduces &livedocs.new-in-vers-5; entity to hold a caption along the lines of
"New in PHP 5".
Some minor housekeeping.
http://cvs.php.net/diff.php/livedocs/common.php?r1=1.13&r2=1.14&ty=u
Index: livedocs/common.php
diff -u livedocs/common.php:1.13 livedocs/common.php:1.14
--- livedocs/common.php:1.13 Mon May 10 06:20:42 2004
+++ livedocs/common.php Sun May 23 04:58:01 2004
@@ -18,7 +18,7 @@
// | Common PHP header, with some basic settings |
// +----------------------------------------------------------------------+
//
-// $Id: common.php,v 1.13 2004/05/10 10:20:42 wez Exp $
+// $Id: common.php,v 1.14 2004/05/23 08:58:01 wez Exp $
set_magic_quotes_runtime(0);
/*$compare = version_compare(phpversion(), '5.0.0RC1');
@@ -66,6 +66,9 @@
define('FALLBACK_INDEX', OUTPUTDIR . '/livedoc-idx.' . FALLBACK_LANG . ".sqlite");
define('FALLBACK_BASE', PHPDOC . "/" . FALLBACK_LANG . "/");
+define('LATEST_VERSION_NO', 5);
+define('LATEST_VERSION', 'PHP ' . LATEST_VERSION_NO);
+
$fb_idx = @sqlite_open(FALLBACK_INDEX);
if (file_exists(INDEX) && $lang != FALLBACK_LANG) {
http://cvs.php.net/diff.php/livedocs/mk_phpdoc.php?r1=1.8&r2=1.9&ty=u
Index: livedocs/mk_phpdoc.php
diff -u livedocs/mk_phpdoc.php:1.8 livedocs/mk_phpdoc.php:1.9
--- livedocs/mk_phpdoc.php:1.8 Sat May 1 05:46:46 2004
+++ livedocs/mk_phpdoc.php Sun May 23 04:58:01 2004
@@ -18,7 +18,7 @@
// | Configuration file for phpdoc build |
// +----------------------------------------------------------------------+
//
-// $Id: mk_phpdoc.php,v 1.8 2004/05/01 09:46:46 nlopess Exp $
+// $Id: mk_phpdoc.php,v 1.9 2004/05/23 08:58:01 wez Exp $
define('MK_VERSION', true);
define('MANUAL_TITLE', 'PHP Manual');
@@ -46,7 +46,7 @@
if ($f == 'configure.xml' || $f ==
'constants.xml' || $f == 'ini.xml' || $f == 'reference.xml') {
$docbook_id = 'ref.' .
basename($path);
} else {
- $docbook_id = 'function.' .
substr($f, 0, -4);
+ $docbook_id = 'function.' .
strtolower(substr($f, 0, -4));
}
break;
case 'language' :
http://cvs.php.net/diff.php/livedocs/mkindex.php?r1=1.32&r2=1.33&ty=u
Index: livedocs/mkindex.php
diff -u livedocs/mkindex.php:1.32 livedocs/mkindex.php:1.33
--- livedocs/mkindex.php:1.32 Tue Apr 27 10:43:28 2004
+++ livedocs/mkindex.php Sun May 23 04:58:01 2004
@@ -19,7 +19,7 @@
// | construct an index |
// +----------------------------------------------------------------------+
//
-// $Id: mkindex.php,v 1.32 2004/04/27 14:43:28 nlopess Exp $
+// $Id: mkindex.php,v 1.33 2004/05/23 08:58:01 wez Exp $
/* just to be on the safe side */
@@ -96,7 +96,7 @@
if ($this->last_id !== false) {
echo "\tAdded ID {$this->last_id}\n";
- $this->data .= "INSERT INTO idents VALUES ('{$this->last_id}',
{$this->fileid}, '" . sqlite_escape_string(trim($this->cdata)) . "');";
+ $this->data .= "INSERT INTO idents VALUES ('" .
strtolower($this->last_id) . "', {$this->fileid}, '" .
sqlite_escape_string(trim($this->cdata)) . "');";
$this->last_id = false;
}
http://cvs.php.net/diff.php/livedocs/mktoc.php?r1=1.8&r2=1.9&ty=u
Index: livedocs/mktoc.php
diff -u livedocs/mktoc.php:1.8 livedocs/mktoc.php:1.9
--- livedocs/mktoc.php:1.8 Mon Feb 16 12:54:59 2004
+++ livedocs/mktoc.php Sun May 23 04:58:01 2004
@@ -20,7 +20,7 @@
// | tree into the toc table. |
// +----------------------------------------------------------------------+
//
-// $Id: mktoc.php,v 1.8 2004/02/16 17:54:59 derick Exp $
+// $Id: mktoc.php,v 1.9 2004/05/23 08:58:01 wez Exp $
set_magic_quotes_runtime(0);
class DocBookTOCParser {
@@ -68,7 +68,7 @@
array_push($this->id_stack, $this->last_id);
array_push($this->docbook_id_stack, $docbook_id);
- echo "INSERT INTO toc VALUES ({$this->last_id}, {$level},
{$parent_id}, '{$docbook_id}', '{$docbook_parent_id}', '{$path}', '{$title}',
'{$title}');\n";
+ echo "INSERT INTO toc VALUES ({$this->last_id}, {$level},
{$parent_id}, '" . strtolower($docbook_id) . "', '{$docbook_parent_id}', '{$path}',
'{$title}', '{$title}');\n";
$this->last_id++;
}
http://cvs.php.net/diff.php/livedocs/style_mapping.php?r1=1.14&r2=1.15&ty=u
Index: livedocs/style_mapping.php
diff -u livedocs/style_mapping.php:1.14 livedocs/style_mapping.php:1.15
--- livedocs/style_mapping.php:1.14 Mon May 10 06:20:42 2004
+++ livedocs/style_mapping.php Sun May 23 04:58:01 2004
@@ -18,7 +18,7 @@
// | Helper functions for formatting elements |
// +----------------------------------------------------------------------+
//
-// $Id: style_mapping.php,v 1.14 2004/05/10 10:20:42 wez Exp $
+// $Id: style_mapping.php,v 1.15 2004/05/23 08:58:01 wez Exp $
// almost XPATH.. ;-)
$map = array(
@@ -154,15 +154,15 @@
function format_refpurpose($node)
{
- global $current_page, $idx, $print_version;
+ global $current_page, $idx;
$vers = '';
if (substr($current_page, 0, 9) == 'function.') {
$func_name = sqlite_escape_string(strtr(substr($current_page, 9), '-',
'_'));
- $q = sqlite_query($idx, "SELECT versinfo FROM funcs where
funcname='$func_name'");
- if ($q && $r = sqlite_fetch_array($q, SQLITE_NUM)) {
- $vers = sprintf('<div class="versinfo">%s</div>', $r[0]);
+ $q = sqlite_single_query($idx, "SELECT versinfo FROM funcs where
funcname='$func_name'");
+ if ($q) {
+ $vers = sprintf('<div class="versinfo">%s</div>', $q);
} else {
$vers = '<div class="versinfo">' .
bind_entities('&livedocs.noversion;') .'</div>';
}
@@ -203,7 +203,7 @@
function format_pubdate($node)
{
- return sprintf('<div class="%s">Published on: %s</div>', $node->tagname,
htmlspecialchars($node->content, ENT_NOQUOTES));
+ return sprintf('<div class="%s">' . bind_entities('&livedocs.published;') .
'</div>', $node->tagname, htmlspecialchars($node->content, ENT_NOQUOTES));
}
function format_ulink($node)
@@ -247,20 +247,20 @@
function format_function($node)
{
- global $current_page, $lang;
+ global $current_page, $lang, $idx;
$replace = array('_' => '-',
'::' => '-',
'->' => '-');
$itemid = strtr($node->content, $replace);
- $itemid = strtr($itemid, array('---' => '-'));
+ $itemid = strtolower(strtr($itemid, array('---' => '-')));
- $class = 'function';
if (isset($node->attributes['class'])) {
$class = 'method';
$dest = $node->attributes['class'] . '.method.' . $itemid;
} else {
+ $class = 'function';
$dest = 'function.' . $itemid;
}
@@ -268,12 +268,30 @@
return sprintf('<span class="%s"%s>%s()</span>', $class, LTR,
$node->content);
}
+ /* check the version info: if it matches LATEST_VERSION then we know it is
+ * a new function and can highlight it accordingly.
+ * Note that we can't assume that no version info means it is in the
+ * latest version, since many language constructs (such as
+ * include/require) don't have versinfo ;-)
+ */
+
+ $q = sqlite_single_query($idx, "SELECT versinfo FROM funcs where funcname='" .
sqlite_escape_string($node->content) . "'");
+ if ($q && LATEST_VERSION == $q) {
+ $image = '<img src="' . WEBBASE . 'themes/' . THEME_NAME . '/vers' .
+ LATEST_VERSION_NO . '.png" alt="' .
+ bind_entities('&livedocs.new-in-vers-' . LATEST_VERSION_NO .
';') .
+ '" width="15" height="15"/> ';
+ } else {
+ $image = '';
+ }
+
$url = generate_url_for_id($lang, $dest);
- return sprintf('<a class="%s" href="%s"%s>%s()</a>',
+ return sprintf('<a class="%s" href="%s"%s>%s()</a>%s',
$class,
$url,
LTR,
- htmlspecialchars($node->content, ENT_NOQUOTES)
+ htmlspecialchars($node->content, ENT_NOQUOTES),
+ $image
);
}
@@ -577,4 +595,4 @@
return sprintf('<span class="%s" dir="ltr">%s</span>', $node->tagname,
htmlspecialchars($node->content, ENT_NOQUOTES));
}
}
-?>
\ No newline at end of file
+?>
http://cvs.php.net/diff.php/livedocs/themes/default/html_format.php?r1=1.8&r2=1.9&ty=u
Index: livedocs/themes/default/html_format.php
diff -u livedocs/themes/default/html_format.php:1.8
livedocs/themes/default/html_format.php:1.9
--- livedocs/themes/default/html_format.php:1.8 Mon May 10 06:20:42 2004
+++ livedocs/themes/default/html_format.php Sun May 23 04:58:01 2004
@@ -18,7 +18,7 @@
// | headers and footers for the HTML rendering |
// +----------------------------------------------------------------------+
//
-// $Id: html_format.php,v 1.8 2004/05/10 10:20:42 wez Exp $
+// $Id: html_format.php,v 1.9 2004/05/23 08:58:01 wez Exp $
// in livedoc.php
@@ -36,7 +36,7 @@
<title>$title</title>
<link rel="stylesheet" href="$css_url" />
</head>
-<body $dir>
+<body$dir>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="1"></td><td rowspan="2" valign="top">
HEAD;
http://cvs.php.net/diff.php/livedocs/themes/php.net/html_format.php?r1=1.10&r2=1.11&ty=u
Index: livedocs/themes/php.net/html_format.php
diff -u livedocs/themes/php.net/html_format.php:1.10
livedocs/themes/php.net/html_format.php:1.11
--- livedocs/themes/php.net/html_format.php:1.10 Mon May 10 06:20:42 2004
+++ livedocs/themes/php.net/html_format.php Sun May 23 04:58:01 2004
@@ -18,7 +18,7 @@
// | headers and footers for the HTML rendering |
// +----------------------------------------------------------------------+
//
-// $Id: html_format.php,v 1.10 2004/05/10 10:20:42 wez Exp $
+// $Id: html_format.php,v 1.11 2004/05/23 08:58:01 wez Exp $
// in livedoc.php
define(
@@ -45,7 +45,7 @@
<link rel="shortcut icon" href="/favicon.ico" />
<script language="Javascript" type="text/javascript" src="/userprefs.js" />
</head>
-<body $dir>
+<body$dir>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#9999cc">
<td align="center" rowspan="2" width="126"><a href="/"><img src="/images/php.gif"
alt="PHP" width="120" height="67" hspace="3" /></a></td>
http://cvs.php.net/diff.php/livedocs/themes/smarty/html_format.php?r1=1.2&r2=1.3&ty=u
Index: livedocs/themes/smarty/html_format.php
diff -u livedocs/themes/smarty/html_format.php:1.2
livedocs/themes/smarty/html_format.php:1.3
--- livedocs/themes/smarty/html_format.php:1.2 Mon May 10 06:20:42 2004
+++ livedocs/themes/smarty/html_format.php Sun May 23 04:58:01 2004
@@ -18,7 +18,7 @@
// | headers and footers for the HTML rendering |
// +----------------------------------------------------------------------+
//
-// $Id: html_format.php,v 1.2 2004/05/10 10:20:42 wez Exp $
+// $Id: html_format.php,v 1.3 2004/05/23 08:58:01 wez Exp $
// in livedoc.php
$WEBSITE = 'http://smarty.php.net';
@@ -97,7 +97,7 @@
</table>
-<table cellpadding="0" cellspacing="0" $dir>
+<table cellpadding="0" cellspacing="0"$dir>
<tr valign="top">
<td bgcolor="#f0ead8">
<table width="170" cellpadding="4" cellspacing="0">