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

Source for file Function.php

Documentation is available at Function.php

  1. <?php
  2.  
  3. class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
  4.     
  5.     var $conf = array(
  6.         'css_div' => null,
  7.         'access'  => '%s',
  8.         'return'  => '%s',
  9.         'name'    => '<strong>%s</strong>',
  10.         'type'    => '%s',
  11.         'descr'   => '<em>%s</em>',
  12.         'default' => 'default %s'
  13.     );
  14.     
  15.     /**
  16.     * 
  17.     * Renders a token into text matching the requested format.
  18.     * 
  19.     * @access public
  20.     * 
  21.     * @param array $options The "options" portion of the token (second
  22.     *  element).
  23.     * 
  24.     * @return string The text rendered from the token options.
  25.     * 
  26.     */
  27.     
  28.     function token($options)
  29.     {
  30.         extract($options); // name, access, return, params
  31.         
  32.         $css = $this->formatConf(' class="%s"', $this->conf['css_div']);
  33.         $output = "<div$css>";
  34.         
  35.         $output .= sprintf($this->conf['access'], $access) . ' ';
  36.         $output .= sprintf($this->conf['return'], $return) . ' ';
  37.         $output .= sprintf($this->conf['name'], $name) . ' ( ';
  38.         
  39.         $list = array();
  40.         foreach ($params as $key => $val) {
  41.             $tmp = sprintf($this->conf['type'], $val['type']) . ' ';
  42.             $tmp .= sprintf($this->conf['descr'], $val['descr']);
  43.             if ($val['default']) {
  44.                 $tmp .= ' ' . sprintf($this->conf['default'], $val['default']);
  45.                 $tmp = "[$tmp]";
  46.             }
  47.             $list[] = $tmp;
  48.         }
  49.         $output .= implode(', ', $list) . " )</div>";
  50.         
  51.         return "\n$output\n\n";
  52.     }
  53. }
  54. ?>

Documentation generated on Mon, 11 Mar 2019 13:56:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.