includes/render.php
changeset 1108 c1be67a50d81
parent 1098 be6cfe79128c
child 1123 777f32ac6b7c
--- a/includes/render.php	Wed Aug 26 13:43:11 2009 -0400
+++ b/includes/render.php	Wed Aug 26 23:25:39 2009 -0400
@@ -164,7 +164,7 @@
     if ( !$smilies )
       $flags |= RENDER_NOSMILIES;
     
-    if ( $flags & ~RENDER_NOSMILIES )
+    if ( !($flags & RENDER_NOSMILIES) )
     {
       $text = RenderMan::smilieyize($text);
     }
@@ -217,6 +217,50 @@
     {
       // FIXME: Where is noinclude/nodisplay being processed in the pipeline? (Seems to be processed, but not here)
     }
+    
+    //
+    // Set rules for the rendering process
+    //
+    
+    if ( $flags & RENDER_BLOCK && !($flags & RENDER_INLINE) )
+    {
+      // block only
+      $carpenter->disable_all_rules();
+      foreach ( array('blockquote', 'tables', 'heading', 'hr', 'multilist', 'bold', 'italic', 'underline', 'paragraph', 'blockquotepost') as $rule )
+      {
+        $carpenter->enable_rule($rule);
+      }
+      
+      $code = $plugins->setHook('render_block_only');
+      foreach ( $code as $cmd )
+      {
+        eval($cmd);
+      }
+    }
+    else if ( $flags & RENDER_INLINE && !($flags & RENDER_BLOCK) )
+    {
+      // inline only
+      $carpenter->disable_all_rules();
+      foreach ( array('bold', 'italic', 'underline', 'externalwithtext', 'externalnotext', 'image', 'internallink') as $rule )
+      {
+        $carpenter->enable_rule($rule);
+      }
+      
+      $code = $plugins->setHook('render_inline_only');
+      foreach ( $code as $cmd )
+      {
+        eval($cmd);
+      }
+    }
+    else
+    {
+      // full render
+      $code = $plugins->setHook('render_full');
+      foreach ( $code as $cmd )
+      {
+        eval($cmd);
+      }
+    }
     $text = $carpenter->render($text);
     
     // For plugin compat