In pratica ho questa funzione che da una frase crea una lista di keyword, in realtà la funzione è + complessa però credo che il problema risieda qui, in pratica quando la frase ha un apostrofo incomincia a dare i numeri:
Codice PHP:
function generateKeywords( $content ) {
global $GWP;
//Filtering other GWP tags
$post_content = preg_replace( "/[%]{2,}[a-zA-z0-9\-\:]{3,}[%]{2,}/", "", $content );
//Removing html formatting
$post_content = strip_tags( $post_content );
//Removing special chars
$post_content = str_replace( $GWP['MetaAdmin']['SpecialChars'], ' ', $post_content );
$post_content = strtolower( $post_content );
//Making keyword list
$keywords = explode( ' ', $post_content );
//Removing short words
foreach ( $keywords as $key=>$val ) {
if ( strlen($val) <= $GWP['MetaAdmin']['MinLength'] ) {
unset( $keywords[$key] );
}
}
//Ranking keywords
$keywords = array_count_values( $keywords );
arsort( $keywords );
$keywords = array_slice( $keywords, 0, $GWP['MetaAdmin']['MaxWords'] );
//Formatting keywords
$keywords = implode(', ', array_keys($keywords));
return $keywords;
} // end func