]>
Commit | Line | Data |
---|---|---|
fe2a6f27 VP |
1 | <?php |
2 | ||
3 | /** Splits up a string by a space | |
4 | * (chr 32) | |
5 | * | |
6 | * Syntax: | |
7 | * split($string) | |
8 | * | |
9 | * Returns: | |
10 | * array $tokens | |
11 | */ | |
12 | function split($str, $delimiter = " ") : Array | |
13 | { | |
14 | return explode($delimiter,$str); | |
15 | } | |
16 | ||
17 | function glue($array, $delimiter = " ") | |
18 | { | |
19 | $string = ""; | |
20 | foreach($array as $str) | |
21 | { | |
22 | if (!$str) | |
23 | continue; | |
24 | $string .= $str.$delimiter; | |
25 | } | |
26 | return trim($string,$delimiter); | |
27 | } | |
28 | ||
29 | function get_relative_path($filename) | |
30 | { | |
31 | $relativepath = split($filename, "/"); | |
32 | foreach($relativepath as &$tok) | |
33 | { | |
34 | $isFinal = ($tok == "html") ? 1 : 0; | |
35 | $tok = NULL; | |
36 | if ($isFinal) | |
37 | break; | |
38 | } | |
39 | $relativepath = glue($relativepath,"/"); | |
40 | return $relativepath; | |
62d4ea03 | 41 | } |