Welcome to Geeklog, Anonymous Thursday, April 25 2024 @ 01:33 am EDT

Geeklog Forums

Geeklog rss api


Status: offline

tomw

Forum User
Full Member
Registered: 08/12/02
Posts: 300
curious
In the comment spam plugin I am using the builtin Geeklog rss functions and thought I would share what I have found since the documentation is sparce.

For a plugin to use the builtin RSS content syndication it needs to implement three functions in functions.inc.

plugin_getfeednames_pluginname()
plugin_getfeedcontent_pluginname()
plugin_feedupdatecheck_pluginname()

where pluginname is the name of the plugin.

The first function plugin_getfeednames_pluginname()
receives no parameters and returns a multidimensional associative array of id/name pairs where 'id' is an integer representing the plugins internal id and 'name' is what the user will see. Thus the plugin will have code like this:
Text Formatted Code

$feed = array(
    array(
      'id'       => 1,
      'name'  => 'Name of Feed'
    ),
    array(
     'id'        => 2,
     'name'   => 'Name of another feed'
    )
);
return $feed;
 


The second function plugin_getfeedcontent_pluginname()
receives three parameters: $feed, $link, $update_data.
The plugin is expected to return a multidimensional associative array holding the content of the feed and to fill in 'link' (some link that represents the same content on the site as that in the feed) and 'update_data' (to be stored for later up-to-date checks. The function will have some code like this:
Text Formatted Code

global $_CONF;

$link = $_CONF['site_url'] . '/pluginname/index.php';
$update_data = time();
$content=array();
foreach($ARRAY OF DATA as $s) {
   $item = array(
       'title' => $s,
       'link'  => $_CONF['site_url'] . '/pluginname/index.php'
    );
    $content[]=$item;
}
return $content;

 


The final function plugin_feedupdatecheck_pluginname()
receives $feed, $topic, $update_data, $limit where
$feed == feed number (meaningless)
$topic == plugin id for feed
$update_data == is data stored by the previous function
$limit == number of items to include (configurable in editor)

The function returns true if the feed is up to date and false otherwise.

Thats about it.

Some questions for Dirk or someone else who knows.

1) Did I get it right?
2) Can you have the functions create rdf files anywhere else besides /backend?

TomW
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
$feed is Geeklog's id for the feed. It can be used to access the gl_syndication table and get information for the feed that is not passed to the functions.

The associative array that plugin_getfeedcontent_xxx returns should have more entries than the 2 you listed:

'text', e.g. the story's text,
'uid', of the author (or owner or similar),
'date', well, what would that be?
'format', can be 'text' or 'html'

The RSS feed class that ships with Geeklog does not use all of those, but Mike's feed writer classes may use some of them.

Feed files will always be stored in the directory specified by $_CONF['rdf_file'].

bye, Dirk
 Quote

Status: offline

tomw

Forum User
Full Member
Registered: 08/12/02
Posts: 300
Thanks for the correction on the content function.

$_CONF['rdf_file'] lists the path to the geeklog.rdf

are you saying you strip the directory off this and put all other rdf files here also?

TomW
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by tomw: $_CONF['rdf_file'] lists the path to the geeklog.rdf

are you saying you strip the directory off this and put all other rdf files here also?

Yep.

bye, Dirk
 Quote

All times are EDT. The time is now 01:33 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content