@@ -183,7 +183,7 @@ static public function isIPhoneGroup($aua = null)
183183
184184 // iPod touch
185185 // Mozilla/5.0 (iPod; U; CPU like Mac OS X; ja-jp) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A110a Safari/419.3
186- if (preg_match ('/iP(?:hone|[ao]d)/ ' , $ ua ) || self ::isAndroidWebKit ($ ua )) {
186+ if (preg_match ('/iP(?:hone|[ao]d)/ ' , $ ua ) || self ::isAndroid ($ ua )) {
187187 $ isiPhoneGroup = true ;
188188 }
189189
@@ -457,6 +457,34 @@ static public function isNintendoDS($ua = null)
457457 return false ;
458458 }
459459
460+ // }}}
461+ // {{{ isAndroid()
462+
463+ /**
464+ * UAがAndroidならtrueを返す。
465+ *
466+ * @param string $ua UAを指定するなら
467+ * @return boolean
468+ */
469+ static public function isAndroid ($ ua = null )
470+ {
471+ if (is_null ($ ua ) and isset ($ _SERVER ['HTTP_USER_AGENT ' ])) {
472+ $ ua = $ _SERVER ['HTTP_USER_AGENT ' ];
473+ }
474+ if (!$ ua ) {
475+ return false ;
476+ }
477+ // シミュレータ
478+ // Mozilla/5.0 (Linux; U; Android 1.0; en-us; generic) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2
479+ // T-mobile G1
480+ // Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2
481+ // genericとdreamが異なる
482+ if (false !== strpos ($ ua , 'Android ' )) {
483+ return true ;
484+ }
485+ return false ;
486+ }
487+
460488 // }}}
461489 // {{{ isAndroidWebKit()
462490
@@ -485,6 +513,29 @@ static public function isAndroidWebKit($ua = null)
485513 return false ;
486514 }
487515
516+ // }}}
517+ // {{{ isAndroidWebKit()
518+
519+ /**
520+ * UAがAndroid(でFirefox)ならtrueを返す。
521+ *
522+ * @param string $ua UAを指定するなら
523+ * @return boolean
524+ */
525+ static public function isAndroidFirefox ($ ua = null )
526+ {
527+ if (is_null ($ ua ) and isset ($ _SERVER ['HTTP_USER_AGENT ' ])) {
528+ $ ua = $ _SERVER ['HTTP_USER_AGENT ' ];
529+ }
530+ if (!$ ua ) {
531+ return false ;
532+ }
533+ if (false !== strpos ($ ua , 'Android ' ) && false !== strpos ($ ua , 'Firefox ' )) {
534+ return true ;
535+ }
536+ return false ;
537+ }
538+
488539 // }}}
489540 // {{{ isSafariGroup()
490541
0 commit comments