//Перенос файлов с DLE
function replace_text_wps($text)
{
preg_match_all("/(\W|^)attachment.*(\W|$)/", $text, $out, PREG_PATTERN_ORDER);
if($out[0]!=null)
{
preg_match_all("/\d+/", $out[0][0], $out1, PREG_PATTERN_ORDER);
if($out1[0]!=null)
{
global $wpdb;
$rTable = $wpdb->get_row("SELECT name, onserver FROM dle_files WHERE id = ".$out1[0][0]);
if($rTable!= null)
{
$str="<a href =\"/uploads/files/".$rTable->onserver."\">".$rTable->name."</a>";
$text = str_replace($out[0][0], $str, $text);
}
}
}
return $text;
}
add_filter('the_content', 'replace_text_wps');
add_filter('the_excerpt', 'replace_text_wps');