1
Hello,
this ist my first "quick & dirty" hack. The idea was, to autolink Glossary terms system wide. I don´t know, if anyone cares about or solved this problem otherwise. i find it very useful. This Hack based on XOOPS 2.0.9.2 Stable and WordBook 1.12.
All Changes were made in this file: "/class/module.textsanitizer.php"
Add this Array at the top of the class:
var $glossary = array();
Add this function (based on smiley function) and replace [YOUR_URL] with your base URL:
function &glossar($message)
{
$db =& Database::getInstance();
if (count($this->glossary == 0)) {
if ($getglossar = $db->query("SELECT term,entryID FROM ". $db->prefix("wbentries"))){
while ($glossar = $db->fetchArray($getglossar)){
$id = $glossar['entryID'];
$term = $glossar['term'];
$termlink = '. $id . '" target="_blank">' . $term . '?';
$message =& preg_replace("/((<[^>]*)|$term)/ie", '"2"=="1"? "1":"$termlink"', $message,1);
array_push($this->glossary, $glossar);
}
}
}
elseif (is_array($this->glossary)){
foreach($this->glossary as $glossar) {
$id = $glossar['entryID'];
$term = $glossar['term'];
$termlink = '. $id . '" target="_blank">' . $term . '?';
$message =& preg_replace("/((<[^>]*)|$term)/ie", '"2"=="1"? "1":"$termlink"', $message,1);
}
}
return $message;
}
Find this: "function &displayTarea"
and add the following line before return:
$text =& $this->glossar($text);
Do the same with the function "function &previewTarea".
Ok, thats it. It´s not perfect, but it works for me. Suggestions are very welcome