mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7575 201d5d3c-b55e-5fd7-737f-ddc643e51545
55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
class Mobile {
|
|
var $ismobile = null;
|
|
|
|
function &getInstance() {
|
|
static $theInstance;
|
|
if(!isset($theInstance)) $theInstance = new Mobile();
|
|
return $theInstance;
|
|
}
|
|
|
|
function isFromMobilePhone() {
|
|
$oMobile =& Mobile::getInstance();
|
|
return $oMobile->_isFromMobilePhone();
|
|
}
|
|
|
|
function _isFromMobilePhone() {
|
|
if(isset($this->ismobile)) return $this->ismobile;
|
|
$db_info = Context::getDBInfo();
|
|
if($db_info->use_mobile_view != "Y" || Context::get('full_browse') || $_COOKIE["FullBrowse"])
|
|
{
|
|
$this->ismobile = false;
|
|
}
|
|
else
|
|
{
|
|
$m = Context::get('m');
|
|
if($m == "1") {
|
|
setcookie("mobile", true);
|
|
$this->ismobile = true;
|
|
}
|
|
else if($m === "0") {
|
|
setcookie("mobile", "");
|
|
$this->ismobile = false;
|
|
}
|
|
else if($_COOKIE["mobile"]) $this->ismobile = true;
|
|
else {
|
|
if(preg_match('/(iPod|iPhone|Android|BlackBerry|SCH\-M[0-9]+)/',$_SERVER['HTTP_USER_AGENT']))
|
|
{
|
|
setcookie("mobile", true);
|
|
$this->ismobile = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return $this->ismobile;
|
|
}
|
|
|
|
function setMobile($ismobile)
|
|
{
|
|
$oMobile =& Mobile::getInstance();
|
|
$oMobile->ismobile = $ismobile;
|
|
}
|
|
}
|
|
|
|
?>
|