From b7c3486b0ded35a16a5958ea2299da534f849f22 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Thu, 29 Oct 2009 05:27:55 -0400 Subject: [PATCH] - lost PEAR5.php file --- program/lib/PEAR5.php | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/program/lib/PEAR5.php b/program/lib/PEAR5.php new file mode 100644 index 0000000..4286067 --- /dev/null +++ b/program/lib/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 -- Gitblit v1.9.1