아래 Mobile.class.php 에서 뭘 어떻게 바꿔야 되는건가요?
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/**
* Mobile class
*
* @author NAVER ([email protected])
*/
class Mobile
{
/**
* Whether mobile or not mobile mode
* @var bool
*/
var $ismobile = NULL;
/**
* Get instance of Mobile class(for singleton)
*
* @return Mobile
*/
function &getInstance()
{
static $theInstance;
if(!isset($theInstance))
{
$theInstance = new Mobile();
}
return $theInstance;
}
/**
* Get current mobile mode
*
* @return bool If mobile mode returns true or false
*/
function isFromMobilePhone()
{
$oMobile = & Mobile::getInstance();
return $oMobile->_isFromMobilePhone();
}
/**
* Get current mobile mode
*
* @return bool
*/
function _isFromMobilePhone()
{
if($this->ismobile !== NULL)
{
return $this->ismobile;
}
if(Mobile::isMobileEnabled() === || Context::get('full_browse') || $_COOKIE["FullBrowse"])
{
return ($this->ismobile = false);
}
$xe_web_path = Context::pathToUrl(_XE_PATH_);
// default setting. if there is cookie for a device, XE do not have to check if it is mobile or not and it will enhance performace of the server.
$this->ismobile = FALSE;
$m = Context::get('m');
if(strlen($m) == 1)
{
if($m == "1")
{
$this->ismobile = TRUE;
}
elseif($m == "0")
{
$this->ismobile = FALSE;
}
}
elseif(isset($_COOKIE['mobile']))
{
if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
{
if($_COOKIE['mobile'] == 'true')
{
$this->ismobile = TRUE;
}
else
{
$this->ismobile = FALSE;
}
}
else
{
$this->ismobile = FALSE;
setcookie("mobile", FALSE);
setcookie("user-agent", FALSE);
if(!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent())
{
$this->ismobile = TRUE;
}
}
}
else
{
if($this->isMobilePadCheckByAgent())
{
$this->ismobile = FALSE;
}
else
{
if($this->isMobileCheckByAgent())
{
$this->ismobile = TRUE;
}
}
}
if($this->ismobile !== NULL)
{
if($this->ismobile == TRUE)
{
if($_COOKIE['mobile'] != 'true')
{
$_COOKIE['mobile'] = 'true';
setcookie("mobile", 'true');
}
}
elseif($_COOKIE['mobile'] != 'false')
{
$_COOKIE['mobile'] = 'false';
setcookie("mobile", 'false');
}
if($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
{
setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']));
}
}
return $this->ismobile;
}
/**
* Detect mobile device by user agent
*
* @return bool Returns true on mobile device or false.
*/
function isMobileCheckByAgent()
{
static $UACheck;
if(isset($UACheck))
{
return $UACheck;
}
$oMobile = Mobile::getInstance();
$mobileAgent = array('Android','Mobile');
if($oMobile->isMobilePadCheckByAgent())
{
$UACheck = TRUE;
return TRUE;
}
foreach($mobileAgent as $agent)
{
if(stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
{
$UACheck = TRUE;
return TRUE;
}
}
$UACheck = FALSE;
return FALSE;
}
/**
* Check if user-agent is a tablet PC as iPad or Andoid tablet.
*
* @return bool TRUE for tablet, and FALSE for else.
*/
function isMobilePadCheckByAgent()
{
static $UACheck;
if(isset($UACheck))
{
return $UACheck;
}
$padAgent = array('Android');
// Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device.
// $exceptionAgent[0] contains exception agents for all exceptions.
$exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile');
foreach($padAgent as $agent)
{
if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE)
{
if(!isset($exceptionAgent[$agent]))
{
$UACheck = TRUE;
return TRUE;
}
elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE)
{
// If the agent is the Android, that can be either tablet and mobile phone.
foreach($exceptionAgent[0] as $val)
{
if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE)
{
$UACheck = FALSE;
return FALSE;
}
}
$UACheck = TRUE;
return TRUE;
}
}
}
$UACheck = FALSE;
return FALSE;
}
/**
* Set mobile mode
*
* @param bool $ismobile
* @return void
*/
function setMobile($ismobile)
{
$oMobile = Mobile::getInstance();
$oMobile->ismobile = $ismobile;
}
function isMobileEnabled()
{
$db_info = Context::getDBInfo();
return ($db_info->use_mobile_view === 'Y');
}
}
?>
원하는 것이 뭔지 제대로 설명하시지도 않고 코어 소스를 통째로 복붙하시면 대체 어쩌라는 건지...
사이트 일반 설정 및 각 페이지/게시판의 설정 화면에서 "모바일 뷰 사용" 옵션이 켜져 있나요? 모바일 앱이라고 하셨는데, 특정 앱에서만 PC 화면이 나오는 건가요? 무슨 앱인가요? 기기 모델과 OS 버전은? 대답하는 사람이 저 위의 소스를 정말로 읽어보고 뭔가 쓸만한 대답을 내놓으려면 시간이 몇 분쯤 걸릴까요? 공짜로 답을 얻고 싶으시면 님도 그만한 정성을 들여서 질문을 쓰셔야지요.
우선 뭔가 설정이 잘못된 것이 있나 살피고, 관련된 설정을 모두 확인한 후에도 여전히 마음에 안 드는 동작이 있으면 그 때 소스를 뜯어보는 것이 XE 방식입니다. ○○보드처럼 일단 소스부터 조지고 보는 방식은 노노예요. XE는 소스보다 사용자 설정이 우선입니다.