3 * log4php is a PHP port of the log4j java logging package.
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>
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>
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>
23 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
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
35 * Utility class for transforming strings.
37 * @log4j-class org.apache.log4j.helpers.Transform
39 * @author VxR <vxr@vxr.it>
44 class LoggerTransform {
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.
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.
56 function escapeTags($input)
58 //Check if the string is null or zero length -- if so, return
64 //Use a StringBuffer in lieu of String concatenation -- it is
65 //much more efficient this way.
67 return htmlspecialchars($input, ENT_NOQUOTES);
71 * Ensures that embeded CDEnd strings (]]>) are handled properly
72 * within message, NDC and throwable tag text.
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
78 * @param string &str The String that is inserted into an existing
79 * CDATA Section within buf.
82 function appendEscapingCDATA(&$buf, $str)
88 LOG4PHP_LOGGER_TRANSFORM_CDATA_END,
89 LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END,