本文整理汇总了PHP中RequestHandler类的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler类的具体用法?PHP RequestHandler怎么用?PHP RequestHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RequestHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->configure();
\yapaf\DevServer::handle();
$requestHandler = new RequestHandler($this->configuration);
return $requestHandler->handle();
}
开发者ID:clauswitt,项目名称:yapaf,代码行数:7,代码来源:Application.php
示例2: factory
/**
* @param DomDocument $context
* @param \BaseXMS\Mvc\SiteAccess $siteAccess
* @return Ambigous <NULL, unknown, \BaseXMS\RequestHandler\RequestHandler>
*/
public static function factory($context, \BaseXMS\Mvc\SiteAccess $siteAccess)
{
$return = null;
$services = $siteAccess->getServiceLocator();
// Get Request handler class
$requestHandlerClass = $context->queryToValue('//contentclass');
//TODO: contentclass is not really the right name
if (!$requestHandlerClass) {
$requestHandlerClass = '\\BaseXMS\\RequestHandler\\RequestHandler';
$services->get('log')->warn('No RequestHandler class specified - falling back to default class.');
}
if (!class_exists($requestHandlerClass)) {
$services->get('log')->warn('Could not find RequestHandler class: "' . $requestHandlerClass . '".');
$requestHandlerClass = '\\BaseXMS\\RequestHandler\\RequestHandler';
}
$services->get('log')->info('Loading RequestHandler class: "' . $requestHandlerClass . '".');
$return = new $requestHandlerClass();
// couldn't get a valid class
if (!$return instanceof RequestHandler) {
$services->get('log')->warn('"' . $requestHandlerClass . '" is not a RequestHandler - falling back to default class.');
$return = new RequestHandler();
}
$return->setContext($context)->setServiceLocator($services)->setSiteAccess($siteAccess);
return $return;
}
开发者ID:pkamps,项目名称:basexms,代码行数:30,代码来源:Factory.php
示例3: __construct
public function __construct(RequestHandler $request)
{
$this->request = $request;
$this->container = $request->getContainer();
$this->view = $this->container->getTwig();
$this->acquireBaseUrl();
$this->session = ApplicationSession::getInstance();
}
开发者ID:Endymion1977,项目名称:phonebook,代码行数:8,代码来源:AbstractBaseController.php
示例4: processRequest
public static function processRequest()
{
global $logger;
$request = $rawResponse = $response = null;
try {
/* Authenticate */
$valid = self::authenticateRequest($_SERVER);
/* Fetch POST data */
$post = file_get_contents("php://input");
$logger->debug("POST Data Received: " . $post);
/* Formulate the request object */
$request = RequestParser::parseInput($_SERVER, $_GET, $post);
$logger->debug("REQUEST Object: " . $request->toString());
/* Handle the request */
$rawResponse = RequestHandler::process($request);
$logger->debug("RESPONSE Object: " . json_encode($rawResponse));
} catch (ApiException $e) {
/* Generate response from Exception details */
$logger->error("ApiException encountered!! " . $e->toString());
$rawResponse = array('httpStatusCode' => $e->getHttpStatusCode(), 'httpStatusCodeMessage' => $e->getHttpStatusCodeMessage(), 'otherHeaders' => $e->getOtherHeaders(), 'code' => $e->getCode(), 'message' => $e->getMessage(), 'debug' => false, 'data' => null);
}
// Format the $rawResponse variable and output
$format = !isset($request) ? 'json' : $request->getFormat();
$debug = !isset($request) ? false : $request->getDebug();
$response = ResponseHandler::respond($rawResponse, $format, $debug);
$logger->debug("Output: " . $response);
}
开发者ID:rajnishp,项目名称:teamroomV3,代码行数:27,代码来源:ApiService.class.php
示例5: getInstance
/**
* Creates single for whole application RequestHandler object.
* Singleton pattern implementation.
*
* @return RequestHandler Either existing or new.
*/
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new RequestHandler();
}
return self::$instance;
}
开发者ID:anzasolutions,项目名称:simland,代码行数:13,代码来源:RequestHandler.class.php
示例6: playGame
/**
* Handle request and set message to.
*/
public function playGame()
{
$this->model->processShot(RequestHandler::getRequest());
$this->view->setMessage($this->model->getMessage());
$this->view->setData($this->model->getData()['grid']);
$this->view->display();
}
开发者ID:nicolas-thompson,项目名称:battleships,代码行数:10,代码来源:BattleCommand.php
示例7: CurrentUser
/**
* Returns user information such as first name, last name, and email address.
*
* @return SimpleXMLElement Xml of Disconnect response
*/
public function CurrentUser()
{
$this->requestXmlDocument = '';
$uriFragment = implode(CoreConstants::SLASH_CHAR, array('v1', 'user', 'current'));
$requestParameters = new RequestParameters(NULL, 'GET', NULL, $uriFragment);
list($respCode, $respXml, $respError) = $this->restRequestHandler->GetResponse($requestParameters, $this->requestXmlDocument, NULL);
return simplexml_load_string($respXml);
}
开发者ID:beanworks,项目名称:quickbooks-online-v3-sdk,代码行数:13,代码来源:PlatformService.php
示例8: buildRequestForm
function buildRequestForm($method, $button_name)
{
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler = $this->__inithandler($reqHandler);
//待请求参数数组
$reqHandler->createSign();
$params = $reqHandler->getAllParameters();
ksort($params);
$sHtml = "<form id='tenpaysubmit' name='tenpaysubmit' action='" . $reqHandler->getGateUrl() . "' method='" . $method . "'>";
while (list($key, $val) = each($params)) {
$sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
}
//submit按钮控件请不要含有name属性
$sHtml = $sHtml . "<input type='submit' value='" . $button_name . "'></form>";
$sHtml = $sHtml . "<script>document.forms['tenpaysubmit'].submit();</script>";
return $sHtml;
}
开发者ID:fengsmith1988,项目名称:weixin-1,代码行数:18,代码来源:tenpay.class.php
示例9: matches
/**
* @see \wcf\system\request\IRoute::matches()
*/
public function matches($requestURL)
{
if (parent::matches($requestURL)) {
$this->routeData['application'] = $this->staticApplication;
$this->routeData['controller'] = RequestHandler::getTokenizedController($this->staticController);
$this->routeData['isDefaultController'] = false;
return true;
}
return false;
}
开发者ID:nick-strohm,项目名称:WCF,代码行数:13,代码来源:StaticRoute.class.php
示例10: fillMenu
/**
* recursive fill the menu.
*
* @param string $lbl
* @param array $page
* @param string $class
* @access private
* @return DomElement
*/
private function fillMenu($lbl, $page, $class = null)
{
if ($class === null) {
$rq = new RequestHandler(DEFAULTPAGE, $this->basepath);
}
if (is_array($page)) {
if (isset($page['default'])) {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page['default']);
if ($class === null && $rq->getPage() == $page['default']) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
unset($page['default']);
} else {
$li = $this->document->createElement('li', $lbl);
}
if (count($page) > 0) {
$subList = $this->document->createElement('ul');
if (!empty($class)) {
$subList->setAttribute('class', 'sub');
} else {
$subList->setAttribute('class', 'sub first');
}
foreach ($page as $slbl => $spage) {
$subList->appendChild($this->fillMenu($slbl, $spage, 'sub'));
}
$li->appendChild($subList);
}
return $li;
} else {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page);
if ($class === null && $rq->getPage() == $page) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
return $li;
}
}
开发者ID:BlackIkeEagle,项目名称:hersteldienst-devolder,代码行数:51,代码来源:MultiMenu.php
示例11: _header
public function _header()
{
$t = Engine::getType();
if ($t == 'user') {
$r = RequestHandler::singleton();
if ($r->getController() != 'styleswitcher') {
$template = HBLoader::LoadComponent('Template');
$template->register_outputfilter(array($this, 'pre_filter'));
}
}
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:11,代码来源:class.styleswitcher.php
示例12: beforeContent
/**
* build menu before content
*
* @access public
* @return void
*/
public function beforeContent()
{
$menu = $this->document->getElementById($this->id);
if ($menu) {
$this->document->addCss('public/css/simplemenu.css');
$menu->removeAttribute('style');
$menuList = $this->document->createElement('ul');
$rq = new RequestHandler(DEFAULTPAGE, $this->basepath);
foreach ($this->menuItems as $lbl => $page) {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page);
if ($rq->getPage() == $page) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
$menuList->appendChild($li);
}
$menu->appendChild($menuList);
}
}
开发者ID:BlackIkeEagle,项目名称:hersteldienst-devolder,代码行数:27,代码来源:SimpleMenu.php
示例13: handleRequest
public static function handleRequest()
{
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
// retrieve authentication attempt
if ($GLOBALS['Session']->hasAccountLevel('Developer')) {
$User = $GLOBALS['Session']->Person;
} else {
$authEngine = new \Sabre\HTTP\BasicAuth();
$authEngine->setRealm('Develop ' . \Site::$title);
$authUserPass = $authEngine->getUserPass();
// try to get user
$userClass = \User::$defaultClass;
$User = $userClass::getByLogin($authUserPass[0], $authUserPass[1]);
// send auth request if login is inadiquate
if (!$User || !$User->hasAccountLevel('Developer')) {
$authEngine->requireLogin();
die("You must login using a " . \Site::getConfig('primary_hostname') . " account with Developer access\n");
}
}
// store login to session
if (isset($GLOBALS['Session'])) {
$GLOBALS['Session'] = $GLOBALS['Session']->changeClass('UserSession', array('PersonID' => $User->ID));
}
// detect base path
$basePath = array_slice(\Site::$requestPath, 0, count(\Site::$resolvedPath));
// switch to JSON response mode
if (static::peekPath() == 'json') {
$basePath[] = static::$responseMode = static::shiftPath();
}
// handle /develop request
if ($_SERVER['REQUEST_METHOD'] == 'GET' && static::getResponseMode() == 'html' && !static::peekPath()) {
\RequestHandler::respond('app/ext', array('App' => \Sencha_App::getByName('EmergenceEditor'), 'mode' => 'production', 'title' => 'EmergenceEditor'));
}
// initial and configure SabreDAV
$server = new \Sabre\DAV\Server(new RootCollection());
$server->setBaseUri('/' . join('/', $basePath));
// The lock manager is reponsible for making sure users don't overwrite each others changes. Change 'data' to a different
// directory, if you're storing your data somewhere else.
# $lockBackend = new Sabre_DAV_Locks_Backend_FS('/tmp/dav-lock');
# $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
# $server->addPlugin($lockPlugin);
// filter temporary files
$server->addPlugin(new \Sabre\DAV\TemporaryFileFilterPlugin('/tmp/dav-tmp'));
// ?mount support
$server->addPlugin(new \Sabre\DAV\Mount\Plugin());
// emergence :)
$server->addPlugin(new \Emergence\DAV\ServerPlugin());
// All we need to do now, is to fire up the server
$server->exec();
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:52,代码来源:DevelopRequestHandler.php
示例14: handleRequest
public function handleRequest($data)
{
parent::handleRequest($data);
if (empty($data['Password'])) {
throw new Exception('Enter a new password for your account');
} elseif ($data['Password'] != $data['PasswordConfirm']) {
throw new Exception('Enter your new password twice for confirmation');
}
$this->Creator->setClearPassword($data['Password']);
$this->Creator->save();
// set used
$this->Used = time();
$this->save();
return RequestHandler::respond('register/passwordRecovered');
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:15,代码来源:PasswordToken.class.php
示例15: redirectViewRecord
public static function redirectViewRecord(ActiveRecord $Record, $path = array(), $permanent = false)
{
if (is_array($path)) {
$path = implode('/', $path);
}
if (!($url = $Record->getURL())) {
if (!($classPath = static::getClassPath($Record))) {
return RequestHandler::throwError('No route to record viewer');
}
$url = '/' . $classPath . '/' . $Record->getHandle();
}
if ($path) {
$url .= '/' . ltrim($path, '/');
}
if ($permanent) {
Site::redirectPermanent($url);
} else {
Site::redirect($url);
}
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:20,代码来源:Router.class.php
示例16: __construct
/**
* Creates a new RequestHandler object.
*
* @param string $className
* @param array $applicationDir
* @param string $type
*/
protected function __construct($className, $applicationDir, $type)
{
self::$activeRequest = $this;
try {
// validate class name
if (!preg_match('/^[a-z0-9_]+$/i', $className)) {
throw new SystemException("Illegal class name '" . $className . "'", 11009);
}
// find class
$className = ucfirst($className) . ucfirst($type);
$classPath = $type . '/' . $className . '.class.php';
$found = false;
foreach ($applicationDir as $dir) {
if (file_exists($dir . $classPath)) {
$classPath = $dir . $classPath;
$found = true;
break;
}
}
if (!$found) {
throw new SystemException("unable to find class file '" . $classPath . "'", 11000);
}
} catch (SystemException $e) {
throw new IllegalLinkException();
}
// define vars
$this->type = $type;
$this->{$type} = $className;
// include class
require_once $classPath;
// execute class
if (!class_exists($className)) {
throw new SystemException("unable to find class '" . $className . "'", 11001);
}
$this->controllerObj = new $className();
}
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:43,代码来源:RequestHandler.class.php
示例17: __construct
public function __construct(GridField $grid, GridFieldComponent $component, $name)
{
$this->grid = $grid;
$this->component = $component;
$this->name = $name;
parent::__construct();
}
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:7,代码来源:GridFieldRequestHandler.php
示例18: __construct
public function __construct($grid, $button)
{
$this->grid = $grid;
$this->button = $button;
$this->context = singleton($grid->getModelClass())->getDefaultSearchContext();
parent::__construct();
}
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:7,代码来源:GridFieldAddExistingSearchHandler.php
示例19: getInstance
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
开发者ID:GrumpyZhou,项目名称:Team_13,代码行数:7,代码来源:RequestHandler.php
示例20:
/**
* Create a new page comment interface
* @param controller The controller that the interface is used on
* @param methodName The method to return this PageCommentInterface object
* @param page The page that we're commenting on
*/
function __construct($controller, $methodName, $page)
{
$this->controller = $controller;
$this->methodName = $methodName;
$this->page = $page;
parent::__construct();
}
开发者ID:racontemoi,项目名称:shibuichi,代码行数:13,代码来源:PageCommentInterface.php
注:本文中的RequestHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论