Advertisement
Guest User

Aron Novak

a guest
Jun 27th, 2008
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.69 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * @file
  5.  *   Describe the planned API functions for aggregator module (D7).
  6.  */
  7.  
  8. /**
  9.  * The parsers have to implement this hook.
  10.  *
  11.  * @param $feed_nodes
  12.  *   Array of the feed nodes. They also contain the feed URL.
  13.  */
  14. function hook_aggregator_parse($feed_nodes) {
  15.  
  16. }
  17.  
  18. /**
  19.  * The processors have to implement this hook.
  20.  *
  21.  * @param $op
  22.  *   'save' or 'delete'
  23.  *   'save' also behaves as 'update'
  24.  * @param $items
  25.  *   When 'save', array of parsed items.
  26.  *   When 'delete', array of item IDs.
  27.  */
  28. function hook_aggregator_process($op, $items) {
  29.  
  30. }
  31.  
  32. /**
  33.  * Downloads the given feed, if changed, call the parsers, cache the parser result, call the processors.
  34.  *
  35.  * @param $feeds
  36.  *   array of nid's of the feeds.
  37.  */
  38. function aggregator_feed_refresh($feeds) {
  39.  
  40. }
  41.  
  42. /**
  43.  * Builds and initializes a feed object.
  44.  * It does not download the feed. it just creates the basic structure
  45.  *
  46.  * @param $url
  47.  *   The URL of the feed.
  48.  * @param $type
  49.  *   The content-type of the feed node, this determines the feed configuration.
  50.  * @return
  51.  *   The node-feed object
  52.  */
  53. function aggregator_feed_create($url, $type) {
  54.  
  55. }
  56.  
  57. /**
  58.  * Downloads and parses the feeds. populates $node objects and add the items to it.
  59.  * Also it caches the parsed results. But it does not save the feed nor the items.
  60.  *
  61.  * @param $feed_nodes
  62.  *   The node-feed objects (come from aggregator_feed_create).
  63.  */
  64. function aggregator_feed_retrieve($feed_nodes) {
  65.  
  66. }
  67.  
  68. /**
  69.  * Show the feed to the user.
  70.  * The $feed can be with or without feed items.
  71.  * A possible use-case: $output = theme('aggregator_feed_preview', $feed);
  72.  *
  73.  * @param $feed
  74.  *   The node-feed object
  75.  *
  76.  */
  77. function theme_aggregator_feed_preview($feed) {
  78.  
  79. }
  80.  
  81. /**
  82.  * Save the feed object, it becomes a node and metadata about the feed.
  83.  * If the node-feed contains the items, the processors are called to save them.
  84.  *
  85.  * @param $feed
  86.  *   The node-feed object with our without the items.
  87.  */
  88. function aggregator_feed_save($feed) {
  89.  
  90. }
  91.  
  92.  
  93.  
  94. /**
  95.  * List all the feeds essential information.
  96.  *
  97.  * @param $type
  98.  *   Filter the listing by node type.
  99.  * @return
  100.  *   array ('nid' => array('url' => , 'title' => , 'description' => )
  101.  */
  102. function aggregator_feed_list($type = FALSE) {
  103.  
  104. }
  105.  
  106. /**
  107.  * Downloads a HTTP url. It handles redirections (only HTTP), feed autodetection,
  108.  * If-Modified-Since and If-None-Match
  109.  *
  110.  * @param $url
  111.  *   Absolute HTTP URL
  112.  */
  113. function aggregator_download($url) {
  114.  
  115. }
  116.  
  117. /**
  118.  * For loading a feed fully, use node_load().
  119.  */
  120.  
  121. /**
  122.  * For deleting a feed, use node_delete().
  123.  * It won't delete feed items. Arguments for this: performance and linkrot.
  124.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement