Mercurial > SimpleWebPresenter
changeset 12:a20bb1b51aad
Merge.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Tue, 29 May 2012 21:08:23 +0200 |
| parents | ba6f0818018b (current diff) 60e73809887a (diff) |
| children | ee2c31392ea3 |
| files | index.php |
| diffstat | 3 files changed, 32 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/accept-language.inc Mon May 28 22:57:30 2012 +0200 +++ b/accept-language.inc Tue May 29 21:08:23 2012 +0200 @@ -18,7 +18,7 @@ // sort list based on value arsort($langs, SORT_NUMERIC); } - return $langs; } + return $langs; } ?> \ No newline at end of file
--- a/common-functions.inc Mon May 28 22:57:30 2012 +0200 +++ b/common-functions.inc Tue May 29 21:08:23 2012 +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
--- a/index.php Mon May 28 22:57:30 2012 +0200 +++ b/index.php Tue May 29 21:08:23 2012 +0200 @@ -159,8 +159,25 @@ $files=$body->getElementsByTagName("file"); 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}'"); }
