티스토리 뷰

Laravel

purifier로 youtube를 허용해보자.

rediate.will 2020. 4. 28. 14:46

config/purifier.php

'default' => [
			'HTML.Doctype'             => 'HTML 4.01 Transitional',
            'HTML.Allowed'             => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[alt|src|style|class|data-id],
                                            table[border|cellpadding|cellspacing|style],tbody,tr[style],td[style],iframe[src|width|height|allowfullscreen]',
            'HTML.TargetBlank'         => true,
            'CSS.AllowedProperties'    => 'font,font-size,font-weight,font-style,text-decoration,padding-left,color,background-color,text-align,width',
            'AutoFormat.Linkify'       => true,
            'AutoFormat.AutoParagraph' => true,
            'AutoFormat.RemoveEmpty'   => true,
            'AutoFormat.RemoveEmpty.RemoveNbsp' => true,
            'HTML.SafeIframe' => true,
            'URI.SafeIframeRegexp' => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
            'HTML.FlashAllowFullScreen' => true,
            ],

 

추가한 부분은

Html.Allowed항목에서 iframe[src|width|height|allowfullscreen],

'HTML.SafeIframe' => true,
'URI.SafeIframeRegexp' => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
'HTML.FlashAllowFullScreen' => true,

 

allowfullscreen은 말그대로 전체보기 허용할거면 추가하고, 안할거면 지우고.

+. https://www.kalemzen.com.tr/htmlpurifier/configdoc/plain.html#HTML.FlashAllowFullScreen

HTML.FlashAllowFullScreen

Whether or not to permit embedded Flash content from %HTML.SafeObject to expand to the full screen. Corresponds to the allowFullScreen parameter.

'Laravel' 카테고리의 다른 글

[Laravel 8] GraphQL을 적용해보자.  (0) 2021.04.23
Syntax error or access violation: 1071 Specified key was too long;  (0) 2020.09.10
라라벨7.0 생텀 spa  (1) 2020.09.07
검색시 공백 오류  (0) 2020.07.15
오늘의 페이지네이션.  (0) 2020.06.22
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함