[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The space2html filter converts horizontal whitespace to HTML code. 4 * 5 * Parameters: 6 * <pre> 7 * encode -- HTML encode the text? Defaults to false. 8 * charset -- Charset of the text. Defaults to ISO-8859-1. 9 * encode_all -- Replace all spaces with ? Defaults to false. 10 * </pre> 11 * 12 * $Horde: framework/Text_Filter/Filter/space2html.php,v 1.1.10.5 2006/01/01 21:28:38 jan Exp $ 13 * 14 * Copyright 2001 Mathieu Arnold <arn_mat@club-internet.fr> 15 * Copyright 2004-2006 Jan Schneider <jan@horde.org> 16 * 17 * See the enclosed file COPYING for license information (LGPL). If you did 18 * not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 19 * 20 * @author Jan Schneider <jan@horde.org> 21 * @author Mathieu Arnold <arn_mat@club-internet.fr> 22 * @package Horde_Text 23 */ 24 class Text_Filter_space2html extends Text_Filter { 25 26 /** 27 * Filter parameters. 28 * 29 * @var array 30 */ 31 var $_params = array('encode' => false, 32 'charset' => 'ISO-8859-1', 33 'encode_all' => false); 34 35 /** 36 * Executes any code necessary before applying the filter patterns. 37 * 38 * @param string $text The text before the filtering. 39 * 40 * @return string The modified text. 41 */ 42 function preProcess($text) 43 { 44 if ($this->_params['encode']) { 45 $text = @htmlspecialchars($text, ENT_COMPAT, $this->_params['charset']); 46 } 47 return $text; 48 } 49 50 /** 51 * Returns a hash with replace patterns. 52 * 53 * @return array Patterns hash. 54 */ 55 function getPatterns() 56 { 57 $replace = array("\t" => ' ', 58 ' ' => ' '); 59 return array('replace' => $replace); 60 } 61 62 /** 63 * Executes any code necessaray after applying the filter patterns. 64 * 65 * @param string $text The text after the filtering. 66 * 67 * @return string The modified text. 68 */ 69 function postProcess($text) 70 { 71 $text = str_replace(' ', ' ', $text); 72 if ($this->_params['encode_all']) { 73 $text = str_replace(' ', ' ', $text); 74 } 75 return $text; 76 } 77 78 }
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 |