diff options
author | robocoder <anthon.pang@gmail.com> | 2011-02-01 21:34:57 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2011-02-01 21:34:57 +0300 |
commit | ba5a93db097fc6481b9075927612f6f6cab6a9c3 (patch) | |
tree | f5422bbbc407031fd9feef83cdac2946db5035db /libs/Zend | |
parent | 92f40ce16ce607291eb40193fe66c1b0f0606891 (diff) |
fixes #1765
git-svn-id: http://dev.piwik.org/svn/trunk@3831 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend')
32 files changed, 271 insertions, 104 deletions
diff --git a/libs/Zend/Cache/Backend.php b/libs/Zend/Cache/Backend.php index 3e94ab3d8c..fa5ab88d48 100644 --- a/libs/Zend/Cache/Backend.php +++ b/libs/Zend/Cache/Backend.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Backend * @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: Backend.php 20880 2010-02-03 18:18:32Z matthew $ + * @version $Id: Backend.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -200,7 +200,7 @@ class Zend_Cache_Backend /** * Verify if the given temporary directory is readable and writable * - * @param $dir temporary directory + * @param string $dir temporary directory * @return boolean true if the directory is ok */ protected function _isGoodTmpDir($dir) diff --git a/libs/Zend/Cache/Backend/Static.php b/libs/Zend/Cache/Backend/Static.php index 0c6f02fc9c..09499b033d 100644 --- a/libs/Zend/Cache/Backend/Static.php +++ b/libs/Zend/Cache/Backend/Static.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Backend * @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: Static.php 22950 2010-09-16 19:33:00Z mabe $ + * @version $Id: Static.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ /** @@ -343,14 +343,16 @@ class Zend_Cache_Backend_Static if (!is_writable($directory)) { return false; } - foreach (new DirectoryIterator($directory) as $file) { - if (true === $file->isFile()) { - if (false === unlink($file->getPathName())) { - return false; + if (is_dir($directory)) { + foreach (new DirectoryIterator($directory) as $file) { + if (true === $file->isFile()) { + if (false === unlink($file->getPathName())) { + return false; + } } } } - rmdir(dirname($path)); + rmdir($directory); } if (file_exists($file)) { if (!is_writable($file)) { @@ -538,7 +540,7 @@ class Zend_Cache_Backend_Static * Detect an octal string and return its octal value for file permission ops * otherwise return the non-string (assumed octal or decimal int already) * - * @param $val The potential octal in need of conversion + * @param string $val The potential octal in need of conversion * @return int */ protected function _octdec($val) @@ -551,9 +553,12 @@ class Zend_Cache_Backend_Static /** * Decode a request URI from the provided ID + * + * @param string $id + * @return string */ protected function _decodeId($id) { - return pack('H*', $id);; + return pack('H*', $id); } } diff --git a/libs/Zend/Cache/Backend/Test.php b/libs/Zend/Cache/Backend/Test.php index 19bf93b080..57e2c8432a 100644 --- a/libs/Zend/Cache/Backend/Test.php +++ b/libs/Zend/Cache/Backend/Test.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Backend * @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: Test.php 23051 2010-10-07 17:01:21Z mabe $ + * @version $Id: Test.php 23671 2011-01-23 19:11:46Z mabe $ */ @@ -164,7 +164,7 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B public function save($data, $id, $tags = array(), $specificLifetime = false) { $this->_addLog('save', array($data, $id, $tags)); - if ($id=='false') { + if (substr($id,-5)=='false') { return false; } return true; @@ -182,7 +182,7 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B public function remove($id) { $this->_addLog('remove', array($id)); - if ($id=='false') { + if (substr($id,-5)=='false') { return false; } return true; diff --git a/libs/Zend/Cache/Core.php b/libs/Zend/Cache/Core.php index 5c2b905622..ad7b87caec 100644 --- a/libs/Zend/Cache/Core.php +++ b/libs/Zend/Cache/Core.php @@ -16,7 +16,7 @@ * @package Zend_Cache * @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: Core.php 22651 2010-07-21 04:19:44Z ramon $ + * @version $Id: Core.php 23671 2011-01-23 19:11:46Z mabe $ */ @@ -397,7 +397,7 @@ class Zend_Cache_Core if ($this->_options['logging']) { $this->_log("Zend_Cache_Core::save() : impossible to save cache (id=$id)"); } - $this->remove($id); + $this->_backend->remove($id); return false; } if ($this->_options['write_control']) { diff --git a/libs/Zend/Cache/Frontend/Function.php b/libs/Zend/Cache/Frontend/Function.php index 88617748cb..3efb1f4c49 100644 --- a/libs/Zend/Cache/Frontend/Function.php +++ b/libs/Zend/Cache/Frontend/Function.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Frontend * @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: Function.php 22648 2010-07-20 14:43:27Z mabe $ + * @version $Id: Function.php 23591 2010-12-29 21:39:21Z mabe $ */ @@ -104,8 +104,7 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core ob_start(); ob_implicit_flush(false); $return = call_user_func_array($callback, $parameters); - $output = ob_get_contents(); - ob_end_clean(); + $output = ob_get_clean(); $data = array($output, $return); $this->save($data, $id, $tags, $specificLifetime, $priority); } diff --git a/libs/Zend/Cache/Frontend/Output.php b/libs/Zend/Cache/Frontend/Output.php index 1757381ce4..53e255b999 100644 --- a/libs/Zend/Cache/Frontend/Output.php +++ b/libs/Zend/Cache/Frontend/Output.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Frontend * @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: Output.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Output.php 23591 2010-12-29 21:39:21Z mabe $ */ @@ -88,8 +88,7 @@ class Zend_Cache_Frontend_Output extends Zend_Cache_Core public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8) { if ($forcedDatas === null) { - $data = ob_get_contents(); - ob_end_clean(); + $data = ob_get_clean(); } else { $data =& $forcedDatas; } diff --git a/libs/Zend/Cache/Frontend/Page.php b/libs/Zend/Cache/Frontend/Page.php index 21ce6537a7..ec60ef70a8 100644 --- a/libs/Zend/Cache/Frontend/Page.php +++ b/libs/Zend/Cache/Frontend/Page.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Frontend * @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: Page.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Page.php 23654 2011-01-22 13:43:51Z ramon $ */ @@ -243,9 +243,11 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core { $this->_cancel = false; $lastMatchingRegexp = null; - foreach ($this->_specificOptions['regexps'] as $regexp => $conf) { - if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) { - $lastMatchingRegexp = $regexp; + if (isset($_SERVER['REQUEST_URI'])) { + foreach ($this->_specificOptions['regexps'] as $regexp => $conf) { + if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) { + $lastMatchingRegexp = $regexp; + } } } $this->_activeOptions = $this->_specificOptions['default_options']; diff --git a/libs/Zend/Config/Writer/Yaml.php b/libs/Zend/Config/Writer/Yaml.php index 2cacd35100..c97b07b5ef 100755 --- a/libs/Zend/Config/Writer/Yaml.php +++ b/libs/Zend/Config/Writer/Yaml.php @@ -16,7 +16,7 @@ * @package Zend_Config * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Yaml.php 23294 2010-11-05 00:27:34Z ramon $ + * @version $Id: Yaml.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ /** @@ -57,7 +57,7 @@ class Zend_Config_Writer_Yaml extends Zend_Config_Writer_FileAbstract /** * Set callback for decoding YAML * - * @param $yamlEncoder the decoder to set + * @param callable $yamlEncoder the decoder to set * @return Zend_Config_Yaml */ public function setYamlEncoder($yamlEncoder) diff --git a/libs/Zend/Config/Yaml.php b/libs/Zend/Config/Yaml.php index 7e930564b2..1e59f4d67c 100755 --- a/libs/Zend/Config/Yaml.php +++ b/libs/Zend/Config/Yaml.php @@ -16,7 +16,7 @@ * @package Zend_Config * @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: Yaml.php 23294 2010-11-05 00:27:34Z ramon $ + * @version $Id: Yaml.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ /** @@ -93,7 +93,7 @@ class Zend_Config_Yaml extends Zend_Config /** * Set callback for decoding YAML * - * @param $yamlDecoder the decoder to set + * @param callable $yamlDecoder the decoder to set * @return Zend_Config_Yaml */ public function setYamlDecoder($yamlDecoder) diff --git a/libs/Zend/Db/Adapter/Sqlsrv.php b/libs/Zend/Db/Adapter/Sqlsrv.php index b86bf54640..006cc7979a 100644 --- a/libs/Zend/Db/Adapter/Sqlsrv.php +++ b/libs/Zend/Db/Adapter/Sqlsrv.php @@ -17,7 +17,7 @@ * @subpackage Adapter * @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: Sqlsrv.php 23584 2010-12-28 19:51:49Z matthew $ + * @version $Id: Sqlsrv.php 23588 2010-12-28 23:06:39Z matthew $ */ /** diff --git a/libs/Zend/Db/Table/Abstract.php b/libs/Zend/Db/Table/Abstract.php index 435d198ecc..c1e54ad230 100644 --- a/libs/Zend/Db/Table/Abstract.php +++ b/libs/Zend/Db/Table/Abstract.php @@ -17,7 +17,7 @@ * @subpackage Table * @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: Abstract.php 23578 2010-12-24 16:31:45Z ramon $ + * @version $Id: Abstract.php 23657 2011-01-22 16:01:47Z ralph $ */ /** @@ -1046,14 +1046,24 @@ abstract class Zend_Db_Table_Abstract */ if (is_string($this->_sequence) && !isset($data[$pkIdentity])) { $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence); + $pkSuppliedBySequence = true; } /** * If the primary key can be generated automatically, and no value was * specified in the user-supplied data, then omit it from the tuple. + * + * Note: this checks for sensible values in the supplied primary key + * position of the data. The following values are considered empty: + * null, false, true, '', array() */ - if (array_key_exists($pkIdentity, $data) && $data[$pkIdentity] === null) { - unset($data[$pkIdentity]); + if (!isset($pkSuppliedBySequence) && array_key_exists($pkIdentity, $data)) { + if ($data[$pkIdentity] === null // null + || $data[$pkIdentity] === '' // empty string + || is_bool($data[$pkIdentity]) // boolean + || (is_array($data[$pkIdentity]) && empty($data[$pkIdentity]))) { // empty array + unset($data[$pkIdentity]); + } } /** diff --git a/libs/Zend/Feed/Writer/Feed.php b/libs/Zend/Feed/Writer/Feed.php index 5e23a619a5..3c66c3241d 100644 --- a/libs/Zend/Feed/Writer/Feed.php +++ b/libs/Zend/Feed/Writer/Feed.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @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: Feed.php 23486 2010-12-10 04:05:30Z mjh_ca $ + * @version $Id: Feed.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ /** @@ -258,7 +258,8 @@ implements Iterator, Countable /** * Attempt to build and return the feed resulting from the data set * - * @param $type The feed type "rss" or "atom" to export as + * @param string $type The feed type "rss" or "atom" to export as + * @param bool $ignoreExceptions * @return string */ public function export($type, $ignoreExceptions = false) diff --git a/libs/Zend/Http/Response/Stream.php b/libs/Zend/Http/Response/Stream.php index 288b65752f..4b8178d28e 100644 --- a/libs/Zend/Http/Response/Stream.php +++ b/libs/Zend/Http/Response/Stream.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Http * @subpackage Response - * @version $Id: Stream.php 20785 2010-01-31 09:43:03Z mikaelkael $ + * @version $Id: Stream.php 23651 2011-01-21 21:51:00Z mikaelkael $ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -90,7 +90,7 @@ class Zend_Http_Response_Stream extends Zend_Http_Response /** * Set the cleanup trigger * - * @param $cleanup Set cleanup trigger + * @param bool $cleanup Set cleanup trigger */ public function setCleanup($cleanup = true) { $this->_cleanup = $cleanup; diff --git a/libs/Zend/Http/UserAgent.php b/libs/Zend/Http/UserAgent.php index 6588d75d90..d155870556 100644 --- a/libs/Zend/Http/UserAgent.php +++ b/libs/Zend/Http/UserAgent.php @@ -171,11 +171,12 @@ class Zend_Http_UserAgent implements Serializable */ public function serialize() { + $device = $this->getDevice(); $spec = array( 'browser_type' => $this->_browserType, 'config' => $this->_config, - 'device_class' => get_class($this->_device), - 'device' => $this->_device->serialize(), + 'device_class' => get_class($device), + 'device' => $device->serialize(), 'user_agent' => $this->getServerValue('http_user_agent'), 'http_accept' => $this->getServerValue('http_accept'), ); diff --git a/libs/Zend/Log.php b/libs/Zend/Log.php index b422e351a4..474f668d28 100644 --- a/libs/Zend/Log.php +++ b/libs/Zend/Log.php @@ -16,7 +16,7 @@ * @package Zend_Log * @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: Log.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Log.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ /** @@ -24,7 +24,7 @@ * @package Zend_Log * @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: Log.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Log.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ class Zend_Log { @@ -72,6 +72,12 @@ class Zend_Log /** * + * @var string + */ + protected $_defaultFormatterNamespace = 'Zend_Log_Formatter'; + + /** + * * @var callback */ protected $_origErrorHandler = null; @@ -169,6 +175,11 @@ class Zend_Log $writer->addFilter($filter); } + if (isset($config['formatterName'])) { + $formatter = $this->_constructFormatterFromConfig($config); + $writer->setFormatter($formatter); + } + return $writer; } @@ -195,6 +206,29 @@ class Zend_Log return $filter; } + /** + * Construct formatter object from configuration array or Zend_Config object + * + * @param array|Zend_Config $config Zend_Config or Array + * @return Zend_Log_Formatter_Interface + * @throws Zend_Log_Exception + */ + protected function _constructFormatterFromConfig($config) + { + $formatter = $this->_constructFromConfig('formatter', $config, $this->_defaultFormatterNamespace); + + if (!$formatter instanceof Zend_Log_Formatter_Interface) { + $formatterName = is_object($formatter) + ? get_class($formatter) + : 'The specified formatter'; + /** @see Zend_Log_Exception */ + // require_once 'Zend/Log/Exception.php'; + throw new Zend_Log_Exception($formatterName . ' does not implement Zend_Log_Formatter_Interface'); + } + + return $formatter; + } + /** * Construct a filter or writer from config * @@ -228,7 +262,7 @@ class Zend_Log if (!$reflection->implementsInterface('Zend_Log_FactoryInterface')) { // require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception( - 'Driver does not implement Zend_Log_FactoryInterface and can not be constructed from config.' + $className . ' does not implement Zend_Log_FactoryInterface and can not be constructed from config.' ); } @@ -469,8 +503,8 @@ class Zend_Log /** * Set an extra item to pass to the log writers. * - * @param $name Name of the field - * @param $value Value of the field + * @param string $name Name of the field + * @param string $value Value of the field * @return Zend_Log */ public function setEventItem($name, $value) diff --git a/libs/Zend/Log/FactoryInterface.php b/libs/Zend/Log/FactoryInterface.php index ea988826c2..fa951b1d4e 100644 --- a/libs/Zend/Log/FactoryInterface.php +++ b/libs/Zend/Log/FactoryInterface.php @@ -16,7 +16,7 @@ * @package Zend_Log * @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: FactoryInterface.php 23484 2010-12-10 03:57:59Z mjh_ca $ + * @version $Id: FactoryInterface.php 23647 2011-01-21 18:54:14Z intiilapa $ */ /** @@ -24,15 +24,15 @@ * @package Zend_Log * @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: FactoryInterface.php 23484 2010-12-10 03:57:59Z mjh_ca $ + * @version $Id: FactoryInterface.php 23647 2011-01-21 18:54:14Z intiilapa $ */ interface Zend_Log_FactoryInterface { /** * Construct a Zend_Log driver * - * @param array|Zen_Config $config + * @param array|Zend_Config $config * @return Zend_Log_FactoryInterface */ static public function factory($config); -} +}
\ No newline at end of file diff --git a/libs/Zend/Log/Formatter/Abstract.php b/libs/Zend/Log/Formatter/Abstract.php new file mode 100644 index 0000000000..deaca3ce12 --- /dev/null +++ b/libs/Zend/Log/Formatter/Abstract.php @@ -0,0 +1,40 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Log + * @subpackage Formatter + * @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: Abstract.php 23648 2011-01-21 19:04:20Z intiilapa $ + */ + +/** @see Zend_Log_Formatter_Interface */ +// require_once 'Zend/Log/Formatter/Interface.php'; + +/** @see Zend_Log_FactoryInterface */ +// require_once 'Zend/Log/FactoryInterface.php'; + +/** + * @category Zend + * @package Zend_Log + * @subpackage Formatter + * @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: Abstract.php 23648 2011-01-21 19:04:20Z intiilapa $ + */ +abstract class Zend_Log_Formatter_Abstract + implements Zend_Log_Formatter_Interface, Zend_Log_FactoryInterface +{ +}
\ No newline at end of file diff --git a/libs/Zend/Log/Formatter/Firebug.php b/libs/Zend/Log/Formatter/Firebug.php index a0238935ec..794f6f3c66 100644 --- a/libs/Zend/Log/Formatter/Firebug.php +++ b/libs/Zend/Log/Formatter/Firebug.php @@ -17,11 +17,11 @@ * @subpackage Formatter * @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: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Firebug.php 23648 2011-01-21 19:04:20Z intiilapa $ */ -/** Zend_Log_Formatter_Interface */ -// require_once 'Zend/Log/Formatter/Interface.php'; +/** Zend_Log_Formatter_Abstract */ +// require_once 'Zend/Log/Formatter/Abstract.php'; /** * @category Zend @@ -30,9 +30,20 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Log_Formatter_Firebug implements Zend_Log_Formatter_Interface +class Zend_Log_Formatter_Firebug extends Zend_Log_Formatter_Abstract { /** + * Factory for Zend_Log_Formatter_Firebug classe + * + * @param array|Zend_Config $options useless + * @return Zend_Log_Formatter_Firebug + */ + public static function factory($options) + { + return new self; + } + + /** * This method formats the event for the firebug writer. * * The default is to just send the message parameter, but through @@ -47,4 +58,4 @@ class Zend_Log_Formatter_Firebug implements Zend_Log_Formatter_Interface { return $event['message']; } -} +}
\ No newline at end of file diff --git a/libs/Zend/Log/Formatter/Simple.php b/libs/Zend/Log/Formatter/Simple.php index 3e8aa5f208..207bcda1f7 100644 --- a/libs/Zend/Log/Formatter/Simple.php +++ b/libs/Zend/Log/Formatter/Simple.php @@ -17,11 +17,11 @@ * @subpackage Formatter * @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: Simple.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Simple.php 23648 2011-01-21 19:04:20Z intiilapa $ */ -/** Zend_Log_Formatter_Interface */ -// require_once 'Zend/Log/Formatter/Interface.php'; +/** Zend_Log_Formatter_Abstract */ +// require_once 'Zend/Log/Formatter/Abstract.php'; /** * @category Zend @@ -29,9 +29,9 @@ * @subpackage Formatter * @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: Simple.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Simple.php 23648 2011-01-21 19:04:20Z intiilapa $ */ -class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface +class Zend_Log_Formatter_Simple extends Zend_Log_Formatter_Abstract { /** * @var string @@ -53,7 +53,7 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface $format = self::DEFAULT_FORMAT . PHP_EOL; } - if (! is_string($format)) { + if (!is_string($format)) { // require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Format must be a string'); } @@ -62,6 +62,28 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface } /** + * Factory for Zend_Log_Formatter_Simple classe + * + * @param array|Zend_Config $options + * @return Zend_Log_Formatter_Simple + */ + public static function factory($options) + { + $format = null; + if (null !== $options) { + if ($options instanceof Zend_Config) { + $options = $options->toArray(); + } + + if (array_key_exists('format', $options)) { + $format = $options['format']; + } + } + + return new self($format); + } + + /** * Formats data into a single line to be written by the writer. * * @param array $event event data @@ -70,17 +92,17 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface public function format($event) { $output = $this->_format; - foreach ($event as $name => $value) { + foreach ($event as $name => $value) { if ((is_object($value) && !method_exists($value,'__toString')) - || is_array($value)) { - + || is_array($value) + ) { $value = gettype($value); } $output = str_replace("%$name%", $value, $output); } + return $output; } - -} +}
\ No newline at end of file diff --git a/libs/Zend/Log/Formatter/Xml.php b/libs/Zend/Log/Formatter/Xml.php index 8940473f09..5a3e4fbdad 100644 --- a/libs/Zend/Log/Formatter/Xml.php +++ b/libs/Zend/Log/Formatter/Xml.php @@ -17,11 +17,11 @@ * @subpackage Formatter * @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 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Xml.php 23648 2011-01-21 19:04:20Z intiilapa $ */ -/** Zend_Log_Formatter_Interface */ -// require_once 'Zend/Log/Formatter/Interface.php'; +/** Zend_Log_Formatter_Abstract */ +// require_once 'Zend/Log/Formatter/Abstract.php'; /** * @category Zend @@ -29,9 +29,9 @@ * @subpackage Formatter * @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 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Xml.php 23648 2011-01-21 19:04:20Z intiilapa $ */ -class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface +class Zend_Log_Formatter_Xml extends Zend_Log_Formatter_Abstract { /** * @var string Name of root element @@ -50,17 +50,56 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface /** * Class constructor + * (the default encoding is UTF-8) * - * @param string $rootElement Name of root element - * @param array $elementMap Relates XML elements to log data field keys - * @param string $encoding Encoding to use (defaults to UTF-8) + * @param array|Zend_Config $options * @return void */ - public function __construct($rootElement = 'logEntry', $elementMap = null, $encoding = 'UTF-8') + public function __construct($options = array()) { - $this->_rootElement = $rootElement; - $this->_elementMap = $elementMap; - $this->setEncoding($encoding); + if ($options instanceof Zend_Config) { + $options = $options->toArray(); + } elseif (!is_array($options)) { + $args = func_get_args(); + + $options = array( + 'rootElement' => array_shift($args) + ); + + if (count($args)) { + $options['elementMap'] = array_shift($args); + } + + if (count($args)) { + $options['encoding'] = array_shift($args); + } + } + + if (!array_key_exists('rootElement', $options)) { + $options['rootElement'] = 'logEntry'; + } + + if (!array_key_exists('encoding', $options)) { + $options['encoding'] = 'UTF-8'; + } + + $this->_rootElement = $options['rootElement']; + $this->setEncoding($options['encoding']); + + if (array_key_exists('elementMap', $options)) { + $this->_elementMap = $options['elementMap']; + } + } + + /** + * Factory for Zend_Log_Formatter_Xml classe + * + * @param array|Zend_Config $options + * @return Zend_Log_Formatter_Xml + */ + public static function factory($options) + { + return new self($options); } /** @@ -118,5 +157,4 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface return $xml . PHP_EOL; } - -} +}
\ No newline at end of file diff --git a/libs/Zend/Log/Writer/Db.php b/libs/Zend/Log/Writer/Db.php index 47217052d6..3d6fa8c45e 100644 --- a/libs/Zend/Log/Writer/Db.php +++ b/libs/Zend/Log/Writer/Db.php @@ -17,7 +17,7 @@ * @subpackage Writer * @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: Db.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Db.php 23601 2011-01-01 15:43:07Z ramon $ */ /** Zend_Log_Writer_Abstract */ @@ -29,7 +29,7 @@ * @subpackage Writer * @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: Db.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Db.php 23601 2011-01-01 15:43:07Z ramon $ */ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract { @@ -74,7 +74,6 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract * * @param array|Zend_Config $config * @return Zend_Log_Writer_Db - * @throws Zend_Log_Exception */ static public function factory($config) { @@ -123,6 +122,7 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract * * @param array $event event data * @return void + * @throws Zend_Log_Exception */ protected function _write($event) { diff --git a/libs/Zend/Log/Writer/Stream.php b/libs/Zend/Log/Writer/Stream.php index 25d6d75892..e07b278b28 100644 --- a/libs/Zend/Log/Writer/Stream.php +++ b/libs/Zend/Log/Writer/Stream.php @@ -17,7 +17,7 @@ * @subpackage Writer * @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: Stream.php 23584 2010-12-28 19:51:49Z matthew $ + * @version $Id: Stream.php 23588 2010-12-28 23:06:39Z matthew $ */ /** Zend_Log_Writer_Abstract */ @@ -32,7 +32,7 @@ * @subpackage Writer * @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: Stream.php 23584 2010-12-28 19:51:49Z matthew $ + * @version $Id: Stream.php 23588 2010-12-28 23:06:39Z matthew $ */ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract { diff --git a/libs/Zend/Log/Writer/Syslog.php b/libs/Zend/Log/Writer/Syslog.php index 0ac5a5690a..3e80bb153d 100644 --- a/libs/Zend/Log/Writer/Syslog.php +++ b/libs/Zend/Log/Writer/Syslog.php @@ -17,7 +17,7 @@ * @subpackage Writer * @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: Syslog.php 23576 2010-12-23 23:25:44Z ramon $ + * @version $Id: Syslog.php 23595 2010-12-30 10:09:31Z intiilapa $ */ /** Zend_Log */ @@ -257,6 +257,11 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract $this->_initializeSyslog(); } - syslog($priority, $event['message']); + $message = $event['message']; + if ($this->_formatter instanceof Zend_Log_Formatter_Interface) { + $message = $this->_formatter->format($event); + } + + syslog($priority, $message); } -} +}
\ No newline at end of file diff --git a/libs/Zend/Mail/Storage/Abstract.php b/libs/Zend/Mail/Storage/Abstract.php index 0d5f1ed1e7..7ec32cf67b 100644 --- a/libs/Zend/Mail/Storage/Abstract.php +++ b/libs/Zend/Mail/Storage/Abstract.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -119,7 +119,7 @@ abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, See /** * Get a message with headers and body * - * @param $id int number of message + * @param int $id number of message * @return Zend_Mail_Message */ abstract public function getMessage($id); diff --git a/libs/Zend/Mail/Storage/Folder/Maildir.php b/libs/Zend/Mail/Storage/Folder/Maildir.php index 228465a9e3..bd4f48bd19 100644 --- a/libs/Zend/Mail/Storage/Folder/Maildir.php +++ b/libs/Zend/Mail/Storage/Folder/Maildir.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Maildir.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Maildir.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -77,7 +77,7 @@ class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir impleme * - delim delim char for folder structur, default is '.' * - folder intial selected folder, default is 'INBOX' * - * @param $params array mail reader specific parameters + * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception */ public function __construct($params) diff --git a/libs/Zend/Mail/Storage/Folder/Mbox.php b/libs/Zend/Mail/Storage/Folder/Mbox.php index fc1d50b2a0..c00fa06e06 100644 --- a/libs/Zend/Mail/Storage/Folder/Mbox.php +++ b/libs/Zend/Mail/Storage/Folder/Mbox.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Mbox.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Mbox.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -73,7 +73,7 @@ class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Ze * - dirname rootdir of mbox structure * - folder intial selected folder, default is 'INBOX' * - * @param $params array mail reader specific parameters + * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception */ public function __construct($params) diff --git a/libs/Zend/Mail/Storage/Maildir.php b/libs/Zend/Mail/Storage/Maildir.php index 736b70cc66..2c94a01f50 100644 --- a/libs/Zend/Mail/Storage/Maildir.php +++ b/libs/Zend/Mail/Storage/Maildir.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Maildir.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Maildir.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -257,7 +257,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract * Supported parameters are: * - dirname dirname of mbox file * - * @param $params array mail reader specific parameters + * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception */ public function __construct($params) diff --git a/libs/Zend/Mail/Storage/Mbox.php b/libs/Zend/Mail/Storage/Mbox.php index 97bc56e394..c3f2ad3f46 100644 --- a/libs/Zend/Mail/Storage/Mbox.php +++ b/libs/Zend/Mail/Storage/Mbox.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Mbox.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Mbox.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -216,7 +216,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract * Supported parameters are: * - filename filename of mbox file * - * @param $params array mail reader specific parameters + * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception */ public function __construct($params) diff --git a/libs/Zend/Mail/Storage/Pop3.php b/libs/Zend/Mail/Storage/Pop3.php index 0841c3c352..de9595296e 100644 --- a/libs/Zend/Mail/Storage/Pop3.php +++ b/libs/Zend/Mail/Storage/Pop3.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Pop3.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Pop3.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -154,7 +154,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract * - port port for POP3 server [optional, default = 110] * - ssl 'SSL' or 'TLS' for secure sockets * - * @param $params array mail reader specific parameters + * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception * @throws Zend_Mail_Protocol_Exception */ diff --git a/libs/Zend/Mail/Storage/Writable/Maildir.php b/libs/Zend/Mail/Storage/Writable/Maildir.php index 3519a4b411..f3ccb14147 100644 --- a/libs/Zend/Mail/Storage/Writable/Maildir.php +++ b/libs/Zend/Mail/Storage/Writable/Maildir.php @@ -17,7 +17,7 @@ * @subpackage Storage * @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: Maildir.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Maildir.php 23651 2011-01-21 21:51:00Z mikaelkael $ */ @@ -105,7 +105,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai * Additional parameters are (see parent for more): * - create if true a new maildir is create if none exists * - * @param $params array mail reader specific parameters + * @param array $params mail reader specific parameters * @throws Zend_Mail_Storage_Exception */ public function __construct($params) { diff --git a/libs/Zend/Session.php b/libs/Zend/Session.php index bdebd57a69..946db59ef8 100644 --- a/libs/Zend/Session.php +++ b/libs/Zend/Session.php @@ -17,7 +17,7 @@ * @package Zend_Session * @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: Session.php 23484 2010-12-10 03:57:59Z mjh_ca $ + * @version $Id: Session.php 23651 2011-01-21 21:51:00Z mikaelkael $ * @since Preview Release 0.2 */ @@ -335,7 +335,7 @@ class Zend_Session extends Zend_Session_Abstract * seconds is specified, then this defaults to self::$_rememberMeSeconds. Due to clock errors on end users' systems, * large values are recommended to avoid undesirable expiration of session cookies. * - * @param $seconds integer - OPTIONAL specifies TTL for cookie in seconds from present time + * @param int $seconds OPTIONAL specifies TTL for cookie in seconds from present time * @return void */ public static function rememberMe($seconds = null) diff --git a/libs/Zend/Version.php b/libs/Zend/Version.php index 6674ab2fde..1162c41211 100644 --- a/libs/Zend/Version.php +++ b/libs/Zend/Version.php @@ -16,7 +16,7 @@ * @package Zend_Version * @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: Version.php 23585 2010-12-28 19:52:52Z matthew $ + * @version $Id: Version.php 23684 2011-01-31 16:41:13Z matthew $ */ /** @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.11.2'; + const VERSION = '1.11.3'; /** * The latest stable version Zend Framework available |