Esempio n. 1
0
 public function init()
 {
     $this->setMethod('post');
     // Hidden referrer url
     $urlFilter = new Zend_Filter_PregReplace();
     // Filter to remove any host names
     $urlFilter->setMatchPattern('/[a-zA-Z0-9]*:\\/\\/.*\\//');
     $urlFilter->setReplacement('/');
     $this->addElement('hidden', 'referrerUrl', array('required' => false, 'filters' => array($urlFilter)));
     // Email entry
     $this->addElement('text', 'email', array('required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address'))))));
     // Modify email error messages & add validator
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
     $this->getElement('email')->addValidator($emailValidator);
     // Password entry
     $this->addElement('password', 'password', array('required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your password'))))));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Retrieve My Quotes', 'class' => 'btn btn-primary pull-left'));
     // Add a resend validation link button
     $this->addElement('submit', 'resendValidation', array('ignore' => true, 'label' => 'Resend Account Validation', 'class' => 'btn btn-primary'));
     // Add a forgotten password button
     $this->addElement('submit', 'forgottenPassword', array('ignore' => true, 'label' => 'Reset Password', 'class' => 'btn btn-primary'));
     // Remove the label from the submit buttons
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     $element = $this->getElement('resendValidation');
     $element->removeDecorator('label');
     $element = $this->getElement('forgottenPassword');
     $element->removeDecorator('label');
     // Set up the decorator on the form and add in decorators which are removed
     /*$this->addDecorator('FormElements')
       ->addDecorator(
           'HtmlTag', 
           array('tag' => 'div', 'class' => 'form_section one-col')
           )
       ->addDecorator('Form');*/
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div')), 'Form'));
 }
Esempio n. 2
0
 public function __construct(array $config = array())
 {
     parent::__construct($config);
     $process = new Diggin_Scraper_Process();
     $process->setExpression($config['expression']);
     $process->setName('kumo');
     $process->setArrayFlag(isset($config['arrayflag']) ? (bool) $config['arrayflag'] : true);
     $process->setType(isset($config['type']) ? $config['type'] : 'TEXT');
     // use only first filter
     if (isset($config['filters'])) {
         if (($match = $config['filters']['matchpattern']) && ($replace = $config['filters']['replacement'])) {
             require_once 'Zend/Filter/PregReplace.php';
             $pregreplace = new Zend_Filter_PregReplace();
             $pregreplace->setMatchPattern($match);
             $pregreplace->setReplacement($replace);
             $process->setFilters(array($pregreplace));
         }
     }
     $this->scraper = new Diggin_Scraper();
     $this->scraper->process($process);
 }
Esempio n. 3
0
 public function content($acl = false, $fieldname = 'content', $label = 'Text:', $required = null)
 {
     $method = $acl ? 'addSupervisedElement' : 'addElement';
     $this->{$method}('textarea', $fieldname, array('label' => $label, 'filters' => array(new Base_Filter_Stripslashes()), 'validators' => array(array('Encoding', true, array('in_charset' => 'UTF-8'))), 'required' => is_null($required) ? $this->default_policy : $required, 'rows' => '20', 'cols' => '100', 'class' => 'bbcode_editor'));
     $filter = new Zend_Filter_PregReplace();
     $filter->setMatchPattern(array('/„/', '/”/', '//', '/–/', '/’/', '/…/', '/®/', '/©/', '/™/'))->setReplacement(array('„', '”', ' ', '–', '’', '…', '®', '©', '™'));
     $this->getElement($fieldname)->addFilter($filter);
     $this->notEmpty($fieldname);
 }