當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AppKernel::handle方法代碼示例

本文整理匯總了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);
}
開發者ID:rodolfobandeira,項目名稱:training-crm-application,代碼行數:11,代碼來源:tracking.php

示例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);
     }
 }
開發者ID:hephaestus9,項目名稱:PartKeepr,代碼行數:20,代碼來源:SetupController.php

示例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);
     }
 }
開發者ID:partkeepr,項目名稱:PartKeepr,代碼行數:31,代碼來源:SetupBaseController.php

示例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;
 }
開發者ID:codekanzlei,項目名稱:cake-cktools,代碼行數:40,代碼來源:Plugin.php

示例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();
開發者ID:jackbravo,項目名稱:symfony-sandbox,代碼行數:11,代碼來源:app_dev.php

示例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);
開發者ID:acmephp,項目名稱:symfony-bundle,代碼行數:20,代碼來源:app.php

示例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;
         }
     }
 }
開發者ID:rameshrr99,項目名稱:civicrm-core,代碼行數:43,代碼來源:Invoke.php

示例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}");
}
開發者ID:ChMat,項目名稱:CoreBundle,代碼行數:31,代碼來源:app.php

示例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);
開發者ID:joshuaestes,項目名稱:symfony-biga-edition,代碼行數:14,代碼來源:app.php

示例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);
開發者ID:slavchoo,項目名稱:tourreview,代碼行數:11,代碼來源:app.php

示例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);
開發者ID:pguso,項目名稱:WellCommerce,代碼行數:11,代碼來源:app.php

示例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();
開發者ID:ronisaha,項目名稱:Lemon,代碼行數:10,代碼來源:index.php

示例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);
開發者ID:zenmagick,項目名稱:zenmagick,代碼行數:19,代碼來源:app_install.php

示例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();
開發者ID:ratasxy,項目名稱:Aguila,代碼行數:10,代碼來源:shell.php

示例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();
開發者ID:ricfrank,項目名稱:www.lebowskienico.it,代碼行數:17,代碼來源:app_dev.php


注:本文中的AppKernel::handle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。