DGE_InlineRSS 0.94 or greater. Version: 0.41 Author: Dave E Author URI: http://dave.coolhandmook.com/ */ // See readme.txt for how to call this function function DGE_SlideShow($ssid, $url, $params=array()) { // Steal these settings from inlinerss $cacheprefix = get_option('dge_irss_cacheprefix'); $cachepath = get_option('dge_irss_cachepath'); // Some other variables. $inlineRSSname = 'dge-ss-'.$ssid; $cachefile = ABSPATH . $cachepath . '/' . $cacheprefix . $inlineRSSname . '.ss'; $stage1xsl = "dge-slideshow/xsl/rssfeed.xsl"; $stage2xsl = "dge-slideshow/dge-slideshow.xsl"; $stage2params = array(); // defaults $play = intval(get_option('dge_ss_def_play')); $repeat = intval(get_option('dge_ss_def_repeat')); $delay = floatval(get_option('dge_ss_def_delay')); $thumbs = intval(get_option('dge_ss_def_thumbs')); $timeout = intval(get_option('dge_ss_def_timeout')); $html = 0; // First up must be a check for a preset so that other parameters // passed to this function can override the preset. if ($presets = get_option('dge_ss_presets')) { $presetName = ''; // Look for preset name in the parameters if (array_key_exists('preset', $params)) { $presetName = $params['preset']; } // otherwise look for an auto preset else if ($autoPresets = get_option('dge_ss_auto_presets')) { foreach ($autoPresets as $regexp => $pn) if (preg_match($regexp, $url)) { $presetName = $pn; break; } } // Find the preset and merge those settings with the function // parameters. Funciont parameters take precedence over preset // parameters. if ($presetName && ($preset = $presets[$presetName])) { $params = array_merge($preset, $params); } } if (array_key_exists('timeout', $params)) $timeout = intval($params['timeout']); if (array_key_exists('reverse', $params)) $stage2params['order'] = "descending"; if (array_key_exists('limit', $params)) $stage2params['limit'] = $params['limit']; if (array_key_exists('delay', $params)) $delay = $params['delay']; if (array_key_exists('repeat', $params)) $repeat = 1; if (array_key_exists('norepeat', $params)) $repeat = 0; if (array_key_exists('play', $params)) $play = 1; if (array_key_exists('pause', $params)) $play = 0; if (array_key_exists('thumbs', $params)) $thumbs = $params['thumbs']; if (array_key_exists('html', $params)) $html = 1; // This must go last, to override any preset xsl files if (array_key_exists('xslt', $params)) $stage1xsl = $params['xslt']; // 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 ) { $input = dge_irss_fetch($url); $stage1xml = "\n" . dge_irss_translate($input, $stage1xsl, $html, array()); $stage2xml = dge_irss_translate($stage1xml, $stage2xsl, false, $stage2params); if (empty($stage2xml)) { if ($exists == FALSE) { return "\n"; } $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', $stage2xml); else $output = $stage2xml; $writefile = TRUE; } $output = "
  • first
  • previous
  • play
  • pause
  • next
  • last
  • maximise
  • minimise

 

    $output
\n"; if ($writefile) { if (!($handle = fopen($cachefile,'w'))) return "\n"; fwrite($handle,$output); fclose($handle); } } else { // We have a local copy, so fetch it. $output = file_get_contents($cachefile); } return $output; } // This is a Wordpress content filter that replaces occurrences of the // following format: // // !slideshow!![!