HTMLPurifier不起作用

时间:2017-03-04 12:07:30

标签: zend-framework3

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

class PostFieldset扩展了Fieldset实现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'
        )
    ));

public function 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

1 个答案:

答案 0 :(得分:0)

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