diff options
Diffstat (limited to 'h-source/Application/Include/myFunctions.php')
-rw-r--r-- | h-source/Application/Include/myFunctions.php | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 2ed9942..5603c97 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -267,9 +267,49 @@ function decodeWikiText($string) $string = preg_replace('/(\[h3\])(.*?)(\[\/h3\])/s', '<div class="div_h3">${2}</div>',$string); + $string = preg_replace_callback('/(\[tab )(lang=)([^\s]+)(\s*\])(.*?)(\[\/tab\])/s', 'createTabs',$string); + $string = preg_replace('/(\[lang\])(.*?)(\[\/lang\])/s', '<div class="div_lang">${2}</div>',$string); - return $string; + return Tabs::render()."\n\n".$string; +} + +//create the list of the tabs in the description entry +function createTabs($match) +{ + $label = Lang::getLabel($match[3]); + Tabs::$tabList[] = "<li><a href='#".$label."'>".$label."</a></li>\n"; + Tabs::$htmlList[] = "<div id='".$label."'>".$match[5]."</div>\n"; + return null; +} + +//create the HTMLof the tats in the description entry +class Tabs +{ + public static $tabList = array(); + public static $htmlList = array(); + + public static function render() + { + $html = null; + if (count(self::$tabList) > 0) + { + $html .= "<div id='description_tabs'>\n"; + $html .= "<ul>\n"; + foreach (self::$tabList as $label) + { + $html .= $label; + } + $html .= "</ul>\n"; + foreach (self::$htmlList as $content) + { + $html .= $content; + } + $html .= "</div>"; + } + return $html; + } + } function checkUrl($url) |