function testRegister() { Flight::path(__DIR__ . '/classes'); Flight::register('test', 'TestClass'); $test = Flight::test(); $loaders = spl_autoload_functions(); $this->assertTrue(sizeof($loaders) > 0); $this->assertTrue(is_object($test)); $this->assertEquals('TestClass', get_class($test)); }
function testRegister() { Flight::path(__DIR__ . '/classes'); Flight::register('user', 'User'); $user = Flight::user(); $loaders = spl_autoload_functions(); $this->assertTrue(sizeof($loaders) > 0); $this->assertTrue(is_object($user)); $this->assertEquals('User', get_class($user)); }
<?php date_default_timezone_set('America/New_York'); require_once 'flight/Flight.php'; require_once 'vendor/github/GitHubClient.php'; // Autoload models and controllers Flight::path('models'); Flight::path('controllers'); Flight::path('models/division_structures'); // Set views path and environment Flight::set('flight.views.path', 'views'); Flight::set('root_dir', dirname(__FILE__)); Flight::set('base_url', '/Division-Tracker/'); // Set database credentials define('DB_HOST', ''); define('DB_USER', ''); define('DB_PASS', ''); define('ARCH_PASS', ''); Flight::register('aod', 'Database', array('aod')); // defines for website URLs define('CLANAOD', 'http://www.clanaod.net/forums/member.php?u='); define('BATTLELOG', 'http://battlelog.battlefield.com/bfh/agent/'); define('BATTLEREPORT', 'http://battlelog.battlefield.com/bf4/battlereport/show/1/'); define('BF4DB', 'http://bf4db.com/players/'); define('PRIVMSG', 'http://www.clanaod.net/forums/private.php?do=newpm&u='); define('EMAIL', 'http://www.clanaod.net/forums/sendmessage.php?do=mailmember&u='); define('REMOVE', 'http://www.clanaod.net/forums/modcp/aodmember.php?do=remaod&u='); // defines for BF4 division activity status display define('PERCENTAGE_CUTOFF_GREEN', 75); define('PERCENTAGE_CUTOFF_AMBER', 50); define('INACTIVE_MIN', 0);
<?php ini_set('display_errors', 'On'); error_reporting(E_ALL); require '../flight/Flight.php'; Flight::path(__DIR__ . '/src'); Flight::path(__DIR__ . '/../src'); Flight::route('/', function () { echo 'hello world!operation'; }); Flight::route('POST /test/', function () { $t = new operation\src\PackageOperation(); $t->test(); }); Flight::route('POST /install/', function () { $t = new operation\src\PackageOperation(); $t->install(); }); Flight::route('POST /update/', function () { $t = new operation\src\PackageOperation(); $t->update(); }); Flight::route('POST /rollback/', function () { $t = new operation\src\PackageOperation(); $t->rollback(); }); Flight::route('POST /maintenance/', function () { $t = new operation\src\PackageOperation(); $t->maintenance(); }); Flight::route('GET /get_task_result/', function () {
<?php define("START_TIME", microtime()); define("APP_PATH", __DIR__ . "/../app"); require __DIR__ . "/../vendor/autoload.php"; Flight::set(require APP_PATH . "/config/app.php"); Flight::path(Flight::get("flight.controllers.path")); Flight::path(Flight::get("flight.models.path")); Flight::path(Flight::get("flight.libs.path"));
Flight::register('view', 'Twig_Environment', array($loader, $twigConfig), function ($twig) { $twig->addExtension(new Twig_Extension_Debug()); // Add the debug extension }); /** * Initiate ActiveRecord */ ActiveRecord\Config::initialize(function ($cfg) { $cfg->set_model_directory('./models'); $cfg->set_connections(array('development' => 'mysql://*****:*****@localhost/test')); $cfg->set_default_connection('development'); }); /** * Add /controllers to the include-path */ Flight::path(dirname(__FILE__) . '/controllers'); Flight::route('/', array('IndexController', 'index')); Flight::route('/test', function () { echo "hello!"; }); Flight::route('/test-user', function () { $user = new User(); $user->firstname = 'Marcus'; $user->surname = 'Olsson'; $user->email = '*****@*****.**'; $user->save(); print_r(User::last()); }); Flight::route('/hello', function () { $data = array('name' => Flight::request()->query->name); Flight::view()->display('template.html', $data);
<?php Flight::path("model/"); Flight::path("controller/"); Flight::register('db', 'mysqli', [$config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['databasename']]); Flight::register("util", "util"); Flight::register("auth", "authController"); Flight::register("posts", "postController"); Flight::register("users", "userController"); Flight::set("flight.base_url", $config['web']['base_url']); Flight::map('link', function ($url) { echo Flight::get('flight.base_url') . $url; });
<?php date_default_timezone_set('America/New_York'); require_once 'flight/Flight.php'; require_once 'vendor/github/GitHubClient.php'; // Autoload models and controllers Flight::path('models'); Flight::path('controllers'); // Set views path and environment Flight::set('flight.views.path', 'views'); Flight::set('root_dir', dirname(__FILE__)); Flight::set('base_url', '/Division-Tracker/'); // Set database credentials define('DB_HOST', ''); define('DB_USER', ''); define('DB_PASS', ''); define('ARCH_PASS', ''); Flight::register('aod', 'Database', array('aod')); // defines for website URLs define('CLANAOD', 'http://www.clanaod.net/forums/member.php?u='); define('BATTLELOG', 'http://battlelog.battlefield.com/bfh/agent/'); define('BATTLEREPORT', 'http://battlelog.battlefield.com/bf4/battlereport/show/1/'); define('BF4DB', 'http://bf4db.com/players/'); define('PRIVMSG', 'http://www.clanaod.net/forums/private.php?do=newpm&u='); define('EMAIL', 'http://www.clanaod.net/forums/sendmessage.php?do=mailmember&u='); define('REMOVE', 'http://www.clanaod.net/forums/modcp/aodmember.php?do=remaod&u='); // defines for BF4 division activity status display define('PERCENTAGE_CUTOFF_GREEN', 75); define('PERCENTAGE_CUTOFF_AMBER', 50); define('INACTIVE_MIN', 0); define('INACTIVE_MAX', 25);
<?php \Flight::set('flight.views.path', __DIR__ . '/../views'); \Flight::path(__DIR__ . '/../controllers'); $connection = new PDO('mysql:host=localhost;dbname=tbzsn', 'root', ''); $db = new \ClanCats\Hydrahon\Builder('mysql', function ($query, $queryString, $queryParameters) use($connection) { $statement = $connection->prepare($queryString); $statement->execute($queryParameters); if ($query instanceof \ClanCats\Hydrahon\Query\Sql\Select) { return $statement->fetchAll(\PDO::FETCH_ASSOC); } }); echo $db->table('users')->select('username')->count();
<?php /** * Include and set up FlightPHP */ $dir = dirname(__FILE__); if (!class_exists('Flight')) { require $dir . '/flight/flight/Flight.php'; // path for classes Flight::path($dir . '/classes'); // set the path for view files Flight::set('flight.views.path', $dir . '/views'); }
<?php Flight::path("controllers/"); Flight::path("classes/"); Flight::register('db', 'mysqli', [$config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['databasename']]); Flight::register('auth', 'auth'); Flight::register('util', 'util'); Flight::register('absence', 'absenceController'); Flight::register('events', 'eventController'); Flight::register('players', 'playerController'); Flight::register('teams', 'teamController'); Flight::register('users', 'userController'); Flight::set("flight.base_url", $config['web']['base_url']); Flight::map('link', function ($url) { echo Flight::get('flight.base_url') . $url; }); Flight::map('noAccess', function () { Flight::util()->render('noAccess'); die; }); Flight::map('notFound', function () { Flight::util()->render('404'); die; }); Flight::map('notLogedIn', function () { Flight::util()->render('notLogedIn'); die; });
<?php /** * @package ArtMoi Wordpress Plugin * @version 1.0 */ /* Plugin Name: ArtMoi Wordpress Plugin Description: Plugin for syncing your ArtMoi account with Wordpress Media Files Version: 1.0 Author URI: http://artmoi.com */ // Require flight require dirname(__FILE__) . '/vendor/flight/flight/Flight.php'; // Set the search path for flight registered classes Flight::path(dirname(__FILE__) . '/classes'); // Set the view folder for flight Flight::set('flight.views.path', dirname(__FILE__) . '/views'); // Register classes with flight Flight::register('artmoi', 'Artmoi_Request'); Flight::register('response', 'Artmoi_response'); Flight::register('controller', 'Artmoi_Controller'); Flight::register('item', 'Artmoi_Item'); class ArtMoi_WP { /** * constructor */ public function __construct() { // Load admin menu and pages
<?php define('START_TIME', microtime()); define('APP_PATH', __DIR__ . '/../app'); require __DIR__ . '/../vendor/autoload.php'; //include helpers.php require APP_PATH . '/core/helpers.php'; //Load Dotenv $dotenv = new Dotenv\Dotenv(__DIR__ . '/../'); $dotenv->load(); Flight::set(require APP_PATH . '/config/app.php'); //setting url case_sensitive, default false Flight::set('flight.case_sensitive', true); /*----- Flight autoload start -----*/ //controllers Flight::path(Flight::get('flight.controllers.path')); //models Flight::path(Flight::get('flight.models.path')); //core Flight::path(Flight::get('flight.core.path')); /*----- Flight autoload end -----*/