Patch attached.

Comments

pillarsdotnet’s picture

Note that a working D7 port of browscap is available here.

pillarsdotnet’s picture

StatusFileSize
new862 bytes

Improved module description.

--- mobile_theme.info
+++ mobile_theme.info
@@ -1,6 +1,7 @@
 ; $Id$
 name = Mobile Theme
-description = Choose a mobile theme to use when the user is vising on a mobile device.
+description = Select an alternate theme for mobile device browsers.
 core = 7.x
 php = 5
+dependencies[] = browscap
 files[] = mobile_theme.module
diff --git mobile_theme.module mobile_theme.module
index b2cb9d6..e575c6a 100644
--- mobile_theme.module
+++ mobile_theme.module
@@ -6,7 +6,7 @@
  */
 function mobile_theme_custom_theme() {
   // @TODO: Provide Browscap support.
-  $browser = get_browser(NULL, TRUE);
+  $browser = browscap_get_browser(NULL);
   if (isset($browser['ismobiledevice'])) {
     if ($browser['ismobiledevice']) {
       $theme = variable_get('mobile_theme_selection', 'default');
robloach’s picture

Status: Needs review » Postponed

Thanks a lot! Will keep this out of CVS however until Browscap is in the CVS :-) . Don't want to confuse peoples.

robloach’s picture

Could even do something like this.....

--- mobile_theme.info
+++ mobile_theme.info
@@ -1,6 +1,7 @@
 ; $Id$
 name = Mobile Theme
-description = Choose a mobile theme to use when the user is vising on a mobile device.
+description = Select an alternate theme for mobile device browsers. Installing the Browscap module will increase accuracy.
 core = 7.x
 php = 5
 files[] = mobile_theme.module
diff --git mobile_theme.module mobile_theme.module
index b2cb9d6..e575c6a 100644
--- mobile_theme.module
+++ mobile_theme.module
@@ -6,7 +6,7 @@
  */
 function mobile_theme_custom_theme() {
-  // @TODO: Provide Browscap support.
-  $browser = get_browser(NULL, TRUE);
+  $browser = module_exists('browscap') ? browscap_get_browser(NULL) : get_browser(NULL, TRUE);
   if (isset($browser['ismobiledevice'])) {
     if ($browser['ismobiledevice']) {
robloach’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.