Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_rss

Namespaces

namespace  core_rss\privacy
  
 

Classes

class  core_rss\privacy\provider
 Privacy class for requesting user data. More...
 
class  core_rss_renderer
 Web service documentation renderer extending the plugin_renderer_base class. More...
 

Functions

 rss_add_enclosures ($item)
 Adds RSS Media Enclosures for "podcasting" by including attachments that are specified in the item->attachments field.
 
 rss_add_http_header ($context, $componentname, $componentinstance, $title)
 Build the URL for the RSS feed and add it as a header.
 
 rss_add_items ($items)
 Generates the rss XML code for every item passed in the array.
 
 rss_delete_file ($componentname, $instance)
 Given an object, deletes all RSS files associated with it.
 
 rss_delete_token ($userid)
 Removes the token for the given user from the DB.
 
 rss_enabled_for_mod ($modname, $instance=null, $hasrsstype=true, $hasrssarticles=true)
 Are RSS feeds enabled for the supplied module instance?
 
 rss_end_tag ($tag, $level=0, $endline=true)
 Return the xml end tag.
 
 rss_full_tag ($tag, $level, $endline, $content, $attributes=null)
 Return the while xml element, including content.
 
 rss_get_file_full_name ($componentname, $filename)
 Retrieve the location and file name of a cached RSS feed.
 
 rss_get_file_name ($instance, $sql, $params=array())
 Construct the file name of the RSS File.
 
 rss_get_link ($contextid, $userid, $componentname, $id, $tooltiptext='')
 Print the link for the RSS feed with the correct RSS icon.
 
 rss_get_token ($userid)
 Get the RSS Token from a given user id.
 
 rss_get_url ($contextid, $userid, $componentname, $additionalargs)
 This function returns the URL for the RSS XML file.
 
 rss_get_userid_from_token ($token)
 Get the ID of the user from a given RSS Token.
 
 rss_geterrorxmlfile ($errortype='rsserror')
 This function return an error xml file (string) to be sent when a rss is required (file.php) and something goes wrong.
 
 rss_print_link ($contextid, $userid, $componentname, $id, $tooltiptext='')
 Print the link for the RSS feed with the correct RSS icon (Theme based)
 
 rss_save_file ($componentname, $filename, $contents, $expandfilename=true)
 This function saves to file the rss feed specified in the parameters.
 
 rss_standard_footer ()
 This function return all the common footers for every rss feed in the site.
 
 rss_standard_header ($title=NULL, $link=NULL, $description=NULL)
 This function return all the common headers for every rss feed in the site.
 
 rss_start_tag ($tag, $level=0, $endline=false, $attributes=null)
 Return the xml start tag.
 

Detailed Description

Function Documentation

◆ rss_add_enclosures()

rss_add_enclosures ( $item)

Adds RSS Media Enclosures for "podcasting" by including attachments that are specified in the item->attachments field.

Parameters
stdClass$itemrepresenting an RSS item
Return values
stringRSS enclosure tags

◆ rss_add_http_header()

rss_add_http_header ( $context,
$componentname,
$componentinstance,
$title )

Build the URL for the RSS feed and add it as a header.

Parameters
stdClass$contextThe context under which the URL should be created
string$componentnameThe name of the component for which the RSS feed exists
stdClass$componentinstanceThe instance of the component
string$titleName for the link to be added to the page header

◆ rss_add_items()

rss_add_items ( $items)

Generates the rss XML code for every item passed in the array.

item->title: The title of the item item->author: The author of the item. Optional !! item->pubdate: The pubdate of the item item->link: The link url of the item item->description: The content of the item

Parameters
array$itemsan array of item objects
Return values
bool|stringthe rss XML code for every item passed in the array

◆ rss_delete_file()

rss_delete_file ( $componentname,
$instance )

Given an object, deletes all RSS files associated with it.

Parameters
string$componentnamethe name of the module ie 'forum'. Used to construct the cache path.
stdClass$instanceAn object with an id member variable ie $forum, $glossary.

◆ rss_delete_token()

rss_delete_token ( $userid)

Removes the token for the given user from the DB.

Parameters
int$useridThe user id for the token you wish to delete

◆ rss_enabled_for_mod()

rss_enabled_for_mod ( $modname,
$instance = null,
$hasrsstype = true,
$hasrssarticles = true )

Are RSS feeds enabled for the supplied module instance?

Parameters
string$modnameThe name of the module to be checked
stdClass$instanceAn instance of an activity module ie $forum, $glossary.
bool$hasrsstypeShould there be a rsstype member variable?
bool$hasrssarticlesShould there be a rssarticles member variable?
Return values
boolwhether or not RSS is enabled for the module

◆ rss_end_tag()

rss_end_tag ( $tag,
$level = 0,
$endline = true )

Return the xml end tag.

Parameters
string$tagthe xml tag name
int$levelthe indentation level
bool$endlinewhether or not to start new tags on a new line
Return values
stringthe xml end tag

◆ rss_full_tag()

rss_full_tag ( $tag,
$level,
$endline,
$content,
$attributes = null )

Return the while xml element, including content.

Parameters
string$tagthe xml tag name
int$levelthe indentation level
bool$endlinewhether or not to start new tags on a new line
string$contentthe text to go inside the tag
array$attributesthe attributes of the xml tag
Return values
stringthe whole xml element

◆ rss_get_file_full_name()

rss_get_file_full_name ( $componentname,
$filename )

Retrieve the location and file name of a cached RSS feed.

Parameters
string$componentnamethe name of the component the RSS feed is being created for
string$filenamethe name of the RSS FEED
Return values
stringThe full name and path of the RSS file

◆ rss_get_file_name()

rss_get_file_name ( $instance,
$sql,
$params = array() )

Construct the file name of the RSS File.

Parameters
stdClass$instancethe instance of the source of the RSS feed
string$sqlthe SQL used to produce the RSS feed
array$paramsthe parameters used in the SQL query
Return values
stringthe name of the RSS file

◆ rss_get_link()

rss_get_link ( $contextid,
$userid,
$componentname,
$id,
$tooltiptext = '' )

Print the link for the RSS feed with the correct RSS icon.

Parameters
stdClass$contextidThe id of the context under which the URL should be created
int$useridThe source of the RSS feed (site/course/group/user)
string$componentnameThe name of the component for which the feed exists
string$idThe name by which to call the RSS File
string$tooltiptextThe tooltip to be displayed with the link
Return values
stringHTML output for the RSS link

◆ rss_get_token()

rss_get_token ( $userid)

Get the RSS Token from a given user id.

Parameters
int$useridThe user id
Return values
stringthe RSS token for the user

◆ rss_get_url()

rss_get_url ( $contextid,
$userid,
$componentname,
$additionalargs )

This function returns the URL for the RSS XML file.

Parameters
int$contextidthe course id
int$useridthe current user id
string$componentnamethe name of the current component. For example "forum"
string$additionalargsFor modules, module instance id
Return values
stringthe url of the RSS feed

◆ rss_get_userid_from_token()

rss_get_userid_from_token ( $token)

Get the ID of the user from a given RSS Token.

Parameters
string$tokenthe RSS token you would like to use to find the user id
Return values
intThe user id

◆ rss_geterrorxmlfile()

rss_geterrorxmlfile ( $errortype = 'rsserror')

This function return an error xml file (string) to be sent when a rss is required (file.php) and something goes wrong.

Parameters
string$errortypeType of error to send, default is rsserror
Return values
stdClassreturns a XML Feed with an error message in it

◆ rss_print_link()

rss_print_link ( $contextid,
$userid,
$componentname,
$id,
$tooltiptext = '' )

Print the link for the RSS feed with the correct RSS icon (Theme based)

Parameters
stdClass$contextidThe id of the context under which the URL should be created
int$useridThe source of the RSS feed (site/course/group/user)
string$componentnameThe name of the component for which the feed exists
string$idThe name by which to call the RSS File
string$tooltiptextThe tooltip to be displayed with the link

◆ rss_save_file()

rss_save_file ( $componentname,
$filename,
$contents,
$expandfilename = true )

This function saves to file the rss feed specified in the parameters.

Parameters
string$componentnamethe module name ie forum. Used to create a cache directory.
string$filenamethe name of the file to be created ie "rss.xml"
string$contentsthe data to be written to the file
bool$expandfilenamewhether or not the fullname of the RSS file should be used
Return values
boolwhether the save was successful or not

◆ rss_standard_footer()

rss_standard_footer ( )

This function return all the common footers for every rss feed in the site.

Return values
string

◆ rss_standard_header()

rss_standard_header ( $title = NULL,
$link = NULL,
$description = NULL )

This function return all the common headers for every rss feed in the site.

Parameters
string$titlethe title for the RSS Feed
string$linkthe link for the origin of the RSS feed
string$descriptionthe description of the contents of the RSS feed
Return values
bool|stringthe standard header for the RSS feed

◆ rss_start_tag()

rss_start_tag ( $tag,
$level = 0,
$endline = false,
$attributes = null )

Return the xml start tag.

Parameters
string$tagthe xml tag name
int$levelthe indentation level
bool$endlinewhether or not to start new tags on a new line
array$attributesthe attributes of the xml tag
Return values
stringthe xml start tag