Absorb core functionality of stripEmbedTagForAdmin() into HTMLFilter class

This commit is contained in:
Kijin Sung 2016-03-12 23:17:37 +09:00
parent 616d894021
commit ef6f0c839f
2 changed files with 30 additions and 13 deletions

View file

@ -87,6 +87,21 @@ class HTMLFilter
return $output;
}
/**
* Remove embedded media from HTML content.
*
* @param string $input
* @param string $replacement
* @return string
*/
public static function removeEmbeddedMedia($input, $replacement = '')
{
$input = preg_replace('!<object[^>]*>(.*?</object>)?!is', $replacement, $input);
$input = preg_replace('!<embed[^>]*>(.*?</embed>)?!is', $replacement, $input);
$input = preg_replace('!<img[^>]*editor_component="multimedia_link"[^>]*>(.*?</img>)?!is', $replacement, $input);
return $input;
}
/**
* Get an instance of HTMLPurifier.
*