class purl_extension in Persistent URL 6
Same name and namespace in other branches
- 7 includes/purl_extension.inc \purl_extension
File extension style. Like ".csv"
Hierarchy
- class \purl_extension implements purl_processor
Expanded class hierarchy of purl_extension
1 string reference to 'purl_extension'
- purl_purl_processor in ./
purl.module - Implementation of hook_purl_processor().
File
- includes/
purl_extension.inc, line 6
View source
class purl_extension implements purl_processor {
public function admin_form(&$form, $id) {
}
public function detect($q) {
$last = explode('.', array_pop(explode('/', $q)));
if (count($last) > 1) {
return array_pop($last);
}
return '';
}
public function method() {
return 'extension';
}
public function description() {
return t('Enter a extension for this context, such as "csv".');
}
public function parse($valid_values, $q) {
$parsed = array();
if (isset($valid_values[$q])) {
$parsed[$q] = $valid_values[$q];
}
return purl_path_elements($this, $parsed);
}
/**
* 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.
*/
public function adjust(&$value, $item, &$q) {
$q = $this
->remove($q, $item);
$value = $this
->remove($value, $item);
}
/**
* Remove our extension from the tail end of the path.
*
* @param $q
* The current path.
* @param $element
* a purl_path_element object
* @return path string with the extension removed.
*/
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;
}
/**
* Because of the expected usage of the files extensions we don't provide
* a rewrite.
*/
public function rewrite(&$path, &$options, $element) {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
purl_extension:: |
public | function |
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. Overrides purl_processor:: |
|
purl_extension:: |
public | function |
Allow extension of the admin setup form. Overrides purl_processor:: |
|
purl_extension:: |
public | function |
Provide a description of processor for the end user Overrides purl_processor:: |
|
purl_extension:: |
public | function |
Detect the the processor value for the current page request Overrides purl_processor:: |
|
purl_extension:: |
public | function |
Return the method the processor users. Overrides purl_processor:: |
|
purl_extension:: |
public | function |
Detects processor in the passed 'value'. Overrides purl_processor:: |
|
purl_extension:: |
public | function | Remove our extension from the tail end of the path. | |
purl_extension:: |
public | function |
Because of the expected usage of the files extensions we don't provide
a rewrite. Overrides purl_processor:: |