diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-03 19:26:54 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-03 19:26:54 +0200 |
commit | 4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch) | |
tree | 6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php | |
parent | 2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff) | |
download | wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip |
twig implementation
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php')
-rw-r--r-- | vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php b/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php new file mode 100644 index 00000000..4fadbe82 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/common.php | |||
@@ -0,0 +1,69 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | define('LINE_WIDTH', 75); | ||
13 | |||
14 | define('LINE', str_repeat('-', LINE_WIDTH) . "\n"); | ||
15 | |||
16 | function bailout($message) | ||
17 | { | ||
18 | echo wordwrap($message, LINE_WIDTH) . " Aborting.\n"; | ||
19 | |||
20 | exit(1); | ||
21 | } | ||
22 | |||
23 | function strip_minor_versions($version) | ||
24 | { | ||
25 | preg_match('/^(?P<version>[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches); | ||
26 | |||
27 | return $matches['version']; | ||
28 | } | ||
29 | |||
30 | function centered($text) | ||
31 | { | ||
32 | $padding = (int) ((LINE_WIDTH - strlen($text))/2); | ||
33 | |||
34 | return str_repeat(' ', $padding) . $text; | ||
35 | } | ||
36 | |||
37 | function cd($dir) | ||
38 | { | ||
39 | if (false === chdir($dir)) { | ||
40 | bailout("Could not switch to directory $dir."); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | function run($command) | ||
45 | { | ||
46 | exec($command, $output, $status); | ||
47 | |||
48 | if (0 !== $status) { | ||
49 | $output = implode("\n", $output); | ||
50 | echo "Error while running:\n " . getcwd() . '$ ' . $command . "\nOutput:\n" . LINE . "$output\n" . LINE; | ||
51 | |||
52 | bailout("\"$command\" failed."); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | function get_icu_version_from_genrb($genrb) | ||
57 | { | ||
58 | exec($genrb . ' --version 2>&1', $output, $status); | ||
59 | |||
60 | if (0 !== $status) { | ||
61 | bailout($genrb . ' failed.'); | ||
62 | } | ||
63 | |||
64 | if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) { | ||
65 | return null; | ||
66 | } | ||
67 | |||
68 | return $matches[1]; | ||
69 | } | ||