本文整理汇总了PHP中Zend_Controller_Request_Http::setParamSources方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::setParamSources方法的具体用法?PHP Zend_Controller_Request_Http::setParamSources怎么用?PHP Zend_Controller_Request_Http::setParamSources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::setParamSources方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParamSourcesHonoredByGetParam
/**
* 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'));
}
示例2: testGetParamsShouldHonorParamSourcesSetting
/**
* @group ZF-5107
*/
public function testGetParamsShouldHonorParamSourcesSetting()
{
$_GET = array('foo' => 'bar');
$_POST = array('foo' => 'baz');
$this->_request->setParamSources(array('_POST'));
$params = $this->_request->getParams();
$this->assertEquals(array('foo' => 'baz'), $params);
}
示例3: actionStaffShare
public function actionStaffShare()
{
$visitor = XenForo_Visitor::getInstance();
if (!$visitor->hasPermission('general', 'bdSocialShare_staffShare')) {
return $this->responseNoPermission();
}
$url = $this->_input->filterSingle('url', XenForo_Input::STRING);
if (empty($url)) {
return $this->responseView('bdSocialShare_ViewPublic_Misc_StaffShare_UrlForm', 'bdsocialshare_staff_share_url_form');
}
$request = new Zend_Controller_Request_Http($url);
$request->setParamSources(array());
$routeMatch = bdSocialShare_Listener::getDependencies()->route($request);
$shareable = $this->getModelFromCache('bdSocialShare_Model_Publisher')->getShareableForRouteMatchAndRequest($routeMatch, $request);
if (empty($shareable)) {
return $this->responseMessage(new XenForo_Phrase('bdsocialshare_url_x_is_not_supported', array('url' => $url)));
}
$userModel = $this->getModelFromCache('XenForo_Model_User');
$viewingUserGuest = $userModel->getVisitingGuestUser();
$userModel->bdSocialShare_prepareViewingUser($viewingUserGuest);
$shareable->setViewingUser($viewingUserGuest);
$publisherModel = $this->getModelFromCache('bdSocialShare_Model_Publisher');
$facebookAccounts = false;
if (bdSocialShare_Option::hasPermissionFacebook($viewingUserGuest)) {
$facebookAccounts = $this->getModelFromCache('bdSocialShare_Model_Facebook')->getAccounts();
}
$twitterAccounts = false;
if (bdSocialShare_Option::hasPermissionTwitter($viewingUserGuest)) {
$twitterAccounts = $this->getModelFromCache('bdSocialShare_Model_Twitter')->getAccounts();
}
if ($this->isConfirmedPost()) {
$target = $this->_input->filterSingle('target', XenForo_Input::STRING);
$targetId = $this->_input->filterSingle('target_id', XenForo_Input::STRING);
$data = $this->_input->filter(array('userText' => XenForo_Input::STRING, 'title' => XenForo_Input::STRING, 'description' => XenForo_Input::STRING, 'image' => XenForo_Input::STRING));
$data['link'] = $shareable->getLink($publisherModel);
$staffShareSharable = new bdSocialShare_Shareable_StaffShare($data);
$published = false;
try {
$published = $publisherModel->publish($target, $targetId, $staffShareSharable, $viewingUserGuest);
} catch (XenForo_Exception $e) {
XenForo_Error::logException($e);
}
if ($published) {
XenForo_Model_Log::logModeratorAction('bdsocialshare_all', $data, $target, array('target_id' => $targetId));
return $this->responseMessage(new XenForo_Phrase('bdsocialshare_staff_share_published_successfully'));
} else {
return $this->responseError(new XenForo_Phrase('unexpected_error_occurred'));
}
}
$viewParams = array('facebookAccounts' => $facebookAccounts, 'twitterAccounts' => $twitterAccounts, 'hasAdminPermissionOption' => $visitor->hasAdminPermission('option'), 'url' => $url, 'link' => $shareable->getLink($publisherModel), 'userText' => strval($shareable->getUserText($publisherModel)), 'title' => strval($shareable->getTitle($publisherModel)), 'description' => strval($shareable->getDescription($publisherModel)), 'image' => $shareable->getImage($publisherModel));
return $this->responseView('bdSocialShare_ViewPublic_Misc_StaffShare', 'bdsocialshare_staff_share', $viewParams);
}