You are here

function ClassifiedBasicTest::relativizeHref in Classified Ads 6.3

Convert a host-relative path like /drupal/taxonomy to a drupal path.

Parameters

string $href: Some path like "/drupal/taxonomy" or "/taxonomy"

Return value

string The internal still aliased path like "taxonomy", or "/" if path does not belong in the current site.

See also

test1265524()

File

tests/classified_basic.test, line 291
Basic test for known bugs in previous versions.

Class

ClassifiedBasicTest

Code

function relativizeHref($href) {
  $base = base_path();
  if (strpos($href, $base) === 0) {
    $ret = drupal_substr($href, drupal_strlen($base));
  }
  else {
    $ret = '/';
  }
  return $ret;
}