You are here

function _mobile_detect_full_debug in Mobile Detect 7

Content generator for hook_block_view('mobile_detect_full_debug')

1 call to _mobile_detect_full_debug()
mobile_detect_block_view in ./mobile_detect.module
Implements function hook_block_view().

File

./mobile_detect.module, line 221
Lightweight mobile detection based on the Mobile_Detect.php library.

Code

function _mobile_detect_full_debug() {
  $true = t('true');
  $false = t('false');
  $detect = mobile_detect_get_object();
  $output = array();
  $output[] = '<dl>';
  $output[] = '<dt>' . t('isMobile') . '</dt>';
  $output[] = '<dd>' . (mobile_detect_check_type('isMobile') ? $true : $false) . '</dd>';
  $output[] = '<dt>' . t('isTablet') . '</dt>';
  $output[] = '<dd>' . (mobile_detect_check_type('isTablet') ? $true : $false) . '</dd>';
  $output[] = '<dt>' . t('isHandheld') . '</dt>';
  $output[] = '<dd>' . (mobile_detect_check_type('isHandheld') ? $true : $false) . '</dd>';
  foreach ($detect
    ->getRules() as $name => $unused) {
    $predicate = 'is' . $name;
    $output[] = '<dt>' . t('is@name', array(
      '@name' => $name,
    )) . '</dt>';
    $output[] = '<dd>' . (mobile_detect_check_type($predicate) ? $true : $false) . '</dd>';
  }
  $output[] = '<dt>' . t('Request Time') . '</dt>';
  $output[] = '<dd>' . REQUEST_TIME . '</dd>';
  $output[] = '</dl>';
  return join('', $output);
}