本文整理汇总了PHP中Application类的典型用法代码示例。如果您正苦于以下问题:PHP Application类的具体用法?PHP Application怎么用?PHP Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetFormRequestPost
function testGetFormRequestPost()
{
$app = new Application();
$_POST['post'] = "Today I learnt that you can only treat your friends so badly before they quit working for you and go and work for Halutte(sp)";
$array = $app->getArrayFromRequest();
$this->assertEquals("Today I learnt that you can only treat your friends so badly before they quit working for you and go and work for Halutte(sp)", $array['post']);
}
示例2: __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);
}
示例3: post
/**
* Implementation for 'POST' method for Rest API
*
* @param mixed $appUid Primary key
*
* @return array $result Returns array within multiple records or a single record depending if
* a single selection was requested passing id(s) as param
*/
protected function post($appUid, $appNumber, $appParent, $appStatus, $proUid, $appProcStatus, $appProcCode, $appParallel, $appInitUser, $appCurUser, $appCreateDate, $appInitDate, $appFinishDate, $appUpdateDate, $appData, $appPin)
{
try {
$result = array();
$obj = new Application();
$obj->setAppUid($appUid);
$obj->setAppNumber($appNumber);
$obj->setAppParent($appParent);
$obj->setAppStatus($appStatus);
$obj->setProUid($proUid);
$obj->setAppProcStatus($appProcStatus);
$obj->setAppProcCode($appProcCode);
$obj->setAppParallel($appParallel);
$obj->setAppInitUser($appInitUser);
$obj->setAppCurUser($appCurUser);
$obj->setAppCreateDate($appCreateDate);
$obj->setAppInitDate($appInitDate);
$obj->setAppFinishDate($appFinishDate);
$obj->setAppUpdateDate($appUpdateDate);
$obj->setAppData($appData);
$obj->setAppPin($appPin);
$obj->save();
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
}
示例4: __construct
/**
* Конструктор (проверка авторизации):
*/
public function __construct(Application $application, Template $template)
{
$session = Session::getInstance();
if (!$session->isAdminSession()) {
die($application->go('errors_error403'));
}
}
示例5: AdminList
public function AdminList(\Application $application)
{
$ret = '<h1>Manage plugins</h1>
<div class="table-wrapper"><form action="" method="POST"><table><tr><th>Plugin Name</th><th>Active</th><th>Description</th><th>Version</th></tr>';
$installed = $this->model->InstalledPlugins();
foreach ($this->model->GetAvailablePlugins() as $available => $facade) {
$data = $application->GetPluginMeta($available);
if (!in_array($available, $application->GetConstantPlugins())) {
$ret .= '<tr><td>' . (!empty($data->Name) ? $data->Name : $available) . '</td>
<td>
<div class="onoffswitch">
<input type="hidden" name="plugin[' . $available . '][action]" value="' . (!in_array($available, $installed) ? 'uninstalled' : '') . '"/>
<input type="checkbox" name="plugin[' . $available . '][value]" id="myonoffswitch_' . $available . '" class="onoffswitch-checkbox checkbox-submit" ' . (in_array($available, $installed) ? 'checked="checked"' : '') . '/>
<label class="onoffswitch-label" for="myonoffswitch_' . $available . '">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
<td>' . (!empty($data->Description) ? $data->Description : '<em>Unavailable</em>') . '</td>
<td>' . (!empty($data->Version) ? $data->Version : '<em>Unavailable</em>') . '</td></tr>';
}
}
return $ret . '</table></div><input type="hidden" name="placeholder" value="1"/><button type="submit" name="submit">Submit</button></form>';
}
示例6: createDatabase
private static function createDatabase()
{
$application = new Application(static::$kernel);
// drop the database
$command = new DropDatabaseDoctrineCommand();
$application->add($command);
$input = new ArrayInput(array('command' => 'doctrine:database:drop', '--force' => true));
$command->run($input, new NullOutput());
// we have to close the connection after dropping the database
// so we don't get "No database selected" error
$connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection();
if ($connection->isConnected()) {
$connection->close();
}
// create the database
$command = new CreateDatabaseDoctrineCommand();
$application->add($command);
$input = new ArrayInput(array('command' => 'doctrine:database:create'));
$command->run($input, new NullOutput());
// create the database
$command = new CreateSchemaDoctrineCommand();
$application->add($command);
$input = new ArrayInput(array('command' => 'doctrine:schema:create', '--em' => 'default'));
$command->run($input, new NullOutput());
// get the Entity Manager
$em = static::$kernel->getContainer()->get('doctrine')->getManager();
// load fixtures
$client = static::createClient();
$loader = new ContainerAwareLoader($client->getContainer());
$loader->loadFromDirectory(static::$kernel->locateResource('@MainBundle/DataFixtures/ORM'));
$purger = new ORMPurger($em);
$executor = new ORMExecutor($em, $purger);
$executor->execute($loader->getFixtures());
}
示例7: __construct
/**
* @param array $app
* @param array $config
* @throws AppException
*/
public function __construct($app, $config = array())
{
parent::__construct($app, $config);
$this->_jbrequest = $this->app->jbrequest;
$task = $this->_jbrequest->getWord('task');
$ctrl = $this->_jbrequest->getCtrl();
if (!method_exists($this, $task)) {
throw new AppException('Action method not found! ' . $ctrl . ' :: ' . $task . '()');
}
// internal vars
$this->application = $this->app->zoo->getApplication();
$this->_params = $this->application->getParams('frontpage');
$this->joomla = $this->app->system->application;
$isSite = $this->app->jbenv->isSite();
if (!$isSite) {
$this->app->document->addStylesheet("root:administrator/templates/system/css/system.css");
$this->app->jbassets->uikit(true, true);
$this->_setToolbarTitle();
} else {
$this->params = $this->joomla->getParams();
$this->pathway = $this->joomla->getPathway();
$this->app->jbassets->setAppCSS();
$this->app->jbassets->setAppJS();
}
$this->_config = JBModelConfig::model();
}
示例8: createResponse
/**
* {@inheritdoc}
*/
public function createResponse(Application $application, Request $request, Socket $socket) : Response
{
if (!$request->hasHeader('Sec-WebSocket-Key')) {
$sink = new MemorySink('No WebSocket key header provided.');
return new BasicResponse(Response::BAD_REQUEST, ['Connection' => 'close', 'Content-Length' => $sink->getLength()], $sink);
}
$headers = ['Connection' => 'upgrade', 'Upgrade' => 'websocket', 'Sec-WebSocket-Accept' => $this->responseKey(trim($request->getHeader('Sec-WebSocket-Key')))];
if ($application instanceof SubProtocol) {
$protocol = $application->selectSubProtocol(array_map('trim', explode(',', $request->getHeader('Sec-WebSocket-Protocol'))));
if (strlen($protocol)) {
$headers['Sec-WebSocket-Protocol'] = $protocol;
}
}
/*
$extensions = $application->selectExtensions(
array_map('trim', explode(',', $request->getHeader('Sec-WebSocket-Extensions')))
);
if (!empty($extensions)) {
$headers['Sec-WebSocket-Extensions'] = $extensions;
}
*/
$response = new BasicResponse(Response::SWITCHING_PROTOCOLS, $headers);
$connection = $this->createConnection($response, $socket, false);
return new WebSocketResponse($application, $connection, $response);
}
示例9: 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;
}
示例10: __construct
/**
*
* @param clagiordano\weblibs\mvc\Application $application
* @return clagiordano\weblibs\mvc\Controller
*/
public function __construct(Application $application)
{
$this->application = $application;
$this->request = new Request();
$this->application->getRegistry()->requestType = $this->request->getType();
$this->application->getRegistry()->requestData = $this->request->getData();
}
示例11: Application
/**
Get core application class
@public
**/
static function &getApplication()
{
static $app;
// create if don't exists
if (!is_object($app)) {
// single app instance only
if (isset($GLOBALS['_globalapp'])) {
$app = $GLOBALS['_globalapp'];
} else {
$app = new Application();
// config
$config =& Factory::getConfig();
$app->set('config', $config);
// authentication
$auth =& Factory::getAuth();
$app->set('auth', $auth);
// set our timezone
if (isset($config->timezone)) {
@(list($tz_script, $tz_db) = explode('|', $config->timezone));
date_default_timezone_set($tz_script);
}
$GLOBALS['_globalapp'] = $app;
}
}
return $app;
}
示例12: generatePage
public function generatePage($view, $data = array())
{
$app = new Application();
$template = $app->getTemplate();
include $template;
//include PATH_SITE.'/templates/default_theme/index.php';
}
示例13: newApplication
/**
* Helper function to create a new application with a new keypair.
* @param type $title
* @return \IdnoPlugins\OAuth2\Application
*/
public static function newApplication($title)
{
$app = new Application();
$app->setTitle($title);
$app->generateKeypair();
return $app;
}
示例14: addMenu
/**
* Add a new main menu. Sticky means that it will be shown for all applications.
*
* @param MenuShortcut $menu
* @param Application $application The application this menu is linked to, if null it is always shown
*/
public function addMenu(MenuShortcut $menu, Application $application = null)
{
$context = $application ? $application->getApplicationId() : 'global';
if (!isset($this->menus[$context])) {
$this->menus[$context] = [];
}
$this->menus[$context][] = $menu;
}
示例15: getAppInstallDate
public function getAppInstallDate(Application $app, $format = null)
{
$install_apps = $this->getInstallApps();
if (isset($install_apps[$app->getId()])) {
return $install_apps[$app->getId()]->getLastInstalled();
}
return null;
}