function ARC_sparql_parser::calc_iri in Taxonomy import/export via XML 5
Same name and namespace in other branches
- 5.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::calc_iri()
- 6.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::calc_iri()
- 6 arc/ARC_sparql_parser.php \ARC_sparql_parser::calc_iri()
3 calls to ARC_sparql_parser::calc_iri()
File
- arc/
ARC_sparql_parser.php, line 152
Class
Code
function calc_iri($path = "") {
$result = "";
/* abs uri */
if (strpos($path, ":") !== false) {
if (strpos($path, "/") === false || strpos($path, "/") > strpos($path, ":")) {
/* no slash after colon */
return $path;
}
}
if (strpos($path, "//") === 0) {
/* net path */
return "http:" . $path;
}
/* rel uri */
$cur_base = $this
->get_url_base($this->base);
if (strpos($path, "#") === 0) {
return $cur_base . $path;
}
if (strpos($path, "/") === 0) {
/* leading slash */
if (preg_match("/([^\\/]*[\\/]{1,2}[^\\/]+)\\//", $cur_base, $matches)) {
return $matches[1] . $path;
}
}
if ($path == "") {
return $cur_base;
}
/* rel path (../ or path) */
$cur_base = substr($cur_base, 0, strrpos($cur_base, "/")) . "/";
/* remove stuff after last slash */
if (strpos($path, "../") === 0) {
if (preg_match("/([^\\/]*[\\/]{1,2}[^\\/]+\\/)(.*)\\//", $cur_base, $matches)) {
$server_part = $matches[1];
$path_part = $matches[2];
/* empty or with trailing / */
}
else {
$server_part = $cur_base;
$path_part = "";
}
while (strpos($path, "../") === 0) {
$path = substr($path, 3);
$path_part = strlen($path_part) ? substr($path_part, 0, -1) : "";
/* remove / */
if (strpos($path_part, "/")) {
$path_part = substr($path_part, 0, strrpos($path_part, "/")) . "/";
/* remove stuff after (new) last slash */
}
else {
$path_part = "";
}
}
return $server_part . $path_part . $path;
}
else {
return $cur_base . $path;
}
return $path;
}