Skip to:
Content

bbPress.org

Ticket #1181: full-rss-filters.patch

File full-rss-filters.patch, 5.7 KB (added by sambauers, 16 years ago)

Reverses [2374] and implements ent2ncr() via filters.

  • bb-templates/kakumei/rss2.php

     
    1010        <channel>
    1111                <title><?php echo $title; ?></title>
    1212                <link><?php echo $link; ?></link>
    13                 <description><![CDATA[<?php echo $description; ?>]]></description>
     13                <description><?php echo $description; ?></description>
    1414                <language><?php esc_html( bb_option('language') ); ?></language>
    1515                <pubDate><?php echo gmdate('D, d M Y H:i:s +0000'); ?></pubDate>
    1616                <?php bb_generator( 'rss2' ); ?>
  • bb-includes/defaults.bb-filters.php

     
    115115function bb_filter_feed_content()
    116116{
    117117        if ( bb_is_feed() ) {
    118                 add_filter( 'bb_title_rss', 'ent2ncr' );
    119                 add_filter( 'topic_title', 'ent2ncr' );
     118                add_filter( 'bb_title_rss', 'strip_tags');
     119                add_filter( 'bb_title_rss', 'ent2ncr', 8);
     120                add_filter( 'bb_title_rss', 'esc_html' );
     121
     122                add_filter( 'bb_description_rss', 'strip_tags');
     123                add_filter( 'bb_description_rss', 'ent2ncr', 8 );
     124                add_filter( 'bb_description_rss', 'esc_html' );
     125
     126                add_filter( 'post_author', 'ent2ncr', 8 );
     127
    120128                add_filter( 'post_link', 'esc_html' );
     129
     130                add_filter( 'post_text', 'ent2ncr' );
    121131                add_filter( 'post_text', 'htmlspecialchars' ); // encode_bad should not be overruled by esc_html
    122                 add_filter( 'post_text', 'ent2ncr' );
    123132        }
    124133}
    125134add_action( 'bb_init', 'bb_filter_feed_content' );
  • rss.php

     
    8181                                $posts[] = bb_get_first_post($topic->topic_id);
    8282                        }
    8383                       
    84                         $title = esc_html( sprintf( __( '%1$s &raquo; View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ) );
     84                        $title = sprintf( __( '%1$s &raquo; View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] );
    8585                        $link = get_view_link($feed_id);
    8686                        $link_self = bb_get_view_rss_link($feed_id);
    8787                        break;
     
    9191                                die();
    9292                        if ( !$posts = get_thread( $feed_id, 0, 1 ) )
    9393                                die();
    94                         $title = esc_html( sprintf( __( '%1$s &raquo; Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() ) );
     94                        $title = sprintf( __( '%1$s &raquo; Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() );
    9595                        $link = get_topic_link($feed_id);
    9696                        $link_self = get_topic_rss_link($feed_id);
    9797                        break;
     
    108108                        if ( !$posts = get_user_favorites( $user->ID ) ) {
    109109                                die();
    110110                        }
    111                         $title = esc_html( sprintf( __( '%1$s &raquo; User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_nicename ) );
     111                        $title = sprintf( __( '%1$s &raquo; User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_nicename );
    112112                        $link = bb_get_profile_link($feed_id);
    113113                        $link_self = get_favorites_rss_link($feed_id);
    114114                        break;
     
    124124                                $posts[] = bb_get_first_post($topic->topic_id);
    125125                        }
    126126                       
    127                         $title = esc_html( sprintf( __( '%1$s &raquo; Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() ) );
     127                        $title = sprintf( __( '%1$s &raquo; Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() );
    128128                        $link = bb_get_tag_link($feed_id);
    129129                        $link_self = bb_get_tag_topics_rss_link($feed_id);
    130130                        break;
     
    134134                                die();
    135135                        if ( !$posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )
    136136                                die();
    137                         $title = esc_html( sprintf( __( '%1$s &raquo; Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ) );
     137                        $title = sprintf( __( '%1$s &raquo; Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() );
    138138                        $link = bb_get_tag_link($feed_id);
    139139                        $link_self = bb_get_tag_posts_rss_link($feed_id);
    140140                        break;
     
    148148                                $posts[] = bb_get_first_post($topic->topic_id);
    149149                        }
    150150                       
    151                         $title = esc_html( sprintf( __( '%1$s &raquo; Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );
     151                        $title = sprintf( __( '%1$s &raquo; Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) );
    152152                        $link = get_forum_link($feed_id);
    153153                        $link_self = bb_get_forum_topics_rss_link($feed_id);
    154154                        break;
     
    156156                case 'forum-posts':
    157157                        if ( !$posts = bb_get_latest_forum_posts( $feed_id ) )
    158158                                die();
    159                         $title = esc_html( sprintf( __( '%1$s &raquo; Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );
     159                        $title = sprintf( __( '%1$s &raquo; Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) );
    160160                        $link = get_forum_link($feed_id);
    161161                        $link_self = bb_get_forum_posts_rss_link($feed_id);
    162162                        break;
     
    171171                                $posts[] = bb_get_first_post($topic->topic_id);
    172172                        }
    173173                       
    174                         $title = esc_html( sprintf( __( '%1$s &raquo; Recent Topics' ), bb_get_option( 'name' ) ) );
     174                        $title = sprintf( __( '%1$s &raquo; Recent Topics' ), bb_get_option( 'name' ) );
    175175                        $link = bb_get_uri();
    176176                        $link_self = bb_get_topics_rss_link();
    177177                        break;
     
    181181                default:
    182182                        if ( !$posts = bb_get_latest_posts( 35 ) )
    183183                                die();
    184                         $title = esc_html( sprintf( __( '%1$s &raquo; Recent Posts' ), bb_get_option( 'name' ) ) );
     184                        $title = sprintf( __( '%1$s &raquo; Recent Posts' ), bb_get_option( 'name' ) );
    185185                        $link = bb_get_uri();
    186186                        $link_self = bb_get_posts_rss_link();
    187187                        break;
     
    190190
    191191bb_send_304( $posts[0]->post_time );
    192192
    193 if (!$description = esc_html( bb_get_option('description') )) {
     193if (!$description = bb_get_option( 'description' ) ) {
    194194        $description = $title;
    195195}
    196196$title = apply_filters( 'bb_title_rss', $title, $feed );