summaryrefslogtreecommitdiffstats
path: root/etc/inc/PEAR.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-01-19 18:58:49 +0000
committerErmal <eri@pfsense.org>2012-01-19 18:58:49 +0000
commit54213e81ddaa2e0fd6831c375c1d642bc4980fee (patch)
treebfb017ba864d14d89bc0578ee8d2cdc84101b3e9 /etc/inc/PEAR.inc
parent0d6fee24468623c2f755a0affd850c8143c4efb8 (diff)
downloadpfsense-54213e81ddaa2e0fd6831c375c1d642bc4980fee.zip
pfsense-54213e81ddaa2e0fd6831c375c1d642bc4980fee.tar.gz
Add class PEAR5 code rather than a new file
Diffstat (limited to 'etc/inc/PEAR.inc')
-rw-r--r--etc/inc/PEAR.inc33
1 files changed, 32 insertions, 1 deletions
diff --git a/etc/inc/PEAR.inc b/etc/inc/PEAR.inc
index c3a9ff6..e7b4731 100644
--- a/etc/inc/PEAR.inc
+++ b/etc/inc/PEAR.inc
@@ -736,7 +736,38 @@ class PEAR
}
if (PEAR_ZE2) {
- include_once 'PEAR5.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];
+ }
+ }
}
function _PEAR_call_destructors()
OpenPOWER on IntegriCloud