2017-03-04 44 views
-1

我用htmlpurifier为形式的过滤器。但是在迁移zf2-> zf3之后它不起作用。 “插件管理器Zend \ Filter \ FilterPluginManager”中找不到名为“htmlpurifier”的插件。虽然在模块配置htmlpurifier存在。HTMLPurifier不起作用

类PostFieldset延伸字段集实现InputFilterProviderInterface:

public function __construct(PostInterface $post, HydratorInterface $hydrator, $name = "post", $options = array()) 

    parent::__construct($name, $options); 

    $this->setHydrator($hydrator); 
    $this->setObject($post); 

    ... 

    $this->add(array(
     'type' => 'textarea', 
     'name' => 'text', 
     'attributes'=>array(
      'class' => 'form-control', 
      'required' => 'required', 
      'rows' => '3', 
     ), 
     'options' => array(
      'label' => 'The text' 
     ) 
    )); 

公共函数getInputFilterSpecification():

return array(

     'text' => array(
      'required' => true, 
      'filters'=>array(
       array(
        'name' => 'htmlpurifier' 
       ), 
      ), 
      'validators' => array(
       array(
        'name'=>'StringLength', 
        'options'=>array(
         'encoding'=>'UTF-8', 
         'min'=>1, 
         'max'=>250000, 
        ) 
       ) 
      ) 
     ), 

模块配置在zenddevelopertools:

'filters' => 
array (size=2) 
    'factories' => 
    array (size=1) 
     'Soflomo\Purifier\PurifierFilter' => string 'Soflomo\Purifier\Factory\PurifierFilterFactory' (length=46) 
    'aliases' => 
    array (size=1) 
     'htmlpurifier' => string 'Soflomo\Purifier\PurifierFilter' (length=31) 

https://bitbucket.org/mad-max/blog-note3

回答

0

删除供应商文件夹并再次安装已帮助。