merge.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. $QR_BASEDIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
  3. $QR_TOOLSDIR = dirname(__FILE__) . DIRECTORY_SEPARATOR;
  4. $outputFile = $QR_BASEDIR . 'phpqrcode.php';
  5. $fileList = array($QR_BASEDIR . 'qrconst.php', $QR_TOOLSDIR . 'merged_config.php', $QR_BASEDIR . 'qrtools.php', $QR_BASEDIR . 'qrspec.php', $QR_BASEDIR . 'qrimage.php', $QR_BASEDIR . 'qrinput.php', $QR_BASEDIR . 'qrbitstream.php', $QR_BASEDIR . 'qrsplit.php', $QR_BASEDIR . 'qrrscode.php', $QR_BASEDIR . 'qrmask.php', $QR_BASEDIR . 'qrencode.php');
  6. $headerFile = $QR_TOOLSDIR . 'merged_header.php';
  7. $versionFile = $QR_BASEDIR . 'VERSION';
  8. $outputCode = '';
  9. foreach ($fileList as $fileName) {
  10. $outputCode .= '
  11. ' . '//---- ' . basename($fileName) . ' -----------------------------' . '
  12. ';
  13. $anotherCode = file_get_contents($fileName);
  14. $anotherCode = preg_replace('/^<\\?php/', '', $anotherCode);
  15. $anotherCode = preg_replace('/\\?>\\*$/', '', $anotherCode);
  16. $outputCode .= '
  17. ' . $anotherCode . '
  18. ';
  19. }
  20. $versionDataEx = explode('
  21. ', file_get_contents($versionFile));
  22. $outputContents = file_get_contents($headerFile);
  23. $outputContents .= '
  24. /*
  25. * Version: ' . trim($versionDataEx[0]) . '
  26. * Build: ' . trim($versionDataEx[1]) . '
  27. */
  28. ';
  29. $outputContents .= $outputCode;
  30. file_put_contents($outputFile, $outputContents);
  31. ?>