cvs: phpweb /include layout.inc
| From: | Gabor Hojtsy | Date: | Sun, 03 Aug 2003 17:23:03 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-19787@lists.php.net to get a copy of this message | ||
goba Sun Aug 3 13:23:03 2003 EDT
Modified files:
/phpweb/include layout.inc
Log:
Use str_replace for performance reasons, and also
honor the starting spaces on lines, discarded by browsers,
but do replace two nbsps with one and a space, as it is
rendered the same way, and is much smaller.
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.172 phpweb/include/layout.inc:1.173
--- phpweb/include/layout.inc:1.172 Sun Aug 3 06:17:21 2003
+++ phpweb/include/layout.inc Sun Aug 3 13:23:03 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.172 2003/08/03 10:17:21 goba Exp $ */
+/* $Id: layout.inc,v 1.173 2003/08/03 17:23:03 goba Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -23,16 +23,20 @@
ob_end_clean();
// Fix output to use CSS classes and wrap well
- $highlighted = '<div class="phpcode">' . preg_replace(
+ $highlighted = '<div class="phpcode">' . str_replace(
array(
- '!<br />!',
- '!<font color="([^"]+)">!',
- '!</font>!',
+ '<br />',
+ '<font color="',
+ '</font>',
+ "\n ",
+ ' '
),
array(
"<br />\n",
- '<span class="\\1">',
+ '<span class="',
'</span>',
+ "\n ",
+ ' '
),
$highlighted
) . '</div>';