issue 2077 fixed the wrong display in mobile environment when using cache.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11010 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-08-09 05:30:35 +00:00
parent 5ce19ccbcb
commit acbad1b6d9

View file

@ -10,12 +10,12 @@ class pageMobile extends pageView {
switch($this->module_info->page_type)
{
case 'WIDGET' : {
$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$this->interval = (int)($this->module_info->page_caching_interval);
break;
}
case 'OUTSIDE' : {
$this->cache_file = sprintf("./files/cache/opage/%d.cache.php", $this->module_info->module_srl);
$this->cache_file = sprintf("./files/cache/opage/%d.m.cache.php", $this->module_info->module_srl);
$this->interval = (int)($this->module_info->page_caching_interval);
$this->path = $this->module_info->mpath;
break;
@ -37,26 +37,43 @@ class pageMobile extends pageView {
$this->setTemplateFile('mobile');
}
function _getWidgetContent(){
function _getWidgetContent()
{
// Arrange a widget ryeolro
if($this->module_info->mcontent)
{
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int)($this->module_info->page_caching_interval);
if($interval>0) {
if(!file_exists($cache_file)) $mtime = 0;
else $mtime = filemtime($cache_file);
if($interval>0)
{
if(!file_exists($cache_file) || filesize($cache_file) < 1)
{
$mtime = 0;
}
else
{
$mtime = filemtime($cache_file);
}
if($mtime + $interval*60 > time()) {
if($mtime + $interval*60 > time())
{
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
} else {
}
else
{
$oWidgetController = &getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
}
else
{
if(file_exists($cache_file))
{
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
}
@ -64,7 +81,8 @@ class pageMobile extends pageView {
{
preg_match_all('!(<img)([^\>]*)(widget=)([^\>]*?)(\>)!is', $this->module_info->content, $matches);
$page_content = '';
for($i=0,$c=count($matches[0]);$i<$c;$i++) {
for($i=0,$c=count($matches[0]);$i<$c;$i++)
{
$page_content .= preg_replace('/ style\=\"([^\"]+)\" /i',' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ',$matches[0][$i])."\n\n";
}
}