Ticket #25639: 25639.5.diff
| File 25639.5.diff, 9.0 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/feed-rssjs-comments.php
8 8 */ 9 9 10 10 $json = new stdClass(); 11 $json-> rss= new stdClass();11 $json->feed = new stdClass(); 12 12 13 $json->rss->version = "2.0";14 $json->rss->channel = new stdClass();15 16 13 if ( is_singular() ) 17 $json-> rss->channel->title = sprintf( __( 'Comments on: %s' ), get_the_title() );14 $json->feed->title = sprintf( __( 'Comments on: %s' ), get_the_title() ); 18 15 elseif ( is_search() ) 19 $json-> rss->channel->title = sprintf( __( 'Comments for %1$s searching on %2$s' ), get_bloginfo( 'name' ), get_search_query() );16 $json->feed->title = sprintf( __( 'Comments for %1$s searching on %2$s' ), get_bloginfo( 'name' ), get_search_query() ); 20 17 else 21 $json-> rss->channel->title = sprintf( __( 'Comments for %s' ), get_bloginfo( 'name' ) . get_the_title() );18 $json->feed->title = sprintf( __( 'Comments for %s' ), get_bloginfo( 'name' ) . get_the_title() ); 22 19 23 $json-> rss->channel->link = get_bloginfo( 'url' );24 $json-> rss->channel->description = get_bloginfo( 'description' );25 $json-> rss->channel->language = get_bloginfo( 'language' );26 $json-> rss->channel->lastBuildDate = mysql2date( 'D, d M Y H:i:s +0000', get_lastcommentmodified( 'GMT' ), false );27 $json-> rss->channel->docs = "http://cyber.law.harvard.edu/rss/rss.html";28 $json-> rss->channel->generator = 'WordPress ' . get_bloginfo( 'version' );29 $json-> rss->channel->ttl = 15;20 $json->feed->link = get_bloginfo( 'url' ); 21 $json->feed->description = get_bloginfo( 'description' ); 22 $json->feed->language = get_bloginfo( 'language' ); 23 $json->feed->lastBuildDate = mysql2date( 'D, d M Y H:i:s +0000', get_lastcommentmodified( 'GMT' ), false ); 24 $json->feed->docs = "http://cyber.law.harvard.edu/rss/rss.html"; 25 $json->feed->generator = get_the_generator( 'rssjs' ); 26 $json->feed->ttl = apply_filters( 'rss_update_period', 'hourly' ); 30 27 31 $json-> rss->channel->item = array();28 $json->feed->item = array(); 32 29 33 30 header( 'Content-Type: ' . feed_content_type( 'rssjs' ) . '; charset=' . get_option( 'blog_charset' ), true ); 34 31 … … 45 42 status_header( 400 ); 46 43 echo json_encode( array( 47 44 'code' => 'json_callback_disabled', 48 'message' => 'JSONP support is disabled on this site.'45 'message' => __( 'JSONP support is disabled on this site.' ) 49 46 ) ); 50 47 exit; 51 48 } … … 54 51 status_header( 400 ); 55 52 echo json_encode( array( 56 53 'code' => 'json_callback_invalid', 57 'message' => 'The JSONP callback function is invalid.'54 'message' => __( 'The JSONP callback function is invalid.' ) 58 55 ) ); 59 56 exit; 60 57 } … … 99 96 */ 100 97 $item = apply_filters( 'comment_rssjs_feed_item', $item ); 101 98 102 $json-> rss->channel->item[] = $item;99 $json->feed->item[] = $item; 103 100 } 104 101 105 102 /* -
src/wp-includes/feed-rssjs.php
8 8 */ 9 9 10 10 $json = new stdClass(); 11 $json->rss = new stdClass();12 11 13 $json->rss->version = "2.0"; 14 $json->rss->channel = new stdClass(); 12 $json->feed = new stdClass(); 15 13 16 $json->rss->channel->title = get_bloginfo( 'name' ); 17 $json->rss->channel->link = get_bloginfo( 'url' ); 18 $json->rss->channel->description = get_bloginfo( 'description' ); 19 $json->rss->channel->language = get_bloginfo( 'language' ); 20 $json->rss->channel->lastBuildDate = mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ); 21 $json->rss->channel->docs = "http://cyber.law.harvard.edu/rss/rss.html"; 22 $json->rss->channel->generator = 'WordPress ' . get_bloginfo( 'version' ); 23 $json->rss->channel->ttl = 15; 14 $json->feed->title = apply_filters( 'bloginfo_rss', get_bloginfo_rss( 'name' ) ); 15 $json->feed->title .= apply_filters( 'wp_title_rss', get_wp_title_rss() ); 16 $json->feed->link = apply_filters( 'bloginfo_rss', get_bloginfo_rss( 'url' ) ); 17 $json->feed->description = apply_filters( 'bloginfo_rss', get_bloginfo_rss( 'description' ) ); 18 $json->feed->language = apply_filters( 'bloginfo_rss', get_bloginfo_rss( 'language' ) ); 19 $json->feed->lastBuildDate = mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ); 20 $json->feed->docs = "http://cyber.law.harvard.edu/rss/rss.html"; 21 $json->feed->generator = get_the_generator( 'rssjs' ); 22 $json->feed->updatePeriod = apply_filters( 'rss_update_period', 'hourly' ); 23 $json->feed->updateInterval = apply_filters( 'rss_update_frequency', '1' ); 24 24 25 $json-> rss->channel->item = array();25 $json->feed->item = array(); 26 26 27 27 header( 'Content-Type: ' . feed_content_type( 'rssjs' ) . '; charset=' . get_option( 'blog_charset' ), true ); 28 28 … … 39 39 status_header( 400 ); 40 40 echo json_encode( array( 41 41 'code' => 'json_callback_disabled', 42 'message' => 'JSONP support is disabled on this site.'42 'message' => __( 'JSONP support is disabled on this site.' ) 43 43 ) ); 44 44 exit; 45 45 } … … 48 48 status_header( 400 ); 49 49 echo json_encode( array( 50 50 'code' => 'json_callback_invalid', 51 'message' => 'The JSONP callback function is invalid.'51 'message' => __( 'The JSONP callback function is invalid.' ) 52 52 ) ); 53 53 exit; 54 54 } … … 65 65 66 66 $item = new stdClass(); 67 67 68 $item->title = get_the_title(); 69 $item->link = get_permalink(); 70 $item->guid = get_the_guid(); 71 $item->description = get_the_content(); 72 $item->pubDate = mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); 68 $item->title = get_the_title_rss(); 69 $item->link = apply_filters( 'the_permalink_rss', get_permalink() ); 70 $item->guid = esc_url( get_the_guid() ); 73 71 72 $item->description = get_the_excerpt(); 73 $item->description = apply_filters( 'the_excerpt_rss', $item->description ); 74 75 if ( !get_option( 'rss_use_excerpt' ) ) { 76 $content = apply_filters( 'the_content_feed', apply_filters( 'the_content', get_the_content() ) ); 77 78 if ( strlen( $content ) > 0 ) 79 $item->content = $content; 80 else 81 $item->content = $item->description; 82 } 83 84 $item->pubDate = mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); 85 $item->author = get_the_author(); 86 $item->author_link = esc_url( get_author_posts_url( $post->post_author ) ); 87 $item->comments = apply_filters( 'comments_link_feed', get_comments_link() ); 88 $item->comments_feed = esc_url( get_post_comments_feed_link( null, 'rssjs' ) ); 89 $item->comments_number = get_comments_number(); 90 $item->category = get_the_category_rssjs(); 91 74 92 /* 75 93 * The item to be added to the rss.js Post feed 76 94 * … … 80 98 */ 81 99 $item = apply_filters( 'rssjs_feed_item', $item ); 82 100 83 $json-> rss->channel->item[] = $item;101 $json->feed->item[] = $item; 84 102 } 85 103 86 104 /* … … 92 110 */ 93 111 $json = apply_filters( 'rssjs_feed', $json ); 94 112 95 96 113 $json_str = json_encode( $json ); 97 114 98 115 if ( ! empty( $callback ) ) { -
src/wp-includes/feed.php
333 333 } 334 334 335 335 /** 336 * Retrieve all of the post categories & tags, formatted for use in feeds. 337 * 338 * All of the categories for the current post in the feed loop, will be 339 * retrieved and have feed markup added. 340 * 341 * @package WordPress 342 * @subpackage Feed 343 * @since 3.8 344 * @uses apply_filters() 345 * 346 * @return array All of the post categories & archive URLs for displaying in the feed. 347 */ 348 function get_the_category_rssjs() { 349 $categories = get_the_category(); 350 $tags = get_the_tags(); 351 $cats = array(); 352 353 foreach ( (array) $categories as $category ) { 354 $name = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'raw' ); 355 356 $cats[$name] = array( 357 'domain' => esc_url( get_category_link( $category->term_id ) ), 358 'value' => $name, 359 ); 360 } 361 362 foreach ( (array) $tags as $tag ) { 363 $name = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', 'raw' ); 364 365 $cats[$name] = array( 366 'domain' => esc_url( get_tag_link( $tag->term_id ) ), 367 'value' => $name, 368 ); 369 } 370 371 return apply_filters( 'the_category_rssjs', array_values( $cats ) ); 372 } 373 374 /** 336 375 * Display the post categories in the feed. 337 376 * 338 377 * @package WordPress -
src/wp-includes/general-template.php
2310 2310 case 'export': 2311 2311 $gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->'; 2312 2312 break; 2313 case 'rssjs': 2314 $gen = 'http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ); 2315 break; 2313 2316 } 2314 2317 return apply_filters( "get_the_generator_{$type}", $gen, $type ); 2315 2318 }