前回に引き続き、今回は不要なタグそのものを削除です。
今回も「simple_html_dom.php」を使います。
// check : del, html tags function amp_template_del_htmltags($content) { $amp_htmltags = array( 'script' ); $amp_dom = str_get_html($content); foreach ($amp_htmltags as $amp_target_htmltag) { foreach ($amp_dom->find($amp_target_htmltag) as $el) { $el->clear(); } } $temp = $amp_dom->save(); $amp_dom->clear(); return $temp; }
AMPでは許可された javasctiptのみ使用可で、他は使用禁止です。
その為 scriptを丸っと削除し、表示チェックをし、調整します。