includes/render.php
changeset 66 52017732bc20
parent 65 627d0a8a7819
child 67 f6454d5fec7a
equal deleted inserted replaced
65:627d0a8a7819 66:52017732bc20
   241     }
   241     }
   242     
   242     
   243     if ( !$plaintext )
   243     if ( !$plaintext )
   244     {
   244     {
   245       // Process images
   245       // Process images
   246       $text = RenderMan::process_image_tags($text, $taglist);
   246       $text   = RenderMan::process_image_tags($text, $taglist);
       
   247       $text = RenderMan::process_imgtags_stage2($text, $taglist);
   247     }
   248     }
   248     
   249     
   249     if($do_params)
   250     if($do_params)
   250     {
   251     {
   251       preg_match_all('#\(_([0-9]+)_\)#', $text, $matchlist);
   252       preg_match_all('#\(_([0-9]+)_\)#', $text, $matchlist);
   278       $wiki->setRenderConf('Xhtml', 'wikilink', 'view_url', contentPath);
   279       $wiki->setRenderConf('Xhtml', 'wikilink', 'view_url', contentPath);
   279       $wiki->setRenderConf('Xhtml', 'Url', 'css_descr', 'external');
   280       $wiki->setRenderConf('Xhtml', 'Url', 'css_descr', 'external');
   280       $result = $wiki->transform($text, 'Xhtml');
   281       $result = $wiki->transform($text, 'Xhtml');
   281     }
   282     }
   282     
   283     
   283     if ( !$plaintext )
   284     // if ( !$plaintext )
   284     {
   285     // {
   285       $result = RenderMan::process_imgtags_stage2($result, $taglist);
   286     //   $result = RenderMan::process_imgtags_stage2($result, $taglist);
   286     }
   287     // }
   287     
   288     
   288     // Reinsert <nowiki> sections
   289     // Reinsert <nowiki> sections
   289     for($i=0;$i<$nw;$i++)
   290     for($i=0;$i<$nw;$i++)
   290     {
   291     {
   291       $result = str_replace('{NOWIKI:'.$random_id.':'.$i.'}', $nowiki[1][$i], $result);
   292       $result = str_replace('{NOWIKI:'.$random_id.':'.$i.'}', $nowiki[1][$i], $result);
   773     $s_delim = "\xFF";
   774     $s_delim = "\xFF";
   774     $f_delim = "\xFF";
   775     $f_delim = "\xFF";
   775     $taglist = array();
   776     $taglist = array();
   776     
   777     
   777     // Wicked huh?
   778     // Wicked huh?
   778     $regex = '/\[\[:' . $paths->nslist['File'] . '([\w\s0-9_\(\)!@%\^\+\|\.-]+?)((\|thumb)|(\|([0-9]+)x([0-9]+)))?(\|left|\|right)?(\|(.+))?\]\]/i';
   779     $regex = '/\[\[:' . $paths->nslist['File'] . '([\w\s0-9_\(\)!@%\^\+\|\.-]+?)((\|thumb)|(\|([0-9]+)x([0-9]+)))?(\|left|\|right)?(\|raw|\|(.+))?\]\]/i';
   779     
   780     
   780     preg_match_all($regex, $text, $matches);
   781     preg_match_all($regex, $text, $matches);
   781     
   782     
   782     foreach ( $matches[0] as $i => $match )
   783     foreach ( $matches[0] as $i => $match )
   783     {
   784     {
   790       $clear      =& $matches[7][$i];
   791       $clear      =& $matches[7][$i];
   791       $caption    =& $matches[8][$i];
   792       $caption    =& $matches[8][$i];
   792       
   793       
   793       if ( !isPage( $paths->nslist['File'] . $filename ) )
   794       if ( !isPage( $paths->nslist['File'] . $filename ) )
   794       {
   795       {
       
   796         $text = str_replace($full_tag, '[[' . makeUrlNS('File', $filename) . ']]', $text);
   795         continue;
   797         continue;
   796       }
   798       }
   797       
   799       
   798       if ( $scale_type == '|thumb' )
   800       if ( $scale_type == '|thumb' )
   799       {
   801       {
   816       
   818       
   817       $img_tag = '<img src="' . $url . '" ';
   819       $img_tag = '<img src="' . $url . '" ';
   818       
   820       
   819       // if ( isset($r_width) && isset($r_height) && $scale_type != '|thumb' )
   821       // if ( isset($r_width) && isset($r_height) && $scale_type != '|thumb' )
   820       // {
   822       // {
   821       // $img_tag .= 'width="' . $r_width . '" height="' . $r_height . '" ';
   823       //   $img_tag .= 'width="' . $r_width . '" height="' . $r_height . '" ';
   822       // }
   824       // }
   823       
   825       
   824       $img_tag .= 'style="border-width: 0px; background-color: white;" ';
   826       $img_tag .= 'style="border-width: 0px; /* background-color: white; */" ';
   825       
   827       
   826       $img_tag .= '/>';
   828       $img_tag .= '/>';
   827       
   829       
   828       $complete_tag = '';
   830       $complete_tag = '';
   829       
   831       
   830       if ( !empty($scale_type) )
   832       if ( !empty($scale_type) && $caption != '|raw' )
   831       {
   833       {
   832         $complete_tag .= '<div class="thumbnail" ';
   834         $complete_tag .= '<div class="thumbnail" ';
   833         $clear_text = '';
   835         $clear_text = '';
   834         if ( !empty($clear) )
   836         if ( !empty($clear) )
   835         {
   837         {
   852           $complete_tag .= $mag_button . $cap;
   854           $complete_tag .= $mag_button . $cap;
   853         }
   855         }
   854         
   856         
   855         $complete_tag .= '</div>';
   857         $complete_tag .= '</div>';
   856       }
   858       }
       
   859       else if ( $caption == '|raw' )
       
   860       {
       
   861         $complete_tag .= $img_tag;
       
   862       }
   857       else
   863       else
   858       {
   864       {
   859         $complete_tag .= '<a href="' . makeUrlNS('File', $filename) . '" style="display: block;">';
   865         $complete_tag .= '<a href="' . makeUrlNS('File', $filename) . '" style="display: block;">';
   860         $complete_tag .= $img_tag;
   866         $complete_tag .= $img_tag;
   861         $complete_tag .= '</a>';
   867         $complete_tag .= '</a>';