includes/wikiengine/Render/Xhtml/Wikilink.php
changeset 713 6865705ec8a6
parent 67 f6454d5fec7a
equal deleted inserted replaced
711:f70d764aab33 713:6865705ec8a6
    54     *
    54     *
    55     */
    55     */
    56 
    56 
    57     function token($options)
    57     function token($options)
    58     {
    58     {
       
    59       ##
       
    60       ## THIS IS NOT WHAT YOU ARE LOOKING FOR!!
       
    61       ## All of this code is deprecated. Patch RenderMan::parse_internal_links() instead!
       
    62       ##
       
    63       
    59         global $session;
    64         global $session;
    60         if ( $session->sid_super )
    65         if ( $session->sid_super )
    61         {
    66         {
    62           $as = htmlspecialchars(urlSeparator) . 'auth='.$session->sid_super;
    67           $as = htmlspecialchars(urlSeparator) . 'auth='.$session->sid_super;
    63         }
    68         }
   118 
   123 
   119             // link to the page view, but we have to build
   124             // link to the page view, but we have to build
   120             // the HREF.  we support both the old form where
   125             // the HREF.  we support both the old form where
   121             // the page always comes at the end, and the new
   126             // the page always comes at the end, and the new
   122             // form that uses %s for sprintf()
   127             // form that uses %s for sprintf()
   123             $href = $this->getConf('view_url');
   128             $href = makeUrl($page, false, true);
   124 
   129             
   125             if (strpos($href, '%s') === false) {
       
   126                 // use the old form (page-at-end)
       
   127                 $href = $href . $page . $anchor;
       
   128             } else {
       
   129                 // use the new form (sprintf format string)
       
   130                 $href = sprintf($href, $page . $anchor);
       
   131             }
       
   132 
       
   133             // get the CSS class and generate output
   130             // get the CSS class and generate output
   134             $css = $this->formatConf(' class="%s"', 'css');
   131             $css = $this->formatConf(' class="%s"', 'css');
   135 
   132 
   136             $start = '<a'.$css.' href="'.$href.$as.'"'.$nobg.'>';
   133             $start = '<a'.$css.' href="'.$href.$as.'"'.$nobg.'>';
   137             $end = '</a>';
   134             $end = '</a>';
   141 
   138 
   142             // link to the page view, but we have to build
   139             // link to the page view, but we have to build
   143             // the HREF.  we support both the old form where
   140             // the HREF.  we support both the old form where
   144             // the page always comes at the end, and the new
   141             // the page always comes at the end, and the new
   145             // form that uses %s for sprintf()
   142             // form that uses %s for sprintf()
   146             $href = $this->getConf('view_url');
   143             $href = makeUrl($page, false, true);
   147 
       
   148             if (strpos($href, '%s') === false) {
       
   149                 // use the old form (page-at-end)
       
   150                 $href = $href . $page . $anchor;
       
   151             } else {
       
   152                 // use the new form (sprintf format string)
       
   153                 $href = sprintf($href, $page . $anchor);
       
   154             }
       
   155 
   144 
   156             // get the CSS class and generate output
   145             // get the CSS class and generate output
   157             $css = $this->formatConf(' class="%s"', 'css');
   146             $css = $this->formatConf(' class="%s"', 'css');
   158 
   147 
   159             $start = '<a'.$css.' href="'.$href.$as.'"'.$nobg.' class="wikilink-nonexistent">';
   148             $start = '<a'.$css.' href="'.$href.'"'.$nobg.' class="wikilink-nonexistent">';
   160             $end = '</a>';
   149             $end = '</a>';
   161             
       
   162         }
   150         }
   163         if (!strlen($text)) {
   151         if (!strlen($text)) {
   164             $start .= $this->textEncode($options['page']);
   152             $start .= $this->textEncode($options['page']);
   165         }
   153         }
   166         if (isset($type)) {
   154         if (isset($type)) {