includes/render.php
changeset 1044 ad6a22377507
parent 1027 98c052fc3337
child 1054 e6b14d33ac55
equal deleted inserted replaced
1043:ac1ecaacb48e 1044:ad6a22377507
   191     require_once( ENANO_ROOT . '/includes/wikiengine/Tables.php' );
   191     require_once( ENANO_ROOT . '/includes/wikiengine/Tables.php' );
   192     
   192     
   193     // this is still needed by parser plugins
   193     // this is still needed by parser plugins
   194     $random_id = md5( time() . mt_rand() );
   194     $random_id = md5( time() . mt_rand() );
   195     
   195     
   196     // Strip out <nowiki> sections and PHP code
   196     // Strip out <nowiki> sections
   197     
       
   198     self::nowiki_strip($text, $nowiki_stripped);
   197     self::nowiki_strip($text, $nowiki_stripped);
   199     
   198     
       
   199     // Run early parsing plugins
   200     $code = $plugins->setHook('render_wikiformat_veryearly');
   200     $code = $plugins->setHook('render_wikiformat_veryearly');
   201     foreach ( $code as $cmd )
   201     foreach ( $code as $cmd )
   202     {
   202     {
   203       eval($cmd);
   203       eval($cmd);
   204     }
   204     }
   205     
   205     
       
   206     // Strip out embedded PHP
   206     self::php_strip($text, $php_stripped);
   207     self::php_strip($text, $php_stripped);
   207     
   208     
       
   209     // Perform render through the engine
   208     $carpenter = new Carpenter();
   210     $carpenter = new Carpenter();
   209     $carpenter->flags = $flags;
   211     $carpenter->flags = $flags;
   210     $carpenter->hook(array(__CLASS__, 'hook_pre'), PO_AFTER, 'lang');
   212     $carpenter->hook(array(__CLASS__, 'hook_pre'), PO_AFTER, 'lang');
   211     $carpenter->hook(array(__CLASS__, 'hook_posttemplates'), PO_AFTER, 'templates');
   213     $carpenter->hook(array(__CLASS__, 'hook_posttemplates'), PO_AFTER, 'templates');
   212     if ( $flags & RENDER_WIKI_TEMPLATE )
   214     if ( $flags & RENDER_WIKI_TEMPLATE )
   213     {
   215     {
   214       // FIXME: process noinclude/nodisplay
   216       // FIXME: Where is noinclude/nodisplay being processed in the pipeline? (Seems to be processed, but not here)
   215     }
   217     }
   216     $text = $carpenter->render($text);
   218     $text = $carpenter->render($text);
   217     
   219     
   218     // For plugin compat
   220     // For plugin compat
   219     $result =& $text;
   221     $result =& $text;
   220     
   222     
       
   223     // Post processing hook
   221     $code = $plugins->setHook('render_wikiformat_post');
   224     $code = $plugins->setHook('render_wikiformat_post');
   222     foreach ( $code as $cmd )
   225     foreach ( $code as $cmd )
   223     {
   226     {
   224       eval($cmd);
   227       eval($cmd);
   225     }
   228     }
   226     
   229     
   227     /*
   230     // Add PHP and nowiki back in
   228     $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '\\1', $text);
       
   229     if ( $paths->namespace == 'Template' )
       
   230     {
       
   231       $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '', $text);
       
   232     }
       
   233     
       
   234     $text = process_tables($text);
       
   235     */
       
   236     
       
   237     self::nowiki_unstrip($text, $nowiki_stripped);
   231     self::nowiki_unstrip($text, $nowiki_stripped);
   238     self::php_unstrip($text, $php_stripped);
   232     self::php_unstrip($text, $php_stripped);
   239     
   233     
   240     profiler_log("RenderMan: finished wikitext render");
   234     profiler_log("RenderMan: finished wikitext render");
   241     
   235