PHP Class PicoFeed\Filter\Tag

Author: Frederic Guillot
Inheritance: extends PicoFeed\Base
Datei anzeigen Open project: fguillot/picofeed Class Usage Examples

Public Methods

Method Description
closeHtmlTag ( string $tag ) : string Return the HTML closing tag.
isAllowed ( string $tag, array $attributes ) : boolean Check if the tag is allowed and is not a pixel tracker.
isAllowedTag ( string $tag ) : boolean Check if a tag is on the whitelist.
isPixelTracker ( string $tag, array $attributes ) : boolean Detect if an image tag is a pixel tracker.
isSelfClosingTag ( string $tag ) : boolean Return true is the tag is self-closing.
openHtmlTag ( string $tag, string $attributes = '' ) : string Return the HTML opening tag.
removeBlacklistedTags ( string $data ) : string Remove script tags.
removeEmptyTags ( string $data ) : string Remove empty tags.
removeMultipleBreakTags ( string $data ) : string Replace

by only one.
setWhitelistedTags ( array $values ) : Tag Set whitelisted tags adn attributes for each tag.

Method Details

closeHtmlTag() public method

Return the HTML closing tag.
public closeHtmlTag ( string $tag ) : string
$tag string Tag name
return string

isAllowed() public method

Check if the tag is allowed and is not a pixel tracker.
public isAllowed ( string $tag, array $attributes ) : boolean
$tag string Tag name
$attributes array Attributes dictionary
return boolean

isAllowedTag() public method

Check if a tag is on the whitelist.
public isAllowedTag ( string $tag ) : boolean
$tag string Tag name
return boolean

isPixelTracker() public method

Detect if an image tag is a pixel tracker.
public isPixelTracker ( string $tag, array $attributes ) : boolean
$tag string Tag name
$attributes array Tag attributes
return boolean

isSelfClosingTag() public method

Return true is the tag is self-closing.
public isSelfClosingTag ( string $tag ) : boolean
$tag string Tag name
return boolean

openHtmlTag() public method

Return the HTML opening tag.
public openHtmlTag ( string $tag, string $attributes = '' ) : string
$tag string Tag name
$attributes string Attributes converted in html
return string

removeBlacklistedTags() public method

Remove script tags.
public removeBlacklistedTags ( string $data ) : string
$data string Input data
return string

removeEmptyTags() public method

Remove empty tags.
public removeEmptyTags ( string $data ) : string
$data string Input data
return string

removeMultipleBreakTags() public method

Replace

by only one.
public removeMultipleBreakTags ( string $data ) : string
$data string Input data
return string

setWhitelistedTags() public method

Set whitelisted tags adn attributes for each tag.
public setWhitelistedTags ( array $values ) : Tag
$values array List of tags: ['video' => ['src', 'cover'], 'img' => ['src']]
return Tag