本文整理汇总了PHP中Zend_Controller_Request_Http::getPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::getPost方法的具体用法?PHP Zend_Controller_Request_Http::getPost怎么用?PHP Zend_Controller_Request_Http::getPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::getPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRequestParameters
public function getRequestParameters()
{
if ($this->request->isPost()) {
return $this->request->getPost();
} else {
return $this->request->getQuery();
}
}
示例2: addAction
public function addAction()
{
$form = new Front_Form_Contact();
if ($this->_request->isPost()) {
$data = $this->_request->getPost();
if ($form->isValid($data)) {
$dataFiltrees = $form->getValues();
$contact = new Application_Model_Contact();
$contact->setPrenom($dataFiltrees['prenom'])->setNom($dataFiltrees['nom'])->setEmail($dataFiltrees['email'])->setTelephone($dataFiltrees['telephone']);
$this->mapper->insert($contact);
$this->_flashMessenger->addMessage('Le contact ' . $contact->getPrenom() . ' a bien été créé');
$this->_redirector->gotoRouteAndExit(['controller' => 'contact'], null, true);
}
}
$this->view->contactForm = $form;
}
示例3: getPost
/**
* @access public
* @param string $key Key to search for in $_POST
* @param mixed $default Default value if $key is not found $_POST
* @param integer $filter Filter definition
* @param array $options Filter configuration
* @return mixed
*/
public function getPost($key = null, $default = null, $filter = null, array $options = null)
{
$value = parent::getPost($key, $default);
if ($filter !== null || $options !== null) {
$value = $this->_filter($value, $default, $filter, $options);
}
return $value;
}
示例4: testGetPost
public function testGetPost()
{
$_POST['post1'] = 'val1';
$this->assertEquals('val1', $this->_request->getPost('post1'));
$this->assertEquals('foo', $this->_request->getPost('BAR', 'foo'));
$_POST['post2'] = 'val2';
$expected = array('post1' => 'val1', 'post2' => 'val2');
$this->assertEquals($expected, $this->_request->getPost());
}
示例5: getPost
public function getPost($k = null, $default = null)
{
if (in_array('vars', $this->getParamSources())) {
if (!$this->isPost()) {
return $k === null ? array() : null;
}
if ($k === null) {
return $this->_vars;
} else {
return isset($this->_vars[$k]) ? $this->_vars[$k] : $default;
}
}
return parent::getPost($k, $default);
}
示例6: widget
/**
* Implements {@link iPMS_Widget_Interface::widget()}
*
* @param Zend_Controller_Request_Http $request
* @return Zend_Form|null A Zend_Form instance or null if user is already authenticated
*/
public function widget(Zend_Controller_Request_Http $request)
{
$auh = Zend_Auth::getInstance();
if (!$auh->hasIdentity()) {
$form = $this->getForm('loginForm');
if ($request->isPost() && is_array($request->getPost('loginForm')) && $form->isValid($request->getPost('loginForm'))) {
$authDbAdapter = new Zend_Auth_Adapter_DbTable(null, 'users', 'username', 'password', 'MD5(?) AND active = 1');
$authDbAdapter->setIdentity($form->getValue('username'))->setCredential($form->getValue('password'));
$result = $authDbAdapter->authenticate();
if ($result->isValid()) {
$auh->getStorage()->write($authDbAdapter->getResultRowObject(null, 'password'));
Zend_Session::regenerateId();
// Protection against session's fixation attacks
/**
* @var $redirector Zend_Controller_Action_Helper_Redirector
*/
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('/');
}
}
return $form;
}
return null;
}
示例7: match
/**
* Rewritten function of the standard controller. Tries to match the pathinfo on url parameters.
*
* @see Mage_Core_Controller_Varien_Router_Standard::match()
*
* @param Zend_Controller_Request_Http $request The http request object that needs to be mapped on Action
* Controllers.
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
//URL Search after habbeda
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
//$identifier = trim($request->getPathInfo(), '/');
if (strpos($url, "/alle/") <= 0 && strpos($url, "/all/") <= 0) {
return false;
}
// if successfully gained url parameters, use them and dispatch ActionController action
$request->setRouteName('landingpagesaa')->setModuleName('landingpagesaa')->setControllerName('index')->setActionName('index');
//->setParam('test', "test");
$urlpara = explode("/filter/", $url);
if (!empty($urlpara[1])) {
$urlparas = explode("?", $urlpara[1]);
// Parse url params
$params = explode('/', trim($urlparas[0], '/'));
$layerParams = array();
$total = count($params);
for ($i = 0; $i < $total - 1; $i++) {
if (isset($params[$i + 1])) {
$layerParams[$params[$i]] = urldecode($params[$i + 1]);
++$i;
}
}
// Add post params to parsed ones from url
// Usefull to easily override params
$layerParams += $request->getPost();
// Add params to request
$request->setParams($layerParams);
// Save params in registry - used later to generate links
Mage::register('layer_params', $layerParams);
}
$request->setRequestUri($url);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例8: editAction
public function editAction()
{
$itemId = $this->_request->getParam('id');
if (is_null($itemId)) {
$this->getRedirector()->gotoSimpleAndExit('index');
}
$page = $this->getModelMapper()->find($itemId, $this->getModel());
if (is_null($page)) {
throw new Zend_Controller_Action_Exception("Страница не найдена", 404);
}
//$this->view->item = $page;
$form = $this->getForm('edit');
$form->addElement('hidden', 'currentUrl');
$element = $form->getElement('currentUrl');
$element->setValue($this->_hostHttp->getServer('REQUEST_URI'));
$form->getDisplayGroup('basic')->addElement($element);
$dataPage = $page->getOptions();
foreach ($dataPage as $key => $value) {
$form->setDefault($key, $value);
}
foreach ($form->getElements() as $key => $element) {
if ($element instanceof Zend_Form_Element_Image) {
$imageValue = $form->getValue($element->getAttrib('data-input')) != '' ? $form->getValue($element->getAttrib('data-input')) : '/files/images/product/2012-05-22_foto_nv.jpg';
$form->setDefault($element->getName(), $imageValue);
}
}
if ($this->_hostHttp->isPost()) {
if ($form->isValid($this->_hostHttp->getPost())) {
$this->saveFormData($form);
$this->clearCache($this->_getNamespace());
$this->getRedirector()->gotoUrlAndExit($this->_request->getParam('currentUrl'));
}
$form->setDefaults($form->getValues());
}
$colsTable = $this->getModelMapper()->getDbTable()->info('cols');
$uri = in_array('full_path', $colsTable) ? $page->getFullPath() : $page->getPath();
$config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'На сайт', 'uri' => '/' . strtolower($this->getNameModule()) . '/' . $uri . '/')));
$containerNav = new Zend_Navigation($config);
$this->view->assign(array('item' => $page, 'form' => $form, 'container_nav' => $containerNav));
}
示例9: _checkBaseUrl
/**
* Auto-redirect to base url (without SID) if the requested url doesn't match it.
* By default this feature is enabled in configuration.
*
* @param Zend_Controller_Request_Http $request
*/
protected function _checkBaseUrl($request)
{
if (!Mage::isInstalled() || $request->getPost()) {
return;
}
if (!Mage::getStoreConfig('web/url/redirect_to_base')) {
return;
}
$adminPath = (string) Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH);
if (!$adminPath) {
$adminPath = (string) Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME);
}
if (preg_match('#^' . $adminPath . '(\\/.*)?$#', ltrim($request->getPathInfo(), '/')) && (string) Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_URL)) {
return;
}
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, Mage::app()->getStore()->isCurrentlySecure());
if (!$baseUrl) {
return;
}
$redirectCode = 302;
if (Mage::getStoreConfig('web/url/redirect_to_base') == 301) {
$redirectCode = 301;
}
$uri = @parse_url($baseUrl);
$host = isset($uri['host']) ? $uri['host'] : '';
$path = isset($uri['path']) ? $uri['path'] : '';
$requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
if ($host && $host != $request->getHttpHost() || $path && strpos($requestUri, $path) === false) {
Mage::app()->getFrontController()->getResponse()->setRedirect($baseUrl, $redirectCode)->sendResponse();
exit;
}
}
示例10: _checkBaseUrl
/**
* Auto-redirect to base url (without SID) if the requested url doesn't match it.
* By default this feature is enabled in configuration.
*
* @param Zend_Controller_Request_Http $request
*/
protected function _checkBaseUrl($request)
{
if (!Mage::isInstalled() || $request->getPost()) {
return;
}
if (!Mage::getStoreConfig('web/url/redirect_to_base')) {
return;
}
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, Mage::app()->getStore()->isCurrentlySecure());
if (!$baseUrl) {
return;
}
$redirectCode = 302;
if (Mage::getStoreConfig('web/url/redirect_to_base') == 301) {
$redirectCode = 301;
}
$uri = @parse_url($baseUrl);
$host = isset($uri['host']) ? $uri['host'] : '';
$path = isset($uri['path']) ? $uri['path'] : '';
$requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
if ($host && $host != $request->getHttpHost() || $path && strpos($requestUri, $path) === false) {
Mage::app()->getFrontController()->getResponse()->setRedirect($baseUrl, $redirectCode)->sendResponse();
exit;
}
}
示例11: getRawPost
public function getRawPost($key = null, $default = null)
{
return parent::getPost($key = null, $default = null);
}
示例12: setFilterData
/**
* Ustawia wartosci filtrow
*
* Jezeli dostarczono parametry filtrow poprzez POST, zostaja one walidowane
* poprzez formularz. Jezeli nie bedzie bledow, dane zostana zapisane
* w tablicy filtrow oraz przekazane do formularza filtrow.
*
* @param Zend_Controller_Request_Http $request
* @throws Logic_Search_Exception
* @return Logic_Search_Abstract
*/
public function setFilterData(Zend_Controller_Request_Http $request)
{
if (!is_object($this->_form)) {
throw new Logic_Search_Exception('Nie ustanowiono obiektu formularza filtrow');
}
$values = $request->getPost();
unset($values['ids']);
if (!empty($values)) {
if ($this->_form->isValid($values)) {
$this->saveFilterData($this->_form->getValues());
}
}
$this->_form->setDefaults($this->getFilterData());
return $this;
}
示例13: _checkShouldBeSecure
/**
* Check that request uses https protocol if it should.
* Function redirects user to correct URL if needed.
*
* @param Zend_Controller_Request_Http $request
* @param string $path
* @return void
*/
protected function _checkShouldBeSecure(Zend_Controller_Request_Http $request, $path = '')
{
if (!Mage::isInstalled() || $request->getPost()) {
return;
}
if ($this->_shouldBeSecure($path) && !$request->isSecure()) {
$url = $this->_getCurrentSecureUrl($request);
if ($this->_shouldRedirectToSecure()) {
$url = Mage::getSingleton('Mage_Core_Model_Url')->getRedirectUrl($url);
}
Mage::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse();
exit;
}
}
示例14: __saveEmployee
/**
*
* @param \Zend_Controller_Request_Http $request
* @return booloean
*/
private function __saveEmployee($request)
{
$employee = new Employee_Model_Employee($request->getPost());
$empoyeeMapper = new Employee_Model_EmployeeMapper();
return $empoyeeMapper->save($employee);
}
示例15: _mergeValue
/**
* Merge session value and post value
*
* @param array $names Value to merge
* @param mixed $namespace Session namespace
* @access protected
* @return array Merged param value
*/
protected function _mergeValue(array $names, $namespace)
{
$session = new Zend_Session_Namespace($namespace);
$params = array();
foreach ($names as $key => $val) {
$params[$val] = $this->_request->getPost($val);
}
if (isset($session->params)) {
$params = array_merge($session->params, $params);
}
return $params;
}