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

Source for file Function.php

Documentation is available at Function.php

  1. <?php
  2.  
  3. // $Id: Function.php 206950 2006-02-11 07:16:37Z toggg $
  4. //not in tiki
  5. class Text_Wiki_Render_Tiki_Function extends Text_Wiki_Render {
  6.     
  7.     /**
  8.     * 
  9.     * Renders a token into text matching the requested format.
  10.     * 
  11.     * @access public
  12.     * 
  13.     * @param array $options The "options" portion of the token (second
  14.     *  element).
  15.     * 
  16.     * @return string The text rendered from the token options.
  17.     * 
  18.     */
  19.     
  20.     function token($options)
  21.     {
  22.         extract($options)// name, access, return, params, throws
  23.         
  24.         // build the baseline output
  25.         $output $this->conf['format_main'];
  26.         $output str_replace('%access'$this->textEncode($access)$output);
  27.         $output str_replace('%return'$this->textEncode($return)$output);
  28.         $output str_replace('%name'$this->textEncode($name)$output);
  29.         
  30.         // build the set of params
  31.         $list = array();
  32.         foreach ($params as $key => $val{
  33.             
  34.             // is there a default value?
  35.             if ($val['default']{
  36.                 $tmp $this->conf['format_paramd'];
  37.             else {
  38.                 $tmp $this->conf['format_param'];
  39.             }
  40.             
  41.             // add the param elements
  42.             $tmp str_replace('%type'$this->textEncode($val['type'])$tmp);
  43.             $tmp str_replace('%descr'$this->textEncode($val['descr'])$tmp);
  44.             $tmp str_replace('%default'$this->textEncode($val['default'])$tmp);
  45.             $list[$tmp;
  46.         }
  47.         
  48.         // insert params into output
  49.         $tmp implode($this->conf['list_sep']$list);
  50.         $output str_replace('%params'$tmp$output);
  51.         
  52.         // build the set of throws
  53.         $list = array();
  54.         foreach ($throws as $key => $val{
  55.                $tmp $this->conf['format_throws'];
  56.             $tmp str_replace('%type'$this->textEncode($val['type'])$tmp);
  57.             $tmp str_replace('%descr'$this->textEncode($val['descr'])$tmp);
  58.             $list[$tmp;
  59.         }
  60.         
  61.         // insert throws into output
  62.         $tmp implode($this->conf['list_sep']$list);
  63.         $output str_replace('%throws'$tmp$output);
  64.         
  65.         // close the div and return the output
  66.         $output .= '</div>';
  67.         return "\n$output\n\n";
  68.     }
  69. }
  70. ?>

Documentation generated on Mon, 11 Mar 2019 15:32:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.