Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/Zend/Log/Formatter/Xml.php')
-rw-r--r--libs/Zend/Log/Formatter/Xml.php47
1 files changed, 39 insertions, 8 deletions
diff --git a/libs/Zend/Log/Formatter/Xml.php b/libs/Zend/Log/Formatter/Xml.php
index ce0edb1301..ebf3c29e97 100644
--- a/libs/Zend/Log/Formatter/Xml.php
+++ b/libs/Zend/Log/Formatter/Xml.php
@@ -15,21 +15,21 @@
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Xml.php 20104 2010-01-06 21:26:01Z matthew $
*/
/** Zend_Log_Formatter_Interface */
-require_once 'Zend/Log/Formatter/Interface.php';
+// require_once 'Zend/Log/Formatter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
- * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xml.php 16219 2009-06-21 19:45:39Z thomas $
+ * @version $Id: Xml.php 20104 2010-01-06 21:26:01Z matthew $
*/
class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
{
@@ -44,14 +44,44 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
protected $_elementMap;
/**
+ * @var string Encoding to use in XML
+ */
+ protected $_encoding;
+
+ /**
* Class constructor
*
+ * @param string $rootElement Name of root element
* @param array $elementMap
+ * @param string $encoding Encoding to use (defaults to UTF-8)
*/
- public function __construct($rootElement = 'logEntry', $elementMap = null)
+ public function __construct($rootElement = 'logEntry', $elementMap = null, $encoding = 'UTF-8')
{
$this->_rootElement = $rootElement;
$this->_elementMap = $elementMap;
+ $this->setEncoding($encoding);
+ }
+
+ /**
+ * Get encoding
+ *
+ * @return string
+ */
+ public function getEncoding()
+ {
+ return $this->_encoding;
+ }
+
+ /**
+ * Set encoding
+ *
+ * @param string $value
+ * @return Zend_Log_Formatter_Xml
+ */
+ public function setEncoding($value)
+ {
+ $this->_encoding = (string) $value;
+ return $this;
}
/**
@@ -71,12 +101,13 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
}
}
- $dom = new DOMDocument();
+ $enc = $this->getEncoding();
+ $dom = new DOMDocument('1.0', $enc);
$elt = $dom->appendChild(new DOMElement($this->_rootElement));
foreach ($dataToInsert as $key => $value) {
if($key == "message") {
- $value = htmlspecialchars($value);
+ $value = htmlspecialchars($value, ENT_COMPAT, $enc);
}
$elt->appendChild(new DOMElement($key, $value));
}