Git Product home page Git Product logo

universalfeedcreator's Introduction

UniversalFeedCreator

RSS and Atom feed generator by Kai Blankenhorn, slightly cleaned up and packaged for Composer.

Supported formats: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated), MBOX, OPML, ATOM, ATOM0.3, HTML, JS, PHP

General Usage

require 'vendor/autoload.php';

$rss = new UniversalFeedCreator();
$rss->useCached(); // use cached version if age < 1 hour
$rss->title = "PHP news";
$rss->description = "daily news from the PHP scripting world";

//optional
$rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;

$rss->link = "http://www.dailyphp.net/news";
$rss->syndicationURL = "http://www.dailyphp.net/" . $_SERVER["SCRIPT_NAME"];

$image = new FeedImage();
$image->title = "dailyphp.net logo";
$image->url = "http://www.dailyphp.net/images/logo.gif";
$image->link = "http://www.dailyphp.net";
$image->description = "Feed provided by dailyphp.net. Click to visit.";

//optional
$image->descriptionTruncSize = 500;
$image->descriptionHtmlSyndicated = true;

$rss->image = $image;

// get your news items from somewhere, e.g. your database:
mysql_select_db($dbHost, $dbUser, $dbPass);
$res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC");
while ($data = mysql_fetch_object($res)) {
    $item = new FeedItem();
    $item->title = $data->title;
    $item->link = $data->url;
    $item->description = $data->short;

    //optional
    $item->descriptionTruncSize = 500;
    $item->descriptionHtmlSyndicated = true;

    $item->date = $data->newsdate;
    $item->source = "http://www.dailyphp.net";
    $item->author = "John Doe";

    $rss->addItem($item);
}

echo $rss->saveFeed("RSS1.0", "news/feed.xml");

Changelog:

v1.8          12-03-13
    packaged for Composer & cleaned up slightly

v1.7.7(BH)    28-03-06
    added GPX Feed (Barry Hunter)


v1.7.6(BH)    20-02-06
    added GeoRSS Feed (Barry Hunter)


v1.7.5(BH)    16-11-05
    added BASE Feed (Barry Hunter)

v1.7.4(BH)    05-07-05
    added KML Feed (Barry Hunter)

v1.7.3(BH)    05-07-05
    added PHP Feed (Barry Hunter)

v1.7.2    10-11-04
    license changed to LGPL

v1.7.1
    fixed a syntax bug
    fixed left over debug code

v1.7    07-18-04
    added HTML and JavaScript feeds (configurable via CSS) (thanks to Pascal Van Hecke)
    added HTML descriptions for all feed formats (thanks to Pascal Van Hecke)
    added a switch to select an external stylesheet (thanks to Pascal Van Hecke)
    changed default content-type to application/xml
    added character encoding setting
    fixed numerous smaller bugs (thanks to Sören Fuhrmann of golem.de)
    improved changing ATOM versions handling (thanks to August Trometer)
    improved the UniversalFeedCreator's useCached method (thanks to Sören Fuhrmann of golem.de)
    added charset output in HTTP headers (thanks to Sören Fuhrmann of golem.de)
    added Slashdot namespace to RSS 1.0 (thanks to Sören Fuhrmann of golem.de)

v1.6    05-10-04
    added stylesheet to RSS 1.0 feeds
    fixed generator comment (thanks Kevin L. Papendick and Tanguy Pruvot)
    fixed RFC822 date bug (thanks Tanguy Pruvot)
    added TimeZone customization for RFC8601 (thanks Tanguy Pruvot)
    fixed Content-type could be empty (thanks Tanguy Pruvot)
    fixed author/creator in RSS1.0 (thanks Tanguy Pruvot)

v1.6 beta    02-28-04
    added Atom 0.3 support (not all features, though)
    improved OPML 1.0 support (hopefully - added more elements)
    added support for arbitrary additional elements (use with caution)
    code beautification :-)
    considered beta due to some internal changes

v1.5.1    01-27-04
    fixed some RSS 1.0 glitches (thanks to Stéphane Vanpoperynghe)
    fixed some inconsistencies between documentation and code (thanks to Timothy Martin)

v1.5    01-06-04
    added support for OPML 1.0
    added more documentation

v1.4    11-11-03
    optional feed saving and caching
    improved documentation
    minor improvements

v1.3    10-02-03
    renamed to FeedCreator, as it not only creates RSS anymore
    added support for mbox
    tentative support for echo/necho/atom/pie/???

v1.2    07-20-03
    intelligent auto-truncating of RSS 0.91 attributes
    don't create some attributes when they're not set
    documentation improved
    fixed a real and a possible bug with date conversions
    code cleanup

v1.1    06-29-03
    added images to feeds
    now includes most RSS 0.91 attributes
    added RSS 2.0 feeds

v1.0    06-24-03
    initial release

Credits

originally (c) Kai Blankenhorn
www.bitfolge.de
[email protected]
v1.3 work by Scott Reynen ([email protected]) and Kai Blankenhorn
v1.5 OPML support by Dirk Clemens

universalfeedcreator's People

Contributors

barryvdh avatar dlangille avatar flack avatar saerdnaer avatar splitbrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

universalfeedcreator's Issues

No licence text provided

Composer.json says the library is available under GNU LGPL 2.1 or later, however the licence text is not included in the repository.

PHP 8.3

FYI, there are issues with PHP 8.3 - I'll post some of the errors here and I'll have a patch later.

<b>Deprecated</b>:  Creation of dynamic property RSSCreator091::$_timeout is deprecated in <b>/usr/local/share/UniversalFeedCreator/lib/Creator/FeedCreator.php</b> on line <b>238</b><br />

<b>Deprecated</b>:  Creation of dynamic property PIECreator01::$truncSize is deprecated in <b>/usr/local/share/UniversalFeedCreator/lib/Creator/PIECreator01.php</b> on line <b>29</b><br />

Deprecation error for html, js output format in php7.4

When I choose HTML as feed output, I get this deprecation error in php7.4:

'join(): Passing glue string after array is deprecated. Swap the parameters'

in: /var/www/html/vendor/openpsa/universalfeedcreator/lib/Creator/HTMLCreator.php
line 143:
$feed = "".join($feedArray, "\r\n");

(or another file for js type)

PHP warning: array given to htmlspecialchars()

Hi,
I am forwarding this issue from a DokuWiki user who noticed this warning:

PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in .../vendor/openpsa/universalfeedcreator/lib/Creator/AtomCreator10.php on line 113

I don't have any further information yet.

Greetings,
Lars

Use of undefined constant FEEDCREATOR_VERSION

Today I upgraded from 1.8.3.1 -> 1.8.4

I wonder what I've done wrong in my install.

2021/01/24 21:50:01 [error] 47739#102365: *4712 FastCGI sent in stderr: "PHP message: PHP Warning: Use of undefined constant FEEDCREATOR_VERSION - assumed 'FEEDCREATOR_VERSION' (this will throw an Error in a future version of PHP) in /usr/local/share/UniversalFeedCreator/lib/Creator/FeedCreator.php on line 130PHP message: PHP Warning: Use of undefined constant FEEDCREATOR_VERSION - assumed 'FEEDCREATOR_VERSION' (this will throw an Error in a future version of PHP) in /usr/local/share/UniversalFeedCreator/lib/Creator/RSSCreator091.php on line 67" while reading response header from upstream, client: 137.74.173.20, server: www.freshports.org, request: "GET /backend/watch-list.php?id=[redacted]&format=rss0.91 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "www.example.org"

FeedDate timezone fail

Unfortunately class FeedDate and thus RSS Feed pubDate fail at date strings with time zones.

For example,

var_dump(new FeedDate('1970-01-01 00:00:00+0200'));

... outputs a unixtime of 0, whereas -7200 would be correct.

A workaround of course is to pass unixtime integers instead of date strings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.