You are here

function browscap_useragent_properties in Browscap 5

Same name and namespace in other branches
  1. 6 browscap.user_agent.inc \browscap_useragent_properties()
  2. 7 browscap.user_agent.inc \browscap_useragent_properties()

Page callback to show details about known useragents.

Parameters

string $useragent a useragent, taken from the url.:

Return value

string an HTMl blob representing the data about this useragent.

1 string reference to 'browscap_useragent_properties'
browscap_menu in ./browscap.module
Implementation of hook_menu().

File

./browscap.module, line 374
Replacement for PHP's get_browser() function

Code

function browscap_useragent_properties($useragent = NULL) {
  drupal_set_title(check_plain(arg(4)));
  if ($useragent == NULL) {
    drupal_not_found();
    return;
  }
  $row = db_fetch_object(db_query('SELECT * FROM {browscap} WHERE useragent = "%s"', $useragent));
  if (!$row) {
    drupal_not_found();
    return;
  }
  $data = unserialize($row->data);
  $headers = array(
    t('property'),
    t('value'),
  );
  foreach ($data as $key => $val) {
    $rows[] = array(
      check_plain($key),
      check_plain($val),
    );
  }
  $output = theme('table', $headers, $rows);
  return $output;
}