File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -59,24 +59,16 @@ protected function postFilterCallback($matches)
59
59
// Domain Whitelist
60
60
$ hostName = [];
61
61
preg_match ('#https?://(.*)#i ' , api_get_path (WEB_PATH ), $ hostName );
62
+ $ extra = ' frameborder="0" ' ;
62
63
63
64
$ youTubeMatch = preg_match ('#src="(https:)?//www.youtube(-nocookie)?.com/#i ' , $ matches [1 ]);
64
65
$ vimeoMatch = preg_match ('#://player.vimeo.com/#i ' , $ matches [1 ]);
65
- $ googleMapsMatch = preg_match ('#src="https://maps.google.com/#i ' , $ matches [1 ]);
66
- $ slideShare = preg_match ('#src="(https?:)?//www.slideshare.net/# ' , $ matches [1 ]);
67
- $ platformDomain = preg_match ('#src="https?://(.+\.)? ' .$ hostName [1 ].'#i ' , $ matches [1 ]);
68
66
69
- if ($ youTubeMatch || $ vimeoMatch || $ googleMapsMatch || $ slideShare || $ platformDomain ) {
70
- $ extra = ' frameborder="0" ' ;
71
- if ($ youTubeMatch ) {
72
- $ extra .= ' allowfullscreen ' ;
73
- } elseif ($ vimeoMatch ) {
74
- $ extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen ' ;
75
- }
76
-
77
- return '<iframe ' .$ matches [1 ].$ extra .'></iframe> ' ;
78
- } else {
79
- return '' ;
67
+ if ($ youTubeMatch ) {
68
+ $ extra .= ' allowfullscreen ' ;
69
+ } elseif ($ vimeoMatch ) {
70
+ $ extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen ' ;
80
71
}
72
+ return '<iframe ' .$ matches [1 ].$ extra .'></iframe> ' ;
81
73
}
82
74
}
You can’t perform that action at this time.
0 commit comments