21 if(!in_array(
$args->order_target, array(
'regdate',
'update_order')))
$args->order_target =
'regdate';
23 if(!in_array(
$args->order_type, array(
'asc',
'desc')))
$args->order_type =
'asc';
31 $args->cols_list_count = (int)
$args->cols_list_count;
32 if(!
$args->cols_list_count)
$args->cols_list_count = 5;
34 if(!
$args->subject_cut_size)
$args->subject_cut_size = 0;
36 if(!
$args->content_cut_size)
$args->content_cut_size = 100;
38 if(!
$args->nickname_cut_size)
$args->nickname_cut_size = 0;
40 if(!
$args->duration_new)
$args->duration_new = 12;
42 if(!
$args->thumbnail_type)
$args->thumbnail_type =
'crop';
44 if(!
$args->thumbnail_width)
$args->thumbnail_width = 100;
46 if(!
$args->thumbnail_height)
$args->thumbnail_height = 75;
48 $args->option_view_arr = explode(
',',
$args->option_view);
50 if(!
$args->markup_type)
$args->markup_type =
'table';
53 $module_srls =
$args->modules_info =
$args->module_srls_info =
$args->mid_lists = array();
56 if(
$args->content_type ==
'rss')
58 $args->rss_urls = array();
60 for($i=0,$c=count($rss_urls);$i<$c;$i++)
62 if($rss_urls[$i])
$args->rss_urls[] = $rss_urls[$i];
68 $obj =
new stdClass();
70 if(!
$args->module_srls)
72 $obj->site_srl = (int)$site_module_info->site_srl;
76 foreach(
$output->data as $key => $val)
78 $args->modules_info[$val->mid] = $val;
79 $args->module_srls_info[$val->module_srl] = $val;
80 $args->mid_lists[$val->module_srl] = $val->mid;
81 $module_srls[] = $val->module_srl;
94 foreach(
$output->data as $key => $val)
96 $args->modules_info[$val->mid] = $val;
97 $args->module_srls_info[$val->module_srl] = $val;
98 $module_srls[] = $val->module_srl;
100 $idx = explode(
',',
$args->module_srls);
101 for($i=0,$c=count($idx);$i<$c;$i++)
104 if(!
$args->module_srls_info[$srl])
continue;
105 $args->mid_lists[$srl] =
$args->module_srls_info[$srl]->mid;
111 $args->module_srl = implode(
',',$module_srls);
118 if(
$args->tab_type ==
'none' ||
$args->tab_type ==
'')
120 switch(
$args->content_type)
142 $content_items = array();
144 switch(
$args->content_type)
190 $obj =
new stdClass();
195 $oCommentModel =
getModel(
'comment');
196 $output = $oCommentModel->getNewestCommentList(
$obj);
198 $content_items = array();
202 foreach(
$output as $key => $oComment)
204 $attribute = $oComment->getObjectVars();
205 $title = $oComment->getSummary(
$args->content_cut_size);
206 $thumbnail = $oComment->getThumbnail(
$args->thumbnail_width,
$args->thumbnail_height,
$args->thumbnail_type);
207 $url = sprintf(
"%s#comment_%s",
getUrl(
'',
'mid',
$args->mid_lists[$attribute->module_srl],
'document_srl',$oComment->get(
'document_srl')),$oComment->get(
'comment_srl'));
209 $attribute->mid =
$args->mid_lists[$attribute->module_srl];
210 $browser_title =
$args->module_srls_info[$attribute->module_srl]->browser_title;
211 $domain =
$args->module_srls_info[$attribute->module_srl]->domain;
214 $content_item->adds($attribute);
215 $content_item->setTitle($title);
216 $content_item->setThumbnail($thumbnail);
217 $content_item->setLink($url);
218 $content_item->setDomain($domain);
219 $content_item->add(
'mid',
$args->mid_lists[$attribute->module_srl]);
220 $content_items[] = $content_item;
222 return $content_items;
230 $obj =
new stdClass();
235 foreach(
$output->data as $key => $val)
237 $category_lists[$val->module_srl][$val->category_srl] = $val;
242 $obj->category_srl =
$args->category_srl;
244 if(
$args->order_target ==
'list_order' ||
$args->order_target ==
'update_order')
246 $obj->order_type =
$args->order_type==
"desc"?
"asc":
"desc";
250 $obj->order_type =
$args->order_type==
"desc"?
"desc":
"asc";
253 $obj->statusList = array(
'PUBLIC');
257 $content_items = array();
258 $first_thumbnail_idx = -1;
261 foreach(
$output->data as $key => $attribute)
264 $oDocument->setAttribute($attribute,
false);
265 $GLOBALS[
'XE_DOCUMENT_LIST'][$oDocument->document_srl] = $oDocument;
266 $document_srls[] = $oDocument->document_srl;
270 for($i=0,$c=count($document_srls);$i<$c;$i++)
272 $oDocument =
$GLOBALS[
'XE_DOCUMENT_LIST'][$document_srls[$i]];
275 $category_srl = $oDocument->get(
'category_srl');
276 $thumbnail = $oDocument->getThumbnail(
$args->thumbnail_width,
$args->thumbnail_height,
$args->thumbnail_type);
279 $content_item->adds($oDocument->getObjectVars());
280 $content_item->add(
'original_content', $oDocument->get(
'content'));
281 $content_item->setTitle($oDocument->getTitleText());
282 $content_item->setCategory( $category_lists[
$module_srl][$category_srl]->
title );
284 $content_item->setContent($oDocument->getSummary(
$args->content_cut_size));
286 $content_item->setThumbnail($thumbnail);
287 $content_item->setExtraImages($oDocument->printExtraImages(
$args->duration_new * 60 * 60));
289 if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
290 $content_items[] = $content_item;
293 $content_items[0]->setFirstThumbnailIdx($first_thumbnail_idx);
296 $oSecurity =
new Security($content_items);
297 $oSecurity->encodeHTML(
'..variables.content',
'..variables.user_name',
'..variables.nick_name');
299 return $content_items;
307 $obj->direct_download =
'Y';
313 foreach(
$output->data as $key => $val)
315 $category_lists[$val->module_srl][$val->category_srl] = $val;
321 $files_count = count($files_output->data);
322 if(!$files_count)
return;
324 $content_items = array();
326 for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
328 $tmp_document_list =
$oDocumentModel->getDocuments($document_srl_list);
330 if(!count($tmp_document_list))
return;
332 foreach($tmp_document_list as $oDocument)
334 $attribute = $oDocument->getObjectVars();
335 $browser_title =
$args->module_srls_info[$attribute->module_srl]->browser_title;
336 $domain =
$args->module_srls_info[$attribute->module_srl]->domain;
337 $category = $category_lists[$attribute->module_srl]->text;
338 $content = $oDocument->getSummary(
$args->content_cut_size);
339 $url = sprintf(
"%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount());
340 $thumbnail = $oDocument->getThumbnail(
$args->thumbnail_width,
$args->thumbnail_height,
$args->thumbnail_type);
341 $extra_images = $oDocument->printExtraImages(
$args->duration_new);
344 $content_item->adds($attribute);
345 $content_item->setCategory($category);
346 $content_item->setContent($content);
347 $content_item->setLink($url);
348 $content_item->setThumbnail($thumbnail);
349 $content_item->setExtraImages($extra_images);
350 $content_item->setDomain($domain);
351 $content_item->add(
'mid',
$args->mid_lists[$attribute->module_srl]);
352 $content_items[] = $content_item;
355 return $content_items;
360 $content_items = array();
361 $args->mid_lists = array();
363 foreach(
$args->rss_urls as $key => $rss)
365 $args->rss_url = $rss;
367 if(count($content_item) > 0)
369 $browser_title = $content_item[0]->getBrowserTitle();
370 $args->mid_lists[] = $browser_title;
371 $content_items[] = $content_item;
375 if(
$args->tab_type ==
'none' ||
$args->tab_type ==
'')
378 foreach($content_items as $key => $val)
380 foreach($val as $k => $v)
382 $date = $v->get(
'regdate');
384 while(array_key_exists(sprintf(
'%s%02d',$date,$i), $items)) $i++;
385 $items[sprintf(
'%s%02d',$date,$i)] = $v;
388 if(
$args->order_type ==
'asc') ksort($items);
390 $content_items = array_slice(array_values($items),0,
$args->list_count*
$args->page_count);
395 foreach($content_items as $key=> $content_item_list)
398 foreach($content_item_list as $k => $content_item)
400 $date = $content_item->get(
'regdate');
402 while(array_key_exists(sprintf(
'%s%02d',$date,$i), $items)) $i++;
403 $items[sprintf(
'%s%02d',$date,$i)] = $content_item;
405 if(
$args->order_type ==
'asc') ksort($items);
408 $content_items[$key] = array_values($items);
411 return $content_items;
416 if(!$value || is_string($value))
return $value;
417 if(is_object($value)) $value = get_object_vars($value);
419 if(!count($value))
return;
420 foreach($value as $key => $val)
427 if(is_object($val)||is_array($val)) $body = $this->
_getRssBody($val);
428 if($body !== null)
return $body;
435 $content = preg_replace(
'!(<br[\s]*/{0,1}>[\s]*)+!is',
' ', $content);
437 $content = str_replace(array(
'</p>',
'</div>',
'</li>'),
' ', $content);
439 $content = preg_replace(
'!<([^>]*?)>!is',
'', $content);
441 $content = str_replace(array(
'<',
'>',
'"',
' '), array(
'<',
'>',
'"',
' '), $content);
443 $content = preg_replace(
'/ ( +)/is',
' ', $content);
445 $content = trim(
cut_str($content, $str_size, $tail));
447 $content = str_replace(array(
'<',
'>',
'"'),array(
'<',
'>',
'"'), $content);
449 $content = preg_replace(
'/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',
"$0-",$content);
466 $DATE_FORMAT =
$args->date_format ?
$args->date_format :
"Y-m-d H:i:s";
470 $encoding = preg_match(
"/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
473 $buff = preg_replace(
"/<\?xml.*\?>/i",
"", $buff);
476 $xml_doc = $oXmlParser->parse($buff);
479 $rss->title = $xml_doc->rss->channel->title->body;
480 $rss->link = $xml_doc->rss->channel->link->body;
482 $items = $xml_doc->rss->channel->item;
485 if($items && !is_array($items)) $items = array($items);
487 $content_items = array();
489 foreach ($items as $key => $value)
491 if($key >=
$args->list_count *
$args->page_count)
break;
494 foreach($value as $key2 => $value2)
496 if(is_array($value2)) $value2 = array_shift($value2);
501 $content_item->setContentsLink($rss->link);
502 $content_item->setTitle($item->title);
503 $content_item->setNickName(max($item->author,$item->{
'dc:creator'}));
505 $item->description = preg_replace(
'!<a href=!is',
'<a target="_blank" rel="noopener" href=', $item->description);
506 $content_item->setContent($this->
_getSummary($item->description,
$args->content_cut_size));
508 $content_item->setLink($item->link);
509 $date = date(
'YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{
'dc:date'})));
510 $content_item->setRegdate($date);
512 $content_items[] = $content_item;
515 else if($xml_doc->{
'rdf:rdf'})
518 $rss->title = $xml_doc->{
'rdf:rdf'}->channel->title->body;
519 $rss->link = $xml_doc->{
'rdf:rdf'}->channel->link->body;
521 $items = $xml_doc->{
'rdf:rdf'}->item;
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 *
$args->page_count)
break;
533 foreach($value as $key2 => $value2)
535 if(is_array($value2)) $value2 = array_shift($value2);
536 $item->{$key2} = $this->_getRssBody($value2);
540 $content_item->setContentsLink($rss->link);
541 $content_item->setTitle($item->title);
542 $content_item->setNickName(max($item->author,$item->{
'dc:creator'}));
544 $item->description = preg_replace(
'!<a href=!is',
'<a target="_blank" rel="noopener" href=', $item->description);
545 $content_item->setContent($this->_getSummary($item->description,
$args->content_cut_size));
546 $content_item->setThumbnail($this->_getRssThumbnail($item->description));
547 $content_item->setLink($item->link);
548 $date = date(
'YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{
'dc:date'})));
549 $content_item->setRegdate($date);
551 $content_items[] = $content_item;
554 else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns ==
'http://www.w3.org/2005/Atom')
557 $rss->title = $xml_doc->feed->title->body;
558 $links = $xml_doc->feed->link;
561 foreach ($links as $value)
563 if($value->attrs->rel ==
'alternate')
565 $rss->link = $value->attrs->href;
570 else if($links->attrs->rel ==
'alternate') $rss->link = $links->attrs->href;
572 $items = $xml_doc->feed->entry;
575 if($items && !is_array($items)) $items = array($items);
577 $content_items = array();
579 foreach ($items as $key => $value)
581 if($key >=
$args->list_count *
$args->page_count)
break;
584 foreach($value as $key2 => $value2)
586 if(is_array($value2)) $value2 = array_shift($value2);
587 $item->{$key2} = $this->_getRssBody($value2);
591 $links = $value->link;
594 foreach ($links as $val)
596 if($val->attrs->rel ==
'alternate')
598 $item->link = $val->attrs->href;
603 else if($links->attrs->rel ==
'alternate') $item->link = $links->attrs->href;
605 $content_item->setContentsLink($rss->link);
608 if(stripos($value->title->attrs->type,
"html") === FALSE) $item->title = $value->title->body;
610 $content_item->setTitle($item->title);
611 $content_item->setNickName(max($item->author,$item->{
'dc:creator'}));
612 $content_item->setAuthorSite($value->author->uri->body);
615 $item->description = ($item->content) ? $item->content : $item->description = $item->summary;
616 $item->description = preg_replace(
'!<a href=!is',
'<a target="_blank" rel="noopener" href=', $item->description);
618 if(($item->content && stripos($value->content->attrs->type,
"html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type,
"html") === FALSE))
620 $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
624 $content_item->setContent($this->_getSummary($item->description,
$args->content_cut_size));
625 $content_item->setThumbnail($this->_getRssThumbnail($item->description));
626 $content_item->setLink($item->link);
627 $date = date(
'YmdHis', strtotime(max($item->published,$item->updated,$item->{
'dc:date'})));
628 $content_item->setRegdate($date);
630 $content_items[] = $content_item;
633 return $content_items;
638 @preg_match(
'@<img[^>]+src\s*=\s*(?:"(.+)"|\'(.+)\'|([^\s>(?:/>)]+))@', $content, $matches);
660 $oTrackbackModel =
getModel(
'trackback');
661 if(!$oTrackbackModel)
671 foreach(
$output->data as $key => $val)
673 $category_lists[$val->module_srl][$val->category_srl] = $val;
682 $output = $oTrackbackModel->getNewestTrackbackList(
$obj);
686 $content_items = array();
687 foreach(
$output->data as $key => $item)
689 $domain =
$args->module_srls_info[$item->module_srl]->domain;
690 $category = $category_lists[$item->module_srl]->text;
691 $url =
getSiteUrl($domain,
'',
'document_srl',$item->document_srl);
692 $browser_title =
$args->module_srls_info[$item->module_srl]->browser_title;
695 $content_item->adds($item);
696 $content_item->setTitle($item->title);
697 $content_item->setCategory($category);
698 $content_item->setNickName($item->blog_name);
699 $content_item->setContent($item->excerpt);
700 $content_item->setDomain($domain);
701 $content_item->setLink($url);
702 $content_item->add(
'mid',
$args->mid_lists[$item->module_srl]);
703 $content_item->setRegdate($item->regdate);
704 $content_items[] = $content_item;
706 return $content_items;
713 $widget_info =
new stdClass();
714 $widget_info->modules_info =
$args->modules_info;
715 $widget_info->option_view_arr =
$args->option_view_arr;
716 $widget_info->list_count =
$args->list_count;
717 $widget_info->page_count =
$args->page_count;
718 $widget_info->subject_cut_size =
$args->subject_cut_size;
719 $widget_info->content_cut_size =
$args->content_cut_size;
720 $widget_info->nickname_cut_size =
$args->nickname_cut_size;
721 $widget_info->new_window =
$args->new_window;
723 $widget_info->duration_new =
$args->duration_new * 60*60;
724 $widget_info->thumbnail_type =
$args->thumbnail_type;
725 $widget_info->thumbnail_width =
$args->thumbnail_width;
726 $widget_info->thumbnail_height =
$args->thumbnail_height;
727 $widget_info->cols_list_count =
$args->cols_list_count;
728 $widget_info->mid_lists =
$args->mid_lists;
730 $widget_info->show_browser_title =
$args->show_browser_title;
731 $widget_info->show_category =
$args->show_category;
732 $widget_info->show_comment_count =
$args->show_comment_count;
733 $widget_info->show_trackback_count =
$args->show_trackback_count;
734 $widget_info->show_icon =
$args->show_icon;
736 $widget_info->list_type =
$args->list_type;
737 $widget_info->tab_type =
$args->tab_type;
739 $widget_info->markup_type =
$args->markup_type;
741 if(
$args->tab_type !=
'none' &&
$args->tab_type)
746 if(!is_array($content_items[
$module_srl]) || !count($content_items[$module_srl]))
continue;
749 $tab_item =
new stdClass();
750 $tab_item->title = $content_items[
$module_srl][0]->getBrowserTitle();
751 $tab_item->content_items = $content_items[
$module_srl];
752 $tab_item->domain = $content_items[
$module_srl][0]->getDomain();
753 $tab_item->url = $content_items[
$module_srl][0]->getContentsLink();
754 if(!$tab_item->url) $tab_item->url =
getSiteUrl($tab_item->domain,
'',
'mid',$mid);
757 $widget_info->tab = $tab;
761 $widget_info->content_items = $content_items;
763 unset(
$args->option_view_arr);
764 unset(
$args->modules_info);
769 $tpl_path = sprintf(
'%sskins/%s', $this->widget_path,
$args->skin);
770 return $oTemplate->compile($tpl_path,
"content");
788 $this->contents_link = $link;
794 $this->has_first_thumbnail_idx =
true;
800 $this->
add(
'extra_images',$extra_images);
804 static $default_domain = null;
814 $this->
add(
'url', strip_tags($url));
818 $this->
add(
'title', strip_tags($title));
822 $this->
add(
'thumbnail', $thumbnail);
830 $this->
add(
'regdate', strip_tags($regdate));
834 $this->
add(
'nick_name', strip_tags($nick_name));
839 $this->
add(
'author_site', strip_tags($site_url));
843 $this->
add(
'category', strip_tags($category));
865 return $this->
get(
'url');
869 return $this->
get(
'module_srl');
873 $title = htmlspecialchars($this->
get(
'title'), ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
875 if($cut_size) $title =
cut_str($title, $cut_size, $tail);
878 if($this->
get(
'title_bold') ==
'Y') $attrs[] =
'font-weight:bold';
879 if($this->
get(
'title_color') && $this->
get(
'title_color') !=
'N') $attrs[] =
'color:#'.$this->get(
'title_color');
881 if(count($attrs)) $title = sprintf(
"<span style=\"%s\">%s</span>", implode(
';', $attrs), $title);
887 return $this->
get(
'content');
891 return $this->
get(
'category');
895 if($cut_size) $nick_name =
cut_str($this->
get(
'nick_name'), $cut_size, $tail);
896 else $nick_name = $this->
get(
'nick_name');
902 return $this->
get(
'author_site');
906 $comment_count = $this->
get(
'comment_count');
907 return $comment_count>0 ? $comment_count :
'';
911 $trackback_count = $this->
get(
'trackback_count');
912 return $trackback_count>0 ? $trackback_count :
'';
916 return zdate($this->
get(
'regdate'), $format);
920 return $this->
get(
'extra_images');
928 return $this->
get(
'thumbnail');
932 return $this->
get(
'member_srl');
setFirstThumbnailIdx($first_thumbnail_idx)
_compile($args, $content_items)
zdate($str, $format= 'Y-m-d H:i:s', $conversion=TRUE)
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']
requestFeedContents($rss_url)
function to receive contents from rss url For Tistory blog in Korea, the original RSS url has locatio...
set($key, $val, $set_to_get_vars=0)
_getTrackbackItems($args)
__construct($browser_title='')
getRemoteResource($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
_getRssThumbnail($content)
_getCommentItems($args)
Get a list of comments and return contentItem.
widget to display content
_getSummary($content, $str_size=50)
getTitle($cut_size=0, $tail='...')
getNickName($cut_size=0, $tail='...')
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
cut_str($string, $cut_size=0, $tail= '...')
setExtraImages($extra_images)
getRegdate($format= 'Y.m.d H:i:s')
proc($args)
Widget handler.