cvs: pear /PHP_Compat Compat.php
| From: | Aidan Lister | Date: | Sat, 26 Jun 2004 11:28:28 +0000 |
| Subject: | cvs: pear /PHP_Compat Compat.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21149@lists.php.net to get a copy of this message | ||
aidan Sat Jun 26 07:28:28 2004 EDT
Modified files:
/pear/PHP_Compat Compat.php
Log:
Removed defined() check from loadConstant - does not work with constant groups
Added a very basic loadVersion method
http://cvs.php.net/diff.php/pear/PHP_Compat/Compat.php?r1=1.12&r2=1.13&ty=u
Index: pear/PHP_Compat/Compat.php
diff -u pear/PHP_Compat/Compat.php:1.12 pear/PHP_Compat/Compat.php:1.13
--- pear/PHP_Compat/Compat.php:1.12 Thu Jun 17 01:00:50 2004
+++ pear/PHP_Compat/Compat.php Sat Jun 26 07:28:27 2004
@@ -16,7 +16,7 @@
// | Authors: Aidan Lister <aidan@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Compat.php,v 1.12 2004/06/17 05:00:50 aidan Exp $
+// $Id: Compat.php,v 1.13 2004/06/26 11:28:27 aidan Exp $
//
@@ -83,18 +83,72 @@
}
else {
- if (!defined($constant)) {
- $file = sprintf('PHP/Compat/Constant/%s.php', $constant);
-
- if ((@include_once $file) !== false) {
- return true;
- }
+ $file = sprintf('PHP/Compat/Constant/%s.php', $constant);
+
+ if ((@include_once $file) !== false) {
+ return true;
}
return false;
}
}
+
+ /**
+ * Load all missing components
+ *
+ * @return bool|array true if loaded, false if not
+ */
+ function loadVersion ()
+ {
+ $functions = array(
+ 'array_change_key_case',
+ 'array_chunk',
+ 'array_combine',
+ 'array_diff_assoc',
+ 'array_key_exists',
+ 'array_search',
+ 'array_udiff',
+ 'array_udiff_assoc',
+ 'call_user_func_array',
+ 'constant',
+ 'file_get_contents',
+ 'file_put_contents',
+ 'fprintf',
+ 'html_entity_decode',
+ 'http_build_query',
+ 'image_type_to_mime_type',
+ 'is_a',
+ 'ob_clean',
+ 'ob_flush',
+ 'ob_get_clean',
+ 'ob_get_flush',
+ 'scandir',
+ 'stripos',
+ 'strripos',
+ 'str_ireplace',
+ 'str_split',
+ 'str_word_count',
+ 'var_export',
+ 'version_compare',
+ 'vprintf',
+ 'vsprintf',
+ );
+
+ $results[] = PHP_Compat::loadFunction($functions);
+
+ $constants = array(
+ 'E_STRICT',
+ 'FILE',
+ 'PATH_SEPARATOR',
+ 'STD',
+ );
+
+ $results[] = PHP_Compat::loadConstant($constants);
+
+ return $results;
+ }
+
}
?>