本文整理汇总了PHP中Cache::hash方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::hash方法的具体用法?PHP Cache::hash怎么用?PHP Cache::hash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache::hash方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_embed
//.........这里部分代码省略.........
}
$flashvars .= 'width=' . $width . '&height=' . $height;
// if there is a static image for this video, use it
if (isset($item['icon_url']) && $item['icon_url']) {
$flashvars .= '&startimage=' . urlencode($item['icon_url']);
}
// if there is a subtitle file for this video, use it
if (isset($item['file_name']) && ($srt = 'files/' . str_replace(':', '/', $item['anchor']) . '/' . str_replace('.' . $extension, '.srt', $item['file_name'])) && file_exists($context['path_to_root'] . $srt)) {
$flashvars .= '&srt=1&srturl=' . urlencode($context['url_to_home'] . $context['url_to_root'] . $srt);
}
// if there is a logo file in the skin, use it
Skin::define_img_href('FLV_IMG_HREF', 'codes/flvplayer_logo.png', '');
if (FLV_IMG_HREF) {
$flashvars .= '&top1=' . urlencode(FLV_IMG_HREF . '|10|10');
}
// rely on Flash
if (Surfer::has_flash()) {
// the full object is built in Javascript --see parameters at http://flv-player.net/players/maxi/documentation/
$output = '<div id="flv_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var flashvars = { flv:"' . $url . '", ' . str_replace(array('&', '='), array('", ', ':"'), $flashvars) . '", autoload:0, margin:1, showiconplay:1, playeralpha:50, iconplaybgalpha:30, showfullscreen:1, showloading:"always", ondoubleclick:"fullscreen" }' . "\n" . 'var params = { allowfullscreen: "true", allowscriptaccess: "always" }' . "\n" . 'var attributes = { id: "file_' . $item['id'] . '", name: "file_' . $item['id'] . '"}' . "\n" . 'swfobject.embedSWF("' . $flvplayer_url . '", "flv_' . $item['id'] . '", "' . $width . '", "' . $height . '", "9", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", flashvars, params);' . "\n");
// native support
} else {
// <video> is HTML5, <object> is legacy
$output = '<video width="' . $width . '" height="' . $height . '" autoplay="" controls="" src="' . $url . '" >' . "\n" . ' <object width="' . $width . '" height="' . $height . '" data="' . $url . '" type="' . Files::get_mime_type($item['file_name']) . '">' . "\n" . ' <param value="' . $url . '" name="movie" />' . "\n" . ' <param value="true" name="allowFullScreen" />' . "\n" . ' <param value="always" name="allowscriptaccess" />' . "\n" . ' <a href="' . $url . '">No video playback capabilities, please download the file</a>' . "\n" . ' </object>' . "\n" . '</video>' . "\n";
}
// job done
return $output;
// a ganttproject timeline
// a ganttproject timeline
case 'gan':
// where the file is
$path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
// we actually use a transformed version of the file
$cache_id = Cache::hash($path) . '.xml';
// apply the transformation
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) < filemtime($context['path_to_root'] . $path) || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
// transform from GanttProject to SIMILE Timeline
$text = Files::transform_gan_to_simile($path);
// put in cache
Safe::file_put_contents($cache_id, $text);
}
// load the SIMILE Timeline javascript library in shared/global.php
$context['javascript']['timeline'] = TRUE;
// cache would kill the loading of the library
cache::poison();
// 1 week ago
$now = gmdate('M d Y H:i:s', time() - 7 * 24 * 60 * 60);
// load the right file
$output = '<div id="gantt" style="height: ' . $height . '; width: ' . $width . '; border: 1px solid #aaa; font-family: Trebuchet MS, Helvetica, Arial, sans serif; font-size: 8pt"></div>' . "\n";
Page::insert_script('var simile_handle;' . "\n" . 'function onLoad() {' . "\n" . ' var eventSource = new Timeline.DefaultEventSource();' . "\n" . ' var theme = Timeline.ClassicTheme.create();' . "\n" . ' theme.event.bubble.width = 350;' . "\n" . ' theme.event.bubble.height = 300;' . "\n" . ' var bandInfos = [' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "80%",' . "\n" . ' intervalUnit: Timeline.DateTime.WEEK,' . "\n" . ' intervalPixels: 200,' . "\n" . ' theme: theme,' . "\n" . ' layout: "original" // original, overview, detailed' . "\n" . ' }),' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' showEventText: false,' . "\n" . ' trackHeight: 0.5,' . "\n" . ' trackGap: 0.2,' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "20%",' . "\n" . ' intervalUnit: Timeline.DateTime.MONTH,' . "\n" . ' intervalPixels: 50' . "\n" . ' })' . "\n" . ' ];' . "\n" . ' bandInfos[1].syncWith = 0;' . "\n" . ' bandInfos[1].highlight = true;' . "\n" . ' bandInfos[1].eventPainter.setLayout(bandInfos[0].eventPainter.getLayout());' . "\n" . ' simile_handle = Timeline.create(document.getElementById("gantt"), bandInfos, Timeline.HORIZONTAL);' . "\n" . ' simile_handle.showLoadingMessage();' . "\n" . ' Timeline.loadXML("' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", function(xml, url) { eventSource.loadXML(xml, url); });' . "\n" . ' simile_handle.hideLoadingMessage();' . "\n" . '}' . "\n" . "\n" . 'var resizeTimerID = null;' . "\n" . 'function onResize() {' . "\n" . ' if (resizeTimerID == null) {' . "\n" . ' resizeTimerID = window.setTimeout(function() {' . "\n" . ' resizeTimerID = null;' . "\n" . ' simile_handle.layout();' . "\n" . ' }, 500);' . "\n" . ' }' . "\n" . '}' . "\n" . "\n" . '// observe page major events' . "\n" . '$(document).ready( onLoad);' . "\n" . '$(window).resize(onResize);' . "\n");
// job done
return $output;
// a Freemind map
// a Freemind map
case 'mm':
// if we have an external reference, use it
if (isset($item['file_href']) && $item['file_href']) {
$target_href = $item['file_href'];
// else redirect to ourself
} else {
// ensure a valid file name
$file_name = utf8::to_ascii($item['file_name']);
// where the file is
$path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
// map the file on the regular web space
$url_prefix = $context['url_to_home'] . $context['url_to_root'];
示例2: array
if (!$permitted) {
// give anonymous surfers a chance for HTTP authentication
if (!Surfer::is_logged()) {
Safe::header('WWW-Authenticate: Basic realm="' . utf8::to_iso8859($context['site_name']) . '"');
Safe::header('Status: 401 Unauthorized', TRUE, 401);
}
// permission denied to authenticated user
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// display feed content
} else {
// get the list from the cache, if possible
if (is_object($anchor)) {
$cache_id = Cache::hash('comments/feed/' . $anchor->get_reference) . '.xml';
} else {
$cache_id = Cache::hash('comments/feed') . '.xml';
}
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
$text = '';
// loads feeding parameters
Safe::load('parameters/feeds.include.php');
// set channel information
$values = array();
$values['channel'] = array();
if (is_object($anchor)) {
$values['channel']['title'] = sprintf(i18n::s('Comments for: %s'), $anchor->get_title());
$values['channel']['link'] = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
$values['channel']['description'] = $anchor->get_teaser('quote');
} else {
$values['channel']['title'] = sprintf(i18n::s('Recent comments at %s'), $context['site_name']);
示例3: layout
/**
* list articles
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// sanity check
if (!isset($this->focus)) {
$this->focus = 'map';
}
// put in cache
$cache_id = Cache::hash('articles/layout_articles_as_carrousel:' . $this->focus) . '.xml';
// save for one minute
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 60 < time()) {
// content of the slideshow
$content = '<?xml version="1.0" encoding="utf-8"?><!-- fhShow Carousel 2.0 configuration file Please visit http://www.flshow.net/ -->' . "\n" . '<slide_show>' . "\n" . ' <options>' . "\n" . ' <debug>false</debug> <!-- true, false -->' . "\n" . ' <background>transparent</background> <!-- #RRGGBB, transparent -->' . "\n" . ' <friction>5</friction> <!-- [1,100] -->' . "\n" . ' <fullscreen>false</fullscreen> <!-- true, false -->' . "\n" . ' <margins>' . "\n" . ' <top>0</top> <!-- [-1000,1000] pixels -->' . "\n" . ' <left>0</left> <!-- [-1000,1000] pixels -->' . "\n" . ' <bottom>0</bottom> <!-- [-1000,1000] pixels -->' . "\n" . ' <right>0</right> <!-- [-1000,1000] pixels -->' . "\n" . ' <horizontal_ratio>20%</horizontal_ratio> <!-- [1,50] a photo may occupy at most horizontalRatio percent of the Carousel width -->' . "\n" . ' <vertical_ratio>90%</vertical_ratio> <!-- [1,100] a photo may occupy at most verticalRatio percent of the Carousel height -->' . "\n" . ' </margins>' . "\n" . ' <interaction>' . "\n" . ' <rotation>mouse</rotation> <!-- auto, mouse, keyboard -->' . "\n" . ' <view_point>none</view_point> <!-- none, mouse, keyboard -->' . "\n" . ' <speed>15</speed> <!-- [-360,360] degrees per second -->' . "\n" . ' <default_speed>15</default_speed> <!-- [-360,360] degrees per second -->' . "\n" . ' <default_view_point>20%</default_view_point> <!-- [0,100] percentage -->' . "\n" . ' <reset_delay>20</reset_delay> <!-- [0,600] seconds, 0 means never reset -->' . "\n" . ' </interaction>' . "\n" . ' <far_photos>' . "\n" . ' <size>50%</size> <!-- [0,100] percentage -->' . "\n" . ' <amount>50%</amount> <!-- [0,100] percentage -->' . "\n" . ' <blur>10</blur> <!-- [0,100] amount -->' . "\n" . ' <blur_quality>3</blur_quality> <!-- [1,3] 1=low - 3=high -->' . "\n" . ' </far_photos>' . "\n" . ' <reflection>' . "\n" . ' <amount>25</amount> <!-- [0,1000] pixels -->' . "\n" . ' <blur>2</blur> <!-- [0,100] blur amount -->' . "\n" . ' <distance>0</distance> <!-- [-1000,1000] pixels -->' . "\n" . ' <alpha>40%</alpha> <!-- [0,100] percentage -->' . "\n" . ' </reflection>' . "\n" . ' <titles>' . "\n" . ' <style>font-size: 14px; font-family: Verdana, _serif; color: #000000;</style>' . "\n" . ' <position>above center</position> <!-- [above, below] [left,center,right]-->' . "\n" . ' <background>' . $context['url_to_home'] . $context['url_to_root'] . 'skins/_reference/layouts/carrousel_bubble.png</background> <!-- image url -->' . "\n" . ' <scale9>35 35 35 35</scale9> <!-- [0,1000] pixels -->' . "\n" . ' <padding>8 15 10 15</padding> <!-- [-1000,1000] pixels -->' . "\n" . ' </titles>' . "\n" . ' </options>' . "\n";
// get a default image
if (Safe::GetImageSize($context['path_to_root'] . $context['skin'] . '/layouts/map.gif')) {
$default_href = $context['url_to_root'] . $context['skin'] . '/layouts/map.gif';
} elseif ($size = Safe::GetImageSize($context['path_to_root'] . 'skins/_reference/layouts/map.gif')) {
$default_href = $context['url_to_root'] . 'skins/_reference/layouts/map.gif';
} else {
$default_href = NULL;
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// this is visual
if (isset($item['icon_url']) && $item['icon_url']) {
$image = $item['icon_url'];
} elseif (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
$image = $item['thumbnail_url'];
} elseif (is_callable(array($anchor, 'get_bullet_url')) && ($image = $anchor->get_bullet_url())) {
} elseif ($default_href) {
$image = $default_href;
} else {
continue;
}
// fix relative path
if (!preg_match('/^(\\/|http:|https:|ftp:)/', $image)) {
$image = $context['url_to_home'] . $context['url_to_root'] . $image;
}
// build a title
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// the url to view this item
$url = Articles::get_permalink($item);
// add to the list
$content .= ' <photo>' . "\n" . ' <title>' . $title . '</title>' . "\n" . ' <src>' . $image . '</src>' . "\n" . ' <href>' . $url . '</href>' . "\n" . ' <target>_self</target>' . "\n" . ' </photo>' . "\n";
}
// finalize slideshow content
$content .= '</slide_show>';
// put in cache
Safe::file_put_contents($cache_id, $content);
}
// allow multiple instances
static $count;
if (!isset($count)) {
$count = 1;
} else {
$count++;
}
// load the right file
$text = '<div id="articles_as_carrousel_' . $count . '"></div>' . "\n";
Page::insert_script('swfobject.embedSWF("' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/carrousel.swf",' . "\n" . '"articles_as_carrousel_' . $count . '",' . "\n" . '"100%",' . "\n" . '"150",' . "\n" . '"9.0.0",' . "\n" . 'false,' . "\n" . '{xmlfile:"' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", loaderColor:"0x666666"},' . "\n" . '{wmode: "transparent"},' . "\n" . '{});' . "\n");
// end of processing
SQL::free($result);
return $text;
}
示例4: load_skin
* @link https://www.google.com/webmasters/sitemaps/docs/en/protocol.html Sitemap Protocol Contents
*
* @author Bernard Paques
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// common definitions and initial processing
include_once 'shared/global.php';
// required by Google
$context['charset'] = 'utf-8';
// load localized strings
i18n::bind('root');
// load a skin engine
load_skin('sitemap');
// get the list from the cache, if possible
$cache_id = Cache::hash('sitemap') . '.xml';
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
$text = '';
// the preamble
$text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
// the front page
$text .= ' <url>' . "\n" . ' <loc>' . $context['url_to_home'] . $context['url_to_root'] . '</loc>' . "\n" . ' <changefreq>weekly</changefreq>' . "\n" . ' <priority>1.0</priority>' . "\n" . ' </url>' . "\n\n";
// the site map
$text .= ' <url>' . "\n" . ' <loc>' . $context['url_to_home'] . $context['url_to_root'] . 'sections/</loc>' . "\n" . ' <changefreq>weekly</changefreq>' . "\n" . ' <priority>1.0</priority>' . "\n" . ' </url>' . "\n\n";
// main sections
if ($items = Sections::list_by_title_for_anchor(NULL, 0, 25, 'raw')) {
foreach ($items as $id => $item) {
$text .= ' <url>' . "\n" . ' <loc>' . encode_link(Sections::get_permalink($item)) . '</loc>' . "\n" . ' <changefreq>weekly</changefreq>' . "\n" . ' </url>' . "\n\n";
}
}
示例5: load_skin
* it is included into the feed as well.
*
* @link http://www.w3.org/2003/01/geo/ RDFIG Geo vocab workspace
*
* @author Bernard Paques
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// common definitions and initial processing
include_once '../shared/global.php';
// ensure we only provide public content through newsfeeds
$context['users_without_teasers'] = 'Y';
// load the rendering skin
load_skin('feeds');
// get the list from the cache, if possible
$cache_id = Cache::hash('feeds/rdf') . '.xml';
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
$text = '';
// loads feeding parameters
Safe::load('parameters/feeds.include.php');
// set default values
if (!isset($context['channel_title']) || $context['channel_title']) {
$context['channel_title'] = $context['site_name'];
}
if (!isset($context['channel_description']) || !$context['channel_description']) {
$context['channel_description'] = $context['site_description'];
}
if (!isset($context['webmaster_address']) || !$context['webmaster_address']) {
$context['webmaster_address'] = $context['site_email'];
}
示例6: layout
/**
* list articles
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// load the SIMILE Timeline javascript library in shared/global.php
$context['javascript']['timeline'] = TRUE;
// sanity check
if (!isset($this->focus)) {
$this->focus = 'default';
}
// put in cache
$cache_id = Cache::hash('articles/layout_articles_as_simile:' . $this->focus) . '.xml';
// save for one minute
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 60 < time()) {
// content of the slideshow
$content = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<data>' . "\n";
// get a default image
if (Safe::GetImageSize($context['path_to_root'] . $context['skin'] . '/layouts/map.gif')) {
$default_href = $context['url_to_root'] . $context['skin'] . '/layouts/map.gif';
} elseif ($size = Safe::GetImageSize($context['path_to_root'] . 'skins/_reference/layouts/map.gif')) {
$default_href = $context['url_to_root'] . 'skins/_reference/layouts/map.gif';
} else {
$default_href = NULL;
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// start
if ($item['publish_date'] > $item['create_date']) {
$first = Skin::build_date($item['publish_date'], 'plain');
} else {
$first = Skin::build_date($item['create_date'], 'plain');
}
// end
$last = Skin::build_date($item['edit_date'], 'plain');
if ($last != $first) {
$last = ' end="' . $last . '"';
} else {
$last = '';
}
// build a title
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// the url to view this item
$url = str_replace('&', '&', Articles::get_permalink($item));
// this is visual
if (isset($item['icon_url']) && $item['icon_url']) {
$image = $item['icon_url'];
} elseif (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
$image = $item['thumbnail_url'];
} else {
$image = '';
}
// fix relative path
if ($image && !preg_match('/^(\\/|http:|https:|ftp:)/', $image)) {
$image = $context['url_to_root'] . $image;
}
if ($image) {
$image = ' image="' . $image . '"';
}
// introduction
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} else {
$introduction = $item['introduction'];
}
// insert overlay data, if any
if (is_object($overlay) && ($data = $overlay->get_text('list', $item))) {
if ($introduction) {
$introduction .= BR;
}
$introduction .= $data;
}
// ampersands kill SIMILE Timeline
if ($introduction) {
$introduction = encode_field(str_replace(array(' ', '&'), ' ', Codes::beautify($introduction)));
}
// details
$details = array();
// info on related comments
//.........这里部分代码省略.........
示例7: load_skin
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// common definitions and initial processing
include_once '../shared/global.php';
include_once 'feeds.php';
// ensure we only provide public content through newsfeeds
$context['users_without_teasers'] = 'Y';
// check network credentials, if any
if ($user = Users::authenticate()) {
Surfer::empower($user['capability']);
}
// load a skin engine
load_skin('feeds');
// get the list from the cache, if possible
$cache_id = Cache::hash('feeds/describe') . '.xml';
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
$text = '';
// loads feeding parameters
Safe::load('parameters/feeds.include.php');
// set default values
if (!isset($context['channel_title']) || $context['channel_title']) {
$context['channel_title'] = $context['site_name'];
}
if (!isset($context['channel_description']) || !$context['channel_description']) {
$context['channel_description'] = $context['site_description'];
}
if (!isset($context['webmaster_address']) || !$context['webmaster_address']) {
$context['webmaster_address'] = $context['site_email'];
}
示例8: load_skin
/**
* provide news in the atom format
*
* @author Bernard Paques
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// common definitions and initial processing
include_once '../shared/global.php';
// ensure we only provide public content through newsfeeds
$context['users_without_teasers'] = 'Y';
// load the rendering skin
load_skin('feeds');
// get the list from the cache, if possible
$cache_id = Cache::hash('feeds/atom') . '.xml';
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
$text = '';
// loads feeding parameters
Safe::load('parameters/feeds.include.php');
// set default values
if (!isset($context['channel_title']) || $context['channel_title']) {
$context['channel_title'] = $context['site_name'];
}
if (!isset($context['channel_description']) || !$context['channel_description']) {
$context['channel_description'] = $context['site_description'];
}
if (!isset($context['webmaster_address']) || !$context['webmaster_address']) {
$context['webmaster_address'] = $context['site_email'];
}
示例9: load_skin
* @author Bernard Paques
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// common definitions and initial processing
include_once '../shared/global.php';
// ensure we only provide public content through newsfeeds
$context['users_without_teasers'] = 'Y';
// check network credentials, if any
if ($user = Users::authenticate()) {
Surfer::empower($user['capability']);
}
// load a skin engine
load_skin('articles');
// get the list from the cache, if possible
$cache_id = Cache::hash('articles/feed') . '.xml';
// save for 5 minutes
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) + 300 < time() || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
$text = '';
// load feeding parameters
Safe::load('parameters/feeds.include.php');
// set default values
if (!isset($context['channel_title']) || !$context['channel_title']) {
$context['channel_title'] = $context['site_name'];
}
if (!isset($context['channel_description']) || !$context['channel_description']) {
$context['channel_description'] = $context['site_description'];
}
if (!isset($context['webmaster_address']) || !$context['webmaster_address']) {
$context['webmaster_address'] = $context['site_email'];
}