本文整理汇总了PHP中Zend_Controller_Request_Http::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::getParam方法的具体用法?PHP Zend_Controller_Request_Http::getParam怎么用?PHP Zend_Controller_Request_Http::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::getParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assert
/**
* 判断是否有访问某个游戏的条件
*
* @see Zend_Acl_Assert_Interface::assert()
*/
public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
{
if ($this->_request->has('gametype')) {
$roleData = ZtChart_Model_Acl_Loader::getInstance()->getRole($role->getRoleId());
return in_array($this->_request->getParam('gametype'), $roleData['role_gametype']);
}
return true;
}
示例2: test_marshall_PUT_body_as_params
public function test_marshall_PUT_body_as_params()
{
$this->request->setMethod('PUT');
$this->request->setRawBody('param1=value1¶m2=value2');
$this->plugin->preDispatch($this->request);
$this->assertEquals('value1', $this->request->getParam('param1'));
$this->assertEquals('value2', $this->request->getParam('param2'));
}
示例3: authenticate
/**
* Performs an authentication attempt
*
* @throws Zend_Auth_Adapter_Exception If authentication cannot be performed
* @return Zend_Auth_Result
*/
public function authenticate()
{
if (empty($this->_request) || empty($this->_response)) {
throw new Zend_Auth_Adapter_Exception('Request and Response objects must be set before calling authenticate method');
}
if ($this->_request->getParam('module') != 'download') {
throw new Zend_Auth_Adapter_Exception('Wrong endpoint');
}
try {
$token = $this->_request->getParam('downloadToken');
if (!$token instanceof Download\Model\DownloadTokenModel) {
throw new Zend_Auth_Adapter_Exception("Download token data is missing", 401);
}
if ($token->authType == \App_Controller_Plugin_Auth::AUTH_TYPE_EXTERNAL) {
$apiId = $token->apiId;
$apiIdMapper = Application\Model\Mapper\APIIdMapper::getInstance();
$res = $apiIdMapper->findOneByApiId($apiId);
if (empty($res)) {
throw new \Application\Exceptions\NotFoundException("Api id '{$apiId}' not found (at Mongo)");
}
$orgId = $res->getOrgId();
$apiUserId = 'API_' . $apiId;
if (empty($orgId)) {
throw new Zend_Auth_Adapter_Exception("Organization id not defined in Api id '{$apiId}' ");
}
$result = array('id' => $apiUserId, 'apiId' => $apiId, 'username' => 'api_' . $orgId, 'monetaryDataAccess' => $res->getMonetaryDataAccess(), 'orgId' => $orgId, 'role' => 'admin', 'authType' => App_Controller_Plugin_Auth::AUTH_TYPE_DOWNLOAD_TOKEN);
} else {
if ($username = $token->username) {
$userMapper = Application\Model\Mapper\UserMapper::getInstance();
$res = $userMapper->findOneByUserName($username);
if (empty($res)) {
throw new \Application\Exceptions\NotFoundException("User name '{$username}' not found");
}
$orgId = $res->getOrganizationId();
if (empty($orgId)) {
throw new Zend_Auth_Adapter_Exception("User '{$username}' has no orgId");
}
$result = array('id' => $res->id, 'username' => $username, 'monetaryDataAccess' => $res->getMonetaryDataAccess(), 'role' => $res->getRole(), 'orgId' => $orgId, 'authType' => App_Controller_Plugin_Auth::AUTH_TYPE_DOWNLOAD_TOKEN, 'language' => $res->language);
}
}
// App_Controller_Plugin_TrackingToken::generateToken($username, $orgId);
// $orgSrv = \Application\Service\OrgService::getInstance();
// $organization = $orgSrv->load($orgId);
// if (empty($organization)) {
// throw new \Application\Exceptions\NotFoundException("Org '$orgId' not found");
// }
if ($token->impersonation) {
$result['impersonation'] = $token->impersonation;
}
$result['downloadToken'] = $token;
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $result);
} catch (Exception $e) {
\App::log()->err($e->getMessage());
}
\App::log()->warn("Download authentication failed: Token => " . @$token->id ?: null);
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null);
}
示例4: __construct
/**
* Constructor to setup the strategy
*/
public function __construct(Zend_Controller_Request_Http $request, Zend_Controller_Response_Http $response)
{
$this->strategies = new Zend_Loader_PluginLoader(array('App_Auth_Strategy' => 'App/Auth/Strategy'));
$auth = Zend_Auth::getInstance();
$this->user = $auth->getIdentity();
$this->request = $request;
$this->response = $response;
$this->setStrategy($this->request->getParam('strategy', 'db'));
}
示例5: noControllerResponse
public static function noControllerResponse(XenForo_RouteMatch $routeMatch, Zend_Controller_Request_Http $request)
{
self::sendErrorPageHeaders();
if (XenForo_Application::debugMode()) {
echo 'Failed to get controller response and reroute to error handler (' . $routeMatch->getControllerName() . '::action' . $routeMatch->getAction() . ')';
if ($request->getParam('_exception')) {
echo self::getExceptionTrace($request->getParam('_exception'));
}
} else {
echo self::_getPhrasedTextIfPossible('An unexpected error occurred. Please try again later.', 'unexpected_error_occurred');
}
}
示例6: init
/**
* Init method.
* Call during construction of the controller to perform some default initialization.
*/
public function init()
{
parent::init();
$this->getResponse()->setHeader('Content-Type', $this->_mimetype);
$this->_request->setParam('view', $this->_helper->viewRenderer);
$this->_helper->viewRenderer->setViewScriptPathSpec(":action.phtml");
$this->view->addHelperPath(USVN_HELPERS_DIR, 'USVN_View_Helper');
$this->_helper->layout->setLayout('default');
$this->_request->setParam('project', $this->_request->getParam('project', '__NONE__'));
$this->_request->setParam('area', $this->_request->getParam('area', '__NONE__'));
if ($this->_mimetype != 'text/html') {
$this->_helper->viewRenderer->setNoRender();
}
}
示例7: linkDoctorAccount
public function linkDoctorAccount(Doctor $doctor)
{
$token = AccessToken::getByDoctor($doctor);
if (!$token instanceof AccessToken) {
$token = AccessToken::create();
$token->setDoctor($doctor);
}
$client = MedOptima_Service_Google_Config::getCalendarClient();
if ($this->_request->getParam('code')) {
$client->authenticate($this->_request->getParam('code'));
(new MedOptima_Service_Google_AccessToken_Initializer())->updateFromEncodedData($token, $client->getAccessToken());
}
$token->save();
return true;
}
示例8: preDispatch
/**
* @param Zend_Controller_Request_Http $request
*/
public function preDispatch($request)
{
// dont filter anything if a resident is logged in
$session = new Zend_Session_Namespace();
if ($session->currentResidentId) {
$session->currentResident = Table_Residents::getInstance()->find($session->currentResidentId)->current();
return;
}
// allow index and session controller to all
if ($request->getControllerName() == 'index' || $request->getControllerName() == 'session') {
return;
}
// Authenticate direct requests for non-html stuff
if ($request->getParam('format') !== "html") {
// The requestor provided a username
if (isset($_SERVER['PHP_AUTH_USER'])) {
$resident = Table_Residents::getInstance()->findResidentByEmailAndPasswordhash($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if ($resident) {
$session->currentResidentId = $resident->getId();
$session->currentResident = $resident;
return;
}
}
header('WWW-Authenticate: Basic realm="WG-Organizer"');
header('HTTP/1.0 401 Unauthorized');
die;
}
// else redirect to frontpage
$request->setControllerName('index');
$request->setActionName('index');
}
示例9: testGetAliasedParamZF2455
public function testGetAliasedParamZF2455()
{
$this->_request->setParam('controller', 'value');
$this->_request->setAlias('var1', 'controller');
$this->assertEquals('value', $this->_request->getParam('controller'));
$this->assertEquals('value', $this->_request->getParam('var1'));
}
示例10: testParamSourcesHonoredByGetParam
/**
* @group ZF-1798
*/
public function testParamSourcesHonoredByGetParam()
{
$_GET = array('foo' => 'bar');
$_POST = array('foo' => 'baz');
$this->_request->setParamSources(array('_POST'));
$this->assertEquals('baz', $this->_request->getParam('foo'));
}
示例11: getParam
/**
* Retrieve a parameter.
*
* Retrieves a parameter from the instance. Priority is in the order of
* userland parameters (see {@link setParam()}), $_GET, $_POST. If a
* parameter matching the $key is not found, null is returned.
*
* If the $key is an alias, the actual key aliased will be used.
*
* @param mixed $key
* @param mixed $default Default value to use if key not found
* @return mixed
*/
public function getParam($key, $default = null)
{
$param = parent::getParam($key, $default);
if (is_string($param)) {
return trim($param);
}
return $param;
}
示例12: factory
/**
* 通过工厂方法快速获取 YUN_Paginator 对象
*
* @param array $data
* @param integer $perPage
* @param string $uriSegment
* @return YUN_Paginator
*/
public static function factory($data, Zend_Controller_Request_Http $request, $perPage = 20, $uriSegment = 'page')
{
$paginator = Zend_Paginator::factory($data);
$paginator->setItemCountPerPage($perPage);
// 每页显示数
$paginator->setCurrentPageNumber($request->getParam($uriSegment));
// 设置当前页
return $paginator;
}
示例13: getRedirectUrl
/**
* Redirect to startup page after logging in if request contains any params (except security key)
*
* @param Mage_Admin_Model_User $user
* @param Zend_Controller_Request_Http $request
* @param string|null $alternativeUrl
* @return null|string
*/
public function getRedirectUrl(Mage_Admin_Model_User $user, Zend_Controller_Request_Http $request = null, $alternativeUrl = null)
{
if (empty($request)) {
return;
}
$countRequiredParams = $this->_urlModel->useSecretKey() && $request->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME) ? 1 : 0;
$countGetParams = count($request->getUserParams()) + count($request->getQuery());
return $countGetParams > $countRequiredParams ? $this->_urlModel->getUrl($user->getStartupPageUrl()) : $alternativeUrl;
}
示例14: testPostDispatchQuitsWithFalseUserErrorHandlerParam
public function testPostDispatchQuitsWithFalseUserErrorHandlerParam()
{
$front = Zend_Controller_Front::getInstance();
$front->resetInstance();
$front->setParam('noErrorHandler', true);
$this->response->setException(new Zend_Controller_Dispatcher_Exception('Testing controller exception'));
$this->request->setModuleName('foo')->setControllerName('bar')->setActionName('baz');
$this->plugin->postDispatch($this->request);
$this->assertNull($this->request->getParam('error_handler'));
}
示例15: testSetNullParamsUnsetsKeys
public function testSetNullParamsUnsetsKeys()
{
$this->_request->setParams(array('foo' => 'bar', 'bar' => 'baz'));
$this->assertEquals('bar', $this->_request->getParam('foo'));
$this->assertEquals('baz', $this->_request->getParam('bar'));
$this->_request->setParams(array('foo' => null));
$params = $this->_request->getParams();
$this->assertFalse(isset($params['foo']));
$this->assertTrue(isset($params['bar']));
}