purl_useragent.inc in Persistent URL 7
File
includes/purl_useragent.inc
View source
<?php
class purl_useragent implements purl_processor {
public function method() {
return 'useragent';
}
public function admin_form(&$form, $id) {
}
public function description() {
return t('Enter a user agent for this context, such as "iPhone".');
}
public function detect($q) {
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (!empty($useragent)) {
return $useragent;
}
return '';
}
public function parse($valid_values, $useragent) {
foreach ($valid_values as $key => $value) {
if (stripos($useragent, $key) !== FALSE) {
return purl_path_elements($this, $valid_values);
}
}
}
public function adjust(&$value, $element, &$q) {
}
public function rewrite(&$path, &$options, $element) {
}
}