Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 52 lines (49 sloc) 1.555 kb
3be8ab7 @saltybeagle Initial port of PEAR2_Templates_Savant to Savvy
authored
1 #!/usr/bin/env php
2 <?php
3 /**
4 * If your package does special stuff in phar format, use this file. Remove if
5 * no phar format is ever generated
6 */
7 if (version_compare(phpversion(), '5.3.1', '<')) {
8 if (substr(phpversion(), 0, 5) != '5.3.1') {
9 // this small hack is because of running RCs of 5.3.1
10 echo "PEAR2_Templates_Savant requires PHP 5.3.1 or newer.
11 ";
12 exit -1;
13 }
14 }
15 foreach (array('phar', 'spl', 'pcre', 'simplexml') as $ext) {
16 if (!extension_loaded($ext)) {
17 echo 'Extension ', $ext, " is required
18 ";
19 exit -1;
20 }
21 }
22 try {
23 Phar::mapPhar();
24 } catch (Exception $e) {
25 echo "Cannot process PEAR2_Templates_Savant phar:
26 ";
27 echo $e->getMessage(), "
28 ";
29 exit -1;
30 }
31 function PEAR2_Templates_Savant_autoload($class)
32 {
4c6a752 @saltybeagle Fix minor syntax error
authored
33 $class = str_replace('_', '\\', $class);
34 if (file_exists('phar://' . __FILE__ . '/PEAR2_Templates_Savant-0.1.0/php/' . implode('/', explode('\\', $class)) . '.php')) {
35 include 'phar://' . __FILE__ . '/PEAR2_Templates_Savant-0.1.0/php/' . implode('/', explode('\\', $class)) . '.php';
3be8ab7 @saltybeagle Initial port of PEAR2_Templates_Savant to Savvy
authored
36 }
37 }
38 spl_autoload_register("PEAR2_Templates_Savant_autoload");
39 $phar = new Phar(__FILE__);
40 $sig = $phar->getSignature();
41 define('PEAR2_Templates_Savant_SIG', $sig['hash']);
42 define('PEAR2_Templates_Savant_SIGTYPE', $sig['hash_type']);
43
44 // your package-specific stuff here, for instance, here is what Pyrus does:
45
46 /**
47 * $frontend = new \pear2\Pyrus\ScriptFrontend\Commands;
48 * @array_shift($_SERVER['argv']);
49 * $frontend->run($_SERVER['argv']);
50 */
51 __HALT_COMPILER();
Something went wrong with that request. Please try again.