| [ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The MIME_Viewer_source class is a class for any viewer that wants 4 * to provide line numbers to extend. 5 * 6 * $Horde: framework/MIME/MIME/Viewer/source.php,v 1.9.10.9 2006/01/01 21:28:25 jan Exp $ 7 * 8 * Copyright 1999-2006 Chuck Hagenbuch <chuck@horde.org> 9 * 10 * See the enclosed file COPYING for license information (LGPL). If you 11 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 12 * 13 * @author Chuck Hagenbuch <chuck@horde.org> 14 * @since Horde 1.3 15 * @package Horde_MIME_Viewer 16 */ 17 class MIME_Viewer_source extends MIME_Viewer { 18 19 /** 20 * Add line numbers to a block of code. 21 * 22 * @param string $code The code to number. 23 */ 24 function lineNumber($code, $linebreak = "\n") 25 { 26 $lines = substr_count($code, $linebreak) + 1; 27 $html = '<table class="lineNumbered" cellspacing="0"><tr><th>'; 28 for ($l = 1; $l <= $lines; $l++) { 29 $html .= sprintf('<a id="l%s" href="#l%s">%s</a><br />', $l, $l, $l) . "\n"; 30 } 31 return $html . '</th><td>' . $code . '</td></tr></table>'; 32 } 33 34 /** 35 * Return the MIME content type of the rendered content. 36 * 37 * @return string The content type of the output. 38 */ 39 function getType() 40 { 41 return 'text/html; charset=' . NLS::getCharset(); 42 } 43 44 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |