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

Source for file Interwiki.php

Documentation is available at Interwiki.php

  1. <?php
  2.  
  3.     
  4.     var $conf = array(
  5.         'sites' => array(
  6.             'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
  7.             'Advogato' => 'http://advogato.org/%s',
  8.             'Wiki'       => 'http://c2.com/cgi/wiki?%s'
  9.         ),
  10.         'target' => '_blank'
  11.     );
  12.     
  13.     
  14.     /**
  15.     * 
  16.     * Renders a token into text matching the requested format.
  17.     * 
  18.     * @access public
  19.     * 
  20.     * @param array $options The "options" portion of the token (second
  21.     *  element).
  22.     * 
  23.     * @return string The text rendered from the token options.
  24.     * 
  25.     */
  26.     
  27.     function token($options)
  28.     {
  29.         $site $options['site'];
  30.         $page $options['page'];
  31.         $text $options['text'];
  32.         
  33.         if (isset($this->conf['sites'][$site])) {
  34.             $href $this->conf['sites'][$site];
  35.         else {
  36.             return $text;
  37.         }
  38.         
  39.         // old form where page is at end,
  40.         // or new form with %s placeholder for sprintf()?
  41.         if (strpos($href'%s'=== false{
  42.             // use the old form
  43.             $href $href $page;
  44.         else {
  45.             // use the new form
  46.             $href sprintf($href$page);
  47.         }
  48.         
  49.         // allow for alternative targets
  50.         $target $this->getConf('target''');
  51.         
  52.         if ($target && trim($target!= ''{
  53.             $target = " target=\"$target\"";
  54.         }
  55.         
  56.         return "$text\\footnote\{$href}";
  57.     }
  58. }
  59. ?>

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