enhanced wikihelper.php to support revisioned link with __CODE__

This commit is contained in:
hyung-hwan 2020-06-26 02:22:20 +00:00
parent ad2adac63f
commit 1ceb8967a3

View File

@ -18,7 +18,7 @@ class WikiHelper
{
if (preg_match ('/^#R([[:digit:]]+)$/', $name, $matches) == 1)
{
// #R123 -> translate it to code reivision.
// #R123 -> translate it to code revision.
$link = "code/revision/{$projectid}/2e/{$matches[1]}";
return $link;
}
@ -163,6 +163,25 @@ class WikiHelper
return $link;
}
}
else if ($cnt == 5)
{
if ($ex[0] == '__CODE__')
{
$ex0 = $this->_trans_reserved ($ex[0]);
$ex1 = ($ex[1] == '')? $projectid: $ex[1];
if ($ex[2] == 'file')
{
// __CODE__|project001|file|123|file001.txt
$ex4 = $converter->AsciiToHex($ex[4]);
if ($ex1 == NULL) return FALSE;
$link = "{$ex0}/{$ex[2]}/{$ex1}/{$ex4}/{$ex[3]}";
return $link;
}
return FALSE;
}
}
}
return NULL; // not an error