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