public function __call($function, $params)
{
if (strpos($function, 'act_') === 0) {
// The first parameter is an array, get it
if (count($params) > 0) {
list($user_filters) = $params;
} else {
$user_filters = array();
}
$action = substr($function, 4);
Plugins::act('theme_action', $action, $this, $user_filters);
} else {
$purposed = 'output';
if (preg_match('/^(.*)_(return|end|out)$/', $function, $matches)) {
$purposed = $matches[2];
$function = $matches[1];
}
array_unshift($params, $function, $this);
$result = call_user_func_array(Method::create('\\Habari\\Plugins', 'theme'), $params);
switch ($purposed) {
case 'return':
return $result;
case 'end':
return end($result);
case 'out':
$output = implode('', (array) $result);
echo $output;
return $output;
default:
$output = implode('', (array) $result);
return $output;
}
}
}