? php_highlight3.patch
Index: bbcode-filter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bbcode/bbcode-filter.inc,v
retrieving revision 1.62
diff -u -p -r1.62 bbcode-filter.inc
--- bbcode-filter.inc	3 Aug 2007 05:38:35 -0000	1.62
+++ bbcode-filter.inc	11 Aug 2007 21:56:26 -0000
@@ -21,10 +21,10 @@ function _bbcode_filter_process(&$body, 
       elseif ($mode) {
         // Strip preformatted code blocks from text during line break processing, replaced below
         $body = str_replace($code_tag[0], "***pRe_sTrInG$i***", $body);
-        $pre[$i++] = '<pre class="bb-code-block">'. $code_tag[1] .'</pre>';
+        $pre[$i++] = '<div class="codeblock"><pre class="bb-code-block">'. $code_tag[1] .'</pre></div>';
       }
       else
-        $body = str_replace($code_tag[0], '<pre class="bb-code-block">'. $code_tag[1] .'</pre>', $body);
+        $body = str_replace($code_tag[0], '<div class="codeblock"><pre class="bb-code-block">'. $code_tag[1] .'</pre></div>', $body);
     }
   }
 
@@ -332,7 +332,11 @@ function _bbcode_notag_tag($text = NULL)
 }
 
 function _bbcode_php_tag($text = NULL) {
-  return '<pre>'. highlight_string( str_replace('<br />', '', stripslashes($text)), true) .'</pre>';
+  $text = "<?php\n".  str_replace('<br />', '', trim(stripslashes($text))) ."\n?>";
+  $text = highlight_string($text, TRUE);
+  // Remove newlines to avoid clashing with the linebreak filter
+  $text = str_replace("\n", '', $text);
+  return '<div class="codeblock"><pre>'. $text .'</pre></div>';
 }
 
 function _bbcode_round_size_val($size) {
Index: bbcode.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bbcode/bbcode.module,v
retrieving revision 1.46
diff -u -p -r1.46 bbcode.module
--- bbcode.module	26 May 2007 06:58:31 -0000	1.46
+++ bbcode.module	11 Aug 2007 21:56:27 -0000
@@ -28,6 +28,11 @@ function bbcode_filter($op, $delta = 0, 
     case 'description':
       return t('Converts BBCode to HTML.');
 
+    case 'prepare':
+      // Strip the special PHP start and end tags out of any [php] BBCode
+      // statements (be nice to the codefilter module)
+      return preg_replace('#\[php(?::\w+)?\](?:[\r\n])*<\?php(.*?)\?>\[/php(?::\w+)?\]#si', '[php]\\1[/php]', $text);
+
     case 'process':
       include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc');
       if (variable_get("bbcode_debug_$format", 0)) {
