Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file Wikilink.php

Documentation is available at Wikilink.php

  1. <?php
  2.  
  3.     var $conf = array(
  4.         'pages' => array(),
  5.         'view_url' => 'http://example.com/index.php?page=%s',
  6.         'new_url'  => 'http://example.com/new.php?page=%s',
  7.         'new_text' => '?'
  8.     );
  9.  
  10.     /**
  11.     *
  12.     * Renders a token into XHTML.
  13.     *
  14.     * @access public
  15.     *
  16.     * @param array $options The "options" portion of the token (second
  17.     *  element).
  18.     *
  19.     * @return string The text rendered from the token options.
  20.     *
  21.     */
  22.  
  23.     function token($options)
  24.     {
  25.         // make nice variable names (page, anchor, text)
  26.         extract($options);
  27.  
  28.         // are we checking page existence?
  29.         $list $this->getConf('pages');
  30.         if (is_array($list)) {
  31.             // yes, check against the page list
  32.             $exists in_array($page$list);
  33.         else {
  34.             // no, assume it exists
  35.             $exists = true;
  36.         }
  37.  
  38.         // convert *after* checking against page names so as not to mess
  39.         // up what the user typed and what we're checking.
  40.         $page $this->textEncode($page);
  41.         $anchor $this->textEncode($anchor);
  42.         $text $this->textEncode($text);
  43.  
  44.         $href $this->getConf('view_url');
  45.  
  46.         if (strpos($href'%s'=== false{
  47.             // use the old form (page-at-end)
  48.             $href $href $page $anchor;
  49.         else {
  50.             // use the new form (sprintf format string)
  51.             $href sprintf($href$page $anchor);
  52.         }
  53.  
  54.         // get the CSS class and generate output
  55.         $css $this->formatConf(' class="%s"''css');
  56.         return "$text\\footnote\{$href}";
  57.     }
  58. }
  59. ?>

Documentation generated on Mon, 11 Mar 2019 14:37:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.