]> git.wh0rd.org Git - tt-rss.git/blob - lib/phpqrcode/tools/merge.php
implement one time passwords using TOTP
[tt-rss.git] / lib / phpqrcode / tools / merge.php
1 <?php\r
2 \r
3 /*\r
4  * PHP QR Code encoder\r
5  *\r
6  * Tool for merging all library files into one, simpler to incorporate.\r
7  * \r
8  * MAKE SURE THAT RESULTING PHPQRCode.php (and its dir) ARE WRITABLE!\r
9  *\r
10  * PHP QR Code is distributed under LGPL 3\r
11  * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>\r
12  *\r
13  * This library is free software; you can redistribute it and/or\r
14  * modify it under the terms of the GNU Lesser General Public\r
15  * License as published by the Free Software Foundation; either\r
16  * version 3 of the License, or any later version.\r
17  *\r
18  * This library is distributed in the hope that it will be useful,\r
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
21  * Lesser General Public License for more details.\r
22  *\r
23  * You should have received a copy of the GNU Lesser General Public\r
24  * License along with this library; if not, write to the Free Software\r
25  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
26  */\r
27  \r
28     $QR_BASEDIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;\r
29     $QR_TOOLSDIR = dirname(__FILE__).DIRECTORY_SEPARATOR;\r
30     \r
31     $outputFile = $QR_BASEDIR.'phpqrcode.php';\r
32     \r
33     // Required libs\r
34     \r
35     $fileList = array(\r
36         $QR_BASEDIR.'qrconst.php',\r
37         $QR_TOOLSDIR.'merged_config.php',\r
38         $QR_BASEDIR.'qrtools.php',\r
39         $QR_BASEDIR.'qrspec.php',\r
40         $QR_BASEDIR.'qrimage.php',\r
41         $QR_BASEDIR.'qrinput.php',\r
42         $QR_BASEDIR.'qrbitstream.php',\r
43         $QR_BASEDIR.'qrsplit.php',\r
44         $QR_BASEDIR.'qrrscode.php',\r
45         $QR_BASEDIR.'qrmask.php',\r
46         $QR_BASEDIR.'qrencode.php'\r
47     );\r
48     \r
49     $headerFile = $QR_TOOLSDIR.'merged_header.php';\r
50     $versionFile = $QR_BASEDIR.'VERSION';\r
51     \r
52     $outputCode = '';\r
53     \r
54     foreach($fileList as $fileName) {\r
55         $outputCode .= "\n\n".'//---- '.basename($fileName).' -----------------------------'."\n\n";\r
56         $anotherCode = file_get_contents($fileName);\r
57         $anotherCode = preg_replace ('/^<\?php/', '', $anotherCode);\r
58         $anotherCode = preg_replace ('/\?>\*$/', '', $anotherCode);\r
59         $outputCode .= "\n\n".$anotherCode."\n\n";\r
60     }\r
61     \r
62         $versionDataEx = explode("\n", file_get_contents($versionFile));\r
63         \r
64     $outputContents = file_get_contents($headerFile);\r
65     $outputContents .= "\n\n/*\n * Version: ".trim($versionDataEx[0])."\n * Build: ".trim($versionDataEx[1])."\n */\n\n";\r
66     $outputContents .= $outputCode;\r
67     \r
68     file_put_contents($outputFile, $outputContents);\r
69     \r
70