includes/render.php
changeset 1108 c1be67a50d81
parent 1098 be6cfe79128c
child 1123 777f32ac6b7c
equal deleted inserted replaced
1107:2d37a11fabd8 1108:c1be67a50d81
   162     global $db, $session, $paths, $template, $plugins; // Common objects
   162     global $db, $session, $paths, $template, $plugins; // Common objects
   163     
   163     
   164     if ( !$smilies )
   164     if ( !$smilies )
   165       $flags |= RENDER_NOSMILIES;
   165       $flags |= RENDER_NOSMILIES;
   166     
   166     
   167     if ( $flags & ~RENDER_NOSMILIES )
   167     if ( !($flags & RENDER_NOSMILIES) )
   168     {
   168     {
   169       $text = RenderMan::smilieyize($text);
   169       $text = RenderMan::smilieyize($text);
   170     }
   170     }
   171     if ( $flags & RENDER_WIKI_DEFAULT )
   171     if ( $flags & RENDER_WIKI_DEFAULT )
   172     {
   172     {
   214     $carpenter->hook(array(__CLASS__, 'hook_pre'), PO_AFTER, 'lang');
   214     $carpenter->hook(array(__CLASS__, 'hook_pre'), PO_AFTER, 'lang');
   215     $carpenter->hook(array(__CLASS__, 'hook_posttemplates'), PO_AFTER, 'templates');
   215     $carpenter->hook(array(__CLASS__, 'hook_posttemplates'), PO_AFTER, 'templates');
   216     if ( $flags & RENDER_WIKI_TEMPLATE )
   216     if ( $flags & RENDER_WIKI_TEMPLATE )
   217     {
   217     {
   218       // FIXME: Where is noinclude/nodisplay being processed in the pipeline? (Seems to be processed, but not here)
   218       // FIXME: Where is noinclude/nodisplay being processed in the pipeline? (Seems to be processed, but not here)
       
   219     }
       
   220     
       
   221     //
       
   222     // Set rules for the rendering process
       
   223     //
       
   224     
       
   225     if ( $flags & RENDER_BLOCK && !($flags & RENDER_INLINE) )
       
   226     {
       
   227       // block only
       
   228       $carpenter->disable_all_rules();
       
   229       foreach ( array('blockquote', 'tables', 'heading', 'hr', 'multilist', 'bold', 'italic', 'underline', 'paragraph', 'blockquotepost') as $rule )
       
   230       {
       
   231         $carpenter->enable_rule($rule);
       
   232       }
       
   233       
       
   234       $code = $plugins->setHook('render_block_only');
       
   235       foreach ( $code as $cmd )
       
   236       {
       
   237         eval($cmd);
       
   238       }
       
   239     }
       
   240     else if ( $flags & RENDER_INLINE && !($flags & RENDER_BLOCK) )
       
   241     {
       
   242       // inline only
       
   243       $carpenter->disable_all_rules();
       
   244       foreach ( array('bold', 'italic', 'underline', 'externalwithtext', 'externalnotext', 'image', 'internallink') as $rule )
       
   245       {
       
   246         $carpenter->enable_rule($rule);
       
   247       }
       
   248       
       
   249       $code = $plugins->setHook('render_inline_only');
       
   250       foreach ( $code as $cmd )
       
   251       {
       
   252         eval($cmd);
       
   253       }
       
   254     }
       
   255     else
       
   256     {
       
   257       // full render
       
   258       $code = $plugins->setHook('render_full');
       
   259       foreach ( $code as $cmd )
       
   260       {
       
   261         eval($cmd);
       
   262       }
   219     }
   263     }
   220     $text = $carpenter->render($text);
   264     $text = $carpenter->render($text);
   221     
   265     
   222     // For plugin compat
   266     // For plugin compat
   223     $result =& $text;
   267     $result =& $text;