PortableInfobox/services/Sanitizers/NodeImageSanitizer.php

20 lines
540 B
PHP
Raw Normal View History

2015-12-23 14:54:03 +00:00
<?php
class NodeImageSanitizer extends NodeSanitizer implements NodeTypeSanitizerInterface {
/**
* @desc sanitize infobox image caption allowing only for links inside it
*
* @param $data
* @return mixed
*/
public function sanitize( $data ) {
$data[ 'caption' ] = $this->sanitizeElementData( $data[ 'caption' ], '<a>' );
return $data;
}
2015-12-28 09:16:33 +00:00
protected function sanitizeElementData( $elementText, $allowedTags = null ) {
return $this->stripUnneededElements( parent::sanitizeElementData( $elementText, $allowedTags ) );
}
2015-12-23 14:54:03 +00:00
}