<?php
  $rssbing  = simplexml_load_file('http://www.bing.com/search?q='.get_search_query().'&count=10&format=rss');
?>
<?php
function CleanFileNameBan($itembing){
$bannedkey = array("xxx","porn","livejasmin","lesbian","sex","ngentut");
$itembing = str_replace($bannedkey, '',$itembing);
$itembing = trim($itembing);
return $itembing;
}
function hilangkan_spesial_karakter($itembing) {
    $itembing = strip_tags($itembing);
    $itembing = preg_replace('/&.+?;/', '', $itembing);
    $itembing = preg_replace('/\s+/', ' ', $itembing);
        $itembing = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', ' ', $itembing);
    $itembing = preg_replace('|-+|', ' ', $itembing);
        $itembing = preg_replace('/&#?[a-z0-9]+;/i','',$itembing);
        $itembing = preg_replace('/[^%A-Za-z0-9 _-]/', ' ', $itembing);
    $itembing = trim($itembing, ' ');
    return $itembing;
}
function ubah_tanda($itembing) {
$itembing = strtolower($itembing);
    $itembing = preg_replace('/&.+?;/', '', $itembing);
    $itembing = preg_replace('/\s+/', '-', $itembing);
        $itembing = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '-', $itembing);
    $itembing = preg_replace('|-+|', '-', $itembing);
        $itembing = preg_replace('/&#?[a-z0-9]+;/i','',$itembing);
        $itembing = preg_replace('/[^%A-Za-z0-9 _-]/', '-', $itembing);
    $itembing = trim($itembing, '-');
    return $itembing;
}
?>
<?php
foreach ($rssbing->channel->item as $itembing) {
  echo  '<a href="'. get_settings('home').'/article/'.ubah_tanda(CleanFileNameBan(hilangkan_spesial_karakter($itembing->title))).'.html"><h1>'.htmlspecialchars(strip_tags($itembing->title)).'</h1></a>';
    echo  '<p>'.htmlspecialchars(strip_tags($itembing->description)).'</p>';
  echo  '<p>'.$itembing->link.' - '.$itembing->pubDate.'</p>';
}
if (empty($itembing)) {
  echo '<small>Not Found</small>';
}
?>