Ticket #26253: 26253.5.diff
| File 26253.5.diff, 13.0 KB (added by , 13 years ago) |
|---|
-
src/wp-includes/feed.php
19 19 * @package WordPress 20 20 * @subpackage Feed 21 21 * @since 1.5.1 22 * @uses apply_filters() Calls 'get_bloginfo_rss' hook with two parameters.23 22 * @see get_bloginfo() For the list of possible values to display. 24 23 * 25 24 * @param string $show See get_bloginfo() for possible values. … … 27 26 */ 28 27 function get_bloginfo_rss($show = '') { 29 28 $info = strip_tags(get_bloginfo($show)); 30 return apply_filters('get_bloginfo_rss', convert_chars($info), $show); 29 /** 30 * Filter the bloginfo for use in RSS feeds. 31 * 32 * @since 2.2.0 33 * 34 * @see convert_chars() 35 * @see get_bloginfo() 36 * 37 * @param string $info Converted string value of the blog information. 38 * @param string $show The type of blog information to retrieve. 39 */ 40 return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show ); 31 41 } 32 42 33 43 /** … … 40 50 * @package WordPress 41 51 * @subpackage Feed 42 52 * @since 0.71 43 * @uses apply_filters() Calls 'bloginfo_rss' hook with two parameters.44 53 * @see get_bloginfo() For the list of possible values to display. 45 54 * 46 55 * @param string $show See get_bloginfo() for possible values. 47 56 */ 48 57 function bloginfo_rss($show = '') { 49 echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show); 58 /** 59 * Filter the retrieved RSS bloginfo for use in feeds. 60 * 61 * @since 2.1.0 62 * 63 * @see get_bloginfo() 64 * 65 * @param string $rss_container RSS container for the blog information. 66 * @param string $show The type of blog information to retrieve. 67 */ 68 echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show ); 50 69 } 51 70 52 71 /** … … 58 77 * @package WordPress 59 78 * @subpackage Feed 60 79 * @since 2.5 61 * @uses apply_filters() Calls 'default_feed' hook on the default feed string.62 80 * 63 81 * @return string Default feed, or for example 'rss2', 'atom', etc. 64 82 */ 65 83 function get_default_feed() { 66 $default_feed = apply_filters('default_feed', 'rss2'); 84 /** 85 * Filter the default feed type. 86 * 87 * @since 2.5.0 88 * 89 * @param string $feed_type Type of default feed. Possible values include 'rss2', 'atom'. 90 * Default 'rss2'. 91 */ 92 $default_feed = apply_filters( 'default_feed', 'rss2' ); 67 93 return 'rss' == $default_feed ? 'rss2' : $default_feed; 68 94 } 69 95 … … 73 99 * @package WordPress 74 100 * @subpackage Feed 75 101 * @since 2.2.0 76 * @uses apply_filters() Calls 'get_wp_title_rss' hook on title.77 * @uses wp_title() See function for $sep parameter usage.78 102 * 79 103 * @param string $sep Optional.How to separate the title. See wp_title() for more info. 80 104 * @return string Error message on failure or blog title on success. … … 83 107 $title = wp_title($sep, false); 84 108 if ( is_wp_error( $title ) ) 85 109 return $title->get_error_message(); 110 /** 111 * Filter the blog title for a feed title. 112 * 113 * @since 2.2.0 114 * 115 * @param string $title The current RSS post title. 116 * @param string $sep Separator used by wp_title(). 117 */ 86 118 $title = apply_filters( 'get_wp_title_rss', $title, $sep ); 87 119 return $title; 88 120 } … … 93 125 * @package WordPress 94 126 * @subpackage Feed 95 127 * @since 2.2.0 96 * @uses apply_filters() Calls 'wp_title_rss' on the blog title.97 128 * @see wp_title() $sep parameter usage. 98 129 * 99 130 * @param string $sep Optional. 100 131 */ 101 132 function wp_title_rss( $sep = '»' ) { 133 /** 134 * Filter the the blog title for display of a feed title. 135 * 136 * @since 2.2.0 137 * 138 * @see get_wp_title_rss() 139 * 140 * @param string $wp_title The current retrieved post title. 141 * @param string $sep Separator used by wp_title(). 142 */ 102 143 echo apply_filters( 'wp_title_rss', get_wp_title_rss( $sep ), $sep ); 103 144 } 104 145 … … 108 149 * @package WordPress 109 150 * @subpackage Feed 110 151 * @since 2.0.0 111 * @uses apply_filters() Calls 'the_title_rss' on the post title.112 152 * 113 153 * @return string Current post title. 114 154 */ 115 155 function get_the_title_rss() { 116 156 $title = get_the_title(); 117 $title = apply_filters('the_title_rss', $title); 157 /** 158 * Filter the post title for a feed. 159 * 160 * @since 1.2.1 161 * 162 * @param string $title The current post title. 163 */ 164 $title = apply_filters( 'the_title_rss', $title ); 118 165 return $title; 119 166 } 120 167 … … 136 183 * @package WordPress 137 184 * @subpackage Feed 138 185 * @since 2.9.0 139 * @uses apply_filters() Calls 'the_content_feed' on the content before processing.140 186 * @see get_the_content() 141 187 * 142 188 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf … … 146 192 if ( !$feed_type ) 147 193 $feed_type = get_default_feed(); 148 194 149 $content = apply_filters('the_content', get_the_content()); 195 /** This filter is documented in wp-admin/post-template.php */ 196 $content = apply_filters( 'the_content', get_the_content() ); 150 197 $content = str_replace(']]>', ']]>', $content); 151 return apply_filters('the_content_feed', $content, $feed_type); 198 /** 199 * Filter the post content for use in feeds. 200 * 201 * @since 2.9.0 202 * 203 * @param string $content The current post content. 204 * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'. 205 * Default 'rss2'. 206 */ 207 return apply_filters( 'the_content_feed', $content, $feed_type ); 152 208 } 153 209 154 210 /** … … 157 213 * @package WordPress 158 214 * @subpackage Feed 159 215 * @since 2.9.0 160 * @uses apply_filters() Calls 'the_content_feed' on the content before processing.161 216 * @see get_the_content() 162 217 * 163 218 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf … … 172 227 * @package WordPress 173 228 * @subpackage Feed 174 229 * @since 0.71 175 * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt.176 230 */ 177 231 function the_excerpt_rss() { 178 232 $output = get_the_excerpt(); 179 echo apply_filters('the_excerpt_rss', $output); 233 /** 234 * Filter the post excerpt for a feed. 235 * 236 * @since 1.2.1 237 * 238 * @param string $output The current post excerpt returned by get_the_excerpt(). 239 */ 240 echo apply_filters( 'the_excerpt_rss', $output ); 180 241 } 181 242 182 243 /** … … 185 246 * @package WordPress 186 247 * @subpackage Feed 187 248 * @since 2.3.0 188 * @uses apply_filters() Call 'the_permalink_rss' on the post permalink189 249 */ 190 250 function the_permalink_rss() { 191 echo esc_url( apply_filters('the_permalink_rss', get_permalink() )); 251 /** 252 * Filter the permalink to the post for use in feeds. 253 * 254 * @since 2.3.0 255 * 256 * @param string $post_permalink The current post permalink. 257 */ 258 echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ); 192 259 } 193 260 194 261 /** … … 198 265 * @return none 199 266 */ 200 267 function comments_link_feed() { 268 /** 269 * Filter the permalink to the comments for the current post. 270 * 271 * @since 3.6.0 272 * 273 * @param string $comment_permalink The current comment permalink with '#comments' appended. 274 */ 201 275 echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) ); 202 276 } 203 277 … … 239 313 * @since 1.5.0 240 314 */ 241 315 function comment_link() { 316 /** 317 * Filter the current comment's permalink. 318 * 319 * @since 3.6.0 320 * 321 * @see get_comment_link() 322 * 323 * @param string $comment_permalink The current comment permalink. 324 */ 242 325 echo esc_url( apply_filters( 'comment_link', get_comment_link() ) ); 243 326 } 244 327 … … 248 331 * @package WordPress 249 332 * @subpackage Feed 250 333 * @since 2.0.0 251 * @uses apply_filters() Calls 'comment_author_rss' hook on comment author.252 334 * @uses get_comment_author() 253 335 * 254 336 * @return string Comment Author 255 337 */ 256 338 function get_comment_author_rss() { 257 return apply_filters('comment_author_rss', get_comment_author() ); 339 /** 340 * Filter the current comment author for use in a feed. 341 * 342 * @since 1.5.0 343 * 344 * @see get_comment_author() 345 * 346 * @param string $comment_author The current comment author. 347 */ 348 return apply_filters( 'comment_author_rss', get_comment_author() ); 258 349 } 259 350 260 351 /** … … 274 365 * @package WordPress 275 366 * @subpackage Feed 276 367 * @since 1.0.0 277 * @uses apply_filters() Calls 'comment_text_rss' filter on comment content.278 368 * @uses get_comment_text() 279 369 */ 280 370 function comment_text_rss() { 281 371 $comment_text = get_comment_text(); 282 $comment_text = apply_filters('comment_text_rss', $comment_text); 372 /** 373 * Filter the current comment content for use in a feed. 374 * 375 * @since 1.5.0 376 * 377 * @param string $comment_text The comment content. 378 */ 379 $comment_text = apply_filters( 'comment_text_rss', $comment_text ); 283 380 echo $comment_text; 284 381 } 285 382 … … 293 390 * @package WordPress 294 391 * @subpackage Feed 295 392 * @since 2.1.0 296 * @uses apply_filters()297 393 * 298 394 * @param string $type Optional, default is the type returned by get_default_feed(). 299 395 * @return string All of the post categories for displaying in the feed. … … 324 420 if ( 'rdf' == $type ) 325 421 $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; 326 422 elseif ( 'atom' == $type ) 423 /** This filter is documented in wp-includes/feed.php */ 327 424 $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), esc_attr( $cat_name ) ); 328 425 else 329 426 $the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n"; 330 427 } 331 428 332 return apply_filters('the_category_rss', $the_list, $type); 429 /** 430 * Filter all of the post categories for display in a feed. 431 * 432 * @since 1.2.1 433 * 434 * @param string $the_list All of the RSS post categories. 435 * @param string $type Type of feed. Possible values include 'rss2', 'atom'. 436 * Default 'rss2'. 437 */ 438 return apply_filters( 'the_category_rss', $the_list, $type ); 333 439 } 334 440 335 441 /** … … 379 485 * @package WordPress 380 486 * @subpackage Template 381 487 * @since 1.5.0 382 * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure.383 488 * @uses get_post_custom() To get the current post enclosure metadata. 384 489 */ 385 490 function rss_enclosure() { … … 395 500 $t = preg_split('/[ \t]/', trim($enclosure[2]) ); 396 501 $type = $t[0]; 397 502 398 echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n"); 503 /** 504 * Filter the RSS enclosure HTML link tag for the current post. 505 * 506 * @since 2.2.0 507 * 508 * @param string $html_link_tag The HTML link tag with a URI and other attributes. 509 */ 510 echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n" ); 399 511 } 400 512 } 401 513 } … … 415 527 * @package WordPress 416 528 * @subpackage Template 417 529 * @since 2.2.0 418 * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure.419 530 * @uses get_post_custom() To get the current post enclosure metadata. 420 531 */ 421 532 function atom_enclosure() { … … 426 537 if ($key == 'enclosure') { 427 538 foreach ( (array) $val as $enc ) { 428 539 $enclosure = explode("\n", $enc); 429 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); 540 /** 541 * Filter the atom enclosure HTML link tag for the current post. 542 * 543 * @since 2.2.0 544 * 545 * @param string $html_link_tag The HTML link tag with a URI and other attributes. 546 */ 547 echo apply_filters( 'atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n" ); 430 548 } 431 549 } 432 550 } … … 488 606 */ 489 607 function self_link() { 490 608 $host = @parse_url(home_url()); 609 /** 610 * Filter a feed URL. 611 * 612 * @since 3.6.0 613 * 614 * @see set_url_scheme() 615 * @see wp_unslash() 616 * 617 * @param string $feed_link The link for the feed with set URL scheme. 618 */ 491 619 echo esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ); 492 620 } 493 621 … … 512 640 513 641 $content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream'; 514 642 643 /** 644 * Filter a feed content type. 645 * 646 * @since 2.8.0 647 * 648 * @param string $content_type Media type indicating the type of data that a feed contains. 649 * @param string $type Type of feed. Possible values include 'rss2', 'atom'. 650 * Default 'rss2'. 651 */ 515 652 return apply_filters( 'feed_content_type', $content_type, $type ); 516 653 } 517 654 … … 540 677 $feed->set_file_class( 'WP_SimplePie_File' ); 541 678 542 679 $feed->set_feed_url( $url ); 680 /** This filter is documented in wp-includes/class-feed.php */ 543 681 $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); 682 /** 683 * Fires just before processing the SimplePie feed object. 684 * 685 * @since 3.0.0 686 * 687 * @param object &$feed SimplePie feed object, passed by reference. 688 * @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged. 689 */ 544 690 do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); 545 691 $feed->init(); 546 692 $feed->handle_content_type();
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)