]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - misc/strings.php
Fix header referencing to overview from other directories
[irc/unrealircd/unrealircd-webpanel.git] / misc / strings.php
CommitLineData
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 */
12function split($str, $delimiter = " ") : Array
13{
14 return explode($delimiter,$str);
15}
16
17function 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
29function 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}