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