Skip to content

Commit d082745

Browse files
WYSIWYG: Allow Genially iframes in HTMLPurifier filter - refs BT#22175
Co-authored-by: Yannick Warnier <[email protected]>
1 parent e69282c commit d082745

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,22 @@ protected function postFilterCallback($matches)
6363

6464
$youTubeMatch = preg_match('#src="(https:)?//www.youtube(-nocookie)?.com/#i', $matches[1]);
6565
$vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]);
66+
$googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]);
67+
$slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]);
68+
$geniallyMatch = preg_match('#src="https://view.genially.com/#i', $matches[1]);
69+
$platformDomain = preg_match('#src="https?://(.+\.)?'.$hostName[1].'#i', $matches[1]);
6670

67-
if ($youTubeMatch) {
68-
$extra .= ' allowfullscreen';
69-
} elseif ($vimeoMatch) {
70-
$extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
71+
if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $geniallyMatch || $platformDomain) {
72+
$extra = ' frameborder="0"';
73+
if ($youTubeMatch || $geniallyMatch) {
74+
$extra .= ' allowfullscreen';
75+
} elseif ($vimeoMatch) {
76+
$extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
77+
}
78+
79+
return '<iframe '.$matches[1].$extra.'></iframe>';
80+
} else {
81+
return '';
7182
}
7283

7384
return '<iframe '.$matches[1].$extra.'></iframe>';

0 commit comments

Comments
 (0)