PortableInfobox/services/Sanitizers/NodeHeroImageSanitizer.php

24 lines
703 B
PHP
Raw Normal View History

2015-12-23 14:54:03 +00:00
<?php
class NodeHeroImageSanitizer extends NodeSanitizer {
protected $allowedTags = [ 'a' ];
protected $selectorsWrappingTextToPad = [ 'li' ];
protected $selectorsWrappingAllowedFeatures = [ 'sup[@class="reference"]' ];
protected $selectorsForFullRemoval = [ 'script', 'span[@itemprop="duration"]' ];
2015-12-23 14:54:03 +00:00
/**
* @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'] );
}
2015-12-23 14:54:03 +00:00
return $data;
}
}