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


PHP Form::addAntispam方法代码示例

本文整理汇总了PHP中Nette\Application\UI\Form::addAntispam方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addAntispam方法的具体用法?PHP Form::addAntispam怎么用?PHP Form::addAntispam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\UI\Form的用法示例。


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

示例1: createComponentSendMessageForm

 /** form for sending message
  * 
  * @return \Nette\Application\UI\Form
  */
 public function createComponentSendMessageForm()
 {
     $form = new Form();
     $form->addText('email', 'Váš email')->addRule(Form::EMAIL, 'Email není platný')->addRule(Form::FILLED, 'Musíte zadat svůj email.');
     $form->addTextArea('text', 'Váš vzkaz')->addRule(Form::FILLED, 'Nelze odeslat prázdnou zprávu')->setAttribute('placeholder', 'Váš vzkaz pro nás.');
     $form->addAntispam('kontrolni', 'Následující políčko vymažte!', 'Jsi spamovací robot?!');
     $form->addSubmit('send', 'Odeslat');
     $form->getElementPrototype()->class('ajax');
     $form->onSuccess[] = $this->sendMessageFormSubmitted;
     return $form;
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:15,代码来源:BaseNormalPresenter.php

示例2: createComponentEditItemForm

 /** form for editing item 
  * 
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentEditItemForm()
 {
     $form = new Form();
     //$userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
     if ($this->pageConfig) {
         /** for each item from configuration for this page create form item
          * 
          */
         foreach ($this->pageConfig["form"] as $item => $params) {
             $formItem = NULL;
             switch ($params["type"]) {
                 case "calendar":
                     //$formItem = $form->addDate($item, $params['text'], Vodacek\Forms\Controls\DateInput::TYPE_DATE);
                     //$formItem = $form->addText($item, $params['text'], 40, 100);
                     $formItem = $form->addDatePicker($item, $params['text']);
                     /** check for minimal date */
                     $min = new DateTime('-100 years 00:00');
                     $max = new DateTime('+100 years 00:00');
                     if (isset($params["min"])) {
                         switch ($params["min"]) {
                             case 'today':
                                 $min = new DateTime('-0 days 00:00');
                                 break;
                             default:
                                 $min = new DateTime($params["min"] . ' 00:00');
                                 break;
                         }
                     }
                     /** check for maximal date */
                     if (isset($params["max"])) {
                         switch ($params["max"]) {
                             case 'today':
                                 $max = new DateTime('+0 days 00:00');
                                 break;
                             default:
                                 $max = new DateTime($params["max"] . ' 00:00');
                                 break;
                         }
                     }
                     $formItem->setAttribute('min', $min->format('Y-m-d'))->setAttribute('max', $max->format('Y-m-d'));
                     break;
                 case "shortText":
                     $formItem = $form->addText($item, $params['text'], 40, 100);
                     break;
                 case "longText":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 5);
                     break;
                 case "location":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 3);
                     break;
                 case "select":
                     $formItem = $form->addSelect($item, $params['text'])->setItems($params["options"])->setPrompt('Vyberte');
                     /** set default value for select if any */
                     if (isset($params["defaultValue"])) {
                         $formItem->setDefaultValue($params["defaultValue"]);
                     }
                     break;
             }
             /** if it is mandatory set rule */
             if (isset($params["mandatory"]) && $params["mandatory"]) {
                 $formItem->addRule(Form::FILLED, 'Je nutné vyplnit "' . $params['text'] . '".');
             }
             /** if it has a hint, show it */
             if (isset($params["hint"])) {
                 $formItem->setOption('description', $params["hint"]);
             }
             /** set actual value if any */
             if (isset($this->editingItem->{$item})) {
                 if ($params["type"] == 'calendar') {
                     //$formItem->setDefaultValue();
                     if (gettype($this->editingItem->{$item}) == 'object') {
                         $this->editingItem->{$item} = $this->editingItem->{$item}->date;
                     }
                 }
                 $formItem->setDefaultValue($this->unescapeTags($this->editingItem->{$item}));
             }
         }
     }
     if (!empty($this->pageConfig['settings']['sendEmail'])) {
         $text = $this->adminEdit ? 'Email' : 'Váš email';
         $form->addText('email', $text, 40, 100)->setDefaultValue($this->editingRow->authorEmail)->setDisabled(TRUE);
     }
     $form->addSelect('delete', 'Chcete tento záznam smazat?')->setItems(array('Ne', 'ANO'));
     $form->addAntispam('kontrolni', 'Následující políčko vymažte!', 'Jsi spamovací robot?!');
     $form->addSubmit('save', 'Uložit');
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div';
     $renderer->wrappers['pair']['container'] = 'dl';
     $renderer->wrappers['label']['container'] = 'dt';
     $renderer->wrappers['control']['container'] = 'dd';
     $form->getElementPrototype()->class('ajax');
     $form->onSuccess[] = $this->editItemFormSubmitted;
     return $form;
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:98,代码来源:EditPresenter.php

示例3: createComponentFeedbackWebForm

 public function createComponentFeedbackWebForm()
 {
     $form = new Form();
     $form->addAntispam();
     $form->addText('name', 'Kontakt:', '', 256);
     $form->addTextArea('note', 'Co se pokazilo? ')->addRule(Form::FILLED, 'Zadejte prosím, co se pokazilo.');
     $form->addSubmit('submit', 'Odeslat');
     $form->onSuccess[] = callback($this, 'processFeedbackWebForm');
     return $form;
 }
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:10,代码来源:DefaultPresenter.php

示例4: createComponentUpdateForm

 /**
  * Form for updating password when you forgot it
  *
  * @return Form
  */
 protected function createComponentUpdateForm()
 {
     $form = new Form();
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addAntispam();
     $form->addHidden('recover_username');
     $form->addHidden('token');
     $form->addPassword('recover_password', 'Heslo:')->setRequired('Zvolte si heslo')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaky', 4)->setOption('description', \Nette\Utils\Html::el('td')->setText('Alespoň 4 znaky'));
     $form->addPassword('password_confirm', 'Heslo znovu:')->setRequired('Zadejte prosím heslo ještě jednou pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $form['recover_password']);
     $form->addSubmit('send', 'Změnit');
     $form->onSuccess[] = $this->updateFormSucceded;
     return $form;
 }
开发者ID:patrickkusebauch,项目名称:27skauti,代码行数:18,代码来源:SignPresenter.php

示例5: createComponentNewItemForm

 /** form for adding new item 
  * 
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentNewItemForm()
 {
     $form = new Form();
     //$userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
     if ($this->pageConfig) {
         /** for each item from configuration for this page create form item
          * 
          */
         foreach ($this->pageConfig["form"] as $item => $params) {
             $formItem = NULL;
             switch ($params["type"]) {
                 case "calendar":
                     //$formItem = $form->addDate($item, $params['text'], Vodacek\Forms\Controls\DateInput::TYPE_DATE);
                     //$formItem = $form->addText($item, $params['text'], 40, 100);
                     $formItem = $form->addDatePicker($item, $params['text']);
                     //$formItem->addRule(Form::VALID, 'Zadané datum není platné!');
                     /** check for minimal date */
                     $min = new DateTime('-100 years 00:00');
                     $max = new DateTime('+100 years 00:00');
                     if (isset($params["min"])) {
                         switch ($params["min"]) {
                             case 'today':
                                 $min = new DateTime('-0 days 00:00');
                                 break;
                             default:
                                 $min = new DateTime($params["min"] . ' 00:00');
                                 break;
                         }
                     }
                     /** check for maximal date */
                     if (isset($params["max"])) {
                         switch ($params["max"]) {
                             case 'today':
                                 $max = new DateTime('+0 days 00:00');
                                 break;
                             default:
                                 $max = new DateTime($params["max"] . ' 00:00');
                                 break;
                         }
                     }
                     $formItem->setAttribute('min', $min->format('Y-m-d'))->setAttribute('max', $max->format('Y-m-d'));
                     break;
                 case "shortText":
                     $formItem = $form->addText($item, $params['text'], 40, 100);
                     break;
                 case "longText":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 5);
                     break;
                 case "location":
                     $formItem = $form->addTextArea($item, $params['text'], 40, 3);
                     break;
                 case "select":
                     $formItem = $form->addSelect($item, $params['text'])->setItems($params["options"])->setPrompt('Vyberte');
                     /** set default value for select if any */
                     if (isset($params["defaultValue"])) {
                         $formItem->setDefaultValue($params["defaultValue"]);
                     }
                     break;
             }
             /** if it is mandatory set rule */
             if (isset($params["mandatory"]) && $params["mandatory"]) {
                 $formItem->addRule(Form::FILLED, 'Je nutné vyplnit "' . $params['text'] . '".');
             }
             /** if it has a hint, show it */
             if (isset($params["hint"])) {
                 $formItem->setOption('description', $params["hint"]);
                 if (gettype($params["hint"]) == 'string') {
                     $formItem->setAttribute('title', $params["hint"])->setOption('description', $params["hint"]);
                 }
             }
             /** add placeholder, if any */
             if (isset($params["placeholder"])) {
                 $formItem->setAttribute('placeholder', $params["placeholder"]);
             }
             /** set default value if any */
             if (isset($params["defaultValue"])) {
                 $formItem->setDefaultValue($params["defaultValue"]);
             }
         }
     }
     if (!empty($this->pageConfig['settings']['sendEmail'])) {
         $hintText = 'Tento email nebude zveřejněn; bude vám na něj zaslán odkaz na stránku, na které můžete zde zadané hodnoty zpětně upravit.';
         $session = $this->getSession('agility');
         $defaultVal = '@';
         //$session->email == NULL ? '@' : $session->email;
         $form->addText('email', 'Váš email:', 40, 100)->setDefaultValue($defaultVal)->setType('e-mail')->addRule(Form::FILLED, 'Je nutné zadat email.')->addRule(Form::EMAIL, 'Nezadali jste platnou emailovou adresu.')->setAttribute('title', $hintText)->setOption('description', $hintText);
     }
     $form->addAntispam('kontrolni');
     $form->addSubmit('create', 'Vytvořit');
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div';
     $renderer->wrappers['pair']['container'] = 'dl';
     $renderer->wrappers['label']['container'] = 'dt';
     $renderer->wrappers['control']['container'] = 'dd';
     $form->getElementPrototype()->class('ajax');
     $form->onSuccess[] = $this->newItemFormSubmitted;
//.........这里部分代码省略.........
开发者ID:BroukPytlik,项目名称:agility,代码行数:101,代码来源:ItemPresenter.php


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