/********** START META DATA MANIPULATON *********/ if ($makeMeta) { function myTruncate2($string, $limit, $break=" ", $pad="...") { // return with no change if string is shorter than $limit if(strlen($string) <= $limit) return $string; $string = substr($string, 0, $limit); if(false !== ($breakpoint = strrpos($string, $break))) { $string = substr($string, 0, $breakpoint); } return $string . $pad; } $description = $row->introtext; $shortdesc = myTruncate2($description, 600); $metaKeys = eUTF::utf8_trim($row->metakey); if ($metaKeys == '') { $keys = array(); $keytitle = $row->title; if ($row->categorytxt) { $keytitle .= ' '.$row->categorytxt; } if ($row->sectiontxt) { $keytitle .= ' '.$row->sectiontxt; } if ($row->author) { $keytitle .= ' '.$row->author; } if ($row->language != '') { $keytitle .= ' '.str_replace(',', ' ',$row->language); } $keytitle = preg_replace('/(\!|\@|\$|\%|\&|\(|\)|\,|\;|\'|\"|\.|\#|\?|\[|\]|\`|\*)/', '', $keytitle); $parts = preg_split('/[\s]/', $keytitle); if (count($parts) > 0) { foreach ($parts as $part) { if (eUTF::utf8_strlen($part) > 3) { $keys[] = $part; } } } $keys = array_unique($keys); if (count($keys) > 20) { $keys = array_slice($keys, 0, 20); } else if (count($keys) < 5) { $keys[] = _E_CATEGORY; $keys[] = _E_CONTENT; $keys[] = _E_SECTION; } asort($keys); $metaKeys = implode(', ',$keys); } $ttl = ($row->categorytxt) ? $row->title.' - '.$row->categorytxt : $row->title; $ttl = preg_replace('/(\@|\$|\%|\&|\'|\"|\#|\[|\]|\`|\*)/', '', $ttl); $mainframe->setPageTitle($ttl); $mainframe->addMetaTag('author' , $row->author); $mainframe->setMetaTag('description', $shortdesc); $mainframe->setMetaTag('keywords', $metaKeys); } /********** END META DATA MANIPULATON *********/