cvs: phpweb /include layout.inc
| From: | Rasmus Lerdorf | Date: | Thu, 26 Aug 2004 08:23:19 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-25951@lists.php.net to get a copy of this message | ||
rasmus Thu Aug 26 04:23:19 2004 EDT
Modified files:
/phpweb/include layout.inc
Log:
Avoid syntax highlighting snippets with syntax errors in them.
http://cvs.php.net/diff.php/phpweb/include/layout.inc?r1=1.204&r2=1.205&ty=u
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.204 phpweb/include/layout.inc:1.205
--- phpweb/include/layout.inc:1.204 Tue Aug 3 15:21:58 2004
+++ phpweb/include/layout.inc Thu Aug 26 04:23:18 2004
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.204 2004/08/03 19:21:58 goba Exp $ */
+/* $Id: layout.inc,v 1.205 2004/08/26 08:23:18 rasmus Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -21,7 +21,11 @@
highlight_string($code);
$highlighted = ob_get_contents();
ob_end_clean();
-
+
+ // This should eventually be a php_syntax_check() call when we move to PHP5
+ // But use this ugly hack for now to avoid code snippets with bad syntax screwing up the
highlighter
+ if(strstr($highlighted,"include/layout.inc</b>")) $highlighted =
"<pre>".htmlentities($code)."</pre>";
+
// Fix output to use CSS classes and wrap well
$highlighted = '<div class="phpcode">' . str_replace(
array(