如何防止HTMLPURIFIER破坏此代码:
<blockquote class="big">
<a class="link_normal opacity" href="http://www.example"></a>
<div class="center">
<a class="link_normal opacity" href="http://www.example"></a>
<div class="table_cell">
<a class="link_normal opacity" href="http://www.example">
<img alt="4241.jpg" class="img_url" src="/images/imagenes_urls/4241.jpg">
</a>
</div>
<a class="link_normal opacity" href="http://www.example"></a>
</div>
<a class="link_normal opacity" href="http://www.example"></a>
<p class="b" style="color:#3b5998;">
<a class="link_normal opacity" href="http://www.example">Desde los 80 hasta 2015, asà ha sido la impresionante evolución de los móviles</a>
</p></blockquote>
当我使用它时变成这样的东西:
let audioSource = SCNAudioSource(named: "coin.wav")
let audioPlayer = SCNAudioPlayer(source: audioSource)
self.addAudioPlayer(audioPlayer)
答案 0 :(得分:0)
对于在HTML4中使用内联标记包装分组标记块引用无效。
您也可以在此处找到有关此标记http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-blockquote-element
的详细信息答案 1 :(得分:0)
您可以使用诸如将JavaScript添加到主标记之类的技巧,例如:
onclick="document.location='http://www.example'"
并且您可以将指针样式添加到光标以使其看起来像普通链接:
style="cursor:pointer"
就是这样:
<blockquote url="http://www.example" class="big" onclick="document.location='http://www.example'" style="cursor:pointer">
<div class="center">
<div class="table_cell"><img src="/images/imagenes_urls/4241.jpg" class="img_url"></div>
</div>
<p style="color:#3b5998" class="b">Desde los 80 hasta 2015, así ha sido la impresionante evolución de los móviles</p>
<p>¿Cómo olvidarse de aquellos enormes objetos a los que llamábamos teléfonos móviles? Muchos de vosotros los recordar...</p>
<span class="dominio">andro4all.com</span>
</blockquote>
&#13;
答案 2 :(得分:0)
经过实验,我刚刚发现了这个具体问题的灵活答案。您可以自定义HTMLPurifier的行为,如http://htmlpurifier.org/docs/enduser-customize.html所述。
具体来说,您可以通过再次定义元素来覆盖'a'锚元素的默认行为,如下所示:
include_once('HTMLPurifier.auto.php');
$config = HTMLPurifier_Config::createDefault();
$def = $config->getHTMLDefinition(true);
// here is the magic method that overwrites the default anchor definition
$def->addElement(
'a', // element name
'Inline', // the type of element: 'Block','Inline', or false, if it's a special case
'Flow', // what type of child elements are permitted: 'Empty', 'Inline', or 'Flow', which includes block elements like div
'Common' // permitted attributes
);
$purifier = new HTMLPurifier($config);
// $dirty_html is the html you want cleaned
echo $purifier->purify($dirty_html);
现在,您可以在HTML5规范(http://dev.w3.org/html5/markup/a.html)中允许的情况下在锚标记中包含块元素。
对于更强大的HTML5解决方案,Christoffer Bubach提供了详细的HTMLPurifier配置以允许更新的HTML5标记,但它不会重新定义锚标记以允许其中的块元素。看看他对这个问题的回答:HTML filter that is HTML5 compliant