You are here

function getlocations_is_mobile in Get Locations 7

Same name and namespace in other branches
  1. 7.2 getlocations.module \getlocations_is_mobile()

Function

Parameters

bool $override:

Return value

Returns TRUE if user agent says its a mobile device

8 calls to getlocations_is_mobile()
getlocations_defaults in ./getlocations.module
Some defaults.
getlocations_js_settings_do in ./getlocations.module
Function sets up javascript settings
getlocations_setup_js in ./getlocations.module
Function to setup the map scripts
theme_getlocations_fields_field_widget_form in modules/getlocations_fields/getlocations_fields.module
The input form
theme_getlocations_gps_button in modules/getlocations_gps/getlocations_gps.module

... See full list

File

./getlocations.module, line 6520
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_is_mobile($override = FALSE) {
  if ($override) {
    return TRUE;
  }
  $getlocations_ua = getlocations_ua_get();
  $str = "/" . $getlocations_ua['ua_string'] . "/i";
  $is_mobile = FALSE;
  $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
  if ($ua && preg_match($str, $ua)) {
    $is_mobile = TRUE;
  }
  return $is_mobile;
}