rss MDL-23391 made lib/rsslib.php more generic

This commit is contained in:
Andrew Davis 2010-07-21 02:11:53 +00:00
parent e269084401
commit 43b92251be
9 changed files with 40 additions and 37 deletions

View file

@ -19,7 +19,7 @@
$dataid = $args[3];
$data = $DB->get_record('data', array('id' => $dataid), '*', MUST_EXIST);
if (!rss_enabled('data', $data, false, true)) {
if (!rss_enabled_for_mod('data', $data, false, true)) {
return null;
}
@ -27,7 +27,7 @@
//get the cache file info
$filename = rss_get_file_name($data, $sql);
$cachedfilepath = rss_get_file_full_name('data', $filename);
$cachedfilepath = rss_get_file_full_name('mod_data', $filename);
//Is the cache out of date?
$cachedfilelastmodified = 0;
@ -91,7 +91,7 @@
$rss = $header.$articles.$footer;
//Save the XML contents to file.
$status = rss_save_file('data', $filename, $rss);
$status = rss_save_file('mod_data', $filename, $rss);
}
}

View file

@ -267,7 +267,7 @@
$meta = '';
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
$rsstitle = format_string($course->shortname) . ': %fullname%';
rss_add_http_header($context, 'data', $data, $rsstitle);
rss_add_http_header($context, 'mod_data', $data, $rsstitle);
}
if ($data->csstemplate) {
$PAGE->requires->css('/mod/data/css.php?d='.$data->id);

View file

@ -83,7 +83,7 @@
require_once("$CFG->libdir/rsslib.php");
$rsstitle = format_string($course->shortname) . ': %fullname%';
rss_add_http_header($modcontext, 'forum', $forum, $rsstitle);
rss_add_http_header($modcontext, 'mod_forum', $forum, $rsstitle);
}
if ($forum->type == 'news') {

View file

@ -63,7 +63,7 @@ function forum_rss_get_feed($context, $args) {
$forum = $DB->get_record('forum', array('id' => $forumid), '*', MUST_EXIST);
if (!rss_enabled('forum', $forum)) {
if (!rss_enabled_for_mod('forum', $forum)) {
return null;
}
@ -72,7 +72,7 @@ function forum_rss_get_feed($context, $args) {
//hash the sql to get the cache file name
$filename = rss_get_file_name($forum, $sql);
$cachedfilepath = rss_get_file_full_name('forum', $filename);
$cachedfilepath = rss_get_file_full_name('mod_forum', $filename);
//Is the cache out of date?
$cachedfilelastmodified = 0;
@ -83,7 +83,7 @@ function forum_rss_get_feed($context, $args) {
//need to regenerate the cached version
$result = forum_rss_feed_contents($forum, $sql);
if (!empty($result)) {
$status = rss_save_file('forum',$filename,$result);
$status = rss_save_file('mod_forum',$filename,$result);
}
}
@ -98,7 +98,7 @@ function forum_rss_get_feed($context, $args) {
* @return void
*/
function forum_rss_delete_file($forum) {
rss_delete_file('forum', $forum);
rss_delete_file('mod_forum', $forum);
}
///////////////////////////////////////////////////////

View file

@ -94,7 +94,7 @@
require_once("$CFG->libdir/rsslib.php");
$rsstitle = format_string($course->shortname) . ': %fullname%';
rss_add_http_header($context, 'forum', $forum, $rsstitle);
rss_add_http_header($context, 'mod_forum', $forum, $rsstitle);
}
/// Print header.

View file

@ -22,7 +22,7 @@
$glossaryid = $args[3];
$glossary = $DB->get_record('glossary', array('id' => $glossaryid), '*', MUST_EXIST);
if (!rss_enabled('glossary', $glossary)) {
if (!rss_enabled_for_mod('glossary', $glossary)) {
return null;
}
@ -30,7 +30,7 @@
//get the cache file info
$filename = rss_get_file_name($glossary, $sql);
$cachedfilepath = rss_get_file_full_name('glossary', $filename);
$cachedfilepath = rss_get_file_full_name('mod_glossary', $filename);
//Is the cache out of date?
$cachedfilelastmodified = 0;
@ -83,7 +83,7 @@
$rss = $header.$articles.$footer;
//Save the XML contents to file.
$status = rss_save_file('glossary', $filename, $rss);
$status = rss_save_file('mod_glossary', $filename, $rss);
}
}

View file

@ -241,7 +241,7 @@ if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds)
&& $glossary->rsstype && $glossary->rssarticles) {
$rsstitle = format_string($course->shortname) . ': %fullname%';
rss_add_http_header($context, 'glossary', $glossary, $rsstitle);
rss_add_http_header($context, 'mod_glossary', $glossary, $rsstitle);
}
if ($tab == GLOSSARY_APPROVAL_VIEW) {