예제 #1
0
function template_file($template, $template_dir = NULL)
{
    if (template_has_absolute_path($template)) {
        $template_dir = '';
    } else {
        $template_dir = template_dir($template_dir, templates_dir(), php_self_dir());
    }
    $template_dir = !empty($template_dir) ? rtrim($template_dir, '/\\') . DIRECTORY_SEPARATOR : $template_dir;
    $template = rtrim($template, '/\\');
    return slashes_to_directory_separator("{$template_dir}{$template}.php");
}
예제 #2
0
function handler_sendmail($handler, $email, $resource)
{
    require_once handler_email_file($handler, php_self_dir());
    $args = func_get_args();
    $handler_email_func_args = array_slice($args, 2);
    $handler_email_func = "{$handler}_{$email}_email";
    $params = call_user_func_array($handler_email_func, $handler_email_func_args);
    // TODO: is this all I need to send to the email template?
    $template_vars = array('resource' => $resource, 'params' => $params);
    if (isset($params['message'])) {
        $message = $params['message'];
    } else {
        $message = template_compose(handler_email_template($handler, $email), $template_vars, handler_email_layout($handler), $template_vars);
    }
    return emailmodule_sendmail($params['from'], $params['to'], $params['subject'], $message);
}
예제 #3
0
function test_handler_dir()
{
    should_return(php_self_dir() . 'handlers' . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, when_passed('foo'));
}