From 1ceb8967a34fc19f98286d3c73c96bd7d038e4cd Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 26 Jun 2020 02:22:20 +0000 Subject: [PATCH] enhanced wikihelper.php to support revisioned link with __CODE__ --- codepot/src/codepot/libraries/wikihelper.php | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/codepot/src/codepot/libraries/wikihelper.php b/codepot/src/codepot/libraries/wikihelper.php index 9415a8be..06f6f494 100644 --- a/codepot/src/codepot/libraries/wikihelper.php +++ b/codepot/src/codepot/libraries/wikihelper.php @@ -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