Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 365 lines (342 sloc) 13.574 kb
56ac3d18 »
2012-05-25 Mark scripts as executable
1 #!/usr/bin/env php
667bfec4 »
2007-07-02 Decomposition
2 <?php
1bc77f88 »
2009-08-28 Report user errors
3 error_reporting(6135); // errors and warnings
e1bc7af8 »
2009-06-13 Change directory structure
4 include dirname(__FILE__) . "/adminer/include/version.inc.php";
bf4f0a1f »
2012-03-08 Replace JSMin by JsShrink
5 include dirname(__FILE__) . "/externals/JsShrink/jsShrink.php";
7f3b4f2b »
2009-05-29 Version checker
6
89436789 »
2007-07-09 sprintf() in lang()
7 function add_apo_slashes($s) {
8 return addcslashes($s, "\\'");
9 }
10
415f500f »
2012-09-06 Don't use \r\n in compiled strings
11 function add_quo_slashes($s) {
12 return addcslashes($s, "\n\r\$\"\\");
13 }
14
0970a583 »
2007-07-05 Prepare for single language version
15 function remove_lang($match) {
bba76d8d »
2007-08-04 Flatten $translations
16 global $translations;
438ca058 »
2007-07-26 Separate languages
17 $idf = strtr($match[2], array("\\'" => "'", "\\\\" => "\\"));
bba76d8d »
2007-08-04 Flatten $translations
18 $s = ($translations[$idf] ? $translations[$idf] : $idf);
64ba9242 »
2009-06-21 Comments
19 if ($match[3] == ",") { // lang() has parameters
89436789 »
2007-07-09 sprintf() in lang()
20 return "$match[1]" . (is_array($s) ? "lang(array('" . implode("', '", array_map('add_apo_slashes', $s)) . "')," : "sprintf('" . add_apo_slashes($s) . "',");
21 }
22 return ($match[1] && $match[4] ? $s : "$match[1]'" . add_apo_slashes($s) . "'$match[4]");
0970a583 »
2007-07-05 Prepare for single language version
23 }
24
4738060a »
2008-05-23 Use numeric language IDs to save bytes
25 function lang_ids($match) {
26 global $lang_ids;
c16c57b1 »
2009-07-11 E-mail sending
27 $lang_id = &$lang_ids[stripslashes($match[1])];
6591d485 »
2012-05-13 Replace isset($var) by $var !== null
28 if ($lang_id === null) {
c16c57b1 »
2009-07-11 E-mail sending
29 $lang_id = count($lang_ids) - 1;
30 }
0116b9d1 »
2009-09-10 Don't set cookie in compile scripts
31 return ($_SESSION["lang"] ? $match[0] : "lang($lang_id$match[2]");
4738060a »
2008-05-23 Use numeric language IDs to save bytes
32 }
33
667bfec4 »
2007-07-02 Decomposition
34 function put_file($match) {
c16c57b1 »
2009-07-11 E-mail sending
35 global $project;
b95f24ea »
2009-07-03 Editor: User friendly data editor
36 if (basename($match[2]) == '$LANG.inc.php') {
c16c57b1 »
2009-07-11 E-mail sending
37 return $match[0]; // processed later
438ca058 »
2007-07-26 Separate languages
38 }
b95f24ea »
2009-07-03 Editor: User friendly data editor
39 $return = file_get_contents(dirname(__FILE__) . "/$project/$match[2]");
0116b9d1 »
2009-09-10 Don't set cookie in compile scripts
40 if (basename($match[2]) != "lang.inc.php" || !$_SESSION["lang"]) {
64ba9242 »
2009-06-21 Comments
41 $tokens = token_get_all($return); // to find out the last token
6bb1401d »
2009-06-01 Remove ?><?php
42 return "?>\n$return" . (in_array($tokens[count($tokens) - 1][0], array(T_CLOSE_TAG, T_INLINE_HTML), true) ? "<?php" : "");
9a4cabe8 »
2011-07-11 Simplify single language version
43 } elseif (preg_match('~\\s*(\\$pos = (.+\n).+;)~sU', $return, $match2)) {
64ba9242 »
2009-06-21 Comments
44 // single language lang() is used for plural
e37c427e »
2010-12-30 Function get_lang useful for customization
45 return "function get_lang() {
46 return '$_SESSION[lang]';
47 }
48
49 function lang(\$translation, \$number) {
9a4cabe8 »
2011-07-11 Simplify single language version
50 \$pos = $match2[2]\t\t: " . (preg_match("~\\\$LANG == '$_SESSION[lang]'.* \\? (.+)\n~U", $match2[1], $match3) ? $match3[1] : "1") . '
51 );
7f1fcc22 »
2012-06-04 Format numbers in translations
52 $translation = str_replace("%d", "%s", $translation[$pos]);
53 $number = number_format($number, 0, ".", lang(\',\'));
54 return sprintf($translation, $number);
e37c427e »
2010-12-30 Function get_lang useful for customization
55 }
56 ';
6bb1401d »
2009-06-01 Remove ?><?php
57 } else {
58 echo "lang() not found\n";
667bfec4 »
2007-07-02 Decomposition
59 }
60 }
61
5d257861 »
2012-09-02 Compress translations
62 function lzw_compress($string) {
63 // compression
64 $dictionary = array_flip(range("\0", "\xFF"));
65 $word = "";
66 $codes = array();
67 for ($i=0; $i <= strlen($string); $i++) {
68 $x = $string[$i];
69 if (strlen($x) && isset($dictionary[$word . $x])) {
70 $word .= $x;
71 } elseif ($i) {
72 $codes[] = $dictionary[$word];
73 $dictionary[$word . $x] = count($dictionary);
74 $word = $x;
75 }
76 }
77 // convert codes to binary string
78 $dictionary_count = 256;
79 $bits = 8; // ceil(log($dictionary_count, 2))
80 $return = "";
81 $rest = 0;
82 $rest_length = 0;
83 foreach ($codes as $code) {
84 $rest = ($rest << $bits) + $code;
85 $rest_length += $bits;
86 $dictionary_count++;
87 if ($dictionary_count >> $bits) {
88 $bits++;
89 }
90 while ($rest_length > 7) {
91 $rest_length -= 8;
92 $return .= chr($rest >> $rest_length);
93 $rest &= (1 << $rest_length) - 1;
94 }
95 }
96 return $return . ($rest_length ? chr($rest << (8 - $rest_length)) : "");
97 }
98
c16c57b1 »
2009-07-11 E-mail sending
99 function put_file_lang($match) {
b4b59779 »
2010-11-15 Include only active translations
100 global $lang_ids, $project, $langs;
0116b9d1 »
2009-09-10 Don't set cookie in compile scripts
101 if ($_SESSION["lang"]) {
c16c57b1 »
2009-07-11 E-mail sending
102 return "";
103 }
0317638e »
2012-09-03 Compress each translation separately
104 $return = "";
b4b59779 »
2010-11-15 Include only active translations
105 foreach ($langs as $lang => $val) {
106 include dirname(__FILE__) . "/adminer/lang/$lang.inc.php"; // assign $translations
c16c57b1 »
2009-07-11 E-mail sending
107 $translation_ids = array_flip($lang_ids); // default translation
108 foreach ($translations as $key => $val) {
6591d485 »
2012-05-13 Replace isset($var) by $var !== null
109 if ($val !== null) {
0317638e »
2012-09-03 Compress each translation separately
110 $translation_ids[$lang_ids[$key]] = implode("\t", (array) $val);
c16c57b1 »
2009-07-11 E-mail sending
111 }
112 }
415f500f »
2012-09-06 Don't use \r\n in compiled strings
113 $return .= '
114 case "' . $lang . '": $compressed = "' . add_quo_slashes(lzw_compress(implode("\n", $translation_ids))) . '"; break;';
c16c57b1 »
2009-07-11 E-mail sending
115 }
0317638e »
2012-09-03 Compress each translation separately
116 $translations_version = crc32($return);
5d257861 »
2012-09-02 Compress translations
117 return '$translations = &$_SESSION["translations"];
ccd12466 »
2012-09-03 Save translations version
118 if ($_SESSION["translations_version"] != ' . $translations_version . ') {
119 $translations = array();
120 $_SESSION["translations_version"] = ' . $translations_version . ';
121 }
57d0c4c6 »
2012-09-16 Fix switching language in compiled version
122 if (!$translations) {
0317638e »
2012-09-03 Compress each translation separately
123 switch ($LANG) {' . $return . '
124 }
125 $translations = array();
126 foreach (explode("\n", lzw_decompress($compressed)) as $val) {
127 $translations[] = (strpos($val, "\t") ? explode("\t", $val) : $val);
128 }
5d257861 »
2012-09-02 Compress translations
129 }
130 ';
c16c57b1 »
2009-07-11 E-mail sending
131 }
132
16f42102 »
2009-04-15 Function minification
133 function short_identifier($number, $chars) {
134 $return = '';
a06f4c15 »
2009-04-15 Size reduction by minification of variables
135 while ($number >= 0) {
b0666e53 »
2012-05-16 Remove unnecessary { } in compile
136 $return .= $chars[$number % strlen($chars)];
a06f4c15 »
2009-04-15 Size reduction by minification of variables
137 $number = floor($number / strlen($chars)) - 1;
138 }
139 return $return;
140 }
141
004d7a96 »
2009-07-24 Link
142 // based on http://latrine.dgx.cz/jak-zredukovat-php-skripty
794192d9 »
2007-09-04 php_shrink()
143 function php_shrink($input) {
cbdf09d8 »
2011-05-12 Show version in comment (thanks to David Grudl)
144 global $VERSION;
815eb26e »
2009-05-08 Use one token for all
145 $special_variables = array_flip(array('$this', '$GLOBALS', '$_GET', '$_POST', '$_FILES', '$_COOKIE', '$_SESSION', '$_SERVER'));
12d2c6db »
2009-10-06 Build Adminer and Editor together
146 $short_variables = array();
a06f4c15 »
2009-04-15 Size reduction by minification of variables
147 $shortening = true;
16f42102 »
2009-04-15 Function minification
148 $tokens = token_get_all($input);
149
b0666e53 »
2012-05-16 Remove unnecessary { } in compile
150 // remove unnecessary { }
151 //! change also `while () { if () {;} }` to `while () if () ;` but be careful about `if () { if () { } } else { }
152 $shorten = 0;
153 $opening = -1;
154 foreach ($tokens as $i => $token) {
155 if (in_array($token[0], array(T_IF, T_ELSE, T_ELSEIF, T_WHILE, T_DO, T_FOR, T_FOREACH), true)) {
156 $shorten = ($token[0] == T_FOR ? 4 : 2);
157 $opening = -1;
158 } elseif (in_array($token[0], array(T_SWITCH, T_FUNCTION, T_CLASS, T_CLOSE_TAG), true)) {
159 $shorten = 0;
160 } elseif ($token === ';') {
161 $shorten--;
162 } elseif ($token === '{') {
163 if ($opening < 0) {
164 $opening = $i;
165 } elseif ($shorten > 1) {
166 $shorten = 0;
167 }
168 } elseif ($token === '}' && $opening >= 0 && $shorten == 1) {
169 unset($tokens[$opening]);
170 unset($tokens[$i]);
171 $shorten = 0;
172 $opening = -1;
173 }
174 }
175 $tokens = array_values($tokens);
176
16f42102 »
2009-04-15 Function minification
177 foreach ($tokens as $i => $token) {
178 if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
179 $short_variables[$token[1]]++;
180 }
181 }
c27a8774 »
2009-04-16 Minify defined functions only
182
16f42102 »
2009-04-15 Function minification
183 arsort($short_variables);
0ced6d33 »
2011-08-09 Preserve short variable names between versions if possible
184 $chars = implode(range('a', 'z')) . '_' . implode(range('A', 'Z'));
185 // preserve variable names between versions if possible
186 $short_variables2 = array_splice($short_variables, strlen($chars));
187 ksort($short_variables);
188 ksort($short_variables2);
189 $short_variables += $short_variables2;
16f42102 »
2009-04-15 Function minification
190 foreach (array_keys($short_variables) as $number => $key) {
0ced6d33 »
2011-08-09 Preserve short variable names between versions if possible
191 $short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
16f42102 »
2009-04-15 Function minification
192 }
a06f4c15 »
2009-04-15 Size reduction by minification of variables
193
541561be »
2012-09-03 Minimize space around %
194 $set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[\]^`{|}'));
794192d9 »
2007-09-04 php_shrink()
195 $space = '';
196 $output = '';
ff85f125 »
2009-06-01 Join echos
197 $in_echo = false;
c16c57b1 »
2009-07-11 E-mail sending
198 $doc_comment = false; // include only first /**
ff85f125 »
2009-06-01 Join echos
199 for (reset($tokens); list($i, $token) = each($tokens); ) {
794192d9 »
2007-09-04 php_shrink()
200 if (!is_array($token)) {
201 $token = array(0, $token);
202 }
dbf95669 »
2009-08-26 Better consecutive echo handling
203 if ($tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG
415f500f »
2012-09-06 Don't use \r\n in compiled strings
204 && strlen(add_apo_slashes($tokens[$i+3][1])) < strlen($tokens[$i+3][1]) + 3
dbf95669 »
2009-08-26 Better consecutive echo handling
205 ) {
206 $tokens[$i+2] = array(T_ECHO, 'echo');
415f500f »
2012-09-06 Don't use \r\n in compiled strings
207 $tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . add_apo_slashes($tokens[$i+3][1]) . "'");
dbf95669 »
2009-08-26 Better consecutive echo handling
208 $tokens[$i+4] = array(0, ';');
209 }
c16c57b1 »
2009-07-11 E-mail sending
210 if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) {
794192d9 »
2007-09-04 php_shrink()
211 $space = "\n";
212 } else {
c16c57b1 »
2009-07-11 E-mail sending
213 if ($token[0] == T_DOC_COMMENT) {
214 $doc_comment = true;
cbdf09d8 »
2011-05-12 Show version in comment (thanks to David Grudl)
215 $token[1] = substr_replace($token[1], "* @version $VERSION\n", -2, 0);
c16c57b1 »
2009-07-11 E-mail sending
216 }
a06f4c15 »
2009-04-15 Size reduction by minification of variables
217 if ($token[0] == T_VAR) {
218 $shortening = false;
219 } elseif (!$shortening) {
220 if ($token[1] == ';') {
221 $shortening = true;
222 }
ff85f125 »
2009-06-01 Join echos
223 } elseif ($token[0] == T_ECHO) {
224 $in_echo = true;
225 } elseif ($token[1] == ';' && $in_echo) {
e2bc1daa »
2009-08-26 No comments without whitespace
226 if ($tokens[$i+1][0] === T_WHITESPACE && $tokens[$i+2][0] === T_ECHO) {
ff85f125 »
2009-06-01 Join echos
227 next($tokens);
c030c163 »
2009-07-30 Compile inline HTML to echo
228 $i++;
229 }
230 if ($tokens[$i+1][0] === T_ECHO) {
231 // join two consecutive echos
ff85f125 »
2009-06-01 Join echos
232 next($tokens);
02046d69 »
2009-09-23 Windows support in e-mail attachments
233 $token[1] = ','; // '.' would conflict with "a".1+2 and would use more memory //! remove ',' and "," but not $var","
dbf95669 »
2009-08-26 Better consecutive echo handling
234 } else {
235 $in_echo = false;
ff85f125 »
2009-06-01 Join echos
236 }
16f42102 »
2009-04-15 Function minification
237 } elseif ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
238 $token[1] = '$' . $short_variables[$token[1]];
a06f4c15 »
2009-04-15 Size reduction by minification of variables
239 }
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
240 if (isset($set[substr($output, -1)]) || isset($set[$token[1][0]])) {
794192d9 »
2007-09-04 php_shrink()
241 $space = '';
242 }
243 $output .= $space . $token[1];
244 $space = '';
245 }
246 }
247 return $output;
248 }
249
9ee9cf08 »
2009-06-26 Remove code generation
250 function minify_css($file) {
dd86e189 »
2012-09-06 Simplify compile_file()
251 return lzw_compress(preg_replace('~\\s*([:;{},])\\s*~', '\\1', preg_replace('~/\\*.*\\*/~sU', '', $file)));
9ee9cf08 »
2009-06-26 Remove code generation
252 }
253
e767663f »
2012-09-06 Compress JS
254 function minify_js($file) {
63c9873c »
2012-09-06 Fix JUSH compilation
255 $file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/'", $file);
e767663f »
2012-09-06 Compress JS
256 if (function_exists('jsShrink')) {
257 $file = jsShrink($file);
258 }
dd86e189 »
2012-09-06 Simplify compile_file()
259 return lzw_compress($file);
e767663f »
2012-09-06 Compress JS
260 }
261
9ee9cf08 »
2009-06-26 Remove code generation
262 function compile_file($match) {
df03f4f0 »
2009-07-13 Join editing.js in compilation
263 global $project;
e767663f »
2012-09-06 Compress JS
264 $file = "";
265 foreach (explode(";", $match[1]) as $filename) {
266 $file .= file_get_contents(dirname(__FILE__) . "/$project/$filename");
267 }
dd86e189 »
2012-09-06 Simplify compile_file()
268 if ($match[2]) {
269 $file = call_user_func($match[2], $file);
270 }
271 return '"' . add_quo_slashes($file) . '"';
9ee9cf08 »
2009-06-26 Remove code generation
272 }
273
e6726941 »
2010-05-07 Rename $driver to $jush
274 $driver = "";
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
275 if (file_exists(dirname(__FILE__) . "/adminer/drivers/" . $_SERVER["argv"][1] . ".inc.php")) {
e6726941 »
2010-05-07 Rename $driver to $jush
276 $driver = $_SERVER["argv"][1];
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
277 array_shift($_SERVER["argv"]);
278 }
279
0116b9d1 »
2009-09-10 Don't set cookie in compile scripts
280 unset($_COOKIE["adminer_lang"]);
281 $_SESSION["lang"] = $_SERVER["argv"][1]; // Adminer functions read language from session
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
282 include dirname(__FILE__) . "/adminer/include/lang.inc.php";
0116b9d1 »
2009-09-10 Don't set cookie in compile scripts
283 if (isset($_SESSION["lang"])) {
284 if (isset($_SERVER["argv"][2]) || !isset($langs[$_SESSION["lang"]])) {
7e97fcd0 »
2012-02-17 Compile usage
285 echo "Usage: php compile.php [driver] [lang]\nPurpose: Compile adminer[-driver][-lang].php and editor[-driver][-lang].php.\n";
7418af0c »
2007-07-05 Czech translation
286 exit(1);
287 }
0116b9d1 »
2009-09-10 Don't set cookie in compile scripts
288 include dirname(__FILE__) . "/adminer/lang/$_SESSION[lang].inc.php";
7418af0c »
2007-07-05 Czech translation
289 }
bba76d8d »
2007-08-04 Flatten $translations
290
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
291 // check function definition in drivers
292 $filename = dirname(__FILE__) . "/adminer/drivers/mysql.inc.php";
293 preg_match_all('~\\bfunction ([^(]+)~', file_get_contents($filename), $matches); //! respect context (extension, class)
294 $functions = array_combine($matches[1], $matches[0]);
295 unset($functions["__destruct"], $functions["Min_DB"], $functions["Min_Result"]);
e6726941 »
2010-05-07 Rename $driver to $jush
296 foreach (glob(dirname(__FILE__) . "/adminer/drivers/" . ($driver ? $driver : "*") . ".inc.php") as $filename) {
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
297 if ($filename != "mysql.inc.php") {
298 $file = file_get_contents($filename);
299 foreach ($functions as $val) {
300 if (!strpos($file, "$val(")) {
301 echo "Missing $val in $filename\n";
302 }
303 }
304 }
305 }
306
e6726941 »
2010-05-07 Rename $driver to $jush
307 include dirname(__FILE__) . "/adminer/include/pdo.inc.php";
955e6b44 »
2011-06-04 PostgreSQL supports only functions
308 $features = array("call" => "routine", "dump", "event", "privileges", "procedure" => "routine", "processlist", "routine", "scheme", "sequence", "status", "trigger", "type", "user" => "privileges", "variables", "view");
12d2c6db »
2009-10-06 Build Adminer and Editor together
309 foreach (array("adminer", "editor") as $project) {
310 $lang_ids = array(); // global variable simplifies usage in a callback function
311 $file = file_get_contents(dirname(__FILE__) . "/$project/index.php");
e6726941 »
2010-05-07 Rename $driver to $jush
312 if ($driver) {
6420c584 »
2010-05-05 Schema support for PostgreSQL
313 $connection = (object) array("server_info" => 5.1); // MySQL support is version specific
e6726941 »
2010-05-07 Rename $driver to $jush
314 $_GET[$driver] = true; // to load the driver
315 include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php";
955e6b44 »
2011-06-04 PostgreSQL supports only functions
316 foreach ($features as $key => $feature) {
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
317 if (!support($feature)) {
955e6b44 »
2011-06-04 PostgreSQL supports only functions
318 if (!is_int($key)) {
319 $feature = $key;
320 }
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
321 $file = str_replace("} elseif (isset(\$_GET[\"$feature\"])) {\n\tinclude \"./$feature.inc.php\";\n", "", $file);
322 }
323 }
324 if (!support("routine")) {
325 $file = str_replace("if (isset(\$_GET[\"callf\"])) {\n\t\$_GET[\"call\"] = \$_GET[\"callf\"];\n}\nif (isset(\$_GET[\"function\"])) {\n\t\$_GET[\"procedure\"] = \$_GET[\"function\"];\n}\n", "", $file);
326 }
327 }
12d2c6db »
2009-10-06 Build Adminer and Editor together
328 $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file);
329 $file = str_replace('include "../adminer/include/coverage.inc.php";', '', $file);
e6726941 »
2010-05-07 Rename $driver to $jush
330 if ($driver) {
331 $file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file);
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
332 }
12d2c6db »
2009-10-06 Build Adminer and Editor together
333 $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php
e678e467 »
2010-05-21 Remove unsupported features in single driver version
334 if ($driver) {
335 foreach ($features as $feature) {
336 if (!support($feature)) {
337 $file = preg_replace("((\t*)" . preg_quote('if (support("' . $feature . '")') . ".*\n\\1\\})sU", '', $file);
338 }
339 }
4b9d451d »
2010-05-28 SQLite version supports two systems
340 if (count($drivers) == 1) {
30cfa613 »
2010-06-08 Fix MySQL only version
341 $file = str_replace('<?php echo html_select("driver", $drivers, DRIVER); ?>', "<input type='hidden' name='driver' value='" . ($driver == "mysql" ? "server" : $driver) . "'>" . reset($drivers), $file);
4b9d451d »
2010-05-28 SQLite version supports two systems
342 }
e678e467 »
2010-05-21 Remove unsupported features in single driver version
343 }
12d2c6db »
2009-10-06 Build Adminer and Editor together
344 $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
5d257861 »
2012-09-02 Compress translations
345 $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
415f500f »
2012-09-06 Don't use \r\n in compiled strings
346 $file = str_replace("\r", "", $file);
12d2c6db »
2009-10-06 Build Adminer and Editor together
347 if ($_SESSION["lang"]) {
348 // single language version
349 $file = preg_replace_callback("~(<\\?php\\s*echo )?lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])(;\\s*\\?>)?~s", 'remove_lang', $file);
350 $file = str_replace("<?php switch_lang(); ?>\n", "", $file);
351 $file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file);
352 }
353 $file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
dd86e189 »
2012-09-06 Simplify compile_file()
354 $file = preg_replace_callback("~compile_file\\('([^']+)'(?:, '([^']*)')?\\)~", 'compile_file', $file); // integrate static files
1be289e8 »
2011-02-09 Optimize compiling files
355 $replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION;
4815c7d0 »
2012-04-15 Don't use AJAX links and forms
356 $file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
12d2c6db »
2009-10-06 Build Adminer and Editor together
357 $file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
358 $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
359 $file = php_shrink($file);
c02bd441 »
2009-07-20 Use $filename
360
e6726941 »
2010-05-07 Rename $driver to $jush
361 $filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php";
12d2c6db »
2009-10-06 Build Adminer and Editor together
362 fwrite(fopen($filename, "w"), $file); // file_put_contents() since PHP 5
3f5b6834 »
2010-04-21 Reintegrate sqlite branch
363 echo "$filename created (" . strlen($file) . " B).\n";
12d2c6db »
2009-10-06 Build Adminer and Editor together
364 }
Something went wrong with that request. Please try again.