2006-12-02 04:36:16 +00:00
< ? php
/*
2008-12-20 10:39:29 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright ( C ) 2008 - 2009 e107 Inc ( e107 . org )
2008-12-20 10:39:29 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Plugin - newsfeeds
*
* $Source : / cvs_backup / e107_0 . 8 / e107_plugins / newsfeed / newsfeed_functions . php , v $
2010-02-10 18:18:01 +00:00
* $Revision $
* $Date $
* $Author $
2008-12-20 10:39:29 +00:00
*
*/
/*
If cache is disabled , first call to this object reads the complete database of active feeds , including the actual news feed . So all data is available for
the rest of the page .
If cache is enabled , only the feed list ( excluding the news feed data ) is loaded . Individual news feeds are stored in separate cache files , and loaded on demand . If the
feed refresh time has expired , the cache is updated .
2006-12-02 04:36:16 +00:00
*/
if ( ! defined ( 'e107_INIT' )) { exit ; }
2015-02-07 13:38:29 -08:00
if ( ! e107 :: isInstalled ( 'newsfeed' ))
2008-12-20 10:39:29 +00:00
{
return ;
}
2016-05-21 09:08:46 -07:00
define ( 'NEWSFEED_LIST_CACHE_TAG' , 'newsfeeds' . e_LAN . " _ " );
define ( 'NEWSFEED_NEWS_CACHE_TAG' , 'newsfeeds_news_' . e_LAN . " _ " );
2008-12-20 10:39:29 +00:00
2016-05-21 09:08:46 -07:00
define ( 'NEWSFEED_DEBUG' , false );
2006-12-02 04:36:16 +00:00
2008-12-20 10:39:29 +00:00
class newsfeedClass
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
var $validFeedList ; // True once feeds read
var $feedList = array (); // List of available feeds read from DB - everything from DB apart from the actual news
var $feedIcon = array (); // Pre-calculated link to each feed's icon
var $newsList = array (); // Actual news element for each feed
var $lastProcessed ; // Note time when processFeeds() last run
var $truncateCount ; // Number of characters to show in feeds in menus
var $truncateMore ; // '...more' string
var $useCache ; // Set if cache is available
// Constructor
2016-04-20 17:25:32 -07:00
function __construct ()
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
$this -> validFeedList = FALSE ;
$this -> newsList = array ();
$this -> feedList = array ();
$this -> feedIcon = array ();
$this -> lastProcessed = 0 ;
$this -> truncateCount = 150 ; // Set a pref for these two later
$this -> truncateMore = '...' ;
2016-05-21 09:08:46 -07:00
$this -> useCache = true ; // e107::getCache()->UserCacheActive; // Have our own local copy - should be faster to access
2008-12-20 10:39:29 +00:00
}
2006-12-02 04:36:16 +00:00
2008-12-20 10:39:29 +00:00
// Ensures the feed list is loaded - uses cache if available
function readFeedList ( $force = FALSE )
{
2013-11-02 01:58:14 -07:00
$sql = e107 :: getDb ();
2008-12-20 10:39:29 +00:00
if ( $this -> validFeedList && ! $force )
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
return ; // Already got list
}
2013-11-02 01:58:14 -07:00
if ( $this -> useCache ) // Cache enabled - try to read from that first
{
2016-04-20 17:25:32 -07:00
if ( ! $force && $temp = e107 :: getCache () -> retrieve ( NEWSFEED_LIST_CACHE_TAG ))
2006-12-02 04:36:16 +00:00
{
2015-02-14 23:34:15 -08:00
$this -> feedList = e107 :: unserialize ( $temp );
2008-12-20 10:39:29 +00:00
return ;
}
}
$fieldList = '*' ;
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
if ( $this -> useCache )
{ // Get all fields except the actual news
$fieldList = 'newsfeed_id, newsfeed_name, newsfeed_url, newsfeed_timestamp, newsfeed_description, newsfeed_image, newsfeed_active, newsfeed_updateint' ;
}
2013-11-02 01:58:14 -07:00
2015-02-14 23:34:15 -08:00
if ( $sql -> select ( " newsfeed " , $fieldList , '`newsfeed_active` > 0' )) // Read in all the newsfeed info on the first go
2008-12-20 10:39:29 +00:00
{
2016-02-14 12:15:55 -08:00
while ( $row = $sql -> fetch ())
2008-12-20 10:39:29 +00:00
{
$nfID = $row [ 'newsfeed_id' ];
2013-11-02 01:58:14 -07:00
2016-04-20 17:25:32 -07:00
if ( ! empty ( $row [ 'newsfeed_data' ]))
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
$this -> newsList [ $nfID ][ 'newsfeed_data' ] = $row [ 'newsfeed_data' ]; // Pull out the actual news - might as well since we're here
2016-05-21 09:08:46 -07:00
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
unset ( $row [ 'newsfeed_data' ]); // Don't keep this in memory twice!
}
2016-05-21 09:08:46 -07:00
$this -> newsList [ $nfID ][ 'newsfeed_timestamp' ] = $row [ 'newsfeed_timestamp' ];
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
$this -> feedList [ $nfID ] = $row ; // Put the rest into the feed data
}
$this -> validFeedList = TRUE ;
}
2013-11-02 01:58:14 -07:00
2016-04-20 17:25:32 -07:00
if ( $this -> useCache ) // Cache enabled - we need to save some updated info
{
2015-02-14 23:34:15 -08:00
$temp = e107 :: serialize ( $this -> feedList , FALSE );
2015-02-15 16:07:27 -08:00
e107 :: getCache () -> set ( NEWSFEED_LIST_CACHE_TAG , $temp );
2008-12-20 10:39:29 +00:00
}
}
// Returns the info for a single feed - from cache or memory as appropriate. If time expired, updates the feed.
function getFeed ( $feedID , $force = FALSE )
{
2013-11-02 01:58:14 -07:00
$tp = e107 :: getParser ();
$sql = e107 :: getDb ();
2008-12-20 10:39:29 +00:00
$this -> readFeedList (); // Make sure we've got the feed data.
if ( ! isset ( $this -> feedList [ $feedID ]))
{
if ( NEWSFEED_DEBUG ) echo " Invalid feed number: { $feedID } <br /> " ;
return FALSE ;
}
2016-04-21 10:39:00 -07:00
2016-05-21 09:08:46 -07:00
$maxAge = ( $this -> feedList [ $feedID ][ 'newsfeed_updateint' ] / 60 );
if ( $maxAge < 1 ){ $maxAge = 1 ; }
// e107::getDebug()->log("NewsFeed #".$feedID." MaxAge: ".$maxAge);
$cachedData = e107 :: getCache () -> retrieve ( NEWSFEED_NEWS_CACHE_TAG . $feedID , $maxAge , true );
if ( empty ( $this -> newsList [ $feedID ][ 'newsfeed_timestamp' ]) || empty ( $cachedData ) || strpos ( $this -> newsList [ $feedID ][ 'newsfeed_data' ], 'MagpieRSS' )) //BC Fix to update newsfeed_data from v1 to v2 spec.
2013-11-02 01:58:14 -07:00
{
$force = true ;
2016-05-21 09:08:46 -07:00
// e107::getDebug()->log("NewsFeed Force");
}
if ( $cachedData !== false && $force === false )
{
2016-05-21 09:45:15 -07:00
e107 :: getDebug () -> log ( " NewsFeed Cache Used " );
2016-05-21 09:08:46 -07:00
$this -> newsList [ $feedID ][ 'newsfeed_data' ] = $cachedData ;
2013-11-02 01:58:14 -07:00
}
2016-04-21 10:39:00 -07:00
2016-05-21 09:08:46 -07:00
if ( $force === true ) // Need to re-read from source - either no cached data yet, or cache expired
2016-04-20 17:25:32 -07:00
{
2016-05-21 09:45:15 -07:00
e107 :: getDebug () -> log ( " NewsFeed Update: Item # " . $feedID . " " . NEWSFEED_NEWS_CACHE_TAG );
2013-11-02 01:58:14 -07:00
if ( NEWSFEED_DEBUG )
{
2016-04-20 17:25:32 -07:00
e107 :: getLog () -> e_log_event ( 10 , debug_backtrace (), " DEBUG " , " Newsfeed update " , " Refresh item: " . $feedID , FALSE , LOG_TO_ROLLING );
2013-11-02 01:58:14 -07:00
}
2008-12-20 10:39:29 +00:00
require_once ( e_HANDLER . 'xml_class.php' );
$xml = new xmlClass ;
require_once ( e_HANDLER . 'magpie_rss.php' );
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
$dbData = array (); // In case we need to update DB
2013-11-02 01:58:14 -07:00
if ( $rawData = $xml -> getRemoteFile ( $this -> feedList [ $feedID ][ 'newsfeed_url' ])) // Need to update feed
{
2008-12-20 10:39:29 +00:00
$rss = new MagpieRSS ( $rawData );
list ( $newsfeed_image , $newsfeed_showmenu , $newsfeed_showmain ) = explode ( " :: " , $this -> feedList [ $feedID ][ 'newsfeed_image' ]);
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
$temp [ 'channel' ] = $rss -> channel ;
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
if (( $newsfeed_showmenu == 0 ) || ( $newsfeed_showmain == 0 ))
{
$temp [ 'items' ] = $rss -> items ; // Unlimited items
}
else
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
$temp [ 'items' ] = array_slice ( $rss -> items , 0 , max ( $newsfeed_showmenu , $newsfeed_showmain )); // Limited items
}
2006-12-02 04:36:16 +00:00
2008-12-20 10:39:29 +00:00
$newsfeed_des = FALSE ;
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
if ( $this -> feedList [ $feedID ][ 'newsfeed_description' ] == 'default' )
{
$temp [ 'newsfeed_description' ] = 'default' ; // This prevents db writes if no better data found
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
if ( $rss -> channel [ 'description' ])
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
$newsfeed_des = $tp -> toDB ( $rss -> channel [ 'description' ]);
$temp [ 'newsfeed_description' ] = $newsfeed_des ;
}
2013-11-02 01:58:14 -07:00
elseif ( $rss -> channel [ 'tagline' ])
2008-12-20 10:39:29 +00:00
{
$newsfeed_des = $tp -> toDB ( $rss -> channel [ 'tagline' ]);
$temp [ 'newsfeed_description' ] = $newsfeed_des ;
}
if ( $temp [ 'newsfeed_description' ] != $this -> feedList [ $feedID ][ 'newsfeed_description' ])
{ // Need to write updated feed name to DB
$this -> feedList [ $feedID ][ 'newsfeed_description' ] = $temp [ 'newsfeed_description' ];
$dbData [ 'newsfeed_description' ] = $temp [ 'newsfeed_description' ];
if ( $this -> useCache )
2006-12-02 04:36:16 +00:00
{
2016-04-20 17:25:32 -07:00
e107 :: getCache () -> clear ( NEWSFEED_LIST_CACHE_TAG ); // Clear the newsfeed cache so its re-read next time
2006-12-02 04:36:16 +00:00
}
}
2008-12-20 10:39:29 +00:00
}
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
if ( $newsfeed_image == 'default' )
{
2009-07-25 07:54:36 +00:00
$temp [ 'newsfeed_image_link' ] = " <a href=' " . $rss -> image [ 'link' ] . " ' rel='external'><img src=' " . $rss -> image [ 'url' ] . " ' alt=' " . $rss -> image [ 'title' ] . " ' style='vertical-align: middle;' /></a> " ;
2008-12-20 10:39:29 +00:00
}
else
{
2016-04-20 17:25:32 -07:00
$temp [ 'newsfeed_image_link' ] = ! empty ( $newsfeed_image ) ? " <img src=' " . $newsfeed_image . " ' alt='' /> " : '' ;
2008-12-20 10:39:29 +00:00
}
2013-11-02 01:58:14 -07:00
2016-04-20 17:25:32 -07:00
$serializedArray = e107 :: serialize ( $temp , false );
2006-12-02 04:36:16 +00:00
2008-12-20 10:39:29 +00:00
$now = time ();
$this -> newsList [ $feedID ][ 'newsfeed_data' ] = $serializedArray ;
$this -> newsList [ $feedID ][ 'newsfeed_timestamp' ] = $now ;
if ( $this -> useCache )
{
2016-05-21 09:08:46 -07:00
// e107::getDebug()->log("Saving Cache");
e107 :: getCache () -> set ( NEWSFEED_NEWS_CACHE_TAG . $feedID , $serializedArray , true );
2008-12-20 10:39:29 +00:00
}
2016-05-21 09:08:46 -07:00
$dbData [ 'newsfeed_data' ] = $serializedArray ;
$dbData [ 'newsfeed_timestamp' ] = $now ;
2013-11-02 01:58:14 -07:00
if ( count ( $dbData )) // Only write the feed data to DB if not using cache. Write description if changed
2016-04-20 17:25:32 -07:00
{
$dbData [ 'WHERE' ] = " newsfeed_id= " . $feedID ;
2016-05-21 09:08:46 -07:00
2016-04-20 17:25:32 -07:00
if ( FALSE === $sql -> update ( 'newsfeed' , $dbData ))
2008-12-20 10:39:29 +00:00
{
2016-05-21 09:08:46 -07:00
// e107::getDebug()->log("NewsFeed DB Update Failed");
2008-12-20 10:39:29 +00:00
if ( NEWSFEED_DEBUG ) echo NFLAN_48 . " <br /><br /> " . var_dump ( $dbData );
}
2006-12-02 04:36:16 +00:00
}
2008-12-20 10:39:29 +00:00
unset ( $rss );
}
else
{
if ( NEWSFEED_DEBUG ) echo $xml -> error ;
return FALSE ;
2006-12-02 04:36:16 +00:00
}
}
2013-11-02 01:58:14 -07:00
2015-02-14 23:34:15 -08:00
return e107 :: unserialize ( $this -> newsList [ $feedID ][ 'newsfeed_data' ]);
2006-12-02 04:36:16 +00:00
}
2008-12-20 10:39:29 +00:00
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
// Return text for the required news feeds (loads info as necessary)
// Uses different templates for main and menu areas
function newsfeedInfo ( $which , $where = 'main' )
2006-12-02 04:36:16 +00:00
{
2013-11-02 01:58:14 -07:00
$tp = e107 :: getParser ();
2016-04-20 17:25:32 -07:00
2008-12-20 10:39:29 +00:00
global $NEWSFEED_MAIN_START , $NEWSFEED_MAIN , $NEWSFEED_MAIN_END ;
global $NEWSFEED_MENU_START , $NEWSFEED_MENU , $NEWSFEED_MENU_END ;
2006-12-02 04:36:16 +00:00
if ( $which == 'all' )
{
2008-12-20 10:39:29 +00:00
$filter = 0 ;
2006-12-02 04:36:16 +00:00
}
else
{
2008-12-20 10:39:29 +00:00
$filter = intval ( $which );
2006-12-02 04:36:16 +00:00
}
$text = " " ;
2008-12-20 10:39:29 +00:00
$this -> readFeedList (); // Make sure we've got all the news feeds loaded
2006-12-02 04:36:16 +00:00
/* get template */
2016-04-20 17:25:32 -07:00
if ( file_exists ( THEME . " templates/newsfeed/newsfeed_menu_template.php " )) //v2.x
{
include ( THEME . " templates/newsfeed/newsfeed_menu_template.php " );
}
elseif ( file_exists ( THEME . " newsfeed_menu_template.php " )) //v1.x
2006-12-02 04:36:16 +00:00
{
include ( THEME . " newsfeed_menu_template.php " );
}
else
{
include ( e_PLUGIN . " newsfeed/templates/newsfeed_menu_template.php " );
}
2016-04-20 17:25:32 -07:00
$vars = array ();
2008-12-20 10:39:29 +00:00
foreach ( $this -> feedList as $nfID => $feed )
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
if (( $filter == 0 ) || ( $filter == $feed [ 'newsfeed_id' ]))
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
if (( $rss = $this -> getFeed ( $nfID ))) // Call ensures that feed is updated if necessary
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
list ( $newsfeed_image , $newsfeed_showmenu , $newsfeed_showmain ) = explode ( " :: " , $feed [ 'newsfeed_image' ]);
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
$numtoshow = intval ( $where == 'main' ? $newsfeed_showmain : $newsfeed_showmenu );
$numtoshow = ( $numtoshow > 0 ? $numtoshow : 999 );
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDNAME' ] = " <a href=' " . e_SELF . " ?show. { $feed [ 'newsfeed_id' ] } '> " . $tp -> toHtml ( $feed [ 'newsfeed_name' ], false , 'TITLE' ) . " </a> " ;
$vars [ 'FEEDDESCRIPTION' ] = $feed [ 'newsfeed_description' ];
$vars [ 'FEEDIMAGE' ] = $rss [ 'newsfeed_image_link' ];
$vars [ 'FEEDLANGUAGE' ] = $rss [ 'channel' ][ 'language' ];
2008-12-20 10:39:29 +00:00
if ( $rss [ 'channel' ][ 'lastbuilddate' ])
2006-12-02 04:36:16 +00:00
{
2008-12-20 10:39:29 +00:00
$pubbed = $rss [ 'channel' ][ 'lastbuilddate' ];
}
else if ( $rss [ 'channel' ][ 'dc' ][ 'date' ])
{
$pubbed = $rss [ 'channel' ][ 'dc' ][ 'date' ];
2006-12-02 04:36:16 +00:00
}
else
{
2008-12-20 10:39:29 +00:00
$pubbed = NFLAN_34 ;
}
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDLASTBUILDDATE' ] = NFLAN_33 . $pubbed ;
$vars [ 'FEEDCOPYRIGHT' ] = $tp -> toHTML ( vartrue ( $rss [ 'channel' ][ 'copyright' ]), FALSE );
$vars [ 'FEEDTITLE' ] = " <a href=' " . $rss [ 'channel' ][ 'link' ] . " ' rel='external'> " . vartrue ( $rss [ 'channel' ][ 'title' ]) . " </a> " ;
$vars [ 'FEEDLINK' ] = $rss [ 'channel' ][ 'link' ];
2013-11-02 01:58:14 -07:00
if ( $feed [ 'newsfeed_active' ] == 2 or $feed [ 'newsfeed_active' ] == 3 )
2008-12-20 10:39:29 +00:00
{
2016-04-20 17:25:32 -07:00
$vars [ 'LINKTOMAIN' ] = " <a href=' " . e_PLUGIN . " newsfeed/newsfeed.php?show. " . $feed [ 'newsfeed_id' ] . " '> " . NFLAN_39 . " </a> " ;
2008-12-20 10:39:29 +00:00
}
else
{
2016-04-20 17:25:32 -07:00
$vars [ 'LINKTOMAIN' ] = " " ;
2008-12-20 10:39:29 +00:00
}
$data = " " ;
$numtoshow = min ( $numtoshow , count ( $rss [ 'items' ]));
$i = 0 ;
while ( $i < $numtoshow )
{
$item = $rss [ 'items' ][ $i ];
2013-11-02 01:58:14 -07:00
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDITEMLINK' ] = " <a href=' " . $item [ 'link' ] . " ' rel='external'> " . $tp -> toHTML ( $item [ 'title' ], FALSE ) . " </a> \n " ;
$vars [ 'FEEDITEMLINK' ] = str_replace ( '&' , '&' , $vars [ 'FEEDITEMLINK' ]);
$feeditemtext = preg_replace ( " # \ [[a-z0-9=]+ \ ]| \ [ \ /[a-z]+ \ ]| \ { [A-Z_]+ \ }#si " , " " , strip_tags ( $item [ 'description' ]));
$vars [ 'FEEDITEMCREATOR' ] = $tp -> toHTML ( vartrue ( $item [ 'author' ]), FALSE );
2013-11-02 01:58:14 -07:00
2008-12-20 10:39:29 +00:00
if ( $where == 'main' )
{
2016-04-20 17:25:32 -07:00
if ( ! empty ( $NEWSFEED_COLLAPSE ))
2008-12-20 10:39:29 +00:00
{
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDITEMLINK' ] = " <a href='#' onclick='expandit(this)'> " . $tp -> toHTML ( $item [ 'title' ], FALSE ) . " </a>
2008-12-20 10:39:29 +00:00
< div style = 'display:none' >
" ;
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDITEMTEXT' ] = preg_replace ( " /[.*]/ " , " " , $tp -> toHTML ( $item [ 'description' ], FALSE )) . "
2008-12-20 10:39:29 +00:00
< br />< br />< a href = '".$item[' link ']."' rel = 'external' > " .NFLAN_44. " </ a >< br />< br />
</ div > " ;
}
else
{
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDITEMLINK' ] = " <a href=' " . $item [ 'link' ] . " ' rel='external'> " . $tp -> toHTML ( $item [ 'title' ], FALSE ) . " </a> \n " ;
$vars [ 'FEEDITEMLINK' ] = str_replace ( '&' , '&' , $vars [ 'FEEDITEMLINK' ]);
$feeditemtext = preg_replace ( " # \ [[a-z0-9=]+ \ ]| \ [ \ /[a-z]+ \ ]| \ { [A-Z_]+ \ }#si " , " " , $item [ 'description' ]);
$vars [ 'FEEDITEMTEXT' ] = $tp -> toHTML ( $feeditemtext , FALSE ) . " \n " ;
2008-12-20 10:39:29 +00:00
}
2016-04-20 17:25:32 -07:00
$data .= $tp -> simpleParse ( $NEWSFEED_MAIN , $vars );
2008-12-20 10:39:29 +00:00
}
else
{
if ( $this -> truncateCount )
{
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDITEMTEXT' ] = $tp -> text_truncate ( $feeditemtext , $this -> truncateCount , $this -> truncateMore );
2008-12-20 10:39:29 +00:00
}
else
{
2016-04-20 17:25:32 -07:00
$vars [ 'FEEDITEMTEXT' ] = '' ; // Might just want title
2008-12-20 10:39:29 +00:00
}
2016-04-20 17:25:32 -07:00
$data .= $tp -> simpleParse ( $NEWSFEED_MENU , $vars );
2008-12-20 10:39:29 +00:00
}
$i ++ ;
2006-12-02 04:36:16 +00:00
}
}
2008-12-20 10:39:29 +00:00
}
2006-12-02 04:36:16 +00:00
2008-12-20 10:39:29 +00:00
if ( $where == 'main' )
{
2016-04-20 17:25:32 -07:00
$vars [ 'BACKLINK' ] = " <a href=' " . e_SELF . " '> " . NFLAN_31 . " </a> " ;
$text = $tp -> simpleParse ( $NEWSFEED_MAIN_START , $vars ) . $data . $tp -> simpleParse ( $NEWSFEED_MAIN_END , $vars );
2008-12-20 10:39:29 +00:00
}
else
{
2016-04-20 17:25:32 -07:00
$text .= $tp -> simpleParse ( $NEWSFEED_MENU_START , $vars ) . $data . $tp -> simpleParse ( $NEWSFEED_MENU_END , $vars );
2006-12-02 04:36:16 +00:00
}
2016-04-20 17:25:32 -07:00
//TODO Move the $vars into their own shortcode class and change simpleParse to parseTemplate();
2006-12-02 04:36:16 +00:00
}
if ( $which == 'all' )
{
2016-04-19 16:57:44 -07:00
$ret [ 'title' ] = ( ! empty ( $NEWSFEED_MENU_CAPTION )) ? $NEWSFEED_MENU_CAPTION : '' ;
2006-12-02 04:36:16 +00:00
}
else
{
2016-04-20 17:25:32 -07:00
$ret [ 'title' ] = $feed [ 'newsfeed_name' ] . " " . varset ( $NEWSFEED_MAIN_CAPTION );
2006-12-02 04:36:16 +00:00
}
$ret [ 'text' ] = $text ;
return $ret ;
}
}
?>