summaryrefslogtreecommitdiffstats
path: root/web/lib/Archive/PEAR5.php
diff options
context:
space:
mode:
authorcanyonknight <canyonknight@gmail.com>2012-10-27 14:24:27 -0400
committercanyonknight <canyonknight@gmail.com>2012-10-27 18:13:46 -0400
commitacdf9a85a0ff320f55d6eebb2ba7550fea61a5bb (patch)
tree06040a9dc53f257eeaa42f39ff8fafd917e7ffc8 /web/lib/Archive/PEAR5.php
parentafaa2404ac713e0d19e47b2e7b42780d90845050 (diff)
downloadaurweb-acdf9a85a0ff320f55d6eebb2ba7550fea61a5bb.tar.xz
Add Archive_Tar class to lib/
Some AUR setups do not have PEAR available. While other setups have access to outdated Archive_Tar versions. Avoid these problems completely by including the necessary files for Archive_Tar in lib/. Remove Archive_Tar requirement from INSTALL doc. Signed-off-by: canyonknight <canyonknight@gmail.com>
Diffstat (limited to 'web/lib/Archive/PEAR5.php')
-rw-r--r--web/lib/Archive/PEAR5.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/web/lib/Archive/PEAR5.php b/web/lib/Archive/PEAR5.php
new file mode 100644
index 0000000..5cee090
--- /dev/null
+++ b/web/lib/Archive/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];
+ }
+}