[ Index ] |
|
Code source de Serendipity 1.2 |
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_th' => null, 9 'css_td' => null 10 ); 11 12 13 /** 14 * 15 * Renders a token into text matching the requested format. 16 * 17 * @access public 18 * 19 * @param array $options The "options" portion of the token (second 20 * element). 21 * 22 * @return string The text rendered from the token options. 23 * 24 */ 25 26 function token($options) 27 { 28 // make nice variable names (type, attr, span) 29 extract($options); 30 31 $pad = ' '; 32 33 switch ($type) { 34 35 case 'table_start': 36 $css = $this->formatConf(' class="%s"', 'css_table'); 37 return "\n\n<table$css>\n"; 38 break; 39 40 case 'table_end': 41 return "</table>\n\n"; 42 break; 43 44 case 'row_start': 45 $css = $this->formatConf(' class="%s"', 'css_tr'); 46 return "$pad<tr$css>\n"; 47 break; 48 49 case 'row_end': 50 return "$pad</tr>\n"; 51 break; 52 53 case 'cell_start': 54 55 // base html 56 $html = $pad . $pad; 57 58 // is this a TH or TD cell? 59 if ($attr == 'header') { 60 // start a header cell 61 $css = $this->formatConf(' class="%s"', 'css_th'); 62 $html .= "<th$css"; 63 } else { 64 // start a normal cell 65 $css = $this->formatConf(' class="%s"', 'css_td'); 66 $html .= "<td$css"; 67 } 68 69 // add the column span 70 if ($span > 1) { 71 $html .= " colspan=\"$span\""; 72 } 73 74 // add alignment 75 if ($attr != 'header' && $attr != '') { 76 $html .= " style=\"text-align: $attr;\""; 77 } 78 79 // done! 80 $html .= '>'; 81 return $html; 82 break; 83 84 case 'cell_end': 85 if ($attr == 'header') { 86 return "</th>\n"; 87 } else { 88 return "</td>\n"; 89 } 90 break; 91 92 default: 93 return ''; 94 95 } 96 } 97 } 98 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:00:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |