本文整理汇总了PHP中AppKernel::handle方法的典型用法代码示例。如果您正苦于以下问题:PHP AppKernel::handle方法的具体用法?PHP AppKernel::handle怎么用?PHP AppKernel::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKernel
的用法示例。
在下文中一共展示了AppKernel::handle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: passDataToApplication
function passDataToApplication($url)
{
$_SERVER['REQUEST_URI'] = modifyUrl($url);
$_GET['loggedAt'] = getLoggedAt();
require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$kernel->handle($request);
}
示例2: handleRequest
protected function handleRequest(Request $request, $uri, $parameters = array(), $environment = "setup_test")
{
$data = json_decode($request->getContent(), true);
if (!array_key_exists("authKey", $data) || !$this->verifyAuthKey($data["authKey"])) {
$response["success"] = false;
$response["message"] = "Invalid Authentication Key";
$response["errors"] = array();
return new JsonResponse($response);
}
try {
$kernel = new \AppKernel($environment, true);
$internalRequest = Request::create($uri, "GET", $parameters);
return $kernel->handle($internalRequest);
} catch (\Exception $e) {
$response["success"] = false;
$response["message"] = "Generic Error";
$response["errors"] = [$e->getMessage()];
return new JsonResponse($response);
}
}
示例3: handleRequest
/**
* Handles the given request by setting up a setup_test environment.
*
* @param Request $request
* @param $uri
* @param array $parameters
* @param string $environment
*
* @return JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
protected function handleRequest(Request $request, $uri, $parameters = [], $environment = 'setup_test')
{
$data = json_decode($request->getContent(), true);
if (!array_key_exists('authKey', $data) || !$this->verifyAuthKey($data['authKey'])) {
$response['success'] = false;
$response['message'] = 'Invalid Authentication Key';
$response['errors'] = [];
return new JsonResponse($response);
}
$parameters['authKey'] = $data['authKey'];
try {
$kernel = new \AppKernel($environment, true);
$internalRequest = Request::create($uri, 'GET', $parameters);
return $kernel->handle($internalRequest);
} catch (\Exception $e) {
$response['success'] = false;
$response['message'] = 'Generic Error';
$response['errors'] = [$e->getMessage()];
return new JsonResponse($response);
}
}
示例4: authenticate
public function authenticate(MOXMAN_Auth_User $user)
{
$config = MOXMAN::getConfig();
// Load environment and session logic
if (!$this->isSessionLoaded) {
$kernel = new AppKernel($config->get("SymfonyAuthenticator.environment", "prod"), false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$kernel->handle($request);
$this->isSessionLoaded = true;
}
// Get all session data
$session = new Session();
$session = $session->all();
// Check logged in key
$loggedInKey = $config->get("SymfonyAuthenticator.logged_in_key", "isLoggedIn");
$sessionValue = isset($session[$loggedInKey]) ? $session[$loggedInKey] : false;
if (!$sessionValue || $sessionValue === "false") {
return false;
}
// Extend config with session prefixed sessions
$sessionConfig = array();
$configPrefix = $config->get("SymfonyAuthenticator.config_prefix", "moxiemanager");
if ($configPrefix) {
foreach ($session as $key => $value) {
if (strpos($key, $configPrefix) === 0) {
$sessionConfig[substr($key, strlen($configPrefix) + 1)] = $value;
}
}
}
// Extend the config with the session config
$config->extend($sessionConfig);
// Replace ${user} with all config items
$key = $config->get("SessionAuthenticator.user_key", "user");
if ($key && isset($session[$key])) {
$config->replaceVariable("user", $session[$key]);
$user->setName($session[$key]);
}
return true;
}
示例5: die
<?php
// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it, or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
die('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}
require_once __DIR__ . '/../app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('dev', true);
$kernel->handle(new Request())->send();
示例6: AppKernel
<?php
/*
* This file is part of the ACME PHP library.
*
* (c) Titouan Galopin <galopintitouan@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
require_once __DIR__ . '/bootstrap.php';
require_once __DIR__ . '/AppKernel.php';
$kernel = new AppKernel('test', false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
$response->send();
$kernel->terminate($request, $response);
示例7: _invoke
/**
* This is the same as invoke(), but it does *not* include exception
* handling.
*
* @param array $args
* The parts of the URL which identify the intended CiviCRM page
* (e.g. array('civicrm', 'event', 'register')).
* @return string
* HTML. For non-HTML content, invoke() may call print() and exit().
*/
public static function _invoke($args)
{
if ($args[0] !== 'civicrm') {
return NULL;
}
// CRM-15901: Turn off PHP errors display for all ajax calls
if (CRM_Utils_Array::value(1, $args) == 'ajax' || CRM_Utils_Array::value('snippet', $_REQUEST)) {
ini_set('display_errors', 0);
}
if (!defined('CIVICRM_SYMFONY_PATH')) {
// Traditional Civi invocation path
self::hackMenuRebuild($args);
// may exit
self::init($args);
self::hackStandalone($args);
$item = self::getItem($args);
return self::runItem($item);
} else {
// Symfony-based invocation path
require_once CIVICRM_SYMFONY_PATH . '/app/bootstrap.php.cache';
require_once CIVICRM_SYMFONY_PATH . '/app/AppKernel.php';
$kernel = new AppKernel('dev', TRUE);
$kernel->loadClassCache();
$response = $kernel->handle(Symfony\Component\HttpFoundation\Request::createFromGlobals());
if (preg_match(':^text/html:', $response->headers->get('Content-Type'))) {
// let the CMS handle the trappings
return $response->getContent();
} else {
$response->send();
exit;
}
}
}
示例8: ApcClassLoader
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$apcLoader = new ApcClassLoader('sf2', $loader);
$loader->unregister();
$apcLoader->register(true);
*/
require_once __DIR__ . '/../app/AppKernel.php';
use Symfony\Component\Yaml\Yaml;
$maintenanceMode = file_exists(__DIR__ . '/../app/config/.update');
$authorized = false;
if (file_exists($file = __DIR__ . '/../app/config/ip_white_list.yml')) {
$ips = Yaml::parse($file);
$authorized = false;
foreach ($ips as $ip) {
if ($ip === $_SERVER['REMOTE_ADDR']) {
$authorized = true;
}
}
}
if (!$maintenanceMode || $authorized) {
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$kernel->handle($request)->send();
//$kernel->terminate($request, $response);
} else {
$url = $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '/../maintenance.php';
header("Location: http://{$url}");
}
示例9: ApcClassLoader
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\ApacheRequest;
umask(00);
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
$loader = new ApcClassLoader('SymfonyBigaEdition', $loader);
$loader->register(true);
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$response = $kernel->handle($request = ApacheRequest::createFromGlobals());
$response->send();
$kernel->terminate($request, $response);
示例10: AppKernel
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$request = Request::createFromGlobals();
$response = $kernel->handle($request)->send();
$kernel->terminate($request, $response);
示例11: AppKernel
<?php
use Symfony\Component\HttpFoundation\Request;
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
示例12: Bootstrap
<?php
use Symfony\Component\HttpFoundation\Request;
require_once __DIR__ . '/../app/autoload.php';
require_once __DIR__ . '/../app/AppBootstrap.php';
require_once __DIR__ . '/../app/AppKernel.php';
$request = Request::createFromGlobals();
$bootstrap = new Bootstrap('prod');
$kernel = new AppKernel($request, $bootstrap->routes, $bootstrap->conf);
$kernel->handle();
示例13: AppKernel
<?php
return;
// @todo replace with a better check
// @todo using filesystem ACLs is recommended, but what should we do by default?
//umask(0002); // This will let the permissions be 0775
umask(00);
// This will let the permissions be 0777
use ZenMagick\Http\Request;
//$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/autoload.php';
require_once __DIR__ . '/../app/AppKernel.php';
// @todo remove context from here altogether!
$application = new AppKernel('install', true, 'admin');
//$application->loadClassCache();
$request = Request::createFromGlobals();
$response = $application->handle($request);
$response->send();
$application->terminate($request, $response);
示例14: AppKernel
<?php
require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('dev', false);
$request = Symfony\Component\HttpFoundation\Request::createFromGlobals();
$handle = $kernel->handle($request);
$container = $kernel->getContainer();
$em = $container->get('doctrine')->getEntityManager();
示例15: header
<?php
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(00);
// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}
require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->handle(Request::createFromGlobals())->send();