PHP Code:
<?php
/**
* SGS Module: RSS
* File: functions.php
*
* Copyright (c) 2007 - 2010 Big Fish Games, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @author William Moffett <william.moffett@bigfishgames.com>
* @version 0.8
* @package PNP Tools
* @subpackage SGS
*
* @copyright Copyright (c) 2007 - 2010 Big Fish Games, Inc.
* @license http://creativecommons.org/licenses/GPL/2.0/ Creative Commons GNU GPL
*/
function toRSS($string){
$search = array(" & ", "\n");
$replace = array(' & ','');
return str_replace($search,$replace,$string);
}
function create_rss($feed){
global $sl, $config;
$sl->class['site_parse']->settag('G_ABSOLUTE', g_ABSOLUTE);
$genre = $sl->class['site_genre']->getAllowedGenre();
if(!$feed || !in_array($feed, array_merge($genre,array('new-download','top-download')))){
$feed = 'glrelease';
}
if($feed == 'new-download'){
$feed = 'glrelease';
}else if($feed == 'top-download'){
$feed = 'glrank';
}
/**
* get the current genreID and information
*/
$genreId = $sl->class['site_genre']->getGenreKey($feed);
$ginfo = $sl->class['site_genre']->getGenreInfo($genreId);
/**
* load templates
*/
$sl->class['site_parse']->load_template(g_MODULES.'rss/templates/item.xml','item');
$sl->class['site_parse']->load_template(g_MODULES.'rss/templates/page.xml','page');
$domainPath = str_replace(array($config['module_dir'].'/','rss/'),array('',''),g_ABSOLUTE);
$agent = $_SERVER['HTTP_USER_AGENT'];
$pubdate = gmdate("r",time());
switch ($feed){
case 'glrelease':
$games = $sl->class['site_download']->getDateList('10');
break;
case 'glrank':
$games = $sl->class['site_download']->getRankList('10');
break;
default:
$genreId = $sl->class['site_genre']->getGenreKey($feed);
if(!$genreId){
$genreId = $sl->class['site_genre']->getGenreKey('glrelease');
}
$games = $sl->class['site_download']->getRankList('10','0', array('genre'=>$genreId));
}
$search = array(" & ", "\n");
$replace = array(' & ','');
$sl->class['site_parse']->settag('TITLE',SITENAME.' - '.toRSS($ginfo['name']));
$sl->class['site_parse']->settag('LINK',$domainPath);
$sl->class['site_parse']->settag('LANGUAGE',LOCAL);
$sl->class['site_parse']->settag('PUBDATE',$pubdate);
$sl->class['site_parse']->settag('DESCRIPTION', toRSS($ginfo['description']));
// $featureGame = FALSE;
$items = '';
foreach($games as $key=>$game){
unset($games[$key]);
$game = array_change_key_case($game, CASE_LOWER);
$game = $sl->class['site_game']->gameInfo($game);
/*
if(!$featureGame){
$game['media'] = '<media:thumbnail url="'.$game['feature'].'"/>';
$featureGame = TRUE;
}else{
$game['media'] = '<media:thumbnail url="'.$game['med'].'"/>';
}
if($game['hasvideo'] == 'yes' && isset($game['video_url'])){
$game['media'] .= '<media:content type="video/x-flv" url="'.$game['video_url'].'"/>';
}else{
$game['media'] .= '<media:content url="'.$game['subfeature'].'"/>';
}
*/
$game['itemtitle'] = $game['gamename'];
/**
* todo Sun, 19 May 2002 15:21:36 GMT
*/
$game['itemreleasedate'] = $game['releasedate'];
$game['itemlink'] = $domainPath.$game['gameinfo_url'];
/**
* <author>{ITEMAUTHOR}</author>
*/
/**
* TODO COMMENT <comments>{ITEMCOMMENTS}</comments>
*/
//$game['itemcomments'] = $domainPath.$game['gameinfo_url'];
/**
* todo do we really need this <guid>{ITEMGUID}</guid>
*/
//$game['itemguid'] = $domainPath.$game['gameinfo_url'];
$game['itemdescription'] = '<![CDATA['.$sl->class['site_elements']->imageTag($sl->class['site_game']->getImageAsset('small',$game), $game['itemtitle'], $id='', $class='', $height='', $width='', $js='', $longdesc='').']]>';
$game['itemdescription'] .= str_replace('&','&',$game['longdesc']);
$items .= $sl->class['site_parse']->render_template('item',$game,TRUE);
}
return $items;
}
?>
About the images, well I checked other account mmmm maybe you can not publish the images, so all is good