[Svn] r3078 - trunk/roundcubemail/program/lib

trac at roundcube.net trac at roundcube.net
Thu Oct 29 10:27:55 CET 2009


Author: alec
Date: 2009-10-29 04:27:55 -0500 (Thu, 29 Oct 2009)
New Revision: 3078

Added:
   trunk/roundcubemail/program/lib/PEAR5.php
Log:
- lost PEAR5.php file


Added: trunk/roundcubemail/program/lib/PEAR5.php
===================================================================
--- trunk/roundcubemail/program/lib/PEAR5.php	                        (rev 0)
+++ trunk/roundcubemail/program/lib/PEAR5.php	2009-10-29 09:27:55 UTC (rev 3078)
@@ -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

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list