You are here

function ARC_sparql_parser::get_url_base in Taxonomy import/export via XML 5.2

Same name and namespace in other branches
  1. 5 arc/ARC_sparql_parser.php \ARC_sparql_parser::get_url_base()
  2. 6.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::get_url_base()
  3. 6 arc/ARC_sparql_parser.php \ARC_sparql_parser::get_url_base()
2 calls to ARC_sparql_parser::get_url_base()
ARC_sparql_parser::calc_iri in arc/ARC_sparql_parser.php
ARC_sparql_parser::set_base in arc/ARC_sparql_parser.php

File

arc/ARC_sparql_parser.php, line 139

Class

ARC_sparql_parser

Code

function get_url_base($url = "") {
  $base = $url;

  /* remove fragment */
  if (preg_match("/([^#]*)[#]?/", $url, $matches)) {

    /* should always match, remove fragment */
    $base = $matches[1];
  }

  /* no path, no query, no trailing slash, e.g. http://www.example.com  -> add slash */
  if (preg_match("/\\/\\/[^\\/]+\$/", $base, $matches)) {

    /* //+no more slashes */
    $base .= "/";
  }
  return $base;
}