function addDic_($txt)
{
global $db;
$sql = "SELECT *
FROM xxdictionary
WHERE xdictionarystatus = 'active'";
$dic = $db->getAll($sql);
#$dic = array('اتاق'=>'#', 'بیمه'=>'#');
$txt = str_replace(array('<', '>'), array('«', '»'), $txt);
foreach($dic as $key => $val){
if(empty($val["xdictionaryword"]))
continue;
$keyword = preg_quote($val["xdictionaryword"], '/');
$keyword = preg_replace('/\s*[\r\n]\s*/', "|", $keyword);
$keyword = preg_replace('/\s+/', '\s+', $keyword);
$reg = '[\.\,\،:؛\'\"\\\\\/\s\(\)«»\[\]\{\}\d\?\!]';
$txt = preg_replace("/(^|$reg)(($keyword)(هایی|ها|های|ی)?)($|$reg)/isUu", "$1 $2 $5", $txt);
$txt = preg_replace("/(^|$reg)(($keyword)(هایی|ها|های|ی)?)($|$reg)/isUu", "$1 $2 $5", $txt);
}
$txt = str_replace(array('«', '»'), array('<', '>'), $txt);
return $txt;
}
/*
$keyword = '('.preg_replace('/\s*[\r\n]\s* /', ")|(", $keyword).')';
$keyword = preg_replace('/\s+/', '\s+', $keyword);
trace($keyword);
$txt = preg_replace('/(^|[\.\,\،:؛\'\"\\\\\/\s\(\)\<\>\[\]\{\}\d\?\!])('.$keyword.')($|[\.\,\،:؛\'\"\\\\\/\s\(\)\<\>\[\]\{\}\d\?\!])/isUu', "$1 $2 ", $txt);
#$txt = str_replace(" $key ", "", $txt);
*/
?>