require '../app/Autoloader.php'; App\Autoloader::register(); if (isset($_COOKIE['lang'])) { $lang = htmlspecialchars($_COOKIE['lang']); if ($lang == "fr") { require_once "lang/fr.php"; } else { if ($lang == "en") { require_once "lang/en.php"; } } } else { require_once "lang/fr.php"; } // Instanciation des classes utiles en singleton $app = App\App::getInstance($translator); $config = App\Config::getInstance(); $debug = App\Debug::getInstance(); $form = App\Components\Form::getInstance(); $user = App\Table\User::getInstance($translator); // $db = new App\Database('blog'); // On inclut la page if (isset($_GET['page'])) { $page = $app::DestroyHTML($_GET['page']); if (file_exists("../pages/" . $page . ".php")) { require_once "../pages/" . $page . ".php"; } else { require_once "../pages/404.php"; } } else {
<?php // Paths define('ROOT', dirname(__DIR__)); define('CSSROOT', str_replace('/var/www/html', '', dirname(__DIR__)) . '/public/css'); // Autoloading require ROOT . '/app/App.php'; App\App::load(); isset($_GET['page']) ? $page = $_GET['page'] : ($page = 'post.index'); $page = explode('.', $page); if ($page[0] == 'admin') { $controller = '\\App\\Controller\\Admin\\' . ucfirst($page[1]) . 'Controller'; $action = $page[2]; } else { $controller = '\\App\\Controller\\' . ucfirst($page[0]) . 'Controller'; $action = $page[1]; } $controller = new $controller(); $controller->{$action}();
$debugbar = new StandardDebugBar(); $debugbar->addCollector(new DebugBar\Bridge\SlimCollector($app)); $loader = new Twig_Loader_Filesystem('.'); $env = new DebugBar\Bridge\Twig\TraceableTwigEnvironment(new Twig_Environment($loader)); $debugbar->addCollector(new DebugBar\Bridge\Twig\TwigCollector($env)); $debugbarRenderer = $debugbar->getJavascriptRenderer(); $view->appendData(['debugbarRenderer' => $debugbarRenderer]); /* -- */ $view->parserOptions['debug'] = true; $view->parserExtensions = array(new \Slim\Views\TwigExtension(), new \Twig_Extension_Debug()); /*$app->get('/', function() use($app) { $app->render('index.twig'); });*/ $app->get('/', function () use($app) { $em = new \App\EntityManager('news'); $news = $em->findAll(); $app->render('index.twig', compact('news')); })->name('home'); /** Inject variable into twig **/ $folders = App\App::getFolders(); $view->appendData(['navigation' => $folders]); $router = new App\ConfigManager(); $view->appendData(['router' => $router]); /** ---- **/ require "routes.php"; /** Inject variable into twig **/ $site = App\App::getConfig('site'); $view->appendData(['site' => $site]); /** ---- **/ //$app->get('/emix/:article', 'App\AppController:test')->name('news.show'); $app->run();
<?php try { require __DIR__ . '/conf/constants.php'; require __BASEDIR__ . '/vendor/autoload.php'; $app = new App\App(); $app->validConf(); $app->run(); } catch (Exception $e) { $app->catchException($e); }
<?php /** * Created by PhpStorm. * User: Colls * Date: 07.09.15 * Time: 15:28 */ require_once __DIR__ . '/vendor/autoload.php'; $familyConfig = (include __DIR__ . "/config/config.php"); $logPath = __DIR__ . "/log/travel.log"; $generator = new \App\PeopleGenerator($familyConfig); $travellers = $generator->run(); $app = new \App\App($travellers); $app->getLog()->setPath($logPath); $app->run();
<?php /** * SyDES - Lightweight CMF for a simple sites with SQLite database * * @package SyDES * @copyright 2011-2016, ArtyGrand <artygrand.ru> * @license GNU GPL v3 or later; see LICENSE */ session_start(); mb_internal_encoding('UTF-8'); if (!isset($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = token(16); } $app = App\App::getInstance(); $handler = new App\Exception\Handler(); $app['exception_handler'] = function () { return new App\Exception\ExceptionHandler(); }; $app['request'] = function () { return App\Http\Request::capture(); }; $app['cache'] = function () { return new App\Cache(DIR_CACHE); }; $app['translator'] = function () { return new App\Translator(); }; $app['event'] = function () { return new App\Event(); };
/** * Determines whether service object is authenticated. * * @return boolean True if service object is authenticated, false otherwise. */ public function isAuthenticated() { $client = parent::getHttpClient(); if ($client->getClientLoginToken() || $client->getAuthSubToken()) { return true; } return false; }
<?php require_once __DIR__ . '/../vendor/autoload.php'; //Kui app on kävitatud //Kuvame erroreid error_reporting(E_ALL); ini_set('display_errors', 1); $config = (include __DIR__ . '/../../config_kaubamaja.php'); $app = new App\App($config); $app->run($_REQUEST);
$apps = App\App::where('platform', $platform)->Paginate(15); } else { $apps = App\App::where('platform', $platform)->where('cid', $category)->Paginate(15); } return view('app')->with(compact('categories', 'apps', 'platform', 'category')); }]); //详情页面 Route::get('/detail/{id}', ['as' => 'detail', function ($id) { $app = App\App::findOrFail($id); return view('detail')->with(compact('app')); }]); //搜索列表 Route::get('/search/{q}', ['as' => 'search', function ($q) { $category = 'all'; $platform = 'android'; $categories = App\AppCategory::all(); $apps = App\App::where('name_chn', 'like', '%' . $q . '%')->orWhere('name_eng', 'like', '%' . $q . '%')->Paginate(15); return view('search')->with(compact('apps', 'categories', 'category', 'platform', 'q')); }]); //下载 Route::get('/download/{id}', ['as' => 'download', function ($id) { $app = App\App::findOrFail($id); $app->increment('downloads', 1); //下载加1 $pathToFile = base_path() . '/public/' . $app->source; if (strpos($app->source, 'https') === false) { return response()->download($pathToFile); } else { return redirect($app->source); } }]);
static function init() { if (!defined('HIANO_APP_PATH')) { die('ERROR:HIANO_APP_PATH undefined!'); } spl_autoload_register(array('Hiano\\ClassLoader', 'load')); if (App\App::getConfig()->get('debug.enable', false)) { $debug_config = App\App::getConfig()->get('debug'); error_reporting($debug_config['error_reporting']); unset($debug_config); } else { error_reporting(0); } if (App\App::getConfig()->get('timezone')) { date_default_timezone_set(App\App::getConfig()->get('timezone')); } if ($session_path = App\App::getConfig()->get('session_path')) { //todo load and register SessionDriver //$session_driver = Hiano::loadDriver('\\Hiano\\') //\Hiano\Session\SessionManager::register(); } //\Hiano\App\App::registerModelPath(HIANO_APP_PATH . '/widgets/models'); $app_path = realpath(HIANO_APP_PATH); \Hiano\App\App::registerModelPath($app_path . '/Model'); \Hiano\App\App::registerImportPath($app_path . '/Include'); App\App::setErrorHandler(function ($ex) { /* @var $ex \Hiano\ErrorException */ throw new \Exception("Error[{$ex->getCode()}]:" . $ex->getMessage()); }); App\App::setRedirectHandler(function ($ex) { /* @var $ex \Hiano\RedirectException */ header('Location:' . $ex->getRedirectUrl()); }); }
/** * Throw an HttpException with the given data. * * @param int $code * @param string $message * @throws App\Exception\HttpException */ function abort($code, $message = '') { App\App::getInstance()->abort($code, $message); }
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content="lorenzo"> <link rel="stylesheet" href="<?php echo CSSROOT . '/master.css'; ?> " charset="utf-8"> <title><?php echo App\App::getInstance()->title; ?> </title> </head> <body> <div class="top-bar"> <div class="top-bar-left"> <ul class="menu"> <li class="menu-text">Site Title</li> <li><a href="index.php">Home</a></li> <li><a href="#">One</a></li> <li><a href="#">Two</a></li> <li><a href="#">Three</a></li> </ul> </div> </div> <div class="container"> <?php echo $content;
<?php /** * @copyright Copyright (C) 2012 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Define required paths define('JPATH_BASE', dirname(__DIR__)); define('JPATH_CONFIGURATION', JPATH_BASE . '/App/Config'); define('JPATH_SETUP', JPATH_BASE . '/App/Setup'); define('JPATH_ROOT', JPATH_BASE); define('JPATH_SITE', JPATH_BASE); define('JPATH_THEMES', JPATH_BASE . '/www/themes'); define('JPATH_TEMPLATES', JPATH_BASE . '/App/Templates'); // Load the Composer autoloader require JPATH_BASE . '/vendor/autoload.php'; // Load the Joomla Framework require JPATH_BASE . '/vendor/joomla/framework/src/import.php'; // Instantiate the application. $application = new App\App(); // Execute the application. $application->execute();
<?php require_once __DIR__ . '/autoloader.php'; ini_set('max_execution_time', 50); $di = new Zend\Di\Di(); $app = new App\App($di); $app->run();
<?php error_reporting(E_ALL); ini_set('display_errors', 'on'); define('ROOT', dirname(__DIR__)); require ROOT . '/vendor/autoload.php'; App\App::getInstance()->start();