includes/render.php
changeset 1123 777f32ac6b7c
parent 1108 c1be67a50d81
child 1157 e154e8176700
equal deleted inserted replaced
1122:e1606c85e937 1123:777f32ac6b7c
   662   {
   662   {
   663     global $db, $session, $paths, $template, $plugins; // Common objects
   663     global $db, $session, $paths, $template, $plugins; // Common objects
   664   
   664   
   665     $parser = is_string($tplcode) ? $template->makeParserText($tplcode) : false;
   665     $parser = is_string($tplcode) ? $template->makeParserText($tplcode) : false;
   666     
   666     
       
   667     // allow blank urlname?
       
   668     $repeater = have_blank_urlname_page() ? '*' : '+';
       
   669     
   667     // stage 1 - links with alternate text
   670     // stage 1 - links with alternate text
   668     preg_match_all('/\[\[([^\[\]<>\{\}\|]+)\|(.+?)\]\]/', $text, $matches);
   671     preg_match_all('/\[\[([^\[\]<>\{\}\|]' . $repeater . ')\|(.+?)\]\]/', $text, $matches);
   669     foreach ( $matches[0] as $i => $match )
   672     foreach ( $matches[0] as $i => $match )
   670     {
   673     {
   671       list($page_id, $namespace) = RenderMan::strToPageID($matches[1][$i]);
   674       list($page_id, $namespace) = RenderMan::strToPageID($matches[1][$i]);
   672       $link = self::generate_internal_link($namespace, $page_id, $matches[2][$i], $match, $parser, $do_exist_check, $match_page_id, $match_namespace);
   675       $link = self::generate_internal_link($namespace, $page_id, $matches[2][$i], $match, $parser, $do_exist_check, $match_page_id, $match_namespace);
   673       $text = str_replace($match, $link, $text);
   676       $text = str_replace($match, $link, $text);
   674     }
   677     }
   675     
   678     
   676     // stage 2 - links with no alternate text
   679     // stage 2 - links with no alternate text
   677     preg_match_all('/\[\[([^\[\]<>\{\}\|]+)\]\]/', $text, $matches);
   680     preg_match_all('/\[\[([^\[\]<>\{\}\|]' . $repeater . ')\]\]/', $text, $matches);
   678     foreach ( $matches[0] as $i => $match )
   681     foreach ( $matches[0] as $i => $match )
   679     {
   682     {
   680       list($page_id, $namespace) = RenderMan::strToPageID($matches[1][$i]);
   683       list($page_id, $namespace) = RenderMan::strToPageID($matches[1][$i]);
   681       $pid_clean = $paths->nslist[$namespace] . sanitize_page_id($page_id);
   684       $pid_clean = $paths->nslist[$namespace] . sanitize_page_id($page_id);
   682       $inner_text = ( isPage($pid_clean) ) ? htmlspecialchars(get_page_title($pid_clean)) : htmlspecialchars($matches[1][$i]);
   685       $inner_text = ( isPage($pid_clean) ) ? htmlspecialchars(get_page_title($pid_clean)) : htmlspecialchars($matches[1][$i]);