Issue 1774, Mobile class fix. Add Opera Mobile browser for exception. (It does not contain the information whether it is a tablet or not.)

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10592 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
misol 2012-04-22 04:39:43 +00:00
parent e92c448c54
commit 7d9a33b6ce

View file

@ -131,7 +131,8 @@ class Mobile {
$padAgent = array('iPad','Android','webOS','hp-tablet','PlayBook'); $padAgent = array('iPad','Android','webOS','hp-tablet','PlayBook');
// Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device. // Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device.
$exceptionAgent = array(0 =>'Opera Mini','Android' => 'Mobile'); // $exceptionAgent[0] contains exception agents for all exceptions.
$exceptionAgent = array(0 => array('Opera Mini','Opera Mobi'),'Android' => 'Mobile');
foreach($padAgent as $agent) foreach($padAgent as $agent)
{ {
@ -144,12 +145,17 @@ class Mobile {
} }
elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
{ {
// Agent is the Android Opera Mini, it does not have 'Mobile' string. // If the agent is the Android, that can be either tablet and mobile phone.
if(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[0]) === FALSE) foreach($exceptionAgent[0] as $val)
{ {
$UACheck = TRUE; if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE)
return TRUE; {
$UACheck = FALSE;
return FALSE;
}
} }
$UACheck = TRUE;
return TRUE;
} }
} }
} }