global $CFG;
$status = true;
-
+
mtrace(' Generating rssfeeds...');
//Check for required functions...
//This function saves to file the rss feed specified in the parameters
function rss_save_file ($modname, $mod, $result) {
-
+
global $CFG;
-
+
$status = true;
if (! $basedir = make_upload_directory ('rss/'. $modname)) {
function rss_add_items($items) {
global $CFG;
-
+
$result = '';
if (!empty($items)) {
//XML Header
$return = rss_standard_header();
- //XML item
+ //XML item
if ($return) {
$item->title = "RSS Error";
$item->link = $CFG->wwwroot;
if ($return) {
$return .= rss_standard_footer();
}
-
+
return $return;
}
$select = '';
$managesharedfeeds = has_capability('block/rss_client:manageanyfeeds', $context);
$manageownfeeds = has_capability('block/rss_client:manageownfeeds', $context);
-
+
if ($rssid != '') {
$select = 'id = '.$rssid.' AND ';
}
if ( ($feed->userid == $USER->id && $manageownfeeds)
|| ($feed->shared && $managesharedfeeds) ) {
-
+
$feedicons = '<a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?id='. $courseid .'&act=rssedit&rssid='. $feed->id .'&shared='.$feed->shared.'&blogid='. $blogid .'">'.
'<img src="'. $CFG->pixpath .'/t/edit.gif" alt="'. get_string('edit').'" title="'. get_string('edit') .'" /></a> '.
-
+
'<a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?id='. $courseid .'&act=delfeed&rssid='. $feed->id.'&shared='.$feed->shared.'blogid='. $blogid .'"
onclick="return confirm(\''. get_string('deletefeedconfirm', 'block_rss_client') .'\');">'.
'<img src="'. $CFG->pixpath .'/t/delete.gif" alt="'. get_string('delete').'" title="'. get_string('delete') .'" /></a>';
<a href="'. $feed->url .'">'. $feed->url .'</a>
</div>
<div class="description">'.$feed->description.'</div>';
-
+
$table->add_data(array($feedinfo, $feedicons));
}
}
$stradd = get_string('add');
$strupdatefeed = get_string('updatefeed', 'block_rss_client');
$straddfeed = get_string('addfeed', 'block_rss_client');
-
+
$returnstring = '';
$returnstring .= '<form action="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php" method="post" id="block_rss">'."\n";
print_location_comment(__FILE__,__LINE__);
- $returnstring .= '<div id="rss_table">'."\n";
+ $returnstring .= '<div id="rss_table">'."\n";
if ($act == 'rssedit') {
- $returnstring .= $strupdatefeed;
- } else {
- $returnstring .= $straddfeed;
+ $returnstring .= $strupdatefeed;
+ } else {
+ $returnstring .= $straddfeed;
}
$returnstring .= "\n".'<br /><input type="text" size="60" maxlength="256" name="url" value="';
- if ($act == 'rssedit') {
- $returnstring .= $url;
+ if ($act == 'rssedit') {
+ $returnstring .= $url;
}
$returnstring .= '" />'."\n";
$returnstring .= '<br />'. get_string('customtitlelabel', 'block_rss_client');
$returnstring .= '<br /><input type="text" size="60" maxlength="128" name="preferredtitle" value="';
- if ($act == 'rssedit') {
- $returnstring .= $preferredtitle;
+ if ($act == 'rssedit') {
+ $returnstring .= $preferredtitle;
}
$returnstring .= '" />'."\n";
$returnstring .= get_string('sharedfeed', 'block_rss_client');
$returnstring .= '<br />'."\n";
}
-
+
$returnstring .= '<input type="hidden" name="act" value="';
if ($act == 'rssedit') {
}
$returnstring .= '" />'."\n";
- if ($act == 'rssedit') {
- $returnstring .= '<input type="hidden" name="rssid" value="'. $rssid .'" />'. "\n";
+ if ($act == 'rssedit') {
+ $returnstring .= '<input type="hidden" name="rssid" value="'. $rssid .'" />'. "\n";
}
$returnstring .= '<input type="hidden" name="id" value="'. $courseid .'" />'."\n";
$returnstring .= '<input type="hidden" name="blogid" value="'. $blogid .'" />'."\n";
$returnstring .= '<input type="hidden" name="user" value="'. $USER->id .'" />'."\n";
$returnstring .= '<br /><input type="submit" value="';
- $validatestring = "<a href=\"#\"
-onclick=\"window.open('http://feedvalidator.org/check.cgi?url='+getElementId('block_rss').elements['url'].value,'validate','width=640,height=480,scrollbars=yes,status=yes,resizable=yes');return true;\">". get_string('validatefeed', 'block_rss_client')."</a>";
+ $validatestring = "<a href=\"#\" onclick=\"window.open('http://feedvalidator.org/check.cgi?url='+getElementId('block_rss').elements['url'].value,'validate','width=640,height=480,scrollbars=yes,status=yes,resizable=yes');return true;\">". get_string('validatefeed', 'block_rss_client')."</a>";
if ($act == 'rssedit') {
$returnstring .= $stredit;
/**
* Adds RSS Media Enclosures for "podcasting" by examining links to media files,
-* and attachments which are media files. Please note that the RSS that is
+* and attachments which are media files. Please note that the RSS that is
* produced cannot be strictly valid for the linked files, since we do not know
-* the files' sizes and cannot include them in the "length" attribute. At
+* the files' sizes and cannot include them in the "length" attribute. At
* present, the validity (and therefore the podcast working in most software)
* can only be ensured for attachments, and not for links.
-* Note also that iTunes does some things very badly - one thing it does is
+* Note also that iTunes does some things very badly - one thing it does is
* refuse to download ANY of your files if you're using "file.php?file=blah"
-* and can't use the more elegant "file.php/blah" slasharguments setting. It
-* stops after ".php" and assumes the files are not media files, despite what
+* and can't use the more elegant "file.php/blah" slasharguments setting. It
+* stops after ".php" and assumes the files are not media files, despite what
* is specified in the "type" attribute. Dodgy coding all round!
-*
+*
* @param $item object representing an RSS item
* @return string RSS enclosure tags
* @author Hannes Gassert <hannes@mediagonal.ch>
$returnstring = '';
$rss_text = $item->description;
-
+
// list of media file extensions and their respective mime types
include_once($CFG->libdir.'/filelib.php');
$mediafiletypes = get_mimetypes_array();
$returnstring .= "\n<enclosure url=\"$attachment->url\" length=\"$attachment->length\" type=\"$type\" />\n";
}
}
-
+
if (!preg_match_all($medialinkpattern, $rss_text, $matches)){
return $returnstring;
}
- // loop over matches of regular expression
+ // loop over matches of regular expression
for ($i = 0; $i < count($matches[2]); $i++){
$url = htmlspecialchars($matches[2][$i]);
$extension = strtolower($matches[3][$i]);
// the rss_*_tag functions can't deal with methods, unfortunately
$returnstring .= "\n<enclosure url='$url' type='$type' />\n";
}
-
+
return $returnstring;
}
?>