2017 © Pedro Peláez
 

package html-stripper

php parser for html tags and html inline styles , to allow or prevent some css styles with any value or specific value

image

ibraheem-ghazi/html-stripper

php parser for html tags and html inline styles , to allow or prevent some css styles with any value or specific value

  • Wednesday, April 4, 2018
  • by IbraheemAlnabriss
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

html-stripper

php parser for html tags and html inline styles , to allow or prevent some css styles with any value or specific value, (*1)

Install

 $ composer require ibraheem-ghazi/html-stripper

Functions

strip($str, $useStripTags=true, $allowedTags= ['p','span','b','strong','u','ins','i','em','s','del','ul','li','ol','table','thead','tfoot','tbody','tr','th','td','br']), (*2)

paramters:
$str           // **(string)** the html code for topic or post
$useStripTags  // **(bool)**   should use strip tags alongside css stripper
$allowedTags   // **(array)**  if strip tags is used , then which tags are allowed 

return clean clone of input string

addStyle($attribute,$value='*',$condition='='), (*3)

paramters:
$attribute           // **(string)** which css attribute should allow (Ex: width, height, text-align, font-size, direction, ...etc)
$value               // **(string)**   which value should allow for this css attribute ('*' mean any value is allowed for this attribute)
$condition           // **(string)**  allowed value should be equal, less than, or greather than specified value 

**use these constants for `` $condition `` : ** 
HTMLStripper::EQUAL
HTMLStripper::LESS_THAN
HTMLStripper::GREATER_THAN


Example:, (*4)

<?php
require 'vendor/autoload.php';
use IbraheemGhazi\HTMLStripper\HTMLStripper;

$str= require 'input_str.php'; //get string from input_str.php and put it in $str variable

$hss= new HTMLStripper();

$hss->addStyle('margin-right','40px',HTMLStripper::LESS_THAN);//39 and less are allowed
$hss->addStyle('text-align','*',HTMLStripper::EQUAL);
$hss->addStyle('height','30px',HTMLStripper::LESS_THAN);
$hss->addStyle('width','5%',HTMLStripper::GREATER_THAN);
// ... etc

// $new_str = $hss->strip($str,true,['strong','em','p']);
$new_str = $hss->strip($str,true,['table','tr','td','th','p','br']);
echo $new_str;

The Versions

04/04 2018

dev-master

9999999-dev

php parser for html tags and html inline styles , to allow or prevent some css styles with any value or specific value

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Ibraheem Ghazi

css style php html strip stripper inline-style css-styles

04/04 2018

1.0

1.0.0.0

php parser for html tags and html inline styles , to allow or prevent some css styles with any value or specific value

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Ibraheem Ghazi

css style php html strip stripper inline-style css-styles