XOOPS  2.6.0
xoopsutility.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
25 {
26 
33  static function recursive($handler, $data)
34  {
35  if (is_array($data)) {
36  $return = array_map(array('XoopsUtility', 'recursive'),
37  array_fill(0, count($data), $handler), $data);
38  return $return;
39  }
40  // single function
41  if (is_string($handler)) {
42  return function_exists($handler) ? $handler($data) : $data;
43  }
44  // Method of a class
45  if (is_callable($handler)) {
46  return call_user_func($handler, $data);
47  }
48  return $data;
49  }
50 }
static recursive($handler, $data)