display_cached_file() public method

This is most useful for caching images (get_favicon(), etc.), however it works for all cached files. This WILL NOT display ANY file/image/page/whatever, but rather only display what has already been cached by SimplePie.
See also: SimplePie::get_favicon()
public display_cached_file ( str $identifier_url, str $cache_location = './cache', str $cache_extension = 'spc', str $cache_class = 'SimplePie_Cache', str $cache_name_function = 'md5' )
$identifier_url str URL that is used to identify the content. This may or may not be the actual URL of the live content.
$cache_location str Location of SimplePie's cache. Defaults to './cache'.
$cache_extension str The file extension that the file was cached with. Defaults to 'spc'.
$cache_class str Name of the cache-handling class being used in SimplePie. Defaults to 'SimplePie_Cache', and should be left as-is unless you've overloaded the class.
$cache_name_function str Obsolete. Exists for backwards compatibility reasons only.
Esempio n. 1
0
 * @package Lilina
 * @version 1.0
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */
/** */
define('LILINA_PATH', dirname(__FILE__));
define('LILINA_INCPATH', LILINA_PATH . '/inc');
define('LILINA_PAGE', 'favicon');
// Hide errors
ini_set('display_errors', false);
require_once LILINA_INCPATH . '/contrib/simplepie.class.php';
if (!isset($_GET['i'])) {
    die;
}
require_once LILINA_INCPATH . '/core/conf.php';
require_once LILINA_INCPATH . '/core/plugin-functions.php';
function faux_hash($input)
{
    return $input;
}
if ($_GET['i'] != 'default' && file_exists(LILINA_CACHE_DIR . $_GET['i'] . '.spi')) {
    SimplePie_Misc::display_cached_file($_GET['i'], LILINA_CONTENT_DIR . '/system/cache', 'spi', 'SimplePie_Cache', 'faux_hash');
} else {
    require_once LILINA_INCPATH . '/core/class-templates.php';
    Locale::load_default_textdomain();
    header('Content-Type: image/png');
    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT');
    // 7 days
    echo file_get_contents(Templates::get_file('feed.png'));
    die;
}
Esempio n. 2
0
<?php

require_once "config.php";
require_once "lib/simplepie/simplepie.inc";
SimplePie_Misc::display_cached_file($_GET['i'], SIMPLEPIE_CACHE_DIR, 'spi');
Esempio n. 3
0
<?php

// This should be modifed as your own use warrants.
require_once 'simplepie.inc';
SimplePie_Misc::display_cached_file($_GET['i'], '../../phorum5/cache', 'spi');
Esempio n. 4
0
<?php

/*
 * This file is part of FEED ON FEEDS - http://feedonfeeds.com/
 *
 * favicon.php - displays an image cached by SimplePie
 *
 *
 * Copyright (C) 2004-2007 Stephen Minutillo
 * steve@minutillo.com - http://minutillo.com/steve/
 *
 * Distributed under the GPL - see LICENSE
 *
 */
require_once 'simplepie/simplepie.inc';
if (file_exists("./cache/" . md5($_GET[i]) . ".spi")) {
    SimplePie_Misc::display_cached_file($_GET['i'], './cache', 'spi');
} else {
    header("Location: image/feed-icon.png");
}