aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Include
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Include')
-rw-r--r--h-source/Application/Include/myFunctions.php66
1 files changed, 56 insertions, 10 deletions
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php
index 61c2ec2..b33c19b 100644
--- a/h-source/Application/Include/myFunctions.php
+++ b/h-source/Application/Include/myFunctions.php
@@ -221,11 +221,14 @@ function getLinkToUser($user)
}
}
-
+$decodeAnotherTime = false;
//decode the text of the wiki
function decodeWikiText($string)
{
+ global $decodeAnotherTime;
+
+ $decodeAnotherTime = false;
$string = preg_replace('/(\[hr\])/', '<hr />',$string);
@@ -250,12 +253,14 @@ function decodeWikiText($string)
$string = preg_replace('/(\[i\])(.*?)(\[\/i\])/s', '<i>${2}</i>',$string);
$string = preg_replace('/(\[del\])(.*?)(\[\/del\])/s', '<del>${2}</del>',$string);
+
+ $string = preg_replace_callback('/(\[\*\])(.*?)(\[\/\*\])/s', 'createItem',$string);
+
+ $string = preg_replace_callback('/(\[list\])(.*?)(\[\/list\])/s', 'createList',$string);
+
+ $string = preg_replace_callback('/(\[enum\])(.*?)(\[\/enum\])/s', 'createEnum',$string);
- $string = preg_replace('/(\[\*\])(.*?)(\[\/\*\])/s', '<li>${2}</li>',$string);
-
- $string = preg_replace('/(\[list\])(.*?)(\[\/list\])/s', '<ul>${2}</ul>',$string);
-
- $string = preg_replace('/(\[enum\])(.*?)(\[\/enum\])/s', '<ol>${2}</ol>',$string);
+// $string = preg_replace('/(\[enum\])(.*?)(\[\/enum\])/s', '<ol>${2}</ol>',$string);
$string = preg_replace('/(\[code\])(.*?)(\[\/code\])/s', '<pre class="code_pre">${2}</pre>',$string);
@@ -274,8 +279,15 @@ function decodeWikiText($string)
$string = preg_replace('/(\{\{)/s', '[',$string);
$string = preg_replace('/(\}\})/s', ']',$string);
-
- return Tabs::render()."\n\n".$string;
+
+ if ($decodeAnotherTime)
+ {
+ return decodeWikiText(Tabs::render().$string);
+ }
+ else
+ {
+ return Tabs::render().$string;
+ }
}
//create the list of the tabs in the description entry
@@ -321,8 +333,6 @@ class Tabs
function checkUrl($url)
{
-// $match = '/^http\:\/\/(www\.)?[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)?\.(com|net|it|info|org|eu|uk)((\/[a-zA-Z0-9\_\-\+]+)+[\/]?)?(\?([a-zA-Z0-9\_\-\+\s]+\=[a-zA-Z0-9\_\-\s\+\&amp;]+)+)?(#[a-zA-Z0-9\_\-\+\s]+)?([\s]*)?$/';
-
$match = '/^http(s)?\:\/\/(www\.)?[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)*\.(com|net|it|info|org|eu|uk|ca|us|cl)((\/[a-zA-Z0-9\_\.\-\:\+]+)*(\/([a-zA-Z0-9\_\:\-\.\+]+\.(php|html|htm|asp|aspx|jsp|cgi))?)?)?(\?([a-zA-Z0-9\_\-\+\s]+\=[a-zA-Z0-9\_\-\s\+\&amp;]+)+)?(#[a-zA-Z0-9\_\-\+\s]+)?([\s]*)?$/';
if (preg_match($match,$url))
@@ -356,6 +366,42 @@ function linkTo($match)
}
}
+function createNode($match,$hnodeTag,$htmlTagBegin,$htmlTagEng)
+{
+ $numb = strlen($hnodeTag);
+ global $decodeAnotherTime;
+
+ if (strstr($match[2],$hnodeTag))
+ {
+ $string = substr($match[0],$numb);
+ $string = decodeWikiText($string);
+ $decodeAnotherTime = true;
+ return $hnodeTag.$string;
+ }
+ else
+ {
+ return $htmlTagBegin.$match[2].$htmlTagEng;
+ }
+}
+
+//create <li></li>
+function createItem($match)
+{
+ return createNode($match,'[*]',"<li>","</li>");
+}
+
+//create <ul></ul>
+function createList($match)
+{
+ return createNode($match,'[list]',"<ul>","</ul>");
+}
+
+//create <ol></ol>
+function createEnum($match)
+{
+ return createNode($match,'[enum]',"<ol>","</ol>");
+}
+
function linkToInternalPage($match)
{
return "<a title = '".$match[2]."' href='http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".encodeUrl($match[2])."'>".$match[2]."</a>";