diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-10-29 09:27:55 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-10-29 09:27:55 +0000 |
| commit | c1dcc2239fbe04f9948bb99c365095dcc29effc9 (patch) | |
| tree | f2af339488579301d3c3b1172ce0b3db2cefdd70 /roundcubemail/program/lib/PEAR5.php | |
| parent | 17ae74fdcad845aca016b40632b4d8984588bc0e (diff) | |
- lost PEAR5.php file
git-svn-id: https://svn.roundcube.net/trunk@3078 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/lib/PEAR5.php')
| -rw-r--r-- | roundcubemail/program/lib/PEAR5.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/roundcubemail/program/lib/PEAR5.php b/roundcubemail/program/lib/PEAR5.php new file mode 100644 index 000000000..428606780 --- /dev/null +++ b/roundcubemail/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 |
