NOISSUE PHP 버전 호환성 개선

This commit is contained in:
khongchi 2013-12-19 20:58:09 +09:00
parent e49c7265ff
commit c5c69bba4e

View file

@ -49,10 +49,10 @@ class mcontent extends WidgetHandler
}
else
{
$obj = new stdClass();
// Apply to all modules in the site if a target module is not specified
if(!$args->module_srls)
{
$obj = new stdClass();
$obj->site_srl = (int)$site_module_info->site_srl;
$output = executeQueryArray('widgets.content.getMids', $obj);
if($output->data)
@ -170,6 +170,7 @@ class mcontent extends WidgetHandler
function _getCommentItems($args)
{
// CommentModel:: getCommentList() to take advantage of the variable order
$obj = new stdClass();
$obj->module_srl = $args->module_srl;
$obj->sort_index = $args->order_target;
$obj->list_count = $args->list_count;
@ -270,6 +271,7 @@ class mcontent extends WidgetHandler
{
$oDocumentModel = &getModel('document');
$obj = new stdClass();
$obj->module_srls = $obj->module_srl = $args->module_srl;
$obj->direct_download = 'Y';
$obj->isvalid = 'Y';
@ -420,6 +422,7 @@ class mcontent extends WidgetHandler
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
$rss = new stdClass();
if($xml_doc->rss)
{
$rss->title = $xml_doc->rss->channel->title->body;
@ -436,6 +439,7 @@ class mcontent extends WidgetHandler
{
if($key >= $args->list_count) break;
unset($item);
$item = new stdClass();
foreach($value as $key2 => $value2)
{
@ -474,6 +478,7 @@ class mcontent extends WidgetHandler
{
if($key >= $args->list_count) break;
unset($item);
$item = new stdClass();
foreach($value as $key2 => $value2)
{
@ -495,84 +500,85 @@ class mcontent extends WidgetHandler
$content_items[] = $content_item;
}
}
else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') {
// Atom 1.0 spec supported by misol
$rss->title = $xml_doc->feed->title->body;
$links = $xml_doc->feed->link;
if(is_array($links))
{
foreach ($links as $value)
else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom')
{
if($value->attrs->rel == 'alternate')
{
$rss->link = $value->attrs->href;
break;
}
}
}
else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
$items = $xml_doc->feed->entry;
if(!$items) return;
if($items && !is_array($items)) $items = array($items);
$content_items = array();
foreach ($items as $key => $value)
{
if($key >= $args->list_count) break;
unset($item);
foreach($value as $key2 => $value2)
{
if(is_array($value2)) $value2 = array_shift($value2);
$item->{$key2} = $this->_getRssBody($value2);
}
$content_item = new mcontentItem($rss->title);
$links = $value->link;
// Atom 1.0 spec supported by misol
$rss->title = $xml_doc->feed->title->body;
$links = $xml_doc->feed->link;
if(is_array($links))
{
foreach ($links as $val)
foreach ($links as $value)
{
if($val->attrs->rel == 'alternate')
if($value->attrs->rel == 'alternate')
{
$item->link = $val->attrs->href;
$rss->link = $value->attrs->href;
break;
}
}
}
else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
$content_item->setContentsLink($rss->link);
if($item->title)
else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
$items = $xml_doc->feed->entry;
if(!$items) return;
if($items && !is_array($items)) $items = array($items);
$content_items = array();
foreach ($items as $key => $value)
{
if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
if($key >= $args->list_count) break;
unset($item);
foreach($value as $key2 => $value2)
{
if(is_array($value2)) $value2 = array_shift($value2);
$item->{$key2} = $this->_getRssBody($value2);
}
$content_item = new mcontentItem($rss->title);
$links = $value->link;
if(is_array($links))
{
foreach ($links as $val)
{
if($val->attrs->rel == 'alternate')
{
$item->link = $val->attrs->href;
break;
}
}
}
else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
$content_item->setContentsLink($rss->link);
if($item->title)
{
if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
}
$content_item->setTitle($item->title);
$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
$content_item->setAuthorSite($value->author->uri->body);
//$content_item->setCategory($item->category);
$item->description = ($item->content) ? $item->content : $item->description = $item->summary;
$item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description);
if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
{
$item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
}
$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
$content_item->setLink($item->link);
$date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'})));
$content_item->setRegdate($date);
$content_items[] = $content_item;
}
$content_item->setTitle($item->title);
$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
$content_item->setAuthorSite($value->author->uri->body);
//$content_item->setCategory($item->category);
$item->description = ($item->content) ? $item->content : $item->description = $item->summary;
$item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description);
if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
{
$item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
}
$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
$content_item->setLink($item->link);
$date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'})));
$content_item->setRegdate($date);
$content_items[] = $content_item;
}
}
return $content_items;
return $content_items;
}
function _getTrackbackItems($args){