13 |
* $Id$ |
* $Id$ |
14 |
* |
* |
15 |
* $Log$ |
* $Log$ |
16 |
|
* Revision 1.9 2005/08/11 14:06:26 jonen |
17 |
|
* + added generic array-key sorting function |
18 |
|
* |
19 |
|
* Revision 1.8 2004/07/21 12:56:19 joko |
20 |
|
* php5 compatibility |
21 |
|
* |
22 |
|
* Revision 1.7 2003/06/25 23:41:14 joko |
23 |
|
* now using "global $Dumper_mode" |
24 |
|
* |
25 |
|
* Revision 1.6 2003/04/16 16:24:23 joko |
26 |
|
* + odd and even from php.net |
27 |
|
* |
28 |
|
* Revision 1.5 2003/04/11 01:31:50 joko |
29 |
|
* + function log (from flib-shortcuts) |
30 |
|
* |
31 |
|
* Revision 1.4 2003/04/09 07:55:47 joko |
32 |
|
* + function untwingle_reference |
33 |
|
* |
34 |
|
* Revision 1.3 2003/04/08 22:35:16 joko |
35 |
|
* + 'function yesno' from utils/links.php |
36 |
|
* |
37 |
* Revision 1.2 2003/04/06 01:37:31 jonen |
* Revision 1.2 2003/04/06 01:37:31 jonen |
38 |
* + added functions to generate and handle unique ID's |
* + added functions to generate and handle unique ID's |
39 |
* |
* |
187 |
} |
} |
188 |
|
|
189 |
function Dumper() { |
function Dumper() { |
190 |
|
global $Dumper_mode; |
191 |
$arg_list = func_get_args(); |
$arg_list = func_get_args(); |
192 |
$count = 1; |
$count = 1; |
193 |
|
|
205 |
ob_end_clean(); |
ob_end_clean(); |
206 |
|
|
207 |
//print "mode: " . $this->Dumper_mode . "<br/>"; |
//print "mode: " . $this->Dumper_mode . "<br/>"; |
208 |
//if ($this->Dumper_mode == HTML) { |
if ($Dumper_mode == 'single_line') { |
209 |
|
$var_dump = str_replace("\n", ' ', $var_dump); |
210 |
|
} else { |
211 |
$var_dump = str_replace("\n", '<br/>', $var_dump); |
$var_dump = str_replace("\n", '<br/>', $var_dump); |
212 |
$var_dump = str_replace(" ", ' ', $var_dump); |
$var_dump = str_replace(" ", ' ', $var_dump); |
213 |
//} |
} |
214 |
|
|
215 |
//if (sizeof($args) == 1) { $var_dump .= '<br/>'; } |
//if (sizeof($args) == 1) { $var_dump .= '<br/>'; } |
216 |
|
|
435 |
|
|
436 |
// from: http://www.php.net/manual/en/function.method-exists.php |
// from: http://www.php.net/manual/en/function.method-exists.php |
437 |
function class_has_method($className, $methodName) { |
function class_has_method($className, $methodName) { |
438 |
$bool_exists = (in_array(strtolower($methodName), get_class_methods($className))); |
|
439 |
|
// new as of 2004-07-21: php5 compatibility |
440 |
|
// taken from http://php.net/manual/en/function.version-compare.php |
441 |
|
if (version_compare(phpversion(), "5.0.0", "<")) { |
442 |
|
$methodName = strtolower($methodName); |
443 |
|
} |
444 |
|
|
445 |
|
$bool_exists = (in_array($methodName, get_class_methods($className))); |
446 |
return $bool_exists; |
return $bool_exists; |
447 |
} |
} |
448 |
|
|
541 |
*/ |
*/ |
542 |
|
|
543 |
if (!class_exists($classname)) { |
if (!class_exists($classname)) { |
544 |
user_error("Class '$classname' doesn't exist."); |
php::log( "Class '$classname' doesn't exist.", PEAR_LOG_ERR ); |
545 |
return; |
return; |
546 |
} |
} |
547 |
|
|
689 |
return ( implode(unpack("H*",Base64_decode($ID)), '') ); |
return ( implode(unpack("H*",Base64_decode($ID)), '') ); |
690 |
} |
} |
691 |
|
|
692 |
|
// from: utils/links.php |
693 |
|
function yesno($bool) { |
694 |
|
return $bool ? 'yes' : 'no'; |
695 |
|
} |
696 |
|
|
697 |
|
function untwingle_reference($item, $options = array()) { |
698 |
|
|
699 |
|
// default |
700 |
|
if (!$options['seperator']) { $options['seperator'] = '_'; } |
701 |
|
|
702 |
|
if ( is_string($item) && (substr($item, 0, 2) == "o_") ) { |
703 |
|
//print "YAI!<br/>"; |
704 |
|
$parts = split($options['seperator'], $item); |
705 |
|
$result = array( |
706 |
|
ident => $parts[1], |
707 |
|
type => $parts[2], |
708 |
|
); |
709 |
|
return $result; |
710 |
|
} |
711 |
|
} |
712 |
|
|
713 |
|
// wrapper-function for getting the logger instance |
714 |
|
// TODO: review! what about php::append_log? |
715 |
|
function log($string, $level = PEAR_LOG_DEBUG) { |
716 |
|
global $app; |
717 |
|
$app->log($string, $level); |
718 |
|
} |
719 |
|
|
720 |
|
// from: http://www.php.net/manual/en/function.array-filter.php#AEN7432 |
721 |
|
function odd($var) { |
722 |
|
return ($var % 2 == 1); |
723 |
|
} |
724 |
|
function even($var) { |
725 |
|
return ($var % 2 == 0); |
726 |
|
} |
727 |
|
|
728 |
|
// modified version from: http://de.php.net/manual/en/function.array-multisort.php |
729 |
|
// compare values of two array-keys |
730 |
|
// usage: asort($array, "comparar_caption"); |
731 |
|
function comparar_caption($a, $b, $key_name="caption") { |
732 |
|
return strnatcasecmp($a[$key_name], $b[$key_name]); |
733 |
|
} |
734 |
|
|
735 |
|
|
736 |
} |
} |
737 |
|
|