/i','',$the_content); $the_content = preg_replace('/<\/noscript>/i','',$the_content); // Delete font tag. $the_content = preg_replace('/]*?>/i','',$the_content); $the_content = preg_replace('/<\/font>/i', '', $the_content); ampbase_delete_style_attribute( $the_content ); // Delete target attribute. $the_content = preg_replace('/ *?target=["][^"]*?["]/i', '', $the_content); $the_content = preg_replace('/ *?target=[\'][^\']*?[\']/i', '', $the_content); // Delete onclick attribute. $the_content = preg_replace('/ *?onclick=["][^"]*?["]/i', '', $the_content); $the_content = preg_replace('/ *?onclick=[\'][^\']*?[\']/i', '', $the_content); // Delete onload attribute. $the_content = preg_replace('/ *?onload=["][^"]*?["]/i', '', $the_content); $the_content = preg_replace('/ *?onload=[\'][^\']*?[\']/i', '', $the_content); // Delete marginwidth attribute. $the_content = preg_replace('/ *?marginwidth=["][^"]*?["]/i', '', $the_content); $the_content = preg_replace('/ *?marginwidth=[\'][^\']*?[\']/i', '', $the_content); // Delete marginheight attribute. $the_content = preg_replace('/ *? marginheight=["][^"]*?["]/i', '', $the_content); $the_content = preg_replace('/ *? marginheight=[\'][^\']*?[\']/i', '', $the_content); // Delete font tag. $the_content = preg_replace('/]+?>/i', '', $the_content); $the_content = preg_replace('/<\/font>/i', '', $the_content); ampbase_convert_amp_img_tag( $the_content ); $pattern = '/

<\/p>/i'; $append = ''; $the_content = preg_replace($pattern, $append, $the_content); $pattern = '//is'; $append = ''; $the_content = preg_replace($pattern, $append, $the_content); $pattern = '{}i'; $append = ''; $the_content = preg_replace($pattern, $append, $the_content); $pattern = '{

}i'; $append = ''; $the_content = preg_replace($pattern, $append, $the_content); return $the_content; } endif; add_filter('the_content','ampbase_convert_content_for_amp', 999999999); function ampbase_convert_iframe( &$the_content ) { /* $the_content = preg_replace("@@i", '', $the_content); */ $amp_placeholder = ''; // amazon $pattern = '/]+?)(src="https?:\/\/rcm-fe.amazon-adsystem.com\/[^"]+?t=([^&"]+)[^"]+?asins=([^&"]+)[^"]*?").*?><\/iframe>/is'; $amazon_url = 'https://www.amazon.co.jp/exec/obidos/ASIN/$4/$3/ref=nosim/'; $append = PHP_EOL . '' . $amp_placeholder . '
' . PHP_EOL; // youtube $the_content = str_replace('http://www.youtube.com/', 'https://www.youtube.com/', $the_content); $the_content = preg_replace($pattern, $append, $the_content); // Corrected to normal link when calling http with title with iframe $pattern = '/]+?src="(http:\/\/[^"]+?)"[^>]+?title="([^"]+?)"[^>]+?><\/iframe>/is'; $append = '$2'; $the_content = preg_replace($pattern, $append, $the_content); $pattern = '/]+?title="([^"]+?)[^>]+?src="(http:\/\/[^"]+?)""[^>]+?><\/iframe>/is'; $append = '$2'; $the_content = preg_replace($pattern, $append, $the_content); // Corrected to normal link when calling http in iframe $pattern = '/]+?src="(http:\/\/[^"]+?)"[^>]+?><\/iframe>/is'; $append = '$1'; $the_content = preg_replace($pattern, $append, $the_content); // Replace iframe with amp-iframe $pattern = '/