예제 #1
0
파일: pnd.php 프로젝트: notmaintained/pnd
function requires()
{
    $libs = func_get_args();
    foreach ($libs as $lib) {
        $lib_file = PND_DIR . $lib . DIRECTORY_SEPARATOR . "{$lib}.php";
        if (!file_exists($lib_file)) {
            trigger_error_("Requires non-existent lib {$lib}", E_USER_ERROR);
        }
        require_once $lib_file;
    }
}
예제 #2
0
function handler_macro($method, $paths, $conds, $func)
{
    $req = request_();
    $handler = handler_($method, $paths, $conds, $func);
    if (handler_match_($handler, $req, $matches)) {
        if (is_callable($handler['func'])) {
            call_user_func_array($handler['func'], array_merge(array($req, $matches)));
        } else {
            trigger_error_("Invalid handler macro func", E_USER_ERROR);
        }
    }
}