Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
/blog/ -> rsslib.php (source)

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

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

return: string
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

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

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

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

return: string
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

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

return: bool whether the save was successful or not
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

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