[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /** 3 * log4php is a PHP port of the log4j java logging package. 4 * 5 * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p> 6 * <p>Design, strategies and part of the methods documentation are developed by log4j team 7 * (Ceki Gülcü as log4j project founder and 8 * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p> 9 * 10 * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br> 11 * For more information, please see {@link http://www.vxr.it/log4php/}.</p> 12 * 13 * <p>This software is published under the terms of the LGPL License 14 * a copy of which has been included with this distribution in the LICENSE file.</p> 15 * 16 * @package log4php 17 * @subpackage helpers 18 */ 19 20 /** 21 * @ignore 22 */ 23 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..'); 24 25 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_START', '<![CDATA['); 26 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_END', ']]>'); 27 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END', ']]>'); 28 define('LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END', 29 LOG4PHP_LOGGER_TRANSFORM_CDATA_END . 30 LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END . 31 LOG4PHP_LOGGER_TRANSFORM_CDATA_START 32 ); 33 34 /** 35 * Utility class for transforming strings. 36 * 37 * @log4j-class org.apache.log4j.helpers.Transform 38 * 39 * @author VxR <vxr@vxr.it> 40 * @package log4php 41 * @subpackage helpers 42 * @since 0.7 43 */ 44 class LoggerTransform { 45 46 /** 47 * This method takes a string which may contain HTML tags (ie, 48 * <b>, <table>, etc) and replaces any '<' and '>' 49 * characters with respective predefined entity references. 50 * 51 * @param string $input The text to be converted. 52 * @return string The input string with the characters '<' and '>' replaced with 53 * &lt; and &gt; respectively. 54 * @static 55 */ 56 function escapeTags($input) 57 { 58 //Check if the string is null or zero length -- if so, return 59 //what was sent in. 60 61 if(empty($input)) 62 return $input; 63 64 //Use a StringBuffer in lieu of String concatenation -- it is 65 //much more efficient this way. 66 67 return htmlspecialchars($input, ENT_NOQUOTES); 68 } 69 70 /** 71 * Ensures that embeded CDEnd strings (]]>) are handled properly 72 * within message, NDC and throwable tag text. 73 * 74 * @param string $buf String holding the XML data to this point. The 75 * initial CDStart (<![CDATA[) and final CDEnd (]]>) 76 * of the CDATA section are the responsibility of 77 * the calling method. 78 * @param string &str The String that is inserted into an existing 79 * CDATA Section within buf. 80 * @static 81 */ 82 function appendEscapingCDATA(&$buf, $str) 83 { 84 if(empty($str)) 85 return; 86 87 $rStr = str_replace( 88 LOG4PHP_LOGGER_TRANSFORM_CDATA_END, 89 LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END, 90 $str 91 ); 92 $buf .= $rStr; 93 } 94 } 95 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |