2017 © Pedro Peláez
 

library html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

image

athoshun/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  • Friday, February 13, 2015
  • by athoshun
  • Repository
  • 3 Watchers
  • 15 Stars
  • 8,251 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 9 Versions
  • 18 % Grown

The README.md

HTMLFilter

Build
Status Latest build report, (*1)

Remove tags or attributes based on a whitelist from a snippet of somewhat well-formatted HTML text using PHP's DOM library., (*2)

Example:, (*3)

<?php

$config = new AthosHun\HTMLFilter\Configuration();
$config->allowTag("p")
       ->allowAttribute("a", "title")
       ->allowAttribute("a", "href", "|^https?://.*\$|");

$filter = new AthosHun\HTMLFilter\HTMLFilter();

$html = <<<HTML
Lorem ipsum <em>dolor</em> sit amet


Consectetur adipisicing elit. , (*4)

HTML; print $filter->filter($config, $html);

Output:, (*5)

Lorem ipsum dolor sit amet
<p>
    Consectetur <a href="http://example.com" title="hey!">adipisicing</a>
    <a>elit</a>.
</p>

Installation

Installation is possible via Composer. Create a file named composer.json in your project directory with the following contents:, (*6)

{
    "require": {
        "athoshun/html-filter": "2.0.*"
    }
}

Then as a normal user, issue the following commands:, (*7)

$ curl http://getcomposer.org/installer | php
$ php composer.phar install

The Versions

13/02 2015

dev-master

9999999-dev https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

by Attila M. Magyar

filter html whitelist

13/02 2015

v2.0.4

2.0.4.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

by Attila M. Magyar

filter html whitelist

13/02 2015

v2.0.3

2.0.3.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

The Development Requires

by Attila M. Magyar

filter html whitelist

26/01 2014

v2.0.2

2.0.2.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

by Attila M. Magyar

filter html whitelist

18/03 2013

v2.0.1

2.0.1.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

by Attila M. Magyar

filter html whitelist

16/03 2013

v2.0.0

2.0.0.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

by Attila M. Magyar

filter html whitelist

03/02 2013

v1.0.2

1.0.2.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

by Attila M. Magyar

filter html whitelist

03/02 2013

v1.0.1

1.0.1.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

by Attila M. Magyar

filter html whitelist

03/02 2013

v1.0.0

1.0.0.0 https://github.com/attilammagyar/html-filter

Remove tags or attributes based on a whitelist from a snippet of well-formatted HTML text using PHP's DOM library

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

by Attila M. Magyar

filter html whitelist