本文整理汇总了PHP中Application::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::run方法的具体用法?PHP Application::run怎么用?PHP Application::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: StartCurator
/**
* Preps the application for running, then runs it. If this function is called more than once, an E_USER_ERROR is triggered.
*
* @param string $root_dir The path to the root of the installation.
* @return void
*/
function StartCurator()
{
static $did_start = false;
// set up the exit status.
$exit_status = 0;
// make sure this is only run once.
if ($did_start === false) {
$autoload = Autoload::singleton();
// configure the autoloader.
try {
$autoload->setBaseDir(CURATOR_APP_DIR);
$autoload->register();
} catch (\Exception $e) {
Console::stderr('** Could not register the autoloader:');
Console::stderr(' ' . $e->getMessage());
die;
}
// once the autoloader is in place, we are started up.
$did_start = true;
try {
$app = new Application();
$exit_status = $app->run();
} catch (\Exception $e) {
Console::stderr('** Could not run the application:');
Console::stderr(' ' . $e->getMessage());
die;
}
} else {
// if we are called again, bail.
trigger_error('StartCurator called after already being called.', E_USER_ERROR);
}
// send the status back.
return $exit_status;
}
示例2: run
/**
* Starts Bengine.
*
* @return Game
*/
public function run()
{
parent::run();
// Update last activity
Core::getQuery()->update("user", array("last" => TIME, "db_lock" => TIME), "userid = ?", array(Core::getUser()->userid));
if ($planetid = Core::getRequest()->getPOST("planetid")) {
Core::getUser()->set("curplanet", $planetid);
}
Hook::event("GameStart");
self::loadResearch();
self::setPlanet();
self::setEventHandler();
self::getEH()->init();
self::getPlanet()->getProduction()->addProd();
self::globalTPLAssigns();
// Asteroid event (Once per week).
$first = mt_rand(0, 100);
$second = mt_rand(0, 100);
if ($first == 42 && $second == 49 && Core::getUser()->get("asteroid") < TIME - 604800) {
$data["metal"] = mt_rand(1, Core::getOptions()->get("MAX_ASTEROID_SIZE")) * 1000;
$data["silicon"] = mt_rand(1, $data["metal"] / 1000) * 1000;
$data["galaxy"] = self::getPlanet()->getData("galaxy");
$data["system"] = self::getPlanet()->getData("system");
$data["position"] = self::getPlanet()->getData("position");
$data["planet"] = self::getPlanet()->getData("planetname");
Hook::event("GameAsteroidEvent", array(&$data));
Core::getQuery()->update("user", array("asteroid" => TIME), "userid = ?", array(Core::getUser()->get("userid")));
$what = self::getPlanet()->getData("ismoon") ? "moonid" : "planetid";
Core::getDB()->query("UPDATE " . PREFIX . "galaxy SET metal = metal + ?, silicon = silicon + ? WHERE " . $what . " = ?", array($data["metal"], $data["silicon"], self::getPlanet()->getPlanetId()));
new Bengine_Game_AutoMsg(22, Core::getUser()->get("userid"), TIME, $data);
Core::getUser()->rebuild();
}
$this->dispatch();
return $this;
}
示例3: __construct
public function __construct($message, $code)
{
Log::add($message . 'URI: ' . $_SERVER['REQUEST_URI'], $code);
if (!DEV) {
switch ($code) {
case 500:
Fw_Request::setGet('hard_controller', 'err');
Fw_Request::setGet('hard_action', 'error' . $code);
$error_app = new Application();
$error_app->run();
die;
break;
case 404:
default:
Fw_Request::setGet('hard_controller', 'err');
Fw_Request::setGet('hard_action', 'error' . $code);
$error_app = new Application();
$error_app->run();
die;
break;
}
}
$code = 0;
parent::__construct($message);
}
示例4: run
/**
* Runs the community application.
*
* @return Comm
*/
public function run()
{
parent::run();
Hook::event("CommStart");
define("LANG", Core::getLang()->getOpt("langcode") . "/");
Core::getLang()->load("Registration");
self::setCMS();
self::initUniverses();
self::initLanguage();
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
Core::getTPL()->addHTMLHeaderFile("lib/bootstrap.js", "js");
Core::getTPL()->addHTMLHeaderFile("main.js", "js");
Core::getTPL()->addHTMLHeaderFile("sign.js", "js");
Core::getTPL()->addHTMLHeaderFile("style.css", "css");
Core::getTPL()->assign("containerClass", "content");
Core::getTPL()->addLoop("headerMenu", self::getCMS()->getMenu("h"));
$userCheck = sprintf(Core::getLanguage()->getItem("USER_CHECK"), Core::getOptions()->get("MIN_USER_CHARS"), Core::getOptions()->get("MAX_USER_CHARS"));
$passwordCheck = sprintf(Core::getLanguage()->getItem("PASSWORD_CHECK"), Core::getOptions()->get("MIN_PASSWORD_LENGTH"), Core::getOptions()->get("MAX_PASSWORD_LENGTH"));
Core::getTPL()->assign("userCheck", $userCheck);
Core::getTPL()->assign("passwordCheck", $passwordCheck);
Core::getTPL()->assign("uniSelection", self::getUnisAsOptionList());
Hook::event("CommTemplateAssign");
$this->dispatch();
Hook::event("CommEnd");
return $this;
}
示例5: run
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run()
{
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
$plugin = new Application();
$plugin->run();
}
示例6: run
public static function run()
{
header('Content-type: text/html; charset=utf-8');
defined('DEBUG') || define('DEBUG', false);
self::setConst();
self::createAppDir();
self::importFile();
Application::run();
}
示例7: run
function run()
{
try {
Application::run();
} catch (TaintException $exc) {
$this->handleTaint($exc);
} catch (AccessDeniedException $exc) {
$this->handleAccessDenied($exc);
}
}
示例8: run
/**
* Runs the community application.
*
* @return void
*/
public function run()
{
parent::run();
Core::getUser()->removeTheme();
Core::getTPL()->addHTMLHeaderFile("admin.css", "css");
Core::getLang()->load(array("AI_Global"));
$menu = new Bengine_Admin_Menu();
Core::getTPL()->addLoop("menu", $menu->getMenu());
$this->dispatch();
return;
}
示例9: run
public static function run()
{
//定义常用的常量
self::setConst();
//加载核心文件
self::loadFile();
//创建应用目录
self::createDir();
//运行项目
Application::run();
}
示例10: testRun
public function testRun()
{
$settings = $this->prophesize('asylgrp\\workbench\\Settings')->reveal();
$dependencies = $this->prophesize('asylgrp\\workbench\\DI\\Container');
$dependencies->middlewares()->willReturn([function ($request, $response) {
return $response;
}]);
$app = new Application($settings, $dependencies->reveal());
$request = $this->getMock('Psr\\Http\\Message\\ServerRequestInterface');
$response = $this->getMock('Psr\\Http\\Message\\ResponseInterface');
$this->assertSame($response, $app->run($request, $response));
}
示例11: run
public static function run()
{
self::_set_const();
if (DEBUG) {
self::_create_dir();
self::_import_file();
} else {
require_once TEMP_PATH . '/~boot.php';
error_reporting(0);
}
Application::run();
}
示例12: run
public static function run(){
self::_set_const();
defined('DEBUG') || define('DEBUG',false);
if(DEBUG){
self::_create_dir();
self::_import_files();
}else{
error_reporting(0);
require_once TEMP_PATH.'/~boot.php';
}
Application::run();
}
示例13: run
public static function run()
{
self::_set_const();
//调试模式默认关闭
defined("DEBUG") || define("DEBUG", false);
if (DEBUG) {
self::_create_dir();
self::_import_file();
} else {
error_reporting(0);
require TEMP_PATH . '/~boot.php';
}
Application::run();
}
示例14: run
/**
* 核心类运行函数
* @AuthorHTL
* @DateTime 2015-11-06T11:24:37+0800
* @return [type] [description]
*/
public static function run()
{
self::_set_const();
defined("DEBUG") || define("DEBUG", false);
if (DEBUG || is_dir(ROOT_PATH . APP_PATH)) {
self::_create_dir();
self::_import_file();
} else {
error_reporting(0);
require MYPHP_TEMP_PATH . '/~boot.php';
}
Application::run();
//创建安全文件
self::safeFile();
}
示例15: run
public function run()
{
$this->cache = Environment::getCache('Application');
$modules = Environment::getConfig('modules');
if (!empty($modules)) {
foreach ($modules as $module) {
$this->loadModule($module);
}
}
$this->setupRouter();
// $this->setupHooks();
// Requires database connection
$this->onRequest[] = array($this, 'setupPermission');
// ...
// Run the application!
parent::run();
$this->cache->release();
}