2017-04-11 33 views
0

私はネットで長時間探しています。しかし、使用しないでください。これを達成する方法を教えてください。HTMLPurifierを使用して、すべてを除外しますが、埋め込みコードを埋め込みます

私は、Instagram埋め込みコードを受け入れるようにHTMLPurifierを設定しようとしています。

Instagramのは、それがworking.Andが許可しようとしませんでしたsetting.But私は 'HTML.AllowedAttributes' で "スタイル" を許可しようとしている

return [ 
'encoding'  => 'UTF-8', 
'finalize'  => true, 
'cachePath'  => storage_path('app/purifier'), 
'cacheFileMode' => 0755, 
'settings'  => [ 
    'default' => [ 
     'HTML.Doctype'    => 'XHTML 1.0 Transitional', 
     'HTML.Allowed'    => 'div,b,strong,p,i,em,blockquote[class|style],a[href|title],ul,ol,li,p[style],br,span[style],img[width|alt|src],iframe[src|width|height|class|frameborder]', 
     'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align', 
     'HTML.AllowedAttributes' => 'style,src', 
     'AutoFormat.AutoParagraph' => true, 
     'AutoFormat.RemoveEmpty' => true, 
     "HTML.SafeIframe"   => true, 
     "URI.SafeIframeRegexp"  => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|api.soundcloud.com/tracks/)%", 
    ], 
    'test' => [ 
     'Attr.EnableID' => true 
    ] 
], 

コード設定

<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="7" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:50.0% 0; text-align:center; width:100%;"> <div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURczMzPf399fX1+bm5mzY9AMAAADiSURBVDjLvZXbEsMgCES5/P8/t9FuRVCRmU73JWlzosgSIIZURCjo/ad+EQJJB4Hv8BFt+IDpQoCx1wjOSBFhh2XssxEIYn3ulI/6MNReE07UIWJEv8UEOWDS88LY97kqyTliJKKtuYBbruAyVh5wOHiXmpi5we58Ek028czwyuQdLKPG1Bkb4NnM+VeAnfHqn1k4+GPT6uGQcvu2h2OVuIf/gWUFyy8OWEpdyZSa3aVCqpVoVvzZZ2VTnn2wU8qzVjDDetO90GSy9mVLqtgYSy231MxrY6I2gGqjrTY0L8fxCxfCBbhWrsYYAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div></div> <p style=" margin:8px 0 0 0; padding:0 4px;"> <a href="https://www.instagram.com/p/BSu5uVWhLWX/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_blank">有人問我整理書櫃的方法 搬完家後我還沒時間整理,就把最近比較想讀的放在外圍這樣</a></p> <p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">囧星人(@shintarokyon)分享的貼文 於 <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2017-04-11T05:10:48+00:00">2017 年 4月 月 10 10:10下午 PDT</time> 張貼</p></div></blockquote> 
<script async defer src="//platform.instagram.com/en_US/embeds.js"></script> 

HTMLPurifierを埋め込みますcss properties-'box-shadow '...などですが、いくつかのプロパティはサポートされていませんでした。

ありがとうございます!新しいプロパティを追加する

+0

HTML PurifierはJavaScriptを安全性のために解析する手段がないため、その観点から、あなたのページにその「