function fp_screen_is_mobile

7.x misc.inc fp_screen_is_mobile()
6.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.

27 calls to fp_screen_is_mobile()
advise.history.inc in modules/advise/advise.history.inc
advise.module in modules/advise/advise.module
advise_display_view in modules/advise/advise.module
This is the page which actually displays the "view" for the user to see their advising session, or for an advisor to advise them.
advise_popup_display_summary in modules/advise/advise.history.inc
Displays the printable advising summary.
blank_degrees.module in modules/blank_degrees/blank_degrees.module

... See full list

File

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

Code

function fp_screen_is_mobile() {

  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;

}