Changeset 2420
- Timestamp:
- 04/13/2010 05:07:48 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/defaults.bb-filters.php
r2401 r2420 116 116 { 117 117 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 ); 120 127 add_filter( 'post_link', 'esc_html' ); 121 add_filter( 'post_text ', 'htmlspecialchars' ); // encode_bad should not be overruled by esc_html122 add_filter( 'post_text ', 'ent2ncr' );128 add_filter( 'post_text_rss', 'ent2ncr', 8 ); 129 add_filter( 'post_text_rss', 'esc_html' ); 123 130 } 124 131 } -
trunk/bb-includes/functions.bb-template.php
r2419 r2420 1786 1786 } 1787 1787 1788 function post_text_rss( $post_id = 0 ) { 1789 echo apply_filters( 'post_text_rss', get_post_text( $post_id ), get_post_id( $post_id ) ); 1790 } 1791 1788 1792 function post_text( $post_id = 0 ) { 1789 1793 echo apply_filters( 'post_text', get_post_text( $post_id ), get_post_id( $post_id ) ); -
trunk/bb-templates/kakumei/rss2.php
r2374 r2420 7 7 xmlns:content="http://purl.org/rss/1.0/modules/content/" 8 8 xmlns:dc="http://purl.org/dc/elements/1.1/" 9 xmlns:atom="http://www.w3.org/2005/Atom"> 9 xmlns:atom="http://www.w3.org/2005/Atom" 10 <?php do_action( 'bb_rss2_ns'); ?> 11 > 10 12 <channel> 11 13 <title><?php echo $title; ?></title> 12 14 <link><?php echo $link; ?></link> 13 <description>< ![CDATA[<?php echo $description; ?>]]></description>14 <language><?php e sc_html( bb_option('language') ); ?></language>15 <pubDate><?php echo gmdate( 'D, d M Y H:i:s +0000'); ?></pubDate>15 <description><?php echo $description; ?></description> 16 <language><?php echo esc_html( bb_get_option( 'language' ) ); ?></language> 17 <pubDate><?php echo gmdate( 'D, d M Y H:i:s +0000' ); ?></pubDate> 16 18 <?php bb_generator( 'rss2' ); ?> 17 <textInput> 18 <title><![CDATA[<?php _e('Search'); ?>]]></title> 19 <description><![CDATA[<?php _e('Search all topics from these forums.'); ?>]]></description> 20 <name>q</name> 21 <link><?php bb_uri('search.php'); ?></link> 22 </textInput> 19 <?php do_action( 'bb_rss2_head' ); ?> 23 20 <atom:link href="<?php echo $link_self; ?>" rel="self" type="application/rss+xml" /> 24 21 25 <?php foreach ( $posts as $bb_post) : ?>22 <?php foreach ( (array) $posts as $bb_post ) : ?> 26 23 <item> 27 <title><?php post_author(); ?> <?php _e( 'on')?> "<?php topic_title( $bb_post->topic_id ); ?>"</title>24 <title><?php post_author(); ?> <?php _e( 'on' ); ?> "<?php topic_title( $bb_post->topic_id ); ?>"</title> 28 25 <link><?php post_link(); ?></link> 29 <pubDate><?php bb_post_time( 'D, d M Y H:i:s +0000', array( 'localize' => false ) ); ?></pubDate>26 <pubDate><?php bb_post_time( 'D, d M Y H:i:s +0000', array( 'localize' => false ) ); ?></pubDate> 30 27 <dc:creator><?php post_author(); ?></dc:creator> 31 28 <guid isPermaLink="false"><?php post_id(); ?>@<?php bb_uri(); ?></guid> 32 <description><?php post_text(); ?></description> 29 <description><?php post_text_rss(); ?></description> 30 <content:encoded><![CDATA[<?php post_text_rss(); ?>]]></content:encoded> 31 <?php do_action( 'bb_rss2_item' ); ?> 33 32 </item> 34 33 <?php endforeach; ?> -
trunk/rss.php
r2345 r2420 74 74 75 75 $topics = $topics_object->results; 76 if ( !$topics || !is_array($topics) )77 die();78 76 79 77 $posts = array(); 80 foreach ( $topics as $topic) {78 foreach ( (array) $topics as $topic ) { 81 79 $posts[] = bb_get_first_post($topic->topic_id); 82 80 } 83 81 84 $title = esc_html( sprintf( __( '%1$s » View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ));82 $title = sprintf( __( '%1$s » View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ); 85 83 $link = get_view_link($feed_id); 86 84 $link_self = bb_get_view_rss_link($feed_id); … … 91 89 die(); 92 90 if ( !$posts = get_thread( $feed_id, 0, 1 ) ) 93 die(); 94 $title = esc_html( sprintf( __( '%1$s » Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title()) );91 die(); /* Should die here, as the topic posts aren't there, so the topic is most probably deleted/empty */ 92 $title = sprintf( __( '%1$s » Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() ); 95 93 $link = get_topic_link($feed_id); 96 94 $link_self = get_topic_rss_link($feed_id); … … 98 96 99 97 case 'profile': 100 if ( bb_get_option( 'mod_rewrite' ) === 'slugs' ) { 101 $user = bb_get_user_by_nicename( $feed_id ); 98 if ( bb_get_option( 'mod_rewrite' ) === 'slugs') { 99 if ( !$user = bb_get_user_by_nicename( $feed_id ) ) 100 $user = bb_get_user( $feed_id ); 102 101 } else { 103 $user = bb_get_user( $feed_id ); 102 if ( !$user = bb_get_user( $feed_id ) ) 103 $user = bb_get_user_by_nicename( $feed_id ); 104 104 } 105 105 if ( !$user ) { 106 106 die(); 107 107 } 108 if ( !$posts = get_user_favorites( $user->ID ) ) { 109 die(); 110 } 111 $title = esc_html( sprintf( __( '%1$s » User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_nicename ) ); 112 $link = bb_get_profile_link($feed_id); 108 $posts = get_user_favorites( $user->ID ); 109 110 $title = sprintf( __( '%1$s » User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_nicename ); 111 $link = get_user_profile_link($feed_id); 113 112 $link_self = get_favorites_rss_link($feed_id); 114 113 break; … … 117 116 if ( !$tag = bb_get_tag( $feed_id ) ) 118 117 die(); 119 if ( !$topics = get_tagged_topics( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) ) 120 die(); 118 $topics = get_tagged_topics( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ); 121 119 122 120 $posts = array(); 123 foreach ( $topics as $topic) {121 foreach ( (array) $topics as $topic ) { 124 122 $posts[] = bb_get_first_post($topic->topic_id); 125 123 } 126 124 127 $title = esc_html( sprintf( __( '%1$s » Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name()) );125 $title = sprintf( __( '%1$s » Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() ); 128 126 $link = bb_get_tag_link($feed_id); 129 127 $link_self = bb_get_tag_topics_rss_link($feed_id); … … 133 131 if ( !$tag = bb_get_tag( $feed_id ) ) 134 132 die(); 135 if ( !$posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) ) 136 die(); 137 $title = esc_html( sprintf( __( '%1$s » Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ) ); 133 $posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ); 134 $title = sprintf( __( '%1$s » Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ); 138 135 $link = bb_get_tag_link($feed_id); 139 136 $link_self = bb_get_tag_posts_rss_link($feed_id); … … 141 138 142 139 case 'forum-topics': 143 if ( !$topics = get_latest_topics( $feed_id ) ) 144 die(); 140 $topics = get_latest_topics( $feed_id ); 145 141 146 142 $posts = array(); 147 foreach ( $topics as $topic) {143 foreach ( (array) $topics as $topic) { 148 144 $posts[] = bb_get_first_post($topic->topic_id); 149 145 } 150 146 151 $title = esc_html( sprintf( __( '%1$s » Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id )) );147 $title = sprintf( __( '%1$s » Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ); 152 148 $link = get_forum_link($feed_id); 153 149 $link_self = bb_get_forum_topics_rss_link($feed_id); … … 155 151 156 152 case 'forum-posts': 157 if ( !$posts = bb_get_latest_forum_posts( $feed_id ) ) 158 die(); 159 $title = esc_html( sprintf( __( '%1$s » Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) ); 153 $posts = bb_get_latest_forum_posts( $feed_id ); 154 $title = sprintf( __( '%1$s » Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ); 160 155 $link = get_forum_link($feed_id); 161 156 $link_self = bb_get_forum_posts_rss_link($feed_id); … … 164 159 // Get just the first post from the latest topics 165 160 case 'all-topics': 166 if ( !$topics = get_latest_topics() ) 167 die(); 161 $topics = get_latest_topics(); 168 162 169 163 $posts = array(); 170 foreach ( $topics as $topic) {164 foreach ( (array) $topics as $topic ) { 171 165 $posts[] = bb_get_first_post($topic->topic_id); 172 166 } 173 167 174 $title = esc_html( sprintf( __( '%1$s » Recent Topics' ), bb_get_option( 'name' )) );168 $title = sprintf( __( '%1$s » Recent Topics' ), bb_get_option( 'name' ) ); 175 169 $link = bb_get_uri(); 176 170 $link_self = bb_get_topics_rss_link(); … … 180 174 case 'all-posts': 181 175 default: 182 if ( !$posts = bb_get_latest_posts( 35 ) ) 183 die(); 184 $title = esc_html( sprintf( __( '%1$s » Recent Posts' ), bb_get_option( 'name' ) ) ); 176 $posts = bb_get_latest_posts( 35 ); 177 $title = sprintf( __( '%1$s » Recent Posts' ), bb_get_option( 'name' ) ); 185 178 $link = bb_get_uri(); 186 179 $link_self = bb_get_posts_rss_link(); … … 189 182 } 190 183 191 bb_send_304( $posts[0]->post_time ); 184 if ( !$posts ) /* We do typecasting in the template, but all themes don't have that! */ 185 $posts = array(); 186 else /* Only send 304 if there are posts */ 187 bb_send_304( $posts[0]->post_time ); 192 188 193 if (!$description = esc_html( bb_get_option('description') )) {189 if (!$description = bb_get_option( 'description' ) ) { 194 190 $description = $title; 195 191 }
Note: See TracChangeset
for help on using the changeset viewer.