/** * Example: overrride render method to add content * @return * @param object $view */ protected function render(array $view) { $user = $this->user->getApp_user_name(); // hack: user is logged in if ($user) { $xtra = sprintf('<ul><li><a href="%s">Layer action "test"</a></li>', $this->getActionUrl('test')); $xtra .= sprintf('<li><a href="%s">Test Two legged OAuth call</a></li>', $this->getActionUrl('two_legged')); $xtra .= sprintf('<li><a href="%s">Test Three legged OAuth call</a></li></ul>', $this->getActionUrl('three_legged')); $view['content'] = $xtra . $view['content']; } parent::render($view); }
$fi = __DIR__ . '/app/controllers/admin/' . $class; if (file_exists($fi)) { require $fi; } } } } spl_autoload_register('__autoload', true, false); //require require_once __DIR__ . '/app/WebConfig.php'; require_once __DIR__ . '/app/WebSession.php'; require_once __DIR__ . '/app/WebUser.php'; require_once __DIR__ . '/app/WebApp.php'; //create Web Appication $app = new WebApp($CONFIGS); $app->config('rewrite_r', $rewrite_r); $app->config('view', new \Slim\Views\Twig()); $app->config('web_dir', __DIR__); $app->notFound(function () use($app) { $app->render('not_found.twig'); }); $app->any('/auth/(:args+)', function ($args = null) use($app) { $app->default_webapp_handler($app, $args); }); $app->any('/admin/(:args+)', array($app, 'Authenticate'), function ($args = null) use($app) { $app->default_webapp_handler($app, $args, 'admin'); }); $app->any('/(:args+)', function ($args = null) use($app) { $app->default_webapp_handler($app, $args); }); $app->run();