21 if(!in_array(
$args->order_target, array(
'list_order',
'update_order')))
$args->order_target =
'list_order';
23 if(!in_array(
$args->order_type, array(
'asc',
'desc')))
$args->order_type =
'asc';
28 if(!
$args->subject_cut_size)
$args->subject_cut_size = 0;
30 if(!
$args->content_cut_size)
$args->content_cut_size = 100;
32 $args->option_view_arr = explode(
',',
$args->option_view);
34 if(!
$args->markup_type)
$args->markup_type =
'list';
37 $module_srls =
$args->modules_info =
$args->module_srls_info =
$args->mid_lists = array();
40 if(
$args->content_type ==
'rss')
42 $args->rss_urls = array();
44 for($i=0,$c=count($rss_urls);$i<$c;$i++)
46 if($rss_urls[$i])
$args->rss_urls[] = $rss_urls[$i];
52 $obj =
new stdClass();
54 if(!
$args->module_srls)
56 $obj->site_srl = (int)$site_module_info->site_srl;
60 foreach(
$output->data as $key => $val)
62 $args->modules_info[$val->mid] = $val;
63 $args->module_srls_info[$val->module_srl] = $val;
64 $args->mid_lists[$val->module_srl] = $val->mid;
65 $module_srls[] = $val->module_srl;
78 foreach(
$output->data as $key => $val)
80 $args->modules_info[$val->mid] = $val;
81 $args->module_srls_info[$val->module_srl] = $val;
82 $module_srls[] = $val->module_srl;
84 $idx = explode(
',',
$args->module_srls);
85 for($i=0,$c=count($idx);$i<$c;$i++)
88 if(!
$args->module_srls_info[$srl])
continue;
89 $args->mid_lists[$srl] =
$args->module_srls_info[$srl]->mid;
95 $args->module_srl = implode(
',',$module_srls);
102 if(
$args->tab_type ==
'none' ||
$args->tab_type ==
'')
104 switch(
$args->content_type)
126 $content_items = array();
128 switch(
$args->content_type)
173 $obj =
new stdClass();
178 $oCommentModel =
getModel(
'comment');
179 $output = $oCommentModel->getNewestCommentList(
$obj);
181 $content_items = array();
185 foreach(
$output as $key => $oComment)
187 $attribute = $oComment->getObjectVars();
188 $title = $oComment->getSummary(
$args->content_cut_size);
189 $thumbnail = $oComment->getThumbnail();
190 $url = sprintf(
"%s#comment_%s",
getUrl(
'',
'mid',
$args->mid_lists[$attribute->module_srl],
'document_srl',$oComment->get(
'document_srl')),$oComment->get(
'comment_srl'));
192 $attribute->mid =
$args->mid_lists[$attribute->module_srl];
193 $browser_title =
$args->module_srls_info[$attribute->module_srl]->browser_title;
194 $domain =
$args->module_srls_info[$attribute->module_srl]->domain;
197 $content_item->adds($attribute);
198 $content_item->setTitle($title);
199 $content_item->setThumbnail($thumbnail);
200 $content_item->setLink($url);
201 $content_item->setDomain($domain);
202 $content_item->add(
'mid',
$args->mid_lists[$attribute->module_srl]);
203 $content_items[] = $content_item;
205 return $content_items;
213 $obj =
new stdClass();
218 foreach(
$output->data as $key => $val)
220 $category_lists[$val->module_srl][$val->category_srl] = $val;
226 $obj->order_type =
$args->order_type==
"desc"?
"asc":
"desc";
228 $obj->statusList = array(
'PUBLIC');
232 $content_items = array();
233 $first_thumbnail_idx = -1;
236 foreach(
$output->data as $key => $attribute)
239 $oDocument->setAttribute($attribute,
false);
240 $GLOBALS[
'XE_DOCUMENT_LIST'][$oDocument->document_srl] = $oDocument;
241 $document_srls[] = $oDocument->document_srl;
245 for($i=0,$c=count($document_srls);$i<$c;$i++)
247 $oDocument =
$GLOBALS[
'XE_DOCUMENT_LIST'][$document_srls[$i]];
250 $category_srl = $oDocument->get(
'category_srl');
251 $thumbnail = $oDocument->getThumbnail();
253 $content_item->adds($oDocument->getObjectVars());
254 $content_item->setTitle($oDocument->getTitleText());
255 $content_item->setCategory( $category_lists[
$module_srl][$category_srl]->
title );
257 $content_item->setContent($oDocument->getSummary(
$args->content_cut_size));
259 $content_item->setThumbnail($thumbnail);
261 if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
262 $content_items[] = $content_item;
265 $content_items[0]->setFirstThumbnailIdx($first_thumbnail_idx);
267 return $content_items;
274 $obj =
new stdClass();
276 $obj->direct_download =
'Y';
282 foreach(
$output->data as $key => $val)
284 $category_lists[$val->module_srl][$val->category_srl] = $val;
290 $files_count = count($files_output->data);
291 if(!$files_count)
return;
293 $content_items = array();
295 for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
297 $tmp_document_list =
$oDocumentModel->getDocuments($document_srl_list);
299 if(!count($tmp_document_list))
return;
301 foreach($tmp_document_list as $oDocument)
303 $attribute = $oDocument->getObjectVars();
304 $browser_title =
$args->module_srls_info[$attribute->module_srl]->browser_title;
305 $domain =
$args->module_srls_info[$attribute->module_srl]->domain;
306 $category = $category_lists[$attribute->module_srl]->text;
307 $content = $oDocument->getSummary(
$args->content_cut_size);
308 $url = sprintf(
"%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount());
309 $thumbnail = $oDocument->getThumbnail();
311 $content_item->adds($attribute);
312 $content_item->setCategory($category);
313 $content_item->setContent($content);
314 $content_item->setLink($url);
315 $content_item->setThumbnail($thumbnail);
316 $content_item->setExtraImages($extra_images);
317 $content_item->setDomain($domain);
318 $content_item->add(
'mid',
$args->mid_lists[$attribute->module_srl]);
319 $content_items[] = $content_item;
322 return $content_items;
327 $content_items = array();
328 $args->mid_lists = array();
330 foreach(
$args->rss_urls as $key => $rss)
332 $args->rss_url = $rss;
334 if(count($content_item) > 0)
336 $browser_title = $content_item[0]->getBrowserTitle();
337 $args->mid_lists[] = $browser_title;
338 $content_items[] = $content_item;
342 if(
$args->tab_type ==
'none' ||
$args->tab_type ==
'')
345 foreach($content_items as $key => $val)
347 foreach($val as $k => $v)
349 $date = $v->get(
'regdate');
351 while(array_key_exists(sprintf(
'%s%02d',$date,$i), $items)) $i++;
352 $items[sprintf(
'%s%02d',$date,$i)] = $v;
355 if(
$args->order_type ==
'asc') ksort($items);
357 $content_items = array_slice(array_values($items),0,
$args->list_count);
358 }
return $content_items;
363 if(!$value || is_string($value))
return $value;
364 if(is_object($value)) $value = get_object_vars($value);
366 if(!count($value))
return;
367 foreach($value as $key => $val)
374 if(is_object($val)||is_array($val)) $body = $this->
_getRssBody($val);
375 if($body !== null)
return $body;
382 $content = preg_replace(
'!(<br[\s]*/{0,1}>[\s]*)+!is',
' ', $content);
384 $content = str_replace(array(
'</p>',
'</div>',
'</li>'),
' ', $content);
386 $content = preg_replace(
'!<([^>]*?)>!is',
'', $content);
388 $content = str_replace(array(
'<',
'>',
'"',
' '), array(
'<',
'>',
'"',
' '), $content);
390 $content = preg_replace(
'/ ( +)/is',
' ', $content);
392 $content = trim(
cut_str($content, $str_size, $tail));
394 $content = str_replace(array(
'<',
'>',
'"'),array(
'<',
'>',
'"'), $content);
396 $content = preg_replace(
'/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',
"$0-",$content);
414 $DATE_FORMAT =
$args->date_format ?
$args->date_format :
"Y-m-d H:i:s";
418 $encoding = preg_match(
"/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
421 $buff = preg_replace(
"/<\?xml.*\?>/i",
"", $buff);
424 $xml_doc = $oXmlParser->parse($buff);
425 $rss =
new stdClass();
428 $rss->title = $xml_doc->rss->channel->title->body;
429 $rss->link = $xml_doc->rss->channel->link->body;
431 $items = $xml_doc->rss->channel->item;
434 if($items && !is_array($items)) $items = array($items);
436 $content_items = array();
438 foreach ($items as $key => $value)
440 if($key >=
$args->list_count)
break;
442 $item =
new stdClass();
444 foreach($value as $key2 => $value2)
446 if(is_array($value2)) $value2 = array_shift($value2);
451 $content_item->setContentsLink($rss->link);
452 $content_item->setTitle($item->title);
453 $content_item->setNickName(max($item->author,$item->{
'dc:creator'}));
455 $item->description = preg_replace(
'!<a href=!is',
'<a target="_blank" rel="noopener" href=', $item->description);
456 $content_item->setContent($this->
_getSummary($item->description,
$args->content_cut_size));
457 $content_item->setLink($item->link);
458 $date = date(
'YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{
'dc:date'})));
459 $content_item->setRegdate($date);
461 $content_items[] = $content_item;
464 else if($xml_doc->{
'rdf:rdf'})
467 $rss->title = $xml_doc->{
'rdf:rdf'}->channel->title->body;
468 $rss->link = $xml_doc->{
'rdf:rdf'}->channel->link->body;
470 $items = $xml_doc->{
'rdf:rdf'}->item;
473 if($items && !is_array($items)) $items = array($items);
475 $content_items = array();
477 foreach ($items as $key => $value)
479 if($key >=
$args->list_count)
break;
481 $item =
new stdClass();
483 foreach($value as $key2 => $value2)
485 if(is_array($value2)) $value2 = array_shift($value2);
486 $item->{$key2} = $this->_getRssBody($value2);
490 $content_item->setContentsLink($rss->link);
491 $content_item->setTitle($item->title);
492 $content_item->setNickName(max($item->author,$item->{
'dc:creator'}));
494 $item->description = preg_replace(
'!<a href=!is',
'<a target="_blank" rel="noopener" href=', $item->description);
495 $content_item->setContent($this->_getSummary($item->description,
$args->content_cut_size));
496 $content_item->setLink($item->link);
497 $date = date(
'YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{
'dc:date'})));
498 $content_item->setRegdate($date);
500 $content_items[] = $content_item;
503 else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns ==
'http://www.w3.org/2005/Atom')
506 $rss->title = $xml_doc->feed->title->body;
507 $links = $xml_doc->feed->link;
510 foreach ($links as $value)
512 if($value->attrs->rel ==
'alternate')
514 $rss->link = $value->attrs->href;
519 else if($links->attrs->rel ==
'alternate') $rss->link = $links->attrs->href;
521 $items = $xml_doc->feed->entry;
524 if($items && !is_array($items)) $items = array($items);
526 $content_items = array();
528 foreach ($items as $key => $value)
530 if($key >=
$args->list_count)
break;
533 foreach($value as $key2 => $value2)
535 if(is_array($value2)) $value2 = array_shift($value2);
536 $item->{$key2} = $this->_getRssBody($value2);
540 $links = $value->link;
543 foreach ($links as $val)
545 if($val->attrs->rel ==
'alternate')
547 $item->link = $val->attrs->href;
552 else if($links->attrs->rel ==
'alternate') $item->link = $links->attrs->href;
554 $content_item->setContentsLink($rss->link);
557 if(stripos($value->title->attrs->type,
"html") === FALSE) $item->title = $value->title->body;
559 $content_item->setTitle($item->title);
560 $content_item->setNickName(max($item->author,$item->{
'dc:creator'}));
561 $content_item->setAuthorSite($value->author->uri->body);
564 $item->description = ($item->content) ? $item->content : $item->description = $item->summary;
565 $item->description = preg_replace(
'!<a href=!is',
'<a target="_blank" rel="noopener" href=', $item->description);
567 if(($item->content && stripos($value->content->attrs->type,
"html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type,
"html") === FALSE))
569 $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
573 $content_item->setContent($this->_getSummary($item->description,
$args->content_cut_size));
574 $content_item->setLink($item->link);
575 $date = date(
'YmdHis', strtotime(max($item->published,$item->updated,$item->{
'dc:date'})));
576 $content_item->setRegdate($date);
578 $content_items[] = $content_item;
581 return $content_items;
589 foreach(
$output->data as $key => $val) {
590 $category_lists[$val->module_srl][$val->category_srl] = $val;
598 $oTrackbackModel =
getModel(
'trackback');
599 $output = $oTrackbackModel->getNewestTrackbackList(
$obj);
603 $content_items = array();
604 foreach(
$output->data as $key => $item)
606 $domain =
$args->module_srls_info[$item->module_srl]->domain;
607 $category = $category_lists[$item->module_srl]->text;
608 $url =
getSiteUrl($domain,
'',
'mid',
$args->mid_lists[$item->module_srl],
'document_srl',$item->document_srl);
609 $browser_title =
$args->module_srls_info[$item->module_srl]->browser_title;
612 $content_item->adds($item);
613 $content_item->setTitle($item->title);
614 $content_item->setCategory($category);
615 $content_item->setNickName($item->blog_name);
616 $content_item->setContent($item->excerpt);
617 $content_item->setDomain($domain);
618 $content_item->setLink($url);
619 $content_item->add(
'mid',
$args->mid_lists[$item->module_srl]);
620 $content_item->setRegdate($item->regdate);
621 $content_items[] = $content_item;
623 return $content_items;
630 $widget_info =
new stdClass();
631 $widget_info->modules_info =
$args->modules_info;
632 $widget_info->option_view_arr =
$args->option_view_arr;
633 $widget_info->list_count =
$args->list_count;
634 $widget_info->subject_cut_size =
$args->subject_cut_size;
635 $widget_info->content_cut_size =
$args->content_cut_size;
637 $widget_info->thumbnail_type =
$args->thumbnail_type;
638 $widget_info->thumbnail_width =
$args->thumbnail_width;
639 $widget_info->thumbnail_height =
$args->thumbnail_height;
640 $widget_info->mid_lists =
$args->mid_lists;
642 $widget_info->show_browser_title =
$args->show_browser_title;
643 $widget_info->show_category =
$args->show_category;
644 $widget_info->show_comment_count =
$args->show_comment_count;
645 $widget_info->show_trackback_count =
$args->show_trackback_count;
646 $widget_info->show_icon =
$args->show_icon;
648 $widget_info->list_type =
$args->list_type;
649 $widget_info->tab_type =
$args->tab_type;
651 $widget_info->markup_type =
$args->markup_type;
652 $widget_info->content_items = $content_items;
654 unset(
$args->option_view_arr);
655 unset(
$args->modules_info);
660 $tpl_path = sprintf(
'%sskins/%s', $this->widget_path,
$args->skin);
661 return $oTemplate->compile($tpl_path,
"content");
680 $this->contents_link = $link;
685 $this->has_first_thumbnail_idx =
true;
691 $this->
add(
'extra_images',$extra_images);
695 static $default_domain = null;
705 $this->
add(
'url',$url);
709 $this->
add(
'title',$title);
714 $this->
add(
'thumbnail',$thumbnail);
718 $this->
add(
'content',$content);
722 $this->
add(
'regdate',$regdate);
726 $this->
add(
'nick_name',$nick_name);
731 $this->
add(
'author_site',$site_url);
735 $this->
add(
'category',$category);
757 return $this->
get(
'url');
761 return $this->
get(
'module_srl');
765 $title = strip_tags($this->
get(
'title'));
767 if($cut_size) $title =
cut_str($title, $cut_size, $tail);
770 if($this->
get(
'title_bold') ==
'Y') $attrs[] =
'font-weight:bold';
771 if($this->
get(
'title_color') && $this->
get(
'title_color') !=
'N') $attrs[] =
'color:#'.$this->get(
'title_color');
773 if(count($attrs)) $title = sprintf(
"<span style=\"%s\">%s</span>", implode(
';', $attrs), htmlspecialchars($title));
779 return $this->
get(
'content');
783 return $this->
get(
'category');
787 return $this->
get(
'nick_name');
791 return $this->
get(
'author_site');
795 $comment_count = $this->
get(
'comment_count');
796 return $comment_count>0 ? $comment_count :
'';
800 $trackback_count = $this->
get(
'trackback_count');
801 return $trackback_count>0 ? $trackback_count :
'';
805 return zdate($this->
get(
'regdate'), $format);
809 return $this->
get(
'extra_images');
817 return $this->
get(
'thumbnail');
821 return $this->
get(
'member_srl');
proc($args)
Widget execution.
zdate($str, $format= 'Y-m-d H:i:s', $conversion=TRUE)
_getTrackbackItems($args)
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
_getSummary($content, $str_size=50)
setFirstThumbnailIdx($first_thumbnail_idx)
_compile($args, $content_items)
set($key, $val, $set_to_get_vars=0)
widget to display mcontent
getRemoteResource($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
getRegdate($format= 'Y.m.d H:i:s')
getTitle($cut_size=0, $tail='...')
setExtraImages($extra_images)
_getCommentItems($args)
Return to the list of comments extracted mcontentItem.
requestFeedContents($rss_url)
function to receive contents from rss url For Tistory blog in Korea, the original RSS url has locatio...
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
cut_str($string, $cut_size=0, $tail= '...')
__construct($browser_title='')