Move bb_translate_video

- To new Class BBCode\Video
- Adding tests
- Make BaseObject::getClass() public
This commit is contained in:
Philipp Holzer 2019-10-23 00:14:47 +02:00
parent 7f49c73730
commit 2870f42ca2
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
5 changed files with 80 additions and 20 deletions

View file

@ -223,22 +223,6 @@ function return_bytes($size_str) {
}
}
function bb_translate_video($s) {
$matches = null;
$r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER);
if ($r) {
foreach ($matches as $mtch) {
if ((stristr($mtch[1], 'youtube')) || (stristr($mtch[1], 'youtu.be'))) {
$s = str_replace($mtch[0], '[youtube]' . $mtch[1] . '[/youtube]', $s);
} elseif (stristr($mtch[1], 'vimeo')) {
$s = str_replace($mtch[0], '[vimeo]' . $mtch[1] . '[/vimeo]', $s);
}
}
}
return $s;
}
/// @TODO Rewrite this
function is_a_date_arg($s) {
$i = intval($s);