]> git.joonet.de Git - adminer.git/commitdiff
Prepare for single language version
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 5 Jul 2007 07:34:42 +0000 (07:34 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 5 Jul 2007 07:34:42 +0000 (07:34 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@32 7c3ca157-0c34-0410-bff1-cbf682f78f5c

_compile.php

index aa73f4e9334fc60b400f99bf006b4d2f0b7776b8..ecfae3dd34ed2ed1886a43b3322dafb360b772e0 100644 (file)
@@ -1,6 +1,10 @@
 <?php
+function remove_lang($match) {
+       global $LANG;
+       return lang(strtr($match[2], array("\\'" => "'", "\\\\" => "\\")));
+}
+
 function put_file($match) {
-       //! exit on error with require, _once
        $return = file_get_contents($match[4]);
        $return = preg_replace("~\\?>?\n?\$~", '', $return);
        if (substr_count($return, "<?php") - substr_count($return, "?>") <= 0 && !$match[5]) {
@@ -13,8 +17,17 @@ function put_file($match) {
        return $return;
 }
 
+error_reporting(E_ALL & ~E_NOTICE);
 $file = file_get_contents("index.php");
+$LANG = (strlen($_SERVER["argv"][1]) == 2 ? $_SERVER["argv"][1] : "");
+if ($LANG) {
+       $file = str_replace("include \"./lang.inc.php\";\n", "", $file);
+}
 $file = preg_replace_callback('~(<\\?php\\s*)?(include|require)(_once)? "([^"]*)";(\\s*\\?>)?~', 'put_file', $file);
+if ($LANG) {
+       include "./lang.inc.php";
+       preg_replace_callback("~(<\\?php\\s*echo )?lang\\('((?:[^\\\\']*|\\\\.)+)'\\)(;\\s*\\?>)?~s", 'remove_lang', $file);
+}
 //! remove spaces and comments
-file_put_contents("phpMinAdmin.php", $file);
+file_put_contents("phpMinAdmin" . ($LANG ? "-$LANG" : "") . ".php", $file);
 echo "phpMinAdmin.php created.\n";