this modified version of the inlineRSS plugin. Version: 0.2 Author: Dave Elcock Author URI: http://dave.stufftoread.net/ */ // This is the main slideshow function that does the real work. See // DGE_SlideShow_contentFilter() below for what to put in the $params // array. function DGE_SlideShow_format($ssid, $url, $params=array()) { // Oh bugger, these are just cut-and-pasted from inlineRSS.php. // It'd be better if there was some interface to ask inlineRSS // what its settings were. $paramfile = 'inlineRSS.txt'; // Configuration file of feeds $fileprefix = 'in_'; // What feed casual names get prefixed with // Some other variables. $xsltParams = array(); $xsltParams['ssid'] = $ssid; $inlineRSSname = "dge-slideshow-".$ssid; $cachefile = ABSPATH . "wp-content/" . $fileprefix . $inlineRSSname . ".html"; // First up must be a check for a preset so that other parameters // passed to this function can override the preset. if (array_key_exists('preset', $params)) { if (($presets = get_option('dge_ss_presets')) && ($preset = $presets[$params['preset']])) { $params = array_merge($preset, $params); } } if (array_key_exists('timeout', $params)) $timeout = intval($params['timeout']); else $timeout = get_option('dge_ss_def_timeout'); if (array_key_exists('reverse', $params)) $xsltFile = "dge-slideshow/reverse.xslt"; else $xsltFile = "dge-slideshow/forward.xslt"; if (array_key_exists('limit', $params)) $xsltParams['limit'] = $params['limit']; // Look for an existing cache and find out how old it is if ( file_exists($cachefile)) { $age = time() - filectime($cachefile); $exists = TRUE; } else { $age = 0; $exists = FALSE; } // If there's no file, or the existing one's old, run through // inlineRSS and create a new cache file. if ( $exists == FALSE or $age > $timeout * 60 ) { $inlineRSSout = inlineRSSparserWithParams( $inlineRSSname, $url, 1, $xsltFile, $xsltParams); if (empty($inlineRSSout)) { if ($exists == FALSE) { die("Error creating slideshow $ssid: inlineRSS failed."); } $writefile = FALSE; } else { // This is a hack to replace the _m.jpg in the filenames // supplied in the feed with just .jpg. This is so that we // get a bigger, better quality image in the slideshow. // The _o.jpg filter cuts out loading of enormous original // photos from Flickr streams. if (get_option('dge_ss_mo_snip')) $output = preg_replace('/_[mo]\.jpg/', '.jpg', $inlineRSSout); else $output = $inlineRSSout; $writefile = TRUE; } if ($writefile) { if (!($handle = fopen($cachefile,'w'))) die ("Error opening $cachefile - possible permissions issue - directory permissions are " . substr(sprintf('%o', fileperms(ABSPATH . "wp-content/")), -4)); fwrite($handle,$output); fclose($handle); } } else { // We have a local copy, so fetch it. $output = file_get_contents($cachefile); } return $output; } function DGE_SlideShow_explodeParams($paramString) { $params = array(); foreach (explode(';', $paramString) as $param) { list($arg,$v) = explode('=', $param); $params[$arg] = $v; } return $params; } function DGE_SlideShow_implodeParams($params) { $result = array(); foreach ($params as $key=>$val) { if ($val == '') $result[]=$key; else $result[] = "$key=$val"; } return implode(';', $result); } // This is a Wordpress content filter that replaces occurrences of the // following format: // // !slideshow!![!