PortableInfobox/services/Sanitizers/NodeHeroImageSanitizer.php
2016-02-12 18:20:14 +01:00

25 lines
752 B
PHP

<?php
class NodeHeroImageSanitizer extends NodeSanitizer {
protected $allowedTags = [ 'a' ];
protected $selectorsWrappingTextToPad = [ 'li' ];
protected $selectorsWrappingAllowedFeatures = [ 'sup[@class="reference"]' ];
protected $selectorsForFullRemoval =
[ 'script', 'span[@itemprop="duration"]', '*[contains(@data-component,"article-media")]'];
/**
* @param $data
* @return mixed
*/
public function sanitize( $data ) {
if ( !empty( $data[ 'title' ][ 'value' ] ) ) {
$data[ 'title' ][ 'value' ] = $this->sanitizeElementData( $data[ 'title' ][ 'value' ] );
}
if ( !empty( $data[ 'image' ][ 'caption' ] ) ) {
$data[ 'image' ]['caption'] = $this->sanitizeElementData( $data[ 'image' ]['caption'] );
}
return $data;
}
}