13 |
* $Id$ |
* $Id$ |
14 |
* |
* |
15 |
* $Log$ |
* $Log$ |
16 |
|
* Revision 1.8 2004/07/21 12:56:19 joko |
17 |
|
* php5 compatibility |
18 |
|
* |
19 |
|
* Revision 1.7 2003/06/25 23:41:14 joko |
20 |
|
* now using "global $Dumper_mode" |
21 |
|
* |
22 |
|
* Revision 1.6 2003/04/16 16:24:23 joko |
23 |
|
* + odd and even from php.net |
24 |
|
* |
25 |
|
* Revision 1.5 2003/04/11 01:31:50 joko |
26 |
|
* + function log (from flib-shortcuts) |
27 |
|
* |
28 |
|
* Revision 1.4 2003/04/09 07:55:47 joko |
29 |
|
* + function untwingle_reference |
30 |
|
* |
31 |
* Revision 1.3 2003/04/08 22:35:16 joko |
* Revision 1.3 2003/04/08 22:35:16 joko |
32 |
* + 'function yesno' from utils/links.php |
* + 'function yesno' from utils/links.php |
33 |
* |
* |
184 |
} |
} |
185 |
|
|
186 |
function Dumper() { |
function Dumper() { |
187 |
|
global $Dumper_mode; |
188 |
$arg_list = func_get_args(); |
$arg_list = func_get_args(); |
189 |
$count = 1; |
$count = 1; |
190 |
|
|
202 |
ob_end_clean(); |
ob_end_clean(); |
203 |
|
|
204 |
//print "mode: " . $this->Dumper_mode . "<br/>"; |
//print "mode: " . $this->Dumper_mode . "<br/>"; |
205 |
//if ($this->Dumper_mode == HTML) { |
if ($Dumper_mode == 'single_line') { |
206 |
|
$var_dump = str_replace("\n", ' ', $var_dump); |
207 |
|
} else { |
208 |
$var_dump = str_replace("\n", '<br/>', $var_dump); |
$var_dump = str_replace("\n", '<br/>', $var_dump); |
209 |
$var_dump = str_replace(" ", ' ', $var_dump); |
$var_dump = str_replace(" ", ' ', $var_dump); |
210 |
//} |
} |
211 |
|
|
212 |
//if (sizeof($args) == 1) { $var_dump .= '<br/>'; } |
//if (sizeof($args) == 1) { $var_dump .= '<br/>'; } |
213 |
|
|
432 |
|
|
433 |
// from: http://www.php.net/manual/en/function.method-exists.php |
// from: http://www.php.net/manual/en/function.method-exists.php |
434 |
function class_has_method($className, $methodName) { |
function class_has_method($className, $methodName) { |
435 |
$bool_exists = (in_array(strtolower($methodName), get_class_methods($className))); |
|
436 |
|
// new as of 2004-07-21: php5 compatibility |
437 |
|
// taken from http://php.net/manual/en/function.version-compare.php |
438 |
|
if (version_compare(phpversion(), "5.0.0", "<")) { |
439 |
|
$methodName = strtolower($methodName); |
440 |
|
} |
441 |
|
|
442 |
|
$bool_exists = (in_array($methodName, get_class_methods($className))); |
443 |
return $bool_exists; |
return $bool_exists; |
444 |
} |
} |
445 |
|
|
538 |
*/ |
*/ |
539 |
|
|
540 |
if (!class_exists($classname)) { |
if (!class_exists($classname)) { |
541 |
user_error("Class '$classname' doesn't exist."); |
php::log( "Class '$classname' doesn't exist.", PEAR_LOG_ERR ); |
542 |
return; |
return; |
543 |
} |
} |
544 |
|
|
691 |
return $bool ? 'yes' : 'no'; |
return $bool ? 'yes' : 'no'; |
692 |
} |
} |
693 |
|
|
694 |
|
function untwingle_reference($item, $options = array()) { |
695 |
|
|
696 |
|
// default |
697 |
|
if (!$options['seperator']) { $options['seperator'] = '_'; } |
698 |
|
|
699 |
|
if ( is_string($item) && (substr($item, 0, 2) == "o_") ) { |
700 |
|
//print "YAI!<br/>"; |
701 |
|
$parts = split($options['seperator'], $item); |
702 |
|
$result = array( |
703 |
|
ident => $parts[1], |
704 |
|
type => $parts[2], |
705 |
|
); |
706 |
|
return $result; |
707 |
|
} |
708 |
|
} |
709 |
|
|
710 |
|
// wrapper-function for getting the logger instance |
711 |
|
// TODO: review! what about php::append_log? |
712 |
|
function log($string, $level = PEAR_LOG_DEBUG) { |
713 |
|
global $app; |
714 |
|
$app->log($string, $level); |
715 |
|
} |
716 |
|
|
717 |
|
// from: http://www.php.net/manual/en/function.array-filter.php#AEN7432 |
718 |
|
function odd($var) { |
719 |
|
return ($var % 2 == 1); |
720 |
|
} |
721 |
|
function even($var) { |
722 |
|
return ($var % 2 == 0); |
723 |
|
} |
724 |
|
|
725 |
} |
} |
726 |
|
|
727 |
|
|