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

Source for file Table.php

Documentation is available at Table.php

  1. <?php
  2.  
  3. class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
  4.     
  5.     var $conf = array(
  6.         'css_table' => null,
  7.         'css_tr' => null,
  8.         'css_td' => null
  9.     );
  10.     
  11.     
  12.     /**
  13.     * 
  14.     * Renders a token into text matching the requested format.
  15.     * 
  16.     * @access public
  17.     * 
  18.     * @param array $options The "options" portion of the token (second
  19.     *  element).
  20.     * 
  21.     * @return string The text rendered from the token options.
  22.     * 
  23.     */
  24.     
  25.     function token($options)
  26.     {
  27.         // make nice variable names (type, align, colspan)
  28.         extract($options);
  29.         
  30.         $pad '    ';
  31.         
  32.         switch ($type{
  33.         
  34.         case 'table_start':
  35.             
  36.             // pick the CSS class
  37.             $css $this->getConf('css_table''');
  38.             if ($css{
  39.                 $css = " class=\"$css\"";
  40.             }
  41.             
  42.             // done!
  43.             return "\n\n<table$css>\n";
  44.             break;
  45.         
  46.         case 'table_end':
  47.             return "</table>\n\n";
  48.             break;
  49.         
  50.         case 'row_start':
  51.             $html = "$pad<tr";
  52.             
  53.             // pick the CSS class
  54.             $css $this->getConf('css_tr''');
  55.             if ($css{
  56.                 $css = " class=\"$css\"";
  57.             }
  58.             
  59.             // done
  60.             return "$pad<tr$css>\n";
  61.             break;
  62.         
  63.         case 'row_end':
  64.             return "$pad</tr>\n";
  65.             break;
  66.         
  67.         case 'cell_start':
  68.             
  69.             // build the base html
  70.             $html = "$pad$pad<td";
  71.             
  72.             // pick and add the CSS class
  73.             $css $this->getConf('css_td''');
  74.             if ($css{
  75.                 $html .= " class=\"$css\"";
  76.             }
  77.             
  78.             // add the column span
  79.             if ($colspan > 1{
  80.                 $html .= " colspan=\"$colspan\"";
  81.             }
  82.             
  83.             // add alignment
  84.             if ($align{
  85.                 $html .= " style=\"text-align: $align;\"";
  86.             }
  87.             
  88.             // done!
  89.             $html .= '>';
  90.             return $html;
  91.             break;
  92.         
  93.         case 'cell_end':
  94.             return "</td>\n";
  95.             break;
  96.         
  97.         default:
  98.             return '';
  99.         
  100.         }
  101.     }
  102. }
  103. ?>

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