iliaa Sat Aug 14 17:41:37 2004 EDT
Modified files:
/livedocs livedoc_funcs.php
Log:
Clean-up +
http://livedocs.aborla.net/patch.php?id=include.entities&download=linux
http://cvs.php.net/diff.php/livedocs/livedoc_funcs.php?r1=1.9&r2=1.10&ty=u
Index: livedocs/livedoc_funcs.php
diff -u livedocs/livedoc_funcs.php:1.9 livedocs/livedoc_funcs.php:1.10
--- livedocs/livedoc_funcs.php:1.9 Fri Jul 30 11:16:29 2004
+++ livedocs/livedoc_funcs.php Sat Aug 14 17:41:37 2004
@@ -214,7 +214,7 @@
$data = preg_replace('@<!--\s+.*\s-->@Usm', '', $data);
/* Replace entities */
- $data = bind_entities($data);
+ $data = str_replace($search, $replace, bind_entities($data));
/* catch any undefined entities */
if ($included) {
@@ -229,14 +229,11 @@
$data = preg_replace('@(<\\?xml.*\\?>)@U', '\\1<div>', $data)
. '</div>';
}
} else {
- $data = preg_replace('/&([a-zA-Z0-9-]+)\.([a-zA-Z0-9.-]+);/sm',
'<phpdoc_include ref="\\1.\\2"/>', $data);
+ $data = preg_replace('/&([a-zA-Z0-9._-]+);/sm', '<phpdoc_include
ref="\\1"/>', $data);
}
- $data = str_replace($search, $replace, $data);
-
$page = new DocBookToHTML($data);
-
if ($return_rev) {
return array($page, $lang_rev);
} else {
@@ -250,10 +247,7 @@
if (empty($notes))
return '';
- $inner = <<<HTML
-<div class="usernotes">
- <span class="title">User Contributed Notes</span>
-HTML;
+ $inner = '<div class="usernotes"><span class="title">User Contributed
Notes</span>';
foreach ($notes as $note) {
$date = date("d-M-Y h:i", $note['xwhen']);
@@ -262,16 +256,9 @@
$node->content = $note['note'];
$node->attributes['role'] = 'php';
$the_note = format_listing($node);
-
- $inner .= <<<HTML
-<div class="usernote">
- <div class="noteheader">
- <span class="user">$note[who]</span><br />
- <span class="when">$date</span>
- </div>
- $the_note
-</div>
-HTML;
+
+ $inner .= '<div class="usernote"><div class="noteheader"><span
class="user">'.$note['who'].
+ '</span><br /><span
class="when">'.$date.'</span></div>'.$the_note.'</div>';
}
return $inner . "</div>";
@@ -384,12 +371,19 @@
return '';
}
+$GLOBALS['special'] = array('gt' => 1,'lt' => 1,'quot' => 1,'amp' => 1);
+
function handle_include($node)
{
global $current_page;
$ref = $node->attributes['ref'];
-
+
+ /* Special HTML entities */
+ if (isset($GLOBALS['special'][$ref])) {
+ return '&' . $ref . ';';
+ }
+
$curr_lvl = sqlite_single_query($GLOBALS['idx'], "SELECT lvl from toc where
docbook_id='$current_page'");
list($row) = sqlite_array_query($GLOBALS['idx'], "SELECT idents.id, lvl from
ents left join files on ents.value = files.filename left join idents on files.fileid =
idents.fileid left join toc on ents.entid=toc.docbook_id where is_file=1 and
ents.entid='$ref' limit 1");
@@ -404,7 +398,6 @@
}
if ($lvl > $curr_lvl) {
-
$fake->content = null;
$fake->attributes['linkend'] = $id;
$fake->tagname = 'xref';