XFeed RSS/Atom feed plugin for CPG 1.5.x XFeed RSS/Atom feed plugin for CPG 1.5.x
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

XFeed RSS/Atom feed plugin for CPG 1.5.x

Started by Aditya Mooley, August 14, 2009, 11:39:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Aditya Mooley

Ported the XFeed plugin to 1.5 with lot more feed possibilities.

A feed will be available for every album (including meta albums) and categories. In case of category with no meta album, lastup will be used.

Also, added some config settings like whether to show the RSS button and number of items in feed. The browser's subscribe to feed icon will display all the available feeds (RSS/Atom) with proper labeling.

Demo - http://adityamooley.net/photos/

Download: http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/cpg1.5.x_plugin_xfeed_v1.11.zip/download
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

Αndré

Good work Aditya. Much more powerful than my Atom feed plugin for 1.5.

But there is an error. See: http://adityamooley.net/photos/index.php?file=xfeed/xfeed&album=lastalb

Aditya Mooley

Thanks for spotting the error. I never tested it with lastalb metaalbum, so never got this error. Its fixed now. I have updated the attachment in first post.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

Αndré

Aditya. Referring to this thread, you have to replace the function xfd_rss_button with this one:
function xfd_rss_button($template_header)
{
    global $XFDSET,$lang_xfeeds,$CONFIG, $album;

    $superCage = Inspekt::makeSuperCage();

    //require('./plugins/xfeed/include/init.inc.php');

    if (!$XFDSET['xfd_rss_button']) {
        return $template_header;
    }

    $xfd_feed = "index.php?file=xfeed/xfeed";

    if ($superCage->get->keyExists('album')) {
        $album = $superCage->get->getRaw('album');
        $xfd_feed .= "&album=$album";
    }

    if ($superCage->get->keyExists('cat')) {
        $cat = $superCage->get->getRaw('cat');
        $cat = (int)$cat;
        $xfd_feed .= "&cat=$cat";
    }

    if ($XFDSET['xfd_feedroute'] == 1) {
        $xfeed_loc = "feeds.feedburner.com/".$XFDSET['xfd_feedburnuname'];
    } else {
        $xfeed_loc = "".str_replace("http://","",$CONFIG[ecards_more_pic_target]).$xfd_feed;
    }

    //static
    $xfeed_title_enc = urlencode($CONFIG['gallery_name']);
    $xfeed_author = "Admin"; // maybe get the first username in the future (gallery creator).

    $html = "
    <!-- BEGIN XFeeds Plugin -->
    <span class=\"xfeeds\">
    <form>
        <select onchange=\"if (this.selectedIndex > 0) location.href=this[this.selectedIndex].value;\">
        <option selected=\"selected\" value=\"\">".$lang_xfeeds['xfd_fe_opts']."</option>
    ";

    if ($XFDSET['xfd_standard'] == 1) {
        $html .= " <optgroup label=\"".$lang_xfeeds['xfd_fe_atom']."\">
        <option value=\"".$CONFIG[ecards_more_pic_target].$xfd_feed."&type=atom\">".$lang_xfeeds['xfd_fe_local_atom']."</option>
        </optgroup>
        ";
    }

    if ($XFDSET['xfd_standard'] == 1 || $XFDSET['xfd_google'] == 1 ||
        $XFDSET['xfd_yahoo'] == 1 || $XFDSET['xfd_msn'] == 1 ||
        $XFDSET['xfd_lines'] == 1 || $XFDSET['xfd_aol'] == 1 ||
        $XFDSET['xfd_feedburn'] == 1 || $XFDSET['xfd_google'] == 1) {

        $html .= " <optgroup label=\"".$lang_xfeeds['xfd_fe_rss']."\">\n";

        if ($XFDSET['xfd_standard'] == 1) {
            $html .= " <option value=\"".$CONFIG[ecards_more_pic_target].$xfd_feed."\">".$lang_xfeeds['xfd_fe_standard']."</option>\n";
        }

        if ($XFDSET['xfd_google'] == 1) {
            $html .= " <option value=\"http://fusion.google.com/add?feedurl=http%3A//".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_google']."</option>\n";
        }

        if ($XFDSET['xfd_yahoo'] == 1) {
            $html .= " <option value=\"http://us.rd.yahoo.com/my/atm/".$xfeed_author."/".$xfeed_title_enc."http%3A//".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_yahoo']."</option>\n";
        }

        if ($XFDSET['xfd_msn'] == 1) {
            $html .= " <option value=\"http://my.msn.com/addtomymsn.armx?id=rss&amp;ut=http://".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_msn']."</option>\n";
        }

        if ($XFDSET['xfd_lines'] == 1) {
            $html .= " <option value=\"http://www.bloglines.com/sub/http://".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_lines']."</option>\n";
        }

        if ($XFDSET['xfd_aol'] == 1) {
            $html .= " <option value=\"http://feeds.my.aol.com/add.jsp?url=http://".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_aol']."</option>\n";
        }

        if ($XFDSET['xfd_feedburn'] == 1) {
            $html .= " <option value=\"http://feeds.feedburner.com/".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_feedburn']."</option>\n";
        }

        $html .= " </optgroup>\n";
    }

    $customRSSOpt = $customRSS = '';
    for ($i = 1; $i <= 5; $i++) {
        if ($XFDSET['xfd_customenable'.$i] == 1) {
            if (empty($customRSSOpt)) {
                $customRSSOpt = "   <optgroup label=\"".$lang_xfeeds['xfd_fe_links']."\" />\n";
            }
            $customRSS .= "  <option value=\"".$XFDSET['xfd_customurl'.$i]."\">".$XFDSET['xfd_customtitle'.$i]."</option>\n";
        }
    }

    $html .= "  $customRSSOpt $customRSS </select>
        <noscript><input type=\"submit\" value=\"go\"></noscript>
    </form>
    </span>

    <!-- END XFeeds Plugin -->
    ";

    return $template_header.$html;
}




Additionally I wonder why you place the config buttin in the sub menu instead of the admin menu ???
$thisplugin->add_filter('sub_menu','xfd_add_config_button');


Maybe we should add this plugin to the svn?

Αndré

Added plugin to svn. Moved config button to admin menu. Added admin menu icon. Replaced function xfd_rss_button.

Version 1.6 attached to the initial post.

Αndré


smoke

Is it possible to get a feed off of the favpics album? 

Aditya Mooley

No, its not possible. You will see the favpic feed when you go on favpic page but your RSS reader won't show anything.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

smoke

I kind of figured that would be the case with it, but I seem to remember being able to access favourites by user ID before.  Wasn't sure if I was missing out on something obvious when I tried it.

Thanks for a cool plugin.

Vixs

How to fix problem displayed color button "RSS" in latest IE8?

In IE8 i see text string "Feed option -->"

Thanks.

Vixs

And this plugin "xfeed 1.9" many conflict with "LightBox NotesFor.net (lightbox_notes_for_net): v2.5"

- no displayed "RSS" color buttons, only text string
- not work subscribe any feed-s

tested in FireFox 3.6.3 and latest IE8

Joe Carver

1) You need to post a link to your Coppermine when asking for support - forum rule

2) LightBox is now at ver. 2.7 - see the Support thread
        - it will work with XFeed above LightBox in list of installed plugins

3) Atom feed did work for me (although I had some troubles with RSS) using AtomFeed ver. 1.9 with and without LightBox

Vixs

1 - http://gallery.art-world.in.ua/
2 - solved
3 - atom plugin not needed, only XFeed

plase help

QuoteHow to fix problem displayed color button "RSS" in latest IE8?

In IE8 i see text string "Feed option -->"

CPG 1.5.3 RC, theme - curve (mod)
installed plugin

bbcode_control
dst
fav_button
fetchcontent
lightbox_notes_for_net
no-crop-rotate
onlinestats
xfeed

Joe Carver

From what I can see it looks like the issue might be with the non-latin characters. I was able to reproduce it somewhat on my cpg test gallery. The version that I have there might be different than yours so therefore:

To be certain I would suggest that you re-test with no plugins installed. Then if you use Opera you mught be able to see the exact fault. Copy and paste that into your next post.

This error I got on your site was similar o one I got on mine with a Cyrillic title on one picture.
QuoteXML parsing failed: syntax error (Line: 11, Character: 9)

8: <generator>Coppermine RSS Aggregator</generator>
  9:
10:    <item>
11:       <title>&ETH;�&ETH;&micro;&ETH;&sup1;&ETH;&middot;&ETH;&deg;&ETH;&para; &ETH;&middot;&ETH;&deg;&Ntilde;�&Ntilde;�&ETH;&deg;&ETH;&sup2;&ETH;&ordm;&ETH;&deg;2</title>
12:       <link>http://gallery.art-world.in.ua/displayimage.php?pid=28</link>
13:       <dc:creator></dc:creator>
14:       <pubDate>Wed, 07 Apr 2010 00:56:56 +0300</pubDate>



Joachim Müller

Does the XML file specify the correct encoding in the header?

Joe Carver

Quote from: Joachim Müller on April 09, 2010, 07:26:03 AM
Does the XML file specify the correct encoding in the header?

Here is what I see.

Quote<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel>

At the moment this is about all that I can contribute to this one  - I am in too deep my own plugins!



xcruci8

Running version 1.5.3 with v1.9 of this plugin.

In codebase.php, part of the add to yahoo link is missing.  I replaced the commented line (line 113) with the line below it and now the link works.


if ($XFDSET['xfd_yahoo'] == 1) {
  //$html .= " <option value=\"http://us.rd.yahoo.com/my/atm/".$xfeed_author."/".$xfeed_title_enc."http%3A//".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_yahoo']."</option>\n"
  $html .= " <option value=\"http://us.rd.yahoo.com/my/atm/".$xfeed_author."/".$xfeed_title_enc."/*http://add.my.yahoo.com/rss?url=http%3A//".$xfeed_loc."\">".$lang_xfeeds['xfd_fe_yahoo']."</option>\n";
}



smartbyte

If you are interested in how to make this plugin Cooliris compatible:

In codebase.php change the sequence of the RSS-feed in the Header on the album page(line 283): (move the $extra_header variable 2 lines up)

    $header .= "    $extra_header
    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"".$CONFIG['gallery_name']." - RSS\" href=\"".$CONFIG['ecards_more_pic_target'].$xfd_feed."\" />
    <link rel=\"alternate\" type=\"application/atom+xml\" title=\"".$CONFIG['gallery_name']." - Atom\" href=\"".$CONFIG['ecards_more_pic_target'].$xfd_feed."&amp;type=atom\" />
    <style type=\"text/css\">


and in xfeed.php change the RSS stream to a media RSS stream(line 124):

//    print "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";
    print "<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";

and comment out or delete the dc-creator line, because the media stream doesn't know how to handle dc tags:

//        print "\t\t<dc:creator>{$row['owner_name']}</dc:creator>\n";

and add the media tags (the creator from above is added again as media:credit):

        print "</description>\n";
        print "\t\t<guid>$base/displayimage.php?pid={$row['pid']}</guid>\n";
print "\t\t<media:credit role=\"uploader\" scheme=\"urn:yvs\">{$row['owner_name']}</media:credit>\n";
        print "\t\t<media:description>".htmlentities($title)."</media:description>\n";
        print "\t\t<media:thumbnail url=\"$base/".get_pic_url($row, 'thumb')."\"/>\n";
        print "\t\t<media:content url=\"$base/".get_pic_url($row, 'normal')."\"/>\n";
        print "\t</item>\n";


and voila Cooliris detects the pictures in the albums.

... just a suggestion, but it's a small change only and I think it's worth it!

C ya.

smartbyte

Quote from: smartbyte on May 10, 2010, 03:28:32 AM


This is beta 2!

Now we still have the dc creator field, because I just added the xmlns:dc to the header.
... and the header looks like this:


    print "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"";
    print "                     xmlns:media=\"http://search.yahoo.com/mrss/\"";
    print "                     xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";


... and I have implemented the dc:creator flag again. Just to be sure, that it is as compatible as it gets...
(I don't know which software uses the dc:creator flags... but Aditya is the master of RSS, I just looked up and tested how to make them work with cooliris.)

By, bye.

ericco

Hello, excuse me for my english  :-\

Why the picture not appears http://www.photos-de-montres.com/galeriemontres/index.php?file=xfeed/xfeed
And also the older last adds picture, only the last
Thk