Ejemplo n.º 1
0
 function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param = array())
 {
     global $NEWSSTYLE, $NEWSLISTSTYLE;
     if ($override_newsitem = e107::getSingleton('override', true)->override_check('render_newsitem')) {
         $result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param);
         if ($result == 'return') {
             return;
         }
     }
     if ($n_restrict == 'userclass') {
         $news['news_id'] = 0;
         $news['news_title'] = LAN_NEWS_1;
         $news['data'] = LAN_NEWS_2;
         $news['news_extended'] = "";
         $news['news_allow_comments'] = 1;
         $news['news_start'] = 0;
         $news['news_end'] = 0;
         $news['news_render_type'] = 0;
         $news['comment_total'] = 0;
     }
     $tmp = array();
     $tmp['caticon'] = defset('ICONSTYLE');
     $tmp['commentoffstring'] = defset('COMMENTOFFSTRING');
     $tmp['commentlink'] = defset('COMMENTLINK');
     $tmp['trackbackstring'] = defset('TRACKBACKSTRING');
     $tmp['trackbackbeforestring'] = defset('TRACKBACKBEFORESTRING');
     $tmp['trackbackafterstring'] = defset('TRACKBACKAFTERSTRING');
     $tmp['itemlink'] = defset('NEWSLIST_ITEMLINK');
     $tmp['thumbnail'] = defset('NEWSLIST_THUMB', "border:0px");
     $tmp['catlink'] = defset('NEWSLIST_CATLINK');
     $tmp['caticon'] = defset('NEWSLIST_CATICON', defset('ICONSTYLE'));
     if (!$param) {
         $param = array();
     }
     $param = array_merge($tmp, $param);
     // Next three images aren't always defined by the caller, even if most of $param is.
     //XXX All of this should be done via CSS from v2 on.
     if (!isset($param['image_nonew_small'])) {
         if (!defined("IMAGE_nonew_small")) {
             define("IMAGE_nonew_small", file_exists(THEME . "images/nonew_comments.png") ? "<img src='" . THEME_ABS . "images/nonew_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/nonew_comments.png' alt=''  />");
         }
         $param['image_nonew_small'] = IMAGE_nonew_small;
     }
     if (!isset($param['image_new_small'])) {
         if (!defined("IMAGE_new_small")) {
             define("IMAGE_new_small", file_exists(THEME . "images/new_comments.png") ? "<img src='" . THEME_ABS . "images/new_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/new_comments.png' alt=''  /> ");
         }
         $param['image_new_small'] = IMAGE_new_small;
     }
     if (!isset($param['image_sticky'])) {
         if (!defined("IMAGE_sticky")) {
             define("IMAGE_sticky", file_exists(THEME . "images/sticky.png") ? "<img src='" . THEME_ABS . "images/sticky.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/sticky.png' alt='' style='width: 14px; height: 14px; vertical-align: bottom' /> ");
         }
         $param['image_sticky'] = IMAGE_sticky;
     }
     cachevars('current_news_item', $news);
     cachevars('current_news_param', $param);
     if ($news['news_render_type'] == 1 && $mode != "extend") {
         if (function_exists("news_list")) {
             $NEWS_PARSE = news_list($news);
         } else {
             if ($NEWSLISTSTYLE) {
                 $NEWS_PARSE = $NEWSLISTSTYLE;
             } else {
                 $NEWS_PARSE = "{NEWSICON}&nbsp;<b>{NEWSTITLELINK}</b><div class='smalltext'>{NEWSAUTHOR} " . LAN_NEWS_100 . " {NEWSDATE} | {NEWSCOMMENTS}</div>";
             }
         }
     } else {
         if ($NEWS_TEMPLATE) {
             $NEWS_PARSE = $NEWS_TEMPLATE;
         } else {
             if (function_exists("news_style")) {
                 $action = varset($param['current_action'], 'default');
                 $NEWS_PARSE = news_style($news, $action, $param);
             } else {
                 $NEWS_PARSE = $NEWSSTYLE;
             }
         }
     }
     //$loop_uid = $news['news_author']; - no references found
     //require_once(e_CORE.'shortcodes/batch/news_shortcodes.php');
     /* DEPRECATED
     		setScVar('news_shortcodes', 'news_item', $news);
     		setScVar('news_shortcodes', 'param', $param);
     		*/
     // Set the Values for the social shortcode usage.
     $tp = e107::getParser();
     $socialArray = array('url' => e107::getUrl()->create('news/view/item', $news, 'full=1'), 'title' => $tp->toText($news['news_title']), 'tags' => $news['news_meta_keywords']);
     $socialObj = e107::getScBatch('social');
     if (is_object($socialObj)) {
         $socialObj->setVars($socialArray);
     }
     // Retrieve batch sc object, set required vars
     $sc = e107::getScBatch('news')->wrapper('news/view/item')->setScVar('news_item', $news)->setScVar('param', $param);
     $text = e107::getParser()->parseTemplate($NEWS_PARSE, true, $sc);
     if ($mode == 'return') {
         return $text;
     } else {
         echo $text;
         return TRUE;
     }
 }
Ejemplo n.º 2
0
     } else {
         $NEWSLISTCATTITLE = str_replace("{NEWSCATEGORY}", $tp->toHTML($category_name, FALSE, 'TITLE'), $NEWSLISTCATTITLE);
     }
     echo $NEWSLISTCATTITLE;
 }
 $i = 1;
 while (isset($newsAr[$i]) && $i <= $interval) {
     $news = $newsAr[$i];
     // Set the Values for the social shortcode usage.
     $socialArray = array('url' => e107::getUrl()->create('news/view/item', $news, 'full=1'), 'title' => $tp->toText($news['news_title']), 'tags' => $news['news_meta_keywords']);
     $socialObj = e107::getScBatch('social');
     if (is_object($socialObj)) {
         $socialObj->setVars($socialArray);
     }
     if (function_exists("news_style")) {
         $template = news_style($news, $action, $param);
     }
     //        render new date header if pref selected ...
     $thispostday = strftime("%j", $news['news_datestamp']);
     if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader'])) {
         echo "<div class='" . DATEHEADERCLASS . "'>" . strftime("%A %d %B %Y", $news['news_datestamp']) . "</div>";
     }
     $newpostday = $thispostday;
     $news['category_id'] = $news['news_category'];
     if ($action == "item") {
         unset($news['news_render_type']);
     }
     // $template = false;
     $ix->render_newsitem($news, 'default', '', $template, $param);
     $i++;
 }