1. Открыть engine/inc/include/functions.inc.php и найти:
function create_metatags($story) {
global $config, $db;
$keyword_count = 20;
$newarr = array ();
$headers = array ();
$quotes = array ("\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "$", "<", ">", "?", "!", '"');
$fastquotes = array ("\x22", "\x60", "\t", "\n", "\r", '"', '\r', '\n', "$", "{", "}", "[", "]", "<", ">");
$story = preg_replace( "#\[hide\](.+?)\[/hide\]#is", "", $story );
$story = preg_replace( "'\[attachment=(.*?)\]'si", "", $story );
$story = preg_replace( "'\[page=(.*?)\](.*?)\[/page\]'si", "", $story );
$story = str_replace( "{PAGEBREAК}", "", $story ); // заменить K на английский K
$story = str_replace( " ", " ", $story );
$story = str_replace( '<br />', ' ', $story );
$story = strip_tags( $story );
$story = preg_replace( "#&(.+?);#", "", $story );
$story = trim(str_replace( " ,", "", $story ));
if( trim( $_REQUEST['meta_title'] ) != "" ) {
$headers['title'] = trim( htmlspecialchars( strip_tags( stripslashes($_REQUEST['meta_title'] ) ), ENT_COMPAT, $config['charset'] ) );
$headers['title'] = $db->safesql(str_replace( $fastquotes, '', $headers['title'] ));
} else $headers['title'] = "";
if( trim( $_REQUEST['descr'] ) != "" ) {
$headers['description'] = dle_substr( strip_tags( stripslashes( $_REQUEST['descr'] ) ), 0, 190, $config['charset'] );
$headers['description'] = $db->safesql( str_replace( $fastquotes, '', $headers['description'] ));
} elseif($config['create_metatags']) {
$story = str_replace( $fastquotes, '', $story );
$headers['description'] = $db->safesql( dle_substr( stripslashes($story), 0, 190, $config['charset'] ) );
} else {
$headers['description'] = '';
}
if( trim( $_REQUEST['keywords'] ) != "" ) {
$headers['keywords'] = $db->safesql( str_replace( $fastquotes, " ", strip_tags( stripslashes( $_REQUEST['keywords'] ) ) ) );
} elseif( $config['create_metatags'] ) {
$story = str_replace( $quotes, ' ', $story );
$arr = explode( " ", $story );
foreach ( $arr as $word ) {
if( dle_strlen( $word, $config['charset'] ) > 4 ) $newarr[] = $word;
}
$arr = array_count_values( $newarr );
arsort( $arr );
$arr = array_keys( $arr );
$total = count( $arr );
$offset = 0;
$arr = array_slice( $arr, $offset, $keyword_count );
$headers['keywords'] = $db->safesql( implode( ", ", $arr ) );
} else {
$headers['keywords'] = '';
}
return $headers;
}
2. Открыть engine/inc/options.php и найти:
showRow( $lang['opt_sys_nfut'], $lang['opt_sys_nfutd'], makeDropDown( array ("1" => $lang['opt_sys_yes'], "0" => $lang['opt_sys_no'] ), "save_con[news_future]", "{$config['news_future']}" ) );
Добавить ниже:
showRow( "Автоматическое формирование метатегов 'description' и 'keywords' для публикаций", "Вы можете включить автоматическое заполнение метатегов 'description' и 'keywords' для публикаций. Если при добавлении публикаций на сайт данные поля не были заполнены, то скрипт автоматически создаст их.", makeDropDown( array ("1" => $lang['opt_sys_yes'], "0" => $lang['opt_sys_no'] ), "save_con[create_metatags]", "{$config['create_metatags']}" ) );