From ba1e502962608ba822e8c1e56b5e8036f0900334 Mon Sep 17 00:00:00 2001 From: robocoder <anthon.pang@gmail.com> Date: Sat, 3 Jul 2010 14:13:18 +0000 Subject: [PATCH] refs #1442 - add license file to PEAR and some new dependencies; add "static" keyword to isError and raiseError as this throws notices with HTML_QuickForm git-svn-id: http://dev.piwik.org/svn/trunk@2419 59fd770c-687e-43c8-a1e3-f5a4ff64c105 --- libs/PEAR.php | 4 ++-- libs/PEAR/FixPHP5PEARWarnings.php | 7 +++++++ libs/PEAR/LICENSE | 27 +++++++++++++++++++++++++ libs/PEAR5.php | 33 +++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 libs/PEAR/FixPHP5PEARWarnings.php create mode 100644 libs/PEAR/LICENSE create mode 100644 libs/PEAR5.php diff --git a/libs/PEAR.php b/libs/PEAR.php index 69b2655366..2eaad4afec 100644 --- a/libs/PEAR.php +++ b/libs/PEAR.php @@ -247,7 +247,7 @@ class PEAR * @access public * @return bool true if parameter is an error */ - function isError($data, $code = null) + static function isError($data, $code = null) { if (!is_a($data, 'PEAR_Error')) { return false; @@ -469,7 +469,7 @@ class PEAR * @see PEAR::setErrorHandling * @since PHP 4.0.5 */ - function &raiseError($message = null, + static function &raiseError($message = null, $code = null, $mode = null, $options = null, diff --git a/libs/PEAR/FixPHP5PEARWarnings.php b/libs/PEAR/FixPHP5PEARWarnings.php new file mode 100644 index 0000000000..be5dc3ce70 --- /dev/null +++ b/libs/PEAR/FixPHP5PEARWarnings.php @@ -0,0 +1,7 @@ +<?php +if ($skipmsg) { + $a = &new $ec($code, $mode, $options, $userinfo); +} else { + $a = &new $ec($message, $code, $mode, $options, $userinfo); +} +?> \ No newline at end of file diff --git a/libs/PEAR/LICENSE b/libs/PEAR/LICENSE new file mode 100644 index 0000000000..a00a2421fd --- /dev/null +++ b/libs/PEAR/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 1997-2009, + Stig Bakken <ssb@php.net>, + Gregory Beaver <cellog@php.net>, + Helgi Þormar Þorbjörnsson <helgi@php.net>, + Tomas V.V.Cox <cox@idecnet.com>, + Martin Jansen <mj@php.net>. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/PEAR5.php b/libs/PEAR5.php new file mode 100644 index 0000000000..428606780b --- /dev/null +++ b/libs/PEAR5.php @@ -0,0 +1,33 @@ +<?php +/** + * This is only meant for PHP 5 to get rid of certain strict warning + * that doesn't get hidden since it's in the shutdown function + */ +class PEAR5 +{ + /** + * If you have a class that's mostly/entirely static, and you need static + * properties, you can use this method to simulate them. Eg. in your method(s) + * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar'); + * You MUST use a reference, or they will not persist! + * + * @access public + * @param string $class The calling classname, to prevent clashes + * @param string $var The variable to retrieve. + * @return mixed A reference to the variable. If not set it will be + * auto initialised to NULL. + */ + static function &getStaticProperty($class, $var) + { + static $properties; + if (!isset($properties[$class])) { + $properties[$class] = array(); + } + + if (!array_key_exists($var, $properties[$class])) { + $properties[$class][$var] = null; + } + + return $properties[$class][$var]; + } +} \ No newline at end of file -- GitLab