Freeder
 All Classes Files Functions Variables Pages
Functions
feeds.php File Reference

Functions to handle the feeds (includes feed2array) More...

Functions

 curl_downloader ($urls)
 
 refresh_feeds ($feeds, $update_feeds_infos=false)
 
 add_feeds ($urls)
 
 delete_feed_id ($id)
 
 delete_feed_url ($url)
 
 edit_feed ($old_url, $new_url, $new_title='')
 
 get_feeds ()
 

Detailed Description

Functions to handle the feeds (includes feed2array)

Freeder

Function Documentation

add_feeds (   $urls)

Add feeds in the database and refresh them.

Parameters
$urlsis an array of urls
Returns
errored urls in array
curl_downloader (   $urls)

Downloads all the urls in the array $urls and returns an array with the results and the http status_codes.

Mostly inspired by blogotext by timovn : https://github.com/timovn/blogotext/blob/master/inc/fich.php

TODO : If open_basedir or safe_mode, Curl will not follow redirections : https://stackoverflow.com/questions/24687145/curlopt-followlocation-and-curl-multi-and-safe-mode

Parameters
anarray $urls of URLs
Returns
an array {'results', 'status_code'}, results being an array of the retrieved contents, indexed by URLs, and 'status_codes' being an array of status_code when different from 200, indexed by URL.
delete_feed_id (   $id)

Remove a feed and all associated tags / entries based on its id

Parameters
$idis the id of the feed to delete
delete_feed_url (   $url)

Remove a feed and all associated tags / entries based on its url

Parameters
$urlis the url of the feed to delete
edit_feed (   $old_url,
  $new_url,
  $new_title = '' 
)

Edit a feed in the database and refresh it.

TODO : Edit more than just the URL

Parameters
$old_urlis the current URL of the feed
$new_urlis the new URL to assign to this feed
$new_title(optionnal) is the new title of the feed
Returns
true upon success, false otherwise.
get_feeds ( )

Returns all the available feeds.

TODO

refresh_feeds (   $feeds,
  $update_feeds_infos = false 
)

Refresh the specified feeds and returns an array with URLs in error

TODO:

  • Get rid of feed ids
  • If no entries for a feed, it might be an error
Parameters
$feedsshould be an array of ids as keys and urls as values
$update_feeds_infosshould be true to update the feed infos from values in the RSS / ATOM