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

Documentation generated on Tue, 12 Mar 2019 21:49:23 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.