2015-12-23 14:54:03 +00:00
|
|
|
<?php
|
|
|
|
|
2015-12-29 07:10:24 +00:00
|
|
|
class NodeHeroImageSanitizer extends NodeSanitizer {
|
2016-01-09 15:01:13 +00:00
|
|
|
protected $allowedTags = [ 'a' ];
|
|
|
|
protected $selectorsWrappingTextToPad = [ 'li' ];
|
|
|
|
protected $selectorsWrappingAllowedFeatures = [ 'sup[@class="reference"]' ];
|
2016-02-12 16:13:48 +00:00
|
|
|
protected $selectorsForFullRemoval =
|
2016-02-12 17:20:14 +00:00
|
|
|
[ 'script', 'span[@itemprop="duration"]', '*[contains(@data-component,"article-media")]'];
|
2016-01-09 15:01:13 +00:00
|
|
|
|
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' ] );
|
|
|
|
}
|
2016-01-09 15:01:13 +00:00
|
|
|
if ( !empty( $data[ 'image' ][ 'caption' ] ) ) {
|
|
|
|
$data[ 'image' ]['caption'] = $this->sanitizeElementData( $data[ 'image' ]['caption'] );
|
|
|
|
}
|
2015-12-23 14:54:03 +00:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|