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


PHP Zend_Filter_PregReplace::setReplacement方法代码示例

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


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

示例1: init

 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'));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:41,代码来源:Login.php

示例2: __construct

 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);
 }
开发者ID:sasezaki,项目名称:spizer,代码行数:21,代码来源:ScrapeAndRequestSender.php


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