mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-12-12 00:26:47 +00:00
26 lines
546 B
PHP
26 lines
546 B
PHP
<?php
|
|
|
|
namespace PortableInfobox\Sanitizers;
|
|
|
|
class NodeDataSanitizer extends NodeSanitizer {
|
|
protected $allowedTags = [ 'a' ];
|
|
|
|
/**
|
|
* @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 mixed $data
|
|
* @return mixed
|
|
*/
|
|
public function sanitize( $data ) {
|
|
$sanitizedLabel = $this->sanitizeElementData( $data['label'] );
|
|
|
|
if ( !empty( $sanitizedLabel ) ) {
|
|
$data['label'] = $sanitizedLabel;
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|