2015-12-28 10:59:53 +00:00
|
|
|
<?php
|
|
|
|
|
2018-08-09 09:49:10 +00:00
|
|
|
namespace PortableInfobox\Sanitizers;
|
|
|
|
|
2015-12-28 10:59:53 +00:00
|
|
|
class SanitizerBuilder {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @desc provide sanitizer for a given node type
|
|
|
|
*
|
2018-08-16 09:25:53 +00:00
|
|
|
* @param string $type
|
2015-12-28 10:59:53 +00:00
|
|
|
* @return NodeSanitizer
|
|
|
|
*/
|
2018-08-16 09:25:53 +00:00
|
|
|
public static function createFromType( $type ) {
|
2015-12-28 10:59:53 +00:00
|
|
|
switch ( $type ) {
|
|
|
|
case 'data':
|
|
|
|
return new NodeDataSanitizer();
|
|
|
|
case 'horizontal-group-content':
|
|
|
|
return new NodeHorizontalGroupSanitizer();
|
|
|
|
case 'title':
|
|
|
|
return new NodeTitleSanitizer();
|
|
|
|
case 'image':
|
|
|
|
return new NodeImageSanitizer();
|
|
|
|
default:
|
|
|
|
return new PassThroughSanitizer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|