Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Delivering RSS feed as application/rss
Avatar
futanari.org #1
Member since May 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Delivering RSS feed as application/rss
OK, so this is an interesting interaction that maybe should be addressed in a future release.

I have a Wordpress site running 4.0 now (futanari.org) and up until August, the RSS feed widget was able to display the previous 10 changes from my dokuwiki hosted at futanari.org/wiki. However starting in Septermber, the widget displayed the error below:

RSS Error: A feed could not be found at http://futanari.org/wiki/feed.php. A feed with an invalid mime type may fall victim to this error, or SimplePie was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.

Now this is curious, because the RSS feed has validated perfectly fine, but searching for information about this error, it seems that since DokuWiki renders the feed as text/css that SimplePie is no longer accepting the feed as valid.

<?xml-stylesheet href="http://futanari.org/wiki/lib/exe/css.php?s=feed" type="text/css"?>

Now then, is there any way to change the RSS delivery to application/rss from text/css?
Avatar
futanari.org #2
Member since May 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
bump
Avatar
Klap-in #3
Member since Nov 2009 · 239 posts · Location: Alkmaar, The Netherlands
Group memberships: Documentation Team, Members
Show profile · Link to this post
The feed is created by https://github.com/splitbrain/dokuwiki/blob/master/feed.php
(or http://xref.dokuwiki.org/reference/dokuwiki/nav.…?feed.p… )

The tag you provided is the additional stylesheet delivered by the wiki for the feed. Sofar I know there is no RSSclient that will use that stylesheet, so I cannot image how that it gives issues...
In the used object, the method  _createStylesheetReferences() creates the text/css mimetype
(see http://xref.dokuwiki.org/reference/dokuwiki/inc/feedcreato… )


Which information do you refer with the respect to (not) accepting of stuff by SimplePie?
Avatar
futanari.org #4
Member since May 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
I don't know what information is not being accepted by SimplePie because the debug is not displaying any information other than previously quoted.

Looking at the github code, RSS 1.0 should render application/xml...

I just determined something that can be used as a stopgap.
Dokuwiki's RSS feed is permanently redirected to feedburner for some reason, well I did the same for my RSS feed, and now SimplePie is rendering it fine.

Doesn't this mean something is screwing up in the feed.php?
Avatar
Klap-in #5
Member since Nov 2009 · 239 posts · Location: Alkmaar, The Netherlands
Group memberships: Documentation Team, Members
Show profile · Link to this post
dokuwiki.org redirects to feedburner to releave the number of page request on the server.
Feedburner uses subsequently an alias of feed.php for getting its information.

Which syntax do you use for creating your widget that lists some of the items from the feed, but shows these error?

Please provide enough information for me, that let try me to reproduce your case.
Avatar
futanari.org #6
Member since May 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
Wordpress > Appearance > Widgets
Default RSS Widget
Settings:
RSS Feed=http://futanari.org/wiki/feed.php
Title=Recent Wiki Updates
Display How Many Items?=10
Other options are Unchecked

Again this is default Wordpress Widget, listing raw code for the widget below.

/**
 * Process RSS feed widget data and optionally retrieve feed items.
 *
 * The feed widget can not have more than 20 items or it will reset back to the
 * default, which is 10.
 *
 * The resulting array has the feed title, feed url, feed link (from channel),
 * feed items, error (if any), and whether to show summary, author, and date.
 * All respectively in the order of the array elements.
 *
 * @since 2.5.0
 *
 * @param array $widget_rss RSS widget feed data. Expects unescaped data.
 * @param bool $check_feed Optional, default is true. Whether to check feed for errors.
 * @return array
 */
function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
    $items = (int) $widget_rss['items'];
    if ( $items < 1 || 20 < $items )
        $items = 10;
    $url           = esc_url_raw( strip_tags( $widget_rss['url'] ) );
    $title         = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
    $show_summary  = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
    $show_author   = isset( $widget_rss['show_author'] ) ? (int) $widget_rss['show_author'] :0;
    $show_date     = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;

    if ( $check_feed ) {
        $rss = fetch_feed($url);
        $error = false;
        $link = '';
        if ( is_wp_error($rss) ) {
            $error = $rss->get_error_message();
        } else {
            $link = esc_url(strip_tags($rss->get_permalink()));
            while ( stristr($link, 'http') != $link )
                $link = substr($link, 1);

            $rss->__destruct();
            unset($rss);
        }
    }

    return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );
}
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-01-27, 19:01:15 (UTC +01:00)