You are here

public function purl_extension::remove in Persistent URL 7

Same name and namespace in other branches
  1. 6 includes/purl_extension.inc \purl_extension::remove()

Remove our extension from the tail end of the path.

Parameters

$q: The current path.

$element: a purl_path_element object

Return value

path string with the extension removed.

1 call to purl_extension::remove()
purl_extension::adjust in includes/purl_extension.inc
Rewrite the query string. Note that this is being passed through the custom_url_rewrite_inbound() stack and may *not* directly affect $_GET['q']. See purl_init() for how $_GET['q'] is affected by processors.

File

includes/purl_extension.inc, line 54

Class

purl_extension
File extension style. Like ".csv"

Code

public function remove($q, $element) {
  $args = explode('.', $q);
  if (count($args > 1)) {
    $extension = array_pop($args);
    if ($element->value == $extension) {
      return implode('.', $args);
    }
  }
  return $q;
}