$ MyKeyword "test" ve yerine metin ise aşağıda değiştirme komut olarak, "Bu test bir test olabilir", ben yerine metin Bu, test olabilir "olması beklenir < em> test em> "
Ancak, ne ben alıyorum şudur: Bu test bir testi b> olabilir.
Ben onun anahtar kelime "test" ilk örneğini atlayarak nedenini belirlemek çalışıyorum.
function save_rseo_content($content){
global $post;
$mykeyword = rseo_getKeyword($post);
$mykeyword = " ".preg_quote($mykeyword, '/');
/*had to add " " before keyword so that the it skips the instance
where the keyword has already been formatted. Only matches " keyword"*/
$theContent =
preg_replace_callback("/\b($mykeyword)\b/i","doReplace", $content);
return $theContent;
}
function doReplace($matches)
{
static $count = 0;
switch($count++) {
case 0: return ' <b>'.trim($matches[1]).'</b>';
case 1: return ' <em>'.trim($matches[1]).'</em>';
case 2: return ' <u>'.trim($matches[1]).'</u>';
default: return $matches[1];
}
}