fp_screen_is_mobile

4.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.

17 calls to fp_screen_is_mobile()
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_display_blank_degree in modules/blank_degrees/blank_degrees.module
blank_degrees_select_degree_form in modules/blank_degrees/blank_degrees.module
This form lets the user select which degree they wish to view.
blocks_render_block in modules/blocks/blocks.module
Implementation of hook_render_block. We are going to render out our content_block content type.

... See full list

File

includes/misc.inc, line 1041
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)",
  );

  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;

}