function fp_screen_is_mobile

7.x misc.inc fp_screen_is_mobile()
6.x misc.inc fp_screen_is_mobile()
4.x misc.inc fp_screen_is_mobile()
5.x misc.inc fp_screen_is_mobile()

This function will attempt to determine automatically if we are on a mobile device, and should therefor use the mobile theme and layout settings.

1 call to fp_screen_is_mobile()

File

includes/misc.inc, line 2370
This file contains misc functions for FlightPath

Code

function fp_screen_is_mobile() {

  depricated_message("calling fp_screen_is_mobile is no longer used as of FP 6.x");

  if (isset($GLOBALS ["fp_page_is_mobile"])) {
    return $GLOBALS ["fp_page_is_mobile"];
  }

  $user_agent = $_SERVER ['HTTP_USER_AGENT'];

  $look_for = array(
    "ipod",
    "iphone",
    "android",
    "opera mini",
    "blackberry",
    "(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)",
    "(iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)",
    "(smartphone|iemobile)",
  );

  $is_mobile = FALSE;

  foreach ($look_for as $test_agent) {
    if (preg_match('/' . $test_agent . '/i', $user_agent)) {
      $is_mobile = TRUE;
      break;
    }
  }


  $GLOBALS ["fp_page_is_mobile"] = $is_mobile;
  return $is_mobile;

}