Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
/blog/ -> rsslib.php (source)

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

Blog RSS Management

Copyright: 2010 Andrew Davis
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 332 lines (12 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 8 functions


Functions that are not part of a class:

blog_rss_get_url($contextid, $userid, $filtertype, $filterselect = 0, $tagid = 0)   X-Ref
Build the URL for the RSS feed

param: int    $contextid    The context under which the URL should be created
param: int    $userid       The id of the user requesting the RSS Feed
param: string $filtertype   The source of the RSS feed (site/course/group/user)
param: int    $filterselect The id of the item defined by $filtertype
param: int    $tagid        The id of the row in the tag table that identifies the RSS Feed
return: string

blog_rss_print_link($context, $filtertype, $filterselect = 0, $tagid = 0, $tooltiptext = '')   X-Ref
Print the link for the RSS feed with the correct RSS icon (Theme based)

param: stdClass    $context      The context under which the URL should be created
param: string      $filtertype   The source of the RSS feed (site/course/group/user)
param: int         $filterselect The id of the item defined by $filtertype
param: int         $tagid        The id of the row in the tag table that identifies the RSS Feed
param: string      $tooltiptext  The tooltip to be displayed with the link

blog_rss_add_http_header($context, $title, $filtertype, $filterselect = 0, $tagid = 0)   X-Ref
Build the URL for the RSS feed amd add it as a header

param: stdClass    $context      The context under which the URL should be created
param: string      $title        Name for the link to be added to the page header
param: string      $filtertype   The source of the RSS feed (site/course/group/user)
param: int         $filterselect The id of the item defined by $filtertype
param: int         $tagid        The id of the row in the tag table that identifies the RSS Feed

blog_rss_get_params($filters)   X-Ref
Utility function to extract parameters needed to generate RSS URLs from the blog filters

param: array $filters filters for the blog
return: array array containing the id of the user/course/group, the relevant context and the filter type: site/user/course/group

blog_rss_get_feed($context, $args)   X-Ref
Generate any blog RSS feed via one function

param: stdClass $context The context of the blog for which the feed it being generated
param: array    $args    An array of arguements needed to build the feed (contextid, token, componentname, type, id, tagid)

blog_rss_file_name($type, $id, $tagid = 0)   X-Ref
Retrieve the location and file name of a cached RSS feed

param: string $type  The source of the RSS feed (site/course/group/user)
param: int    $id    The id of the item defined by $type
param: int    $tagid The id of the row in the tag table that identifies the RSS Feed
return: string

blog_rss_save_file($type, $id, $tagid = 0, $contents = '')   X-Ref
This function saves to file the rss feed specified in the parameters

param: string $type     The source of the RSS feed (site/course/group/user)
param: int    $id       The id of the item defined by $type
param: int    $tagid    The id of the row in the tag table that identifies the RSS Feed
param: string $contents The contents of the RSS Feed file
return: bool whether the save was successful or not

blog_rss_delete_file($userid)   X-Ref
Delete the supplied user's cached blog post RSS feed.
Only user blogs are available by RSS.
This doesn't call rss_delete_file() as blog RSS caching uses it's own file structure.

param: int $userid