Cita:
Estoy intentando generar las keywords de un sitio web, pero me marca ese error que no me deja continuar.Fatal error: Call to undefined function clean() in [...]KeyPer.php on line 4
Para llamar a la clase y la función que necesito utilizo:
Código PHP:
if (empty($keywords)){
$ekeys = new KeyPer;
$keywords = $ekeys->Keys($html);
}
Código PHP:
<?php
class KeyPer {
function Keys($html) {
$html = clean($html);
$blacklist='de,la,los,las,el,ella,nosotros,yo,tu,el,te,mi,del,ellos';
$sticklist='';
$minlength = 3;
$count = 17;
$html = preg_replace('/[\.;:|\'|\"|\`|\,|\(|\)|\-]/', ' ', $html);
$html = preg_replace('/¡/', '', $html);
$html = preg_replace('/¿/', '', $html);
$keysArray = explode(" ", $html);
$keysArray = array_count_values(array_map('strtolower', $keysArray));
$blackArray = explode(",", $blacklist);
foreach($blackArray as $blackWord){
if(isset($keysArray[trim($blackWord)]))
unset($keysArray[trim($blackWord)]);
}
arsort($keysArray);
$i = 1;
$keywords = "";
foreach($keysArray as $word => $instances){
if($i > $count) break;
if(istrlen(trim($word)) >= $minlength && is_string($word)) {
$keywords .= $word . ", ";
$i++;
}
}
$keywords = rtrim($keywords, ", ");
return $keywords=$sticklist.''.$keywords;
}
function clean($html) {
$regex = '/(([_A-Za-z0-9-]+)(\\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-]+)(\\.[A-Za-z0-9-]+)*)/iex';
$desc = preg_replace($regex, '', $html);
$html = preg_replace( "''si", '', $html );
$html = preg_replace( '/]*>([^<]+)<\/a>/is', '\2 (\1)', $html );
$html = preg_replace( '//', '', $html );
$html = preg_replace( '/{.+?}/', '', $html );
$html = preg_replace( '/ /', ' ', $html );
$html = preg_replace( '/&/', ' ', $html );
$html = preg_replace( '/"/', ' ', $html );
$html = strip_tags( $html );
$html = htmlspecialchars($html);
$html = str_replace(array("\r\n", "\r", "\n", "\t"), " ", $html);
while (strchr($html," ")) {
$html = str_replace(" ", " ",$html);
}
for ($cnt = 1;
$cnt < strlen($html)-1; $cnt++) {
if (($html{$cnt} == '.') || ($html{$cnt} == ',')) {
if ($html{$cnt+1} != ' ') {
$html = substr_replace($html, ' ', $cnt + 1, 0);
}
}
}
return $html;
}
}
?>
No se porque me marca indefinida, alguien sabe como se puede solucionar este error??.
Saludos!!!