# HG changeset patch
# User Markus Broeker
# Date 1455485216 -3600
# Node ID f11c31f7fa3e7232339235879bf56a5c96511770
# Parent a56e7f9a046308d58471851229bcac9e0d383bc3
Alten Library Ordner entfernt
diff --git a/library/log4php/Logger.php b/library/log4php/Logger.php
deleted file mode 100644
--- a/library/log4php/Logger.php
+++ /dev/null
@@ -1,596 +0,0 @@
-
- *
{@link trace()}
- *
{@link debug()}
- *
{@link info()}
- *
{@link warn()}
- *
{@link error()}
- *
{@link fatal()}
- *
- *
- * @package log4php
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version SVN: $Id: Logger.php 1395241 2012-10-07 08:28:53Z ihabunek $
- * @link http://logging.apache.org/log4php
- */
-class Logger {
-
- /**
- * Logger additivity. If set to true then child loggers will inherit
- * the appenders of their ancestors by default.
- * @var boolean
- */
- private $additive = true;
-
- /**
- * The Logger's fully qualified class name.
- * TODO: Determine if this is useful.
- */
- private $fqcn = 'Logger';
-
- /** The assigned Logger level. */
- private $level;
-
- /** The name of this Logger instance. */
- private $name;
-
- /** The parent logger. Set to null if this is the root logger. */
- private $parent;
-
- /** A collection of appenders linked to this logger. */
- private $appenders = array();
-
- /**
- * Constructor.
- * @param string $name Name of the logger.
- */
- public function __construct($name) {
- $this->name = $name;
- }
-
- /**
- * Returns the logger name.
- * @return string
- */
- public function getName() {
- return $this->name;
- }
-
- /**
- * Returns the parent Logger. Can be null if this is the root logger.
- * @return Logger
- */
- public function getParent() {
- return $this->parent;
- }
-
- // ******************************************
- // *** Logging methods ***
- // ******************************************
-
- /**
- * Log a message object with the TRACE level.
- *
- * @param mixed $message message
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function trace($message, $throwable = null) {
- $this->log(LoggerLevel::getLevelTrace(), $message, $throwable);
- }
-
- /**
- * Log a message object with the DEBUG level.
- *
- * @param mixed $message message
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function debug($message, $throwable = null) {
- $this->log(LoggerLevel::getLevelDebug(), $message, $throwable);
- }
-
- /**
- * Log a message object with the INFO Level.
- *
- * @param mixed $message message
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function info($message, $throwable = null) {
- $this->log(LoggerLevel::getLevelInfo(), $message, $throwable);
- }
-
- /**
- * Log a message with the WARN level.
- *
- * @param mixed $message message
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function warn($message, $throwable = null) {
- $this->log(LoggerLevel::getLevelWarn(), $message, $throwable);
- }
-
- /**
- * Log a message object with the ERROR level.
- *
- * @param mixed $message message
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function error($message, $throwable = null) {
- $this->log(LoggerLevel::getLevelError(), $message, $throwable);
- }
-
- /**
- * Log a message object with the FATAL level.
- *
- * @param mixed $message message
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function fatal($message, $throwable = null) {
- $this->log(LoggerLevel::getLevelFatal(), $message, $throwable);
- }
-
- /**
- * Log a message using the provided logging level.
- *
- * @param LoggerLevel $level The logging level.
- * @param mixed $message Message to log.
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- */
- public function log(LoggerLevel $level, $message, $throwable = null) {
- if ($this->isEnabledFor($level)) {
- $event = new LoggerLoggingEvent($this->fqcn, $this, $level, $message, null, $throwable);
- $this->callAppenders($event);
- }
-
- // Forward the event upstream if additivity is turned on
- if (isset($this->parent) && $this->getAdditivity()) {
-
- // Use the event if already created
- if (isset($event)) {
- $this->parent->logEvent($event);
- } else {
- $this->parent->log($level, $message, $throwable);
- }
- }
- }
-
- /**
- * Logs an already prepared logging event object.
- * @param LoggerLoggingEvent $event
- */
- public function logEvent(LoggerLoggingEvent $event) {
- if ($this->isEnabledFor($event->getLevel())) {
- $this->callAppenders($event);
- }
-
- // Forward the event upstream if additivity is turned on
- if (isset($this->parent) && $this->getAdditivity()) {
- $this->parent->logEvent($event);
- }
- }
-
- /**
- * If assertion parameter evaluates as false, then logs the message
- * using the ERROR level.
- *
- * @param bool $assertion
- * @param string $msg message to log
- */
- public function assertLog($assertion = true, $msg = '') {
- if ($assertion == false) {
- $this->error($msg);
- }
- }
-
- /**
- * This method creates a new logging event and logs the event without
- * further checks.
- *
- * It should not be called directly. Use {@link trace()}, {@link debug()},
- * {@link info()}, {@link warn()}, {@link error()} and {@link fatal()}
- * wrappers.
- *
- * @param string $fqcn Fully qualified class name of the Logger
- * @param Exception $throwable Optional throwable information to include
- * in the logging event.
- * @param LoggerLevel $level log level
- * @param mixed $message message to log
- */
- public function forcedLog($fqcn, $throwable, LoggerLevel $level, $message) {
- $event = new LoggerLoggingEvent($fqcn, $this, $level, $message, null, $throwable);
- $this->callAppenders($event);
-
- // Forward the event upstream if additivity is turned on
- if (isset($this->parent) && $this->getAdditivity()) {
- $this->parent->logEvent($event);
- }
- }
-
- /**
- * Forwards the given logging event to all linked appenders.
- * @param LoggerLoggingEvent $event
- */
- public function callAppenders($event) {
- foreach ($this->appenders as $appender) {
- $appender->doAppend($event);
- }
- }
-
- // ******************************************
- // *** Checker methods ***
- // ******************************************
-
- /**
- * Check whether this Logger is enabled for a given Level passed as parameter.
- *
- * @param LoggerLevel level
- * @return boolean
- */
- public function isEnabledFor(LoggerLevel $level) {
- return $level->isGreaterOrEqual($this->getEffectiveLevel());
- }
-
- /**
- * Check whether this Logger is enabled for the TRACE Level.
- * @return boolean
- */
- public function isTraceEnabled() {
- return $this->isEnabledFor(LoggerLevel::getLevelTrace());
- }
-
- /**
- * Check whether this Logger is enabled for the DEBUG Level.
- * @return boolean
- */
- public function isDebugEnabled() {
- return $this->isEnabledFor(LoggerLevel::getLevelDebug());
- }
-
- /**
- * Check whether this Logger is enabled for the INFO Level.
- * @return boolean
- */
- public function isInfoEnabled() {
- return $this->isEnabledFor(LoggerLevel::getLevelInfo());
- }
-
- /**
- * Check whether this Logger is enabled for the WARN Level.
- * @return boolean
- */
- public function isWarnEnabled() {
- return $this->isEnabledFor(LoggerLevel::getLevelWarn());
- }
-
- /**
- * Check whether this Logger is enabled for the ERROR Level.
- * @return boolean
- */
- public function isErrorEnabled() {
- return $this->isEnabledFor(LoggerLevel::getLevelError());
- }
-
- /**
- * Check whether this Logger is enabled for the FATAL Level.
- * @return boolean
- */
- public function isFatalEnabled() {
- return $this->isEnabledFor(LoggerLevel::getLevelFatal());
- }
-
- // ******************************************
- // *** Configuration methods ***
- // ******************************************
-
- /**
- * Adds a new appender to the Logger.
- * @param LoggerAppender $appender The appender to add.
- */
- public function addAppender($appender) {
- $appenderName = $appender->getName();
- $this->appenders[$appenderName] = $appender;
- }
-
- /** Removes all appenders from the Logger. */
- public function removeAllAppenders() {
- foreach ($this->appenders as $name => $appender) {
- $this->removeAppender($name);
- }
- }
-
- /**
- * Remove the appender passed as parameter form the Logger.
- * @param mixed $appender an appender name or a {@link LoggerAppender} instance.
- */
- public function removeAppender($appender) {
- if ($appender instanceof LoggerAppender) {
- $appender->close();
- unset($this->appenders[$appender->getName()]);
- } else if (is_string($appender) and isset($this->appenders[$appender])) {
- $this->appenders[$appender]->close();
- unset($this->appenders[$appender]);
- }
- }
-
- /**
- * Returns the appenders linked to this logger as an array.
- * @return array collection of appender names
- */
- public function getAllAppenders() {
- return $this->appenders;
- }
-
- /**
- * Returns a linked appender by name.
- * @return LoggerAppender
- */
- public function getAppender($name) {
- return $this->appenders[$name];
- }
-
- /**
- * Sets the additivity flag.
- * @param boolean $additive
- */
- public function setAdditivity($additive) {
- $this->additive = (bool)$additive;
- }
-
- /**
- * Returns the additivity flag.
- * @return boolean
- */
- public function getAdditivity() {
- return $this->additive;
- }
-
- /**
- * Starting from this Logger, search the Logger hierarchy for a non-null level and return it.
- * @see LoggerLevel
- * @return LoggerLevel or null
- */
- public function getEffectiveLevel() {
- for ($logger = $this; $logger !== null; $logger = $logger->getParent()) {
- if ($logger->getLevel() !== null) {
- return $logger->getLevel();
- }
- }
- }
-
- /**
- * Get the assigned Logger level.
- * @return LoggerLevel The assigned level or null if none is assigned.
- */
- public function getLevel() {
- return $this->level;
- }
-
- /**
- * Set the Logger level.
- *
- * Use LoggerLevel::getLevelXXX() methods to get a LoggerLevel object, e.g.
- * $logger->setLevel(LoggerLevel::getLevelInfo());
- *
- * @param LoggerLevel $level The level to set, or NULL to clear the logger level.
- */
- public function setLevel(LoggerLevel $level = null) {
- $this->level = $level;
- }
-
- /**
- * Checks whether an appender is attached to this logger instance.
- *
- * @param LoggerAppender $appender
- * @return boolean
- */
- public function isAttached(LoggerAppender $appender) {
- return isset($this->appenders[$appender->getName()]);
- }
-
- /**
- * Sets the parent logger.
- * @param Logger $logger
- */
- public function setParent(Logger $logger) {
- $this->parent = $logger;
- }
-
- // ******************************************
- // *** Static methods and properties ***
- // ******************************************
-
- /** The logger hierarchy used by log4php. */
- private static $hierarchy;
-
- /** Inidicates if log4php has been initialized */
- private static $initialized = false;
-
- /**
- * Returns the hierarchy used by this Logger.
- *
- * Caution: do not use this hierarchy unless you have called initialize().
- * To get Loggers, use the Logger::getLogger and Logger::getRootLogger
- * methods instead of operating on on the hierarchy directly.
- *
- * @return LoggerHierarchy
- */
- public static function getHierarchy() {
- if (!isset(self::$hierarchy)) {
- self::$hierarchy = new LoggerHierarchy(new LoggerRoot());
- }
- return self::$hierarchy;
- }
-
- /**
- * Returns a Logger by name. If it does not exist, it will be created.
- *
- * @param string $name The logger name
- * @return Logger
- */
- public static function getLogger($name) {
- if (!self::isInitialized()) {
- self::configure();
- }
- return self::getHierarchy()->getLogger($name);
- }
-
- /**
- * Returns the Root Logger.
- * @return LoggerRoot
- */
- public static function getRootLogger() {
- if (!self::isInitialized()) {
- self::configure();
- }
- return self::getHierarchy()->getRootLogger();
- }
-
- /**
- * Clears all Logger definitions from the logger hierarchy.
- * @return boolean
- */
- public static function clear() {
- return self::getHierarchy()->clear();
- }
-
- /**
- * Destroy configurations for logger definitions
- */
- public static function resetConfiguration() {
- self::getHierarchy()->resetConfiguration();
- self::getHierarchy()->clear(); // TODO: clear or not?
- self::$initialized = false;
- }
-
- /**
- * Safely close all appenders.
- * @deprecated This is no longer necessary due the appenders shutdown via
- * destructors.
- */
- public static function shutdown() {
- return self::getHierarchy()->shutdown();
- }
-
- /**
- * check if a given logger exists.
- *
- * @param string $name logger name
- * @return boolean
- */
- public static function exists($name) {
- return self::getHierarchy()->exists($name);
- }
-
- /**
- * Returns an array this whole Logger instances.
- * @see Logger
- * @return array
- */
- public static function getCurrentLoggers() {
- return self::getHierarchy()->getCurrentLoggers();
- }
-
- /**
- * Configures log4php.
- *
- * This method needs to be called before the first logging event has
- * occured. If this method is not called before then the default
- * configuration will be used.
- *
- * @param string|array $configuration Either a path to the configuration
- * file, or a configuration array.
- *
- * @param string|LoggerConfigurator $configurator A custom
- * configurator class: either a class name (string), or an object which
- * implements the LoggerConfigurator interface. If left empty, the default
- * configurator implementation will be used.
- */
- public static function configure($configuration = null, $configurator = null) {
- self::resetConfiguration();
- $configurator = self::getConfigurator($configurator);
- $configurator->configure(self::getHierarchy(), $configuration);
- self::$initialized = true;
- }
-
- /**
- * Creates a logger configurator instance based on the provided
- * configurator class. If no class is given, returns an instance of
- * the default configurator.
- *
- * @param string|LoggerConfigurator $configurator The configurator class
- * or LoggerConfigurator instance.
- */
- private static function getConfigurator($configurator = null) {
- if ($configurator === null) {
- return new LoggerConfiguratorDefault();
- }
-
- if (is_object($configurator)) {
- if ($configurator instanceof LoggerConfigurator) {
- return $configurator;
- } else {
- trigger_error("log4php: Given configurator object [$configurator] does not implement the LoggerConfigurator interface. Reverting to default configurator.", E_USER_WARNING);
- return new LoggerConfiguratorDefault();
- }
- }
-
- if (is_string($configurator)) {
- if (!class_exists($configurator)) {
- trigger_error("log4php: Specified configurator class [$configurator] does not exist. Reverting to default configurator.", E_USER_WARNING);
- return new LoggerConfiguratorDefault();
- }
-
- $instance = new $configurator();
-
- if (!($instance instanceof LoggerConfigurator)) {
- trigger_error("log4php: Specified configurator class [$configurator] does not implement the LoggerConfigurator interface. Reverting to default configurator.", E_USER_WARNING);
- return new LoggerConfiguratorDefault();
- }
-
- return $instance;
- }
-
- trigger_error("log4php: Invalid configurator specified. Expected either a string or a LoggerConfigurator instance. Reverting to default configurator.", E_USER_WARNING);
- return new LoggerConfiguratorDefault();
- }
-
- /**
- * Returns true if the log4php framework has been initialized.
- * @return boolean
- */
- private static function isInitialized() {
- return self::$initialized;
- }
-}
diff --git a/library/log4php/LoggerAppender.php b/library/log4php/LoggerAppender.php
deleted file mode 100644
--- a/library/log4php/LoggerAppender.php
+++ /dev/null
@@ -1,289 +0,0 @@
-name = $name;
-
- if ($this->requiresLayout) {
- $this->layout = $this->getDefaultLayout();
- }
- }
-
- public function __destruct() {
- $this->close();
- }
-
- /**
- * Returns the default layout for this appender. Can be overriden by
- * derived appenders.
- *
- * @return LoggerLayout
- */
- public function getDefaultLayout() {
- return new LoggerLayoutSimple();
- }
-
- /**
- * Adds a filter to the end of the filter chain.
- * @param LoggerFilter $filter add a new LoggerFilter
- */
- public function addFilter($filter) {
- if ($this->filter === null) {
- $this->filter = $filter;
- } else {
- $this->filter->addNext($filter);
- }
- }
-
- /**
- * Clears the filter chain by removing all the filters in it.
- */
- public function clearFilters() {
- $this->filter = null;
- }
-
- /**
- * Returns the first filter in the filter chain.
- * The return value may be null if no is filter is set.
- * @return LoggerFilter
- */
- public function getFilter() {
- return $this->filter;
- }
-
- /**
- * Returns the first filter in the filter chain.
- * The return value may be null if no is filter is set.
- * @return LoggerFilter
- */
- public function getFirstFilter() {
- return $this->filter;
- }
-
- /**
- * Performs threshold checks and invokes filters before delegating logging
- * to the subclass' specific append() method.
- * @see LoggerAppender::append()
- * @param LoggerLoggingEvent $event
- */
- public function doAppend(LoggerLoggingEvent $event) {
- if ($this->closed) {
- return;
- }
-
- if (!$this->isAsSevereAsThreshold($event->getLevel())) {
- return;
- }
-
- $filter = $this->getFirstFilter();
- while ($filter !== null) {
- switch ($filter->decide($event)) {
- case LoggerFilter::DENY:
- return;
- case LoggerFilter::ACCEPT:
- return $this->append($event);
- case LoggerFilter::NEUTRAL:
- $filter = $filter->getNext();
- }
- }
- $this->append($event);
- }
-
- /**
- * Sets the appender layout.
- * @param LoggerLayout $layout
- */
- public function setLayout($layout) {
- if ($this->requiresLayout()) {
- $this->layout = $layout;
- }
- }
-
- /**
- * Returns the appender layout.
- * @return LoggerLayout
- */
- public function getLayout() {
- return $this->layout;
- }
-
- /**
- * Configurators call this method to determine if the appender
- * requires a layout.
- *
- *
If this method returns true, meaning that layout is required,
- * then the configurator will configure a layout using the configuration
- * information at its disposal. If this method returns false,
- * meaning that a layout is not required, then layout configuration will be
- * skipped even if there is available layout configuration
- * information at the disposal of the configurator.
- *
- *
In the rather exceptional case, where the appender
- * implementation admits a layout but can also work without it, then
- * the appender should return true.
- *
- * @return boolean
- */
- public function requiresLayout() {
- return $this->requiresLayout;
- }
-
- /**
- * Retruns the appender name.
- * @return string
- */
- public function getName() {
- return $this->name;
- }
-
- /**
- * Sets the appender name.
- * @param string $name
- */
- public function setName($name) {
- $this->name = $name;
- }
-
- /**
- * Returns the appender's threshold level.
- * @return LoggerLevel
- */
- public function getThreshold() {
- return $this->threshold;
- }
-
- /**
- * Sets the appender threshold.
- *
- * @param LoggerLevel|string $threshold Either a {@link LoggerLevel}
- * object or a string equivalent.
- * @see LoggerOptionConverter::toLevel()
- */
- public function setThreshold($threshold) {
- $this->setLevel('threshold', $threshold);
- }
-
- /**
- * Checks whether the message level is below the appender's threshold.
- *
- * If there is no threshold set, then the return value is always true.
- *
- * @param LoggerLevel $level
- * @return boolean Returns true if level is greater or equal than
- * threshold, or if the threshold is not set. Otherwise returns false.
- */
- public function isAsSevereAsThreshold($level) {
- if ($this->threshold === null) {
- return true;
- }
- return $level->isGreaterOrEqual($this->getThreshold());
- }
-
- /**
- * Prepares the appender for logging.
- *
- * Derived appenders should override this method if option structure
- * requires it.
- */
- public function activateOptions() {
- $this->closed = false;
- }
-
- /**
- * Forwards the logging event to the destination.
- *
- * Derived appenders should implement this method to perform actual logging.
- *
- * @param LoggerLoggingEvent $event
- */
- abstract protected function append(LoggerLoggingEvent $event);
-
- /**
- * Releases any resources allocated by the appender.
- *
- * Derived appenders should override this method to perform proper closing
- * procedures.
- */
- public function close() {
- $this->closed = true;
- }
-
- /** Triggers a warning for this logger with the given message. */
- protected function warn($message) {
- $id = get_class($this) . (empty($this->name) ? '' : ":{$this->name}");
- trigger_error("log4php: [$id]: $message", E_USER_WARNING);
- }
-
-}
diff --git a/library/log4php/LoggerAppenderPool.php b/library/log4php/LoggerAppenderPool.php
deleted file mode 100644
--- a/library/log4php/LoggerAppenderPool.php
+++ /dev/null
@@ -1,98 +0,0 @@
-getName();
-
- if (empty($name)) {
- trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING);
- return;
- }
-
- if (isset(self::$appenders[$name])) {
- trigger_error("log4php: Appender [$name] already exists in pool. Overwriting existing appender.", E_USER_WARNING);
- }
-
- self::$appenders[$name] = $appender;
- }
-
- /**
- * Retrieves an appender from the pool by name.
- * @param string $name Name of the appender to retrieve.
- * @return LoggerAppender The named appender or NULL if no such appender
- * exists in the pool.
- */
- public static function get($name) {
- return isset(self::$appenders[$name]) ? self::$appenders[$name] : null;
- }
-
- /**
- * Removes an appender from the pool by name.
- * @param string $name Name of the appender to remove.
- */
- public static function delete($name) {
- unset(self::$appenders[$name]);
- }
-
- /**
- * Returns all appenders from the pool.
- * @return array Array of LoggerAppender objects.
- */
- public static function getAppenders() {
- return self::$appenders;
- }
-
- /**
- * Checks whether an appender exists in the pool.
- * @param string $name Name of the appender to look for.
- * @return boolean TRUE if the appender with the given name exists.
- */
- public static function exists($name) {
- return isset(self::$appenders[$name]);
- }
-
- /**
- * Clears all appenders from the pool.
- */
- public static function clear() {
- self::$appenders = array();
- }
-}
\ No newline at end of file
diff --git a/library/log4php/LoggerAutoloader.php b/library/log4php/LoggerAutoloader.php
deleted file mode 100644
--- a/library/log4php/LoggerAutoloader.php
+++ /dev/null
@@ -1,142 +0,0 @@
- '/LoggerAppender.php',
- 'LoggerAppenderPool' => '/LoggerAppenderPool.php',
- 'LoggerConfigurable' => '/LoggerConfigurable.php',
- 'LoggerConfigurator' => '/LoggerConfigurator.php',
- 'LoggerException' => '/LoggerException.php',
- 'LoggerFilter' => '/LoggerFilter.php',
- 'LoggerHierarchy' => '/LoggerHierarchy.php',
- 'LoggerLevel' => '/LoggerLevel.php',
- 'LoggerLocationInfo' => '/LoggerLocationInfo.php',
- 'LoggerLoggingEvent' => '/LoggerLoggingEvent.php',
- 'LoggerMDC' => '/LoggerMDC.php',
- 'LoggerNDC' => '/LoggerNDC.php',
- 'LoggerLayout' => '/LoggerLayout.php',
- 'LoggerReflectionUtils' => '/LoggerReflectionUtils.php',
- 'LoggerRoot' => '/LoggerRoot.php',
- 'LoggerThrowableInformation' => '/LoggerThrowableInformation.php',
-
- // Appenders
- 'LoggerAppenderConsole' => '/appenders/LoggerAppenderConsole.php',
- 'LoggerAppenderDailyFile' => '/appenders/LoggerAppenderDailyFile.php',
- 'LoggerAppenderEcho' => '/appenders/LoggerAppenderEcho.php',
- 'LoggerAppenderFile' => '/appenders/LoggerAppenderFile.php',
- 'LoggerAppenderMail' => '/appenders/LoggerAppenderMail.php',
- 'LoggerAppenderMailEvent' => '/appenders/LoggerAppenderMailEvent.php',
- 'LoggerAppenderMongoDB' => '/appenders/LoggerAppenderMongoDB.php',
- 'LoggerAppenderNull' => '/appenders/LoggerAppenderNull.php',
- 'LoggerAppenderFirePHP' => '/appenders/LoggerAppenderFirePHP.php',
- 'LoggerAppenderPDO' => '/appenders/LoggerAppenderPDO.php',
- 'LoggerAppenderPhp' => '/appenders/LoggerAppenderPhp.php',
- 'LoggerAppenderRollingFile' => '/appenders/LoggerAppenderRollingFile.php',
- 'LoggerAppenderSocket' => '/appenders/LoggerAppenderSocket.php',
- 'LoggerAppenderSyslog' => '/appenders/LoggerAppenderSyslog.php',
-
- // Configurators
- 'LoggerConfigurationAdapter' => '/configurators/LoggerConfigurationAdapter.php',
- 'LoggerConfigurationAdapterINI' => '/configurators/LoggerConfigurationAdapterINI.php',
- 'LoggerConfigurationAdapterPHP' => '/configurators/LoggerConfigurationAdapterPHP.php',
- 'LoggerConfigurationAdapterXML' => '/configurators/LoggerConfigurationAdapterXML.php',
- 'LoggerConfiguratorDefault' => '/configurators/LoggerConfiguratorDefault.php',
-
- // Filters
- 'LoggerFilterDenyAll' => '/filters/LoggerFilterDenyAll.php',
- 'LoggerFilterLevelMatch' => '/filters/LoggerFilterLevelMatch.php',
- 'LoggerFilterLevelRange' => '/filters/LoggerFilterLevelRange.php',
- 'LoggerFilterStringMatch' => '/filters/LoggerFilterStringMatch.php',
-
- // Helpers
- 'LoggerFormattingInfo' => '/helpers/LoggerFormattingInfo.php',
- 'LoggerOptionConverter' => '/helpers/LoggerOptionConverter.php',
- 'LoggerPatternParser' => '/helpers/LoggerPatternParser.php',
- 'LoggerUtils' => '/helpers/LoggerUtils.php',
-
- // Pattern converters
- 'LoggerPatternConverter' => '/pattern/LoggerPatternConverter.php',
- 'LoggerPatternConverterClass' => '/pattern/LoggerPatternConverterClass.php',
- 'LoggerPatternConverterCookie' => '/pattern/LoggerPatternConverterCookie.php',
- 'LoggerPatternConverterDate' => '/pattern/LoggerPatternConverterDate.php',
- 'LoggerPatternConverterEnvironment' => '/pattern/LoggerPatternConverterEnvironment.php',
- 'LoggerPatternConverterFile' => '/pattern/LoggerPatternConverterFile.php',
- 'LoggerPatternConverterLevel' => '/pattern/LoggerPatternConverterLevel.php',
- 'LoggerPatternConverterLine' => '/pattern/LoggerPatternConverterLine.php',
- 'LoggerPatternConverterLiteral' => '/pattern/LoggerPatternConverterLiteral.php',
- 'LoggerPatternConverterLocation' => '/pattern/LoggerPatternConverterLocation.php',
- 'LoggerPatternConverterLogger' => '/pattern/LoggerPatternConverterLogger.php',
- 'LoggerPatternConverterMDC' => '/pattern/LoggerPatternConverterMDC.php',
- 'LoggerPatternConverterMessage' => '/pattern/LoggerPatternConverterMessage.php',
- 'LoggerPatternConverterMethod' => '/pattern/LoggerPatternConverterMethod.php',
- 'LoggerPatternConverterNDC' => '/pattern/LoggerPatternConverterNDC.php',
- 'LoggerPatternConverterNewLine' => '/pattern/LoggerPatternConverterNewLine.php',
- 'LoggerPatternConverterProcess' => '/pattern/LoggerPatternConverterProcess.php',
- 'LoggerPatternConverterRelative' => '/pattern/LoggerPatternConverterRelative.php',
- 'LoggerPatternConverterRequest' => '/pattern/LoggerPatternConverterRequest.php',
- 'LoggerPatternConverterServer' => '/pattern/LoggerPatternConverterServer.php',
- 'LoggerPatternConverterSession' => '/pattern/LoggerPatternConverterSession.php',
- 'LoggerPatternConverterSessionID' => '/pattern/LoggerPatternConverterSessionID.php',
- 'LoggerPatternConverterSuperglobal' => '/pattern/LoggerPatternConverterSuperglobal.php',
- 'LoggerPatternConverterThrowable' => '/pattern/LoggerPatternConverterThrowable.php',
-
- // Layouts
- 'LoggerLayoutHtml' => '/layouts/LoggerLayoutHtml.php',
- 'LoggerLayoutPattern' => '/layouts/LoggerLayoutPattern.php',
- 'LoggerLayoutSerialized' => '/layouts/LoggerLayoutSerialized.php',
- 'LoggerLayoutSimple' => '/layouts/LoggerLayoutSimple.php',
- 'LoggerLayoutTTCC' => '/layouts/LoggerLayoutTTCC.php',
- 'LoggerLayoutXml' => '/layouts/LoggerLayoutXml.php',
-
- // Renderers
- 'LoggerRendererDefault' => '/renderers/LoggerRendererDefault.php',
- 'LoggerRendererException' => '/renderers/LoggerRendererException.php',
- 'LoggerRendererMap' => '/renderers/LoggerRendererMap.php',
- 'LoggerRenderer' => '/renderers/LoggerRenderer.php',
- );
-
- /**
- * Loads a class.
- * @param string $className The name of the class to load.
- */
- public static function autoload($className) {
- if (isset(self::$classes[$className])) {
- include dirname(__FILE__) . self::$classes[$className];
- }
- }
-}
diff --git a/library/log4php/LoggerConfigurable.php b/library/log4php/LoggerConfigurable.php
deleted file mode 100644
--- a/library/log4php/LoggerConfigurable.php
+++ /dev/null
@@ -1,116 +0,0 @@
-$property = LoggerOptionConverter::toBooleanEx($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected a boolean value. Property not changed.");
- }
- }
-
- /** Setter function for integer type. */
- protected function setInteger($property, $value) {
- try {
- $this->$property = LoggerOptionConverter::toIntegerEx($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected an integer. Property not changed.");
- }
- }
-
- /** Setter function for LoggerLevel values. */
- protected function setLevel($property, $value) {
- try {
- $this->$property = LoggerOptionConverter::toLevelEx($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected a level value. Property not changed.");
- }
- }
-
- /** Setter function for integer type. */
- protected function setPositiveInteger($property, $value) {
- try {
- $this->$property = LoggerOptionConverter::toPositiveIntegerEx($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected a positive integer. Property not changed.");
- }
- }
-
- /** Setter for file size. */
- protected function setFileSize($property, $value) {
- try {
- $this->$property = LoggerOptionConverter::toFileSizeEx($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected a file size value. Property not changed.");
- }
- }
-
- /** Setter function for numeric type. */
- protected function setNumeric($property, $value) {
- try {
- $this->$property = LoggerOptionConverter::toNumericEx($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected a number. Property not changed.");
- }
- }
-
- /** Setter function for string type. */
- protected function setString($property, $value, $nullable = false) {
- if ($value === null) {
- if ($nullable) {
- $this->$property = null;
- } else {
- $this->warn("Null value given for '$property' property. Expected a string. Property not changed.");
- }
- } else {
- try {
- $value = LoggerOptionConverter::toStringEx($value);
- $this->$property = LoggerOptionConverter::substConstants($value);
- } catch (Exception $ex) {
- $value = var_export($value, true);
- $this->warn("Invalid value given for '$property' property: [$value]. Expected a string. Property not changed.");
- }
- }
- }
-
- /** Triggers a warning. */
- protected function warn($message) {
- $class = get_class($this);
- trigger_error("log4php: $class: $message", E_USER_WARNING);
- }
-}
diff --git a/library/log4php/LoggerConfigurator.php b/library/log4php/LoggerConfigurator.php
deleted file mode 100644
--- a/library/log4php/LoggerConfigurator.php
+++ /dev/null
@@ -1,41 +0,0 @@
-This abstract class assumes and also imposes that filters be
- * organized in a linear chain. The {@link #decide
- * decide(LoggerLoggingEvent)} method of each filter is called sequentially,
- * in the order of their addition to the chain.
- *
- *
The {@link decide()} method must return one
- * of the integer constants {@link LoggerFilter::DENY},
- * {@link LoggerFilter::NEUTRAL} or {@link LoggerFilter::ACCEPT}.
- *
- *
If the value {@link LoggerFilter::DENY} is returned, then the log event is
- * dropped immediately without consulting with the remaining
- * filters.
- *
- *
If the value {@link LoggerFilter::NEUTRAL} is returned, then the next filter
- * in the chain is consulted. If there are no more filters in the
- * chain, then the log event is logged. Thus, in the presence of no
- * filters, the default behaviour is to log all logging events.
- *
- *
If the value {@link LoggerFilter::ACCEPT} is returned, then the log
- * event is logged without consulting the remaining filters.
- *
- *
The philosophy of log4php filters is largely inspired from the
- * Linux ipchains.
- *
- * @version $Revision: 1213283 $
- * @package log4php
- */
-abstract class LoggerFilter extends LoggerConfigurable {
-
- /**
- * The log event must be logged immediately without consulting with
- * the remaining filters, if any, in the chain.
- */
- const ACCEPT = 1;
-
- /**
- * This filter is neutral with respect to the log event. The
- * remaining filters, if any, should be consulted for a final decision.
- */
- const NEUTRAL = 0;
-
- /**
- * The log event must be dropped immediately without consulting
- * with the remaining filters, if any, in the chain.
- */
- const DENY = -1;
-
- /**
- * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain.
- */
- protected $next;
-
- /**
- * Usually filters options become active when set. We provide a
- * default do-nothing implementation for convenience.
- */
- public function activateOptions() {
- }
-
- /**
- * Decide what to do.
- *
If the decision is {@link LoggerFilter::DENY}, then the event will be
- * dropped. If the decision is {@link LoggerFilter::NEUTRAL}, then the next
- * filter, if any, will be invoked. If the decision is {@link LoggerFilter::ACCEPT} then
- * the event will be logged without consulting with other filters in
- * the chain.
- *
- * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon.
- * @return integer {@link LoggerFilter::NEUTRAL} or {@link LoggerFilter::DENY}|{@link LoggerFilter::ACCEPT}
- */
- public function decide(LoggerLoggingEvent $event) {
- return self::NEUTRAL;
- }
-
- /**
- * Adds a new filter to the filter chain this filter is a part of.
- * If this filter has already and follow up filter, the param filter
- * is passed on until it is the last filter in chain.
- *
- * @param $filter - the filter to add to this chain
- */
- public function addNext($filter) {
- if ($this->next !== null) {
- $this->next->addNext($filter);
- } else {
- $this->next = $filter;
- }
- }
-
- /**
- * Returns the next filter in this chain
- * @return the next filter
- */
- public function getNext() {
- return $this->next;
- }
-
-}
diff --git a/library/log4php/LoggerHierarchy.php b/library/log4php/LoggerHierarchy.php
deleted file mode 100644
--- a/library/log4php/LoggerHierarchy.php
+++ /dev/null
@@ -1,257 +0,0 @@
-The casual user does not have to deal with this class directly.
- *
- *
The structure of the logger hierarchy is maintained by the
- * getLogger method. The hierarchy is such that children link
- * to their parent but parents do not have any pointers to their
- * children. Moreover, loggers can be instantiated in any order, in
- * particular descendant before ancestor.
- *
- *
In case a descendant is created before a particular ancestor,
- * then it creates a provision node for the ancestor and adds itself
- * to the provision node. Other descendants of the same ancestor add
- * themselves to the previously created provision node.
- *
- * @version $Revision: 1394956 $
- * @package log4php
- */
-class LoggerHierarchy {
-
- /** Array holding all Logger instances. */
- protected $loggers = array();
-
- /**
- * The root logger.
- * @var RootLogger
- */
- protected $root;
-
- /**
- * The logger renderer map.
- * @var LoggerRendererMap
- */
- protected $rendererMap;
-
- /**
- * Main level threshold. Events with lower level will not be logged by any
- * logger, regardless of it's configuration.
- * @var LoggerLevel
- */
- protected $threshold;
-
- /**
- * Creates a new logger hierarchy.
- * @param LoggerRoot $root The root logger.
- */
- public function __construct(LoggerRoot $root) {
- $this->root = $root;
- $this->setThreshold(LoggerLevel::getLevelAll());
- $this->rendererMap = new LoggerRendererMap();
- }
-
- /**
- * Clears all loggers.
- */
- public function clear() {
- $this->loggers = array();
- }
-
- /**
- * Check if the named logger exists in the hierarchy.
- * @param string $name
- * @return boolean
- */
- public function exists($name) {
- return isset($this->loggers[$name]);
- }
-
- /**
- * Returns all the currently defined loggers in this hierarchy as an array.
- * @return array
- */
- public function getCurrentLoggers() {
- return array_values($this->loggers);
- }
-
- /**
- * Returns a named logger instance logger. If it doesn't exist, one is created.
- *
- * @param string $name Logger name
- * @return Logger Logger instance.
- */
- public function getLogger($name) {
- if (!isset($this->loggers[$name])) {
- $logger = new Logger($name);
-
- $nodes = explode('.', $name);
- $firstNode = array_shift($nodes);
-
- // if name is not a first node but another first node is their
- if ($firstNode != $name and isset($this->loggers[$firstNode])) {
- $logger->setParent($this->loggers[$firstNode]);
- } else {
- // if there is no father, set root logger as father
- $logger->setParent($this->root);
- }
-
- // if there are more nodes than one
- if (count($nodes) > 0) {
- // find parent node
- foreach ($nodes as $node) {
- $parentNode = "$firstNode.$node";
- if (isset($this->loggers[$parentNode]) and $parentNode != $name) {
- $logger->setParent($this->loggers[$parentNode]);
- }
- $firstNode .= ".$node";
- }
- }
-
- $this->loggers[$name] = $logger;
- }
-
- return $this->loggers[$name];
- }
-
- /**
- * Returns the logger renderer map.
- * @return LoggerRendererMap
- */
- public function getRendererMap() {
- return $this->rendererMap;
- }
-
- /**
- * Returns the root logger.
- * @return LoggerRoot
- */
- public function getRootLogger() {
- return $this->root;
- }
-
- /**
- * Returns the main threshold level.
- * @return LoggerLevel
- */
- public function getThreshold() {
- return $this->threshold;
- }
-
- /**
- * Returns true if the hierarchy is disabled for given log level and false
- * otherwise.
- * @return boolean
- */
- public function isDisabled(LoggerLevel $level) {
- return ($this->threshold->toInt() > $level->toInt());
- }
-
- /**
- * Reset all values contained in this hierarchy instance to their
- * default.
- *
- * This removes all appenders from all loggers, sets
- * the level of all non-root loggers to null,
- * sets their additivity flag to true and sets the level
- * of the root logger to {@link LOGGER_LEVEL_DEBUG}.
- *
- *
Existing loggers are not removed. They are just reset.
- *
- *
This method should be used sparingly and with care as it will
- * block all logging until it is completed.
- */
- public function resetConfiguration() {
- $root = $this->getRootLogger();
-
- $root->setLevel(LoggerLevel::getLevelDebug());
- $this->setThreshold(LoggerLevel::getLevelAll());
- $this->shutDown();
-
- foreach ($this->loggers as $logger) {
- $logger->setLevel(null);
- $logger->setAdditivity(true);
- $logger->removeAllAppenders();
- }
-
- $this->rendererMap->reset();
- LoggerAppenderPool::clear();
- }
-
- /**
- * Sets the main threshold level.
- * @param LoggerLevel $l
- */
- public function setThreshold(LoggerLevel $threshold) {
- $this->threshold = $threshold;
- }
-
- /**
- * Shutting down a hierarchy will safely close and remove
- * all appenders in all loggers including the root logger.
- *
- * The shutdown method is careful to close nested
- * appenders before closing regular appenders. This is allows
- * configurations where a regular appender is attached to a logger
- * and again to a nested appender.
- *
- * @todo Check if the last paragraph is correct.
- */
- public function shutdown() {
- $this->root->removeAllAppenders();
-
- foreach ($this->loggers as $logger) {
- $logger->removeAllAppenders();
- }
- }
-
- /**
- * Prints the current Logger hierarchy tree. Useful for debugging.
- */
- public function printHierarchy() {
- $this->printHierarchyInner($this->getRootLogger(), 0);
- }
-
- private function printHierarchyInner(Logger $current, $level) {
- for ($i = 0; $i < $level; $i++) {
- echo ($i == $level - 1) ? "|--" : "| ";
- }
- echo $current->getName() . "\n";
-
- foreach ($this->loggers as $logger) {
- if ($logger->getParent() == $current) {
- $this->printHierarchyInner($logger, $level + 1);
- }
- }
- }
-}
diff --git a/library/log4php/LoggerLayout.php b/library/log4php/LoggerLayout.php
deleted file mode 100644
--- a/library/log4php/LoggerLayout.php
+++ /dev/null
@@ -1,74 +0,0 @@
-getRenderedMessage();
- }
-
- /**
- * Returns the content type output by this layout.
- * @return string
- */
- public function getContentType() {
- return "text/plain";
- }
-
- /**
- * Returns the footer for the layout format.
- * @return string
- */
- public function getFooter() {
- return null;
- }
-
- /**
- * Returns the header for the layout format.
- * @return string
- */
- public function getHeader() {
- return null;
- }
-
- /** Triggers a warning for this layout with the given message. */
- protected function warn($message) {
- trigger_error("log4php: [" . get_class($this) . "]: $message", E_USER_WARNING);
- }
-}
diff --git a/library/log4php/LoggerLevel.php b/library/log4php/LoggerLevel.php
deleted file mode 100644
--- a/library/log4php/LoggerLevel.php
+++ /dev/null
@@ -1,274 +0,0 @@
-OFF, FATAL, ERROR,
- * WARN, INFO, DEBUG and
- * ALL.
- *
- *
The LoggerLevel class may be subclassed to define a larger
- * level set.
- *
- * @version $Revision: 1379729 $
- * @package log4php
- * @since 0.5
- */
-class LoggerLevel {
-
- const OFF = 2147483647;
- const FATAL = 50000;
- const ERROR = 40000;
- const WARN = 30000;
- const INFO = 20000;
- const DEBUG = 10000;
- const TRACE = 5000;
- const ALL = -2147483647;
-
- /** Integer level value. */
- private $level;
-
- /** Contains a list of instantiated levels. */
- private static $levelMap;
-
- /** String representation of the level. */
- private $levelStr;
-
- /**
- * Equivalent syslog level.
- * @var integer
- */
- private $syslogEquivalent;
-
- /**
- * Constructor
- *
- * @param integer $level
- * @param string $levelStr
- * @param integer $syslogEquivalent
- */
- private function __construct($level, $levelStr, $syslogEquivalent) {
- $this->level = $level;
- $this->levelStr = $levelStr;
- $this->syslogEquivalent = $syslogEquivalent;
- }
-
- /**
- * Compares two logger levels.
- *
- * @param LoggerLevels $other
- * @return boolean
- */
- public function equals($other) {
- if ($other instanceof LoggerLevel) {
- if ($this->level == $other->level) {
- return true;
- }
- } else {
- return false;
- }
- }
-
- /**
- * Returns an Off Level
- * @return LoggerLevel
- */
- public static function getLevelOff() {
- if (!isset(self::$levelMap[LoggerLevel::OFF])) {
- self::$levelMap[LoggerLevel::OFF] = new LoggerLevel(LoggerLevel::OFF, 'OFF', LOG_ALERT);
- }
- return self::$levelMap[LoggerLevel::OFF];
- }
-
- /**
- * Returns a Fatal Level
- * @return LoggerLevel
- */
- public static function getLevelFatal() {
- if (!isset(self::$levelMap[LoggerLevel::FATAL])) {
- self::$levelMap[LoggerLevel::FATAL] = new LoggerLevel(LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
- }
- return self::$levelMap[LoggerLevel::FATAL];
- }
-
- /**
- * Returns an Error Level
- * @return LoggerLevel
- */
- public static function getLevelError() {
- if (!isset(self::$levelMap[LoggerLevel::ERROR])) {
- self::$levelMap[LoggerLevel::ERROR] = new LoggerLevel(LoggerLevel::ERROR, 'ERROR', LOG_ERR);
- }
- return self::$levelMap[LoggerLevel::ERROR];
- }
-
- /**
- * Returns a Warn Level
- * @return LoggerLevel
- */
- public static function getLevelWarn() {
- if (!isset(self::$levelMap[LoggerLevel::WARN])) {
- self::$levelMap[LoggerLevel::WARN] = new LoggerLevel(LoggerLevel::WARN, 'WARN', LOG_WARNING);
- }
- return self::$levelMap[LoggerLevel::WARN];
- }
-
- /**
- * Returns an Info Level
- * @return LoggerLevel
- */
- public static function getLevelInfo() {
- if (!isset(self::$levelMap[LoggerLevel::INFO])) {
- self::$levelMap[LoggerLevel::INFO] = new LoggerLevel(LoggerLevel::INFO, 'INFO', LOG_INFO);
- }
- return self::$levelMap[LoggerLevel::INFO];
- }
-
- /**
- * Returns a Debug Level
- * @return LoggerLevel
- */
- public static function getLevelDebug() {
- if (!isset(self::$levelMap[LoggerLevel::DEBUG])) {
- self::$levelMap[LoggerLevel::DEBUG] = new LoggerLevel(LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
- }
- return self::$levelMap[LoggerLevel::DEBUG];
- }
-
- /**
- * Returns a Trace Level
- * @return LoggerLevel
- */
- public static function getLevelTrace() {
- if (!isset(self::$levelMap[LoggerLevel::TRACE])) {
- self::$levelMap[LoggerLevel::TRACE] = new LoggerLevel(LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
- }
- return self::$levelMap[LoggerLevel::TRACE];
- }
-
- /**
- * Returns an All Level
- * @return LoggerLevel
- */
- public static function getLevelAll() {
- if (!isset(self::$levelMap[LoggerLevel::ALL])) {
- self::$levelMap[LoggerLevel::ALL] = new LoggerLevel(LoggerLevel::ALL, 'ALL', LOG_DEBUG);
- }
- return self::$levelMap[LoggerLevel::ALL];
- }
-
- /**
- * Return the syslog equivalent of this level as an integer.
- * @return integer
- */
- public function getSyslogEquivalent() {
- return $this->syslogEquivalent;
- }
-
- /**
- * Returns true if this level has a higher or equal
- * level than the level passed as argument, false
- * otherwise.
- *
- * @param LoggerLevel $other
- * @return boolean
- */
- public function isGreaterOrEqual($other) {
- return $this->level >= $other->level;
- }
-
- /**
- * Returns the string representation of this level.
- * @return string
- */
- public function toString() {
- return $this->levelStr;
- }
-
- /**
- * Returns the string representation of this level.
- * @return string
- */
- public function __toString() {
- return $this->toString();
- }
-
- /**
- * Returns the integer representation of this level.
- * @return integer
- */
- public function toInt() {
- return $this->level;
- }
-
- /**
- * Convert the input argument to a level. If the conversion fails, then
- * this method returns the provided default level.
- *
- * @param mixed $arg The value to convert to level.
- * @param LoggerLevel $default Value to return if conversion is not possible.
- * @return LoggerLevel
- */
- public static function toLevel($arg, $defaultLevel = null) {
- if (is_int($arg)) {
- switch ($arg) {
- case self::ALL:
- return self::getLevelAll();
- case self::TRACE:
- return self::getLevelTrace();
- case self::DEBUG:
- return self::getLevelDebug();
- case self::INFO:
- return self::getLevelInfo();
- case self::WARN:
- return self::getLevelWarn();
- case self::ERROR:
- return self::getLevelError();
- case self::FATAL:
- return self::getLevelFatal();
- case self::OFF:
- return self::getLevelOff();
- default:
- return $defaultLevel;
- }
- } else {
- switch (strtoupper($arg)) {
- case 'ALL':
- return self::getLevelAll();
- case 'TRACE':
- return self::getLevelTrace();
- case 'DEBUG':
- return self::getLevelDebug();
- case 'INFO':
- return self::getLevelInfo();
- case 'WARN':
- return self::getLevelWarn();
- case 'ERROR':
- return self::getLevelError();
- case 'FATAL':
- return self::getLevelFatal();
- case 'OFF':
- return self::getLevelOff();
- default:
- return $defaultLevel;
- }
- }
- }
-}
diff --git a/library/log4php/LoggerLocationInfo.php b/library/log4php/LoggerLocationInfo.php
deleted file mode 100644
--- a/library/log4php/LoggerLocationInfo.php
+++ /dev/null
@@ -1,103 +0,0 @@
-lineNumber = isset($trace['line']) ? $trace['line'] : null;
- $this->fileName = isset($trace['file']) ? $trace['file'] : null;
- $this->className = isset($trace['class']) ? $trace['class'] : null;
- $this->methodName = isset($trace['function']) ? $trace['function'] : null;
- $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() .
- '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
- }
-
- /** Returns the caller class name. */
- public function getClassName() {
- return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className;
- }
-
- /** Returns the caller file name. */
- public function getFileName() {
- return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName;
- }
-
- /** Returns the caller line number. */
- public function getLineNumber() {
- return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber;
- }
-
- /** Returns the caller method name. */
- public function getMethodName() {
- return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName;
- }
-
- /** Returns the full information of the caller. */
- public function getFullInfo() {
- return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
- }
-
-}
diff --git a/library/log4php/LoggerLoggingEvent.php b/library/log4php/LoggerLoggingEvent.php
deleted file mode 100644
--- a/library/log4php/LoggerLoggingEvent.php
+++ /dev/null
@@ -1,370 +0,0 @@
-fqcn = $fqcn;
- if ($logger instanceof Logger) {
- $this->logger = $logger;
- $this->categoryName = $logger->getName();
- } else {
- $this->categoryName = strval($logger);
- }
- $this->level = $level;
- $this->message = $message;
- if ($timeStamp !== null && is_numeric($timeStamp)) {
- $this->timeStamp = $timeStamp;
- } else {
- $this->timeStamp = microtime(true);
- }
-
- if ($throwable !== null && $throwable instanceof Exception) {
- $this->throwableInfo = new LoggerThrowableInformation($throwable);
- }
- }
-
- /**
- * Returns the full qualified classname.
- * TODO: PHP does contain namespaces in 5.3. Those should be returned too,
- */
- public function getFullQualifiedClassname() {
- return $this->fqcn;
- }
-
- /**
- * Set the location information for this logging event. The collected
- * information is cached for future use.
- *
- *
This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
- * to collect informations about caller.
- *
It only recognize informations generated by {@link Logger} and its subclasses.
- * @return LoggerLocationInfo
- */
- public function getLocationInformation() {
- if ($this->locationInfo === null) {
-
- $locationInfo = array();
- $trace = debug_backtrace();
- $prevHop = null;
- // make a downsearch to identify the caller
- $hop = array_pop($trace);
- while ($hop !== null) {
- if (isset($hop['class'])) {
- // we are sometimes in functions = no class available: avoid php warning here
- $className = strtolower($hop['class']);
- if (!empty($className) and ($className == 'logger' or
- strtolower(get_parent_class($className)) == 'logger')
- ) {
- $locationInfo['line'] = $hop['line'];
- $locationInfo['file'] = $hop['file'];
- break;
- }
- }
- $prevHop = $hop;
- $hop = array_pop($trace);
- }
- $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
- if (isset($prevHop['function']) and
- $prevHop['function'] !== 'include' and
- $prevHop['function'] !== 'include_once' and
- $prevHop['function'] !== 'require' and
- $prevHop['function'] !== 'require_once'
- ) {
-
- $locationInfo['function'] = $prevHop['function'];
- } else {
- $locationInfo['function'] = 'main';
- }
-
- $this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn);
- }
- return $this->locationInfo;
- }
-
- /**
- * Return the level of this event. Use this form instead of directly
- * accessing the {@link $level} field.
- * @return LoggerLevel
- */
- public function getLevel() {
- return $this->level;
- }
-
- /**
- * Returns the logger which created the event.
- * @return Logger
- */
- public function getLogger() {
- return $this->logger;
- }
-
- /**
- * Return the name of the logger. Use this form instead of directly
- * accessing the {@link $categoryName} field.
- * @return string
- */
- public function getLoggerName() {
- return $this->categoryName;
- }
-
- /**
- * Return the message for this logging event.
- * @return mixed
- */
- public function getMessage() {
- return $this->message;
- }
-
- /**
- * This method returns the NDC for this event. It will return the
- * correct content even if the event was generated in a different
- * thread or even on a different machine. The {@link LoggerNDC::get()} method
- * should never be called directly.
- * @return string
- */
- public function getNDC() {
- if ($this->ndcLookupRequired) {
- $this->ndcLookupRequired = false;
- $this->ndc = LoggerNDC::get();
- }
- return $this->ndc;
- }
-
- /**
- * Returns the the context corresponding to the key
- * parameter.
- * @return string
- */
- public function getMDC($key) {
- return LoggerMDC::get($key);
- }
-
- /**
- * Returns the entire MDC context.
- * @return array
- */
- public function getMDCMap() {
- return LoggerMDC::getMap();
- }
-
- /**
- * Render message.
- * @return string
- */
- public function getRenderedMessage() {
- if ($this->renderedMessage === null and $this->message !== null) {
- if (is_string($this->message)) {
- $this->renderedMessage = $this->message;
- } else {
- $rendererMap = Logger::getHierarchy()->getRendererMap();
- $this->renderedMessage = $rendererMap->findAndRender($this->message);
- }
- }
- return $this->renderedMessage;
- }
-
- /**
- * Returns the time when the application started, as a UNIX timestamp
- * with microseconds.
- * @return float
- */
- public static function getStartTime() {
- if (!isset(self::$startTime)) {
- self::$startTime = microtime(true);
- }
- return self::$startTime;
- }
-
- /**
- * @return float
- */
- public function getTimeStamp() {
- return $this->timeStamp;
- }
-
- /**
- * Returns the time in seconds passed from the beginning of execution to
- * the time the event was constructed.
- *
- * @return float Seconds with microseconds in decimals.
- */
- public function getRelativeTime() {
- return $this->timeStamp - self::$startTime;
- }
-
- /**
- * Returns the time in milliseconds passed from the beginning of execution
- * to the time the event was constructed.
- *
- * @deprecated This method has been replaced by getRelativeTime which
- * does not perform unneccesary multiplication and formatting.
- *
- * @return integer
- */
- public function getTime() {
- $eventTime = $this->getTimeStamp();
- $eventStartTime = LoggerLoggingEvent::getStartTime();
- return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
- }
-
- /**
- * @return mixed
- */
- public function getThreadName() {
- if ($this->threadName === null) {
- $this->threadName = (string)getmypid();
- }
- return $this->threadName;
- }
-
- /**
- * @return mixed LoggerThrowableInformation
- */
- public function getThrowableInformation() {
- return $this->throwableInfo;
- }
-
- /**
- * Serialize this object
- * @return string
- */
- public function toString() {
- serialize($this);
- }
-
- /**
- * Avoid serialization of the {@link $logger} object
- */
- public function __sleep() {
- return array(
- 'fqcn',
- 'categoryName',
- 'level',
- 'ndc',
- 'ndcLookupRequired',
- 'message',
- 'renderedMessage',
- 'threadName',
- 'timeStamp',
- 'locationInfo',
- );
- }
-
-}
-
-LoggerLoggingEvent::getStartTime();
diff --git a/library/log4php/LoggerMDC.php b/library/log4php/LoggerMDC.php
deleted file mode 100644
--- a/library/log4php/LoggerMDC.php
+++ /dev/null
@@ -1,88 +0,0 @@
-nested diagnostic contexts.
- *
- * NDC was defined by Neil Harrison in the article "Patterns for Logging
- * Diagnostic Messages" part of the book "Pattern Languages of
- * Program Design 3" edited by Martin et al.
- *
- * A Nested Diagnostic Context, or NDC in short, is an instrument
- * to distinguish interleaved log output from different sources. Log
- * output is typically interleaved when a server handles multiple
- * clients near-simultaneously.
- *
- * This class is similar to the {@link LoggerMDC} class except that it is
- * based on a stack instead of a map.
- *
- * Interleaved log output can still be meaningful if each log entry
- * from different contexts had a distinctive stamp. This is where NDCs
- * come into play.
- *
- * Note that NDCs are managed on a per thread basis.
- *
- * NDC operations such as {@link push()}, {@link pop()},
- * {@link clear()}, {@link getDepth()} and {@link setMaxDepth()}
- * affect the NDC of the current thread only. NDCs of other
- * threads remain unaffected.
- *
- * For example, a servlet can build a per client request NDC
- * consisting the clients host name and other information contained in
- * the the request. Cookies are another source of distinctive
- * information. To build an NDC one uses the {@link push()}
- * operation.
- *
- * Simply put,
- *
- * - Contexts can be nested.
- * - When entering a context, call LoggerNDC::push()
- * As a side effect, if there is no nested diagnostic context for the
- * current thread, this method will create it.
- * - When leaving a context, call LoggerNDC::pop()
- * - When exiting a thread make sure to call {@link remove()}
- *
- * There is no penalty for forgetting to match each
- * push operation with a corresponding pop,
- * except the obvious mismatch between the real application context
- * and the context set in the NDC.
- *
- * If configured to do so, {@link LoggerPatternLayout} and {@link LoggerLayoutTTCC}
- * instances automatically retrieve the nested diagnostic
- * context for the current thread without any user intervention.
- * Hence, even if a servlet is serving multiple clients
- * simultaneously, the logs emanating from the same code (belonging to
- * the same category) can still be distinguished because each client
- * request will have a different NDC tag.
- *
- * Example:
- *
- * {@example ../../examples/php/ndc.php 19}
- *
- * With the properties file:
- *
- * {@example ../../examples/resources/ndc.properties 18}
- *
- * Will result in the following (notice the conn and client ids):
- *
- *
- * 2009-09-13 19:04:27 DEBUG root conn=1234: just received a new connection in src/examples/php/ndc.php at 23
- * 2009-09-13 19:04:27 DEBUG root conn=1234 client=ab23: some more messages that can in src/examples/php/ndc.php at 25
- * 2009-09-13 19:04:27 DEBUG root conn=1234 client=ab23: now related to a client in src/examples/php/ndc.php at 26
- * 2009-09-13 19:04:27 DEBUG root : back and waiting for new connections in src/examples/php/ndc.php at 29
- *
- *
- * @version $Revision: 1350602 $
- * @package log4php
- * @since 0.3
- */
-class LoggerNDC {
-
- /** This is the repository of NDC stack */
- private static $stack = array();
-
- /**
- * Clear any nested diagnostic information if any. This method is
- * useful in cases where the same thread can be potentially used
- * over and over in different unrelated contexts.
- *
- *
This method is equivalent to calling the {@link setMaxDepth()}
- * method with a zero maxDepth argument.
- */
- public static function clear() {
- self::$stack = array();
- }
-
- /**
- * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
- * @return array
- */
- public static function get() {
- return implode(' ', self::$stack);
- }
-
- /**
- * Get the current nesting depth of this diagnostic context.
- *
- * @see setMaxDepth()
- * @return integer
- */
- public static function getDepth() {
- return count(self::$stack);
- }
-
- /**
- * Clients should call this method before leaving a diagnostic
- * context.
- *
- *
The returned value is the value that was pushed last. If no
- * context is available, then the empty string "" is returned.
- *
- * @return string The innermost diagnostic context.
- */
- public static function pop() {
- if (count(self::$stack) > 0) {
- return array_pop(self::$stack);
- } else {
- return '';
- }
- }
-
- /**
- * Looks at the last diagnostic context at the top of this NDC
- * without removing it.
- *
- *
The returned value is the value that was pushed last. If no
- * context is available, then the empty string "" is returned.
- * @return string The innermost diagnostic context.
- */
- public static function peek() {
- if (count(self::$stack) > 0) {
- return end(self::$stack);
- } else {
- return '';
- }
- }
-
- /**
- * Push new diagnostic context information for the current thread.
- *
- *
The contents of the message parameter is
- * determined solely by the client.
- *
- * @param string $message The new diagnostic context information.
- */
- public static function push($message) {
- array_push(self::$stack, (string)$message);
- }
-
- /**
- * Remove the diagnostic context for this thread.
- */
- public static function remove() {
- LoggerNDC::clear();
- }
-
- /**
- * Set maximum depth of this diagnostic context. If the current
- * depth is smaller or equal to maxDepth, then no
- * action is taken.
- *
- *
This method is a convenient alternative to multiple
- * {@link pop()} calls. Moreover, it is often the case that at
- * the end of complex call sequences, the depth of the NDC is
- * unpredictable. The {@link setMaxDepth()} method circumvents
- * this problem.
- *
- * @param integer $maxDepth
- * @see getDepth()
- */
- public static function setMaxDepth($maxDepth) {
- $maxDepth = (int)$maxDepth;
- if (LoggerNDC::getDepth() > $maxDepth) {
- self::$stack = array_slice(self::$stack, 0, $maxDepth);
- }
- }
-}
diff --git a/library/log4php/LoggerReflectionUtils.php b/library/log4php/LoggerReflectionUtils.php
deleted file mode 100644
--- a/library/log4php/LoggerReflectionUtils.php
+++ /dev/null
@@ -1,152 +0,0 @@
-obj = $obj;
- }
-
- /**
- * Set the properties of an object passed as a parameter in one
- * go. The properties are parsed relative to a
- * prefix.
- *
- * @param object $obj The object to configure.
- * @param array $properties An array containing keys and values.
- * @param string $prefix Only keys having the specified prefix will be set.
- */
- // TODO: check, if this is really useful
- public static function setPropertiesByObject($obj, $properties, $prefix) {
- $pSetter = new LoggerReflectionUtils($obj);
- return $pSetter->setProperties($properties, $prefix);
- }
-
-
- /**
- * Set the properites for the object that match the
- * prefix passed as parameter.
- *
- * Example:
- *
- * $arr['xxxname'] = 'Joe';
- * $arr['xxxmale'] = true;
- * and prefix xxx causes setName and setMale.
- *
- * @param array $properties An array containing keys and values.
- * @param string $prefix Only keys having the specified prefix will be set.
- */
- public function setProperties($properties, $prefix) {
- $len = strlen($prefix);
- reset($properties);
- while (list($key,) = each($properties)) {
- if (strpos($key, $prefix) === 0) {
- if (strpos($key, '.', ($len + 1)) > 0) {
- continue;
- }
- $value = $properties[$key];
- $key = substr($key, $len);
- if ($key == 'layout' and ($this->obj instanceof LoggerAppender)) {
- continue;
- }
- $this->setProperty($key, $value);
- }
- }
- $this->activate();
- }
-
- /**
- * Set a property on this PropertySetter's Object. If successful, this
- * method will invoke a setter method on the underlying Object. The
- * setter is the one for the specified property name and the value is
- * determined partly from the setter argument type and partly from the
- * value specified in the call to this method.
- *
- *
If the setter expects a String no conversion is necessary.
- * If it expects an int, then an attempt is made to convert 'value'
- * to an int using new Integer(value). If the setter expects a boolean,
- * the conversion is by new Boolean(value).
- *
- * @param string $name name of the property
- * @param string $value String value of the property
- */
- public function setProperty($name, $value) {
- if ($value === null) {
- return;
- }
-
- $method = "set" . ucfirst($name);
-
- if (!method_exists($this->obj, $method)) {
- throw new Exception("Error setting log4php property $name to $value: no method $method in class " . get_class($this->obj) . "!");
- } else {
- return call_user_func(array($this->obj, $method), $value);
- }
- }
-
- public function activate() {
- if (method_exists($this->obj, 'activateoptions')) {
- return call_user_func(array($this->obj, 'activateoptions'));
- }
- }
-
- /**
- * Creates an instances from the given class name.
- *
- * @param string $classname
- * @return an object from the class with the given classname
- */
- public static function createObject($class) {
- if (!empty($class)) {
- return new $class();
- }
- return null;
- }
-
- /**
- * @param object $object
- * @param string $name
- * @param mixed $value
- */
- public static function setter($object, $name, $value) {
- if (empty($name)) {
- return false;
- }
- $methodName = 'set' . ucfirst($name);
- if (method_exists($object, $methodName)) {
- return call_user_func(array($object, $methodName), $value);
- } else {
- return false;
- }
- }
-
-}
diff --git a/library/log4php/LoggerRoot.php b/library/log4php/LoggerRoot.php
deleted file mode 100644
--- a/library/log4php/LoggerRoot.php
+++ /dev/null
@@ -1,71 +0,0 @@
-setLevel($level);
- }
-
- /**
- * @return LoggerLevel the level
- */
- public function getEffectiveLevel() {
- return $this->getLevel();
- }
-
- /**
- * Override level setter to prevent setting the root logger's level to
- * null. Root logger must always have a level.
- *
- * @param LoggerLevel $level
- */
- public function setLevel(LoggerLevel $level = null) {
- if (isset($level)) {
- parent::setLevel($level);
- } else {
- trigger_error("log4php: Cannot set LoggerRoot level to null.", E_USER_WARNING);
- }
- }
-
- /**
- * Override parent setter. Root logger cannot have a parent.
- * @param Logger $parent
- */
- public function setParent(Logger $parent) {
- trigger_error("log4php: LoggerRoot cannot have a parent.", E_USER_WARNING);
- }
-}
diff --git a/library/log4php/LoggerThrowableInformation.php b/library/log4php/LoggerThrowableInformation.php
deleted file mode 100644
--- a/library/log4php/LoggerThrowableInformation.php
+++ /dev/null
@@ -1,68 +0,0 @@
-throwable = $throwable;
- }
-
- /**
- * Return source exception
- *
- * @return Exception
- */
- public function getThrowable() {
- return $this->throwable;
- }
-
- /**
- * @desc Returns string representation of throwable
- *
- * @return array
- */
- public function getStringRepresentation() {
- if (!is_array($this->throwableArray)) {
- $renderer = new LoggerRendererException();
-
- $this->throwableArray = explode("\n", $renderer->render($this->throwable));
- }
-
- return $this->throwableArray;
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderConsole.php b/library/log4php/appenders/LoggerAppenderConsole.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderConsole.php
+++ /dev/null
@@ -1,103 +0,0 @@
-fp = fopen($this->target, 'w');
- if (is_resource($this->fp) && $this->layout !== null) {
- fwrite($this->fp, $this->layout->getHeader());
- }
- $this->closed = (bool)is_resource($this->fp) === false;
- }
-
-
- public function close() {
- if ($this->closed != true) {
- if (is_resource($this->fp) && $this->layout !== null) {
- fwrite($this->fp, $this->layout->getFooter());
- fclose($this->fp);
- }
- $this->closed = true;
- }
- }
-
- public function append(LoggerLoggingEvent $event) {
- if (is_resource($this->fp) && $this->layout !== null) {
- fwrite($this->fp, $this->layout->format($event));
- }
- }
-
- /**
- * Sets the 'target' parameter.
- * @param string $target
- */
- public function setTarget($target) {
- $value = trim($target);
- if ($value == self::STDOUT || strtoupper($value) == 'STDOUT') {
- $this->target = self::STDOUT;
- } elseif ($value == self::STDERR || strtoupper($value) == 'STDERR') {
- $this->target = self::STDERR;
- } else {
- $target = var_export($target);
- $this->warn("Invalid value given for 'target' property: [$target]. Property not set.");
- }
- }
-
- /**
- * Returns the value of the 'target' parameter.
- * @return string
- */
- public function getTarget() {
- return $this->target;
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderDailyFile.php b/library/log4php/appenders/LoggerAppenderDailyFile.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderDailyFile.php
+++ /dev/null
@@ -1,128 +0,0 @@
-datePattern)) {
- $this->warn("Required parameter 'datePattern' not set. Closing appender.");
- $this->closed = true;
- return;
- }
- }
-
- /**
- * Appends a logging event.
- *
- * If the target file changes because of passage of time (e.g. at midnight)
- * the current file is closed. A new file, with the new date, will be
- * opened by the write() method.
- */
- public function append(LoggerLoggingEvent $event) {
- $eventDate = $this->getDate($event->getTimestamp());
-
- // Initial setting of current date
- if (!isset($this->currentDate)) {
- $this->currentDate = $eventDate;
- } // Check if rollover is needed
- else if ($this->currentDate !== $eventDate) {
- $this->currentDate = $eventDate;
-
- // Close the file if it's open.
- // Note: $this->close() is not called here because it would set
- // $this->closed to true and the appender would not recieve
- // any more logging requests
- if (is_resource($this->fp)) {
- $this->write($this->layout->getFooter());
- fclose($this->fp);
- }
- $this->fp = null;
- }
-
- parent::append($event);
- }
-
- /** Renders the date using the configured datePattern. */
- protected function getDate($timestamp = null) {
- return date($this->datePattern, $timestamp);
- }
-
- /**
- * Determines target file. Replaces %s in file path with a date.
- */
- protected function getTargetFile() {
- return str_replace('%s', $this->currentDate, $this->file);
- }
-
- /**
- * Sets the 'datePattern' parameter.
- * @param string $datePattern
- */
- public function setDatePattern($datePattern) {
- $this->setString('datePattern', $datePattern);
- }
-
- /**
- * Returns the 'datePattern' parameter.
- * @return string
- */
- public function getDatePattern() {
- return $this->datePattern;
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderEcho.php b/library/log4php/appenders/LoggerAppenderEcho.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderEcho.php
+++ /dev/null
@@ -1,88 +0,0 @@
- element will be inserted
- * before each line break in the logged message. Default is false.
- *
- * @version $Revision: 1337820 $
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/echo.html Appender documentation
- */
-class LoggerAppenderEcho extends LoggerAppender {
- /**
- * Used to mark first append. Set to false after first append.
- * @var boolean
- */
- protected $firstAppend = true;
-
- /**
- * If set to true, a element will be inserted before each line
- * break in the logged message. Default value is false. @var boolean
- */
- protected $htmlLineBreaks = false;
-
- public function close() {
- if ($this->closed != true) {
- if (!$this->firstAppend) {
- echo $this->layout->getFooter();
- }
- }
- $this->closed = true;
- }
-
- public function append(LoggerLoggingEvent $event) {
- if ($this->layout !== null) {
- if ($this->firstAppend) {
- echo $this->layout->getHeader();
- $this->firstAppend = false;
- }
- $text = $this->layout->format($event);
-
- if ($this->htmlLineBreaks) {
- $text = nl2br($text);
- }
- echo $text;
- }
- }
-
- /**
- * Sets the 'htmlLineBreaks' parameter.
- * @param boolean $value
- */
- public function setHtmlLineBreaks($value) {
- $this->setBoolean('htmlLineBreaks', $value);
- }
-
- /**
- * Returns the 'htmlLineBreaks' parameter.
- * @returns boolean
- */
- public function getHtmlLineBreaks() {
- return $this->htmlLineBreaks;
- }
-}
-
diff --git a/library/log4php/appenders/LoggerAppenderFile.php b/library/log4php/appenders/LoggerAppenderFile.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderFile.php
+++ /dev/null
@@ -1,225 +0,0 @@
-file;
- }
-
- /**
- * Acquires the target file resource, creates the destination folder if
- * necessary. Writes layout header to file.
- *
- * @return boolean FALSE if opening failed
- */
- protected function openFile() {
- $file = $this->getTargetFile();
-
- // Create the target folder if needed
- if (!is_file($file)) {
- $dir = dirname($file);
-
- if (!is_dir($dir)) {
- $success = mkdir($dir, 0777, true);
- if ($success === false) {
- $this->warn("Failed creating target directory [$dir]. Closing appender.");
- $this->closed = true;
- return false;
- }
- }
- }
-
- $mode = $this->append ? 'a' : 'w';
- $this->fp = fopen($file, $mode);
- if ($this->fp === false) {
- $this->warn("Failed opening target file. Closing appender.");
- $this->fp = null;
- $this->closed = true;
- return false;
- }
-
- // Required when appending with concurrent access
- if ($this->append) {
- fseek($this->fp, 0, SEEK_END);
- }
-
- // Write the header
- $this->write($this->layout->getHeader());
- }
-
- /**
- * Writes a string to the target file. Opens file if not already open.
- * @param string $string Data to write.
- */
- protected function write($string) {
- // Lazy file open
- if (!isset($this->fp)) {
- if ($this->openFile() === false) {
- return; // Do not write if file open failed.
- }
- }
-
- if ($this->locking) {
- $this->writeWithLocking($string);
- } else {
- $this->writeWithoutLocking($string);
- }
- }
-
- protected function writeWithLocking($string) {
- if (flock($this->fp, LOCK_EX)) {
- if (fwrite($this->fp, $string) === false) {
- $this->warn("Failed writing to file. Closing appender.");
- $this->closed = true;
- }
- flock($this->fp, LOCK_UN);
- } else {
- $this->warn("Failed locking file for writing. Closing appender.");
- $this->closed = true;
- }
- }
-
- protected function writeWithoutLocking($string) {
- if (fwrite($this->fp, $string) === false) {
- $this->warn("Failed writing to file. Closing appender.");
- $this->closed = true;
- }
- }
-
- public function activateOptions() {
- if (empty($this->file)) {
- $this->warn("Required parameter 'file' not set. Closing appender.");
- $this->closed = true;
- return;
- }
- }
-
- public function close() {
- if (is_resource($this->fp)) {
- $this->write($this->layout->getFooter());
- fclose($this->fp);
- }
- $this->fp = null;
- $this->closed = true;
- }
-
- public function append(LoggerLoggingEvent $event) {
- $this->write($this->layout->format($event));
- }
-
- /**
- * Sets the 'file' parameter.
- * @param string $file
- */
- public function setFile($file) {
- $this->setString('file', $file);
- }
-
- /**
- * Returns the 'file' parameter.
- * @return string
- */
- public function getFile() {
- return $this->file;
- }
-
- /**
- * Returns the 'append' parameter.
- * @return boolean
- */
- public function getAppend() {
- return $this->append;
- }
-
- /**
- * Sets the 'append' parameter.
- * @param boolean $append
- */
- public function setAppend($append) {
- $this->setBoolean('append', $append);
- }
-
- /**
- * Sets the 'file' parmeter. Left for legacy reasons.
- * @param string $fileName
- * @deprecated Use setFile() instead.
- */
- public function setFileName($fileName) {
- $this->setFile($fileName);
- }
-
- /**
- * Returns the 'file' parmeter. Left for legacy reasons.
- * @return string
- * @deprecated Use getFile() instead.
- */
- public function getFileName() {
- return $this->getFile();
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderFirePHP.php b/library/log4php/appenders/LoggerAppenderFirePHP.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderFirePHP.php
+++ /dev/null
@@ -1,100 +0,0 @@
-console = FirePHP::to($this->target)->console();
- $this->closed = false;
- } else {
- $this->warn('FirePHP is not installed correctly. Closing appender.');
- }
- }
-
- public function append(LoggerLoggingEvent $event) {
- $msg = $event->getMessage();
-
- // Skip formatting for objects and arrays which are handled by FirePHP.
- if (!is_array($msg) && !is_object($msg)) {
- $msg = $this->getLayout()->format($event);
- }
-
- switch ($event->getLevel()->toInt()) {
- case LoggerLevel::TRACE:
- case LoggerLevel::DEBUG:
- $this->console->log($msg);
- break;
- case LoggerLevel::INFO:
- $this->console->info($msg);
- break;
- case LoggerLevel::WARN:
- $this->console->warn($msg);
- break;
- case LoggerLevel::ERROR:
- case LoggerLevel::FATAL:
- $this->console->error($msg);
- break;
- }
- }
-
- /** Returns the target. */
- public function getTarget() {
- return $this->target;
- }
-
- /** Sets the target. */
- public function setTarget($target) {
- $this->setString('target', $target);
- }
-}
\ No newline at end of file
diff --git a/library/log4php/appenders/LoggerAppenderMail.php b/library/log4php/appenders/LoggerAppenderMail.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderMail.php
+++ /dev/null
@@ -1,136 +0,0 @@
-layout !== null) {
- $this->body .= $this->layout->format($event);
- }
- }
-
- public function close() {
- if ($this->closed != true) {
- $from = $this->from;
- $to = $this->to;
-
- if (!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
- $subject = $this->subject;
- if (!$this->dry) {
- mail(
- $to, $subject,
- $this->layout->getHeader() . $this->body . $this->layout->getFooter(),
- "From: {$from}\r\n");
- } else {
- echo "DRY MODE OF MAIL APP.: Send mail to: " . $to . " with content: " . $this->body;
- }
- }
- $this->closed = true;
- }
- }
-
- /** Sets the 'subject' parameter. */
- public function setSubject($subject) {
- $this->setString('subject', $subject);
- }
-
- /** Returns the 'subject' parameter. */
- public function getSubject() {
- return $this->subject;
- }
-
- /** Sets the 'to' parameter. */
- public function setTo($to) {
- $this->setString('to', $to);
- }
-
- /** Returns the 'to' parameter. */
- public function getTo() {
- return $this->to;
- }
-
- /** Sets the 'from' parameter. */
- public function setFrom($from) {
- $this->setString('from', $from);
- }
-
- /** Returns the 'from' parameter. */
- public function getFrom() {
- return $this->from;
- }
-
- /** Enables or disables dry mode. */
- public function setDry($dry) {
- $this->setBoolean('dry', $dry);
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderMailEvent.php b/library/log4php/appenders/LoggerAppenderMailEvent.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderMailEvent.php
+++ /dev/null
@@ -1,180 +0,0 @@
-to)) {
- $this->warn("Required parameter 'to' not set. Closing appender.");
- $this->close = true;
- return;
- }
-
- $sendmail_from = ini_get('sendmail_from');
- if (empty($this->from) and empty($sendmail_from)) {
- $this->warn("Required parameter 'from' not set. Closing appender.");
- $this->close = true;
- return;
- }
-
- $this->closed = false;
- }
-
- public function append(LoggerLoggingEvent $event) {
- $smtpHost = $this->smtpHost;
- $prevSmtpHost = ini_get('SMTP');
- if (!empty($smtpHost)) {
- ini_set('SMTP', $smtpHost);
- }
-
- $smtpPort = $this->port;
- $prevSmtpPort = ini_get('smtp_port');
- if ($smtpPort > 0 and $smtpPort < 65535) {
- ini_set('smtp_port', $smtpPort);
- }
-
- // On unix only sendmail_path, which is PHP_INI_SYSTEM i.e. not changeable here, is used.
-
- $addHeader = empty($this->from) ? '' : "From: {$this->from}\r\n";
-
- if (!$this->dry) {
- $result = mail($this->to, $this->subject, $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), $addHeader);
- } else {
- echo "DRY MODE OF MAIL APP.: Send mail to: " . $this->to . " with additional headers '" . trim($addHeader) . "' and content: " . $this->layout->format($event);
- }
-
- ini_set('SMTP', $prevSmtpHost);
- ini_set('smtp_port', $prevSmtpPort);
- }
-
- /** Sets the 'from' parameter. */
- public function setFrom($from) {
- $this->setString('from', $from);
- }
-
- /** Returns the 'from' parameter. */
- public function getFrom() {
- return $this->from;
- }
-
- /** Sets the 'port' parameter. */
- public function setPort($port) {
- $this->setPositiveInteger('port', $port);
- }
-
- /** Returns the 'port' parameter. */
- public function getPort() {
- return $this->port;
- }
-
- /** Sets the 'smtpHost' parameter. */
- public function setSmtpHost($smtpHost) {
- $this->setString('smtpHost', $smtpHost);
- }
-
- /** Returns the 'smtpHost' parameter. */
- public function getSmtpHost() {
- return $this->smtpHost;
- }
-
- /** Sets the 'subject' parameter. */
- public function setSubject($subject) {
- $this->setString('subject', $subject);
- }
-
- /** Returns the 'subject' parameter. */
- public function getSubject() {
- return $this->subject;
- }
-
- /** Sets the 'to' parameter. */
- public function setTo($to) {
- $this->setString('to', $to);
- }
-
- /** Returns the 'to' parameter. */
- public function getTo() {
- return $this->to;
- }
-
- /** Enables or disables dry mode. */
- public function setDry($dry) {
- $this->setBoolean('dry', $dry);
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderMongoDB.php b/library/log4php/appenders/LoggerAppenderMongoDB.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderMongoDB.php
+++ /dev/null
@@ -1,361 +0,0 @@
-host = self::DEFAULT_MONGO_URL_PREFIX . self::DEFAULT_MONGO_HOST;
- $this->port = self::DEFAULT_MONGO_PORT;
- $this->databaseName = self::DEFAULT_DB_NAME;
- $this->collectionName = self::DEFAULT_COLLECTION_NAME;
- $this->timeout = self::DEFAULT_TIMEOUT_VALUE;
- $this->requiresLayout = false;
- }
-
- /**
- * Setup db connection.
- * Based on defined options, this method connects to the database and
- * creates a {@link $collection}.
- */
- public function activateOptions() {
- try {
- $this->connection = new Mongo(sprintf('%s:%d', $this->host, $this->port), array('timeout' => $this->timeout));
- $db = $this->connection->selectDB($this->databaseName);
- if ($this->userName !== null && $this->password !== null) {
- $authResult = $db->authenticate($this->userName, $this->password);
- if ($authResult['ok'] == floatval(0)) {
- throw new Exception($authResult['errmsg'], $authResult['ok']);
- }
- }
- $this->collection = $db->selectCollection($this->collectionName);
- } catch (MongoConnectionException $ex) {
- $this->closed = true;
- $this->warn(sprintf('Failed to connect to mongo deamon: %s', $ex->getMessage()));
- } catch (InvalidArgumentException $ex) {
- $this->closed = true;
- $this->warn(sprintf('Error while selecting mongo database: %s', $ex->getMessage()));
- } catch (Exception $ex) {
- $this->closed = true;
- $this->warn('Invalid credentials for mongo database authentication');
- }
- }
-
- /**
- * Appends a new event to the mongo database.
- *
- * @param LoggerLoggingEvent $event
- */
- public function append(LoggerLoggingEvent $event) {
- try {
- if ($this->collection != null) {
- $this->collection->insert($this->format($event));
- }
- } catch (MongoCursorException $ex) {
- $this->warn(sprintf('Error while writing to mongo collection: %s', $ex->getMessage()));
- }
- }
-
- /**
- * Converts the logging event into an array which can be logged to mongodb.
- *
- * @param LoggerLoggingEvent $event
- * @return array The array representation of the logging event.
- */
- protected function format(LoggerLoggingEvent $event) {
- $timestampSec = (int)$event->getTimestamp();
- $timestampUsec = (int)(($event->getTimestamp() - $timestampSec) * 1000000);
-
- $document = array(
- 'timestamp' => new MongoDate($timestampSec, $timestampUsec),
- 'level' => $event->getLevel()->toString(),
- 'thread' => (int)$event->getThreadName(),
- 'message' => $event->getMessage(),
- 'loggerName' => $event->getLoggerName()
- );
-
- $locationInfo = $event->getLocationInformation();
- if ($locationInfo != null) {
- $document['fileName'] = $locationInfo->getFileName();
- $document['method'] = $locationInfo->getMethodName();
- $document['lineNumber'] = ($locationInfo->getLineNumber() == 'NA') ? 'NA' : (int)$locationInfo->getLineNumber();
- $document['className'] = $locationInfo->getClassName();
- }
-
- $throwableInfo = $event->getThrowableInformation();
- if ($throwableInfo != null) {
- $document['exception'] = $this->formatThrowable($throwableInfo->getThrowable());
- }
-
- return $document;
- }
-
- /**
- * Converts an Exception into an array which can be logged to mongodb.
- *
- * Supports innner exceptions (PHP >= 5.3)
- *
- * @param Exception $ex
- * @return array
- */
- protected function formatThrowable(Exception $ex) {
- $array = array(
- 'message' => $ex->getMessage(),
- 'code' => $ex->getCode(),
- 'stackTrace' => $ex->getTraceAsString(),
- );
-
- if (method_exists($ex, 'getPrevious') && $ex->getPrevious() !== null) {
- $array['innerException'] = $this->formatThrowable($ex->getPrevious());
- }
-
- return $array;
- }
-
- /**
- * Closes the connection to the logging database
- */
- public function close() {
- if ($this->closed != true) {
- $this->collection = null;
- if ($this->connection !== null) {
- $this->connection->close();
- $this->connection = null;
- }
- $this->closed = true;
- }
- }
-
- /**
- * Sets the value of {@link $host} parameter.
- * @param string $host
- */
- public function setHost($host) {
- if (!preg_match('/^mongodb\:\/\//', $host)) {
- $host = self::DEFAULT_MONGO_URL_PREFIX . $host;
- }
- $this->host = $host;
- }
-
- /**
- * Returns the value of {@link $host} parameter.
- * @return string
- */
- public function getHost() {
- return $this->host;
- }
-
- /**
- * Sets the value of {@link $port} parameter.
- * @param int $port
- */
- public function setPort($port) {
- $this->setPositiveInteger('port', $port);
- }
-
- /**
- * Returns the value of {@link $port} parameter.
- * @return int
- */
- public function getPort() {
- return $this->port;
- }
-
- /**
- * Sets the value of {@link $databaseName} parameter.
- * @param string $databaseName
- */
- public function setDatabaseName($databaseName) {
- $this->setString('databaseName', $databaseName);
- }
-
- /**
- * Returns the value of {@link $databaseName} parameter.
- * @return string
- */
- public function getDatabaseName() {
- return $this->databaseName;
- }
-
- /**
- * Sets the value of {@link $collectionName} parameter.
- * @param string $collectionName
- */
- public function setCollectionName($collectionName) {
- $this->setString('collectionName', $collectionName);
- }
-
- /**
- * Returns the value of {@link $collectionName} parameter.
- * @return string
- */
- public function getCollectionName() {
- return $this->collectionName;
- }
-
- /**
- * Sets the value of {@link $userName} parameter.
- * @param string $userName
- */
- public function setUserName($userName) {
- $this->setString('userName', $userName, true);
- }
-
- /**
- * Returns the value of {@link $userName} parameter.
- * @return string
- */
- public function getUserName() {
- return $this->userName;
- }
-
- /**
- * Sets the value of {@link $password} parameter.
- * @param string $password
- */
- public function setPassword($password) {
- $this->setString('password', $password, true);
- }
-
- /**
- * Returns the value of {@link $password} parameter.
- * @return string
- */
- public function getPassword() {
- return $this->password;
- }
-
- /**
- * Sets the value of {@link $timeout} parameter.
- * @param int $timeout
- */
- public function setTimeout($timeout) {
- $this->setPositiveInteger('timeout', $timeout);
- }
-
- /**
- * Returns the value of {@link $timeout} parameter.
- * @return int
- */
- public function getTimeout() {
- return $this->timeout;
- }
-
- /**
- * Returns the mongodb connection.
- * @return Mongo
- */
- public function getConnection() {
- return $this->connection;
- }
-
- /**
- * Returns the active mongodb collection.
- * @return MongoCollection
- */
- public function getCollection() {
- return $this->collection;
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderNull.php b/library/log4php/appenders/LoggerAppenderNull.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderNull.php
+++ /dev/null
@@ -1,44 +0,0 @@
-establishConnection();
- } catch (PDOException $e) {
- $this->warn("Failed connecting to database. Closing appender. Error: " . $e->getMessage());
- $this->close();
- return;
- }
-
- // Parse the insert patterns; pattern parts are comma delimited
- $pieces = explode(',', $this->insertPattern);
- $converterMap = LoggerLayoutPattern::getDefaultConverterMap();
- foreach ($pieces as $pattern) {
- $parser = new LoggerPatternParser($pattern, $converterMap);
- $this->converters[] = $parser->parse();
- }
-
- $this->closed = false;
- }
-
- /**
- * Connects to the database, and prepares the insert query.
- * @throws PDOException If connect or prepare fails.
- */
- protected function establishConnection() {
- // Acquire database connection
- $this->db = new PDO($this->dsn, $this->user, $this->password);
- $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-
- // Prepare the insert statement
- $insertSQL = str_replace('__TABLE__', $this->table, $this->insertSQL);
- $this->preparedInsert = $this->db->prepare($insertSQL);
- }
-
- /**
- * Appends a new event to the database.
- *
- * If writing to database fails, it will retry by re-establishing the
- * connection up to $reconnectAttempts times. If writing still fails,
- * the appender will close.
- */
- public function append(LoggerLoggingEvent $event) {
-
- for ($attempt = 1; $attempt <= $this->reconnectAttempts + 1; $attempt++) {
- try {
- // Attempt to write to database
- $this->preparedInsert->execute($this->format($event));
- $this->preparedInsert->closeCursor();
- break;
- } catch (PDOException $e) {
- $this->warn("Failed writing to database: " . $e->getMessage());
-
- // Close the appender if it's the last attempt
- if ($attempt > $this->reconnectAttempts) {
- $this->warn("Failed writing to database after {$this->reconnectAttempts} reconnect attempts. Closing appender.");
- $this->close();
- // Otherwise reconnect and try to write again
- } else {
- $this->warn("Attempting a reconnect (attempt $attempt of {$this->reconnectAttempts}).");
- $this->establishConnection();
- }
- }
- }
- }
-
- /**
- * Converts the logging event to a series of database parameters by using
- * the converter chain which was set up on activation.
- */
- protected function format(LoggerLoggingEvent $event) {
- $params = array();
- foreach ($this->converters as $converter) {
- $buffer = '';
- while ($converter !== null) {
- $converter->format($buffer, $event);
- $converter = $converter->next;
- }
- $params[] = $buffer;
- }
- return $params;
- }
-
- /**
- * Closes the connection to the logging database
- */
- public function close() {
- // Close the connection (if any)
- $this->db = null;
-
- // Close the appender
- $this->closed = true;
- }
-
- // ******************************************
- // *** Accessor methods ***
- // ******************************************
-
- /**
- * Returns the active database handle or null if not established.
- * @return PDO
- */
- public function getDatabaseHandle() {
- return $this->db;
- }
-
- /** Sets the username. */
- public function setUser($user) {
- $this->setString('user', $user);
- }
-
- /** Returns the username. */
- public function getUser($user) {
- return $this->user;
- }
-
- /** Sets the password. */
- public function setPassword($password) {
- $this->setString('password', $password);
- }
-
- /** Returns the password. */
- public function getPassword($password) {
- return $this->password;
- }
-
- /** Sets the insert SQL. */
- public function setInsertSQL($sql) {
- $this->setString('insertSQL', $sql);
- }
-
- /** Returns the insert SQL. */
- public function getInsertSQL($sql) {
- return $this->insertSQL;
- }
-
- /** Sets the insert pattern. */
- public function setInsertPattern($pattern) {
- $this->setString('insertPattern', $pattern);
- }
-
- /** Returns the insert pattern. */
- public function getInsertPattern($pattern) {
- return $this->insertPattern;
- }
-
- /** Sets the table name. */
- public function setTable($table) {
- $this->setString('table', $table);
- }
-
- /** Returns the table name. */
- public function getTable($table) {
- return $this->table;
- }
-
- /** Sets the DSN string. */
- public function setDSN($dsn) {
- $this->setString('dsn', $dsn);
- }
-
- /** Returns the DSN string. */
- public function getDSN($dsn) {
- return $this->setString('dsn', $dsn);
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderPhp.php b/library/log4php/appenders/LoggerAppenderPhp.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderPhp.php
+++ /dev/null
@@ -1,49 +0,0 @@
-level < WARN mapped to E_USER_NOTICE
- * - WARN <= level < ERROR mapped to E_USER_WARNING
- * - level >= ERROR mapped to E_USER_ERROR
- *
- * @version $Revision: 1337820 $
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/php.html Appender documentation
- */
-class LoggerAppenderPhp extends LoggerAppender {
-
- public function append(LoggerLoggingEvent $event) {
- $level = $event->getLevel();
- if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
- trigger_error($this->layout->format($event), E_USER_ERROR);
- } else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
- trigger_error($this->layout->format($event), E_USER_WARNING);
- } else {
- trigger_error($this->layout->format($event), E_USER_NOTICE);
- }
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderRollingFile.php b/library/log4php/appenders/LoggerAppenderRollingFile.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderRollingFile.php
+++ /dev/null
@@ -1,305 +0,0 @@
-maxFileSize.
- *
- * There is one backup file by default.
- *
- * @var integer
- */
- protected $maxBackupIndex = 1;
-
- /**
- * The compress parameter determindes the compression with zlib.
- * If set to true, the rollover files are compressed and saved with the .gz extension.
- * @var boolean
- */
- protected $compress = false;
-
- /**
- * Set to true in the constructor if PHP >= 5.3.0. In that case clearstatcache
- * supports conditional clearing of statistics.
- * @var boolean
- * @see http://php.net/manual/en/function.clearstatcache.php
- */
- private $clearConditional = false;
-
- /**
- * Get the maximum size that the output file is allowed to reach
- * before being rolled over to backup files.
- * @return integer
- */
- public function getMaximumFileSize() {
- return $this->maxFileSize;
- }
-
- public function __construct($name = '') {
- parent::__construct($name);
- if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
- $this->clearConditional = true;
- }
- }
-
- /**
- * Implements the usual roll over behaviour.
- *
- * If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex.
- * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
- *
- * If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
- *
- * Rollover must be called while the file is locked so that it is safe for concurrent access.
- *
- * @throws LoggerException If any part of the rollover procedure fails.
- */
- private function rollOver() {
- // If maxBackups <= 0, then there is no file renaming to be done.
- if ($this->maxBackupIndex > 0) {
- // Delete the oldest file, to keep Windows happy.
- $file = $this->file . '.' . $this->maxBackupIndex;
-
- if (file_exists($file) && !unlink($file)) {
- throw new LoggerException("Unable to delete oldest backup file from [$file].");
- }
-
- // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
- $this->renameArchievedLogs($this->file);
-
- // Backup the active file
- $this->moveToBackup($this->file);
- }
-
- // Truncate the active file
- ftruncate($this->fp, 0);
- rewind($this->fp);
- }
-
- private function moveToBackup($source) {
- if ($this->compress) {
- $target = $source . '.1.gz';
- $this->compressFile($source, $target);
- } else {
- $target = $source . '.1';
- copy($source, $target);
- }
- }
-
- private function compressFile($source, $target) {
- $target = 'compress.zlib://' . $target;
-
- $fin = fopen($source, 'rb');
- if ($fin === false) {
- throw new LoggerException("Unable to open file for reading: [$source].");
- }
-
- $fout = fopen($target, 'wb');
- if ($fout === false) {
- throw new LoggerException("Unable to open file for writing: [$target].");
- }
-
- while (!feof($fin)) {
- $chunk = fread($fin, self::COMPRESS_CHUNK_SIZE);
- if (false === fwrite($fout, $chunk)) {
- throw new LoggerException("Failed writing to compressed file.");
- }
- }
-
- fclose($fin);
- fclose($fout);
- }
-
- private function renameArchievedLogs($fileName) {
- for ($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
-
- $source = $fileName . "." . $i;
- if ($this->compress) {
- $source .= '.gz';
- }
-
- if (file_exists($source)) {
- $target = $fileName . '.' . ($i + 1);
- if ($this->compress) {
- $target .= '.gz';
- }
-
- rename($source, $target);
- }
- }
- }
-
- /**
- * Writes a string to the target file. Opens file if not already open.
- * @param string $string Data to write.
- */
- protected function write($string) {
- // Lazy file open
- if (!isset($this->fp)) {
- if ($this->openFile() === false) {
- return; // Do not write if file open failed.
- }
- }
-
- // Lock the file while writing and possible rolling over
- if (flock($this->fp, LOCK_EX)) {
-
- // Write to locked file
- if (fwrite($this->fp, $string) === false) {
- $this->warn("Failed writing to file. Closing appender.");
- $this->closed = true;
- }
-
- // Stats cache must be cleared, otherwise filesize() returns cached results
- // If supported (PHP 5.3+), clear only the state cache for the target file
- if ($this->clearConditional) {
- clearstatcache(true, $this->file);
- } else {
- clearstatcache();
- }
-
- // Rollover if needed
- if (filesize($this->file) > $this->maxFileSize) {
- try {
- $this->rollOver();
- } catch (LoggerException $ex) {
- $this->warn("Rollover failed: " . $ex->getMessage() . " Closing appender.");
- $this->closed = true;
- }
- }
-
- flock($this->fp, LOCK_UN);
- } else {
- $this->warn("Failed locking file for writing. Closing appender.");
- $this->closed = true;
- }
- }
-
- public function activateOptions() {
- parent::activateOptions();
-
- if ($this->compress && !extension_loaded('zlib')) {
- $this->warn("The 'zlib' extension is required for file compression. Disabling compression.");
- $this->compression = false;
- }
- }
-
- /**
- * Set the 'maxBackupIndex' parameter.
- * @param integer $maxBackupIndex
- */
- public function setMaxBackupIndex($maxBackupIndex) {
- $this->setPositiveInteger('maxBackupIndex', $maxBackupIndex);
- }
-
- /**
- * Returns the 'maxBackupIndex' parameter.
- * @return integer
- */
- public function getMaxBackupIndex() {
- return $this->maxBackupIndex;
- }
-
- /**
- * Set the 'maxFileSize' parameter.
- * @param mixed $maxFileSize
- */
- public function setMaxFileSize($maxFileSize) {
- $this->setFileSize('maxFileSize', $maxFileSize);
- }
-
- /**
- * Returns the 'maxFileSize' parameter.
- * @return integer
- */
- public function getMaxFileSize() {
- return $this->maxFileSize;
- }
-
- /**
- * Set the 'maxFileSize' parameter (kept for backward compatibility).
- * @param mixed $maxFileSize
- * @deprecated Use setMaxFileSize() instead.
- */
- public function setMaximumFileSize($maxFileSize) {
- $this->warn("The 'maximumFileSize' parameter is deprecated. Use 'maxFileSize' instead.");
- return $this->setMaxFileSize($maxFileSize);
- }
-
- /**
- * Sets the 'compress' parameter.
- * @param boolean $compress
- */
- public function setCompress($compress) {
- $this->setBoolean('compress', $compress);
- }
-
- /**
- * Returns the 'compress' parameter.
- * @param boolean
- */
- public function getCompress() {
- return $this->compress;
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderSocket.php b/library/log4php/appenders/LoggerAppenderSocket.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderSocket.php
+++ /dev/null
@@ -1,122 +0,0 @@
-remoteHost)) {
- $this->warn("Required parameter [remoteHost] not set. Closing appender.");
- $this->closed = true;
- return;
- }
-
- if (empty($this->timeout)) {
- $this->timeout = ini_get("default_socket_timeout");
- }
-
- $this->closed = false;
- }
-
- public function append(LoggerLoggingEvent $event) {
- $socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout);
- if ($socket === false) {
- $this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender.");
- $this->closed = true;
- return;
- }
-
- if (false === fwrite($socket, $this->layout->format($event))) {
- $this->warn("Error writing to socket. Closing appender.");
- $this->closed = true;
- }
- fclose($socket);
- }
-
- // ******************************************
- // *** Accessor methods ***
- // ******************************************
-
- /** Sets the target host. */
- public function setRemoteHost($hostname) {
- $this->setString('remoteHost', $hostname);
- }
-
- /** Sets the target port */
- public function setPort($port) {
- $this->setPositiveInteger('port', $port);
- }
-
- /** Sets the timeout. */
- public function setTimeout($timeout) {
- $this->setPositiveInteger('timeout', $timeout);
- }
-
- /** Returns the target host. */
- public function getRemoteHost() {
- return $this->getRemoteHost();
- }
-
- /** Returns the target port. */
- public function getPort() {
- return $this->port;
- }
-
- /** Returns the timeout */
- public function getTimeout() {
- return $this->timeout;
- }
-}
diff --git a/library/log4php/appenders/LoggerAppenderSyslog.php b/library/log4php/appenders/LoggerAppenderSyslog.php
deleted file mode 100644
--- a/library/log4php/appenders/LoggerAppenderSyslog.php
+++ /dev/null
@@ -1,303 +0,0 @@
-FATAL to LOG_ALERT
- * - ERROR to LOG_ERR
- * - WARN to LOG_WARNING
- * - INFO to LOG_INFO
- * - DEBUG to LOG_DEBUG
- * - TRACE to LOG_DEBUG
- *
- * @version $Revision: 1337820 $
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/syslog.html Appender documentation
- */
-class LoggerAppenderSyslog extends LoggerAppender {
-
- /**
- * The ident string is added to each message. Typically the name of your application.
- *
- * @var string
- */
- protected $ident = "Apache log4php";
-
- /**
- * The syslog priority to use when overriding priority. This setting is
- * required if {@link overridePriority} is set to true.
- *
- * @var string
- */
- protected $priority;
-
- /**
- * The option used when opening the syslog connection.
- *
- * @var string
- */
- protected $option = 'PID|CONS';
-
- /**
- * The facility value indicates the source of the message.
- *
- * @var string
- */
- protected $facility = 'USER';
-
- /**
- * If set to true, the message priority will always use the value defined
- * in {@link $priority}, otherwise the priority will be determined by the
- * message's log level.
- *
- * @var string
- */
- protected $overridePriority = false;
-
- /**
- * Holds the int value of the {@link $priority}.
- * @var int
- */
- private $intPriority;
-
- /**
- * Holds the int value of the {@link $facility}.
- * @var int
- */
- private $intFacility;
-
- /**
- * Holds the int value of the {@link $option}.
- * @var int
- */
- private $intOption;
-
- /**
- * Sets the {@link $ident}.
- *
- * @param string $ident
- */
- public function setIdent($ident) {
- $this->ident = $ident;
- }
-
- /**
- * Sets the {@link $priority}.
- *
- * @param string $priority
- */
- public function setPriority($priority) {
- $this->priority = $priority;
- }
-
- /**
- * Sets the {@link $facility}.
- *
- * @param string $facility
- */
- public function setFacility($facility) {
- $this->facility = $facility;
- }
-
- /**
- * Sets the {@link $overridePriority}.
- *
- * @param string $overridePriority
- */
- public function setOverridePriority($overridePriority) {
- $this->overridePriority = $overridePriority;
- }
-
- /**
- * Sets the 'option' parameter.
- *
- * @param string $option
- */
- public function setOption($option) {
- $this->option = $option;
- }
-
- /**
- * Returns the 'ident' parameter.
- *
- * @return string $ident
- */
- public function getIdent() {
- return $this->ident;
- }
-
- /**
- * Returns the 'priority' parameter.
- *
- * @return string
- */
- public function getPriority() {
- return $this->priority;
- }
-
- /**
- * Returns the 'facility' parameter.
- *
- * @return string
- */
- public function getFacility() {
- return $this->facility;
- }
-
- /**
- * Returns the 'overridePriority' parameter.
- *
- * @return string
- */
- public function getOverridePriority() {
- return $this->overridePriority;
- }
-
- /**
- * Returns the 'option' parameter.
- *
- * @return string
- */
- public function getOption() {
- return $this->option;
- }
-
-
- public function activateOptions() {
- $this->intPriority = $this->parsePriority();
- $this->intOption = $this->parseOption();
- $this->intFacility = $this->parseFacility();
-
- $this->closed = false;
- }
-
- public function close() {
- if ($this->closed != true) {
- closelog();
- $this->closed = true;
- }
- }
-
- /**
- * Appends the event to syslog.
- *
- * Log is opened and closed each time because if it is not closed, it
- * can cause the Apache httpd server to log to whatever ident/facility
- * was used in openlog().
- *
- * @see http://www.php.net/manual/en/function.syslog.php#97843
- */
- public function append(LoggerLoggingEvent $event) {
- $priority = $this->getSyslogPriority($event->getLevel());
- $message = $this->layout->format($event);
-
- openlog($this->ident, $this->intOption, $this->intFacility);
- syslog($priority, $message);
- closelog();
- }
-
- /** Determines which syslog priority to use based on the given level. */
- private function getSyslogPriority(LoggerLevel $level) {
- if ($this->overridePriority) {
- return $this->intPriority;
- }
- return $level->getSyslogEquivalent();
- }
-
- /** Parses a syslog option string and returns the correspodning int value. */
- private function parseOption() {
- $value = 0;
- $options = explode('|', $this->option);
-
- foreach ($options as $option) {
- if (!empty($option)) {
- $constant = "LOG_" . trim($option);
- if (defined($constant)) {
- $value |= constant($constant);
- } else {
- trigger_error("log4php: Invalid syslog option provided: $option. Whole option string: {$this->option}.", E_USER_WARNING);
- }
- }
- }
- return $value;
- }
-
- /** Parses the facility string and returns the corresponding int value. */
- private function parseFacility() {
- if (!empty($this->facility)) {
- $constant = "LOG_" . trim($this->facility);
- if (defined($constant)) {
- return constant($constant);
- } else {
- trigger_error("log4php: Invalid syslog facility provided: {$this->facility}.", E_USER_WARNING);
- }
- }
- }
-
- /** Parses the priority string and returns the corresponding int value. */
- private function parsePriority() {
- if (!empty($this->priority)) {
- $constant = "LOG_" . trim($this->priority);
- if (defined($constant)) {
- return constant($constant);
- } else {
- trigger_error("log4php: Invalid syslog priority provided: {$this->priority}.", E_USER_WARNING);
- }
- }
- }
-}
diff --git a/library/log4php/configurators/LoggerConfigurationAdapter.php b/library/log4php/configurators/LoggerConfigurationAdapter.php
deleted file mode 100644
--- a/library/log4php/configurators/LoggerConfigurationAdapter.php
+++ /dev/null
@@ -1,38 +0,0 @@
-load($path);
-
- // Parse threshold
- if (isset($properties[self::THRESHOLD_PREFIX])) {
- $this->config['threshold'] = $properties[self::THRESHOLD_PREFIX];
- }
-
- // Parse root logger
- if (isset($properties[self::ROOT_LOGGER_PREFIX])) {
- $this->parseLogger($properties[self::ROOT_LOGGER_PREFIX], self::ROOT_LOGGER_NAME);
- }
-
- $appenders = array();
-
- foreach ($properties as $key => $value) {
- // Parse loggers
- if ($this->beginsWith($key, self::LOGGER_PREFIX)) {
- $name = substr($key, strlen(self::LOGGER_PREFIX));
- $this->parseLogger($value, $name);
- }
-
- // Parse additivity
- if ($this->beginsWith($key, self::ADDITIVITY_PREFIX)) {
- $name = substr($key, strlen(self::ADDITIVITY_PREFIX));
- $this->config['loggers'][$name]['additivity'] = $value;
- } // Parse appenders
- else if ($this->beginsWith($key, self::APPENDER_PREFIX)) {
- $this->parseAppender($key, $value);
- } // Parse renderers
- else if ($this->beginsWith($key, self::RENDERER_PREFIX)) {
- $this->parseRenderer($key, $value);
- }
- }
-
- return $this->config;
- }
-
-
- /**
- * Parses a logger definition.
- *
- * Loggers are defined in the following manner:
- *
- * log4php.logger. = [], [, , ...]
- *
- *
- * @param string $value The configuration value (level and appender-refs).
- * @param string $name Logger name.
- */
- private function parseLogger($value, $name) {
- // Value is divided by commas
- $parts = explode(',', $value);
- if (empty($value) || empty($parts)) {
- return;
- }
-
- // The first value is the logger level
- $level = array_shift($parts);
-
- // The remaining values are appender references
- $appenders = array();
- while ($appender = array_shift($parts)) {
- $appender = trim($appender);
- if (!empty($appender)) {
- $appenders[] = trim($appender);
- }
- }
-
- // Find the target configuration
- if ($name == self::ROOT_LOGGER_NAME) {
- $this->config['rootLogger']['level'] = trim($level);
- $this->config['rootLogger']['appenders'] = $appenders;
- } else {
- $this->config['loggers'][$name]['level'] = trim($level);
- $this->config['loggers'][$name]['appenders'] = $appenders;
- }
- }
-
- /**
- * Parses an configuration line pertaining to an appender.
- *
- * Parses the following patterns:
- *
- * Appender class:
- *
- * log4php.appender. =
- *
- *
- * Appender parameter:
- *
- * log4php.appender.. =
- *
- *
- * Appender threshold:
- *
- * log4php.appender..threshold =
- *
- *
- * Appender layout:
- *
- * log4php.appender..layout =
- *
- *
- * Layout parameter:
- *
- * log4php.appender..layout. =
- *
- *
- * For example, a full appender config might look like:
- *
- *
- * @param string $key
- * @param string $value
- */
- private function parseAppender($key, $value) {
-
- // Remove the appender prefix from key
- $subKey = substr($key, strlen(self::APPENDER_PREFIX));
-
- // Divide the string by dots
- $parts = explode('.', $subKey);
- $count = count($parts);
-
- // The first part is always the appender name
- $name = trim($parts[0]);
-
- // Only one part - this line defines the appender class
- if ($count == 1) {
- $this->config['appenders'][$name]['class'] = $value;
- return;
- } // Two parts - either a parameter, a threshold or layout class
- else if ($count == 2) {
-
- if ($parts[1] == 'layout') {
- $this->config['appenders'][$name]['layout']['class'] = $value;
- return;
- } else if ($parts[1] == 'threshold') {
- $this->config['appenders'][$name]['threshold'] = $value;
- return;
- } else {
- $this->config['appenders'][$name]['params'][$parts[1]] = $value;
- return;
- }
- } // Three parts - this can only be a layout parameter
- else if ($count == 3) {
- if ($parts[1] == 'layout') {
- $this->config['appenders'][$name]['layout']['params'][$parts[2]] = $value;
- return;
- }
- }
-
- trigger_error("log4php: Don't know how to parse the following line: \"$key = $value\". Skipping.");
- }
-
- /**
- * Parses a renderer definition.
- *
- * Renderers are defined as:
- *
- * log4php.renderer. =
- *
- *
- * @param string $key log4php.renderer.
- * @param string $value
- */
- private function parseRenderer($key, $value) {
- // Remove the appender prefix from key
- $renderedClass = substr($key, strlen(self::APPENDER_PREFIX));
- $renderingClass = $value;
-
- $this->config['renderers'][] = compact('renderedClass', 'renderingClass');
- }
-
- /** Helper method. Returns true if $str begins with $sub. */
- private function beginsWith($str, $sub) {
- return (strncmp($str, $sub, strlen($sub)) == 0);
- }
-
-
-}
-
diff --git a/library/log4php/configurators/LoggerConfigurationAdapterPHP.php b/library/log4php/configurators/LoggerConfigurationAdapterPHP.php
deleted file mode 100644
--- a/library/log4php/configurators/LoggerConfigurationAdapterPHP.php
+++ /dev/null
@@ -1,83 +0,0 @@
-
- * array(
- * 'level' => 'info',
- * 'appenders' => array('default')
- * ),
- * 'appenders' => array(
- * 'default' => array(
- * 'class' => 'LoggerAppenderEcho',
- * 'layout' => array(
- * 'class' => 'LoggerLayoutSimple'
- * )
- * )
- * )
- * )
- * ?>
- *
- *
- * @package log4php
- * @subpackage configurators
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision: 1343601 $
- * @since 2.2
- */
-class LoggerConfigurationAdapterPHP implements LoggerConfigurationAdapter {
- public function convert($url) {
- if (!file_exists($url)) {
- throw new LoggerException("File [$url] does not exist.");
- }
-
- // Load the config file
- $data = @file_get_contents($url);
- if ($data === false) {
- $error = error_get_last();
- throw new LoggerException("Error loading config file: {$error['message']}");
- }
-
- $config = @eval('?>' . $data);
-
- if ($config === false) {
- $error = error_get_last();
- throw new LoggerException("Error parsing configuration: " . $error['message']);
- }
-
- if (empty($config)) {
- throw new LoggerException("Invalid configuration: empty configuration array.");
- }
-
- if (!is_array($config)) {
- throw new LoggerException("Invalid configuration: not an array.");
- }
-
- return $config;
- }
-}
-
diff --git a/library/log4php/configurators/LoggerConfigurationAdapterXML.php b/library/log4php/configurators/LoggerConfigurationAdapterXML.php
deleted file mode 100644
--- a/library/log4php/configurators/LoggerConfigurationAdapterXML.php
+++ /dev/null
@@ -1,278 +0,0 @@
- array(),
- 'loggers' => array(),
- 'renderers' => array(),
- );
-
- public function convert($url) {
- $xml = $this->loadXML($url);
-
- $this->parseConfiguration($xml);
-
- // Parse the node
- if (isset($xml->root)) {
- $this->parseRootLogger($xml->root);
- }
-
- // Process nodes
- foreach ($xml->logger as $logger) {
- $this->parseLogger($logger);
- }
-
- // Process nodes
- foreach ($xml->appender as $appender) {
- $this->parseAppender($appender);
- }
-
- // Process nodes
- foreach ($xml->renderer as $rendererNode) {
- $this->parseRenderer($rendererNode);
- }
-
- // Process node
- foreach ($xml->defaultRenderer as $rendererNode) {
- $this->parseDefaultRenderer($rendererNode);
- }
-
- return $this->config;
- }
-
- /**
- * Loads and validates the XML.
- * @param string $url Input XML.
- */
- private function loadXML($url) {
- if (!file_exists($url)) {
- throw new LoggerException("File [$url] does not exist.");
- }
-
- libxml_clear_errors();
- $oldValue = libxml_use_internal_errors(true);
-
- // Load XML
- $xml = @simplexml_load_file($url);
- if ($xml === false) {
-
- $errorStr = "";
- foreach (libxml_get_errors() as $error) {
- $errorStr .= $error->message;
- }
-
- throw new LoggerException("Error loading configuration file: " . trim($errorStr));
- }
-
- libxml_clear_errors();
- libxml_use_internal_errors($oldValue);
-
- return $xml;
- }
-
- /**
- * Parses the node.
- */
- private function parseConfiguration(SimpleXMLElement $xml) {
- $attributes = $xml->attributes();
- if (isset($attributes['threshold'])) {
- $this->config['threshold'] = (string)$attributes['threshold'];
- }
- }
-
- /** Parses an node. */
- private function parseAppender(SimpleXMLElement $node) {
- $name = $this->getAttributeValue($node, 'name');
- if (empty($name)) {
- $this->warn("An node is missing the required 'name' attribute. Skipping appender definition.");
- return;
- }
-
- $appender = array();
- $appender['class'] = $this->getAttributeValue($node, 'class');
-
- if (isset($node['threshold'])) {
- $appender['threshold'] = $this->getAttributeValue($node, 'threshold');
- }
-
- if (isset($node->layout)) {
- $appender['layout'] = $this->parseLayout($node->layout, $name);
- }
-
- if (count($node->param) > 0) {
- $appender['params'] = $this->parseParameters($node);
- }
-
- foreach ($node->filter as $filterNode) {
- $appender['filters'][] = $this->parseFilter($filterNode);
- }
-
- $this->config['appenders'][$name] = $appender;
- }
-
- /** Parses a node. */
- private function parseLayout(SimpleXMLElement $node, $appenderName) {
- $layout = array();
- $layout['class'] = $this->getAttributeValue($node, 'class');
-
- if (count($node->param) > 0) {
- $layout['params'] = $this->parseParameters($node);
- }
-
- return $layout;
- }
-
- /** Parses any child nodes returning them in an array. */
- private function parseParameters($paramsNode) {
- $params = array();
-
- foreach ($paramsNode->param as $paramNode) {
- if (empty($paramNode['name'])) {
- $this->warn("A node is missing the required 'name' attribute. Skipping parameter.");
- continue;
- }
-
- $name = $this->getAttributeValue($paramNode, 'name');
- $value = $this->getAttributeValue($paramNode, 'value');
-
- $params[$name] = $value;
- }
-
- return $params;
- }
-
- /** Parses a node. */
- private function parseRootLogger(SimpleXMLElement $node) {
- $logger = array();
-
- if (isset($node->level)) {
- $logger['level'] = $this->getAttributeValue($node->level, 'value');
- }
-
- $logger['appenders'] = $this->parseAppenderReferences($node);
-
- $this->config['rootLogger'] = $logger;
- }
-
- /** Parses a node. */
- private function parseLogger(SimpleXMLElement $node) {
- $logger = array();
-
- $name = $this->getAttributeValue($node, 'name');
- if (empty($name)) {
- $this->warn("A node is missing the required 'name' attribute. Skipping logger definition.");
- return;
- }
-
- if (isset($node->level)) {
- $logger['level'] = $this->getAttributeValue($node->level, 'value');
- }
-
- if (isset($node['additivity'])) {
- $logger['additivity'] = $this->getAttributeValue($node, 'additivity');
- }
-
- $logger['appenders'] = $this->parseAppenderReferences($node);
-
- // Check for duplicate loggers
- if (isset($this->config['loggers'][$name])) {
- $this->warn("Duplicate logger definition [$name]. Overwriting.");
- }
-
- $this->config['loggers'][$name] = $logger;
- }
-
- /**
- * Parses a node for appender references and returns them in an array.
- *
- * Previous versions supported appender-ref, as well as appender_ref so both
- * are parsed for backward compatibility.
- */
- private function parseAppenderReferences(SimpleXMLElement $node) {
- $refs = array();
- foreach ($node->appender_ref as $ref) {
- $refs[] = $this->getAttributeValue($ref, 'ref');
- }
-
- foreach ($node->{'appender-ref'} as $ref) {
- $refs[] = $this->getAttributeValue($ref, 'ref');
- }
-
- return $refs;
- }
-
- /** Parses a node. */
- private function parseFilter($filterNode) {
- $filter = array();
- $filter['class'] = $this->getAttributeValue($filterNode, 'class');
-
- if (count($filterNode->param) > 0) {
- $filter['params'] = $this->parseParameters($filterNode);
- }
-
- return $filter;
- }
-
- /** Parses a node. */
- private function parseRenderer(SimpleXMLElement $node) {
- $renderedClass = $this->getAttributeValue($node, 'renderedClass');
- $renderingClass = $this->getAttributeValue($node, 'renderingClass');
-
- $this->config['renderers'][] = compact('renderedClass', 'renderingClass');
- }
-
- /** Parses a node. */
- private function parseDefaultRenderer(SimpleXMLElement $node) {
- $renderingClass = $this->getAttributeValue($node, 'renderingClass');
-
- // Warn on duplicates
- if (isset($this->config['defaultRenderer'])) {
- $this->warn("Duplicate node. Overwriting.");
- }
-
- $this->config['defaultRenderer'] = $renderingClass;
- }
-
- // ******************************************
- // ** Helper methods **
- // ******************************************
-
- private function getAttributeValue(SimpleXMLElement $node, $name) {
- return isset($node[$name]) ? (string)$node[$name] : null;
- }
-
- private function warn($message) {
- trigger_error("log4php: " . $message, E_USER_WARNING);
- }
-}
-
diff --git a/library/log4php/configurators/LoggerConfiguratorDefault.php b/library/log4php/configurators/LoggerConfiguratorDefault.php
deleted file mode 100644
--- a/library/log4php/configurators/LoggerConfiguratorDefault.php
+++ /dev/null
@@ -1,470 +0,0 @@
- 'LoggerConfigurationAdapterXML',
- self::FORMAT_INI => 'LoggerConfigurationAdapterINI',
- self::FORMAT_PHP => 'LoggerConfigurationAdapterPHP',
- );
-
- /** Default configuration; used if no configuration file is provided. */
- private static $defaultConfiguration = array(
- 'threshold' => 'ALL',
- 'rootLogger' => array(
- 'level' => 'DEBUG',
- 'appenders' => array('default'),
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'LoggerAppenderEcho'
- ),
- ),
- );
-
- /** Holds the appenders before they are linked to loggers. */
- private $appenders = array();
-
- /**
- * Configures log4php based on the given configuration. The input can
- * either be a path to the config file, or a PHP array holding the
- * configuration.
- *
- * If no configuration is given, or if the given configuration cannot be
- * parsed for whatever reason, a warning will be issued, and log4php
- * will use the default configuration contained in
- * {@link $defaultConfiguration}.
- *
- * @param LoggerHierarchy $hierarchy The hierarchy on which to perform
- * the configuration.
- * @param string|array $input Either path to the config file or the
- * configuration as an array. If not set, default configuration
- * will be used.
- */
- public function configure(LoggerHierarchy $hierarchy, $input = null) {
- $config = $this->parse($input);
- $this->doConfigure($hierarchy, $config);
- }
-
- /**
- * Parses the given configuration and returns the parsed configuration
- * as a PHP array. Does not perform any configuration.
- *
- * If no configuration is given, or if the given configuration cannot be
- * parsed for whatever reason, a warning will be issued, and the default
- * configuration will be returned ({@link $defaultConfiguration}).
- *
- * @param string|array $input Either path to the config file or the
- * configuration as an array. If not set, default configuration
- * will be used.
- * @return array The parsed configuration.
- */
- public function parse($input) {
- // No input - use default configuration
- if (!isset($input)) {
- $config = self::$defaultConfiguration;
- } // Array input - contains configuration within the array
- else if (is_array($input)) {
- $config = $input;
- } // String input - contains path to configuration file
- else if (is_string($input)) {
- try {
- $config = $this->parseFile($input);
- } catch (LoggerException $e) {
- $this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
- $config = self::$defaultConfiguration;
- }
- } // Anything else is an error
- else {
- $this->warn("Invalid configuration param given. Reverting to default configuration.");
- $config = self::$defaultConfiguration;
- }
-
- return $config;
- }
-
- /**
- * Returns the default log4php configuration.
- * @return array
- */
- public static function getDefaultConfiguration() {
- return self::$defaultConfiguration;
- }
-
- /**
- * Loads the configuration file from the given URL, determines which
- * adapter to use, converts the configuration to a PHP array and
- * returns it.
- *
- * @param string $url Path to the config file.
- * @return The configuration from the config file, as a PHP array.
- * @throws LoggerException If the configuration file cannot be loaded, or
- * if the parsing fails.
- */
- private function parseFile($url) {
-
- if (!file_exists($url)) {
- throw new LoggerException("File not found at [$url].");
- }
-
- $type = $this->getConfigType($url);
- $adapterClass = $this->adapters[$type];
-
- $adapter = new $adapterClass();
- return $adapter->convert($url);
- }
-
- /** Determines configuration file type based on the file extension. */
- private function getConfigType($url) {
- $info = pathinfo($url);
- $ext = strtolower($info['extension']);
-
- switch ($ext) {
- case 'xml':
- return self::FORMAT_XML;
-
- case 'ini':
- case 'properties':
- return self::FORMAT_INI;
-
- case 'php':
- return self::FORMAT_PHP;
-
- default:
- throw new LoggerException("Unsupported configuration file extension: $ext");
- }
- }
-
- /**
- * Constructs the logger hierarchy based on configuration.
- *
- * @param LoggerHierarchy $hierarchy
- * @param array $config
- */
- private function doConfigure(LoggerHierarchy $hierarchy, $config) {
- if (isset($config['threshold'])) {
- $threshold = LoggerLevel::toLevel($config['threshold']);
- if (isset($threshold)) {
- $hierarchy->setThreshold($threshold);
- } else {
- $this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
- }
- }
-
- // Configure appenders and add them to the appender pool
- if (isset($config['appenders']) && is_array($config['appenders'])) {
- foreach ($config['appenders'] as $name => $appenderConfig) {
- $this->configureAppender($name, $appenderConfig);
- }
- }
-
- // Configure root logger
- if (isset($config['rootLogger'])) {
- $this->configureRootLogger($hierarchy, $config['rootLogger']);
- }
-
- // Configure loggers
- if (isset($config['loggers']) && is_array($config['loggers'])) {
- foreach ($config['loggers'] as $loggerName => $loggerConfig) {
- $this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
- }
- }
-
- // Configure renderers
- if (isset($config['renderers']) && is_array($config['renderers'])) {
- foreach ($config['renderers'] as $rendererConfig) {
- $this->configureRenderer($hierarchy, $rendererConfig);
- }
- }
-
- if (isset($config['defaultRenderer'])) {
- $this->configureDefaultRenderer($hierarchy, $config['defaultRenderer']);
- }
- }
-
- private function configureRenderer(LoggerHierarchy $hierarchy, $config) {
- if (empty($config['renderingClass'])) {
- $this->warn("Rendering class not specified. Skipping renderer definition.");
- return;
- }
-
- if (empty($config['renderedClass'])) {
- $this->warn("Rendered class not specified. Skipping renderer definition.");
- return;
- }
-
- // Error handling performed by RendererMap
- $hierarchy->getRendererMap()->addRenderer($config['renderedClass'], $config['renderingClass']);
- }
-
- private function configureDefaultRenderer(LoggerHierarchy $hierarchy, $class) {
- if (empty($class)) {
- $this->warn("Rendering class not specified. Skipping default renderer definition.");
- return;
- }
-
- // Error handling performed by RendererMap
- $hierarchy->getRendererMap()->setDefaultRenderer($class);
- }
-
- /**
- * Configures an appender based on given config and saves it to
- * {@link $appenders} array so it can be later linked to loggers.
- * @param string $name Appender name.
- * @param array $config Appender configuration options.
- */
- private function configureAppender($name, $config) {
-
- // TODO: add this check to other places where it might be useful
- if (!is_array($config)) {
- $type = gettype($config);
- $this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
- return;
- }
-
- // Parse appender class
- $class = $config['class'];
- if (empty($class)) {
- $this->warn("No class given for appender [$name]. Skipping appender definition.");
- return;
- }
- if (!class_exists($class)) {
- $this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
- return;
- }
-
- // Instantiate the appender
- $appender = new $class($name);
- if (!($appender instanceof LoggerAppender)) {
- $this->warn("Invalid class [$class] given for appender [$name]. Not a valid LoggerAppender class. Skipping appender definition.");
- return;
- }
-
- // Parse the appender threshold
- if (isset($config['threshold'])) {
- $threshold = LoggerLevel::toLevel($config['threshold']);
- if ($threshold instanceof LoggerLevel) {
- $appender->setThreshold($threshold);
- } else {
- $this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
- }
- }
-
- // Parse the appender layout
- if ($appender->requiresLayout() && isset($config['layout'])) {
- $this->createAppenderLayout($appender, $config['layout']);
- }
-
- // Parse filters
- if (isset($config['filters']) && is_array($config['filters'])) {
- foreach ($config['filters'] as $filterConfig) {
- $this->createAppenderFilter($appender, $filterConfig);
- }
- }
-
- // Set options if any
- if (isset($config['params'])) {
- $this->setOptions($appender, $config['params']);
- }
-
- // Activate and save for later linking to loggers
- $appender->activateOptions();
- $this->appenders[$name] = $appender;
- }
-
- /**
- * Parses layout config, creates the layout and links it to the appender.
- * @param LoggerAppender $appender
- * @param array $config Layout configuration.
- */
- private function createAppenderLayout(LoggerAppender $appender, $config) {
- $name = $appender->getName();
- $class = $config['class'];
- if (empty($class)) {
- $this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
- return;
- }
- if (!class_exists($class)) {
- $this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
- return;
- }
-
- $layout = new $class();
- if (!($layout instanceof LoggerLayout)) {
- $this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
- return;
- }
-
- if (isset($config['params'])) {
- $this->setOptions($layout, $config['params']);
- }
-
- $layout->activateOptions();
- $appender->setLayout($layout);
- }
-
- /**
- * Parses filter config, creates the filter and adds it to the appender's
- * filter chain.
- * @param LoggerAppender $appender
- * @param array $config Filter configuration.
- */
- private function createAppenderFilter(LoggerAppender $appender, $config) {
- $name = $appender->getName();
- $class = $config['class'];
- if (!class_exists($class)) {
- $this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
- return;
- }
-
- $filter = new $class();
- if (!($filter instanceof LoggerFilter)) {
- $this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
- return;
- }
-
- if (isset($config['params'])) {
- $this->setOptions($filter, $config['params']);
- }
-
- $filter->activateOptions();
- $appender->addFilter($filter);
- }
-
- /**
- * Configures the root logger
- * @see configureLogger()
- */
- private function configureRootLogger(LoggerHierarchy $hierarchy, $config) {
- $logger = $hierarchy->getRootLogger();
- $this->configureLogger($logger, $config);
- }
-
- /**
- * Configures a logger which is not root.
- * @see configureLogger()
- */
- private function configureOtherLogger(LoggerHierarchy $hierarchy, $name, $config) {
- // Get logger from hierarchy (this creates it if it doesn't already exist)
- $logger = $hierarchy->getLogger($name);
- $this->configureLogger($logger, $config);
- }
-
- /**
- * Configures a logger.
- *
- * @param Logger $logger The logger to configure
- * @param array $config Logger configuration options.
- */
- private function configureLogger(Logger $logger, $config) {
- $loggerName = $logger->getName();
-
- // Set logger level
- if (isset($config['level'])) {
- $level = LoggerLevel::toLevel($config['level']);
- if (isset($level)) {
- $logger->setLevel($level);
- } else {
- $this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
- }
- }
-
- // Link appenders to logger
- if (isset($config['appenders'])) {
- foreach ($config['appenders'] as $appenderName) {
- if (isset($this->appenders[$appenderName])) {
- $logger->addAppender($this->appenders[$appenderName]);
- } else {
- $this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
- }
- }
- }
-
- // Set logger additivity
- if (isset($config['additivity'])) {
- try {
- $additivity = LoggerOptionConverter::toBooleanEx($config['additivity'], null);
- $logger->setAdditivity($additivity);
- } catch (Exception $ex) {
- $this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
- }
- }
- }
-
- /**
- * Helper method which applies given options to an object which has setters
- * for these options (such as appenders, layouts, etc.).
- *
- * For example, if options are:
- *
- * array(
- * 'file' => '/tmp/myfile.log',
- * 'append' => true
- * )
- *
- *
- * This method will call:
- *
- * $object->setFile('/tmp/myfile.log')
- * $object->setAppend(true)
- *
- *
- * If required setters do not exist, it will produce a warning.
- *
- * @param mixed $object The object to configure.
- * @param unknown_type $options
- */
- private function setOptions($object, $options) {
- foreach ($options as $name => $value) {
- $setter = "set$name";
- if (method_exists($object, $setter)) {
- $object->$setter($value);
- } else {
- $class = get_class($object);
- $this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
- }
- }
- }
-
- /** Helper method to simplify error reporting. */
- private function warn($message) {
- trigger_error("log4php: $message", E_USER_WARNING);
- }
-}
diff --git a/library/log4php/filters/LoggerFilterDenyAll.php b/library/log4php/filters/LoggerFilterDenyAll.php
deleted file mode 100644
--- a/library/log4php/filters/LoggerFilterDenyAll.php
+++ /dev/null
@@ -1,56 +0,0 @@
-
- * An example for this filter:
- *
- * {@example ../../examples/php/filter_denyall.php 19}
- *
- *
- * The corresponding XML file:
- *
- * {@example ../../examples/resources/filter_denyall.xml 18}
- *
- * @version $Revision: 883108 $
- * @package log4php
- * @subpackage filters
- * @since 0.3
- */
-class LoggerFilterDenyAll extends LoggerFilter {
-
- /**
- * Always returns the integer constant {@link LoggerFilter::DENY}
- * regardless of the {@link LoggerLoggingEvent} parameter.
- *
- * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to filter.
- * @return LoggerFilter::DENY Always returns {@link LoggerFilter::DENY}
- */
- public function decide(LoggerLoggingEvent $event) {
- return LoggerFilter::DENY;
- }
-}
diff --git a/library/log4php/filters/LoggerFilterLevelMatch.php b/library/log4php/filters/LoggerFilterLevelMatch.php
deleted file mode 100644
--- a/library/log4php/filters/LoggerFilterLevelMatch.php
+++ /dev/null
@@ -1,100 +0,0 @@
-The filter admits two options LevelToMatch and
- * AcceptOnMatch. If there is an exact match between the value
- * of the LevelToMatch option and the level of the
- * {@link LoggerLoggingEvent}, then the {@link decide()} method returns
- * {@link LoggerFilter::ACCEPT} in case the AcceptOnMatch
- * option value is set to true, if it is false then
- * {@link LoggerFilter::DENY} is returned. If there is no match,
- * {@link LoggerFilter::NEUTRAL} is returned.
- *
- *
- * An example for this filter:
- *
- * {@example ../../examples/php/filter_levelmatch.php 19}
- *
- *
- * The corresponding XML file:
- *
- * {@example ../../examples/resources/filter_levelmatch.xml 18}
- *
- * @version $Revision: 1213283 $
- * @package log4php
- * @subpackage filters
- * @since 0.6
- */
-class LoggerFilterLevelMatch extends LoggerFilter {
-
- /**
- * Indicates if this event should be accepted or denied on match
- * @var boolean
- */
- protected $acceptOnMatch = true;
-
- /**
- * The level, when to match
- * @var LoggerLevel
- */
- protected $levelToMatch;
-
- /**
- * @param boolean $acceptOnMatch
- */
- public function setAcceptOnMatch($acceptOnMatch) {
- $this->setBoolean('acceptOnMatch', $acceptOnMatch);
- }
-
- /**
- * @param string $l the level to match
- */
- public function setLevelToMatch($level) {
- $this->setLevel('levelToMatch', $level);
- }
-
- /**
- * Return the decision of this filter.
- *
- * Returns {@link LoggerFilter::NEUTRAL} if the LevelToMatch
- * option is not set or if there is not match. Otherwise, if there is a
- * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
- * AcceptOnMatch property is set to true. The
- * returned decision is {@link LoggerFilter::DENY} if the
- * AcceptOnMatch property is set to false.
- *
- * @param LoggerLoggingEvent $event
- * @return integer
- */
- public function decide(LoggerLoggingEvent $event) {
- if ($this->levelToMatch === null) {
- return LoggerFilter::NEUTRAL;
- }
-
- if ($this->levelToMatch->equals($event->getLevel())) {
- return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
- } else {
- return LoggerFilter::NEUTRAL;
- }
- }
-}
diff --git a/library/log4php/filters/LoggerFilterLevelRange.php b/library/log4php/filters/LoggerFilterLevelRange.php
deleted file mode 100644
--- a/library/log4php/filters/LoggerFilterLevelRange.php
+++ /dev/null
@@ -1,138 +0,0 @@
-The filter admits three options LevelMin, LevelMax
- * and AcceptOnMatch.
- *
- *
If the level of the {@link LoggerLoggingEvent} is not between Min and Max
- * (inclusive), then {@link LoggerFilter::DENY} is returned.
- *
- *
If the Logging event level is within the specified range, then if
- * AcceptOnMatch is true,
- * {@link LoggerFilter::ACCEPT} is returned, and if
- * AcceptOnMatch is false,
- * {@link LoggerFilter::NEUTRAL} is returned.
- *
- *
If LevelMin is not defined, then there is no
- * minimum acceptable level (i.e. a level is never rejected for
- * being too "low"/unimportant). If LevelMax is not
- * defined, then there is no maximum acceptable level (ie a
- * level is never rejected for being too "high"/important).
- *
- *
Refer to the {@link LoggerAppender::setThreshold()} method
- * available to all appenders extending {@link LoggerAppender}
- * for a more convenient way to filter out events by level.
- *
- *
- * An example for this filter:
- *
- * {@example ../../examples/php/filter_levelrange.php 19}
- *
- *
- * The corresponding XML file:
- *
- * {@example ../../examples/resources/filter_levelrange.xml 18}
- *
- * @author Simon Kitching
- * @author based on the org.apache.log4j.varia.LevelRangeFilte Java code by Ceki Gülcü
- *
- * @version $Revision: 1213283 $
- * @package log4php
- * @subpackage filters
- * @since 0.6
- */
-class LoggerFilterLevelRange extends LoggerFilter {
-
- /**
- * @var boolean
- */
- protected $acceptOnMatch = true;
-
- /**
- * @var LoggerLevel
- */
- protected $levelMin;
-
- /**
- * @var LoggerLevel
- */
- protected $levelMax;
-
- /**
- * @param boolean $acceptOnMatch
- */
- public function setAcceptOnMatch($acceptOnMatch) {
- $this->setBoolean('acceptOnMatch', $acceptOnMatch);
- }
-
- /**
- * @param string $l the level min to match
- */
- public function setLevelMin($level) {
- $this->setLevel('levelMin', $level);
- }
-
- /**
- * @param string $l the level max to match
- */
- public function setLevelMax($level) {
- $this->setLevel('levelMax', $level);
- }
-
- /**
- * Return the decision of this filter.
- *
- * @param LoggerLoggingEvent $event
- * @return integer
- */
- public function decide(LoggerLoggingEvent $event) {
- $level = $event->getLevel();
-
- if ($this->levelMin !== null) {
- if ($level->isGreaterOrEqual($this->levelMin) == false) {
- // level of event is less than minimum
- return LoggerFilter::DENY;
- }
- }
-
- if ($this->levelMax !== null) {
- if ($level->toInt() > $this->levelMax->toInt()) {
- // level of event is greater than maximum
- // Alas, there is no Level.isGreater method. and using
- // a combo of isGreaterOrEqual && !Equal seems worse than
- // checking the int values of the level objects..
- return LoggerFilter::DENY;
- }
- }
-
- if ($this->acceptOnMatch) {
- // this filter set up to bypass later filters and always return
- // accept if level in range
- return LoggerFilter::ACCEPT;
- } else {
- // event is ok for this filter; allow later filters to have a look..
- return LoggerFilter::NEUTRAL;
- }
- }
-}
diff --git a/library/log4php/filters/LoggerFilterStringMatch.php b/library/log4php/filters/LoggerFilterStringMatch.php
deleted file mode 100644
--- a/library/log4php/filters/LoggerFilterStringMatch.php
+++ /dev/null
@@ -1,89 +0,0 @@
-The filter admits two options {@link $stringToMatch} and
- * {@link $acceptOnMatch}. If there is a match (using {@link PHP_MANUAL#strpos}
- * between the value of the {@link $stringToMatch} option and the message
- * of the {@link LoggerLoggingEvent},
- * then the {@link decide()} method returns {@link LoggerFilter::ACCEPT} if
- * the AcceptOnMatch option value is true, if it is false then
- * {@link LoggerFilter::DENY} is returned. If there is no match, {@link LoggerFilter::NEUTRAL}
- * is returned.
- *
- *
- * An example for this filter:
- *
- * {@example ../../examples/php/filter_stringmatch.php 19}
- *
- *
- * The corresponding XML file:
- *
- * {@example ../../examples/resources/filter_stringmatch.xml 18}
- *
- * @version $Revision: 1213283 $
- * @package log4php
- * @subpackage filters
- * @since 0.3
- */
-class LoggerFilterStringMatch extends LoggerFilter {
-
- /**
- * @var boolean
- */
- protected $acceptOnMatch = true;
-
- /**
- * @var string
- */
- protected $stringToMatch;
-
- /**
- * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
- */
- public function setAcceptOnMatch($acceptOnMatch) {
- $this->setBoolean('acceptOnMatch', $acceptOnMatch);
- }
-
- /**
- * @param string $s the string to match
- */
- public function setStringToMatch($string) {
- $this->setString('stringToMatch', $string);
- }
-
- /**
- * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
- */
- public function decide(LoggerLoggingEvent $event) {
- $msg = $event->getRenderedMessage();
-
- if ($msg === null or $this->stringToMatch === null) {
- return LoggerFilter::NEUTRAL;
- }
-
- if (strpos($msg, $this->stringToMatch) !== false) {
- return ($this->acceptOnMatch) ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
- }
- return LoggerFilter::NEUTRAL;
- }
-}
diff --git a/library/log4php/helpers/LoggerFormattingInfo.php b/library/log4php/helpers/LoggerFormattingInfo.php
deleted file mode 100644
--- a/library/log4php/helpers/LoggerFormattingInfo.php
+++ /dev/null
@@ -1,54 +0,0 @@
-$key
using this search criteria:
- * - if $key is a constant then return it. Else
- * - if $key is set in $_ENV then return it. Else
- * - return $def.
- *
- * @param string $key The key to search for.
- * @param string $def The default value to return.
- * @return string the string value of the system property, or the default
- * value if there is no property with that key.
- */
- public static function getSystemProperty($key, $def) {
- if (defined($key)) {
- return (string)constant($key);
- } else if (isset($_SERVER[$key])) {
- return (string)$_SERVER[$key];
- } else if (isset($_ENV[$key])) {
- return (string)$_ENV[$key];
- } else {
- return $def;
- }
- }
-
- /** Converts $value to boolean, or throws an exception if not possible. */
- public static function toBooleanEx($value) {
- if (isset($value)) {
- if (is_bool($value)) {
- return $value;
- }
- $value = strtolower(trim($value));
- if (in_array($value, self::$trueValues)) {
- return true;
- }
- if (in_array($value, self::$falseValues)) {
- return false;
- }
- }
-
- throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to boolean.");
- }
-
- /**
- * Converts $value to integer, or throws an exception if not possible.
- * Floats cannot be converted to integer.
- */
- public static function toIntegerEx($value) {
- if (is_integer($value)) {
- return $value;
- }
- if (is_numeric($value) && ($value == (integer)$value)) {
- return (integer)$value;
- }
-
- throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to integer.");
- }
-
- /**
- * Converts $value to integer, or throws an exception if not possible.
- * Floats cannot be converted to integer.
- */
- public static function toPositiveIntegerEx($value) {
- if (is_integer($value) && $value > 0) {
- return $value;
- }
- if (is_numeric($value) && ($value == (integer)$value) && $value > 0) {
- return (integer)$value;
- }
-
- throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a positive integer.");
- }
-
- /** Converts the value to a level. Throws an exception if not possible. */
- public static function toLevelEx($value) {
- if ($value instanceof LoggerLevel) {
- return $value;
- }
- $level = LoggerLevel::toLevel($value);
- if ($level === null) {
- throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a logger level.");
- }
- return $level;
- }
-
- /**
- * Converts a value to a valid file size (integer).
- *
- * Supports 'KB', 'MB' and 'GB' suffixes, where KB = 1024 B etc.
- *
- * The final value will be rounded to the nearest integer.
- *
- * Examples:
- * - '100' => 100
- * - '100.12' => 100
- * - '100KB' => 102400
- * - '1.5MB' => 1572864
- *
- * @param mixed $value File size (optionally with suffix).
- * @return integer Parsed file size.
- */
- public static function toFileSizeEx($value) {
-
- if (empty($value)) {
- throw new LoggerException("Empty value cannot be converted to a file size.");
- }
-
- if (is_numeric($value)) {
- return (integer)$value;
- }
-
- if (!is_string($value)) {
- throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a file size.");
- }
-
- $str = strtoupper(trim($value));
- $count = preg_match('/^([0-9.]+)(KB|MB|GB)?$/', $str, $matches);
-
- if ($count > 0) {
- $size = $matches[1];
- $unit = $matches[2];
-
- switch ($unit) {
- case 'KB':
- $size *= pow(1024, 1);
- break;
- case 'MB':
- $size *= pow(1024, 2);
- break;
- case 'GB':
- $size *= pow(1024, 3);
- break;
- }
-
- return (integer)$size;
- }
-
- throw new LoggerException("Given value [$value] cannot be converted to a file size.");
- }
-
- /**
- * Converts a value to string, or throws an exception if not possible.
- *
- * Objects can be converted to string if they implement the magic
- * __toString() method.
- *
- */
- public static function toStringEx($value) {
- if (is_string($value)) {
- return $value;
- }
- if (is_numeric($value)) {
- return (string)$value;
- }
- if (is_object($value) && method_exists($value, '__toString')) {
- return (string)$value;
- }
-
- throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to string.");
- }
-
- /**
- * Performs value substitution for string options.
- *
- * An option can contain PHP constants delimited by '${' and '}'.
- *
- * E.g. for input string "some ${FOO} value", the method will attempt
- * to substitute ${FOO} with the value of constant FOO if it exists.
- *
- * Therefore, if FOO is a constant, and it has value "bar", the resulting
- * string will be "some bar value".
- *
- * If the constant is not defined, it will be replaced by an empty string,
- * and the resulting string will be "some value".
- *
- * @param string $string String on which to perform substitution.
- * @return string
- */
- public static function substConstants($string) {
- preg_match_all('/\${([^}]+)}/', $string, $matches);
-
- foreach ($matches[1] as $key => $match) {
- $match = trim($match);
- $search = $matches[0][$key];
- $replacement = defined($match) ? constant($match) : '';
- $string = str_replace($search, $replacement, $string);
- }
- return $string;
- }
-}
diff --git a/library/log4php/helpers/LoggerPatternParser.php b/library/log4php/helpers/LoggerPatternParser.php
deleted file mode 100644
--- a/library/log4php/helpers/LoggerPatternParser.php
+++ /dev/null
@@ -1,237 +0,0 @@
-It is this class that parses conversion patterns and creates
- * a chained list of {@link LoggerPatternConverter} converters.
- *
- * @version $Revision: 1395467 $
- * @package log4php
- * @subpackage helpers
- *
- * @since 0.3
- */
-class LoggerPatternParser {
-
- /** Escape character for conversion words in the conversion pattern. */
- const ESCAPE_CHAR = '%';
-
- /** Maps conversion words to relevant converters. */
- private $converterMap;
-
- /** Conversion pattern used in layout. */
- private $pattern;
-
- /** Regex pattern used for parsing the conversion pattern. */
- private $regex;
-
- /**
- * First converter in the chain.
- * @var LoggerPatternConverter
- */
- private $head;
-
- /** Last converter in the chain. */
- private $tail;
-
- public function __construct($pattern, $converterMap) {
- $this->pattern = $pattern;
- $this->converterMap = $converterMap;
-
- // Construct the regex pattern
- $this->regex =
- '/' . // Starting regex pattern delimiter
- self::ESCAPE_CHAR . // Character which marks the start of the conversion pattern
- '(?P[0-9.-]*)' . // Format modifiers (optional)
- '(?P[a-zA-Z]+)' . // The conversion word
- '(?P
- *
- * @version $Revision: 1326626 $
- * @package log4php
- * @subpackage helpers
- * @since 0.3
- */
-abstract class LoggerPatternConverter {
-
- /**
- * Next converter in the converter chain.
- * @var LoggerPatternConverter
- */
- public $next = null;
-
- /**
- * Formatting information, parsed from pattern modifiers.
- * @var LoggerFormattingInfo
- */
- protected $formattingInfo;
-
- /**
- * Converter-specific formatting options.
- * @var array
- */
- protected $option;
-
- /**
- * Constructor
- * @param LoggerFormattingInfo $formattingInfo
- * @param array $option
- */
- public function __construct(LoggerFormattingInfo $formattingInfo = null, $option = null) {
- $this->formattingInfo = $formattingInfo;
- $this->option = $option;
- $this->activateOptions();
- }
-
- /**
- * Called in constructor. Converters which need to process the options
- * can override this method.
- */
- public function activateOptions() {
- }
-
- /**
- * Converts the logging event to the desired format. Derived pattern
- * converters must implement this method.
- *
- * @param LoggerLoggingEvent $event
- */
- abstract public function convert(LoggerLoggingEvent $event);
-
- /**
- * Converts the event and formats it according to setting in the
- * Formatting information object.
- *
- * @param string &$sbuf string buffer to write to
- * @param LoggerLoggingEvent $event Event to be formatted.
- */
- public function format(&$sbuf, $event) {
- $string = $this->convert($event);
-
- if (!isset($this->formattingInfo)) {
- $sbuf .= $string;
- return;
- }
-
- $fi = $this->formattingInfo;
-
- // Empty string
- if ($string === '' || is_null($string)) {
- if ($fi->min > 0) {
- $sbuf .= str_repeat(' ', $fi->min);
- }
- return;
- }
-
- $len = strlen($string);
-
- // Trim the string if needed
- if ($len > $fi->max) {
- if ($fi->trimLeft) {
- $sbuf .= substr($string, $len - $fi->max, $fi->max);
- } else {
- $sbuf .= substr($string, 0, $fi->max);
- }
- } // Add padding if needed
- else if ($len < $fi->min) {
- if ($fi->padLeft) {
- $sbuf .= str_repeat(' ', $fi->min - $len);
- $sbuf .= $string;
- } else {
- $sbuf .= $string;
- $sbuf .= str_repeat(' ', $fi->min - $len);
- }
- } // No action needed
- else {
- $sbuf .= $string;
- }
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterClass.php b/library/log4php/pattern/LoggerPatternConverterClass.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterClass.php
+++ /dev/null
@@ -1,62 +0,0 @@
-option) && is_numeric($this->option) && $this->option >= 0) {
- $this->length = (integer)$this->option;
- }
- }
-
- public function convert(LoggerLoggingEvent $event) {
- $name = $event->getLocationInformation()->getClassName();
-
- if (!isset($this->cache[$name])) {
-
- // If length is set return shortened class name
- if (isset($this->length)) {
- $this->cache[$name] = LoggerUtils::shortenClassName($name, $this->length);
- } // If no length is specified return the full class name
- else {
- $this->cache[$name] = $name;
- }
- }
-
- return $this->cache[$name];
- }
-}
-
\ No newline at end of file
diff --git a/library/log4php/pattern/LoggerPatternConverterCookie.php b/library/log4php/pattern/LoggerPatternConverterCookie.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterCookie.php
+++ /dev/null
@@ -1,35 +0,0 @@
- self::DATE_FORMAT_ISO8601,
- 'ABSOLUTE' => self::DATE_FORMAT_ABSOLUTE,
- 'DATE' => self::DATE_FORMAT_DATE,
- );
-
- private $useLocalDate = false;
-
- public function activateOptions() {
-
- // Parse the option (date format)
- if (!empty($this->option)) {
- if (isset($this->specials[$this->option])) {
- $this->format = $this->specials[$this->option];
- } else {
- $this->format = $this->option;
- }
- }
-
- // Check whether the pattern contains milliseconds (u)
- if (preg_match('/(?format)) {
- $this->useLocalDate = true;
- }
- }
-
- public function convert(LoggerLoggingEvent $event) {
- if ($this->useLocalDate) {
- return $this->date($this->format, $event->getTimeStamp());
- }
- return date($this->format, $event->getTimeStamp());
- }
-
- /**
- * Currently, PHP date() function always returns zeros for milliseconds (u)
- * on Windows. This is a replacement function for date() which correctly
- * displays milliseconds on all platforms.
- *
- * It is slower than PHP date() so it should only be used if necessary.
- */
- private function date($format, $utimestamp) {
- $timestamp = floor($utimestamp);
- $ms = floor(($utimestamp - $timestamp) * 1000);
- $ms = str_pad($ms, 3, '0', STR_PAD_LEFT);
-
- return date(preg_replace('`(?getLocationInformation()->getFileName();
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterLevel.php b/library/log4php/pattern/LoggerPatternConverterLevel.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterLevel.php
+++ /dev/null
@@ -1,34 +0,0 @@
-getLevel()->toString();
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterLine.php b/library/log4php/pattern/LoggerPatternConverterLine.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterLine.php
+++ /dev/null
@@ -1,35 +0,0 @@
-getLocationInformation()->getLineNumber();
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterLiteral.php b/library/log4php/pattern/LoggerPatternConverterLiteral.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterLiteral.php
+++ /dev/null
@@ -1,40 +0,0 @@
-literalValue = $literalValue;
- }
-
- public function convert(LoggerLoggingEvent $event) {
- return $this->literalValue;
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterLocation.php b/library/log4php/pattern/LoggerPatternConverterLocation.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterLocation.php
+++ /dev/null
@@ -1,39 +0,0 @@
-getLocationInformation()->getClassName() . '.' .
- $event->getLocationInformation()->getMethodName() . '(' .
- $event->getLocationInformation()->getFileName() . ':' .
- $event->getLocationInformation()->getLineNumber() . ')';
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterLogger.php b/library/log4php/pattern/LoggerPatternConverterLogger.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterLogger.php
+++ /dev/null
@@ -1,63 +0,0 @@
-option) && is_numeric($this->option) && $this->option >= 0) {
- $this->length = (integer)$this->option;
- }
- }
-
- public function convert(LoggerLoggingEvent $event) {
- $name = $event->getLoggerName();
-
- if (!isset($this->cache[$name])) {
-
- // If length is set return shortened logger name
- if (isset($this->length)) {
- $this->cache[$name] = LoggerUtils::shortenClassName($name, $this->length);
- } // If no length is specified return full logger name
- else {
- $this->cache[$name] = $name;
- }
- }
-
- return $this->cache[$name];
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterMDC.php b/library/log4php/pattern/LoggerPatternConverterMDC.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterMDC.php
+++ /dev/null
@@ -1,55 +0,0 @@
-option) && $this->option !== '') {
- $this->key = $this->option;
- }
- }
-
- public function convert(LoggerLoggingEvent $event) {
- if (isset($this->key)) {
- return $event->getMDC($this->key);
- } else {
- $buff = array();
- $map = $event->getMDCMap();
- foreach ($map as $key => $value) {
- $buff [] = "$key=$value";
- }
- return implode(', ', $buff);
- }
- }
-}
-
\ No newline at end of file
diff --git a/library/log4php/pattern/LoggerPatternConverterMessage.php b/library/log4php/pattern/LoggerPatternConverterMessage.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterMessage.php
+++ /dev/null
@@ -1,34 +0,0 @@
-getRenderedMessage();
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterMethod.php b/library/log4php/pattern/LoggerPatternConverterMethod.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterMethod.php
+++ /dev/null
@@ -1,35 +0,0 @@
-getLocationInformation()->getMethodName();
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterNDC.php b/library/log4php/pattern/LoggerPatternConverterNDC.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterNDC.php
+++ /dev/null
@@ -1,35 +0,0 @@
-getNDC();
- }
-}
-
\ No newline at end of file
diff --git a/library/log4php/pattern/LoggerPatternConverterNewLine.php b/library/log4php/pattern/LoggerPatternConverterNewLine.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterNewLine.php
+++ /dev/null
@@ -1,34 +0,0 @@
-getRelativeTime();
- return number_format($ts, 4);
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterRequest.php b/library/log4php/pattern/LoggerPatternConverterRequest.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterRequest.php
+++ /dev/null
@@ -1,35 +0,0 @@
-option) && $this->option !== '') {
- $key = $this->option;
- }
-
- /*
- * There is a bug in PHP which doesn't allow superglobals to be
- * accessed when their name is stored in a variable, e.g.:
- *
- * $name = '_SERVER';
- * $array = $$name;
- *
- * This code does not work when run from within a method (only when run
- * in global scope). But the following code does work:
- *
- * $name = '_SERVER';
- * global $$name;
- * $array = $$name;
- *
- * That's why global is used here.
- */
- global ${$this->name};
-
- // Check the given superglobal exists. It is possible that it is not initialized.
- if (!isset(${$this->name})) {
- $class = get_class($this);
- trigger_error("log4php: $class: Cannot find superglobal variable \${$this->name}.", E_USER_WARNING);
- return;
- }
-
- $source = ${$this->name};
-
- // When the key is set, display the matching value
- if (isset($key)) {
- if (isset($source[$key])) {
- $this->value = $source[$key];
- }
- } // When the key is not set, display all values
- else {
- $values = array();
- foreach ($source as $key => $value) {
- $values[] = "$key=$value";
- }
- $this->value = implode(', ', $values);
- }
- }
-
- public function convert(LoggerLoggingEvent $event) {
- return $this->value;
- }
-}
diff --git a/library/log4php/pattern/LoggerPatternConverterThrowable.php b/library/log4php/pattern/LoggerPatternConverterThrowable.php
deleted file mode 100644
--- a/library/log4php/pattern/LoggerPatternConverterThrowable.php
+++ /dev/null
@@ -1,40 +0,0 @@
-getThrowableInformation();
- if (isset($info)) {
- $ex = $info->getThrowable();
- return (string)$ex . PHP_EOL;
- }
- return '';
- }
-}
-
\ No newline at end of file
diff --git a/library/log4php/renderers/LoggerRenderer.php b/library/log4php/renderers/LoggerRenderer.php
deleted file mode 100644
--- a/library/log4php/renderers/LoggerRenderer.php
+++ /dev/null
@@ -1,36 +0,0 @@
-input to a string.
- * @param mixed $input The entity to render.
- * @return string The rendered string.
- */
- public function render($input);
-}
diff --git a/library/log4php/renderers/LoggerRendererDefault.php b/library/log4php/renderers/LoggerRendererDefault.php
deleted file mode 100644
--- a/library/log4php/renderers/LoggerRendererDefault.php
+++ /dev/null
@@ -1,36 +0,0 @@
-print_r.
- *
- * @package log4php
- * @subpackage renderers
- * @since 0.3
- */
-class LoggerRendererDefault implements LoggerRenderer {
-
- /** @inheritdoc */
- public function render($input) {
- return print_r($input, true);
- }
-}
diff --git a/library/log4php/renderers/LoggerRendererException.php b/library/log4php/renderers/LoggerRendererException.php
deleted file mode 100644
--- a/library/log4php/renderers/LoggerRendererException.php
+++ /dev/null
@@ -1,36 +0,0 @@
-reset();
- }
-
- /**
- * Adds a renderer to the map.
- *
- * If a renderer already exists for the given $renderedClass it
- * will be overwritten without warning.
- *
- * @param string $renderedClass The name of the class which will be
- * rendered by the renderer.
- * @param string $renderingClass The name of the class which will
- * perform the rendering.
- */
- public function addRenderer($renderedClass, $renderingClass) {
- // Check the rendering class exists
- if (!class_exists($renderingClass)) {
- trigger_error("log4php: Failed adding renderer. Rendering class [$renderingClass] not found.");
- return;
- }
-
- // Create the instance
- $renderer = new $renderingClass();
-
- // Check the class implements the right interface
- if (!($renderer instanceof LoggerRenderer)) {
- trigger_error("log4php: Failed adding renderer. Rendering class [$renderingClass] does not implement the LoggerRenderer interface.");
- return;
- }
-
- // Convert to lowercase since class names in PHP are not case sensitive
- $renderedClass = strtolower($renderedClass);
-
- $this->map[$renderedClass] = $renderer;
- }
-
- /**
- * Sets a custom default renderer class.
- *
- * TODO: there's code duplication here. This method is almost identical to
- * addRenderer(). However, it has custom error messages so let it sit for
- * now.
- *
- * @param string $renderingClass The name of the class which will
- * perform the rendering.
- */
- public function setDefaultRenderer($renderingClass) {
- // Check the class exists
- if (!class_exists($renderingClass)) {
- trigger_error("log4php: Failed setting default renderer. Rendering class [$renderingClass] not found.");
- return;
- }
-
- // Create the instance
- $renderer = new $renderingClass();
-
- // Check the class implements the right interface
- if (!($renderer instanceof LoggerRenderer)) {
- trigger_error("log4php: Failed setting default renderer. Rendering class [$renderingClass] does not implement the LoggerRenderer interface.");
- return;
- }
-
- $this->defaultRenderer = $renderer;
- }
-
- /**
- * Returns the default renderer.
- * @var LoggerRenderer
- */
- public function getDefaultRenderer() {
- return $this->defaultRenderer;
- }
-
- /**
- * Finds the appropriate renderer for the given input, and
- * renders it (i.e. converts it to a string).
- *
- * @param mixed $input Input to render.
- * @return string The rendered contents.
- */
- public function findAndRender($input) {
- if ($input === null) {
- return null;
- }
-
- // For objects, try to find a renderer in the map
- if (is_object($input)) {
- $renderer = $this->getByClassName(get_class($input));
- if (isset($renderer)) {
- return $renderer->render($input);
- }
- }
-
- // Fall back to the default renderer
- return $this->defaultRenderer->render($input);
- }
-
- /**
- * Returns the appropriate renderer for a given object.
- *
- * @param mixed $object
- * @return LoggerRenderer Or null if none found.
- */
- public function getByObject($object) {
- if (!is_object($object)) {
- return null;
- }
- return $this->getByClassName(get_class($object));
- }
-
- /**
- * Returns the appropriate renderer for a given class name.
- *
- * If no renderer could be found, returns NULL.
- *
- * @param string $class
- * @return LoggerRendererObject Or null if not found.
- */
- public function getByClassName($class) {
- for (; !empty($class); $class = get_parent_class($class)) {
- $class = strtolower($class);
- if (isset($this->map[$class])) {
- return $this->map[$class];
- }
- }
- return null;
- }
-
- /** Empties the renderer map. */
- public function clear() {
- $this->map = array();
- }
-
- /** Resets the renderer map to it's default configuration. */
- public function reset() {
- $this->defaultRenderer = new LoggerRendererDefault();
- $this->clear();
- $this->addRenderer('Exception', 'LoggerRendererException');
- }
-}
diff --git a/library/log4php/xml/log4php.dtd b/library/log4php/xml/log4php.dtd
deleted file mode 100644
--- a/library/log4php/xml/log4php.dtd
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/library/smarty/.gitattributes b/library/smarty/.gitattributes
deleted file mode 100644
--- a/library/smarty/.gitattributes
+++ /dev/null
@@ -1,22 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto
-
-# Custom for Visual Studio
-*.cs diff=csharp
-*.sln merge=union
-*.csproj merge=union
-*.vbproj merge=union
-*.fsproj merge=union
-*.dbproj merge=union
-
-# Standard to msysgit
-*.doc diff=astextplain
-*.DOC diff=astextplain
-*.docx diff=astextplain
-*.DOCX diff=astextplain
-*.dot diff=astextplain
-*.DOT diff=astextplain
-*.pdf diff=astextplain
-*.PDF diff=astextplain
-*.rtf diff=astextplain
-*.RTF diff=astextplain
diff --git a/library/smarty/.gitignore b/library/smarty/.gitignore
deleted file mode 100644
--- a/library/smarty/.gitignore
+++ /dev/null
@@ -1,222 +0,0 @@
-#################
-## Eclipse
-#################
-
-*.pydevproject
-.project
-.metadata
-bin/
-tmp/
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.classpath
-.settings/
-.loadpath
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# CDT-specific
-.cproject
-
-# PDT-specific
-.buildpath
-
-
-#################
-## Visual Studio
-#################
-
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.sln.docstates
-
-# Build results
-
-[Dd]ebug/
-[Rr]elease/
-x64/
-build/
-[Bb]in/
-[Oo]bj/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-*_i.c
-*_p.c
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.log
-*.scc
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opensdf
-*.sdf
-*.cachefile
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# NCrunch
-*.ncrunch*
-.*crunch*.local.xml
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.Publish.xml
-*.pubxml
-
-# NuGet Packages Directory
-## TODO: If you have NuGet Package Restore enabled, uncomment the next line
-#packages/
-
-# Windows Azure Build Output
-csx
-*.build.csdef
-
-# Windows Store app package directory
-AppPackages/
-
-# Others
-sql/
-*.Cache
-ClientBin/
-[Ss]tyle[Cc]op.*
-~$*
-*~
-*.dbmdl
-*.[Pp]ublish.xml
-*.pfx
-*.publishsettings
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file to a newer
-# Visual Studio version. Backup files are not needed, because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-
-# SQL Server files
-App_Data/*.mdf
-App_Data/*.ldf
-
-#############
-## Windows detritus
-#############
-
-# Windows image file caches
-Thumbs.db
-ehthumbs.db
-
-# Folder config file
-Desktop.ini
-
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
-
-# Mac crap
-.DS_Store
-
-
-#############
-## Python
-#############
-
-*.py[co]
-
-# Packages
-*.egg
-*.egg-info
-dist/
-build/
-eggs/
-parts/
-var/
-sdist/
-develop-eggs/
-.installed.cfg
-
-# Installer logs
-pip-log.txt
-
-# Unit test / coverage reports
-.coverage
-.tox
-
-#Translations
-*.mo
-
-#Mr Developer
-.mr.developer.cfg
-
-.idea/
-.idea\
-
-# Smarty
-lexer/*.php
-lexer/*.out
\ No newline at end of file
diff --git a/library/smarty/.travis.yml b/library/smarty/.travis.yml
deleted file mode 100644
--- a/library/smarty/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: php
-
-php:
- - 5.3
- - 5.4
- - 5.5
- - 5.6
-
-allow_failures:
- - php: hhvm
-
-install:
- - git clone --depth=50 --branch=master git://github.com/smarty-php/smarty-phpunit.git
-
-script:
- - cd smarty-phpunit
- - phpunit ./
-
diff --git a/library/smarty/COMPOSER_RELEASE_NOTES.txt b/library/smarty/COMPOSER_RELEASE_NOTES.txt
deleted file mode 100644
--- a/library/smarty/COMPOSER_RELEASE_NOTES.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-Starting with Smarty 3.1.21 Composer has been configured to load the packages from github.
-
-*******************************************************************************
-* *
-* NOTE: Because of this change you must clear your local composer cache with *
-* the "composer clearcache" command *
-* *
-*******************************************************************************
-
-To get the latest stable version use
- "require": {
- "smarty/smarty": "~3.1"
- }
-in your composer.json file.
-
-To get the trunk version use
- "require": {
- "smarty/smarty": "~3.1@dev"
- }
-
-The "smarty/smarty" package will start at libs/.... subfolder.
-
-To retrieve the development and documentation folders add
- "require-dev": {
- "smarty/smarty-dev": "~3.1@dev"
- }
-
diff --git a/library/smarty/COPYING.lib b/library/smarty/COPYING.lib
deleted file mode 100644
--- a/library/smarty/COPYING.lib
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
\ No newline at end of file
diff --git a/library/smarty/INHERITANCE_RELEASE_NOTES.txt b/library/smarty/INHERITANCE_RELEASE_NOTES.txt
deleted file mode 100644
--- a/library/smarty/INHERITANCE_RELEASE_NOTES.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-In Smarty 3.1 template inheritance is a compile time process. All the extending of {block} tags
-is done at compile time and the parent and child templates are compiled in a single compiled template.
-{include} subtemplate could also {block} tags. Such subtemplate could not compiled by it's own because
-it could be used in other context where the {block} extended with a different result. For that reasion
-the compiled code of {include} subtemplates gets also merged in compiled inheritance template.
-
-Merging the code into a single compile template has some drawbacks.
-1. You could not use variable file names in {include} Smarty would use the {include} of compilation time.
-2. You could not use individual compile_id in {include}
-3. Seperate caching of subtemplate was not possible
-4. Any change of the template directory structure between calls was not necessarily seen.
-
-Starting with 3.1.15 some of the above conditions got checked and resulted in an exception. It turned out
-that a couple of users did use some of above and now got exceptions.
-
-To resolve this starting with 3.1.16 there is a new configuration parameter $inheritance_merge_compiled_includes.
-For most backward compatibility its default setting is true.
-With this setting all {include} subtemplate will be merge into the compiled inheritance template, but the above cases
-could be rejected by exception.
-
-
-If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged.
-You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option.
-{include file='foo.bar' inline}
-
-1. In case of a variable file name like {include file=$foo inline} you must use the variable in a compile_id $smarty->compile_id = $foo;
-2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the
- global compile_id as well $smarty->compile_id = $bar;
-3. If call templates with different template_dir configurations and a parent could same named child template from different folders
- you must make the folder name part of the compile_id.
-
-
-In the upcomming major release Smarty 3.2 inheritance will no longer be a compile time process.
-All restrictions will be then removed.
-
diff --git a/library/smarty/NEW_FEATURES.txt b/library/smarty/NEW_FEATURES.txt
deleted file mode 100644
--- a/library/smarty/NEW_FEATURES.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-This file contains a brief description of new features which have been added to Smarty 3.1
-
-Smarty 3.1.22
-
- Namespace support within templates
- ==================================
- Within templates you can now use namespace specifications on:
- - Constants like foo\bar\FOO
- - Class names like foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo()
- - PHP function names like foo\bar\baz()
-
- Security
- ========
- - disable special $smarty variable -
- The Smarty_Security class has the new property $disabled_special_smarty_vars.
- It's an array which can be loaded with the $smarty special variable names like
- 'template_object', 'template', 'current_dir' and others which will be disabled.
- Note: That this security check is performed at compile time.
-
- - limit template nesting -
- Property $max_template_nesting of Smarty_Security does set the maximum template nesting level.
- The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded
- an Exception will be thrown. The default setting is 0 which does disable this check.
-
- - trusted static methods -
- The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods.
- It's an nested array of trusted class and method names.
- Format:
- array (
- 'class_1' => array('method_1', 'method_2'), // allowed methods
- 'class_2' => array(), // all methods of class allowed
- )
- To disable access for all methods of all classes set $trusted_static_methods = null;
- The default value is an empty array() which does enables all methods of all classes, but for backward compatibility
- the setting of $static_classes will be checked.
- Note: That this security check is performed at compile time.
-
- - trusted static properties -
- The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties.
- It's an nested array of trusted class and property names.
- Format:
- array (
- 'class_1' => array('prop_1', 'prop_2'), // allowed properties listed
- 'class_2' => array(), // all properties of class allowed
- }
- To disable access for all properties of all classes set $trusted_static_properties = null;
- The default value is an empty array() which does enables all properties of all classes, but for backward compatibility
- the setting of $static_classes will be checked.
- Note: That this security check is performed at compile time.
-
- - trusted constants .
- The Smarty_Security class has the new property $trusted_constants to restrict access to constants.
- It's an array of trusted constant names.
- Format:
- array (
- 'SMARTY_DIR' , // allowed constant
- }
- If the array is empty (default) the usage of constants can be controlled with the
- Smarty_Security::$allow_constants property (default true)
-
-
-
- Compiled Templates
- ==================
- Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html
- property and creates different compiled templates files depending on the setting.
-
- Same applies to config files and the $config_overwrite, $config_booleanize and
- $config_read_hidden properties.
-
- Debugging
- =========
- The layout of the debug window has been changed for better readability
-
- New class constants
- Smarty::DEBUG_OFF
- Smarty::DEBUG_ON
- Smarty::DEBUG_INDIVIDUAL
- have been introduced for setting the $debugging property.
-
- Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual gebug window.
-
- .
-
\ No newline at end of file
diff --git a/library/smarty/README b/library/smarty/README
deleted file mode 100644
--- a/library/smarty/README
+++ /dev/null
@@ -1,574 +0,0 @@
-Smarty 3.x
-
-Author: Monte Ohrt
-Author: Uwe Tews
-
-AN INTRODUCTION TO SMARTY 3
-
-NOTICE FOR 3.1 release:
-
-Please see the SMARTY_3.1_NOTES.txt file that comes with the distribution.
-
-NOTICE for 3.0.5 release:
-
-Smarty now follows the PHP error_reporting level by default. If PHP does not mask E_NOTICE and you try to access an unset template variable, you will now get an E_NOTICE warning. To revert to the old behavior:
-
-$smarty->error_reporting = E_ALL & ~E_NOTICE;
-
-NOTICE for 3.0 release:
-
-IMPORTANT: Some API adjustments have been made between the RC4 and 3.0 release.
-We felt it is better to make these now instead of after a 3.0 release, then have to
-immediately deprecate APIs in 3.1. Online documentation has been updated
-to reflect these changes. Specifically:
-
----- API CHANGES RC4 -> 3.0 ----
-
-$smarty->register->*
-$smarty->unregister->*
-$smarty->utility->*
-$samrty->cache->*
-
-Have all been changed to local method calls such as:
-
-$smarty->clearAllCache()
-$smarty->registerFoo()
-$smarty->unregisterFoo()
-$smarty->testInstall()
-etc.
-
-Registration of function, block, compiler, and modifier plugins have been
-consolidated under two API calls:
-
-$smarty->registerPlugin(...)
-$smarty->unregisterPlugin(...)
-
-Registration of pre, post, output and variable filters have been
-consolidated under two API calls:
-
-$smarty->registerFilter(...)
-$smarty->unregisterFilter(...)
-
-Please refer to the online documentation for all specific changes:
-
-http://www.smarty.net/documentation
-
-----
-
-The Smarty 3 API has been refactored to a syntax geared
-for consistency and modularity. The Smarty 2 API syntax is still supported, but
-will throw a deprecation notice. You can disable the notices, but it is highly
-recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run
-through an extra rerouting wrapper.
-
-Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also,
-all Smarty properties now have getters and setters. So for example, the property
-$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be
-retrieved with $smarty->getCacheDir().
-
-Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were
-just duplicate functions of the now available "get*" methods.
-
-Here is a rundown of the Smarty 3 API:
-
-$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null)
-$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null)
-$smarty->isCached($template, $cache_id = null, $compile_id = null)
-$smarty->createData($parent = null)
-$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
-$smarty->enableSecurity()
-$smarty->disableSecurity()
-$smarty->setTemplateDir($template_dir)
-$smarty->addTemplateDir($template_dir)
-$smarty->templateExists($resource_name)
-$smarty->loadPlugin($plugin_name, $check = true)
-$smarty->loadFilter($type, $name)
-$smarty->setExceptionHandler($handler)
-$smarty->addPluginsDir($plugins_dir)
-$smarty->getGlobal($varname = null)
-$smarty->getRegisteredObject($name)
-$smarty->getDebugTemplate()
-$smarty->setDebugTemplate($tpl_name)
-$smarty->assign($tpl_var, $value = null, $nocache = false)
-$smarty->assignGlobal($varname, $value = null, $nocache = false)
-$smarty->assignByRef($tpl_var, &$value, $nocache = false)
-$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false)
-$smarty->appendByRef($tpl_var, &$value, $merge = false)
-$smarty->clearAssign($tpl_var)
-$smarty->clearAllAssign()
-$smarty->configLoad($config_file, $sections = null)
-$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
-$smarty->getConfigVariable($variable)
-$smarty->getStreamVariable($variable)
-$smarty->getConfigVars($varname = null)
-$smarty->clearConfig($varname = null)
-$smarty->getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
-$smarty->clearAllCache($exp_time = null, $type = null)
-$smarty->clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
-
-$smarty->registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = array())
-
-$smarty->registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
-
-$smarty->registerFilter($type, $function_name)
-$smarty->registerResource($resource_type, $function_names)
-$smarty->registerDefaultPluginHandler($function_name)
-$smarty->registerDefaultTemplateHandler($function_name)
-
-$smarty->unregisterPlugin($type, $tag)
-$smarty->unregisterObject($object_name)
-$smarty->unregisterFilter($type, $function_name)
-$smarty->unregisterResource($resource_type)
-
-$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
-$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
-$smarty->testInstall()
-
-// then all the getters/setters, available for all properties. Here are a few:
-
-$caching = $smarty->getCaching(); // get $smarty->caching
-$smarty->setCaching(true); // set $smarty->caching
-$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices
-$smarty->setCacheId($id); // set $smarty->cache_id
-$debugging = $smarty->getDebugging(); // get $smarty->debugging
-
-
-FILE STRUCTURE
-
-The Smarty 3 file structure is similar to Smarty 2:
-
-/libs/
- Smarty.class.php
-/libs/sysplugins/
- internal.*
-/libs/plugins/
- function.mailto.php
- modifier.escape.php
- ...
-
-A lot of Smarty 3 core functionality lies in the sysplugins directory; you do
-not need to change any files here. The /libs/plugins/ folder is where Smarty
-plugins are located. You can add your own here, or create a separate plugin
-directory, just the same as Smarty 2. You will still need to create your own
-/cache/, /templates/, /templates_c/, /configs/ folders. Be sure /cache/ and
-/templates_c/ are writable.
-
-The typical way to use Smarty 3 should also look familiar:
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-$smarty->assign('foo','bar');
-$smarty->display('index.tpl');
-
-
-However, Smarty 3 works completely different on the inside. Smarty 3 is mostly
-backward compatible with Smarty 2, except for the following items:
-
-*) Smarty 3 is PHP 5 only. It will not work with PHP 4.
-*) The {php} tag is disabled by default. Enable with $smarty->allow_php_tag=true.
-*) Delimiters surrounded by whitespace are no longer treated as Smarty tags.
- Therefore, { foo } will not compile as a tag, you must use {foo}. This change
- Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
- This can be disabled by setting $smarty->auto_literal = false;
-*) The Smarty 3 API is a bit different. Many Smarty 2 API calls are deprecated
- but still work. You will want to update your calls to Smarty 3 for maximum
- efficiency.
-
-
-There are many things that are new to Smarty 3. Here are the notable items:
-
-LEXER/PARSER
-============
-
-Smarty 3 now uses a lexing tokenizer for its parser/compiler. Basically, this
-means Smarty has some syntax additions that make life easier such as in-template
-math, shorter/intuitive function parameter options, infinite function recursion,
-more accurate error handling, etc.
-
-
-WHAT IS NEW IN SMARTY TEMPLATE SYNTAX
-=====================================
-
-Smarty 3 allows expressions almost anywhere. Expressions can include PHP
-functions as long as they are not disabled by the security policy, object
-methods and properties, etc. The {math} plugin is no longer necessary but
-is still supported for BC.
-
-Examples:
-{$x+$y} will output the sum of x and y.
-{$foo = strlen($bar)} function in assignment
-{assign var=foo value= $x+$y} in attributes
-{$foo = myfunct( ($x+$y)*3 )} as function parameter
-{$foo[$x+3]} as array index
-
-Smarty tags can be used as values within other tags.
-Example: {$foo={counter}+3}
-
-Smarty tags can also be used inside double quoted strings.
-Example: {$foo="this is message {counter}"}
-
-You can define arrays within templates.
-Examples:
-{assign var=foo value=[1,2,3]}
-{assign var=foo value=['y'=>'yellow','b'=>'blue']}
-Arrays can be nested.
-{assign var=foo value=[1,[9,8],3]}
-
-There is a new short syntax supported for assigning variables.
-Example: {$foo=$bar+2}
-
-You can assign a value to a specific array element. If the variable exists but
-is not an array, it is converted to an array before the new values are assigned.
-Examples:
-{$foo['bar']=1}
-{$foo['bar']['blar']=1}
-
-You can append values to an array. If the variable exists but is not an array,
-it is converted to an array before the new values are assigned.
-Example: {$foo[]=1}
-
-You can use a PHP-like syntax for accessing array elements, as well as the
-original "dot" notation.
-Examples:
-{$foo[1]} normal access
-{$foo['bar']}
-{$foo['bar'][1]}
-{$foo[$x+$x]} index may contain any expression
-{$foo[$bar[1]]} nested index
-{$foo[section_name]} smarty section access, not array access!
-
-The original "dot" notation stays, and with improvements.
-Examples:
-{$foo.a.b.c} => $foo['a']['b']['c']
-{$foo.a.$b.c} => $foo['a'][$b]['c'] with variable index
-{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c'] with expression as index
-{$foo.a.{$b.c}} => $foo['a'][$b['c']] with nested index
-
-note that { and } are used to address ambiguties when nesting the dot syntax.
-
-Variable names themselves can be variable and contain expressions.
-Examples:
-$foo normal variable
-$foo_{$bar} variable name containing other variable
-$foo_{$x+$y} variable name containing expressions
-$foo_{$bar}_buh_{$blar} variable name with multiple segments
-{$foo_{$x}} will output the variable $foo_1 if $x has a value of 1.
-
-Object method chaining is implemented.
-Example: {$object->method1($x)->method2($y)}
-
-{for} tag added for looping (replacement for {section} tag):
-{for $x=0, $y=count($foo); $x<$y; $x++} .... {/for}
-Any number of statements can be used separated by comma as the first
-inital expression at {for}.
-
-{for $x = $start to $end step $step} ... {/for}is in the SVN now .
-You can use also
-{for $x = $start to $end} ... {/for}
-In this case the step value will be automaticall 1 or -1 depending on the start and end values.
-Instead of $start and $end you can use any valid expression.
-Inside the loop the following special vars can be accessed:
-$x@iteration = number of iteration
-$x@total = total number of iterations
-$x@first = true on first iteration
-$x@last = true on last iteration
-
-
-The Smarty 2 {section} syntax is still supported.
-
-New shorter {foreach} syntax to loop over an array.
-Example: {foreach $myarray as $var}...{/foreach}
-
-Within the foreach loop, properties are access via:
-
-$var@key foreach $var array key
-$var@iteration foreach current iteration count (1,2,3...)
-$var@index foreach current index count (0,1,2...)
-$var@total foreach $var array total
-$var@first true on first iteration
-$var@last true on last iteration
-
-The Smarty 2 {foreach} tag syntax is still supported.
-
-NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo.
-If you want to access an array element with index foo, you must use quotes
-such as {$bar['foo']}, or use the dot syntax {$bar.foo}.
-
-while block tag is now implemented:
-{while $foo}...{/while}
-{while $x lt 10}...{/while}
-
-Direct access to PHP functions:
-Just as you can use PHP functions as modifiers directly, you can now access
-PHP functions directly, provided they are permitted by security settings:
-{time()}
-
-There is a new {function}...{/function} block tag to implement a template function.
-This enables reuse of code sequences like a plugin function. It can call itself recursively.
-Template function must be called with the new {call name=foo...} tag.
-
-Example:
-
-Template file:
-{function name=menu level=0}
-
- {foreach $data as $entry}
- {if is_array($entry)}
-
-{/function}
-
-{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' =>
- ['item3-3-1','item3-3-2']],'item4']}
-
-{call name=menu data=$menu}
-
-
-Generated output:
- * item1
- * item2
- * item3
- o item3-1
- o item3-2
- o item3-3
- + item3-3-1
- + item3-3-2
- * item4
-
-The function tag itself must have the "name" attribute. This name is the tag
-name when calling the function. The function tag may have any number of
-additional attributes. These will be default settings for local variables.
-
-New {nocache} block function:
-{nocache}...{/nocache} will declare a section of the template to be non-cached
-when template caching is enabled.
-
-New nocache attribute:
-You can declare variable/function output as non-cached with the nocache attribute.
-Examples:
-
-{$foo nocache=true}
-{$foo nocache} /* same */
-
-{foo bar="baz" nocache=true}
-{foo bar="baz" nocache} /* same */
-
-{time() nocache=true}
-{time() nocache} /* same */
-
-Or you can also assign the variable in your script as nocache:
-$smarty->assign('foo',$something,true); // third param is nocache setting
-{$foo} /* non-cached */
-
-$smarty.current_dir returns the directory name of the current template.
-
-You can use strings directly as templates with the "string" resource type.
-Examples:
-$smarty->display('string:This is my template, {$foo}!'); // php
-{include file="string:This is my template, {$foo}!"} // template
-
-
-
-VARIABLE SCOPE / VARIABLE STORAGE
-=================================
-
-In Smarty 2, all assigned variables were stored within the Smarty object.
-Therefore, all variables assigned in PHP were accessible by all subsequent
-fetch and display template calls.
-
-In Smarty 3, we have the choice to assign variables to the main Smarty object,
-to user-created data objects, and to user-created template objects.
-These objects can be chained. The object at the end of a chain can access all
-variables belonging to that template and all variables within the parent objects.
-The Smarty object can only be the root of a chain, but a chain can be isolated
-from the Smarty object.
-
-All known Smarty assignment interfaces will work on the data and template objects.
-
-Besides the above mentioned objects, there is also a special storage area for
-global variables.
-
-A Smarty data object can be created as follows:
-$data = $smarty->createData(); // create root data object
-$data->assign('foo','bar'); // assign variables as usual
-$data->config_load('my.conf'); // load config file
-
-$data= $smarty->createData($smarty); // create data object having a parent link to
-the Smarty object
-
-$data2= $smarty->createData($data); // create data object having a parent link to
-the $data data object
-
-A template object can be created by using the createTemplate method. It has the
-same parameter assignments as the fetch() or display() method.
-Function definition:
-function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
-
-The first parameter can be a template name, a smarty object or a data object.
-
-Examples:
-$tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent
-$tpl->assign('foo','bar'); // directly assign variables
-$tpl->config_load('my.conf'); // load config file
-
-$tpl = $smarty->createTemplate('mytpl.tpl',$smarty); // create template having a parent link to the Smarty object
-$tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object
-
-The standard fetch() and display() methods will implicitly create a template object.
-If the $parent parameter is not specified in these method calls, the template object
-is will link back to the Smarty object as it's parent.
-
-If a template is called by an {include...} tag from another template, the
-subtemplate links back to the calling template as it's parent.
-
-All variables assigned locally or from a parent template are accessible. If the
-template creates or modifies a variable by using the {assign var=foo...} or
-{$foo=...} tags, these new values are only known locally (local scope). When the
-template exits, none of the new variables or modifications can be seen in the
-parent template(s). This is same behavior as in Smarty 2.
-
-With Smarty 3, we can assign variables with a scope attribute which allows the
-availablility of these new variables or modifications globally (ie in the parent
-templates.)
-
-Possible scopes are local, parent, root and global.
-Examples:
-{assign var=foo value='bar'} // no scope is specified, the default 'local'
-{$foo='bar'} // same, local scope
-{assign var=foo value='bar' scope='local'} // same, local scope
-
-{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object
-{$foo='bar' scope='parent'} // (normally the calling template)
-
-{assign var=foo value='bar' scope='root'} // Values will be exported up to the root object, so they can
-{$foo='bar' scope='root'} // be seen from all templates using the same root.
-
-{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage,
-{$foo='bar' scope='global'} // they are available to any and all templates.
-
-
-The scope attribute can also be attached to the {include...} tag. In this case,
-the specified scope will be the default scope for all assignments within the
-included template.
-
-
-PLUGINS
-=======
-
-Smarty3 are following the same coding rules as in Smarty2.
-The only difference is that the template object is passed as additional third parameter.
-
-smarty_plugintype_name (array $params, object $smarty, object $template)
-
-The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty2 internals.
-
-
-TEMPLATE INHERITANCE:
-=====================
-
-With template inheritance you can define blocks, which are areas that can be
-overriden by child templates, so your templates could look like this:
-
-parent.tpl:
-
-
- {block name='title'}My site name{/block}
-
-
-
-
-
-
-child.tpl:
-{extends file='parent.tpl'}
-{block name='title'}
-Child title
-{/block}
-
-grandchild.tpl:
-{extends file='child.tpl'}
-{block name='title'}Home - {$smarty.block.parent}{/block}
-{block name='page-title'}My home{/block}
-{block name='content'}
- {foreach $images as $img}
-
- {/foreach}
-{/block}
-
-We redefined all the blocks here, however in the title block we used {$smarty.block.parent},
-which tells Smarty to insert the default content from the parent template in its place.
-The content block was overriden to display the image files, and page-title has also be
-overriden to display a completely different title.
-
-If we render grandchild.tpl we will get this:
-
-
- Home - Child title
-
-
-
My home
-
-
-
-
-
-
-
-
-NOTE: In the child templates everything outside the {extends} or {block} tag sections
-is ignored.
-
-The inheritance tree can be as big as you want (meaning you can extend a file that
-extends another one that extends another one and so on..), but be aware that all files
-have to be checked for modifications at runtime so the more inheritance the more overhead you add.
-
-Instead of defining the parent/child relationships with the {extends} tag in the child template you
-can use the resource as follow:
-
-$smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl');
-
-Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content
-is appended or prepended to the child block content.
-
-{block name='title' append} My title {/block}
-
-
-PHP STREAMS:
-============
-
-(see online documentation)
-
-VARIBLE FILTERS:
-================
-
-(see online documentation)
-
-
-STATIC CLASS ACCESS AND NAMESPACE SUPPORT
-=========================================
-
-You can register a class with optional namespace for the use in the template like:
-
-$smarty->register->templateClass('foo','name\name2\myclass');
-
-In the template you can use it like this:
-{foo::method()} etc.
-
-
-=======================
-
-Please look through it and send any questions/suggestions/etc to the forums.
-
-http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14168
-
-Monte and Uwe
diff --git a/library/smarty/README.md b/library/smarty/README.md
deleted file mode 100644
--- a/library/smarty/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-#Smarty 3 template engine
-##Distribution repository
-
-*Read the NEW_FEATURES file for recent extensions to Smarty 3.1 functionality*
-
-Smarty versions 3.1.11 or later are now on github and can be installed with Composer.
-
-
-The "smarty/smarty" package will start at libs/.... subfolder.
-
-To get the latest stable version of Smarty 3.1 use
-
- "require": {
- "smarty/smarty": "~3.1"
- }
-
-in your composer.json file.
-
- To get the trunk version use
-
- "require": {
- "smarty/smarty": "~3.1@dev"
- }
-
-For a specific version use something like
-
- "require": {
- "smarty/smarty": "3.1.19"
- }
-
-PHPUnit test can be installed by corresponding composer entries like
-
- "require": {
- "smarty/smarty-phpunit": "3.1.19"
- }
-
-Similar applies for the lexer/parser generator
-
- "require": {
- "smarty/smarty-lexer": "3.1.19"
- }
-
-Or you could use
-
- "require": {
- "smarty/smarty-dev": "3.1.19"
- }
-
-Which is a wrapper to install all 3 packages
-
-
-Composer can also be used for Smarty2 versions 2.6.24 to 2.6.28
diff --git a/library/smarty/SMARTY_2_BC_NOTES.txt b/library/smarty/SMARTY_2_BC_NOTES.txt
deleted file mode 100644
--- a/library/smarty/SMARTY_2_BC_NOTES.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-= Known incompatibilities with Smarty 2 =
-
-== Syntax ==
-
-Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported
-by a wrapper but deprecated. See the README that comes with Smarty 3 for more
-information.
-
-The {$array|@mod} syntax has always been a bit confusing, where an "@" is required
-to apply a modifier to an array instead of the individual elements. Normally you
-always want the modifier to apply to the variable regardless of its type. In Smarty 3,
-{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the
-modifier will still apply to the array. If you really want the modifier to apply to
-each array element, you must loop the array in-template, or use a custom modifier that
-supports array iteration. Most smarty functions already escape values where necessary
-such as {html_options}
-
-== PHP Version ==
-Smarty 3 is PHP 5 only. It will not work with PHP 4.
-
-== {php} Tag ==
-The {php} tag is disabled by default. The use of {php} tags is
-deprecated. It can be enabled with $smarty->allow_php_tag=true.
-
-But if you scatter PHP code which belongs together into several
-{php} tags it may not work any longer.
-
-== Delimiters and whitespace ==
-Delimiters surrounded by whitespace are no longer treated as Smarty tags.
-Therefore, { foo } will not compile as a tag, you must use {foo}. This change
-Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
-This can be disabled by setting $smarty->auto_literal = false;
-
-== Unquoted Strings ==
-Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
-in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
-so long as they contain no special characters. (anything outside of A-Za-z0-9_)
-
-For example filename strings must be quoted
-
-
-== Extending the Smarty class ==
-Smarty 3 makes use of the __construct method for initialization. If you are extending
-the Smarty class, its constructor is not called implicitly if the your child class defines
-its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
-within your child constructor is required.
-
-
-
-== Autoloader ==
-Smarty 3 does register its own autoloader with spl_autoload_register. If your code has
-an existing __autoload function then this function must be explicitly registered on
-the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php
-for further details.
-
-== Plugin Filenames ==
-Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames
-to be lower case. Because of this, Smarty plugin file names must also be lowercase.
-In Smarty 2, mixed case file names did work.
-
-== Scope of Special Smarty Variables ==
-In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach...
-had global scope. If you had loops with the same name in subtemplates you could accidentally
-overwrite values of parent template.
-
-In Smarty 3 these special Smarty variable have only local scope in the template which
-is defining the loop. If you need their value in a subtemplate you have to pass them
-as parameter.
-
-
-== SMARTY_RESOURCE_CHAR_SET ==
-Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset.
-This is now used also on modifiers like escape as default charset. If your templates use
-other charsets make sure that you define the constant accordingly. Otherwise you may not
-get any output.
-
-== newline at {if} tags ==
-A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
-If one of the {if} tags is at the line end you will now get a newline in the HTML output.
-
-== trigger_error() ==
-The API function trigger_error() has been removed because it did just map to PHP trigger_error.
-However it's still included in the Smarty2 API wrapper.
-
-== Smarty constants ==
-The constants
-SMARTY_PHP_PASSTHRU
-SMARTY_PHP_QUOTE
-SMARTY_PHP_REMOVE
-SMARTY_PHP_ALLOW
-have been replaced with class constants
-Smarty::PHP_PASSTHRU
-Smarty::PHP_QUOTE
-Smarty::PHP_REMOVE
-Smarty::PHP_ALLOW
-
diff --git a/library/smarty/SMARTY_3.0_BC_NOTES.txt b/library/smarty/SMARTY_3.0_BC_NOTES.txt
deleted file mode 100644
--- a/library/smarty/SMARTY_3.0_BC_NOTES.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-== Smarty2 backward compatibility ==
-All Smarty2 specific API functions and deprecated functionallity has been moved
-to the SmartyBC class.
-
-== {php} Tag ==
-The {php} tag is no longer available in the standard Smarty calls.
-The use of {php} tags is deprecated and only available in the SmartyBC class.
-
-== {include_php} Tag ==
-The {include_php} tag is no longer available in the standard Smarty calls.
-The use of {include_php} tags is deprecated and only available in the SmartyBC class.
-
-== php template resource ==
-The support of the php template resource is removed.
-
-== $cache_dir, $compile_dir, $config_dir, $template_dir access ==
-The mentioned properties can't be accessed directly any longer. You must use
-corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir()
-
-== obsolete Smarty class properties ==
-The following no longer used properties are removed:
-$allow_php_tag
-$allow_php_template
-$deprecation_notices
\ No newline at end of file
diff --git a/library/smarty/SMARTY_3.1_NOTES.txt b/library/smarty/SMARTY_3.1_NOTES.txt
deleted file mode 100644
--- a/library/smarty/SMARTY_3.1_NOTES.txt
+++ /dev/null
@@ -1,306 +0,0 @@
-Smarty 3.1 Notes
-================
-
-Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all
-backward compatibility has been moved to a separate class file named
-SmartyBC.class.php. If you require compatibility with 2.0, you will
-need to use this class.
-
-Some differences from 3.0 are also present. 3.1 begins the journey of
-requiring setters/getters for property access. So far this is only
-implemented on the five directory properties: template_dir,
-plugins_dir, configs_dir, compile_dir and cache_dir. These properties
-are now protected, it is required to use the setters/getters instead.
-That said, direct property access will still work, however slightly
-slower since they will now fall through __set() and __get() and in
-turn passed through the setter/getter methods. 3.2 will exhibit a full
-list of setter/getter methods for all (currently) public properties,
-so code-completion in your IDE will work as expected.
-
-There is absolutely no PHP allowed in templates any more. All
-deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC
-class if you need any backward compatibility.
-
-Internal Changes
-
- Full UTF-8 Compatibility
-
-The plugins shipped with Smarty 3.1 have been rewritten to fully
-support UTF-8 strings if Multibyte String is available. Without
-MBString UTF-8 cannot be handled properly. For those rare cases where
-templates themselves have to juggle encodings, the new modifiers
-to_charset and from_charset may come in handy.
-
- Plugin API and Performance
-
-All Plugins (modifiers, functions, blocks, resources,
-default_template_handlers, etc) are now receiving the
-Smarty_Internal_Template instance, where they were supplied with the
-Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template
-mimics the behavior of Smarty, this API simplification should not
-require any changes to custom plugins.
-
-The plugins shipped with Smarty 3.1 have been rewritten for better
-performance. Most notably {html_select_date} and {html_select_time}
-have been improved vastly. Performance aside, plugins have also been
-reviewed and generalized in their API. {html_select_date} and
-{html_select_time} now share almost all available options.
-
-The escape modifier now knows the $double_encode option, which will
-prevent entities from being encoded again.
-
-The capitalize modifier now know the $lc_rest option, which makes sure
-all letters following a captial letter are lower-cased.
-
-The count_sentences modifier now accepts (.?!) as
-legitimate endings of a sentence - previously only (.) was
-accepted
-
-The new unescape modifier is there to reverse the effects of the
-escape modifier. This applies to the escape formats html, htmlall and
-entity.
-
- default_template_handler_func
-
-The invocation of $smarty->$default_template_handler_func had to be
-altered. Instead of a Smarty_Internal_Template, the fifth argument is
-now provided with the Smarty instance. New footprint:
-
-
-/**
- * Default Template Handler
- *
- * called when Smarty's file: resource is unable to load a requested file
- *
- * @param string $type resource type (e.g. "file", "string", "eval", "resource")
- * @param string $name resource name (e.g. "foo/bar.tpl")
- * @param string &$content template's content
- * @param integer &$modified template's modification time
- * @param Smarty $smarty Smarty instance
- * @return string|boolean path to file or boolean true if $content and $modified
- * have been filled, boolean false if no default template
- * could be loaded
- */
-function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) {
- if (false) {
- // return corrected filepath
- return "/tmp/some/foobar.tpl";
- } elseif (false) {
- // return a template directly
- $content = "the template source";
- $modified = time();
- return true;
- } else {
- // tell smarty that we failed
- return false;
- }
-}
-
- Stuff done to the compiler
-
-Many performance improvements have happened internally. One notable
-improvement is that all compiled templates are now handled as PHP
-functions. This speeds up repeated templates tremendously, as each one
-calls an (in-memory) PHP function instead of performing another file
-include/scan.
-
-New Features
-
- Template syntax
-
- {block}..{/block}
-
-The {block} tag has a new hide option flag. It does suppress the block
-content if no corresponding child block exists.
-EXAMPLE:
-parent.tpl
-{block name=body hide} child content "{$smarty.block.child}" was
-inserted {block}
-In the above example the whole block will be suppressed if no child
-block "body" is existing.
-
- {setfilter}..{/setfilter}
-
-The new {setfilter} block tag allows the definition of filters which
-run on variable output.
-SYNTAX:
-{setfilter filter1|filter2|filter3....}
-Smarty3 will lookup up matching filters in the following search order:
-1. varibale filter plugin in plugins_dir.
-2. a valid modifier. A modifier specification will also accept
-additional parameter like filter2:'foo'
-3. a PHP function
-{/setfilter} will turn previous filter setting off again.
-{setfilter} tags can be nested.
-EXAMPLE:
-{setfilter filter1}
- {$foo}
- {setfilter filter2}
- {$bar}
- {/setfilter}
- {$buh}
-{/setfilter}
-{$blar}
-In the above example filter1 will run on the output of $foo, filter2
-on $bar, filter1 again on $buh and no filter on $blar.
-NOTES:
-- {$foo nofilter} will suppress the filters
-- These filters will run in addition to filters defined by
-registerFilter('variable',...), autoLoadFilter('variable',...) and
-defined default modifier.
-- {setfilter} will effect only the current template, not included
-subtemplates.
-
- Resource API
-
-Smarty 3.1 features a new approach to resource management. The
-Smarty_Resource API allows simple, yet powerful integration of custom
-resources for templates and configuration files. It offers simple
-functions for loading data from a custom resource (e.g. database) as
-well as define new template types adhering to the special
-non-compiling (e,g, plain php) and non-compile-caching (e.g. eval:
-resource type) resources.
-
-See demo/plugins/resource.mysql.php for an example custom database
-resource.
-
-Note that old-fashioned registration of callbacks for resource
-management has been deprecated but is still possible with SmartyBC.
-
- CacheResource API
-
-In line with the Resource API, the CacheResource API offers a more
-comfortable handling of output-cache data. With the
-Smarty_CacheResource_Custom accessing databases is made simple. With
-the introduction of Smarty_CacheResource_KeyValueStore the
-implementation of resources like memcache or APC became a no-brainer;
-simple hash-based storage systems are now supporting hierarchical
-output-caches.
-
-See demo/plugins/cacheresource.mysql.php for an example custom
-database CacheResource.
-See demo/plugins/cacheresource.memcache.php for an example custom
-memcache CacheResource using the KeyValueStore helper.
-
-Note that old-fashioned registration of $cache_handler is not possible
-anymore. As the functionality had not been ported to Smarty 3.0.x
-properly, it has been dropped from 3.1 completely.
-
-Locking facilities have been implemented to avoid concurrent cache
-generation. Enable cache locking by setting
-$smarty->cache_locking = true;
-
- Relative Paths in Templates (File-Resource)
-
-As of Smarty 3.1 {include file="../foo.tpl"} and {include
-file="./foo.tpl"} will resolve relative to the template they're in.
-Relative paths are available with {include file="..."} and
-{extends file="..."}. As $smarty->fetch('../foo.tpl') and
-$smarty->fetch('./foo.tpl') cannot be relative to a template, an
-exception is thrown.
-
- Addressing a specific $template_dir
-
-Smarty 3.1 introduces the $template_dir index notation.
-$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"}
-require the template bar.tpl to be loaded from $template_dir['foo'];
-Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to
-define indexes along with the actual directories.
-
- Mixing Resources in extends-Resource
-
-Taking the php extends: template resource one step further, it is now
-possible to mix resources within an extends: call like
-$smarty->fetch("extends:file:foo.tpl|db:bar.tpl");
-
-To make eval: and string: resources available to the inheritance
-chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been
-introduced. Supplying the base64 or urlencode flags will trigger
-decoding the TPL_STRING in with either base64_decode() or urldecode().
-
- extends-Resource in template inheritance
-
-Template based inheritance may now inherit from php's extends:
-resource like {extends file="extends:foo.tpl|db:bar.tpl"}.
-
- New Smarty property escape_html
-
-$smarty->escape_html = true will autoescape all template variable
-output by calling htmlspecialchars({$output}, ENT_QUOTES,
-SMARTY_RESOURCE_CHAR_SET).
-NOTE:
-This is a compile time option. If you change the setting you must make
-sure that the templates get recompiled.
-
- New option at Smarty property compile_check
-
-The automatic recompilation of modified templates can now be
-controlled by the following settings:
-$smarty->compile_check = COMPILECHECK_OFF (false) - template files
-will not be checked
-$smarty->compile_check = COMPILECHECK_ON (true) - template files will
-always be checked
-$smarty->compile_check = COMPILECHECK_CACHEMISS - template files will
-be checked if caching is enabled and there is no existing cache file
-or it has expired
-
- Automatic recompilation on Smarty version change
-
-Templates will now be automatically recompiled on Smarty version
-changes to avoide incompatibillities in the compiled code. Compiled
-template checked against the current setting of the SMARTY_VERSION
-constant.
-
- default_config_handler_func()
-
-Analogous to the default_template_handler_func()
-default_config_handler_func() has been introduced.
-
- default_plugin_handler_func()
-
-An optional default_plugin_handler_func() can be defined which gets called
-by the compiler on tags which can't be resolved internally or by plugins.
-The default_plugin_handler() can map tags to plugins on the fly.
-
-New getters/setters
-
-The following setters/getters will be part of the official
-documentation, and will be strongly recommended. Direct property
-access will still work for the foreseeable future... it will be
-transparently routed through the setters/getters, and consequently a
-bit slower.
-
-array|string getTemplateDir( [string $index] )
-replaces $smarty->template_dir; and $smarty->template_dir[$index];
-Smarty setTemplateDir( array|string $path )
-replaces $smarty->template_dir = "foo"; and $smarty->template_dir =
-array("foo", "bar");
-Smarty addTemplateDir( array|string $path, [string $index])
-replaces $smarty->template_dir[] = "bar"; and
-$smarty->template_dir[$index] = "bar";
-
-array|string getConfigDir( [string $index] )
-replaces $smarty->config_dir; and $smarty->config_dir[$index];
-Smarty setConfigDir( array|string $path )
-replaces $smarty->config_dir = "foo"; and $smarty->config_dir =
-array("foo", "bar");
-Smarty addConfigDir( array|string $path, [string $index])
-replaces $smarty->config_dir[] = "bar"; and
-$smarty->config_dir[$index] = "bar";
-
-array getPluginsDir()
-replaces $smarty->plugins_dir;
-Smarty setPluginsDir( array|string $path )
-replaces $smarty->plugins_dir = "foo";
-Smarty addPluginsDir( array|string $path )
-replaces $smarty->plugins_dir[] = "bar";
-
-string getCompileDir()
-replaces $smarty->compile_dir;
-Smarty setCompileDir( string $path )
-replaces $smarty->compile_dir = "foo";
-
-string getCacheDir()
-replaces $smarty->cache_dir;
-Smarty setCacheDir( string $path )
-replaces $smarty->cache_dir;
diff --git a/library/smarty/change_log.txt b/library/smarty/change_log.txt
deleted file mode 100644
--- a/library/smarty/change_log.txt
+++ /dev/null
@@ -1,2649 +0,0 @@
- ===== 3.1.27===== (18.06.2015)
-18.06.2015
- - bugfix another update on file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
-
- ===== 3.1.26===== (18.06.2015)
-18.06.2015
- - bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
-
-17.06.2015
- - bugfix calling a plugin with nocache option but no other attributes like {foo nocache} caused call to undefined function https://github.com/smarty-php/smarty/issues/55
-
- ===== 3.1.25===== (15.06.2015)
- 15.06.2015
- - optimization of smarty_cachereource_keyvaluestore.php code
-
- 14.06.2015
- - bugfix a relative sub template path could fail if template_dir path did contain /../ https://github.com/smarty-php/smarty/issues/50
- - optimization rework of path normalization
- - bugfix an output tag with variable, modifier followed by an operator like {$foo|modifier+1} did fail https://github.com/smarty-php/smarty/issues/53
-
- 13.06.2015
- - bugfix a custom cache resource using smarty_cachereource_keyvaluestore.php did fail if php.ini mbstring.func_overload = 2 (forum topic 25568)
-
- 11.06.2015
- - bugfix the lexer could hang on very large quoted strings (forum topic 25570)
-
- 08.06.2015
- - bugfix using {$foo} as array index like $bar.{$foo} or in double quoted string like "some {$foo} thing" failed https://github.com/smarty-php/smarty/issues/49
-
- 04.06.2015
- - bugfix possible error message on unset() while compiling {block} tags https://github.com/smarty-php/smarty/issues/46
-
- 01.06.2015
- - bugfix including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47
-
- 27.05.2015
- - bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43
-
- 24.05.2015
- - bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42
-
- ===== 3.1.24===== (23.05.2015)
- 23.05.2015
- - improvement on php_handling to allow very large PHP sections, better error handling
- - improvement allow extreme large comment sections (forum 25538)
-
- 21.05.2015
- - bugfix broken PHP 5.2 compatibility when compiling 1 did compile into wrong code https://github.com/smarty-php/smarty/issues/41
-
- 19.05.2015
- - bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39
- - bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220)
- - bugfix compiler could run into the pcre.backtrack_limit on larger comment or {php} tag sections (forum 25538)
-
- 18.05.2015
- - improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
- compilation speed
-
- 16.05.2015
- - bugfix {php}{/php} did work just for single lines https://github.com/smarty-php/smarty/issues/33
- - improvement remove not needed ?> handling from parser to new compiler module
-
- 05.05.2015
- - bugfix code could be messed up when {tags} are used in multiple attributes https://github.com/smarty-php/smarty/issues/23
-
- 04.05.2015
- - bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22)
- - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (https://github.com/smarty-php/smarty/issues/24)
-
- 28.04.2015
- - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) 2nd fix
-
- 28.04.2015
- - bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508)
-
- 23.04.2015
- - bugfix a nocache template variable used as parameter at {insert} was by mistake cached
-
- 20.04.2015
- - bugfix at a template function containing nocache code a parmeter could overwrite a template variable of same name
-
- 27.03.2015
- - bugfix Smarty_Security->allow_constants=false; did also disable true, false and null (change of 16.03.2015)
- - improvement added a whitelist for trusted constants to security Smarty_Security::$trusted_constants (forum topic 25471)
-
- 20.03.2015
- - bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452}
- - bugfix correct update of global variable values on exit of template functions. (reported under Smarty Developers)
-
- 16.03.2015
- - bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452}
- - bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457}
- - bugfix {block}{/block} tags did not work inside double quoted strings https://github.com/smarty-php/smarty/issues/18
-
-
- 15.03.2015
- - bugfix $smarty->compile_check must be restored before rendering of a just updated cache file {forum 25452}
-
- 14.03.2015
- - bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable.
-
- - bugfix template functions defined with {function} in an included subtemplate could not be called in nocache
- mode with {call... nocache} if the subtemplate had it's own cache file {forum 25452}
-
- 10.03.2015
- - bugfix {include ... nocache} whith variable file or compile_id attribute was not executed in nocache mode.
-
- 12.02.2015
- - bugfix multiple Smarty::fetch() of same template when $smarty->merge_compiled_includes = true; could cause function already defined error
-
- 11.02.2015
- - bugfix recursive {includes} did create E_NOTICE message when $smarty->merge_compiled_includes = true; (github issue #16)
-
- 22.01.2015
- - new feature security can now control access to static methods and properties
- see also NEW_FEATURES.txt
-
- 21.01.2015
- - bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397)
- - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class
-
- 04.01.2015
- - push last weeks changes to github
-
- - different optimizations
- - improvement automatically create different versions of compiled templates and config files depending
- on property settings.
- - optimization restructure template processing by moving code into classes it better belongs to
- - optimization restructure config file processing
-
- 31.12.2014
- - bugfix use function_exists('mb_get_info') for setting Smarty::$_MBSTRING.
- Function mb_split could be overloaded depending on php.ini mbstring.func_overload
-
-
- 29.12.2014
- - new feature security can now limit the template nesting level by property $max_template_nesting
- see also NEW_FEATURES.txt (forum 25370)
-
- 29.12.2014
- - new feature security can now disable special $smarty variables listed in property $disabled_special_smarty_vars
- see also NEW_FEATURES.txt (forum 25370)
-
- 27.12.2014
- - bugfix clear internal _is_file_cache when plugins_dir was modified
-
- 13.12.2014
- - improvement optimization of lexer and parser resulting in a up to 30% higher compiling speed
-
- 11.12.2014
- - bugfix resolve parser ambiguity between constant print tag {CONST} and other smarty tags after change of 09.12.2014
-
- 09.12.2014
- - bugfix variables $null, $true and $false did not work after the change of 12.11.2014 (forum 25342)
- - bugfix call of template function by a variable name did not work after latest changes (forum 25342)
-
- 23.11.2014
- - bugfix a plugin with attached modifier could fail if the tag was immediately followed by another Smarty tag (since 3.1.21) (forum 25326)
-
- 13.11.2014
- - improvement move autoload code into Autoloader.php. Use Composer autoloader when possible
-
- 12.11.2014
- - new feature added support of namespaces to template code
-
- 08.11.2014 - 10.11.2014
- - bugfix subtemplate called in nocache mode could be called with wrong compile_id when it did change on one of the calling templates
- - improvement add code of template functions called in nocache mode dynamically to cache file (related to bugfix of 01.11.2014)
- - bugfix Debug Console did not include all data from merged compiled subtemplates
-
- 04.11.2014
- - new feature $smarty->debug = true; => overwrite existing Debug Console window (old behaviour)
- $smarty->debug = 2; => individual Debug Console window by template name
-
- 03.11.2014
- - bugfix Debug Console did not show included subtemplates since 3.1.17 (forum 25301)
- - bugfix Modifier debug_print_var did not limit recursion or prevent recursive object display at Debug Console
- (ATTENTION: parameter order has changed to be able to specify maximum recursion)
- - bugfix Debug consol did not include subtemplate information with $smarty->merge_compiled_includes = true
- - improvement The template variables are no longer displayed as objects on the Debug Console
- - improvement $smarty->createData($parent = null, $name = null) new optional name parameter for display at Debug Console
- - addition of some hooks for future extension of Debug Console
-
- 01.11.2014
- - bugfix and enhancement on subtemplate {include} and template {function} tags.
- * Calling a template which has a nocache section could fail if it was called from a cached and a not cached subtemplate.
- * Calling the same subtemplate cached and not cached with the $smarty->merge_compiled_includes enabled could cause problems
- * Many smaller related changes
-
- 30.10.2014
- - bugfix access to class constant by object like {$object::CONST} or variable class name {$class::CONST} did not work (forum 25301)
-
- 26.10.2014
- - bugfix E_NOTICE message was created during compilation when ASP tags '<%' or '%>' are in template source text
- - bugfix merge_compiled_includes option failed when caching enables and same subtemplate was included cached and not cached
-
- ===== 3.1.21 ===== (18.10.2014)
- 18.10.2014
- - composer moved to github
-
- 17.10.2014
- - bugfix on $php_handling security and optimization of smarty_internal_parsetree (Thue Kristensen)
-
- 16.10.2014
- - bugfix composer.json update
-
- 15.10.2014
- - bugfix calling a new created cache file with fetch() and Smarty::CACHING_LIFETIME_SAVED multiple times did fail (forum 22350)
-
- 14.10.2014
- - bugfix any tag placed within "
diff --git a/library/smarty/libs/plugins/block.textformat.php b/library/smarty/libs/plugins/block.textformat.php
deleted file mode 100644
--- a/library/smarty/libs/plugins/block.textformat.php
+++ /dev/null
@@ -1,109 +0,0 @@
-
- * Name: textformat
- * Purpose: format text a certain way with preset styles
- * or custom wrap/indent settings
- * Params:
- *
- * - name - name of cycle (optional)
- * - values - comma separated list of values to cycle, or an array of values to cycle
- * (this can be left out for subsequent calls)
- * - reset - boolean - resets given var to true
- * - print - boolean - print var or not. default is true
- * - advance - boolean - whether or not to advance the cycle
- * - delimiter - the value delimiter, default is ","
- * - assign - boolean, assigns to template var instead of printed.
- *