Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit: hello skeleton

  • Loading branch information...
commit 1ca4640e653f370d5c4c733c8f4e750f4844780e 1 parent 22afe2d
@mbontemps mbontemps authored
Showing with 3,019 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +3 −0  .gitmodules
  3. +13 −0 src/Application/FrontBundle/Controller/DefaultController.php
  4. +10 −0 src/Application/FrontBundle/FrontBundle.php
  5. +7 −0 src/Application/FrontBundle/Resources/config/routing.xml
  6. +1 −0  src/Application/FrontBundle/Resources/views/Default/index.php
  7. +23 −0 src/autoload.php
  8. +1 −0  src/vendor/symfony
  9. +27 −0 src/vendor/zend/LICENSE.txt
  10. +36 −0 src/vendor/zend/library/Zend/Exception.php
  11. +36 −0 src/vendor/zend/library/Zend/Log/Exception.php
  12. +43 −0 src/vendor/zend/library/Zend/Log/Factory.php
  13. +45 −0 src/vendor/zend/library/Zend/Log/Filter.php
  14. +63 −0 src/vendor/zend/library/Zend/Log/Filter/AbstractFilter.php
  15. +88 −0 src/vendor/zend/library/Zend/Log/Filter/Message.php
  16. +104 −0 src/vendor/zend/library/Zend/Log/Filter/Priority.php
  17. +80 −0 src/vendor/zend/library/Zend/Log/Filter/SuppressFilter.php
  18. +45 −0 src/vendor/zend/library/Zend/Log/Formatter.php
  19. +54 −0 src/vendor/zend/library/Zend/Log/Formatter/Firebug.php
  20. +88 −0 src/vendor/zend/library/Zend/Log/Formatter/Simple.php
  21. +127 −0 src/vendor/zend/library/Zend/Log/Formatter/Xml.php
  22. +516 −0 src/vendor/zend/library/Zend/Log/Logger.php
  23. +71 −0 src/vendor/zend/library/Zend/Log/Writer.php
  24. +136 −0 src/vendor/zend/library/Zend/Log/Writer/AbstractWriter.php
  25. +142 −0 src/vendor/zend/library/Zend/Log/Writer/Db.php
  26. +199 −0 src/vendor/zend/library/Zend/Log/Writer/Firebug.php
  27. +307 −0 src/vendor/zend/library/Zend/Log/Writer/Mail.php
  28. +81 −0 src/vendor/zend/library/Zend/Log/Writer/Mock.php
  29. +60 −0 src/vendor/zend/library/Zend/Log/Writer/Null.php
  30. +134 −0 src/vendor/zend/library/Zend/Log/Writer/Stream.php
  31. +192 −0 src/vendor/zend/library/Zend/Log/Writer/Syslog.php
  32. +114 −0 src/vendor/zend/library/Zend/Log/Writer/ZendMonitor.php
  33. +59 −0 symfony2bundles/FrontKernel.php
  34. +24 −0 symfony2bundles/config/config.yml
  35. +9 −0 symfony2bundles/config/config_dev.yml
  36. +2 −0  symfony2bundles/config/config_prod.yml
  37. +10 −0 symfony2bundles/config/config_test.yml
  38. +3 −0  symfony2bundles/config/routing.yml
  39. +11 −0 symfony2bundles/console
  40. +29 −0 symfony2bundles/phpunit.xml
  41. +6 −0 web/index.php
  42. +12 −0 web/index_dev.php
View
8 .gitignore
@@ -0,0 +1,8 @@
+/symfony2bundles/config/config*_local.yml
+/symfony2bundles/cache/*
+/symfony2bundles/logs/*
+/nbproject
+.DS_Store
+catalog.xml
+*.swp
+/web/.htaccess
View
3  .gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/vendor/symfony"]
+ path = src/vendor/symfony
+ url = http://github.com/fabpot/symfony.git
View
13 src/Application/FrontBundle/Controller/DefaultController.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Application\FrontBundle\Controller;
+
+use Symfony\Framework\FoundationBundle\Controller;
+
+class DefaultController extends Controller
+{
+ public function indexAction()
+ {
+ return $this->render('FrontBundle:Default:index');
+ }
+}
View
10 src/Application/FrontBundle/FrontBundle.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace Application\FrontBundle;
+
+use Symfony\Foundation\Bundle\Bundle as BaseBundle;
+use Symfony\Components\DependencyInjection\ContainerInterface;
+
+class FrontBundle extends BaseBundle
+{
+}
View
7 src/Application/FrontBundle/Resources/config/routing.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<routes xmlns="http://www.symfony-project.org/schema/routing"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
+
+</routes>
View
1  src/Application/FrontBundle/Resources/views/Default/index.php
@@ -0,0 +1 @@
+Hello!
View
23 src/autoload.php
@@ -0,0 +1,23 @@
+<?php
+
+require_once __DIR__.'/vendor/symfony/src/Symfony/Foundation/UniversalClassLoader.php';
+
+use Symfony\Foundation\UniversalClassLoader;
+
+$loader = new UniversalClassLoader();
+$loader->registerNamespaces(array(
+ 'Symfony' => __DIR__.'/vendor/symfony/src',
+ 'Application' => __DIR__,
+ 'Bundle' => __DIR__,
+ // 'Doctrine\\Common' => __DIR__.'/vendor/doctrine/lib/vendor/doctrine-common/lib',
+ // 'Doctrine\\DBAL\\Migrations' => __DIR__.'/vendor/doctrine-migrations/lib',
+ // 'Doctrine\\ODM\\MongoDB' => __DIR__.'/vendor/doctrine-mongodb/lib',
+ // 'Doctrine\\DBAL' => __DIR__.'/vendor/doctrine/lib/vendor/doctrine-dbal/lib',
+ // 'Doctrine' => __DIR__.'/vendor/doctrine/lib',
+ 'Zend' => __DIR__.'/vendor/zend/library',
+));
+$loader->registerPrefixes(array(
+ // 'Swift_' => __DIR__.'/vendor/swiftmailer/lib/classes',
+ 'Twig_' => __DIR__.'/vendor/twig/lib',
+));
+$loader->register();
1  src/vendor/symfony
@@ -0,0 +1 @@
+Subproject commit 244c202a087920075252203070d082204e7a15f2
View
27 src/vendor/zend/LICENSE.txt
@@ -0,0 +1,27 @@
+Copyright (c) 2005-2010, Zend Technologies USA, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of Zend Technologies USA, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
36 src/vendor/zend/library/Zend/Exception.php
@@ -0,0 +1,36 @@
+<?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
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend;
+
+/**
+ * @uses Exception
+ * @category Zend
+ * @package Zend
+ * @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 Exception extends \Exception
+{
+}
View
36 src/vendor/zend/library/Zend/Log/Exception.php
@@ -0,0 +1,36 @@
+<?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
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log;
+
+/**
+ * @uses \Zend\Exception
+ * @category Zend
+ * @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$
+ */
+class Exception extends \Zend\Exception
+{}
View
43 src/vendor/zend/library/Zend/Log/Factory.php
@@ -0,0 +1,43 @@
+<?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
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log;
+
+/**
+ * @category Zend
+ * @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$
+ */
+interface Factory
+{
+ /**
+ * Construct a Zend_Log driver
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Factory
+ */
+ static public function factory($config = array());
+}
View
45 src/vendor/zend/library/Zend/Log/Filter.php
@@ -0,0 +1,45 @@
+<?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 Filter
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log;
+
+/**
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Filter
+ * @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$
+ */
+interface Filter
+{
+ /**
+ * Returns TRUE to accept the message, FALSE to block it.
+ *
+ * @param array $event event data
+ * @return boolean accepted?
+ */
+ public function accept($event);
+}
View
63 src/vendor/zend/library/Zend/Log/Filter/AbstractFilter.php
@@ -0,0 +1,63 @@
+<?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 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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Filter;
+use Zend\Log\Factory,
+ Zend\Log\Filter;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Filter\FilterInterface
+ * @uses \Zend\Log\FactoryInterface
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+abstract class AbstractFilter
+ implements Filter, Factory
+{
+ /**
+ * Validate and optionally convert the config to array
+ *
+ * @param array|\Zend\Config\Config $config \Zend\Config\Config or Array
+ * @return array
+ * @throws \Zend\Log\Exception
+ */
+ static protected function _parseConfig($config)
+ {
+ if ($config instanceof \Zend\Config\Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config)) {
+ throw new \Zend\Log\Exception('Configuration must be an array or instance of Zend\\Config\\Config');
+ }
+
+ return $config;
+ }
+}
View
88 src/vendor/zend/library/Zend/Log/Filter/Message.php
@@ -0,0 +1,88 @@
+<?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 Filter
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Filter;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Filter\AbstractFilter
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Filter
+ * @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$
+ */
+class Message extends AbstractFilter
+{
+ /**
+ * @var string
+ */
+ protected $_regexp;
+
+ /**
+ * Filter out any log messages not matching $regexp.
+ *
+ * @param string $regexp Regular expression to test the log message
+ * @throws \Zend\Log\Exception
+ */
+ public function __construct($regexp)
+ {
+ if (@preg_match($regexp, '') === false) {
+ throw new \Zend\Log\Exception("Invalid regular expression '$regexp'");
+ }
+ $this->_regexp = $regexp;
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Filter_Message
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Filter\Message
+ * @throws \Zend\Log\Exception
+ */
+ static public function factory($config = array())
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'regexp' => null
+ ), $config);
+
+ return new self(
+ $config['regexp']
+ );
+ }
+
+ /**
+ * Returns TRUE to accept the message, FALSE to block it.
+ *
+ * @param array $event event data
+ * @return boolean accepted?
+ */
+ public function accept($event)
+ {
+ return preg_match($this->_regexp, $event['message']) > 0;
+ }
+}
View
104 src/vendor/zend/library/Zend/Log/Filter/Priority.php
@@ -0,0 +1,104 @@
+<?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 Filter
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Filter;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Filter\AbstractFilter
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Filter
+ * @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$
+ */
+class Priority extends AbstractFilter
+{
+ /**
+ * @var integer
+ */
+ protected $_priority;
+
+ /**
+ * @var string
+ */
+ protected $_operator;
+
+ /**
+ * Filter logging by $priority. By default, it will accept any log
+ * event whose priority value is less than or equal to $priority.
+ *
+ * @param integer $priority Priority
+ * @param string $operator Comparison operator
+ * @throws \Zend\Log\Exception
+ */
+ public function __construct($priority, $operator = \NULL)
+ {
+ if (! is_integer($priority)) {
+ throw new \Zend\Log\Exception('Priority must be an integer');
+ }
+
+ $this->_priority = $priority;
+ $this->_operator = is_null($operator) ? '<=' : $operator;
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Filter_Priority
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Filter\Priority
+ * @throws \Zend\Log\Exception
+ */
+ static public function factory($config = array())
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'priority' => null,
+ 'operator' => null,
+ ), $config);
+
+ // Add support for constants
+ if (!is_numeric($config['priority']) && isset($config['priority']) && defined($config['priority'])) {
+ $config['priority'] = constant($config['priority']);
+ }
+
+ return new self(
+ $config['priority'],
+ $config['operator']
+ );
+ }
+
+ /**
+ * Returns TRUE to accept the message, FALSE to block it.
+ *
+ * @param array $event event data
+ * @return boolean accepted?
+ */
+ public function accept($event)
+ {
+ return version_compare($event['priority'], $this->_priority, $this->_operator);
+ }
+}
View
80 src/vendor/zend/library/Zend/Log/Filter/SuppressFilter.php
@@ -0,0 +1,80 @@
+<?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 Filter
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Filter;
+
+/**
+ * @uses \Zend\Log\Filter\AbstractFilter
+ * @category Zend
+ * @package Zend_Log
+ * @subpackage Filter
+ * @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$
+ */
+class SuppressFilter extends AbstractFilter
+{
+ /**
+ * @var boolean
+ */
+ protected $_accept = true;
+
+ /**
+ * This is a simple boolean filter.
+ *
+ * Call suppress(true) to suppress all log events.
+ * Call suppress(false) to accept all log events.
+ *
+ * @param boolean $suppress Should all log events be suppressed?
+ * @return void
+ */
+ public function suppress($suppress)
+ {
+ $this->_accept = (! $suppress);
+ }
+
+ /**
+ * Returns TRUE to accept the message, FALSE to block it.
+ *
+ * @param array $event event data
+ * @return boolean accepted?
+ */
+ public function accept($event)
+ {
+ return $this->_accept;
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Filter_Suppress
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Filter\Suppress
+ * @throws \Zend\Log\Exception
+ */
+ static public function factory($config = array())
+ {
+ return new self();
+ }
+}
View
45 src/vendor/zend/library/Zend/Log/Formatter.php
@@ -0,0 +1,45 @@
+<?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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log;
+
+/**
+ * @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$
+ */
+interface Formatter
+{
+ /**
+ * Formats data into a single line to be written by the writer.
+ *
+ * @param array $event event data
+ * @return string formatted line to write to the log
+ */
+ public function format($event);
+}
View
54 src/vendor/zend/library/Zend/Log/Formatter/Firebug.php
@@ -0,0 +1,54 @@
+<?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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Formatter;
+use \Zend\Log\Formatter;
+
+/**
+ * @uses \Zend\Log\Formatter\FormatterInterface
+ * @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
+ */
+class Firebug implements Formatter
+{
+ /**
+ * This method formats the event for the firebug writer.
+ *
+ * The default is to just send the message parameter, but through
+ * extension of this class and calling the
+ * {@see Zend_Log_Writer_Firebug::setFormatter()} method you can
+ * pass as much of the event data as you are interested in.
+ *
+ * @param array $event event data
+ * @return mixed event message
+ */
+ public function format($event)
+ {
+ return $event['message'];
+ }
+}
View
88 src/vendor/zend/library/Zend/Log/Formatter/Simple.php
@@ -0,0 +1,88 @@
+<?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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Formatter;
+use \Zend\Log\Formatter;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Formatter\FormatterInterface
+ * @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$
+ */
+class Simple implements Formatter
+{
+ /**
+ * @var string
+ */
+ protected $_format;
+
+ const DEFAULT_FORMAT = '%timestamp% %priorityName% (%priority%): %message%';
+
+ /**
+ * Class constructor
+ *
+ * @param null|string $format Format specifier for log messages
+ * @throws \Zend\Log\Exception
+ */
+ public function __construct($format = null)
+ {
+ if ($format === null) {
+ $format = self::DEFAULT_FORMAT . PHP_EOL;
+ }
+
+ if (! is_string($format)) {
+ throw new \Zend\Log\Exception('Format must be a string');
+ }
+
+ $this->_format = $format;
+ }
+
+ /**
+ * Formats data into a single line to be written by the writer.
+ *
+ * @param array $event event data
+ * @return string formatted line to write to the log
+ */
+ public function format($event)
+ {
+ $output = $this->_format;
+ foreach ($event as $name => $value) {
+
+ if ((is_object($value) && !method_exists($value,'__toString'))
+ || is_array($value)) {
+
+ $value = gettype($value);
+ }
+
+ $output = str_replace("%$name%", $value, $output);
+ }
+ return $output;
+ }
+}
View
127 src/vendor/zend/library/Zend/Log/Formatter/Xml.php
@@ -0,0 +1,127 @@
+<?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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Formatter;
+
+use \Zend\Log\Formatter;
+
+/**
+ * @uses DOMDocument
+ * @uses DOMElement
+ * @uses \Zend\Log\Formatter\FormatterInterface
+ * @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$
+ */
+class Xml implements Formatter
+{
+ /**
+ * @var Relates XML elements to log data field keys.
+ */
+ protected $_rootElement;
+
+ /**
+ * @var Relates XML elements to log data field keys.
+ */
+ 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, $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;
+ }
+
+ /**
+ * Formats data into a single line to be written by the writer.
+ *
+ * @param array $event event data
+ * @return string formatted line to write to the log
+ */
+ public function format($event)
+ {
+ if ($this->_elementMap === null) {
+ $dataToInsert = $event;
+ } else {
+ $dataToInsert = array();
+ foreach ($this->_elementMap as $elementName => $fieldKey) {
+ $dataToInsert[$elementName] = $event[$fieldKey];
+ }
+ }
+
+ $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, ENT_COMPAT, $enc);
+ }
+ $elt->appendChild(new \DOMElement($key, $value));
+ }
+
+ $xml = $dom->saveXML();
+ $xml = preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $xml);
+
+ return $xml . PHP_EOL;
+ }
+}
View
516 src/vendor/zend/library/Zend/Log/Logger.php
@@ -0,0 +1,516 @@
+<?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
+ * @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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log;
+use Zend\Config\Config;
+
+/**
+ * @uses \Zend\Loader
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Filter\Priority
+ * @category Zend
+ * @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$
+ */
+class Logger implements Factory
+{
+ const EMERG = 0; // Emergency: system is unusable
+ const ALERT = 1; // Alert: action must be taken immediately
+ const CRIT = 2; // Critical: critical conditions
+ const ERR = 3; // Error: error conditions
+ const WARN = 4; // Warning: warning conditions
+ const NOTICE = 5; // Notice: normal but significant condition
+ const INFO = 6; // Informational: informational messages
+ const DEBUG = 7; // Debug: debug messages
+
+ /**
+ * @var array of priorities where the keys are the
+ * priority numbers and the values are the priority names
+ */
+ protected $_priorities = array();
+
+ /**
+ * @var array of \Zend\Log\Writer\AbstractWriter
+ */
+ protected $_writers = array();
+
+ /**
+ * @var array of \Zend\Log\Filter\FilterInterface
+ */
+ protected $_filters = array();
+
+ /**
+ * @var array of extra log event
+ */
+ protected $_extras = array();
+
+ /**
+ *
+ * @var string
+ */
+ protected $_defaultWriterNamespace = '\\Zend\\Log\\Writer';
+
+ /**
+ *
+ * @var string
+ */
+ protected $_defaultFilterNamespace = '\\Zend\\Log\\Filter';
+
+ /**
+ *
+ * @var callback
+ */
+ protected $_origErrorHandler = null;
+
+ /**
+ *
+ * @var boolean
+ */
+ protected $_registeredErrorHandler = false;
+
+ /**
+ *
+ * @var array
+ */
+ protected $_errorHandlerMap = false;
+
+ /**
+ * Class constructor. Create a new logger
+ *
+ * @param \Zend\Log\Writer\AbstractWriter|null $writer default writer
+ */
+ public function __construct(Writer $writer = null)
+ {
+ $r = new \ReflectionClass($this);
+ $this->_priorities = array_flip($r->getConstants());
+
+ if ($writer !== null) {
+ $this->addWriter($writer);
+ }
+ }
+
+ /**
+ * Factory to construct the logger and one or more writers
+ * based on the configuration array
+ *
+ * @param array|\Zend\Config\Config Array or instance of \Zend\Config\Config
+ * @return \Zend\Log\Logger
+ */
+ static public function factory($config = array())
+ {
+ if ($config instanceof Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config) || empty($config)) {
+ throw new Exception('Configuration must be an array or instance of Zend\\Config\\Config');
+ }
+
+ $log = new self;
+
+ if (!is_array(current($config))) {
+ $log->addWriter(current($config));
+ } else {
+ foreach($config as $writer) {
+ $log->addWriter($writer);
+ }
+ }
+
+ return $log;
+ }
+
+
+ /**
+ * Construct a writer object based on a configuration array
+ *
+ * @param array $spec config array with writer spec
+ * @return \Zend\Log\Writer\AbstractWriter
+ */
+ protected function _constructWriterFromConfig($config)
+ {
+ $writer = $this->_constructFromConfig('writer', $config, $this->_defaultWriterNamespace);
+
+ if (!$writer instanceof Writer) {
+ throw new Exception("{$writerName} does not extend Zend\\Log\\Writer!");
+ }
+
+ if (isset($config['filterName'])) {
+ $filter = $this->_constructFilterFromConfig($config);
+ $writer->addFilter($filter);
+ }
+
+ return $writer;
+ }
+
+ /**
+ * Construct filter object from configuration array or Zend_Config object
+ *
+ * @param array|\Zend\Config\Config $config \Zend\Config\Config or Array
+ * @return \Zend\Log\Filter
+ */
+ protected function _constructFilterFromConfig($config)
+ {
+ $filter = $this->_constructFromConfig('filter', $config, $this->_defaultFilterNamespace);
+
+ if (!$filter instanceof Filter) {
+ throw new Exception("{$filterName} does not implement Zend\\Log\\Filter");
+ }
+
+ return $filter;
+ }
+
+ /**
+ * Construct a filter or writer from config
+ *
+ * @param string $type 'writer' of 'filter'
+ * @param mixed $config \Zend\Config\Config or Array
+ * @param string $namespace
+ * @return object
+ */
+ protected function _constructFromConfig($type, $config, $namespace)
+ {
+ if ($config instanceof Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config) || empty($config)) {
+ throw new Exception(
+ 'Configuration must be an array or instance of Zend\\Config\\Config'
+ );
+ }
+
+ $params = isset($config[ $type .'Params' ]) ? $config[ $type .'Params' ] : array();
+ $className = $this->getClassName($config, $type, $namespace);
+ if (!class_exists($className)) {
+ \Zend\Loader::loadClass($className);
+ }
+
+ $reflection = new \ReflectionClass($className);
+ if (!$reflection->implementsInterface('\\Zend\\Log\\Factory')) {
+ throw new Exception(
+ 'Driver does not implement Zend\\Log\\Factory and can not be constructed from config.'
+ );
+ }
+
+ return call_user_func(array($className, 'factory'), $params);
+ }
+
+ /**
+ * Get the writer or filter full classname
+ *
+ * @param array $config
+ * @param string $type filter|writer
+ * @param string $defaultNamespace
+ * @return string full classname
+ */
+ protected function getClassName($config, $type, $defaultNamespace)
+ {
+ if (!isset($config[ $type . 'Name' ])) {
+ throw new Exception("Specify {$type}Name in the configuration array");
+ }
+ $className = $config[ $type . 'Name' ];
+
+ $namespace = $defaultNamespace;
+ if (isset($config[ $type . 'Namespace' ])) {
+ $namespace = $config[ $type . 'Namespace' ];
+ }
+
+ $fullClassName = $namespace . '\\' . $className;
+ return $fullClassName;
+ }
+
+ /**
+ * Packs message and priority into Event array
+ *
+ * @param string $message Message to log
+ * @param integer $priority Priority of message
+ * @return array Event array
+ **/
+ protected function _packEvent($message, $priority)
+ {
+ return array_merge(array(
+ 'timestamp' => date('c'),
+ 'message' => $message,
+ 'priority' => $priority,
+ 'priorityName' => $this->_priorities[$priority]
+ ),
+ $this->_extras
+ );
+ }
+
+ /**
+ * Class destructor. Shutdown log writers
+ *
+ * @return void
+ */
+ public function __destruct()
+ {
+ foreach($this->_writers as $writer) {
+ $writer->shutdown();
+ }
+ }
+
+ /**
+ * Undefined method handler allows a shortcut:
+ * $log->priorityName('message')
+ * instead of
+ * $log->log('message', \Zend\Log\Logger::PRIORITY_NAME)
+ *
+ * @param string $method priority name
+ * @param string $params message to log
+ * @return void
+ * @throws \Zend\Log\Exception
+ */
+ public function __call($method, $params)
+ {
+ $priority = strtoupper($method);
+ if (($priority = array_search($priority, $this->_priorities)) !== false) {
+ switch (count($params)) {
+ case 0:
+ throw new Exception('Missing log message');
+ case 1:
+ $message = array_shift($params);
+ $extras = null;
+ break;
+ default:
+ $message = array_shift($params);
+ $extras = array_shift($params);
+ break;
+ }
+ $this->log($message, $priority, $extras);
+ } else {
+ throw new Exception('Bad log priority');
+ }
+ }
+
+ /**
+ * Log a message at a priority
+ *
+ * @param string $message Message to log
+ * @param integer $priority Priority of message
+ * @param mixed $extras Extra information to log in event
+ * @return void
+ * @throws \Zend\Log\Exception
+ */
+ public function log($message, $priority, $extras = null)
+ {
+ // sanity checks
+ if (empty($this->_writers)) {
+ throw new Exception('No writers were added');
+ }
+
+ if (! isset($this->_priorities[$priority])) {
+ throw new Exception('Bad log priority');
+ }
+
+ // pack into event required by filters and writers
+ $event = $this->_packEvent($message, $priority);
+
+ // Check to see if any extra information was passed
+ if (!empty($extras)) {
+ $info = array();
+ if (is_array($extras)) {
+ foreach ($extras as $key => $value) {
+ if (is_string($key)) {
+ $event[$key] = $value;
+ } else {
+ $info[] = $value;
+ }
+ }
+ } else {
+ $info = $extras;
+ }
+ if (!empty($info)) {
+ $event['info'] = $info;
+ }
+ }
+
+ // abort if rejected by the global filters
+ foreach ($this->_filters as $filter) {
+ if (! $filter->accept($event)) {
+ return;
+ }
+ }
+
+ // send to each writer
+ foreach ($this->_writers as $writer) {
+ $writer->write($event);
+ }
+ }
+
+ /**
+ * Add a custom priority
+ *
+ * @param string $name Name of priority
+ * @param integer $priority Numeric priority
+ * @throws Zend_Log_InvalidArgumentException
+ */
+ public function addPriority($name, $priority)
+ {
+ // Priority names must be uppercase for predictability.
+ $name = strtoupper($name);
+
+ if (isset($this->_priorities[$priority])
+ || array_search($name, $this->_priorities)) {
+ throw new Exception('Existing priorities cannot be overwritten');
+ }
+
+ $this->_priorities[$priority] = $name;
+ }
+
+ /**
+ * Add a filter that will be applied before all log writers.
+ * Before a message will be received by any of the writers, it
+ * must be accepted by all filters added with this method.
+ *
+ * @param int|\Zend\Log\Filter\FilterInterface $filter
+ * @return void
+ */
+ public function addFilter($filter)
+ {
+ if (is_integer($filter)) {
+ $filter = new Filter\Priority($filter);
+
+ } elseif ($filter instanceof Config || is_array($filter)) {
+ $filter = $this->_constructFilterFromConfig($filter);
+
+ } elseif(! $filter instanceof Filter) {
+ throw new Exception('Invalid filter provided');
+ }
+
+ $this->_filters[] = $filter;
+ }
+
+ /**
+ * Add a writer. A writer is responsible for taking a log
+ * message and writing it out to storage.
+ *
+ * @param mixed $writer \Zend\Log\Writer\AbstractWriter or Config array
+ * @return void
+ */
+ public function addWriter($writer)
+ {
+ if (is_array($writer) || $writer instanceof Config) {
+ $writer = $this->_constructWriterFromConfig($writer);
+ }
+
+ if (!$writer instanceof Writer) {
+ throw new Exception(
+ 'Writer must be an instance of Zend\\Log\\Writer'
+ . ' or you should pass a configuration array'
+ );
+ }
+
+ $this->_writers[] = $writer;
+ }
+
+ /**
+ * Set an extra item to pass to the log writers.
+ *
+ * @param $name Name of the field
+ * @param $value Value of the field
+ * @return void
+ */
+ public function setEventItem($name, $value)
+ {
+ $this->_extras = array_merge($this->_extras, array($name => $value));
+ }
+
+ /**
+ * Register Logging system as an error handler to log php errors
+ * Note: it still calls the original error handler if set_error_handler is able to return it.
+ *
+ * Errors will be mapped as:
+ * E_NOTICE, E_USER_NOTICE => NOTICE
+ * E_WARNING, E_CORE_WARNING, E_USER_WARNING => WARN
+ * E_ERROR, E_USER_ERROR, E_CORE_ERROR, E_RECOVERABLE_ERROR => ERR
+ * E_DEPRECATED, E_STRICT, E_USER_DEPRECATED => DEBUG
+ * (unknown/other) => INFO
+ *
+ * @link http://www.php.net/manual/en/function.set-error-handler.php Custom error handler
+ *
+ * @return \Zend\Log\Logger
+ */
+ public function registerErrorHandler()
+ {
+ // Only register once. Avoids loop issues if it gets registered twice.
+ if ($this->_registeredErrorHandler) {
+ return $this;
+ }
+
+ $this->_origErrorHandler = set_error_handler(array($this, 'errorHandler'));
+
+ // Contruct a default map of phpErrors to Zend_Log priorities.
+ // Some of the errors are uncatchable, but are included for completeness
+ $this->_errorHandlerMap = array(
+ E_NOTICE => self::NOTICE,
+ E_USER_NOTICE => self::NOTICE,
+ E_WARNING => self::WARN,
+ E_CORE_WARNING => self::WARN,
+ E_USER_WARNING => self::WARN,
+ E_ERROR => self::ERR,
+ E_USER_ERROR => self::ERR,
+ E_CORE_ERROR => self::ERR,
+ E_RECOVERABLE_ERROR => self::ERR,
+ E_STRICT => self::DEBUG,
+ );
+
+ $this->_errorHandlerMap['E_DEPRECATED'] = self::DEBUG;
+ $this->_errorHandlerMap['E_USER_DEPRECATED'] = self::DEBUG;
+ $this->_registeredErrorHandler = true;
+ return $this;
+ }
+
+ /**
+ * Error Handler will convert error into log message, and then call the original error handler
+ *
+ * @link http://www.php.net/manual/en/function.set-error-handler.php Custom error handler
+ * @param int $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param int $errline
+ * @param array $errcontext
+ * @return boolean
+ */
+ public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
+ {
+ $errorLevel = error_reporting();
+
+ if ($errorLevel && $errno) {
+ if (isset($this->_errorHandlerMap[$errno])) {
+ $priority = $this->_errorHandlerMap[$errno];
+ } else {
+ $priority = self::INFO;
+ }
+ $this->log($errstr, $priority, array('errno'=>$errno, 'file'=>$errfile, 'line'=>$errline, 'context'=>$errcontext));
+ }
+
+ if ($this->_origErrorHandler !== null) {
+ return call_user_func($this->_origErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext);
+ }
+ return false;
+ }
+}
View
71 src/vendor/zend/library/Zend/Log/Writer.php
@@ -0,0 +1,71 @@
+<?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 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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\FactoryInterface
+ * @uses \Zend\Log\Filter\Priority
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+interface Writer
+{
+ /**
+ * Add a log filter to the writer
+ *
+ * @param int|\Zend\Log\Filter $filter
+ * @return Writer
+ */
+ public function addFilter($filter);
+
+ /**
+ * Set a message formatter for the writer
+ *
+ * @param \Zend\Log\Formatter|Callable $formatter
+ * @return Writer
+ */
+ public function setFormatter($formatter);
+
+ /**
+ * Write a log message
+ *
+ * @param array|mixed $event
+ * @return Writer
+ */
+ public function write($event);
+
+ /**
+ * Perform shutdown activities
+ *
+ * @return void
+ */
+ public function shutdown();
+}
View
136 src/vendor/zend/library/Zend/Log/Writer/AbstractWriter.php
@@ -0,0 +1,136 @@
+<?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 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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Writer;
+
+use \Zend\Log\Factory,
+ \Zend\Log\Writer;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Factory
+ * @uses \Zend\Log\Filter\Priority
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+abstract class AbstractWriter implements Writer, Factory
+{
+ /**
+ * @var array of \Zend\Log\Filter
+ */
+ protected $_filters = array();
+
+ /**
+ * Formats the log message before writing.
+ * @var \Zend\Log\Formatter
+ */
+ protected $_formatter;
+
+ /**
+ * Add a filter specific to this writer.
+ *
+ * @param \Zend\Log\Filter $filter
+ * @return void
+ */
+ public function addFilter($filter)
+ {
+ if (is_integer($filter)) {
+ $filter = new \Zend\Log\Filter\Priority($filter);
+ }
+
+ $this->_filters[] = $filter;
+ }
+
+ /**
+ * Log a message to this writer.
+ *
+ * @param array $event log data event
+ * @return void
+ */
+ public function write($event)
+ {
+ foreach ($this->_filters as $filter) {
+ if (! $filter->accept($event)) {
+ return;
+ }
+ }
+
+ // exception occurs on error
+ $this->_write($event);
+ }
+
+ /**
+ * Set a new formatter for this writer
+ *
+ * @param \Zend\Log\Formatter $formatter
+ * @return void
+ */
+ public function setFormatter($formatter)
+ {
+ $this->_formatter = $formatter;
+ }
+
+ /**
+ * Perform shutdown activites such as closing open resources
+ *
+ * @return void
+ */
+ public function shutdown()
+ {}
+
+ /**
+ * Write a message to the log.
+ *
+ * @param array $event log data event
+ * @return void
+ */
+ abstract protected function _write($event);
+
+ /**
+ * Validate and optionally convert the config to array
+ *
+ * @param array|\Zend\Config\Config $config \Zend\Config\Config or Array
+ * @return array
+ * @throws \Zend\Log\Exception
+ */
+ static protected function _parseConfig($config)
+ {
+ if ($config instanceof \Zend\Config\Config) {
+ $config = $config->toArray();
+ }
+
+ if (!is_array($config)) {
+ throw new \Zend\Log\Exception(
+ 'Configuration must be an array or instance of Zend\\Config\\Config'
+ );
+ }
+
+ return $config;
+ }
+}
View
142 src/vendor/zend/library/Zend/Log/Writer/Db.php
@@ -0,0 +1,142 @@
+<?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 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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Writer;
+use Zend\Log;
+
+/**
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Writer\AbstractWriter
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+class Db extends AbstractWriter
+{
+ /**
+ * Database adapter instance
+ * @var Zend_Db_Adapter
+ */
+ private $_db;
+
+ /**
+ * Name of the log table in the database
+ * @var string
+ */
+ private $_table;
+
+ /**
+ * Relates database columns names to log data field keys.
+ *
+ * @var null|array
+ */
+ private $_columnMap;
+
+ /**
+ * Class constructor
+ *
+ * @param Zend_Db_Adapter $db Database adapter instance
+ * @param string $table Log table in database
+ * @param array $columnMap
+ */
+ public function __construct($db, $table, $columnMap = null)
+ {
+ $this->_db = $db;
+ $this->_table = $table;
+ $this->_columnMap = $columnMap;
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Db
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Writer\Db
+ * @throws \Zend\Log\Exception
+ */
+ static public function factory($config = array())
+ {
+ $config = self::_parseConfig($config);
+ $config = array_merge(array(
+ 'db' => null,
+ 'table' => null,
+ 'columnMap' => null,
+ ), $config);
+
+ if (isset($config['columnmap'])) {
+ $config['columnMap'] = $config['columnmap'];
+ }
+
+ return new self(
+ $config['db'],
+ $config['table'],
+ $config['columnMap']
+ );
+ }
+
+ /**
+ * Formatting is not possible on this writer
+ */
+ public function setFormatter($formatter)
+ {
+ throw new Log\Exception(get_class() . ' does not support formatting');
+ }
+
+ /**
+ * Remove reference to database adapter
+ *
+ * @return void
+ */
+ public function shutdown()
+ {
+ $this->_db = null;
+ }
+
+ /**
+ * Write a message to the log.
+ *
+ * @param array $event event data
+ * @return void
+ */
+ protected function _write($event)
+ {
+ if ($this->_db === null) {
+ throw new Log\Exception('Database adapter is null');
+ }
+
+ if ($this->_columnMap === null) {
+ $dataToInsert = $event;
+ } else {
+ $dataToInsert = array();
+ foreach ($this->_columnMap as $columnName => $fieldKey) {
+ $dataToInsert[$columnName] = $event[$fieldKey];
+ }
+ }
+
+ $this->_db->insert($this->_table, $dataToInsert);
+ }
+}
View
199 src/vendor/zend/library/Zend/Log/Writer/Firebug.php
@@ -0,0 +1,199 @@
+<?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 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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Writer;
+use Zend\Log;
+use Zend\Wildfire\Plugin\FirePhp;
+
+/**
+ * Writes log messages to the Firebug Console via FirePHP.
+ *
+ * @uses \Zend\Log\Logger
+ * @uses \Zend\Log\Formatter\Firebug
+ * @uses \Zend\Log\Writer\AbstractWriter
+ * @uses \Zend\Wildfire\Plugin\FirePhp\FirePhp
+ * @category Zend
+ * @package Zend_Log
+ * @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
+ */
+class Firebug extends AbstractWriter
+{
+
+ /**
+ * Maps logging priorities to logging display styles
+ * @var array
+ */
+ protected $_priorityStyles = array(Log\Logger::EMERG => FirePhp\FirePhp::ERROR,
+ Log\Logger::ALERT => FirePhp\FirePhp::ERROR,
+ Log\Logger::CRIT => FirePhp\FirePhp::ERROR,
+ Log\Logger::ERR => FirePhp\FirePhp::ERROR,
+ Log\Logger::WARN => FirePhp\FirePhp::WARN,
+ Log\Logger::NOTICE => FirePhp\FirePhp::INFO,
+ Log\Logger::INFO => FirePhp\FirePhp::INFO,
+ Log\Logger::DEBUG => FirePhp\FirePhp::LOG);
+
+ /**
+ * The default logging style for un-mapped priorities
+ * @var string
+ */
+ protected $_defaultPriorityStyle = FirePhp\FirePhp::LOG;
+
+ /**
+ * Flag indicating whether the log writer is enabled
+ * @var boolean
+ */
+ protected $_enabled = true;
+
+ /**
+ * Class constructor
+ */
+ public function __construct()
+ {
+ if (php_sapi_name() == 'cli') {
+ $this->setEnabled(false);
+ }
+
+ $this->_formatter = new Log\Formatter\Firebug();
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Firebug
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Writer\Firebug
+ * @throws \Zend\Log\Exception
+ */
+ static public function factory($config = array())
+ {
+ return new self();
+ }
+
+ /**
+ * Enable or disable the log writer.
+ *
+ * @param boolean $enabled Set to TRUE to enable the log writer
+ * @return boolean The previous value.
+ */
+ public function setEnabled($enabled)
+ {
+ $previous = $this->_enabled;
+ $this->_enabled = $enabled;
+ return $previous;
+ }
+
+ /**
+ * Determine if the log writer is enabled.
+ *
+ * @return boolean Returns TRUE if the log writer is enabled.
+ */
+ public function getEnabled()
+ {
+ return $this->_enabled;
+ }
+
+ /**
+ * Set the default display style for user-defined priorities
+ *
+ * @param string $style The default log display style
+ * @return string Returns previous default log display style
+ */
+ public function setDefaultPriorityStyle($style)
+ {
+ $previous = $this->_defaultPriorityStyle;
+ $this->_defaultPriorityStyle = $style;
+ return $previous;
+ }
+
+ /**
+ * Get the default display style for user-defined priorities
+ *
+ * @return string Returns the default log display style
+ */
+ public function getDefaultPriorityStyle()
+ {
+ return $this->_defaultPriorityStyle;
+ }
+
+ /**
+ * Set a display style for a logging priority
+ *
+ * @param int $priority The logging priority
+ * @param string $style The logging display style
+ * @return string|boolean The previous logging display style if defined or TRUE otherwise
+ */
+ public function setPriorityStyle($priority, $style)
+ {
+ $previous = true;
+ if (array_key_exists($priority,$this->_priorityStyles)) {
+ $previous = $this->_priorityStyles[$priority];
+ }
+ $this->_priorityStyles[$priority] = $style;
+ return $previous;
+ }
+
+ /**
+ * Get a display style for a logging priority
+ *
+ * @param int $priority The logging priority
+ * @return string|boolean The logging display style if defined or FALSE otherwise
+ */
+ public function getPriorityStyle($priority)
+ {
+ if (array_key_exists($priority,$this->_priorityStyles)) {
+ return $this->_priorityStyles[$priority];
+ }
+ return false;
+ }
+
+ /**
+ * Log a message to the Firebug Console.
+ *
+ * @param array $event The event data
+ * @return void
+ */
+ protected function _write($event)
+ {
+ if (!$this->getEnabled()) {
+ return;
+ }
+
+ if (array_key_exists($event['priority'],$this->_priorityStyles)) {
+ $type = $this->_priorityStyles[$event['priority']];
+ } else {
+ $type = $this->_defaultPriorityStyle;
+ }
+
+ $message = $this->_formatter->format($event);
+
+ $label = isset($event['firebugLabel'])?$event['firebugLabel']:null;
+
+ FirePhp\FirePhp::getInstance()->send($message,
+ $label,
+ $type,
+ array('traceOffset'=>6));
+ }
+}
View
307 src/vendor/zend/library/Zend/Log/Writer/Mail.php
@@ -0,0 +1,307 @@
+<?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 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$
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Log\Writer;
+use Zend\Log;
+
+/**
+ * Class used for writing log messages to email via Zend_Mail.
+ *
+ * Allows for emailing log messages at and above a certain level via a
+ * Zend_Mail object. Note that this class only sends the email upon
+ * completion, so any log entries accumulated are sent in a single email.
+ *
+ * @uses \Zend\Log\Exception
+ * @uses \Zend\Log\Formatter\Simple
+ * @uses \Zend\Log\Writer\AbstractWriter
+ * @category Zend
+ * @package Zend_Log
+ * @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$
+ */
+class Mail extends AbstractWriter
+{
+ /**
+ * Array of formatted events to include in message body.
+ *
+ * @var array
+ */
+ protected $_eventsToMail = array();
+
+ /**
+ * Array of formatted lines for use in an HTML email body; these events
+ * are formatted with an optional formatter if the caller is using
+ * Zend_Layout.
+ *
+ * @var array
+ */
+ protected $_layoutEventsToMail = array();
+
+ /**
+ * Zend_Mail instance to use
+ *
+ * @var \Zend\Mail\Mail
+ */
+ protected $_mail;
+
+ /**
+ * Zend_Layout instance to use; optional.
+ *
+ * @var \Zend\Layout\Layout
+ */
+ protected $_layout;
+
+ /**
+ * Optional formatter for use when rendering with Zend_Layout.
+ *
+ * @var \Zend\Log\Formatter
+ */
+ protected $_layoutFormatter;
+
+ /**
+ * Array keeping track of the number of entries per priority level.
+ *
+ * @var array
+ */
+ protected $_numEntriesPerPriority = array();
+
+ /**
+ * Subject prepend text.
+ *
+ * Can only be used of the Zend_Mail object has not already had its
+ * subject line set. Using this will cause the subject to have the entry
+ * counts per-priority level appended to it.
+ *
+ * @var string|null
+ */
+ protected $_subjectPrependText;
+
+ /**
+ * Class constructor.
+ *
+ * Constructs the mail writer; requires a Zend_Mail instance, and takes an
+ * optional Zend_Layout instance. If Zend_Layout is being used,
+ * $this->_layout->events will be set for use in the layout template.
+ *
+ * @param \Zend\Mail\Mail $mail Mail instance
+ * @param \Zend\Layout\Layout $layout Layout instance; optional
+ * @return void
+ */
+ public function __construct(\Zend\Mail\Mail $mail, \Zend\Layout\Layout $layout = null)
+ {
+ $this->_mail = $mail;
+ $this->_layout = $layout;
+ $this->_formatter = new Log\Formatter\Simple();
+ }
+
+ /**
+ * Create a new instance of Zend_Log_Writer_Mail
+ *
+ * @param array|\Zend\Config\Config $config
+ * @return \Zend\Log\Writer\Mail
+ * @throws \Zend\Log\Exception
+ */
+ static public function factory($config = array())
+ {
+ throw new Log\Exception('Zend\\Log\\Writer\\Mail does not currently implement a factory');
+ }
+
+ /**
+ * Places event line into array of lines to be used as message body.
+ *
+ * Handles the formatting of both plaintext entries, as well as those
+ * rendered with Zend_Layout.
+ *
+ * @param array $event Event data
+ * @return void
+ */
+ protected function _write($event)
+ {
+ // Track the number of entries per priority level.
+ if (!isset($this->_numEntriesPerPriority[$event['priorityName']])) {
+ $this->_numEntriesPerPriority[$event['priorityName']] = 1;
+ } else {
+ $this->_numEntriesPerPriority[$event['priorityName']]++;
+ }
+
+ $formattedEvent = $this->_formatter->format($event);
+
+ // All plaintext events are to use the standard formatter.
+ $this->_eventsToMail[] = $formattedEvent;
+
+ // If we have a Zend_Layout instance, use a specific formatter for the
+ // layout if one exists. Otherwise, just use the event with its
+ // default format.
+ if ($this->_layout) {
+ if ($this->_layoutFormatter) {
+ $this->_layoutEventsToMail[] =
+ $this->_layoutFormatter->format($event);
+ } else {
+ $this->_layoutEventsToMail[] = $formattedEvent;
+ }
+ }
+ }
+
+ /**
+ * Gets instance of Zend_Log_Formatter_Instance used for formatting a
+ * message using Zend_Layout, if applicable.
+ *
+ * @return \Zend\Log\Formatter|null The formatter, or null.
+ */
+ public function getLayoutFormatter()
+ {
+ return $this->_layoutFormatter;
+ }
+
+ /**
+ * Sets a specific formatter for use with Zend_Layout events.
+ *
+ * Allows use of a second formatter on lines that will be rendered with
+ * Zend_Layout. In the event that Zend_Layout is not being used, this
+ * formatter cannot be set, so an exception will be thrown.
+ *
+ * @param \Zend\Log\Formatter\FormatterInterface $formatter
+ * @return \Zend\Log\Writer\Mail
+ * @throws \Zend\Log\Exception
+ */
+ public function setLayoutFormatter(Log\Formatter $formatter)
+ {
+ if (!$this->_layout) {
+ throw new Log\Exception(
+ 'cannot set formatter for layout; ' .
+ 'a Zend_Layout instance is not in use');
+ }
+
+ $this->_layoutFormatter = $formatter;
+ return $this;
+ }
+
+ /**
+ * Allows caller to have the mail subject dynamically set to contain the
+ * entry counts per-priority level.
+ *
+ * Sets the text for use in the subject, with entry counts per-priority
+ * level appended to the end. Since a Zend_Mail subject can only be set