Пример #1
0
    if (is_array($val) && isset($val['reload']) && $val['reload']) {
        $module = $val['module'];
        $feedback_pre[$name]['reload'] = FALSE;
        goto load_module;
    }
}
foreach ($feedback as $blName => $result) {
    if (is_array($result) && isset($result['reload']) && $result['reload']) {
        $module = $result['module'];
        $feedback[$blName]['reload'] = FALSE;
        goto load_module;
    }
}
$rendered = render(LAYOUT_PATH, compact('module', 'feedback', 'modules', 'feedback_pre'));
switch ($rendered) {
    case RENDER_ERR_NO_FILE:
        echo 'No page to display! - ', RENDER_ERR_NO_FILE;
        break;
    case RENDER_ERR_FILE:
        echo 'Cound not read the file! - ', RENDER_ERR_FILE;
        break;
    default:
}
if (isset($modules[$module]['post-process']) && !empty($modules[$module]['post-process'])) {
    $feedback_post = load_deps(get_deps($modules, $module, MODULES_ROOT, 'post-process'), compact('modules', 'module', 'feedback', 'feedback_pre'));
    if ($feedback_post == ERR_LOAD_FILE) {
        echo ERR_LOAD_FILE;
        exit;
    }
}
/* vim: set ts=4 sw=4 tw=80 sts=4 fdm=marker nowrap et :*/
Пример #2
0
/**
 * Get (in a recursive manner) a module's dependendencies
 *
 * Walk the dependency arrays and push every file path onto a stack
 *
 * @param array $modules the complete list of modules
 * @param array $module of which the deps should be loaded
 * @param array $modules_root path to the directory where the modules lay(with a
 * DIRECTORY_SEPARATOR at the end)
 * @param array $stack the stack that will store the paths to the dependencies
 * @param string $part get either post-process or pre-process dependencies
 *
 * @return $stack return the complete list of dependencies
 */
function get_deps($modules, $module, $modules_root, $part = 'pre-process', $stack = array())
{
    foreach ($modules[$module][$part] as $meta => $dep) {
        if (FALSE != stristr($dep, '.php')) {
            $stack[] = array($meta => $modules_root . $module . DIRECTORY_SEPARATOR . $dep);
        } else {
            $stack = get_deps($modules, $dep, $modules_root, $part, $stack);
        }
    }
    return $stack;
}