]> Raphaƫl G. Git Repositories - cdn/blob - vendor/phpqrcode/tools/merge.php
Add osm map generator
[cdn] / vendor / 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 $QR_BASEDIR.'qrvect.php'
48 );
49
50 $headerFile = $QR_TOOLSDIR.'merged_header.php';
51 $versionFile = $QR_BASEDIR.'VERSION';
52
53 $outputCode = '';
54
55 foreach($fileList as $fileName) {
56 $outputCode .= "\n\n".'//---- '.basename($fileName).' -----------------------------'."\n\n";
57 $anotherCode = file_get_contents($fileName);
58 $anotherCode = preg_replace ('/^<\?php/', '', $anotherCode);
59 $anotherCode = preg_replace ('/\?>\*$/', '', $anotherCode);
60 $outputCode .= "\n\n".$anotherCode."\n\n";
61 }
62
63 $versionDataEx = explode("\n", file_get_contents($versionFile));
64
65 $outputContents = file_get_contents($headerFile);
66 $outputContents .= "\n\n/*\n * Version: ".trim($versionDataEx[0])."\n * Build: ".trim($versionDataEx[1])."\n */\n\n";
67 $outputContents .= $outputCode;
68
69 file_put_contents($outputFile, $outputContents);
70
71