PortableInfobox/services/Sanitizers/NodeDataSanitizer.php

22 lines
513 B
PHP
Raw Normal View History

2015-12-23 14:54:03 +00:00
<?php
class NodeDataSanitizer extends NodeSanitizer implements NodeTypeSanitizerInterface {
/**
* @desc remove all HTML tags but links from data labels.
* If label after sanitization became empty because contained only image
* do not sanitize it.
*
* @param $data
* @return mixed
*/
public function sanitize( $data ) {
$sanitizedLabel = $this->sanitizeElementData( $data[ 'label' ], '<a>' );
if ( !empty( $sanitizedLabel) ) {
$data[ 'label' ] = $sanitizedLabel;
}
return $data;
}
}