当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Filter_Input类代码示例

本文整理汇总了PHP中Zend_Filter_Input的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Filter_Input类的具体用法?PHP Zend_Filter_Input怎么用?PHP Zend_Filter_Input使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Filter_Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareSave

 /**
  * Preapares data for saving of subscriber
  * Add the line for rapidmail status
  *
  * @param  Mage_Newsletter_Model_Subscriber $subscriber
  * @return array
  */
 protected function _prepareSave(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     $data = array();
     $data['customer_id'] = $subscriber->getCustomerId();
     $data['store_id'] = $subscriber->getStoreId() ? $subscriber->getStoreId() : 0;
     $data['subscriber_status'] = $subscriber->getStatus();
     $data['subscriber_email'] = $subscriber->getEmail();
     $data['subscriber_confirm_code'] = $subscriber->getCode();
     $data['rapidmail_status'] = $subscriber->getRapidmailStatus();
     if ($subscriber->getIsStatusChanged()) {
         $data['change_status_at'] = Mage::getSingleton('core/date')->gmtDate();
     }
     $validators = array('subscriber_email' => 'EmailAddress');
     $filters = array();
     $input = new Zend_Filter_Input($filters, $validators, $data);
     $session = Mage::getSingleton($this->_messagesScope);
     if ($input->hasInvalid() || $input->hasMissing()) {
         foreach ($input->getMessages() as $message) {
             if (is_array($message)) {
                 foreach ($message as $error) {
                     $session->addError($error);
                 }
             } else {
                 $session->addError($message);
             }
         }
         Mage::throwException(Mage::helper('newsletter')->__('Form was filled incorrectly'));
     }
     return $data;
 }
开发者ID:narf-studios,项目名称:magento-rapidmail,代码行数:37,代码来源:Subscriber.php

示例2: contactUsAction

 public function contactUsAction()
 {
     $filters = array('name' => 'StringTrim', 'tel' => 'StringTrim', 'email' => 'StringTrim', 'enquiry' => 'StringTrim');
     $validators = array('name' => 'NotEmpty', 'tel' => 'NotEmpty', 'email' => 'NotEmpty', 'enquiry' => 'NotEmpty');
     $input = new Zend_Filter_Input($filters, $validators, $_POST);
     $returnArray = array();
     if ($input->isValid()) {
         $emailer = new Application_Core_Mail();
         $params = Zend_Registry::get('params');
         $emailer->setTo($params->email->contactUs, 'HomeLet');
         $emailer->setFrom($input->email, $input->name);
         $emailer->setSubject('HomeLet - Contact Us Form');
         $bodyHtml = 'Name : ' . $input->name . '<br />';
         $bodyHtml .= 'Email : ' . $input->email . '<br />';
         $bodyHtml .= 'Tel : ' . $input->tel . '<br />';
         $bodyHtml .= 'Enquiry : <pre>' . $input->enquiry . '</pre><br />';
         $emailer->setBodyHtml($bodyHtml);
         if ($emailer->send()) {
             // Email sent successfully
             $returnArray['success'] = true;
             $returnArray['errorMessage'] = '';
         } else {
             $returnArray['success'] = false;
             $returnArray['errorMessage'] = 'Problem sending email.';
         }
     } else {
         $returnArray['success'] = false;
         $returnArray['errorMessage'] = $input->getMessages();
     }
     echo Zend_Json::encode($returnArray);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:31,代码来源:IndexController.php

示例3: searchAction

 public function searchAction()
 {
     $filters = array('q' => array('StringTrim', 'StripTags'));
     $validators = array('q' => array('presence' => 'required'));
     $input = new Zend_Filter_Input($filters, $validators, $_GET);
     if (is_string($this->_request->getParam('q'))) {
         $queryString = $input->getEscaped('q');
         $this->view->queryString = $queryString;
         if ($input->isValid()) {
             $config = Zend_Registry::get('config');
             $index = App_Search_Lucene::open($config->luceneIndex);
             $query = new Zend_Search_Lucene_Search_Query_Boolean();
             $pathTerm = new Zend_Search_Lucene_Index_Term($queryString);
             $pathQuery = new Zend_Search_Lucene_Search_Query_Term($pathTerm);
             $query->addSubquery($pathQuery, true);
             $pathTerm = new Zend_Search_Lucene_Index_Term('20091023', 'CreationDate');
             $pathQuery = new Zend_Search_Lucene_Search_Query_Term($pathTerm);
             $query->addSubquery($pathQuery, true);
             try {
                 $hits = $index->find($query);
             } catch (Zend_Search_Lucene_Exception $ex) {
                 $hits = array();
             }
             $this->view->hits = $hits;
         } else {
             $this->view->messages = $input->getMessages();
         }
     }
 }
开发者ID:philipnorton42,项目名称:PDFSearch,代码行数:29,代码来源:IndexController.php

示例4: _savePanel

 /**
  * Save changes to an existing panel. This can be expanded to allow adding of new Panels in the future.
  *
  * @return void
  */
 protected function _savePanel()
 {
     // First of all we need to validate and sanitise the input from the form
     $urlFilter = new Zend_Filter();
     $urlFilter->addFilter(new Zend_Filter_StringTrim());
     $urlFilter->addFilter(new Zend_Filter_StringTrim('/'));
     $requiredText = new Zend_Validate();
     $requiredText->addValidator(new Zend_Validate_NotEmpty());
     $filters = array('id' => 'Digits');
     $validators = array('id' => array('allowEmpty' => true), 'content' => array('allowEmpty' => true));
     $input = new Zend_Filter_Input($filters, $validators, $_POST);
     if ($input->isValid()) {
         // Data is all valid, formatted and sanitized so we can save it in the database
         $panel = new Datasource_Cms_Panels();
         if (!$input->id) {
             // This is a new panel so we need to create a new ID
             // NOT IMPLEMENTED - YET
         } else {
             $panel->saveChanges($input->id, $input->getUnescaped('content'));
             $panelID = $input->id;
         }
         // Changes saved - so send them back with a nice success message
         $this->_helper->getHelper('FlashMessenger')->addMessage(array('saved' => true));
         $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/panels/edit?id=' . $panelID);
     } else {
         // Invalid data in form
         /*
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
         */
     }
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:38,代码来源:PanelsController.php

示例5: removeContactAction

 /**
  * 
  * Remove an existing contact
  */
 public function removeContactAction()
 {
     $return = array();
     $pageSession = new Zend_Session_Namespace('letting_agents_application');
     $contactManager = new LettingAgents_Manager_Contacts();
     $postData = $this->getRequest()->getParams();
     $filters = array('uid' => 'StringTrim', 'uid' => 'StripTags');
     $validators = array('uid' => 'Alnum');
     $input = new Zend_Filter_Input($filters, $validators, $postData);
     if ($input->isValid()) {
         // Valid input
         $contactManager->deleteByUid($input->uid);
     } else {
         // false
         $return['errorHtml'] = 'Invalid Contact';
     }
     $agent = new LettingAgents_Manager_AgentApplication();
     $agentData = new LettingAgents_Object_AgentApplication();
     $agentData = $agent->fetchByUid($pageSession->agentUniqueId);
     $organisation_type = $agentData->get_organisation_type();
     switch ($organisation_type) {
         case LettingAgents_Object_CompanyTypes::LimitedCompany:
             $partialFile = "limited-company-list.phtml";
             break;
         case LettingAgents_Object_CompanyTypes::LimitedLiabilityPartnership:
         case LettingAgents_Object_CompanyTypes::Partnership:
             $partialFile = "partnership-list.phtml";
             break;
     }
     $return['contactHtml'] = $this->view->partialLoop("partials/{$partialFile}", $contactManager->fetchByAgencyUid($pageSession->agentUniqueId));
     echo Zend_Json::encode($return);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:36,代码来源:SignUpJsonController.php

示例6: editAction

 public function editAction()
 {
     $form = new C3op_Form_ReceivableEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         if ($form->isValid($postData)) {
             $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/projects/project/success-create');
         } else {
             throw new C3op_Projects_ProjectException("A project must have a valid title.");
         }
     } else {
         $data = $this->_request->getParams();
         $filters = array('id' => new Zend_Filter_Alnum());
         $validators = array('id' => new C3op_Util_ValidId());
         $input = new Zend_Filter_Input($filters, $validators, $data);
         if ($input->isValid()) {
             $id = $input->id;
             if (!isset($this->receivableMapper)) {
                 $this->receivableMapper = new C3op_Projects_ReceivableMapper($this->db);
             }
             $thisReceivable = $this->receivableMapper->findById($id);
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'title', $thisReceivable->GetTitle());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
             $this->SetDateValueToFormField($form, 'predictedDate', $thisReceivable->GetPredictedDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'predictedValue', $thisReceivable->GetPredictedValue());
             $this->SetDateValueToFormField($form, 'realDate', $thisReceivable->GetRealDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'realValue', $thisReceivable->GetRealValue());
             $projectId = $this->populateProjectFields($thisReceivable->GetProject(), $form);
         }
     }
 }
开发者ID:racporto,项目名称:c3op,代码行数:34,代码来源:ReceivableController.php

示例7: showAction

 public function showAction()
 {
     $params = $this->getRequest()->getUserParams();
     $filters = array('wherecolumn' => 'alnum', 'order' => 'alnum', 'count' => 'digits', 'offset' => 'digits');
     $valids = array('wherecolumn' => array('presence' => 'optional'), 'wherevalue' => array('presence' => 'optional'), 'order' => array('presence' => 'optional'), 'count' => array('int', 'default' => 20), 'offset' => 'int');
     $input = new Zend_Filter_Input($filters, $valids, $params);
     if (!$input->isValid()) {
         $this->_redirect();
     }
     $whereColumn = $input->wherecolumn;
     $whereValue = $input->wherevalue;
     $order = $input->order;
     $count = $input->count;
     $offset = $input->offset;
     $db = $this->_model->getAdapter();
     $tableInfo = $this->_model->info();
     $this->view->tableInfo = $tableInfo;
     $where = null;
     if ($whereColumn) {
         $expr = $db->quoteIdentifier($whereColumn) . ' IN (?)';
         $where = $db->quoteInto($expr, $whereValue);
     }
     $this->view->rowset = $this->_model->fetchAll($where, $order, $count, $offset);
     $select = $db->select()->from($tableInfo['name'], 'COUNT(*)');
     $this->view->rowCount = $db->fetchOne($select);
     $this->view->distinctValues = array();
     foreach ($tableInfo['cols'] as $columnName) {
         $select = $db->select()->from($tableInfo['name'], $columnName)->distinct();
         $this->view->distinctValues[$columnName] = $db->fetchCol($select);
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:GridController.php

示例8: loaddataorderspaymentAction

 public function loaddataorderspaymentAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     $aInputFilters = array("*" => array(new Zend_Filter_StringTrim()));
     $aInputValidators = array("num_row_per_page" => array(new Zend_Validate_Digits()), "curr_page" => array(new Zend_Validate_Digits()), "sort_column" => array(new AppCms2_Validate_SpecialAlpha()), "sort_method" => array(new Zend_Validate_Alpha()));
     $oInput = new Zend_Filter_Input($aInputFilters, $aInputValidators, $_POST);
     $nNumRowPerPage = $oInput->getUnescaped("num_row_per_page");
     $nCurrPage = $oInput->getUnescaped("curr_page");
     $sSortColumn = $oInput->getUnescaped("sort_column");
     $sSortMethod = $oInput->getUnescaped("sort_method");
     $aFilter = array();
     foreach ($aFilter as $sKey => $sValue) {
         if (!isset($sValue)) {
             unset($aFilter[$sKey]);
         }
     }
     $oModelVOrderPaymentHistory = new User_Model_VOrderPaymentHistory();
     $oRowset = $oModelVOrderPaymentHistory->getUserPayments($aFilter, $nNumRowPerPage, ($nCurrPage - 1) * $nNumRowPerPage, $sSortColumn . " " . $sSortMethod);
     $nNumRows = $oModelVOrderPaymentHistory->getUserPayments($aFilter)->count();
     $aJson = array("rowset" => $oRowset->toArray(), "num_rows" => $nNumRows);
     header("Content-type: application/json");
     echo Zend_Json::encode($aJson);
     exit;
 }
开发者ID:lstaszak,项目名称:zf_zk_aleph,代码行数:25,代码来源:PaymentController.php

示例9: _sanitizeData

 private function _sanitizeData()
 {
     Fgsl_Session_Namespace::init('session');
     $filterInput = new Zend_Filter_Input(null, null, $_POST);
     $filterInput->setDefaultEscapeFilter('StripTags');
     Fgsl_Session_Namespace::set('post', $filterInput);
 }
开发者ID:rogeriopradoj,项目名称:temostudo,代码行数:7,代码来源:Bootstrap.php

示例10: usunAction

 function usunAction()
 {
     $post = new Zend_Filter_Input($_POST);
     $respondent = new Respondenci();
     $db = $respondent->getAdapter();
     $params = $this->_action->getParams();
     if (isset($params['id'])) {
         $id = (int) $params['id'];
         $num = (int) $params['page'];
         $where = $db->quoteInto('id_respondent = ?', $id);
         $respondent->delete($where);
         $this->_forward('respondenci', 'edytuj', array('page' => $num));
     } else {
         $what = trim($post->noTags('Umail'));
         $where = $db->quoteInto('e_mail = ?', $what);
         try {
             if (empty($what)) {
                 throw new Respondenci_Exception('Podaj adres e-mail.');
             }
             $respondent->delete($where);
             $this->_redirect('/respondenci/');
         } catch (Respondenci_Exception $e) {
             $this->_forward('respondenci', 'index', array('insertionError' => $e->getMessage()));
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:phppool,代码行数:26,代码来源:RespondenciController.php

示例11: executeInternal

 /**
  * @return void
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function executeInternal()
 {
     if ($this->getRequest()->getPostValue()) {
         try {
             /** @var \Magento\CatalogRule\Model\Rule $model */
             $model = $this->_objectManager->create('Magento\\CatalogRule\\Model\\Rule');
             $this->_eventManager->dispatch('adminhtml_controller_catalogrule_prepare_save', ['request' => $this->getRequest()]);
             $data = $this->getRequest()->getPostValue();
             $inputFilter = new \Zend_Filter_Input(['from_date' => $this->_dateFilter, 'to_date' => $this->_dateFilter], [], $data);
             $data = $inputFilter->getUnescaped();
             $id = $this->getRequest()->getParam('rule_id');
             if ($id) {
                 $model->load($id);
                 if ($id != $model->getId()) {
                     throw new LocalizedException(__('Wrong rule specified.'));
                 }
             }
             $validateResult = $model->validateData(new \Magento\Framework\DataObject($data));
             if ($validateResult !== true) {
                 foreach ($validateResult as $errorMessage) {
                     $this->messageManager->addError($errorMessage);
                 }
                 $this->_getSession()->setPageData($data);
                 $this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
                 return;
             }
             $data['conditions'] = $data['rule']['conditions'];
             unset($data['rule']);
             $model->loadPost($data);
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setPageData($model->getData());
             $model->save();
             $this->messageManager->addSuccess(__('You saved the rule.'));
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setPageData(false);
             if ($this->getRequest()->getParam('auto_apply')) {
                 $this->getRequest()->setParam('rule_id', $model->getId());
                 $this->_forward('applyRules');
             } else {
                 if ($model->isRuleBehaviorChanged()) {
                     $this->_objectManager->create('Magento\\CatalogRule\\Model\\Flag')->loadSelf()->setState(1)->save();
                 }
                 if ($this->getRequest()->getParam('back')) {
                     $this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
                     return;
                 }
                 $this->_redirect('catalog_rule/*/');
             }
             return;
         } catch (LocalizedException $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\Exception $e) {
             $this->messageManager->addError(__('Something went wrong while saving the rule data. Please review the error log.'));
             $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setPageData($data);
             $this->_redirect('catalog_rule/*/edit', ['id' => $this->getRequest()->getParam('rule_id')]);
             return;
         }
     }
     $this->_redirect('catalog_rule/*/');
 }
开发者ID:nblair,项目名称:magescotch,代码行数:63,代码来源:Save.php

示例12: _filterInputBlock

 protected function _filterInputBlock($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'value' => array(array('Alnum', array('allowwhitespace' => true))), 'long_description' => array(), 'conclusion_text' => array(array('Alnum', array('allowwhitespace' => true)))), array('questionnaire_id' => array('NotEmpty'), 'designation' => array('allowEmpty' => true), 'value' => array('NotEmpty', 'messages' => array('O nome do bloco não pode ser vazio.')), 'long_description' => array('allowEmpty' => true), 'conclusion_text' => array('allowEmpty' => true)), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:8,代码来源:Block.php

示例13: _filterInputQuestion

 protected function _filterInputQuestion($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'term' => array(array('Alnum', array('allowwhitespace' => true))), 'description' => array(array('HtmlEntities'))), array('term' => array('NotEmpty'), 'description' => array('NotEmpty')), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:8,代码来源:Glossary.php

示例14: _filterInputECAC

 protected function _filterInputECAC($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('enterprise_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa'), 'presence' => 'required'), 'competition_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa'), 'presence' => 'required'), 'category_award_id' => array('NotEmpty', 'messages' => array('Escolha a categoria do premio'), 'presence' => 'required'), 'token' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:8,代码来源:EnterpriseCategoryAwardCompetition.php

示例15: _filterInputEnterpriseProgramaRank

 protected function _filterInputEnterpriseProgramaRank($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('enterprise_id_key' => array('allowEmpty' => true), 'user_id' => array('allowEmpty' => true), 'programa_id' => array('allowEmpty' => true), 'classificar' => array('allowEmpty' => true), 'desclassificar' => array('allowEmpty' => true), 'justificativa' => array('allowEmpty' => true), 'classificado_verificacao' => array('allowEmpty' => true), 'desclassificado_verificacao' => array('allowEmpty' => true), 'motivo_desclassificado_verificacao' => array('allowEmpty' => true), 'classificado_ouro' => array('allowEmpty' => true), 'classificado_prata' => array('allowEmpty' => true), 'classificado_bronze' => array('allowEmpty' => true), 'desclassificado_final' => array('allowEmpty' => true), 'motivo_desclassificado_final' => array('allowEmpty' => true), 'classificar_nacional' => array('allowEmpty' => true), 'desclassificar_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_nacional' => array('allowEmpty' => true), 'classificar_fase2_nacional' => array('allowEmpty' => true), 'desclassificar_fase2_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_fase2_nacional' => array('allowEmpty' => true), 'classificado_ouro_nacional' => array('allowEmpty' => true), 'classificado_prata_nacional' => array('allowEmpty' => true), 'classificado_bronze_nacional' => array('allowEmpty' => true), 'classificar_fase3_nacional' => array('allowEmpty' => true), 'desclassificar_fase3_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_fase3_nacional' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:8,代码来源:EnterpriseProgramaRank.php


注:本文中的Zend_Filter_Input类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。