/[drupal]/contributions/modules/aggregation/feed_handlers/example.inc
ViewVC logotype

Diff of /contributions/modules/aggregation/feed_handlers/example.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3 by mistknight, Fri Feb 23 07:08:10 2007 UTC revision 1.3.4.1 by mistknight, Sat Apr 19 23:36:08 2008 UTC
# Line 15  Line 15 
15   */   */
16  function _aggregation_example_parse($feed_XML, $feed)  function _aggregation_example_parse($feed_XML, $feed)
17  {  {
         return;  
   
18          // loop over items in feed. For each item prepare the needed parameters,          // loop over items in feed. For each item prepare the needed parameters,
19          // then call _aggregation_add_item, dummy calls with info below...          // then call _aggregation_add_item, dummy calls with info below...
20    
21          // Note : If in VERY rare occasions you need to process a feed URL present in this current feed, you can do that by calling          // Foreach item in $feed_XML
         // aggregation_get_URL, then passing the result to aggregation_get_XML.You are strongly encouraged to wrap any calls  
         // to these function in try catch statements. If any error occurs, simply throw the exception and the module will  
         // handle logging the error!  
   
         // can be ommitted, then URL will be our image GUID  
         $image_array['guid'] = $image_guid;  
   
         // can be ommitted, then image will take article's title  
         $image_array['title'] = $image_title;  
   
         // if any of these is ommitted, the $image_title will be used instead  
         $image_array['teaser'] = $image_teaser;  
         $image_array['body'] = $image_body;  
   
         // This is A MUST if you're interested in getting an image  
         $image_array['url'] = $image_url;  
   
         // can be ommitted, then image will take current time  
         $image_array['timestamp'] = $image_timestamp;  
   
   
         // Create additional taxonomies if the feed contains categories you'd like to preserve  
   
         $additional_taxonomies = array();  
         // Create a vocabulary named "vocab_new_1" if it doesn't already exist. Next create "term_new_1", "term_new_2" if they  
         // don't exist. If vocabulary or terms exist, the item will go under them! This is sort of an auto-taxonomy technique!  
         $additional_taxonomies['vocab_new_1'] = array('term_new_1', 'term_new_2');  
   
         // Same goes here, create as many as you'd like to capture terms already present in the feed  
         $additional_taxonomies['vocab_new_2'] = array('term_new_3', 'term_new_4');  
22    
23          // let's pass these arguments to the module by calling _aggregation_add_item                  // Note : If in VERY rare occasions (ex. NEWSML) you need to process a feed URL present in this current feed,
24          _aggregation_add_item($title, $body, $teaser, $original_author, $feed, $additional_taxonomies, $timestamp, $original_item_url, $guid, $image_array);                  // you can do that by calling aggregation_get_URL, then passing the return value to aggregation_get_XML.You are
25                    // strongly encouraged to wrap any calls to these function in try catch statements.
26                    // If any error occurs, simply throw an exception and the module will handle logging the error!
27    
28                    // can be ommitted, then image URL will be our image GUID
29                    $image_array['guid'] = $image_guid;
30    
31                    // can be ommitted, then image will take article's title
32                    $image_array['title'] = $image_title;
33    
34                    // if any of these is ommitted, the $image_title will be used instead
35                    $image_array['teaser'] = $image_teaser;
36                    $image_array['body'] = $image_body;
37    
38                    // This is A MUST if you're interested in getting an image at all
39                    $image_array['url'] = $image_url;
40    
41                    // can be ommitted, then image will take current time
42                    $image_array['timestamp'] = $image_timestamp;
43    
44    
45                    // Create additional taxonomies if the feed contains categories you'd like to preserve such as ATOM category tags
46    
47                    $additional_taxonomies = array();
48                    // Create a vocabulary named "vocab_new_1" if it doesn't already exist. Next create "term_new_1", "term_new_2" if they
49                    // don't exist. If vocabulary or terms exist, the item will go under them! This is sort of an auto-taxonomy technique!
50                    $additional_taxonomies['vocab_new_1'] = array('term_new_1', 'term_new_2');
51    
52                    // Create as many as you'd like to capture categories already present in the feed checkout ATOM.inc for example
53                    $additional_taxonomies['vocab_new_2'] = array('term_new_3', 'term_new_4');
54    
55                    // let's pass these arguments to the module by calling _aggregation_add_item
56                    _aggregation_add_item($title, $body, $teaser, $original_author, $feed,
57                            $additional_taxonomies, $timestamp, $original_item_url, $guid, $image_array);
58    
59          // We're finally done, moving on to the next item...                  // We're finally done, moving on to the next item if any...
60            // End Foreach
61  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.3.4.1

  ViewVC Help
Powered by ViewVC 1.1.3