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

Source for file Toc.php

Documentation is available at Toc.php

  1. <?php
  2.  
  3. // $Id: Toc.php,v 1.7 2004/09/25 19:05:14 pmjones Exp $
  4.  
  5.     
  6.     var $conf = array(
  7.         'css_list' => null,
  8.         'css_item' => null,
  9.         'title' => '<strong>Table of Contents</strong>',
  10.         'div_id' => 'toc'
  11.     );
  12.     
  13.     var $min = 2;
  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.         // type, id, level, count, attr
  31.         extract($options);
  32.         
  33.         switch ($type{
  34.         
  35.         case 'list_start':
  36.         
  37.             $html '<div';
  38.             
  39.             $css $this->getConf('css_list');
  40.             if ($css{
  41.                 $html .= " class=\"$css\"";
  42.             }
  43.             
  44.             $div_id $this->getConf('div_id');
  45.             if ($div_id{
  46.                 $html .= " id=\"$div_id\"";
  47.             }
  48.             
  49.             $html .= '>';
  50.             $html .= $this->getConf('title');
  51.             return $html;
  52.             break;
  53.         
  54.         case 'list_end':
  55.             return "</div>\n";
  56.             break;
  57.             
  58.         case 'item_start':
  59.             $html '<div';
  60.             
  61.             $css $this->getConf('css_item');
  62.             if ($css{
  63.                 $html .= " class=\"$css\"";
  64.             }
  65.             
  66.             $pad ($level $this->min);
  67.             $html .= " style=\"margin-left: {$pad}em;\">";
  68.             
  69.             $html .= "<a href=\"#$id\">";
  70.             return $html;
  71.             break;
  72.         
  73.         case 'item_end':
  74.             return "</a></div>\n";
  75.             break;
  76.         }
  77.     }
  78. }
  79. ?>

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