Commit 9746f3966abf84259f94bcbe3a6f97f99209f9c0
1 parent
e7ac3939
Import PHP_Compat 1.4.1 from PEAR.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3486 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
76 changed files
with
5253 additions
and
0 deletions
thirdparty/pear/PHP/Compat.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Provides missing functionality in the form of constants and functions | |
| 23 | + * for older versions of PHP | |
| 24 | + * | |
| 25 | + * Optionally, you may simply include the file. | |
| 26 | + * e.g. require_once 'PHP/Compat/Function/scandir.php'; | |
| 27 | + * | |
| 28 | + * @category PHP | |
| 29 | + * @package PHP_Compat | |
| 30 | + * @version $Revision$ | |
| 31 | + * @author Aidan Lister <aidan@php.net> | |
| 32 | + * @static | |
| 33 | + */ | |
| 34 | +class PHP_Compat | |
| 35 | +{ | |
| 36 | + /** | |
| 37 | + * Load a function, or array of functions | |
| 38 | + * | |
| 39 | + * @param string|array $function The function or functions to load | |
| 40 | + * @return bool|array TRUE if loaded, FALSE if not | |
| 41 | + */ | |
| 42 | + function loadFunction($function) | |
| 43 | + { | |
| 44 | + // Recursiveness | |
| 45 | + if (is_array($function)) { | |
| 46 | + $res = array(); | |
| 47 | + foreach ($function as $singlefunc) { | |
| 48 | + $res[$singlefunc] = PHP_Compat::loadFunction($singlefunc); | |
| 49 | + } | |
| 50 | + | |
| 51 | + return $res; | |
| 52 | + } | |
| 53 | + | |
| 54 | + // Load function | |
| 55 | + if (!function_exists($function)) { | |
| 56 | + $file = sprintf('PHP/Compat/Function/%s.php', $function); | |
| 57 | + if ((@include_once $file) !== false) { | |
| 58 | + return true; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 62 | + return false; | |
| 63 | + } | |
| 64 | + | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * Load a constant, or array of constants | |
| 68 | + * | |
| 69 | + * @param string|array $constant The constant or constants to load | |
| 70 | + * @return bool|array TRUE if loaded, FALSE if not | |
| 71 | + */ | |
| 72 | + function loadConstant($constant) | |
| 73 | + { | |
| 74 | + // Recursiveness | |
| 75 | + if (is_array($constant)) { | |
| 76 | + $res = array(); | |
| 77 | + foreach ($constant as $singleconst) { | |
| 78 | + $res[$singleconst] = PHP_Compat::loadConstant($singleconst); | |
| 79 | + } | |
| 80 | + | |
| 81 | + return $res; | |
| 82 | + } | |
| 83 | + | |
| 84 | + // Load constant | |
| 85 | + $file = sprintf('PHP/Compat/Constant/%s.php', $constant); | |
| 86 | + if ((@include_once $file) !== false) { | |
| 87 | + return true; | |
| 88 | + } | |
| 89 | + | |
| 90 | + return false; | |
| 91 | + } | |
| 92 | + | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * Load components for a PHP version | |
| 96 | + * | |
| 97 | + * @param string $version PHP Version to load | |
| 98 | + * @return array An associative array of component names loaded | |
| 99 | + */ | |
| 100 | + function loadVersion($version = null) | |
| 101 | + { | |
| 102 | + // Include list of components | |
| 103 | + require 'PHP/Compat/Components.php'; | |
| 104 | + | |
| 105 | + // Include version_compare to work with older versions | |
| 106 | + PHP_Compat::loadFunction('version_compare'); | |
| 107 | + | |
| 108 | + // Init | |
| 109 | + $phpversion = phpversion(); | |
| 110 | + $methods = array( | |
| 111 | + 'function' => 'loadFunction', | |
| 112 | + 'constant' => 'loadConstant'); | |
| 113 | + $res = array(); | |
| 114 | + | |
| 115 | + // Iterate each component | |
| 116 | + foreach ($components as $type => $slice) { | |
| 117 | + foreach ($slice as $component => $compversion) { | |
| 118 | + if (($version === null && | |
| 119 | + 1 === version_compare($compversion, $phpversion)) || // C > PHP | |
| 120 | + (0 === version_compare($compversion, $version) || // C = S | |
| 121 | + 1 === version_compare($compversion, $phpversion))) { // C > PHP | |
| 122 | + | |
| 123 | + $res[$type][$component] = | |
| 124 | + call_user_func(array('PHP_Compat', $methods[$type]), $component); | |
| 125 | + } | |
| 126 | + } | |
| 127 | + } | |
| 128 | + | |
| 129 | + return $res; | |
| 130 | + } | |
| 131 | +} | |
| 132 | + | |
| 133 | +?> | |
| 0 | 134 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Components.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +// Functions | |
| 22 | +$components['function']['array_change_key_case'] = '4.2.0'; | |
| 23 | +$components['function']['array_chunk'] = '4.2.0'; | |
| 24 | +$components['function']['array_combine'] = '5.0.0'; | |
| 25 | +$components['function']['array_diff_assoc'] = '4.3.0'; | |
| 26 | +$components['function']['array_diff_key'] = '5.0.2'; | |
| 27 | +$components['function']['array_diff_ukey'] = '5.0.2'; | |
| 28 | +$components['function']['array_intersect_assoc'] = '5.0.0'; | |
| 29 | +$components['function']['array_intersect_key'] = '5.0.2'; | |
| 30 | +$components['function']['array_intersect_uassoc'] = '5.0.0'; | |
| 31 | +$components['function']['array_intersect_ukey'] = '5.0.2'; | |
| 32 | +$components['function']['array_key_exists'] = '4.1.0'; | |
| 33 | +$components['function']['array_search'] = '4.0.5'; | |
| 34 | +$components['function']['array_udiff'] = '5.0.0'; | |
| 35 | +$components['function']['array_udiff_assoc'] = '5.0.0'; | |
| 36 | +$components['function']['array_udiff_uassoc'] = '5.0.0'; | |
| 37 | +$components['function']['array_uintersect'] = '5.0.0'; | |
| 38 | +$components['function']['array_uintersect_assoc'] = '5.0.0'; | |
| 39 | +$components['function']['array_uintersect_uassoc'] = '5.0.0'; | |
| 40 | +$components['function']['array_walk_recursive'] = '5.0.0'; | |
| 41 | +$components['function']['call_user_func_array'] = '4.0.4'; | |
| 42 | +$components['function']['clone'] = '5.0.0'; | |
| 43 | +$components['function']['constant'] = '4.0.4'; | |
| 44 | +$components['function']['convert_uudecode'] = '5.0.0'; | |
| 45 | +$components['function']['convert_uuencode'] = '5.0.0'; | |
| 46 | +$components['function']['debug_print_backtrace'] = '5.0.0'; | |
| 47 | +$components['function']['file_get_contents'] = '4.3.0'; | |
| 48 | +$components['function']['file_put_contents'] = '5.0.0'; | |
| 49 | +$components['function']['floatval'] = '4.2.0'; | |
| 50 | +$components['function']['fprintf'] = '5.0.0'; | |
| 51 | +$components['function']['fputcsv'] = '5.0.0'; | |
| 52 | +$components['function']['get_headers'] = '5.0.0'; | |
| 53 | +$components['function']['get_include_path'] = '4.3.0'; | |
| 54 | +$components['function']['html_entity_decode'] = '4.3.0'; | |
| 55 | +$components['function']['htmlspecialchars_decode'] = '5.1.0'; | |
| 56 | +$components['function']['http_build_query'] = '5.0.0'; | |
| 57 | +$components['function']['ibase_timefmt'] = '5.0.0'; | |
| 58 | +$components['function']['image_type_to_mime_type'] = '4.3.0'; | |
| 59 | +$components['function']['ini_get_all'] = '4.2.0'; | |
| 60 | +$components['function']['is_a'] = '4.2.0'; | |
| 61 | +$components['function']['md5_file'] = '4.2.0'; | |
| 62 | +$components['function']['mhash'] = '4.0.0'; | |
| 63 | +$components['function']['ob_clean'] = '4.2.0'; | |
| 64 | +$components['function']['ob_flush'] = '4.2.0'; | |
| 65 | +$components['function']['ob_get_clean'] = '4.3.0'; | |
| 66 | +$components['function']['ob_get_flush'] = '4.3.0'; | |
| 67 | +$components['function']['php_strip_whitespace'] = '5.0.0'; | |
| 68 | +$components['function']['pg_affected_rows'] = '4.2.0'; | |
| 69 | +$components['function']['pg_escape_bytea'] = '4.2.0'; | |
| 70 | +$components['function']['pg_unescape_bytea'] = '4.2.0'; | |
| 71 | +$components['function']['restore_include_path'] = '4.3.0'; | |
| 72 | +$components['function']['scandir'] = '5.0.0'; | |
| 73 | +$components['function']['set_include_path'] = '4.3.0'; | |
| 74 | +$components['function']['str_ireplace'] = '5.0.0'; | |
| 75 | +$components['function']['str_rot13'] = '4.2.0'; | |
| 76 | +$components['function']['str_shuffle'] = '4.3.0'; | |
| 77 | +$components['function']['str_split'] = '5.0.0'; | |
| 78 | +$components['function']['str_word_count'] = '4.3.0'; | |
| 79 | +$components['function']['stripos'] = '5.0.0'; | |
| 80 | +$components['function']['strpbrk'] = '5.0.0'; | |
| 81 | +$components['function']['strripos'] = '5.0.0'; | |
| 82 | +$components['function']['substr_compare'] = '5.0.0'; | |
| 83 | +$components['function']['var_export'] = '4.2.0'; | |
| 84 | +$components['function']['version_compare'] = '4.1.0'; | |
| 85 | +$components['function']['vprintf'] = '4.1.0'; | |
| 86 | +$components['function']['vsprintf'] = '4.1.0'; | |
| 87 | + | |
| 88 | +// Constants | |
| 89 | +$components['constant']['DIRECTORY_SEPARATOR'] = '4.0.6'; | |
| 90 | +$components['constant']['E_STRICT'] = '5.0.0'; | |
| 91 | +$components['constant']['FILE'] = '4.3.0'; | |
| 92 | +$components['constant']['PATH_SEPARATOR'] = '4.2.0'; | |
| 93 | +$components['constant']['PHP_EOL'] = '5.0.1'; | |
| 94 | +$components['constant']['STD'] = '4.3.0'; | |
| 95 | +$components['constant']['T'] = '5.0.0'; | |
| 96 | +$components['constant']['UPLOAD_ERR'] = '4.3.0'; | |
| 97 | +?> | |
| 0 | 98 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/DIRECTORY_SEPARATOR.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace constant DIRECTORY_SEPARATOR | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/reserved.constants.standard | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.0.6 | |
| 30 | + */ | |
| 31 | +if (!defined('DIRECTORY_SEPARATOR')) { | |
| 32 | + define('DIRECTORY_SEPARATOR', | |
| 33 | + strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/' | |
| 34 | + ); | |
| 35 | +} | |
| 36 | + | |
| 37 | +?> | |
| 0 | 38 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/E_STRICT.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace constant E_STRICT | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/ref.errorfunc | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + */ | |
| 31 | +if (!defined('E_STRICT')) { | |
| 32 | + define('E_STRICT', 2048); | |
| 33 | +} | |
| 34 | + | |
| 35 | +?> | |
| 0 | 36 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/FILE.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace filesystem constants | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/ref.filesystem | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + */ | |
| 31 | +if (!defined('FILE_USE_INCLUDE_PATH')) { | |
| 32 | + define('FILE_USE_INCLUDE_PATH', 1); | |
| 33 | +} | |
| 34 | + | |
| 35 | +if (!defined('FILE_IGNORE_NEW_LINES')) { | |
| 36 | + define('FILE_IGNORE_NEW_LINES', 2); | |
| 37 | +} | |
| 38 | + | |
| 39 | +if (!defined('FILE_SKIP_EMPTY_LINES')) { | |
| 40 | + define('FILE_SKIP_EMPTY_LINES', 4); | |
| 41 | +} | |
| 42 | + | |
| 43 | +if (!defined('FILE_APPEND')) { | |
| 44 | + define('FILE_APPEND', 8); | |
| 45 | +} | |
| 46 | + | |
| 47 | +if (!defined('FILE_NO_DEFAULT_CONTEXT')) { | |
| 48 | + define('FILE_NO_DEFAULT_CONTEXT', 16); | |
| 49 | +} | |
| 50 | + | |
| 51 | +?> | |
| 0 | 52 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/PATH_SEPARATOR.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace constant PATH_SEPARATOR | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/ref.dir | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + */ | |
| 31 | +if (!defined('PATH_SEPARATOR')) { | |
| 32 | + define('PATH_SEPARATOR', | |
| 33 | + strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':' | |
| 34 | + ); | |
| 35 | +} | |
| 36 | + | |
| 37 | +?> | |
| 0 | 38 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/PHP_EOL.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace PHP_EOL constant | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/reserved.constants.core | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.2 | |
| 30 | + */ | |
| 31 | +if (!defined('PHP_EOL')) { | |
| 32 | + switch (strtoupper(substr(PHP_OS, 0, 3))) { | |
| 33 | + // Windows | |
| 34 | + case 'WIN': | |
| 35 | + define('PHP_EOL', "\r\n"); | |
| 36 | + break; | |
| 37 | + | |
| 38 | + // Mac | |
| 39 | + case 'DAR': | |
| 40 | + define('PHP_EOL', "\r"); | |
| 41 | + break; | |
| 42 | + | |
| 43 | + // Unix | |
| 44 | + default: | |
| 45 | + define('PHP_EOL', "\n"); | |
| 46 | + } | |
| 47 | +} | |
| 48 | + | |
| 49 | +?> | |
| 0 | 50 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/STD.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace commandline constants | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/features.commandline | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + */ | |
| 31 | +if (!defined('STDIN')) { | |
| 32 | + define('STDIN', fopen('php://stdin', 'r')); | |
| 33 | +} | |
| 34 | + | |
| 35 | +if (!defined('STDOUT')) { | |
| 36 | + define('STDOUT', fopen('php://stdout', 'w')); | |
| 37 | +} | |
| 38 | + | |
| 39 | +if (!defined('STDERR')) { | |
| 40 | + define('STDERR', fopen('php://stderr', 'w')); | |
| 41 | +} | |
| 42 | + | |
| 43 | +?> | |
| 0 | 44 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/T.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace tokenizer constants | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/ref.tokenizer | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + */ | |
| 31 | +if (!defined('T_ML_COMMENT')) { | |
| 32 | + define('T_ML_COMMENT', T_COMMENT); | |
| 33 | +} | |
| 34 | +if (!defined('T_DOC_COMMENT')) { | |
| 35 | + define('T_DOC_COMMENT', T_ML_COMMENT); | |
| 36 | +} | |
| 37 | + | |
| 38 | +if (!defined('T_OLD_FUNCTION')) { | |
| 39 | + define('T_OLD_FUNCTION', -1); | |
| 40 | +} | |
| 41 | +if (!defined('T_ABSTRACT')) { | |
| 42 | + define('T_ABSTRACT', -1); | |
| 43 | +} | |
| 44 | +if (!defined('T_CATCH')) { | |
| 45 | + define('T_CATCH', -1); | |
| 46 | +} | |
| 47 | +if (!defined('T_FINAL')) { | |
| 48 | + define('T_FINAL', -1); | |
| 49 | +} | |
| 50 | +if (!defined('T_INSTANCEOF')) { | |
| 51 | + define('T_INSTANCEOF', -1); | |
| 52 | +} | |
| 53 | +if (!defined('T_PRIVATE')) { | |
| 54 | + define('T_PRIVATE', -1); | |
| 55 | +} | |
| 56 | +if (!defined('T_PROTECTED')) { | |
| 57 | + define('T_PROTECTED', -1); | |
| 58 | +} | |
| 59 | +if (!defined('T_PUBLIC')) { | |
| 60 | + define('T_PUBLIC', -1); | |
| 61 | +} | |
| 62 | +if (!defined('T_THROW')) { | |
| 63 | + define('T_THROW', -1); | |
| 64 | +} | |
| 65 | +if (!defined('T_TRY')) { | |
| 66 | + define('T_TRY', -1); | |
| 67 | +} | |
| 68 | +if (!defined('T_CLONE')) { | |
| 69 | + define('T_CLONE', -1); | |
| 70 | +} | |
| 71 | + | |
| 72 | +?> | |
| 0 | 73 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Constant/UPLOAD_ERR.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace upload error constants | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/features.file-upload.errors | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + */ | |
| 31 | +if (!defined('UPLOAD_ERR_OK')) { | |
| 32 | + define('UPLOAD_ERR_OK', 0); | |
| 33 | +} | |
| 34 | + | |
| 35 | +if (!defined('UPLOAD_ERR_INI_SIZE')) { | |
| 36 | + define('UPLOAD_ERR_INI_SIZE', 1); | |
| 37 | +} | |
| 38 | + | |
| 39 | +if (!defined('UPLOAD_ERR_FORM_SIZE')) { | |
| 40 | + define('UPLOAD_ERR_FORM_SIZE', 2); | |
| 41 | +} | |
| 42 | + | |
| 43 | +if (!defined('UPLOAD_ERR_PARTIAL')) { | |
| 44 | + define('UPLOAD_ERR_PARTIAL', 3); | |
| 45 | +} | |
| 46 | + | |
| 47 | +if (!defined('UPLOAD_ERR_NO_FILE')) { | |
| 48 | + define('UPLOAD_ERR_NO_FILE', 4); | |
| 49 | +} | |
| 50 | + | |
| 51 | +?> | |
| 0 | 52 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_change_key_case.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +if (!defined('CASE_LOWER')) { | |
| 23 | + define('CASE_LOWER', 0); | |
| 24 | +} | |
| 25 | + | |
| 26 | +if (!defined('CASE_UPPER')) { | |
| 27 | + define('CASE_UPPER', 1); | |
| 28 | +} | |
| 29 | + | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * Replace array_change_key_case() | |
| 33 | + * | |
| 34 | + * @category PHP | |
| 35 | + * @package PHP_Compat | |
| 36 | + * @link http://php.net/function.array_change_key_case | |
| 37 | + * @author Stephan Schmidt <schst@php.net> | |
| 38 | + * @author Aidan Lister <aidan@php.net> | |
| 39 | + * @version $Revision$ | |
| 40 | + * @since PHP 4.2.0 | |
| 41 | + * @require PHP 4.0.0 (user_error) | |
| 42 | + */ | |
| 43 | +if (!function_exists('array_change_key_case')) { | |
| 44 | + function array_change_key_case($input, $case = CASE_LOWER) | |
| 45 | + { | |
| 46 | + if (!is_array($input)) { | |
| 47 | + user_error('array_change_key_case(): The argument should be an array', | |
| 48 | + E_USER_WARNING); | |
| 49 | + return false; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $output = array (); | |
| 53 | + $keys = array_keys($input); | |
| 54 | + $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; | |
| 55 | + | |
| 56 | + foreach ($keys as $key) { | |
| 57 | + $output[$casefunc($key)] = $input[$key]; | |
| 58 | + } | |
| 59 | + | |
| 60 | + return $output; | |
| 61 | + } | |
| 62 | +} | |
| 63 | +?> | |
| 0 | 64 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_chunk.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_combine() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_chunk | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @author Thiemo Mรคttig (http://maettig.com) | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 4.2.0 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('array_chunk')) { | |
| 34 | + function array_chunk($input, $size, $preserve_keys = false) | |
| 35 | + { | |
| 36 | + if (!is_array($input)) { | |
| 37 | + user_error('array_chunk() expects parameter 1 to be array, ' . | |
| 38 | + gettype($input) . ' given', E_USER_WARNING); | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + if (!is_numeric($size)) { | |
| 43 | + user_error('array_chunk() expects parameter 2 to be long, ' . | |
| 44 | + gettype($size) . ' given', E_USER_WARNING); | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + | |
| 48 | + $size = (int)$size; | |
| 49 | + if ($size <= 0) { | |
| 50 | + user_error('array_chunk() Size parameter expected to be greater than 0', | |
| 51 | + E_USER_WARNING); | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 55 | + $chunks = array(); | |
| 56 | + $i = 0; | |
| 57 | + | |
| 58 | + if ($preserve_keys !== false) { | |
| 59 | + foreach ($input as $key => $value) { | |
| 60 | + $chunks[(int)($i++ / $size)][$key] = $value; | |
| 61 | + } | |
| 62 | + } else { | |
| 63 | + foreach ($input as $value) { | |
| 64 | + $chunks[(int)($i++ / $size)][] = $value; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + return $chunks; | |
| 69 | + } | |
| 70 | +} | |
| 71 | + | |
| 72 | +?> | |
| 0 | 73 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_combine.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_combine() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_combine | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_combine')) { | |
| 33 | + function array_combine($keys, $values) | |
| 34 | + { | |
| 35 | + if (!is_array($keys)) { | |
| 36 | + user_error('array_combine() expects parameter 1 to be array, ' . | |
| 37 | + gettype($keys) . ' given', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (!is_array($values)) { | |
| 42 | + user_error('array_combine() expects parameter 2 to be array, ' . | |
| 43 | + gettype($values) . ' given', E_USER_WARNING); | |
| 44 | + return; | |
| 45 | + } | |
| 46 | + | |
| 47 | + $key_count = count($keys); | |
| 48 | + $value_count = count($values); | |
| 49 | + if ($key_count !== $value_count) { | |
| 50 | + user_error('array_combine() Both parameters should have equal number of elements', E_USER_WARNING); | |
| 51 | + return false; | |
| 52 | + } | |
| 53 | + | |
| 54 | + if ($key_count === 0 || $value_count === 0) { | |
| 55 | + user_error('array_combine() Both parameters should have number of elements at least 0', E_USER_WARNING); | |
| 56 | + return false; | |
| 57 | + } | |
| 58 | + | |
| 59 | + $keys = array_values($keys); | |
| 60 | + $values = array_values($values); | |
| 61 | + | |
| 62 | + $combined = array(); | |
| 63 | + for ($i = 0; $i < $key_count; $i++) { | |
| 64 | + $combined[$keys[$i]] = $values[$i]; | |
| 65 | + } | |
| 66 | + | |
| 67 | + return $combined; | |
| 68 | + } | |
| 69 | +} | |
| 70 | + | |
| 71 | +?> | |
| 0 | 72 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_diff_assoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_diff_assoc() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_diff_assoc | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_diff_assoc')) { | |
| 33 | + function array_diff_assoc() | |
| 34 | + { | |
| 35 | + // Check we have enough arguments | |
| 36 | + $args = func_get_args(); | |
| 37 | + $count = count($args); | |
| 38 | + if (count($args) < 2) { | |
| 39 | + user_error('Wrong parameter count for array_diff_assoc()', E_USER_WARNING); | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + | |
| 43 | + // Check arrays | |
| 44 | + for ($i = 0; $i < $count; $i++) { | |
| 45 | + if (!is_array($args[$i])) { | |
| 46 | + user_error('array_diff_assoc() Argument #' . | |
| 47 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 48 | + return; | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + // Get the comparison array | |
| 53 | + $array_comp = array_shift($args); | |
| 54 | + --$count; | |
| 55 | + | |
| 56 | + // Traverse values of the first array | |
| 57 | + foreach ($array_comp as $key => $value) { | |
| 58 | + // Loop through the other arrays | |
| 59 | + for ($i = 0; $i < $count; $i++) { | |
| 60 | + // Loop through this arrays key/value pairs and compare | |
| 61 | + foreach ($args[$i] as $comp_key => $comp_value) { | |
| 62 | + if ((string)$key === (string)$comp_key && | |
| 63 | + (string)$value === (string)$comp_value) | |
| 64 | + { | |
| 65 | + | |
| 66 | + unset($array_comp[$key]); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + return $array_comp; | |
| 73 | + } | |
| 74 | +} | |
| 75 | +?> | |
| 0 | 76 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_diff_key.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_diff_key() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_diff_key | |
| 27 | + * @author Tom Buskens <ortega@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.2 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_diff_key')) { | |
| 33 | + function array_diff_key() | |
| 34 | + { | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 2) { | |
| 37 | + user_error('Wrong parameter count for array_diff_key()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + // Check arrays | |
| 42 | + $array_count = count($args); | |
| 43 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 44 | + if (!is_array($args[$i])) { | |
| 45 | + user_error('array_diff_key() Argument #' . | |
| 46 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 47 | + return; | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + $result = $args[0]; | |
| 52 | + foreach ($args[0] as $key1 => $value1) { | |
| 53 | + for ($i = 1; $i !== $array_count; $i++) { | |
| 54 | + foreach ($args[$i] as $key2 => $value2) { | |
| 55 | + if ((string) $key1 === (string) $key2) { | |
| 56 | + unset($result[$key2]); | |
| 57 | + break 2; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + } | |
| 61 | + } | |
| 62 | + return $result; | |
| 63 | + } | |
| 64 | +} | |
| 65 | + | |
| 66 | +?> | |
| 0 | 67 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_diff_uassoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_diff_uassoc() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_diff_uassoc | |
| 27 | + * @version $Revision$ | |
| 28 | + * @since PHP 5.0.0 | |
| 29 | + * @require PHP 4.0.6 (is_callable) | |
| 30 | + */ | |
| 31 | +if (!function_exists('array_diff_uassoc')) { | |
| 32 | + function array_diff_uassoc() | |
| 33 | + { | |
| 34 | + // Sanity check | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 3) { | |
| 37 | + user_error('Wrong parameter count for array_diff_uassoc()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + // Get compare function | |
| 42 | + $compare_func = array_pop($args); | |
| 43 | + if (!is_callable($compare_func)) { | |
| 44 | + if (is_array($compare_func)) { | |
| 45 | + $compare_func = $compare_func[0] . '::' . $compare_func[1]; | |
| 46 | + } | |
| 47 | + user_error('array_diff_uassoc() Not a valid callback ' . | |
| 48 | + $compare_func, E_USER_WARNING); | |
| 49 | + return; | |
| 50 | + } | |
| 51 | + | |
| 52 | + // Check arrays | |
| 53 | + $array_count = count($args); | |
| 54 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 55 | + if (!is_array($args[$i])) { | |
| 56 | + user_error('array_diff_uassoc() Argument #' . | |
| 57 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 62 | + // Compare entries | |
| 63 | + $result = array(); | |
| 64 | + foreach ($args[0] as $k => $v) { | |
| 65 | + for ($i = 1; $i < $array_count; $i++) { | |
| 66 | + foreach ($args[$i] as $kk => $vv) { | |
| 67 | + if ($v == $vv) { | |
| 68 | + $compare = call_user_func_array($compare_func, array($k, $kk)); | |
| 69 | + if ($compare == 0) { | |
| 70 | + continue 3; | |
| 71 | + } | |
| 72 | + } | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + $result[$k] = $v; | |
| 77 | + } | |
| 78 | + | |
| 79 | + return $result; | |
| 80 | + } | |
| 81 | +} | |
| 82 | + | |
| 83 | +?> | |
| 0 | 84 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_diff_ukey.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_diff_ukey() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_diff_ukey | |
| 27 | + * @author Tom Buskens <ortega@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.2 | |
| 30 | + * @require PHP 4.0.6 (is_callable) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_diff_ukey')) { | |
| 33 | + function array_diff_ukey() | |
| 34 | + { | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 3) { | |
| 37 | + user_error('Wrong parameter count for array_diff_ukey()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + // Get compare function | |
| 42 | + $compare_func = array_pop($args); | |
| 43 | + if (!is_callable($compare_func)) { | |
| 44 | + if (is_array($compare_func)) { | |
| 45 | + $compare_func = $compare_func[0].'::'.$compare_func[1]; | |
| 46 | + } | |
| 47 | + user_error('array_diff_ukey() Not a valid callback ' . | |
| 48 | + $compare_func, E_USER_WARNING); | |
| 49 | + return; | |
| 50 | + } | |
| 51 | + | |
| 52 | + // Check arrays | |
| 53 | + $array_count = count($args); | |
| 54 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 55 | + if (!is_array($args[$i])) { | |
| 56 | + user_error('array_diff_ukey() Argument #' . | |
| 57 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 62 | + // Compare entries | |
| 63 | + $result = $args[0]; | |
| 64 | + foreach ($args[0] as $key1 => $value1) { | |
| 65 | + for ($i = 1; $i !== $array_count; $i++) { | |
| 66 | + foreach ($args[$i] as $key2 => $value2) { | |
| 67 | + if (!(call_user_func($compare_func, (string) $key1, (string) $key2))) { | |
| 68 | + unset($result[$key1]); | |
| 69 | + break 2; | |
| 70 | + } | |
| 71 | + } | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + return $result; | |
| 76 | + } | |
| 77 | +} | |
| 78 | + | |
| 79 | +?> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_intersect_assoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_intersect_assoc() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_intersect_assoc | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_intersect_assoc')) { | |
| 33 | + function array_intersect_assoc() | |
| 34 | + { | |
| 35 | + // Sanity check | |
| 36 | + $args = func_get_args(); | |
| 37 | + if (count($args) < 2) { | |
| 38 | + user_error('wrong parameter count for array_intersect_assoc()', E_USER_WARNING); | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + // Check arrays | |
| 43 | + $array_count = count($args); | |
| 44 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 45 | + if (!is_array($args[$i])) { | |
| 46 | + user_error('array_intersect_assoc() Argument #' . | |
| 47 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 48 | + return; | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + // Compare entries | |
| 53 | + $intersect = array(); | |
| 54 | + foreach ($args[0] as $key => $value) { | |
| 55 | + $intersect[$key] = $value; | |
| 56 | + | |
| 57 | + for ($i = 1; $i < $array_count; $i++) { | |
| 58 | + if (!isset($args[$i][$key]) || $args[$i][$key] != $value) { | |
| 59 | + unset($intersect[$key]); | |
| 60 | + break; | |
| 61 | + } | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + return $intersect; | |
| 66 | + } | |
| 67 | +} | |
| 68 | + | |
| 69 | +?> | |
| 0 | 70 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_intersect_key.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_intersect_key() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_intersect_key | |
| 27 | + * @author Tom Buskens <ortega@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.2 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_intersect_key')) { | |
| 33 | + function array_intersect_key() | |
| 34 | + { | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 2) { | |
| 37 | + user_error('Wrong parameter count for array_intersect_key()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + // Check arrays | |
| 42 | + $array_count = count($args); | |
| 43 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 44 | + if (!is_array($args[$i])) { | |
| 45 | + user_error('array_intersect_key() Argument #' . | |
| 46 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 47 | + return; | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + // Compare entries | |
| 52 | + $result = array(); | |
| 53 | + foreach ($args[0] as $key1 => $value1) { | |
| 54 | + for ($i = 1; $i !== $array_count; $i++) { | |
| 55 | + foreach ($args[$i] as $key2 => $value2) { | |
| 56 | + if ((string) $key1 === (string) $key2) { | |
| 57 | + $result[$key1] = $value1; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 63 | + return $result; | |
| 64 | + } | |
| 65 | +} | |
| 66 | + | |
| 67 | +?> | |
| 0 | 68 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_intersect_uassoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_intersect_assoc() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_intersect_uassoc | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.6 (is_callable) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_intersect_uassoc')) { | |
| 33 | + function array_intersect_uassoc() | |
| 34 | + { | |
| 35 | + // Sanity check | |
| 36 | + $args = func_get_args(); | |
| 37 | + if (count($args) < 3) { | |
| 38 | + user_error('Wrong parameter count for array_intersect_ukey()', E_USER_WARNING); | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + // Get compare function | |
| 43 | + $compare_func = array_pop($args); | |
| 44 | + if (!is_callable($compare_func)) { | |
| 45 | + if (is_array($compare_func)) { | |
| 46 | + $compare_func = $compare_func[0] . '::' . $compare_func[1]; | |
| 47 | + } | |
| 48 | + user_error('array_intersect_uassoc() Not a valid callback ' . | |
| 49 | + $compare_func, E_USER_WARNING); | |
| 50 | + return; | |
| 51 | + } | |
| 52 | + | |
| 53 | + // Check arrays | |
| 54 | + $array_count = count($args); | |
| 55 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 56 | + if (!is_array($args[$i])) { | |
| 57 | + user_error('array_intersect_uassoc() Argument #' . | |
| 58 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 59 | + return; | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 63 | + // Compare entries | |
| 64 | + $result = array(); | |
| 65 | + foreach ($args[0] as $k => $v) { | |
| 66 | + for ($i = 0; $i < $array_count; $i++) { | |
| 67 | + $match = false; | |
| 68 | + foreach ($args[$i] as $kk => $vv) { | |
| 69 | + $compare = call_user_func_array($compare_func, array($k, $kk)); | |
| 70 | + if ($compare === 0 && $v == $vv) { | |
| 71 | + $match = true; | |
| 72 | + continue 2; | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + if ($match === false) { | |
| 77 | + continue 2; | |
| 78 | + } | |
| 79 | + } | |
| 80 | + | |
| 81 | + if ($match === true) { | |
| 82 | + $result[$k] = $v; | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + return $result; | |
| 87 | + } | |
| 88 | +} | |
| 89 | + | |
| 90 | +?> | |
| 0 | 91 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_intersect_ukey.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_intersect_ukey() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_intersect_ukey | |
| 27 | + * @author Tom Buskens <ortega@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.2 | |
| 30 | + * @require PHP 4.0.6 (is_callable) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_intersect_ukey')) { | |
| 33 | + function array_intersect_ukey() | |
| 34 | + { | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 3) { | |
| 37 | + user_error('Wrong parameter count for array_intersect_ukey()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + // Get compare function | |
| 42 | + $compare_func = array_pop($args); | |
| 43 | + if (!is_callable($compare_func)) { | |
| 44 | + if (is_array($compare_func)) { | |
| 45 | + $compare_func = $compare_func[0].'::'.$compare_func[1]; | |
| 46 | + } | |
| 47 | + user_error('array_diff_ukey() Not a valid callback ' . | |
| 48 | + $compare_func, E_USER_WARNING); | |
| 49 | + return; | |
| 50 | + } | |
| 51 | + | |
| 52 | + // Check arrays | |
| 53 | + $array_count = count($args); | |
| 54 | + for ($i = 0; $i !== $array_count; $i++) { | |
| 55 | + if (!is_array($args[$i])) { | |
| 56 | + user_error('array_intersect_ukey() Argument #' . | |
| 57 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 62 | + // Compare entries | |
| 63 | + $result = array(); | |
| 64 | + foreach ($args[0] as $key1 => $value1) { | |
| 65 | + for ($i = 1; $i !== $array_count; $i++) { | |
| 66 | + foreach ($args[$i] as $key2 => $value2) { | |
| 67 | + if (!(call_user_func($compare_func, (string) $key1, (string) $key2))) { | |
| 68 | + $result[$key1] = $value1; | |
| 69 | + break 2; | |
| 70 | + } | |
| 71 | + } | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + return $result; | |
| 76 | + } | |
| 77 | +} | |
| 78 | + | |
| 79 | +?> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_key_exists.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_key_exists() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_key_exists | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.1.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_key_exists')) { | |
| 33 | + function array_key_exists($key, $search) | |
| 34 | + { | |
| 35 | + if (!is_scalar($key)) { | |
| 36 | + user_error('array_key_exists() The first argument should be either a string or an integer', | |
| 37 | + E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (is_object($search)) { | |
| 42 | + $search = get_object_vars($search); | |
| 43 | + } | |
| 44 | + | |
| 45 | + if (!is_array($search)) { | |
| 46 | + user_error('array_key_exists() The second argument should be either an array or an object', | |
| 47 | + E_USER_WARNING); | |
| 48 | + return false; | |
| 49 | + } | |
| 50 | + | |
| 51 | + return in_array($key, array_keys($search)); | |
| 52 | + } | |
| 53 | +} | |
| 54 | + | |
| 55 | +?> | |
| 0 | 56 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_search.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_search() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_search | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @author Thiemo Mรคttig (http://maettig.com/) | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 4.0.5 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('array_search')) { | |
| 34 | + function array_search($needle, $haystack, $strict = false) | |
| 35 | + { | |
| 36 | + if (!is_array($haystack)) { | |
| 37 | + user_error('array_search() Wrong datatype for second argument', E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + foreach ($haystack as $key => $value) { | |
| 42 | + if ($strict ? $value === $needle : $value == $needle) { | |
| 43 | + return $key; | |
| 44 | + } | |
| 45 | + } | |
| 46 | + | |
| 47 | + return false; | |
| 48 | + } | |
| 49 | +} | |
| 50 | + | |
| 51 | +?> | |
| 0 | 52 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_udiff.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace array_udiff() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.array_udiff | |
| 28 | + * @author Stephan Schmidt <schst@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.6 (is_callable) | |
| 33 | + */ | |
| 34 | +if (!function_exists('array_udiff')) { | |
| 35 | + function array_udiff() | |
| 36 | + { | |
| 37 | + $args = func_get_args(); | |
| 38 | + | |
| 39 | + if (count($args) < 3) { | |
| 40 | + user_error('Wrong parameter count for array_udiff()', E_USER_WARNING); | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + | |
| 44 | + // Get compare function | |
| 45 | + $compare_func = array_pop($args); | |
| 46 | + if (!is_callable($compare_func)) { | |
| 47 | + if (is_array($compare_func)) { | |
| 48 | + $compare_func = $compare_func[0] . '::' . $compare_func[1]; | |
| 49 | + } | |
| 50 | + user_error('array_udiff() Not a valid callback ' . | |
| 51 | + $compare_func, E_USER_WARNING); | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 55 | + // Check arrays | |
| 56 | + $cnt = count($args); | |
| 57 | + for ($i = 0; $i < $cnt; $i++) { | |
| 58 | + if (!is_array($args[$i])) { | |
| 59 | + user_error('array_udiff() Argument #' . | |
| 60 | + ($i + 1). ' is not an array', E_USER_WARNING); | |
| 61 | + return; | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + $diff = array (); | |
| 66 | + // Traverse values of the first array | |
| 67 | + foreach ($args[0] as $key => $value) { | |
| 68 | + // Check all arrays | |
| 69 | + for ($i = 1; $i < $cnt; $i++) { | |
| 70 | + foreach ($args[$i] as $cmp_value) { | |
| 71 | + $result = call_user_func($compare_func, $value, $cmp_value); | |
| 72 | + if ($result === 0) { | |
| 73 | + continue 3; | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 77 | + $diff[$key] = $value; | |
| 78 | + } | |
| 79 | + return $diff; | |
| 80 | + } | |
| 81 | +} | |
| 82 | + | |
| 83 | +?> | |
| 0 | 84 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_udiff_assoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace array_udiff_assoc() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @author Stephan Schmidt <schst@php.net> | |
| 28 | + * @author Aidan Lister <aidan@php.net> | |
| 29 | + * @version $Revision$ | |
| 30 | + * @link http://php.net/function.array-udiff-assoc | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.6 (is_callable) | |
| 33 | + */ | |
| 34 | +if (!function_exists('array_udiff_assoc')) { | |
| 35 | + function array_udiff_assoc() | |
| 36 | + { | |
| 37 | + $args = func_get_args(); | |
| 38 | + if (count($args) < 3) { | |
| 39 | + user_error('Wrong parameter count for array_udiff_assoc()', E_USER_WARNING); | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + | |
| 43 | + // Get compare function | |
| 44 | + $compare_func = array_pop($args); | |
| 45 | + if (!is_callable($compare_func)) { | |
| 46 | + if (is_array($compare_func)) { | |
| 47 | + $compare_func = $compare_func[0] . '::' . $compare_func[1]; | |
| 48 | + } | |
| 49 | + user_error('array_udiff_assoc() Not a valid callback ' . | |
| 50 | + $compare_func, E_USER_WARNING); | |
| 51 | + return; | |
| 52 | + } | |
| 53 | + | |
| 54 | + // Check arrays | |
| 55 | + $count = count($args); | |
| 56 | + for ($i = 0; $i < $count; $i++) { | |
| 57 | + if (!is_array($args[$i])) { | |
| 58 | + user_error('array_udiff_assoc() Argument #' . | |
| 59 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 60 | + return; | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + $diff = array (); | |
| 65 | + // Traverse values of the first array | |
| 66 | + foreach ($args[0] as $key => $value) { | |
| 67 | + // Check all arrays | |
| 68 | + for ($i = 1; $i < $count; $i++) { | |
| 69 | + if (!array_key_exists($key, $args[$i])) { | |
| 70 | + continue; | |
| 71 | + } | |
| 72 | + $result = call_user_func($compare_func, $value, $args[$i][$key]); | |
| 73 | + if ($result === 0) { | |
| 74 | + continue 2; | |
| 75 | + } | |
| 76 | + } | |
| 77 | + | |
| 78 | + $diff[$key] = $value; | |
| 79 | + } | |
| 80 | + | |
| 81 | + return $diff; | |
| 82 | + } | |
| 83 | +} | |
| 84 | + | |
| 85 | +?> | |
| 0 | 86 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_udiff_uassoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_udiff_uassoc() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_udiff_uassoc | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.6 (is_callable) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_udiff_uassoc')) { | |
| 33 | + function array_udiff_uassoc() | |
| 34 | + { | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 3) { | |
| 37 | + user_error('Wrong parameter count for array_udiff_uassoc()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + // Get compare function | |
| 42 | + $compare_func = array_pop($args); | |
| 43 | + if (!is_callable($compare_func)) { | |
| 44 | + if (is_array($compare_func)) { | |
| 45 | + $compare_func = $compare_func[0] . '::' . $compare_func[1]; | |
| 46 | + } | |
| 47 | + user_error('array_udiff_uassoc() Not a valid callback ' . $compare_func, E_USER_WARNING); | |
| 48 | + return; | |
| 49 | + } | |
| 50 | + | |
| 51 | + // Check arrays | |
| 52 | + $count = count($args); | |
| 53 | + for ($i = 0; $i < $count; $i++) { | |
| 54 | + if (!is_array($args[$i])) { | |
| 55 | + user_error('array_udiff_uassoc() Argument #' . | |
| 56 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 57 | + return; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + // Traverse values of the first array | |
| 62 | + $diff = array (); | |
| 63 | + foreach ($args[0] as $key => $value) { | |
| 64 | + // Check all arrays | |
| 65 | + for ($i = 1; $i < $count; $i++) { | |
| 66 | + if (!array_key_exists($key, $args[$i])) { | |
| 67 | + continue; | |
| 68 | + } | |
| 69 | + $result = call_user_func($compare_func, $value, $args[$i][$key]); | |
| 70 | + if ($result === 0) { | |
| 71 | + continue 2; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + $diff[$key] = $value; | |
| 76 | + } | |
| 77 | + | |
| 78 | + return $diff; | |
| 79 | + } | |
| 80 | +} | |
| 81 | + | |
| 82 | +?> | |
| 0 | 83 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_uintersect.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Tom Buskens <ortega@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace array_uintersect() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.array_uintersect | |
| 28 | + * @author Tom Buskens <ortega@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.6 (is_callable) | |
| 33 | + */ | |
| 34 | +if (!function_exists('array_uintersect')) { | |
| 35 | + function array_uintersect() | |
| 36 | + { | |
| 37 | + $args = func_get_args(); | |
| 38 | + if (count($args) < 3) { | |
| 39 | + user_error('wrong parameter count for array_uintersect()', | |
| 40 | + E_USER_WARNING); | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + | |
| 44 | + // Get compare function | |
| 45 | + $user_func = array_pop($args); | |
| 46 | + if (!is_callable($user_func)) { | |
| 47 | + if (is_array($user_func)) { | |
| 48 | + $user_func = $user_func[0] . '::' . $user_func[1]; | |
| 49 | + } | |
| 50 | + user_error('array_uintersect() Not a valid callback ' . | |
| 51 | + $user_func, E_USER_WARNING); | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 55 | + // Check arrays | |
| 56 | + $array_count = count($args); | |
| 57 | + for ($i = 0; $i < $array_count; $i++) { | |
| 58 | + if (!is_array($args[$i])) { | |
| 59 | + user_error('array_uintersect() Argument #' . | |
| 60 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 61 | + return; | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + // Compare entries | |
| 66 | + $output = array(); | |
| 67 | + foreach ($args[0] as $key => $item) { | |
| 68 | + for ($i = 1; $i !== $array_count; $i++) { | |
| 69 | + $array = $args[$i]; | |
| 70 | + foreach($array as $key0 => $item0) { | |
| 71 | + if (!call_user_func($user_func, $item, $item0)) { | |
| 72 | + $output[$key] = $item; | |
| 73 | + } | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 77 | + | |
| 78 | + return $output; | |
| 79 | + } | |
| 80 | +} | |
| 81 | + | |
| 82 | +?> | |
| 0 | 83 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_uintersect_assoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Tom Buskens <ortega@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace array_uintersect_assoc() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.array_uintersect_assoc | |
| 28 | + * @author Tom Buskens <ortega@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.6 (is_callable) | |
| 33 | + */ | |
| 34 | +if (!function_exists('array_uintersect_assoc')) { | |
| 35 | + function array_uintersect_assoc() | |
| 36 | + { | |
| 37 | + $args = func_get_args(); | |
| 38 | + if (count($args) < 3) { | |
| 39 | + user_error('wrong parameter count for array_uintersect_assoc()', E_USER_WARNING); | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + | |
| 43 | + // Get compare function | |
| 44 | + $user_func = array_pop($args); | |
| 45 | + if (!is_callable($user_func)) { | |
| 46 | + if (is_array($user_func)) { | |
| 47 | + $user_func = $user_func[0] . '::' . $user_func[1]; | |
| 48 | + } | |
| 49 | + user_error('array_uintersect_assoc() Not a valid callback ' . | |
| 50 | + $user_func, E_USER_WARNING); | |
| 51 | + return; | |
| 52 | + } | |
| 53 | + | |
| 54 | + // Check arrays | |
| 55 | + $array_count = count($args); | |
| 56 | + for ($i = 0; $i < $array_count; $i++) { | |
| 57 | + if (!is_array($args[$i])) { | |
| 58 | + user_error('array_uintersect_assoc() Argument #' . | |
| 59 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 60 | + return; | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + // Compare entries | |
| 65 | + $output = array(); | |
| 66 | + foreach ($args[0] as $key => $item) { | |
| 67 | + for ($i = 1; $i !== $array_count; $i++) { | |
| 68 | + if (array_key_exists($key, $args[$i])) { | |
| 69 | + $compare = call_user_func($user_func, $item, $args[$i][$key]); | |
| 70 | + if ($compare === 0) { | |
| 71 | + $output[$key] = $item; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 77 | + return $output; | |
| 78 | + } | |
| 79 | +} | |
| 80 | + | |
| 81 | +?> | |
| 0 | 82 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_uintersect_uassoc.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace array_uintersect_uassoc() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.array_uintersect_uassoc | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.6 (is_callable) | |
| 31 | + */ | |
| 32 | +if (!function_exists('array_uintersect_uassoc')) { | |
| 33 | + function array_uintersect_uassoc() | |
| 34 | + { | |
| 35 | + $args = func_get_args(); | |
| 36 | + if (count($args) < 4) { | |
| 37 | + user_error('Wrong parameter count for array_uintersect_uassoc()', | |
| 38 | + E_USER_WARNING); | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + // Get key_compare_func | |
| 43 | + $key_compare_func = array_pop($args); | |
| 44 | + if (!is_callable($key_compare_func)) { | |
| 45 | + if (is_array($key_compare_func)) { | |
| 46 | + $key_compare_func = $key_compare_func[0] . '::' . $key_compare_func[1]; | |
| 47 | + } | |
| 48 | + user_error('array_uintersect_uassoc() Not a valid callback ' . | |
| 49 | + $key_compare_func, E_USER_WARNING); | |
| 50 | + return; | |
| 51 | + } | |
| 52 | + | |
| 53 | + // Get data_compare_func | |
| 54 | + $data_compare_func = array_pop($args); | |
| 55 | + if (!is_callable($data_compare_func)) { | |
| 56 | + if (is_array($data_compare_func)) { | |
| 57 | + $data_compare_func = $data_compare_func[0] . '::' . $data_compare_func[1]; | |
| 58 | + } | |
| 59 | + user_error('array_uintersect_uassoc() Not a valid callback ' | |
| 60 | + . $data_compare_func, E_USER_WARNING); | |
| 61 | + return; | |
| 62 | + } | |
| 63 | + | |
| 64 | + // Check arrays | |
| 65 | + $count = count($args); | |
| 66 | + for ($i = 0; $i !== $count; $i++) { | |
| 67 | + if (!is_array($args[$i])) { | |
| 68 | + user_error('array_uintersect_uassoc() Argument #' . | |
| 69 | + ($i + 1) . ' is not an array', E_USER_WARNING); | |
| 70 | + return; | |
| 71 | + } | |
| 72 | + } | |
| 73 | + | |
| 74 | + // Traverse values of the first array | |
| 75 | + $intersect = array (); | |
| 76 | + foreach ($args[0] as $key => $value) { | |
| 77 | + // Check against each array | |
| 78 | + for ($i = 1; $i < $count; $i++) { | |
| 79 | + // Traverse each element in current array | |
| 80 | + foreach ($args[$i] as $ckey => $cvalue) { | |
| 81 | + // Compare key and value | |
| 82 | + if (call_user_func($key_compare_func, $key, $ckey) === 0 && | |
| 83 | + call_user_func($data_compare_func, $value, $cvalue) === 0) | |
| 84 | + { | |
| 85 | + | |
| 86 | + $intersect[$key] = $value; | |
| 87 | + continue; | |
| 88 | + } | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + return $intersect; | |
| 94 | + } | |
| 95 | +} | |
| 96 | + | |
| 97 | +?> | |
| 0 | 98 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/array_walk_recursive.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Tom Buskens <ortega@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace array_walk_recursive() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.array_walk_recursive | |
| 28 | + * @author Tom Buskens <ortega@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.6 (is_callable) | |
| 33 | + */ | |
| 34 | +if (!function_exists('array_walk_recursive')) { | |
| 35 | + function array_walk_recursive(&$input, $funcname) | |
| 36 | + { | |
| 37 | + if (!is_callable($funcname)) { | |
| 38 | + if (is_array($funcname)) { | |
| 39 | + $funcname = $funcname[0] . '::' . $funcname[1]; | |
| 40 | + } | |
| 41 | + user_error('array_walk_recursive() Not a valid callback ' . $user_func, | |
| 42 | + E_USER_WARNING); | |
| 43 | + return; | |
| 44 | + } | |
| 45 | + | |
| 46 | + if (!is_array($input)) { | |
| 47 | + user_error('array_walk_recursive() The argument should be an array', | |
| 48 | + E_USER_WARNING); | |
| 49 | + return; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $args = func_get_args(); | |
| 53 | + | |
| 54 | + foreach ($input as $key => $item) { | |
| 55 | + if (is_array($item)) { | |
| 56 | + array_walk_recursive($item, $funcname, $args); | |
| 57 | + $input[$key] = $item; | |
| 58 | + } else { | |
| 59 | + $args[0] = &$item; | |
| 60 | + $args[1] = &$key; | |
| 61 | + call_user_func_array($funcname, $args); | |
| 62 | + $input[$key] = $item; | |
| 63 | + } | |
| 64 | + } | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 68 | +?> | |
| 0 | 69 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/call_user_func_array.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace call_user_func_array() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.call_user_func_array | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.0.4 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('call_user_func_array')) { | |
| 33 | + function call_user_func_array($function, $param_arr) | |
| 34 | + { | |
| 35 | + $param_arr = array_values((array) $param_arr); | |
| 36 | + | |
| 37 | + // Sanity check | |
| 38 | + if (!is_callable($function)) { | |
| 39 | + if (is_array($function) && count($function) > 2) { | |
| 40 | + $function = $function[0] . '::' . $function[1]; | |
| 41 | + } | |
| 42 | + $error = sprintf('call_user_func_array() First argument is expected ' . | |
| 43 | + 'to be a valid callback, \'%s\' was given', $function); | |
| 44 | + user_error($error, E_USER_WARNING); | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + | |
| 48 | + // Build argument string | |
| 49 | + $arg_string = ''; | |
| 50 | + $comma = ''; | |
| 51 | + for ($i = 0, $x = count($param_arr); $i < $x; $i++) { | |
| 52 | + $arg_string .= $comma . "\$param_arr[$i]"; | |
| 53 | + $comma = ', '; | |
| 54 | + } | |
| 55 | + | |
| 56 | + // Determine method of calling function | |
| 57 | + if (is_array($function)) { | |
| 58 | + $object =& $function[0]; | |
| 59 | + $method = $function[1]; | |
| 60 | + | |
| 61 | + // Static vs method call | |
| 62 | + if (is_string($function[0])) { | |
| 63 | + eval("\$retval = $object::\$method($arg_string);"); | |
| 64 | + } else { | |
| 65 | + eval("\$retval = \$object->\$method($arg_string);"); | |
| 66 | + } | |
| 67 | + } else { | |
| 68 | + eval("\$retval = \$function($arg_string);"); | |
| 69 | + } | |
| 70 | + | |
| 71 | + return $retval; | |
| 72 | + } | |
| 73 | +} | |
| 74 | + | |
| 75 | +?> | |
| 0 | 76 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/clone.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace clone() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/language.oop5.cloning | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (version_compare(phpversion(), '5.0') === -1) { | |
| 33 | + // Needs to be wrapped in eval as clone is a keyword in PHP5 | |
| 34 | + eval(' | |
| 35 | + function clone($object) | |
| 36 | + { | |
| 37 | + // Sanity check | |
| 38 | + if (!is_object($object)) { | |
| 39 | + user_error(\'clone() __clone method called on non-object\', E_USER_WARNING); | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + | |
| 43 | + // Use serialize/unserialize trick to deep copy the object | |
| 44 | + $object = unserialize(serialize($object)); | |
| 45 | + | |
| 46 | + // If there is a __clone method call it on the "new" class | |
| 47 | + if (method_exists($object, \'__clone\')) { | |
| 48 | + $object->__clone(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + return $object; | |
| 52 | + } | |
| 53 | + '); | |
| 54 | +} | |
| 55 | + | |
| 56 | +?> | |
| 0 | 57 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/constant.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace constant() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.constant | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.0.4 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('constant')) { | |
| 33 | + function constant($constant) | |
| 34 | + { | |
| 35 | + if (!defined($constant)) { | |
| 36 | + $error = sprintf('constant() Couldn\'t find constant %s', $constant); | |
| 37 | + user_error($error, E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + eval("\$value=$constant;"); | |
| 42 | + | |
| 43 | + return $value; | |
| 44 | + } | |
| 45 | +} | |
| 46 | + | |
| 47 | +?> | |
| 0 | 48 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/convert_uudecode.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Michael Wallner <mike@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace convert_uudecode() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.convert_uudecode | |
| 28 | + * @author Michael Wallner <mike@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.0 (user_error) | |
| 33 | + */ | |
| 34 | +if (!function_exists('convert_uudecode')) { | |
| 35 | + function convert_uudecode($string) | |
| 36 | + { | |
| 37 | + // Sanity check | |
| 38 | + if (!is_scalar($string)) { | |
| 39 | + user_error('convert_uuencode() expects parameter 1 to be string, ' . | |
| 40 | + gettype($string) . ' given', E_USER_WARNING); | |
| 41 | + return false; | |
| 42 | + } | |
| 43 | + | |
| 44 | + if (strlen($string) < 8) { | |
| 45 | + user_error('convert_uuencode() The given parameter is not a valid uuencoded string', E_USER_WARNING); | |
| 46 | + return false; | |
| 47 | + } | |
| 48 | + | |
| 49 | + $decoded = ''; | |
| 50 | + foreach (explode("\n", $string) as $line) { | |
| 51 | + | |
| 52 | + $c = count($bytes = unpack('c*', substr(trim($line), 1))); | |
| 53 | + | |
| 54 | + while ($c % 4) { | |
| 55 | + $bytes[++$c] = 0; | |
| 56 | + } | |
| 57 | + | |
| 58 | + foreach (array_chunk($bytes, 4) as $b) { | |
| 59 | + $b0 = $b[0] == 0x60 ? 0 : $b[0] - 0x20; | |
| 60 | + $b1 = $b[1] == 0x60 ? 0 : $b[1] - 0x20; | |
| 61 | + $b2 = $b[2] == 0x60 ? 0 : $b[2] - 0x20; | |
| 62 | + $b3 = $b[3] == 0x60 ? 0 : $b[3] - 0x20; | |
| 63 | + | |
| 64 | + $b0 <<= 2; | |
| 65 | + $b0 |= ($b1 >> 4) & 0x03; | |
| 66 | + $b1 <<= 4; | |
| 67 | + $b1 |= ($b2 >> 2) & 0x0F; | |
| 68 | + $b2 <<= 6; | |
| 69 | + $b2 |= $b3 & 0x3F; | |
| 70 | + | |
| 71 | + $decoded .= pack('c*', $b0, $b1, $b2); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + return rtrim($decoded, "\0"); | |
| 76 | + } | |
| 77 | +} | |
| 78 | + | |
| 79 | +?> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/convert_uuencode.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Michael Wallner <mike@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace convert_uuencode() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.convert_uuencode | |
| 28 | + * @author Michael Wallner <mike@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.0 (user_error) | |
| 33 | + */ | |
| 34 | +if (!function_exists('convert_uuencode')) { | |
| 35 | + function convert_uuencode($string) | |
| 36 | + { | |
| 37 | + // Sanity check | |
| 38 | + if (!is_scalar($string)) { | |
| 39 | + user_error('convert_uuencode() expects parameter 1 to be string, ' . | |
| 40 | + gettype($string) . ' given', E_USER_WARNING); | |
| 41 | + return false; | |
| 42 | + } | |
| 43 | + | |
| 44 | + $u = 0; | |
| 45 | + $encoded = ''; | |
| 46 | + | |
| 47 | + while ($c = count($bytes = unpack('c*', substr($string, $u, 45)))) { | |
| 48 | + $u += 45; | |
| 49 | + $encoded .= pack('c', $c + 0x20); | |
| 50 | + | |
| 51 | + while ($c % 3) { | |
| 52 | + $bytes[++$c] = 0; | |
| 53 | + } | |
| 54 | + | |
| 55 | + foreach (array_chunk($bytes, 3) as $b) { | |
| 56 | + $b0 = ($b[0] & 0xFC) >> 2; | |
| 57 | + $b1 = (($b[0] & 0x03) << 4) + (($b[1] & 0xF0) >> 4); | |
| 58 | + $b2 = (($b[1] & 0x0F) << 2) + (($b[2] & 0xC0) >> 6); | |
| 59 | + $b3 = $b[2] & 0x3F; | |
| 60 | + | |
| 61 | + $b0 = $b0 ? $b0 + 0x20 : 0x60; | |
| 62 | + $b1 = $b1 ? $b1 + 0x20 : 0x60; | |
| 63 | + $b2 = $b2 ? $b2 + 0x20 : 0x60; | |
| 64 | + $b3 = $b3 ? $b3 + 0x20 : 0x60; | |
| 65 | + | |
| 66 | + $encoded .= pack('c*', $b0, $b1, $b2, $b3); | |
| 67 | + } | |
| 68 | + | |
| 69 | + $encoded .= "\n"; | |
| 70 | + } | |
| 71 | + | |
| 72 | + // Add termination characters | |
| 73 | + $encoded .= "\x60\n"; | |
| 74 | + | |
| 75 | + return $encoded; | |
| 76 | + } | |
| 77 | +} | |
| 78 | + | |
| 79 | +?> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/debug_print_backtrace.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Laurent Laville <pear@laurent-laville.org> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace debug_print_backtrace() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.debug_print_backtrace | |
| 28 | + * @author Laurent Laville <pear@laurent-laville.org> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.0 | |
| 33 | + */ | |
| 34 | +if (!function_exists('debug_print_backtrace')) { | |
| 35 | + function debug_print_backtrace() | |
| 36 | + { | |
| 37 | + // Get backtrace | |
| 38 | + $backtrace = debug_backtrace(); | |
| 39 | + | |
| 40 | + // Unset call to debug_print_backtrace | |
| 41 | + array_shift($backtrace); | |
| 42 | + | |
| 43 | + // Iterate backtrace | |
| 44 | + $calls = array(); | |
| 45 | + foreach ($backtrace as $i => $call) { | |
| 46 | + $location = $call['file'] . ':' . $call['line']; | |
| 47 | + $function = (isset($call['class'])) ? | |
| 48 | + $call['class'] . '.' . $call['function'] : | |
| 49 | + $call['function']; | |
| 50 | + | |
| 51 | + $params = ''; | |
| 52 | + if (isset($call['args'])) { | |
| 53 | + $params = implode(', ', $call['args']); | |
| 54 | + } | |
| 55 | + | |
| 56 | + $calls[] = sprintf('#%d %s(%s) called at [%s]', | |
| 57 | + $i, | |
| 58 | + $function, | |
| 59 | + $params, | |
| 60 | + $location); | |
| 61 | + } | |
| 62 | + | |
| 63 | + echo implode("\n", $calls); | |
| 64 | + } | |
| 65 | +} | |
| 66 | + | |
| 67 | +?> | |
| 0 | 68 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/file_get_contents.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace file_get_contents() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.file_get_contents | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @internal resource_context is not supported | |
| 30 | + * @since PHP 5 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('file_get_contents')) { | |
| 34 | + function file_get_contents($filename, $incpath = false, $resource_context = null) | |
| 35 | + { | |
| 36 | + if (false === $fh = fopen($filename, 'rb', $incpath)) { | |
| 37 | + user_error('file_get_contents() failed to open stream: No such file or directory', | |
| 38 | + E_USER_WARNING); | |
| 39 | + return false; | |
| 40 | + } | |
| 41 | + | |
| 42 | + clearstatcache(); | |
| 43 | + if ($fsize = @filesize($filename)) { | |
| 44 | + $data = fread($fh, $fsize); | |
| 45 | + } else { | |
| 46 | + $data = ''; | |
| 47 | + while (!feof($fh)) { | |
| 48 | + $data .= fread($fh, 8192); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + fclose($fh); | |
| 53 | + return $data; | |
| 54 | + } | |
| 55 | +} | |
| 56 | + | |
| 57 | +?> | |
| 0 | 58 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/file_put_contents.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +if (!defined('FILE_USE_INCLUDE_PATH')) { | |
| 22 | + define('FILE_USE_INCLUDE_PATH', 1); | |
| 23 | +} | |
| 24 | + | |
| 25 | +if (!defined('FILE_APPEND')) { | |
| 26 | + define('FILE_APPEND', 8); | |
| 27 | +} | |
| 28 | + | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Replace file_put_contents() | |
| 32 | + * | |
| 33 | + * @category PHP | |
| 34 | + * @package PHP_Compat | |
| 35 | + * @link http://php.net/function.file_put_contents | |
| 36 | + * @author Aidan Lister <aidan@php.net> | |
| 37 | + * @version $Revision$ | |
| 38 | + * @internal resource_context is not supported | |
| 39 | + * @since PHP 5 | |
| 40 | + * @require PHP 4.0.0 (user_error) | |
| 41 | + */ | |
| 42 | +if (!function_exists('file_put_contents')) { | |
| 43 | + function file_put_contents($filename, $content, $flags = null, $resource_context = null) | |
| 44 | + { | |
| 45 | + // If $content is an array, convert it to a string | |
| 46 | + if (is_array($content)) { | |
| 47 | + $content = implode('', $content); | |
| 48 | + } | |
| 49 | + | |
| 50 | + // If we don't have a string, throw an error | |
| 51 | + if (!is_scalar($content)) { | |
| 52 | + user_error('file_put_contents() The 2nd parameter should be either a string or an array', | |
| 53 | + E_USER_WARNING); | |
| 54 | + return false; | |
| 55 | + } | |
| 56 | + | |
| 57 | + // Get the length of data to write | |
| 58 | + $length = strlen($content); | |
| 59 | + | |
| 60 | + // Check what mode we are using | |
| 61 | + $mode = ($flags & FILE_APPEND) ? | |
| 62 | + 'a' : | |
| 63 | + 'w'; | |
| 64 | + | |
| 65 | + // Check if we're using the include path | |
| 66 | + $use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ? | |
| 67 | + true : | |
| 68 | + false; | |
| 69 | + | |
| 70 | + // Open the file for writing | |
| 71 | + if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) { | |
| 72 | + user_error('file_put_contents() failed to open stream: Permission denied', | |
| 73 | + E_USER_WARNING); | |
| 74 | + return false; | |
| 75 | + } | |
| 76 | + | |
| 77 | + // Write to the file | |
| 78 | + $bytes = 0; | |
| 79 | + if (($bytes = @fwrite($fh, $content)) === false) { | |
| 80 | + $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s', | |
| 81 | + $length, | |
| 82 | + $filename); | |
| 83 | + user_error($errormsg, E_USER_WARNING); | |
| 84 | + return false; | |
| 85 | + } | |
| 86 | + | |
| 87 | + // Close the handle | |
| 88 | + @fclose($fh); | |
| 89 | + | |
| 90 | + // Check all the data was written | |
| 91 | + if ($bytes != $length) { | |
| 92 | + $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.', | |
| 93 | + $bytes, | |
| 94 | + $length); | |
| 95 | + user_error($errormsg, E_USER_WARNING); | |
| 96 | + return false; | |
| 97 | + } | |
| 98 | + | |
| 99 | + // Return length | |
| 100 | + return $bytes; | |
| 101 | + } | |
| 102 | +} | |
| 103 | + | |
| 104 | +?> | |
| 0 | 105 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/floatval.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace floatval() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.floatval | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.2.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) (Type Casting) | |
| 31 | + */ | |
| 32 | +if (!function_exists('floatval')) { | |
| 33 | + function floatval($var) | |
| 34 | + { | |
| 35 | + return (float) $var; | |
| 36 | + } | |
| 37 | +} | |
| 38 | + | |
| 39 | +?> | |
| 0 | 40 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/fprintf.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace fprintf() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.fprintf | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('fprintf')) { | |
| 33 | + function fprintf() { | |
| 34 | + $args = func_get_args(); | |
| 35 | + | |
| 36 | + if (count($args) < 2) { | |
| 37 | + user_error('Wrong parameter count for fprintf()', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + $resource_handle = array_shift($args); | |
| 42 | + $format = array_shift($args); | |
| 43 | + | |
| 44 | + if (!is_resource($resource_handle)) { | |
| 45 | + user_error('fprintf() supplied argument is not a valid stream resource', | |
| 46 | + E_USER_WARNING); | |
| 47 | + return false; | |
| 48 | + } | |
| 49 | + | |
| 50 | + return fwrite($resource_handle, vsprintf($format, $args)); | |
| 51 | + } | |
| 52 | +} | |
| 53 | + | |
| 54 | +?> | |
| 0 | 55 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/fputcsv.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace fprintf() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.fprintf | |
| 27 | + * @author Twebb <twebb@boisecenter.com> | |
| 28 | + * @author Aidan Lister <aidan@php.net> | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 5 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('fputcsv')) { | |
| 34 | + function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"') | |
| 35 | + { | |
| 36 | + // Sanity Check | |
| 37 | + if (!is_resource($extension)) { | |
| 38 | + user_error('fputcsv() expects parameter 1 to be resource, ' . | |
| 39 | + gettype($extension) . ' given', E_USER_WARNING); | |
| 40 | + return false; | |
| 41 | + } | |
| 42 | + | |
| 43 | + | |
| 44 | + $str = ''; | |
| 45 | + foreach ($fields as $cell) { | |
| 46 | + $cell = str_replace($enclosure, $enclosure.$enclosure, $cell); | |
| 47 | + | |
| 48 | + if (strchr($cell, $delimiter) !== false || | |
| 49 | + strchr($cell, $enclosure) !== false || | |
| 50 | + strchr($cell, "\n") !== false) { | |
| 51 | + | |
| 52 | + $str .= $enclosure . $cell . $enclosure . $delimiter; | |
| 53 | + } else { | |
| 54 | + $str .= $cell . $delimiter; | |
| 55 | + } | |
| 56 | + } | |
| 57 | + | |
| 58 | + fputs($handle, substr($str, 0, -1) . "\n"); | |
| 59 | + | |
| 60 | + return strlen($str); | |
| 61 | + } | |
| 62 | +} | |
| 63 | + | |
| 64 | +?> | |
| 0 | 65 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/get_headers.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace get_headers() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.get_headers | |
| 27 | + * @author Aeontech <aeontech@gmail.com> | |
| 28 | + * @author Cpurruc <cpurruc@fh-landshut.de> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5.0.0 | |
| 32 | + * @require PHP 4.0.0 (user_error) | |
| 33 | + */ | |
| 34 | +if (!function_exists('get_headers')) { | |
| 35 | + function get_headers($url, $format = 0) | |
| 36 | + { | |
| 37 | + // Init | |
| 38 | + $urlinfo = parse_url($url); | |
| 39 | + $port = isset($urlinfo['port']) ? $urlinfo['port'] : 80; | |
| 40 | + | |
| 41 | + // Connect | |
| 42 | + $fp = fsockopen($urlinfo['host'], $port, $errno, $errstr, 30); | |
| 43 | + if ($fp === false) { | |
| 44 | + return false; | |
| 45 | + } | |
| 46 | + | |
| 47 | + // Send request | |
| 48 | + $head = 'HEAD ' . $urlinfo['path'] . | |
| 49 | + (isset($urlinfo['query']) ? '?' . $urlinfo['query'] : '') . | |
| 50 | + ' HTTP/1.0' . "\r\n" . | |
| 51 | + 'Host: ' . $urlinfo['host'] . "\r\n\r\n"; | |
| 52 | + fputs($fp, $head); | |
| 53 | + | |
| 54 | + // Read | |
| 55 | + while (!feof($fp)) { | |
| 56 | + if ($header = trim(fgets($fp, 1024))) { | |
| 57 | + list($key) = explode(':', $header); | |
| 58 | + | |
| 59 | + if ($format === 1) { | |
| 60 | + // First element is the HTTP header type, such as HTTP 200 OK | |
| 61 | + // It doesn't have a separate name, so check for it | |
| 62 | + if ($key == $header) { | |
| 63 | + $headers[] = $header; | |
| 64 | + } else { | |
| 65 | + $headers[$key] = substr($header, strlen($key)+2); | |
| 66 | + } | |
| 67 | + } else { | |
| 68 | + $headers[] = $header; | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } | |
| 72 | + | |
| 73 | + return $headers; | |
| 74 | + } | |
| 75 | +} | |
| 76 | + | |
| 77 | +?> | |
| 0 | 78 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/get_include_path.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace get_include_path() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.get_include_path | |
| 27 | + * @author Stephan Schmidt <schst@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + * @require PHP 4.0.0 | |
| 31 | + */ | |
| 32 | +if (!function_exists('get_include_path')) { | |
| 33 | + function get_include_path() | |
| 34 | + { | |
| 35 | + return ini_get('include_path'); | |
| 36 | + } | |
| 37 | +} | |
| 38 | + | |
| 39 | +?> | |
| 0 | 40 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/html_entity_decode.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: David Irvine <dave@codexweb.co.za> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +if (!defined('ENT_NOQUOTES')) { | |
| 23 | + define('ENT_NOQUOTES', 0); | |
| 24 | +} | |
| 25 | + | |
| 26 | +if (!defined('ENT_COMPAT')) { | |
| 27 | + define('ENT_COMPAT', 2); | |
| 28 | +} | |
| 29 | + | |
| 30 | +if (!defined('ENT_QUOTES')) { | |
| 31 | + define('ENT_QUOTES', 3); | |
| 32 | +} | |
| 33 | + | |
| 34 | + | |
| 35 | +/** | |
| 36 | + * Replace html_entity_decode() | |
| 37 | + * | |
| 38 | + * @category PHP | |
| 39 | + * @package PHP_Compat | |
| 40 | + * @link http://php.net/function.html_entity_decode | |
| 41 | + * @author David Irvine <dave@codexweb.co.za> | |
| 42 | + * @author Aidan Lister <aidan@php.net> | |
| 43 | + * @version $Revision$ | |
| 44 | + * @since PHP 4.3.0 | |
| 45 | + * @internal Setting the charset will not do anything | |
| 46 | + * @require PHP 4.0.0 (user_error) | |
| 47 | + */ | |
| 48 | +if (!function_exists('html_entity_decode')) { | |
| 49 | + function html_entity_decode($string, $quote_style = ENT_COMPAT, $charset = null) | |
| 50 | + { | |
| 51 | + if (!is_int($quote_style)) { | |
| 52 | + user_error('html_entity_decode() expects parameter 2 to be long, ' . | |
| 53 | + gettype($quote_style) . ' given', E_USER_WARNING); | |
| 54 | + return; | |
| 55 | + } | |
| 56 | + | |
| 57 | + $trans_tbl = get_html_translation_table(HTML_ENTITIES); | |
| 58 | + $trans_tbl = array_flip($trans_tbl); | |
| 59 | + | |
| 60 | + // Add single quote to translation table; | |
| 61 | + $trans_tbl['''] = '\''; | |
| 62 | + | |
| 63 | + // Not translating double quotes | |
| 64 | + if ($quote_style & ENT_NOQUOTES) { | |
| 65 | + // Remove double quote from translation table | |
| 66 | + unset($trans_tbl['"']); | |
| 67 | + } | |
| 68 | + | |
| 69 | + return strtr($string, $trans_tbl); | |
| 70 | + } | |
| 71 | +} | |
| 72 | +?> | |
| 0 | 73 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/htmlspecialchars_decode.php
0 โ 100644
| 1 | +<?PHP | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace function htmlspecialchars_decode() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.htmlspecialchars_decode | |
| 28 | + * @author Aidan Lister <aidan@php.net> | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 5.1.0 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('htmlspecialchars_decode')) { | |
| 34 | + function htmlspecialchars_decode($string, $quote_style = null) | |
| 35 | + { | |
| 36 | + // Sanity check | |
| 37 | + if (!is_scalar($string)) { | |
| 38 | + user_error('htmlspecialchars_decode() expects parameter 1 to be string, ' . | |
| 39 | + gettype($string) . ' given', E_USER_WARNING); | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + | |
| 43 | + if (!is_int($quote_style) && $quote_style !== null) { | |
| 44 | + user_error('htmlspecialchars_decode() expects parameter 2 to be integer, ' . | |
| 45 | + gettype($quote_style) . ' given', E_USER_WARNING); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + | |
| 49 | + // Init | |
| 50 | + $from = array('&', '<', '>'); | |
| 51 | + $to = array('&', '<', '>'); | |
| 52 | + | |
| 53 | + // The function does not behave as documented | |
| 54 | + // This matches the actual behaviour of the function | |
| 55 | + if ($quote_style & ENT_COMPAT || $quote_style & ENT_QUOTES) { | |
| 56 | + $from[] = '"'; | |
| 57 | + $to[] = '"'; | |
| 58 | + | |
| 59 | + $from[] = '''; | |
| 60 | + $to[] = "'"; | |
| 61 | + } | |
| 62 | + | |
| 63 | + return str_replace($from, $to, $string); | |
| 64 | + } | |
| 65 | +} | |
| 66 | + | |
| 67 | +?> | |
| 0 | 68 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/http_build_query.php
0 โ 100644
| 1 | +<?PHP | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace function http_build_query() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.http-build-query | |
| 28 | + * @author Stephan Schmidt <schst@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.0 (user_error) | |
| 33 | + */ | |
| 34 | +if (!function_exists('http_build_query')) { | |
| 35 | + function http_build_query($formdata, $numeric_prefix = null) | |
| 36 | + { | |
| 37 | + // If $formdata is an object, convert it to an array | |
| 38 | + if (is_object($formdata)) { | |
| 39 | + $formdata = get_object_vars($formdata); | |
| 40 | + } | |
| 41 | + | |
| 42 | + // Check we have an array to work with | |
| 43 | + if (!is_array($formdata)) { | |
| 44 | + user_error('http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given.', | |
| 45 | + E_USER_WARNING); | |
| 46 | + return false; | |
| 47 | + } | |
| 48 | + | |
| 49 | + // If the array is empty, return null | |
| 50 | + if (empty($formdata)) { | |
| 51 | + return; | |
| 52 | + } | |
| 53 | + | |
| 54 | + // Argument seperator | |
| 55 | + $separator = ini_get('arg_separator.output'); | |
| 56 | + | |
| 57 | + // Start building the query | |
| 58 | + $tmp = array (); | |
| 59 | + foreach ($formdata as $key => $val) { | |
| 60 | + if (is_integer($key) && $numeric_prefix != null) { | |
| 61 | + $key = $numeric_prefix . $key; | |
| 62 | + } | |
| 63 | + | |
| 64 | + if (is_scalar($val)) { | |
| 65 | + array_push($tmp, urlencode($key).'='.urlencode($val)); | |
| 66 | + continue; | |
| 67 | + } | |
| 68 | + | |
| 69 | + // If the value is an array, recursively parse it | |
| 70 | + if (is_array($val)) { | |
| 71 | + array_push($tmp, __http_build_query($val, urlencode($key))); | |
| 72 | + continue; | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + return implode($separator, $tmp); | |
| 77 | + } | |
| 78 | + | |
| 79 | + // Helper function | |
| 80 | + function __http_build_query ($array, $name) | |
| 81 | + { | |
| 82 | + $tmp = array (); | |
| 83 | + foreach ($array as $key => $value) { | |
| 84 | + if (is_array($value)) { | |
| 85 | + array_push($tmp, __http_build_query($value, sprintf('%s[%s]', $name, $key))); | |
| 86 | + } elseif (is_scalar($value)) { | |
| 87 | + array_push($tmp, sprintf('%s[%s]=%s', $name, urlencode($key), urlencode($value))); | |
| 88 | + } elseif (is_object($value)) { | |
| 89 | + array_push($tmp, __http_build_query(get_object_vars($value), sprintf('%s[%s]', $name, $key))); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + // Argument seperator | |
| 94 | + $separator = ini_get('arg_separator.output'); | |
| 95 | + | |
| 96 | + return implode($separator, $tmp); | |
| 97 | + } | |
| 98 | +} | |
| 99 | + | |
| 100 | +?> | |
| 0 | 101 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/ibase_timefmt.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace function ibase_timefmt() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.ibase_timefmt | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5.0.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('ibase_timefmt')) { | |
| 33 | + function ibase_timefmt($format, $columntype = IBASE_TIMESTAMP) | |
| 34 | + { | |
| 35 | + switch ($columntype) { | |
| 36 | + case IBASE_TIMESTAMP: | |
| 37 | + ini_set('ibase.dateformat', $format); | |
| 38 | + break; | |
| 39 | + | |
| 40 | + case IBASE_DATE: | |
| 41 | + ini_set('ibase.dateformat', $format); | |
| 42 | + break; | |
| 43 | + | |
| 44 | + case IBASE_TIME: | |
| 45 | + ini_set('ibase.timeformat', $format); | |
| 46 | + break; | |
| 47 | + | |
| 48 | + default: | |
| 49 | + return false; | |
| 50 | + } | |
| 51 | + | |
| 52 | + return true; | |
| 53 | + } | |
| 54 | +} | |
| 55 | + | |
| 56 | +?> | |
| 0 | 57 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/image_type_to_mime_type.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +if (!defined('IMAGETYPE_GIF')) { | |
| 22 | + define('IMAGETYPE_GIF', 1); | |
| 23 | +} | |
| 24 | + | |
| 25 | +if (!defined('IMAGETYPE_JPEG')) { | |
| 26 | + define('IMAGETYPE_JPEG', 2); | |
| 27 | +} | |
| 28 | + | |
| 29 | +if (!defined('IMAGETYPE_PNG')) { | |
| 30 | + define('IMAGETYPE_PNG', 3); | |
| 31 | +} | |
| 32 | + | |
| 33 | +if (!defined('IMAGETYPE_SWF')) { | |
| 34 | + define('IMAGETYPE_SWF', 4); | |
| 35 | +} | |
| 36 | + | |
| 37 | +if (!defined('IMAGETYPE_PSD')) { | |
| 38 | + define('IMAGETYPE_PSD', 5); | |
| 39 | +} | |
| 40 | + | |
| 41 | +if (!defined('IMAGETYPE_BMP')) { | |
| 42 | + define('IMAGETYPE_BMP', 6); | |
| 43 | +} | |
| 44 | + | |
| 45 | +if (!defined('IMAGETYPE_TIFF_II')) { | |
| 46 | + define('IMAGETYPE_TIFF_II', 7); | |
| 47 | +} | |
| 48 | + | |
| 49 | +if (!defined('IMAGETYPE_TIFF_MM')) { | |
| 50 | + define('IMAGETYPE_TIFF_MM', 8); | |
| 51 | +} | |
| 52 | + | |
| 53 | +if (!defined('IMAGETYPE_JPC')) { | |
| 54 | + define('IMAGETYPE_JPC', 9); | |
| 55 | +} | |
| 56 | + | |
| 57 | +if (!defined('IMAGETYPE_JP2')) { | |
| 58 | + define('IMAGETYPE_JP2', 10); | |
| 59 | +} | |
| 60 | + | |
| 61 | +if (!defined('IMAGETYPE_JPX')) { | |
| 62 | + define('IMAGETYPE_JPX', 11); | |
| 63 | +} | |
| 64 | + | |
| 65 | +if (!defined('IMAGETYPE_JB2')) { | |
| 66 | + define('IMAGETYPE_JB2', 12); | |
| 67 | +} | |
| 68 | + | |
| 69 | +if (!defined('IMAGETYPE_SWC')) { | |
| 70 | + define('IMAGETYPE_SWC', 13); | |
| 71 | +} | |
| 72 | + | |
| 73 | +if (!defined('IMAGETYPE_IFF')) { | |
| 74 | + define('IMAGETYPE_IFF', 14); | |
| 75 | +} | |
| 76 | + | |
| 77 | +if (!defined('IMAGETYPE_WBMP')) { | |
| 78 | + define('IMAGETYPE_WBMP', 15); | |
| 79 | +} | |
| 80 | + | |
| 81 | +if (!defined('IMAGETYPE_XBM')) { | |
| 82 | + define('IMAGETYPE_XBM', 16); | |
| 83 | +} | |
| 84 | + | |
| 85 | + | |
| 86 | +/** | |
| 87 | + * Replace image_type_to_mime_type() | |
| 88 | + * | |
| 89 | + * @category PHP | |
| 90 | + * @package PHP_Compat | |
| 91 | + * @link http://php.net/function.image_type_to_mime_type | |
| 92 | + * @author Aidan Lister <aidan@php.net> | |
| 93 | + * @version $Revision$ | |
| 94 | + * @since PHP 4.3.0 | |
| 95 | + * @require PHP 4.0.0 (user_error) | |
| 96 | + */ | |
| 97 | +if (!function_exists('image_type_to_mime_type')) { | |
| 98 | + function image_type_to_mime_type($imagetype) | |
| 99 | + { | |
| 100 | + switch ($imagetype): | |
| 101 | + case IMAGETYPE_GIF: | |
| 102 | + return 'image/gif'; | |
| 103 | + break; | |
| 104 | + case IMAGETYPE_JPEG: | |
| 105 | + return 'image/jpeg'; | |
| 106 | + break; | |
| 107 | + case IMAGETYPE_PNG: | |
| 108 | + return 'image/png'; | |
| 109 | + break; | |
| 110 | + case IMAGETYPE_SWF: | |
| 111 | + case IMAGETYPE_SWC: | |
| 112 | + return 'application/x-shockwave-flash'; | |
| 113 | + break; | |
| 114 | + case IMAGETYPE_PSD: | |
| 115 | + return 'image/psd'; | |
| 116 | + break; | |
| 117 | + case IMAGETYPE_BMP: | |
| 118 | + return 'image/bmp'; | |
| 119 | + break; | |
| 120 | + case IMAGETYPE_TIFF_MM: | |
| 121 | + case IMAGETYPE_TIFF_II: | |
| 122 | + return 'image/tiff'; | |
| 123 | + break; | |
| 124 | + case IMAGETYPE_JP2: | |
| 125 | + return 'image/jp2'; | |
| 126 | + break; | |
| 127 | + case IMAGETYPE_IFF: | |
| 128 | + return 'image/iff'; | |
| 129 | + break; | |
| 130 | + case IMAGETYPE_WBMP: | |
| 131 | + return 'image/vnd.wap.wbmp'; | |
| 132 | + break; | |
| 133 | + case IMAGETYPE_XBM: | |
| 134 | + return 'image/xbm'; | |
| 135 | + break; | |
| 136 | + case IMAGETYPE_JPX: | |
| 137 | + case IMAGETYPE_JB2: | |
| 138 | + case IMAGETYPE_JPC: | |
| 139 | + default: | |
| 140 | + return 'application/octet-stream'; | |
| 141 | + break; | |
| 142 | + | |
| 143 | + endswitch; | |
| 144 | + } | |
| 145 | +} | |
| 146 | + | |
| 147 | +?> | |
| 0 | 148 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/ini_get_all.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace ini_get_all() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.ini_get_all | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.2.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('ini_get_all')) { | |
| 33 | + function ini_get_all($extension = null) | |
| 34 | + { | |
| 35 | + // Sanity check | |
| 36 | + if (!is_scalar($extension)) { | |
| 37 | + user_error('ini_get_all() expects parameter 1 to be string, ' . | |
| 38 | + gettype($extension) . ' given', E_USER_WARNING); | |
| 39 | + return false; | |
| 40 | + } | |
| 41 | + | |
| 42 | + // Get the location of php.ini | |
| 43 | + ob_start(); | |
| 44 | + phpinfo(INFO_GENERAL); | |
| 45 | + $info = ob_get_contents(); | |
| 46 | + ob_clean(); | |
| 47 | + $info = explode("\n", $info); | |
| 48 | + $line = array_values(preg_grep('#php.ini#', $info)); | |
| 49 | + list (, $value) = explode('<td class="v">', $line[0]); | |
| 50 | + $inifile = trim(strip_tags($value)); | |
| 51 | + | |
| 52 | + // Parse | |
| 53 | + if ($extension !== null) { | |
| 54 | + $ini_all = parse_ini_file($inifile, true); | |
| 55 | + | |
| 56 | + // Lowercase extension keys | |
| 57 | + foreach ($ini_all as $key => $value) { | |
| 58 | + $ini_arr[strtolower($key)] = $value; | |
| 59 | + } | |
| 60 | + | |
| 61 | + $ini = $ini_arr[$extension]; | |
| 62 | + } else { | |
| 63 | + $ini = parse_ini_file($inifile); | |
| 64 | + } | |
| 65 | + | |
| 66 | + // Order | |
| 67 | + $ini_lc = array_map('strtolower', array_keys($ini)); | |
| 68 | + array_multisort($ini_lc, SORT_ASC, SORT_STRING, $ini); | |
| 69 | + | |
| 70 | + // Format | |
| 71 | + $info = array(); | |
| 72 | + foreach ($ini as $key => $value) { | |
| 73 | + $info[$key] = array( | |
| 74 | + 'global_value' => $value, | |
| 75 | + 'local_value' => ini_get($key), | |
| 76 | + // No way to know this | |
| 77 | + 'access' => -1 | |
| 78 | + ); | |
| 79 | + } | |
| 80 | + | |
| 81 | + return $info; | |
| 82 | + } | |
| 83 | +} | |
| 84 | + | |
| 85 | +?> | |
| 0 | 86 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/is_a.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace function is_a() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.is_a | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.2.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) (is_subclass_of) | |
| 31 | + */ | |
| 32 | +if (!function_exists('is_a')) { | |
| 33 | + function is_a($object, $class) | |
| 34 | + { | |
| 35 | + if (!is_object($object)) { | |
| 36 | + return false; | |
| 37 | + } | |
| 38 | + | |
| 39 | + if (get_class($object) == strtolower($class)) { | |
| 40 | + return true; | |
| 41 | + } else { | |
| 42 | + return is_subclass_of($object, $class); | |
| 43 | + } | |
| 44 | + } | |
| 45 | +} | |
| 46 | + | |
| 47 | +?> | |
| 0 | 48 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/md5_file.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace md5_file() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/md5_file | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.2.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('md5_file')) { | |
| 33 | + function md5_file($filename, $raw_output = false) | |
| 34 | + { | |
| 35 | + // Sanity check | |
| 36 | + if (!is_scalar($filename)) { | |
| 37 | + user_error('md5_file() expects parameter 1 to be string, ' . | |
| 38 | + gettype($filename) . ' given', E_USER_WARNING); | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + if (!is_scalar($raw_output)) { | |
| 43 | + user_error('md5_file() expects parameter 2 to be bool, ' . | |
| 44 | + gettype($raw_output) . ' given', E_USER_WARNING); | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + | |
| 48 | + if (!file_exists($filename)) { | |
| 49 | + user_error('md5_file() Unable to open file', E_USER_WARNING); | |
| 50 | + return false; | |
| 51 | + } | |
| 52 | + | |
| 53 | + // Read the file | |
| 54 | + if (false === $fh = fopen($filename, 'rb')) { | |
| 55 | + user_error('md5_file() failed to open stream: No such file or directory', | |
| 56 | + E_USER_WARNING); | |
| 57 | + return false; | |
| 58 | + } | |
| 59 | + | |
| 60 | + clearstatcache(); | |
| 61 | + if ($fsize = @filesize($filename)) { | |
| 62 | + $data = fread($fh, $fsize); | |
| 63 | + } else { | |
| 64 | + $data = ''; | |
| 65 | + while (!feof($fh)) { | |
| 66 | + $data .= fread($fh, 8192); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + fclose($fh); | |
| 71 | + | |
| 72 | + // Return | |
| 73 | + if ($raw_output === true) { | |
| 74 | + $data = pack('H*', $data); | |
| 75 | + } | |
| 76 | + | |
| 77 | + return $data; | |
| 78 | + } | |
| 79 | +} | |
| 80 | + | |
| 81 | +?> | |
| 0 | 82 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/mhash.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +if (!defined('MHASH_CRC32')) { | |
| 22 | + define('MHASH_CRC32', 0); | |
| 23 | +} | |
| 24 | + | |
| 25 | +if (!defined('MHASH_MD5')) { | |
| 26 | + define('MHASH_MD5', 1); | |
| 27 | +} | |
| 28 | + | |
| 29 | +if (!defined('MHASH_SHA1')) { | |
| 30 | + define('MHASH_SHA1', 2); | |
| 31 | +} | |
| 32 | + | |
| 33 | +if (!defined('MHASH_HAVAL256')) { | |
| 34 | + define('MHASH_HAVAL256', 3); | |
| 35 | +} | |
| 36 | + | |
| 37 | +if (!defined('MHASH_RIPEMD160')) { | |
| 38 | + define('MHASH_RIPEMD160', 5); | |
| 39 | +} | |
| 40 | + | |
| 41 | +if (!defined('MHASH_TIGER')) { | |
| 42 | + define('MHASH_TIGER', 7); | |
| 43 | +} | |
| 44 | + | |
| 45 | +if (!defined('MHASH_GOST')) { | |
| 46 | + define('MHASH_GOST', 8); | |
| 47 | +} | |
| 48 | + | |
| 49 | +if (!defined('MHASH_CRC32B')) { | |
| 50 | + define('MHASH_CRC32B', 9); | |
| 51 | +} | |
| 52 | + | |
| 53 | +if (!defined('MHASH_HAVAL192')) { | |
| 54 | + define('MHASH_HAVAL192', 11); | |
| 55 | +} | |
| 56 | + | |
| 57 | +if (!defined('MHASH_HAVAL160')) { | |
| 58 | + define('MHASH_HAVAL160', 12); | |
| 59 | +} | |
| 60 | + | |
| 61 | +if (!defined('MHASH_HAVAL128')) { | |
| 62 | + define('MHASH_HAVAL128', 13); | |
| 63 | +} | |
| 64 | + | |
| 65 | +if (!defined('MHASH_TIGER128')) { | |
| 66 | + define('MHASH_TIGER128', 14); | |
| 67 | +} | |
| 68 | + | |
| 69 | +if (!defined('MHASH_TIGER160')) { | |
| 70 | + define('MHASH_TIGER160', 15); | |
| 71 | +} | |
| 72 | + | |
| 73 | +if (!defined('MHASH_MD4')) { | |
| 74 | + define('MHASH_MD4', 16); | |
| 75 | +} | |
| 76 | + | |
| 77 | +if (!defined('MHASH_SHA256')) { | |
| 78 | + define('MHASH_SHA256', 17); | |
| 79 | +} | |
| 80 | + | |
| 81 | +if (!defined('MHASH_ADLER32')) { | |
| 82 | + define('MHASH_ADLER32', 18); | |
| 83 | +} | |
| 84 | + | |
| 85 | + | |
| 86 | +/** | |
| 87 | + * Replace mhash() | |
| 88 | + * | |
| 89 | + * @category PHP | |
| 90 | + * @package PHP_Compat | |
| 91 | + * @link http://php.net/function.mhash | |
| 92 | + * @author Aidan Lister <aidan@php.net> | |
| 93 | + * @version $Revision$ | |
| 94 | + * @since PHP 4.1.0 | |
| 95 | + * @require PHP 4.0.0 (user_error) | |
| 96 | + */ | |
| 97 | +if (!function_exists('mhash')) { | |
| 98 | + function mhash($hashtype, $data, $key = '') | |
| 99 | + { | |
| 100 | + switch ($hashtype) { | |
| 101 | + case MHASH_MD5: | |
| 102 | + $key = str_pad((strlen($key) > 64 ? pack("H*", md5($key)) : $key), 64, chr(0x00)); | |
| 103 | + $k_opad = $key ^ (str_pad('', 64, chr(0x5c))); | |
| 104 | + $k_ipad = $key ^ (str_pad('', 64, chr(0x36))); | |
| 105 | + return pack("H*", md5($k_opad . pack("H*", md5($k_ipad . $data)))); | |
| 106 | + | |
| 107 | + default: | |
| 108 | + return false; | |
| 109 | + | |
| 110 | + break; | |
| 111 | + } | |
| 112 | + } | |
| 113 | +} | |
| 114 | + | |
| 115 | +?> | |
| 0 | 116 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/ob_clean.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace ob_clean() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.ob_clean | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @author Thiemo Mรคttig (http://maettig.com/) | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 4.2.0 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('ob_clean')) { | |
| 34 | + function ob_clean() | |
| 35 | + { | |
| 36 | + if (@ob_end_clean()) { | |
| 37 | + return ob_start(); | |
| 38 | + } | |
| 39 | + | |
| 40 | + user_error("ob_clean() failed to delete buffer. No buffer to delete.", E_USER_NOTICE); | |
| 41 | + | |
| 42 | + return false; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +?> | |
| 0 | 47 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/ob_flush.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace ob_flush() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.ob_flush | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @author Thiemo Mรคttig (http://maettig.com/) | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 4.2.0 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('ob_flush')) { | |
| 34 | + function ob_flush() | |
| 35 | + { | |
| 36 | + if (@ob_end_flush()) { | |
| 37 | + return ob_start(); | |
| 38 | + } | |
| 39 | + | |
| 40 | + user_error("ob_flush() Failed to flush buffer. No buffer to flush.", E_USER_NOTICE); | |
| 41 | + | |
| 42 | + return false; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +?> | |
| 0 | 47 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/ob_get_clean.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace ob_get_clean() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.ob_get_clean | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @author Thiemo Mรคttig (http://maettig.com/) | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 4.3.0 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('ob_get_clean')) { | |
| 34 | + function ob_get_clean() | |
| 35 | + { | |
| 36 | + $contents = ob_get_contents(); | |
| 37 | + | |
| 38 | + if ($contents !== false) { | |
| 39 | + ob_end_clean(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + return $contents; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +?> | |
| 0 | 47 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/ob_get_flush.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace ob_get_flush() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.ob_get_flush | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @author Thiemo Mรคttig (http://maettig.com/) | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 4.3.0 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('ob_get_flush')) { | |
| 34 | + function ob_get_flush() | |
| 35 | + { | |
| 36 | + $contents = ob_get_contents(); | |
| 37 | + | |
| 38 | + if ($contents !== false) { | |
| 39 | + ob_end_flush(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + return $contents; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +?> | |
| 0 | 47 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/pg_affected_rows.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Ian Eure <ieure@php.net> | | |
| 16 | +// | Mocha (http://us4.php.net/pg_escape_bytea) | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace pg_affected_rows() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.pg_affectd_rows | |
| 28 | + * @author Ian Eure <ieure@php.net> | |
| 29 | + * @version $Revision@ | |
| 30 | + * @since PHP 4.2.0 | |
| 31 | + * @require PHP 4.0.0 | |
| 32 | + */ | |
| 33 | +if (!function_exists('pg_affected_rows')) { | |
| 34 | + function pg_affected_rows($resource) | |
| 35 | + { | |
| 36 | + return pg_cmdtuples($resource); | |
| 37 | + } | |
| 38 | +} | |
| 39 | + | |
| 40 | +?> | |
| 0 | 41 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/pg_escape_bytea.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Ian Eure <ieure@php.net> | | |
| 16 | +// | Mocha (http://us4.php.net/pg_escape_bytea) | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace pg_escape_bytea() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.pg_escape_bytea | |
| 28 | + * @author Ian Eure <ieure@php.net> | |
| 29 | + * @version $Revision@ | |
| 30 | + * @since PHP 4.2.0 | |
| 31 | + * @require PHP 4.0.0 | |
| 32 | + */ | |
| 33 | +if (!function_exists('pg_escape_bytea')) { | |
| 34 | + function pg_escape_bytea($data) | |
| 35 | + { | |
| 36 | + return str_replace( | |
| 37 | + array(chr(92), chr(0), chr(39)), | |
| 38 | + array('\\\134', '\\\000', '\\\047'), | |
| 39 | + $data); | |
| 40 | + } | |
| 41 | +} | |
| 42 | + | |
| 43 | +?> | |
| 0 | 44 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/pg_unescape_bytea.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Ian Eure <ieure@php.net> | | |
| 16 | +// | Tobias <php@tobias.olsson.be> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace pg_unescape_bytea() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.pg_unescape_bytea | |
| 28 | + * @author Ian Eure <ieure@php.net> | |
| 29 | + * @version $Revision@ | |
| 30 | + * @since PHP 4.2.0 | |
| 31 | + * @require PHP 4.0.0 | |
| 32 | + */ | |
| 33 | +if (!function_exists('pg_unescape_bytea')) { | |
| 34 | + function pg_unescape_bytea(&$data) | |
| 35 | + { | |
| 36 | + return str_replace( | |
| 37 | + array('$', '"'), | |
| 38 | + array('\\$', '\\"'), | |
| 39 | + $data); | |
| 40 | + } | |
| 41 | +} | |
| 42 | +?> | |
| 0 | 43 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/php_strip_whitespace.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace php_strip_whitespace() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.php_strip_whitespace | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) + Tokenizer extension | |
| 31 | + */ | |
| 32 | +if (!function_exists('php_strip_whitespace')) { | |
| 33 | + function php_strip_whitespace($file) | |
| 34 | + { | |
| 35 | + // Sanity check | |
| 36 | + if (!is_scalar($file)) { | |
| 37 | + user_error('php_strip_whitespace() expects parameter 1 to be string, ' . | |
| 38 | + gettype($file) . ' given', E_USER_WARNING); | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + // Load file / tokens | |
| 43 | + $source = implode('', file($file)); | |
| 44 | + $tokens = token_get_all($source); | |
| 45 | + | |
| 46 | + // Init | |
| 47 | + $source = ''; | |
| 48 | + $was_ws = false; | |
| 49 | + | |
| 50 | + // Process | |
| 51 | + foreach ($tokens as $token) { | |
| 52 | + if (is_string($token)) { | |
| 53 | + // Single character tokens | |
| 54 | + $source .= $token; | |
| 55 | + } else { | |
| 56 | + list($id, $text) = $token; | |
| 57 | + | |
| 58 | + switch ($id) { | |
| 59 | + // Skip all comments | |
| 60 | + case T_COMMENT: | |
| 61 | + case T_ML_COMMENT: | |
| 62 | + case T_DOC_COMMENT: | |
| 63 | + break; | |
| 64 | + | |
| 65 | + // Remove whitespace | |
| 66 | + case T_WHITESPACE: | |
| 67 | + // We don't want more than one whitespace in a row replaced | |
| 68 | + if ($was_ws !== true) { | |
| 69 | + $source .= ' '; | |
| 70 | + } | |
| 71 | + $was_ws = true; | |
| 72 | + break; | |
| 73 | + | |
| 74 | + default: | |
| 75 | + $was_ws = false; | |
| 76 | + $source .= $text; | |
| 77 | + break; | |
| 78 | + } | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + return $source; | |
| 83 | + } | |
| 84 | +} | |
| 85 | + | |
| 86 | +?> | |
| 0 | 87 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/restore_include_path.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace restore_include_path() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.restore_include_path | |
| 27 | + * @author Stephan Schmidt <schst@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + */ | |
| 31 | +if (!function_exists('restore_include_path')) { | |
| 32 | + function restore_include_path() | |
| 33 | + { | |
| 34 | + return ini_restore('include_path'); | |
| 35 | + } | |
| 36 | +} | |
| 37 | +?> | |
| 0 | 38 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/scandir.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace scandir() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.scandir | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('scandir')) { | |
| 33 | + function scandir($directory, $sorting_order = 0) | |
| 34 | + { | |
| 35 | + if (!is_string($directory)) { | |
| 36 | + user_error('scandir() expects parameter 1 to be string, ' . | |
| 37 | + gettype($directory) . ' given', E_USER_WARNING); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (!is_int($sorting_order) && !is_bool($sorting_order)) { | |
| 42 | + user_error('scandir() expects parameter 2 to be long, ' . | |
| 43 | + gettype($sorting_order) . ' given', E_USER_WARNING); | |
| 44 | + return; | |
| 45 | + } | |
| 46 | + | |
| 47 | + if (!is_dir($directory) || (false === $fh = @opendir($directory))) { | |
| 48 | + user_error('scandir() failed to open dir: Invalid argument', E_USER_WARNING); | |
| 49 | + return false; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $files = array (); | |
| 53 | + while (false !== ($filename = readdir($fh))) { | |
| 54 | + $files[] = $filename; | |
| 55 | + } | |
| 56 | + | |
| 57 | + closedir($fh); | |
| 58 | + | |
| 59 | + if ($sorting_order == 1) { | |
| 60 | + rsort($files); | |
| 61 | + } else { | |
| 62 | + sort($files); | |
| 63 | + } | |
| 64 | + | |
| 65 | + return $files; | |
| 66 | + } | |
| 67 | +} | |
| 68 | + | |
| 69 | +?> | |
| 0 | 70 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/set_include_path.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace set_include_path() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.set_include_path | |
| 27 | + * @author Stephan Schmidt <schst@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + */ | |
| 31 | +if (!function_exists('set_include_path')) { | |
| 32 | + function set_include_path($new_include_path) | |
| 33 | + { | |
| 34 | + return ini_set('include_path', $new_include_path); | |
| 35 | + } | |
| 36 | +} | |
| 37 | +?> | |
| 0 | 38 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/str_ireplace.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace str_ireplace() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.str_ireplace | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + * @note count not by returned by reference, to enable | |
| 32 | + * change '$count = null' to '&$count' | |
| 33 | + */ | |
| 34 | +if (!function_exists('str_ireplace')) { | |
| 35 | + function str_ireplace($search, $replace, $subject, $count = null) | |
| 36 | + { | |
| 37 | + // Sanity check | |
| 38 | + if (is_string($search) && is_array($replace)) { | |
| 39 | + user_error('Array to string conversion', E_USER_NOTICE); | |
| 40 | + $replace = (string) $replace; | |
| 41 | + } | |
| 42 | + | |
| 43 | + // If search isn't an array, make it one | |
| 44 | + if (!is_array($search)) { | |
| 45 | + $search = array ($search); | |
| 46 | + } | |
| 47 | + $search = array_values($search); | |
| 48 | + | |
| 49 | + // If replace isn't an array, make it one, and pad it to the length of search | |
| 50 | + if (!is_array($replace)) { | |
| 51 | + $replace_string = $replace; | |
| 52 | + | |
| 53 | + $replace = array (); | |
| 54 | + for ($i = 0, $c = count($search); $i < $c; $i++) { | |
| 55 | + $replace[$i] = $replace_string; | |
| 56 | + } | |
| 57 | + } | |
| 58 | + $replace = array_values($replace); | |
| 59 | + | |
| 60 | + // Check the replace array is padded to the correct length | |
| 61 | + $length_replace = count($replace); | |
| 62 | + $length_search = count($search); | |
| 63 | + if ($length_replace < $length_search) { | |
| 64 | + for ($i = $length_replace; $i < $length_search; $i++) { | |
| 65 | + $replace[$i] = ''; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + // If subject is not an array, make it one | |
| 70 | + $was_array = false; | |
| 71 | + if (!is_array($subject)) { | |
| 72 | + $was_array = true; | |
| 73 | + $subject = array ($subject); | |
| 74 | + } | |
| 75 | + | |
| 76 | + // Loop through each subject | |
| 77 | + $count = 0; | |
| 78 | + foreach ($subject as $subject_key => $subject_value) { | |
| 79 | + // Loop through each search | |
| 80 | + foreach ($search as $search_key => $search_value) { | |
| 81 | + // Split the array into segments, in between each part is our search | |
| 82 | + $segments = explode(strtolower($search_value), strtolower($subject_value)); | |
| 83 | + | |
| 84 | + // The number of replacements done is the number of segments minus the first | |
| 85 | + $count += count($segments) - 1; | |
| 86 | + $pos = 0; | |
| 87 | + | |
| 88 | + // Loop through each segment | |
| 89 | + foreach ($segments as $segment_key => $segment_value) { | |
| 90 | + // Replace the lowercase segments with the upper case versions | |
| 91 | + $segments[$segment_key] = substr($subject_value, $pos, strlen($segment_value)); | |
| 92 | + // Increase the position relative to the initial string | |
| 93 | + $pos += strlen($segment_value) + strlen($search_value); | |
| 94 | + } | |
| 95 | + | |
| 96 | + // Put our original string back together | |
| 97 | + $subject_value = implode($replace[$search_key], $segments); | |
| 98 | + } | |
| 99 | + | |
| 100 | + $result[$subject_key] = $subject_value; | |
| 101 | + } | |
| 102 | + | |
| 103 | + // Check if subject was initially a string and return it as a string | |
| 104 | + if ($was_array === true) { | |
| 105 | + return $result[0]; | |
| 106 | + } | |
| 107 | + | |
| 108 | + // Otherwise, just return the array | |
| 109 | + return $result; | |
| 110 | + } | |
| 111 | +} | |
| 112 | + | |
| 113 | +?> | |
| 0 | 114 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/str_rot13.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Alan Morey <alan@caint.com> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace str_rot13() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.str_rot13 | |
| 28 | + * @author Alan Morey <alan@caint.com> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 4.0.0 | |
| 32 | + */ | |
| 33 | +if (!function_exists('str_rot13')) { | |
| 34 | + function str_rot13($str) | |
| 35 | + { | |
| 36 | + $from = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| 37 | + $to = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'; | |
| 38 | + | |
| 39 | + return strtr($str, $from, $to); | |
| 40 | + } | |
| 41 | +} | |
| 42 | + | |
| 43 | +?> | |
| 0 | 44 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/str_shuffle.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace str_shuffle() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.str_shuffle | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('str_shuffle')) { | |
| 33 | + function str_shuffle($str) | |
| 34 | + { | |
| 35 | + $newstr = ''; | |
| 36 | + $strlen = strlen($str); | |
| 37 | + $str = (string) $str; | |
| 38 | + | |
| 39 | + // Seed | |
| 40 | + list($usec, $sec) = explode(' ', microtime()); | |
| 41 | + $seed = (float) $sec + ((float) $usec * 100000); | |
| 42 | + mt_srand($seed); | |
| 43 | + | |
| 44 | + // Shuffle | |
| 45 | + for ($i = 0; $strlen > $i; $i++) { | |
| 46 | + $newstr .= $str[mt_rand(0, $strlen - 1)]; | |
| 47 | + } | |
| 48 | + | |
| 49 | + return $newstr; | |
| 50 | + } | |
| 51 | +} | |
| 52 | + | |
| 53 | +?> | |
| 0 | 54 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/str_split.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace str_split() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.str_split | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('str_split')) { | |
| 33 | + function str_split($string, $split_length = 1) | |
| 34 | + { | |
| 35 | + if (!is_scalar($split_length)) { | |
| 36 | + user_error('str_split() expects parameter 2 to be long, ' . | |
| 37 | + gettype($split_length) . ' given', E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + $split_length = (int) $split_length; | |
| 42 | + if ($split_length < 1) { | |
| 43 | + user_error('str_split() The length of each segment must be greater than zero', E_USER_WARNING); | |
| 44 | + return false; | |
| 45 | + } | |
| 46 | + | |
| 47 | + // Select split method | |
| 48 | + if ($split_length < 65536) { | |
| 49 | + // Faster, but only works for less than 2^16 | |
| 50 | + preg_match_all('/.{1,' . $split_length . '}/s', $string, $matches); | |
| 51 | + return $matches[0]; | |
| 52 | + } else { | |
| 53 | + // Required due to preg limitations | |
| 54 | + $arr = array(); | |
| 55 | + $idx = 0; | |
| 56 | + $pos = 0; | |
| 57 | + $len = strlen($string); | |
| 58 | + | |
| 59 | + while ($len > 0) { | |
| 60 | + $blk = ($len < $split_length) ? $len : $split_length; | |
| 61 | + $arr[$idx++] = substr($string, $pos, $blk); | |
| 62 | + $pos += $blk; | |
| 63 | + $len -= $blk; | |
| 64 | + } | |
| 65 | + | |
| 66 | + return $arr; | |
| 67 | + } | |
| 68 | + } | |
| 69 | +} | |
| 70 | + | |
| 71 | +?> | |
| 0 | 72 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/str_word_count.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace str_word_count() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.str_word_count | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.3.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('str_word_count')) { | |
| 33 | + function str_word_count($string, $format = null) | |
| 34 | + { | |
| 35 | + if ($format !== 1 && $format !== 2 && $format !== null) { | |
| 36 | + user_error('str_word_count() The specified format parameter, "' . $format . '" is invalid', | |
| 37 | + E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + $word_string = preg_replace('/[0-9]+/', '', $string); | |
| 42 | + $word_array = preg_split('/[^A-Za-z0-9_\']+/', $word_string, -1, PREG_SPLIT_NO_EMPTY); | |
| 43 | + | |
| 44 | + switch ($format) { | |
| 45 | + case null: | |
| 46 | + $result = count($word_array); | |
| 47 | + break; | |
| 48 | + | |
| 49 | + case 1: | |
| 50 | + $result = $word_array; | |
| 51 | + break; | |
| 52 | + | |
| 53 | + case 2: | |
| 54 | + $lastmatch = 0; | |
| 55 | + $word_assoc = array(); | |
| 56 | + foreach ($word_array as $word) { | |
| 57 | + $word_assoc[$lastmatch = strpos($string, $word, $lastmatch)] = $word; | |
| 58 | + $lastmatch += strlen($word); | |
| 59 | + } | |
| 60 | + $result = $word_assoc; | |
| 61 | + break; | |
| 62 | + } | |
| 63 | + | |
| 64 | + return $result; | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 68 | +?> | |
| 0 | 69 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/stripos.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace stripos() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.stripos | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('stripos')) { | |
| 33 | + function stripos($haystack, $needle, $offset = null) | |
| 34 | + { | |
| 35 | + if (!is_scalar($haystack)) { | |
| 36 | + user_error('stripos() expects parameter 1 to be string, ' . | |
| 37 | + gettype($haystack) . ' given', E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (!is_scalar($needle)) { | |
| 42 | + user_error('stripos() needle is not a string or an integer.', E_USER_WARNING); | |
| 43 | + return false; | |
| 44 | + } | |
| 45 | + | |
| 46 | + if (!is_int($offset) && !is_bool($offset) && !is_null($offset)) { | |
| 47 | + user_error('stripos() expects parameter 3 to be long, ' . | |
| 48 | + gettype($offset) . ' given', E_USER_WARNING); | |
| 49 | + return false; | |
| 50 | + } | |
| 51 | + | |
| 52 | + // Manipulate the string if there is an offset | |
| 53 | + $fix = 0; | |
| 54 | + if (!is_null($offset)) { | |
| 55 | + if ($offset > 0) { | |
| 56 | + $haystack = substr($haystack, $offset, strlen($haystack) - $offset); | |
| 57 | + $fix = $offset; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + $segments = explode(strtolower($needle), strtolower($haystack), 2); | |
| 62 | + | |
| 63 | + // Check there was a match | |
| 64 | + if (count($segments) === 1) { | |
| 65 | + return false; | |
| 66 | + } | |
| 67 | + | |
| 68 | + $position = strlen($segments[0]) + $fix; | |
| 69 | + return $position; | |
| 70 | + } | |
| 71 | +} | |
| 72 | + | |
| 73 | +?> | |
| 0 | 74 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/strpbrk.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Stephan Schmidt <schst@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace strpbrk() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.strpbrk | |
| 27 | + * @author Stephan Schmidt <schst@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 5 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('strpbrk')) { | |
| 33 | + function strpbrk($haystack, $char_list) | |
| 34 | + { | |
| 35 | + if (!is_scalar($haystack)) { | |
| 36 | + user_error('strpbrk() expects parameter 1 to be string, ' . | |
| 37 | + gettype($haystack) . ' given', E_USER_WARNING); | |
| 38 | + return false; | |
| 39 | + } | |
| 40 | + | |
| 41 | + if (!is_scalar($char_list)) { | |
| 42 | + user_error('strpbrk() expects parameter 2 to be scalar, ' . | |
| 43 | + gettype($needle) . ' given', E_USER_WARNING); | |
| 44 | + return false; | |
| 45 | + } | |
| 46 | + | |
| 47 | + $haystack = (string) $haystack; | |
| 48 | + $char_list = (string) $char_list; | |
| 49 | + | |
| 50 | + $len = strlen($haystack); | |
| 51 | + for ($i = 0; $i < $len; $i++) { | |
| 52 | + $char = substr($haystack, $i, 1); | |
| 53 | + if (strpos($char_list, $char) === false) { | |
| 54 | + continue; | |
| 55 | + } | |
| 56 | + return substr($haystack, $i); | |
| 57 | + } | |
| 58 | + | |
| 59 | + return false; | |
| 60 | + } | |
| 61 | +} | |
| 62 | + | |
| 63 | +?> | |
| 0 | 64 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/strripos.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// | Stephan Schmidt <schst@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace strripos() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.strripos | |
| 28 | + * @author Aidan Lister <aidan@php.net> | |
| 29 | + * @version $Revision$ | |
| 30 | + * @since PHP 5 | |
| 31 | + * @require PHP 4.0.0 (user_error) | |
| 32 | + */ | |
| 33 | +if (!function_exists('strripos')) { | |
| 34 | + function strripos($haystack, $needle, $offset = null) | |
| 35 | + { | |
| 36 | + // Sanity check | |
| 37 | + if (!is_scalar($haystack)) { | |
| 38 | + user_error('strripos() expects parameter 1 to be scalar, ' . | |
| 39 | + gettype($haystack) . ' given', E_USER_WARNING); | |
| 40 | + return false; | |
| 41 | + } | |
| 42 | + | |
| 43 | + if (!is_scalar($needle)) { | |
| 44 | + user_error('strripos() expects parameter 2 to be scalar, ' . | |
| 45 | + gettype($needle) . ' given', E_USER_WARNING); | |
| 46 | + return false; | |
| 47 | + } | |
| 48 | + | |
| 49 | + if (!is_int($offset) && !is_bool($offset) && !is_null($offset)) { | |
| 50 | + user_error('strripos() expects parameter 3 to be long, ' . | |
| 51 | + gettype($offset) . ' given', E_USER_WARNING); | |
| 52 | + return false; | |
| 53 | + } | |
| 54 | + | |
| 55 | + // Initialise variables | |
| 56 | + $needle = strtolower($needle); | |
| 57 | + $haystack = strtolower($haystack); | |
| 58 | + $needle_fc = $needle{0}; | |
| 59 | + $needle_len = strlen($needle); | |
| 60 | + $haystack_len = strlen($haystack); | |
| 61 | + $offset = (int) $offset; | |
| 62 | + $leftlimit = ($offset >= 0) ? $offset : 0; | |
| 63 | + $p = ($offset >= 0) ? | |
| 64 | + $haystack_len : | |
| 65 | + $haystack_len + $offset + 1; | |
| 66 | + | |
| 67 | + // Reverse iterate haystack | |
| 68 | + while (--$p > $leftlimit) { | |
| 69 | + if ($needle_fc === $haystack{$p} && | |
| 70 | + substr($haystack, $p, $needle_len) === $needle) { | |
| 71 | + return $p; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + return false; | |
| 76 | + } | |
| 77 | +} | |
| 78 | + | |
| 79 | +?> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/substr_compare.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Tom Buskens <ortega@php.net> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace substr_compare() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.substr_compare | |
| 28 | + * @author Tom Buskens <ortega@php.net> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 5 | |
| 32 | + * @require PHP 4.0.0 (user_error) | |
| 33 | + */ | |
| 34 | +if (!function_exists('substr_compare')) { | |
| 35 | + function substr_compare($main_str, $str, $offset, $length = null, $case_insensitive = false) | |
| 36 | + { | |
| 37 | + if (!is_string($main_str)) { | |
| 38 | + user_error('substr_compare() expects parameter 1 to be string, ' . | |
| 39 | + gettype($main_str) . ' given', E_USER_WARNING); | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + | |
| 43 | + if (!is_string($str)) { | |
| 44 | + user_error('substr_compare() expects parameter 2 to be string, ' . | |
| 45 | + gettype($str) . ' given', E_USER_WARNING); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + | |
| 49 | + if (!is_int($offset)) { | |
| 50 | + user_error('substr_compare() expects parameter 3 to be long, ' . | |
| 51 | + gettype($offset) . ' given', E_USER_WARNING); | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 55 | + if (is_null($length)) { | |
| 56 | + $length = strlen($main_str) - $offset; | |
| 57 | + } elseif ($offset >= strlen($main_str)) { | |
| 58 | + user_error('substr_compare() The start position cannot exceed initial string length', | |
| 59 | + E_USER_WARNING); | |
| 60 | + return false; | |
| 61 | + } | |
| 62 | + | |
| 63 | + $main_str = substr($main_str, $offset, $length); | |
| 64 | + $str = substr($str, 0, strlen($main_str)); | |
| 65 | + | |
| 66 | + if ($case_insensitive === false) { | |
| 67 | + return strcmp($main_str, $str); | |
| 68 | + } else { | |
| 69 | + return strcasecmp($main_str, $str); | |
| 70 | + } | |
| 71 | + } | |
| 72 | +} | |
| 73 | + | |
| 74 | +?> | |
| 0 | 75 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/var_export.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace var_export() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.var_export | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.2.0 | |
| 30 | + * @require PHP 4.0.0 (user_error) | |
| 31 | + */ | |
| 32 | +if (!function_exists('var_export')) { | |
| 33 | + function var_export($array, $return = false) | |
| 34 | + { | |
| 35 | + // Common output variables | |
| 36 | + $indent = ' '; | |
| 37 | + $doublearrow = ' => '; | |
| 38 | + $lineend = ",\n"; | |
| 39 | + $stringdelim = '\''; | |
| 40 | + $newline = "\n"; | |
| 41 | + $find = array(null, '\\', '\''); | |
| 42 | + $replace = array('NULL', '\\\\', '\\\''); | |
| 43 | + | |
| 44 | + // Check the export isn't a simple string / int | |
| 45 | + if (is_string($array)) { | |
| 46 | + $out = $stringdelim . $array . $stringdelim; | |
| 47 | + } elseif (is_int($array)) { | |
| 48 | + $out = (string)$array; | |
| 49 | + } else { | |
| 50 | + // Begin the array export | |
| 51 | + // Start the string | |
| 52 | + $out = "array (\n"; | |
| 53 | + | |
| 54 | + // Loop through each value in array | |
| 55 | + foreach ($array as $key => $value) { | |
| 56 | + // If the key is a string, delimit it | |
| 57 | + if (is_string($key)) { | |
| 58 | + $key = str_replace($find, $replace, $key); | |
| 59 | + $key = $stringdelim . $key . $stringdelim; | |
| 60 | + } | |
| 61 | + | |
| 62 | + // Delimit value | |
| 63 | + if (is_array($value)) { | |
| 64 | + // We have an array, so do some recursion | |
| 65 | + // Do some basic recursion while increasing the indent | |
| 66 | + $recur_array = explode($newline, var_export($value, true)); | |
| 67 | + $temp_array = array(); | |
| 68 | + foreach ($recur_array as $recur_line) { | |
| 69 | + $temp_array[] = $indent . $recur_line; | |
| 70 | + } | |
| 71 | + $recur_array = implode($newline, $temp_array); | |
| 72 | + $value = $newline . $recur_array; | |
| 73 | + } elseif (is_null($value)) { | |
| 74 | + $value = 'NULL'; | |
| 75 | + } else { | |
| 76 | + $value = str_replace($find, $replace, $value); | |
| 77 | + $value = $stringdelim . $value . $stringdelim; | |
| 78 | + } | |
| 79 | + | |
| 80 | + // Piece together the line | |
| 81 | + $out .= $indent . $key . $doublearrow . $value . $lineend; | |
| 82 | + } | |
| 83 | + | |
| 84 | + // End our string | |
| 85 | + $out .= ")"; | |
| 86 | + } | |
| 87 | + | |
| 88 | + | |
| 89 | + // Decide method of output | |
| 90 | + if ($return === true) { | |
| 91 | + return $out; | |
| 92 | + } else { | |
| 93 | + echo $out; | |
| 94 | + return; | |
| 95 | + } | |
| 96 | + } | |
| 97 | +} | |
| 98 | + | |
| 99 | +?> | |
| 0 | 100 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/version_compare.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Philippe Jausions <Philippe.Jausions@11abacus.com> | | |
| 16 | +// | Aidan Lister <aidan@php.net> | | |
| 17 | +// +----------------------------------------------------------------------+ | |
| 18 | +// | |
| 19 | +// $Id$ | |
| 20 | + | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * Replace version_compare() | |
| 24 | + * | |
| 25 | + * @category PHP | |
| 26 | + * @package PHP_Compat | |
| 27 | + * @link http://php.net/function.version_compare | |
| 28 | + * @author Philippe Jausions <Philippe.Jausions@11abacus.com> | |
| 29 | + * @author Aidan Lister <aidan@php.net> | |
| 30 | + * @version $Revision$ | |
| 31 | + * @since PHP 4.1.0 | |
| 32 | + * @require PHP 4.0.0 (user_error) | |
| 33 | + */ | |
| 34 | +if (!function_exists('version_compare')) { | |
| 35 | + function version_compare($version1, $version2, $operator = '<') | |
| 36 | + { | |
| 37 | + // Check input | |
| 38 | + if (!is_scalar($version1)) { | |
| 39 | + user_error('version_compare() expects parameter 1 to be string, ' . | |
| 40 | + gettype($version1) . ' given', E_USER_WARNING); | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + | |
| 44 | + if (!is_scalar($version2)) { | |
| 45 | + user_error('version_compare() expects parameter 2 to be string, ' . | |
| 46 | + gettype($version2) . ' given', E_USER_WARNING); | |
| 47 | + return; | |
| 48 | + } | |
| 49 | + | |
| 50 | + if (!is_scalar($operator)) { | |
| 51 | + user_error('version_compare() expects parameter 3 to be string, ' . | |
| 52 | + gettype($operator) . ' given', E_USER_WARNING); | |
| 53 | + return; | |
| 54 | + } | |
| 55 | + | |
| 56 | + // Standardise versions | |
| 57 | + $v1 = explode('.', | |
| 58 | + str_replace('..', '.', | |
| 59 | + preg_replace('/([^0-9\.]+)/', '.$1.', | |
| 60 | + str_replace(array('-', '_', '+'), '.', | |
| 61 | + trim($version1))))); | |
| 62 | + | |
| 63 | + $v2 = explode('.', | |
| 64 | + str_replace('..', '.', | |
| 65 | + preg_replace('/([^0-9\.]+)/', '.$1.', | |
| 66 | + str_replace(array('-', '_', '+'), '.', | |
| 67 | + trim($version2))))); | |
| 68 | + | |
| 69 | + // Replace empty entries at the start of the array | |
| 70 | + while (empty($v1[0]) && array_shift($v1)) {} | |
| 71 | + while (empty($v2[0]) && array_shift($v2)) {} | |
| 72 | + | |
| 73 | + // Release state order | |
| 74 | + // '#' stands for any number | |
| 75 | + $versions = array( | |
| 76 | + 'dev' => 0, | |
| 77 | + 'alpha' => 1, | |
| 78 | + 'a' => 1, | |
| 79 | + 'beta' => 2, | |
| 80 | + 'b' => 2, | |
| 81 | + 'RC' => 3, | |
| 82 | + '#' => 4, | |
| 83 | + 'p' => 5, | |
| 84 | + 'pl' => 5); | |
| 85 | + | |
| 86 | + // Loop through each segment in the version string | |
| 87 | + $compare = 0; | |
| 88 | + for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) { | |
| 89 | + if ($v1[$i] == $v2[$i]) { | |
| 90 | + continue; | |
| 91 | + } | |
| 92 | + $i1 = $v1[$i]; | |
| 93 | + $i2 = $v2[$i]; | |
| 94 | + if (is_numeric($i1) && is_numeric($i2)) { | |
| 95 | + $compare = ($i1 < $i2) ? -1 : 1; | |
| 96 | + break; | |
| 97 | + } | |
| 98 | + // We use the position of '#' in the versions list | |
| 99 | + // for numbers... (so take care of # in original string) | |
| 100 | + if ($i1 == '#') { | |
| 101 | + $i1 = ''; | |
| 102 | + } elseif (is_numeric($i1)) { | |
| 103 | + $i1 = '#'; | |
| 104 | + } | |
| 105 | + if ($i2 == '#') { | |
| 106 | + $i2 = ''; | |
| 107 | + } elseif (is_numeric($i2])) { | |
| 108 | + $i2 = '#'; | |
| 109 | + } | |
| 110 | + if (isset($versions[$i1]) && isset($versions[$i2])) { | |
| 111 | + $compare = ($versions[$i1] < $versions[$i2]) ? -1 : 1; | |
| 112 | + } elseif (isset($versions[$i1])) { | |
| 113 | + $compare = 1; | |
| 114 | + } elseif (isset($versions[$i2])) { | |
| 115 | + $compare = -1; | |
| 116 | + } else { | |
| 117 | + $compare = 0; | |
| 118 | + } | |
| 119 | + | |
| 120 | + break; | |
| 121 | + } | |
| 122 | + | |
| 123 | + // If previous loop didn't find anything, compare the "extra" segments | |
| 124 | + if ($compare == 0) { | |
| 125 | + if (count($v2) > count($v1)) { | |
| 126 | + if (isset($versions[$v2[$i]])) { | |
| 127 | + $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; | |
| 128 | + } else { | |
| 129 | + $compare = -1; | |
| 130 | + } | |
| 131 | + } elseif (count($v2) < count($v1)) { | |
| 132 | + if (isset($versions[$v1[$i]])) { | |
| 133 | + $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; | |
| 134 | + } else { | |
| 135 | + $compare = 1; | |
| 136 | + } | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + // Compare the versions | |
| 141 | + if (func_num_args() > 2) { | |
| 142 | + switch ($operator) { | |
| 143 | + case '>': | |
| 144 | + case 'gt': | |
| 145 | + return (bool) ($compare > 0); | |
| 146 | + break; | |
| 147 | + case '>=': | |
| 148 | + case 'ge': | |
| 149 | + return (bool) ($compare >= 0); | |
| 150 | + break; | |
| 151 | + case '<=': | |
| 152 | + case 'le': | |
| 153 | + return (bool) ($compare <= 0); | |
| 154 | + break; | |
| 155 | + case '==': | |
| 156 | + case '=': | |
| 157 | + case 'eq': | |
| 158 | + return (bool) ($compare == 0); | |
| 159 | + break; | |
| 160 | + case '<>': | |
| 161 | + case '!=': | |
| 162 | + case 'ne': | |
| 163 | + return (bool) ($compare != 0); | |
| 164 | + break; | |
| 165 | + case '': | |
| 166 | + case '<': | |
| 167 | + case 'lt': | |
| 168 | + return (bool) ($compare < 0); | |
| 169 | + break; | |
| 170 | + default: | |
| 171 | + return; | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + return $compare; | |
| 176 | + } | |
| 177 | +} | |
| 178 | + | |
| 179 | +?> | |
| 0 | 180 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/vprintf.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace vprintf() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.vprintf | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.1.0 | |
| 30 | + * @require PHP 4.0.4 (call_user_func_array) | |
| 31 | + */ | |
| 32 | +if (!function_exists('vprintf')) { | |
| 33 | + function vprintf ($format, $args) | |
| 34 | + { | |
| 35 | + if (count($args) < 2) { | |
| 36 | + user_error('vprintf() Too few arguments', E_USER_WARNING); | |
| 37 | + return; | |
| 38 | + } | |
| 39 | + | |
| 40 | + array_unshift($args, $format); | |
| 41 | + return call_user_func_array('printf', $args); | |
| 42 | + } | |
| 43 | +} | |
| 44 | + | |
| 45 | +?> | |
| 0 | 46 | \ No newline at end of file | ... | ... |
thirdparty/pear/PHP/Compat/Function/vsprintf.php
0 โ 100644
| 1 | +<?php | |
| 2 | +// +----------------------------------------------------------------------+ | |
| 3 | +// | PHP Version 4 | | |
| 4 | +// +----------------------------------------------------------------------+ | |
| 5 | +// | Copyright (c) 1997-2004 The PHP Group | | |
| 6 | +// +----------------------------------------------------------------------+ | |
| 7 | +// | This source file is subject to version 3.0 of the PHP license, | | |
| 8 | +// | that is bundled with this package in the file LICENSE, and is | | |
| 9 | +// | available at through the world-wide-web at | | |
| 10 | +// | http://www.php.net/license/3_0.txt. | | |
| 11 | +// | If you did not receive a copy of the PHP license and are unable to | | |
| 12 | +// | obtain it through the world-wide-web, please send a note to | | |
| 13 | +// | license@php.net so we can mail you a copy immediately. | | |
| 14 | +// +----------------------------------------------------------------------+ | |
| 15 | +// | Authors: Aidan Lister <aidan@php.net> | | |
| 16 | +// +----------------------------------------------------------------------+ | |
| 17 | +// | |
| 18 | +// $Id$ | |
| 19 | + | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Replace vsprintf() | |
| 23 | + * | |
| 24 | + * @category PHP | |
| 25 | + * @package PHP_Compat | |
| 26 | + * @link http://php.net/function.vsprintf | |
| 27 | + * @author Aidan Lister <aidan@php.net> | |
| 28 | + * @version $Revision$ | |
| 29 | + * @since PHP 4.1.0 | |
| 30 | + * @require PHP 4.0.4 (call_user_func_array) | |
| 31 | + */ | |
| 32 | +if (!function_exists('vsprintf')) { | |
| 33 | + function vsprintf ($format, $args) | |
| 34 | + { | |
| 35 | + if (count($args) < 2) { | |
| 36 | + user_error('vsprintf() Too few arguments', E_USER_WARNING); | |
| 37 | + return; | |
| 38 | + } | |
| 39 | + | |
| 40 | + array_unshift($args, $format); | |
| 41 | + return call_user_func_array('sprintf', $args); | |
| 42 | + } | |
| 43 | +} | |
| 44 | + | |
| 45 | +?> | |
| 0 | 46 | \ No newline at end of file | ... | ... |