You are here

function purl_parse in Persistent URL 6

Same name and namespace in other branches
  1. 7 purl.module \purl_parse()

Parses a query string of various types (url, domain, etc.) and returns an array of any found values and their respective providers/id values.

Parameters

$processor: Object that implements purl_processor

$q: The value being parsed.

Return value

The contents of the cache.

1 call to purl_parse()
purl_get_normal_path in ./purl.module
Process a query string into its respective processors and modifiers and return the adjusted query string. If true, the $activate argument is used to call provider callbacks for a given query string. All values are static cached for a given query…

File

./purl.module, line 268

Code

function purl_parse($processor, $q) {
  static $cache;
  if (!isset($cache)) {
    $cache = new purl_cache();
  }
  if ($cache
    ->get($processor
    ->method(), $q) === false) {
    $valid_values = purl_modifiers($processor
      ->method());
    $item = $processor
      ->parse($valid_values, $q);
    $cache
      ->add($processor
      ->method(), array(
      $q => $item,
    ));
  }
  return $cache
    ->get($processor
    ->method(), $q);
}