function ossn_load_page($handler, $page)
{
    global $Ossn;
    ossn_add_context($handler);
    $page = explode('/', $page);
    if (isset($Ossn->page) && isset($Ossn->page[$handler]) && !empty($handler) && is_callable($Ossn->page[$handler])) {
        ob_start();
        call_user_func($Ossn->page[$handler], $page, $handler);
        $contents = ob_get_clean();
        $params['page'] = $page;
        $params['handler'] = $handler;
        return ossn_call_hook('page', 'load', $params, $contents);
    } else {
        return ossn_error_page();
    }
}
Ejemplo n.º 2
0
/**
 * Output a page.
 *
 * If page is not registered then user will see a 404 page;
 *
 * @param  (string) $handler Page handler name;
 * @param  (string) $page  handler/page;
 * @last edit: $arsalanshah
 * @Reason: Initial;
 *
 * @return mix|null data
 * @access private
 */
function ossn_load_page($handler, $page)
{
    global $Ossn;
    $context = $handler;
    if (isset($page) && !empty($page)) {
        $context = "{$handler}/{$page}";
    }
    //set context
    ossn_add_context($context);
    $page = explode('/', $page);
    if (isset($Ossn->page) && isset($Ossn->page[$handler]) && !empty($handler) && is_callable($Ossn->page[$handler])) {
        //get page contents
        ob_start();
        call_user_func($Ossn->page[$handler], $page, $handler);
        $contents = ob_get_clean();
        //supply params to hook
        $params['page'] = $page;
        $params['handler'] = $handler;
        return ossn_call_hook('page', 'load', $params, $contents);
    } else {
        return ossn_error_page();
    }
}