summaryrefslogtreecommitdiff
path: root/inc/search.php
diff options
context:
space:
mode:
authorGina Haeussge <osd@foosel.net>2008-10-12 16:03:06 +0200
committerGina Haeussge <osd@foosel.net>2008-10-12 16:03:06 +0200
commitd8126df2d8fc96fb63f58ef890140c527f23ed15 (patch)
tree7885331985da4a688999a91410f4bd0cbd7f3d0a /inc/search.php
parentaab557e9d4eb4fc034db5af15079e151b21ab81b (diff)
downloadrpg-d8126df2d8fc96fb63f58ef890140c527f23ed15.tar.gz
rpg-d8126df2d8fc96fb63f58ef890140c527f23ed15.tar.bz2
Implementation of FS#872
darcs-hash:20081012140306-2b4f5-3fd4006f178e358be3d19be5c4244e56facd1b9a.gz
Diffstat (limited to 'inc/search.php')
-rw-r--r--inc/search.php27
1 files changed, 6 insertions, 21 deletions
diff --git a/inc/search.php b/inc/search.php
index af4315cde..35e5a358a 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -43,38 +43,23 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1){
//give directories to userfunction then recurse
foreach($dirs as $dir){
- if (search_callback($func,$data,$base,$dir,'d',$lvl,$opts)){
+ if (call_user_func_array($func, array(&$data,$base,$dir,'d',$lvl,$opts))){
search($data,$base,$func,$opts,$dir,$lvl+1);
}
}
//now handle the files
foreach($files as $file){
- search_callback($func,$data,$base,$file,'f',$lvl,$opts);
+ call_user_func_array($func, array(&$data,$base,$file,'f',$lvl,$opts));
}
}
/**
- * Used to run a user callback
- *
- * Makes sure the $data array is passed by reference (unlike when using
- * call_user_func())
- *
- * @todo If this can be generalized it may be useful elsewhere in the code
- * @author Andreas Gohr <andi@splitbrain.org>
+ * Wrapper around call_user_func_array.
+ *
+ * @deprecated
*/
function search_callback($func,&$data,$base,$file,$type,$lvl,$opts){
- if(is_array($func)){
- if(is_object($func[0])){
- // instanciated object
- return $func[0]->$func[1]($data,$base,$file,$type,$lvl,$opts);
- }else{
- // static call
- $f = $func[0].'::'.$func[1];
- return $f($data,$base,$file,$type,$lvl,$opts);
- }
- }
- // simple function call
- return $func($data,$base,$file,$type,$lvl,$opts);
+ return call_user_func_array($func, array(&$data,$base,$file,$type,$lvl,$opts));
}
/**