mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-12-23 13:32:36 +00:00
25 lines
752 B
PHP
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;
|
|
}
|
|
}
|