本文整理汇总了PHP中Zend_Controller_Request_Abstract::isPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::isPost方法的具体用法?PHP Zend_Controller_Request_Abstract::isPost怎么用?PHP Zend_Controller_Request_Abstract::isPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::isPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) {
$viewVars = $this->_cleanData($viewRenderer->view->getVars());
} else {
$viewVars = "No 'getVars()' method in view class";
}
$vars = '<div style="width:50%;float:left;">';
$vars .= '<h4>View variables</h4>' . '<div id="ZFDebug_vars" style="margin-left:-22px">' . $viewVars . '</div>' . '<h4>Request parameters</h4>' . '<div id="ZFDebug_requests" style="margin-left:-22px">' . $this->_cleanData($this->_request->getParams()) . '</div>';
$vars .= '</div><div style="width:45%;float:left;">';
if ($this->_request->isPost()) {
$vars .= '<h4>Post variables</h4>' . '<div id="ZFDebug_post" style="margin-left:-22px">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>Constants</h4>';
$constants = get_defined_constants(true);
ksort($constants['user']);
$vars .= '<div id="ZFDebug_constants" style="margin-left:-22px">' . $this->_cleanData($constants['user']) . '</div>';
$registry = Zend_Registry::getInstance();
$vars .= '<h4>Zend Registry</h4>';
$registry->ksort();
$vars .= '<div id="ZFDebug_registry" style="margin-left:-22px">' . $this->_cleanData($registry) . '</div>';
$cookies = $this->_request->getCookie();
$vars .= '<h4>Cookies</h4>' . '<div id="ZFDebug_cookie" style="margin-left:-22px">' . $this->_cleanData($cookies) . '</div>';
$vars .= '</div><div style="clear:both"> </div>';
return $vars;
}
示例2: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewVars = $viewRenderer->view->getVars();
$vars = '';
if ($this->_request->isPost()) {
$vars .= '<h4>$_POST</h4>' . '<div id="Centurion_ZFDebug_post">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>$_COOKIE</h4>' . '<div id="Centurion_ZFDebug_cookie">' . $this->_cleanData($this->_request->getCookie()) . '</div>' . '<h4>Request</h4>' . '<div id="Centurion_ZFDebug_requests">' . $this->_cleanData($this->_request->getParams()) . '</div>' . '<h4>View vars</h4>' . '<div id="Centurion_ZFDebug_vars">' . $this->_cleanData($viewVars) . '</div>';
return $vars;
}
示例3: routeStartup
/**
* Called before Zend_Controller_Front calls on the router to evaluate the
* request against the registered routes
*
* @param Zend_Controller_Request_Abstract $request
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
if ($request instanceof Zend_Controller_Request_Http) {
if ($request->isPost() || $request->isPut()) {
$post = $request->getPost();
if (empty($post) && empty($_FILES)) {
// Get maximum size and meassurement unit
$max = ini_get('post_max_size');
$unit = substr($max, -1);
if (!is_numeric($unit)) {
$max = substr($max, 0, -1);
}
// Convert to bytes
switch (strtoupper($unit)) {
case 'G':
$max *= 1024;
case 'M':
$max *= 1024;
case 'K':
$max *= 1024;
}
$length = $request->getServer('CONTENT_LENGTH');
if ($max < $length) {
if (!empty($this->_callback)) {
call_user_func($this->_callback, $request);
} else {
$e = new Zend_Controller_Exception('Maximum content length size (' . $max . ') exceeded', 1000);
$this->getResponse()->setException($e);
}
}
}
}
}
}
示例4: addAction
public function addAction()
{
if ($this->_request->isPost()) {
$url = $this->_request->getParam('currentUrl');
if ($this->_request->getParam('dataFormProducts')) {
$dataProducts = $this->_request->getParam('dataFormProducts');
//основные - sku, name, description, note, sorting, path
$product = new Catalog_Model_Products($dataProducts);
//modDate, order
$product->setMetaTitle($dataProducts['name'])->setMetaDescription($dataProducts['description'])->setMetaKeywords($dataProducts['name'])->setOrder($dataProducts['sorting'])->setActive(1)->setDeleted(0)->setAddDate(date("Y-m-d H:i:s"))->setModDate(date("Y-m-d H:i:s"));
$this->_modelMapper->save($product);
$productId = $this->_modelMapper->getDbTable()->getAdapter()->lastInsertId();
$categoriesMapperXref = new Catalog_Model_Mapper_CategoriesXref();
$categoriesMapperXref->save(new Catalog_Model_CategoriesXref(array('productId' => $productId, 'categoryId' => $this->_request->getParam('categoryId'))));
$product = $this->_modelMapper->find($productId, $this->_model);
$upload = new Zend_File_Transfer();
$uploadPath = '/upload/products/' . $product->getId() . '/';
//image
if ($upload->isUploaded('fileLoadImage')) {
$imageFile = $this->_uploadFiles($productId, $upload, 'fileLoadImage');
$product->setUploadPath($uploadPath)->setImage($imageFile['fileLoadImage']['name']);
}
//draft
if ($upload->isUploaded('fileLoadDraft')) {
$imageFile = $this->_uploadFiles($productId, $upload, 'fileLoadDraft');
$product->setUploadPathDraft($uploadPath)->setDraft($imageFile['fileLoadDraft']['name']);
}
$this->_modelMapper->save($product);
$url = '/catalog/' . $product->getFullPath();
}
$this->clearCache('CatalogProductsList');
$this->_redirector->gotoUrlAndExit($url);
}
//Zend_Debug::dump($this->_request->getParams());
}
示例5: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) {
$viewVars = $this->_cleanData($viewRenderer->view->getVars());
} else {
$viewVars = "Pas de méthode 'getVars()' dans l\\'objet vue";
}
$vars = '';
if ($this->_request->isPost()) {
$vars .= '<h4>Superglobale $_POST</h4>' . '<div id="ZFDebug_post">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>Superglobale $_COOKIE</h4>' . '<div id="ZFDebug_cookie">' . $this->_cleanData($this->_request->getCookie()) . '</div>' . '<h4>Paramètres de l\'objet Request</h4>' . '<div id="ZFDebug_requests">' . $this->_cleanData($this->_request->getParams()) . '</div>' . '<h4>Variables de vue (Zend_View)</h4>' . '<div id="ZFDebug_vars">' . $viewVars . '</div>';
return $vars;
}
示例6: authenticate
/**
* Authenticate a user.
*
* @param Zend_Controller_Request_Abstract $request The current request
* @param Zend_Controller_Response_Abstract $response The current response
* @return array|bool User data,
* or FALSE when no user is logged in yet
*/
public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{
if (!$request->isPost()) {
return $this->acceptToken($request->getParam('token'), $request->getParam('uid'));
}
$this->requestToken($request->getPost());
return false;
}
示例7: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) {
$viewVars = $this->_cleanData($viewRenderer->view->getVars());
} else {
$viewVars = "No 'getVars()' method in view class";
}
// $front = Zend_Controller_Front::getInstance();
$vars = '';
if ($this->_request->isPost()) {
$vars .= '<h4>$_POST</h4>' . '<div id="ZFDebug_post">' . $this->_cleanData($this->_request->getPost()) . '</div>';
}
$vars .= '<h4>$_COOKIE</h4>' . '<div id="ZFDebug_cookie">' . $this->_cleanData($this->_request->getCookie()) . '</div>' . '<h4>Request</h4>' . '<div id="ZFDebug_requests">' . $this->_cleanData($this->_request->getParams()) . '</div>' . '<h4>View vars</h4>' . '<div id="ZFDebug_vars">' . $viewVars . '</div>';
return $vars;
}
示例8: deleteAction
/**
* deleteAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function deleteAction()
{
$this->core->logger->debug('properties->controllers->CategoryController->deleteAction()');
$this->getModelCategories();
if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
$this->objModelCategories->deleteCategoryNode($this->objRequest->getParam("id"));
$this->view->blnShowFormAlert = true;
}
$this->renderScript('category/form.phtml');
}
示例9: deleteAction
/**
* deleteAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function deleteAction()
{
$this->core->logger->debug('core->controllers->FolderController->deleteAction()');
$this->getModelFolders();
if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
$this->objModelFolders->deleteFolderNode($this->objRequest->getParam("id"));
$this->view->blnShowFormAlert = true;
}
$this->renderScript('folder/form.phtml');
}
示例10: authenticate
/**
* Authenticate a user.
* @param Zend_Controller_Request_Abstract $request The current request
* @param Zend_Controller_Response_Abstract $response The current response
* @return Array|Boolean User data, or FALSE
*/
public function authenticate(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
{
$facebook = $this->_getFacebookClient();
$authVars = $this->_getAuthVars();
$cookie = new Garp_Store_Cookie('Garp_Auth');
/**
* Send the user to Facebook to login and give us access.
* This happens when the form on the login page gets posted.
* Then this request will be made one more time; when the user comes back from Facebook.
* At that point he might has given us access, which is
* checked in the try {...} catch(){...} block below.
* Just note that any POST request here results in the user being redirected to Facebook.
*/
if ($request->isPost()) {
if (!empty($this->_extendedUserColumns)) {
$cookie->extendedUserColumns = serialize($this->_extendedUserColumns);
}
$cookie->writeCookie();
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$scope = isset($authVars->scope) ? $authVars->scope : null;
$redirector->gotoUrl($facebook->getLoginUrl(array('scope' => $scope)));
exit;
}
// Session based API call.
try {
if ($cookie->extendedUserColumns) {
$this->setExtendedUserColumns(unserialize($cookie->extendedUserColumns));
$cookie->destroy('extendedUserColumns');
}
$userData = $facebook->login(!!$authVars->grabUserImage);
$userData = $this->_getUserData($userData);
// Automatically fetch friends if so configured.
if (!empty($authVars->friends->collect) && $authVars->friends->collect) {
$bindingModel = 'Model_UserUser';
// A Sensible Default™
if (empty($authVars->friends->bindingModel)) {
$bindingModel = $authVars->friends->bindingModel;
}
$facebook->mapFriends(array('bindingModel' => $bindingModel, 'user_id' => $userData['id']));
}
return $userData;
} catch (FacebookApiException $e) {
$this->_addError($e->getMessage());
return false;
} catch (Exception $e) {
if (strpos($e->getMessage(), 'Duplicate entry') !== false && strpos($e->getMessage(), 'email_unique') !== false) {
$this->_addError(__('this email address already exists'));
return false;
}
throw $e;
$this->_addError(__('login error'));
return false;
}
}
示例11: getAutoSearchForm
/**
* Creates an autosearch form for indexAction.
*
* @return \Gems_Form|null
*/
protected function getAutoSearchForm()
{
$data = $this->getSearchData();
// \MUtil_Echo::track($data);
$this->form = $form = $this->createForm(array('name' => 'autosubmit', 'class' => 'form-inline', 'role' => 'form'));
$elements = $this->getAutoSearchElements($data);
if ($elements) {
// Assign a name so autosubmit will only work on this form (when there are others)
$form->setHtml('div');
$div = $form->getHtml();
$div->class = 'search';
$span = $div->div(array('class' => 'panel panel-default'))->div(array('class' => 'inputgroup panel-body'));
$elements[] = $this->getAutoSearchSubmit();
if ($reset = $this->getAutoSearchReset()) {
$elements[] = $reset;
}
foreach ($elements as $element) {
if ($element instanceof \Zend_Form_Element) {
$appendLabel = false;
if ($element->getLabel()) {
$labelDecor = $element->getDecorator('Label');
if ($labelDecor) {
$appendLabel = \Zend_Form_Decorator_Abstract::APPEND === $labelDecor->getPlacement();
if (!$appendLabel) {
$span->label($element);
}
}
}
$span->input($element);
if ($appendLabel) {
$span->label($element);
}
// TODO: Elementen automatisch toevoegen in \MUtil_Form
$form->addElement($element);
} elseif (null === $element) {
$span = $div->div(array('class' => 'panel panel-default'))->div(array('class' => 'inputgroup panel-body'));
} else {
$span[] = $element;
}
}
if ($this->request->isPost()) {
if (!$form->isValid($data)) {
$this->addMessage($form->getErrorMessages());
$this->addMessage($form->getMessages());
}
} else {
$form->populate($data);
}
$href = $this->getAutoSearchHref();
$form->setAutoSubmit($href, $this->containingId);
return $form;
}
}
示例12: preDispatch
/**
* Performs CSRF protection checks before dispatching occurs
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$this->_initializeTokens();
if ($request->isPost() === true && $this->_autoProtect) {
if (empty($this->_previousToken)) {
throw new RuntimeException('A possible CSRF attack detected - no token received');
}
$value = $request->getPost($this->_keyName);
if (!$this->isValidToken($value)) {
throw new RuntimeException('A possible CSRF attack detected - tokens do not match');
}
}
}
示例13: dispatchLoopStartup
/**
* @access public
* @param Zend_Controller_Request_Abstract $request
* @return boolean|null
*/
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
if (!$request->isPost()) {
return null;
}
$formHelperToken = $this->getHelper();
$token = $request->getPost($formHelperToken->getTokenKey());
if (!empty($token) && $formHelperToken->hasToken($token)) {
$formHelperToken->removeToken($token);
return true;
}
$this->_checkFailed($request);
return false;
}
示例14: preDispatch
/**
* Performs CSRF protection checks before dispatching occurs
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$this->_initializeTokens();
if ($request->isPost() === true) {
$this->_error->message = null;
if (empty($this->_previousToken)) {
$this->_error->message = Zend_Registry::get('t')->_('No token received, please re-submit the form');
}
//A possible CSRF attack detected - no token received
$value = $request->getPost($this->_keyName);
if (!$this->isValidToken($value)) {
$this->_error->message = Zend_Registry::get('t')->_('Tokens do not match, please re-submit the form');
}
//A possible CSRF attack detected - tokens do not match
}
}
示例15: routeStartup
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$this->_securitySession = new Zend_Session_Namespace('Zetta_Security');
if ($request->isPost() && (!$request->getParam('csrf_hash') || $request->getParam('csrf_hash') != $this->_securitySession->csrf_hash)) {
throw new Exception('Access Denied (csrf attack detected)', 401);
}
$this->_csrf_hash = md5(rand());
if (!$this->_securitySession->csrf_hash) {
$this->_securitySession->csrf_hash = $this->_csrf_hash;
}
$this->_view->headScript()->prependScript('
var _csrf_hash = "' . $this->_securitySession->csrf_hash . '";');
$this->_view->csrf_hash = $this->_securitySession->csrf_hash;
Zend_Controller_Front::getInstance()->unregisterPlugin($this)->registerPlugin($this, 1000000);
// перерегистрируем плагин чтобы dispatchLoopShutdown запустился последним
}