Advertisement
ralphschindler

Untitled

Sep 15th, 2011
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. if (version_compare(phpversion(), '5.3.1', '<')) {
  3. if (substr(phpversion(), 0, 5) != '5.3.1') {
  4. // this small hack is because of running RCs of 5.3.1
  5. echo "Zend_Code requires PHP 5.3.1 or newer.\n";
  6. exit -1;
  7. }
  8. }
  9.  
  10. foreach (array('phar', 'spl', 'pcre', 'simplexml') as $ext) {
  11. if (!extension_loaded($ext)) {
  12. echo 'Extension ', $ext, " is required\n";
  13. exit -1;
  14. }
  15. }
  16.  
  17. try {
  18. Phar::mapPhar();
  19. } catch (Exception $e) {
  20. echo "Cannot process Zend_Code phar:\n";
  21. echo $e->getMessage(), "\n";
  22. exit -1;
  23. }
  24.  
  25. spl_autoload_register(function ($class) {
  26. $class = str_replace(array('_', '\\'), '/', $class);
  27. if (file_exists('phar://' . __FILE__ . '/Zend_Code-@PACKAGE_VERSION@/php/' . $class . '.php')) {
  28. include 'phar://' . __FILE__ . '/Zend_Code-@PACKAGE_VERSION@/php/' . $class . '.php';
  29. }
  30. });
  31.  
  32. $phar = new Phar(__FILE__);
  33. $sig = $phar->getSignature();
  34. define('Zend_Code_SIG', $sig['hash']);
  35. define('Zend_Code_SIGTYPE', $sig['hash_type']);
  36.  
  37. __HALT_COMPILER();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement