# HG changeset patch # User Tom Fredrik "BFG" Klaussen # Date 1307880900 -7200 # Node ID 19dfa6f3e2be62a7277aa3e2a12f129bfade30dd # Parent 350a8c63bd14903f889542f504f61f9423be4d2e Support for scripts. diff -r 350a8c63bd14 -r 19dfa6f3e2be common-functions.inc --- a/common-functions.inc Fri May 20 23:34:33 2011 +0200 +++ b/common-functions.inc Sun Jun 12 14:15:00 2011 +0200 @@ -60,4 +60,16 @@ $elem=$elems->item(0); return $elem; } + +function getXmlContent($node) +{ + $text=$node->ownerDocument->saveXml($node); + $pattern="/^<".$node->tagName."[^>]*>/is"; + $text=preg_replace($pattern, '' , $text); + $pattern='/<\/'.$node->tagName.'[^>]*>$/is'; + $text=preg_replace($pattern, '' , $text); + + return $text; +} + ?> \ No newline at end of file diff -r 350a8c63bd14 -r 19dfa6f3e2be index.php --- a/index.php Fri May 20 23:34:33 2011 +0200 +++ b/index.php Sun Jun 12 14:15:00 2011 +0200 @@ -128,8 +128,25 @@ } foreach ($files as $file) { - $src=$file->getAttribute("src"); - $file_content=loadFile("${lang}/${src}"); + $script=$file->getAttribute("script"); + if ($script) { + $src=""; + $cwd=getcwd(); + + $matches=array(); + preg_match('/(.*\/)/', $script, $matches); + $dirname=$matches[0]; + preg_match('/([^\/]*)$/', $script, $matches); + $filename=$matches[0]; + chdir("${lang}/${dirname}"); + $pipe=popen("php ${filename}","r"); + $file_content = stream_get_contents($pipe); + chdir("${cwd}"); + } + else { + $src=$file->getAttribute("src"); + $file_content=loadFile("${lang}/${src}"); + } if(floatval($file_content)<0) { errorPage("Resource not found '${lang}/${src}'"); }