class purl_domain in Persistent URL 7
Same name and namespace in other branches
- 6 includes/purl_domain.inc \purl_domain
Full domain handling.
Hierarchy
- class \purl_domain implements purl_processor
Expanded class hierarchy of purl_domain
1 string reference to 'purl_domain'
- purl_purl_processor in ./
purl.module - Implements hook_purl_processor().
File
- includes/
purl_domain.inc, line 6
View source
class purl_domain implements purl_processor {
public function admin_form(&$form, $id) {
global $base_url;
$form['purl_location'] = array(
'#type' => 'fieldset',
);
$form['purl_location']['purl_base_domain'] = array(
'#type' => 'textfield',
'#title' => t('Default domain'),
'#description' => t('Enter the default domain if you are using domain modifiers.'),
'#required' => FALSE,
'#default_value' => variable_get('purl_base_domain', $base_url),
'#element_validate' => array(
'purl_validate_fqdn',
),
);
}
function detect($q) {
return str_replace('http://', '', $_SERVER['HTTP_HOST']);
}
public function method() {
return 'domain';
}
public function description() {
return t('Enter a domain registered for this context, such as "www.example.com". Do not include http://');
}
/**
* Simply match our 'q' (aka domain) against an allowed value.
*/
public function parse($valid_values, $q) {
$parsed = array();
if (isset($valid_values[$q])) {
$parsed[$q] = $valid_values[$q];
}
return purl_path_elements($this, $parsed);
}
public function adjust(&$value, $item, &$q) {
return;
}
public function rewrite(&$path, &$options, $element) {
$options['absolute'] = TRUE;
if ($base_url = $this
->base_url()) {
if (!_purl_skip($element, $options)) {
$base = parse_url($base_url);
$base_path = !empty($base['path']) ? $base['path'] : "";
$options['base_url'] = "{$base['scheme']}://{$element->value}{$base_path}";
}
else {
$options['base_url'] = $base_url;
}
}
}
protected function base_url() {
global $base_url;
$base = variable_get('purl_base_domain', $base_url);
return !empty($base) ? $base : $base_url;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
purl_domain:: |
public | function |
Used to provide compatibility with the path alias system. Overrides purl_processor:: |
|
purl_domain:: |
public | function |
Allow extension of the admin setup form. Overrides purl_processor:: |
|
purl_domain:: |
protected | function | ||
purl_domain:: |
public | function |
Provide a description of processor for the end user Overrides purl_processor:: |
|
purl_domain:: |
function |
Detect the the processor value for the current page request Overrides purl_processor:: |
||
purl_domain:: |
public | function |
Return the method the processor users. Overrides purl_processor:: |
|
purl_domain:: |
public | function |
Simply match our 'q' (aka domain) against an allowed value. Overrides purl_processor:: |
|
purl_domain:: |
public | function |
Responsible for rewriting outgoing links. Note: it's this functions
job to make sure it doesn't alter a link that has already been
treated. Overrides purl_processor:: |