Ticket #16747: 16747.diff
File 16747.diff, 3.9 KB (added by , 14 years ago) |
---|
-
wp-includes/feed.php
369 369 * the user has the password for the post. If not then it will return before 370 370 * displaying. 371 371 * 372 * Also uses the function get_post_ custom() to get the post's 'enclosure'372 * Also uses the function get_post_meta() to get the post's 'enclosure' 373 373 * metadata field and parses the value to display the enclosure(s). The 374 374 * enclosure(s) consist of enclosure HTML tag(s) with a URI and other 375 375 * attributes. … … 377 377 * @package WordPress 378 378 * @subpackage Template 379 379 * @since 1.5.0 380 * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure .381 * @uses get_post_ custom() To get the current post enclosure metadata.380 * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure and 'rss_enclosures' hook on all rss enclosures. 381 * @uses get_post_meta() To get the current post enclosure metadata. 382 382 */ 383 383 function rss_enclosure() { 384 384 if ( post_password_required() ) 385 385 return; 386 386 387 foreach ( (array) get_post_custom() as $key => $val) { 388 if ($key == 'enclosure') { 389 foreach ( (array) $val as $enc ) { 390 $enclosure = explode("\n", $enc); 387 $output = ''; 388 $post_id = get_the_ID(); 389 $encs = get_post_meta( $post_id, 'enclosure' ); 391 390 392 //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3' 393 $t = preg_split('/[ \t]/', trim($enclosure[2]) ); 394 $type = $t[0]; 391 if ( !$encs ) 392 return; 395 393 396 echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n"); 397 } 398 } 394 foreach ( $encs as $enc ) { 395 $enclosure = array_map( 'trim', explode( "\n", $enc ) ); 396 397 //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3' 398 list( $type ) = preg_split( '/[ \t]/', $enclosure[2] ); 399 400 $output .= apply_filters( 'rss_enclosure', "\t\t" . '<enclosure url="' . htmlspecialchars( $enclosure[0] ) . '" length="' . $enclosure[1] . '" type="' . $type . '" />' . "\n", $enclosure ); 399 401 } 402 403 echo apply_filters( 'rss_enclosures', $output ); 400 404 } 401 405 402 406 /** … … 406 410 * the user has the password for the post. If not then it will return before 407 411 * displaying. 408 412 * 409 * Also uses the function get_post_ custom() to get the post's 'enclosure'413 * Also uses the function get_post_meta() to get the post's 'enclosure' 410 414 * metadata field and parses the value to display the enclosure(s). The 411 415 * enclosure(s) consist of link HTML tag(s) with a URI and other attributes. 412 416 * 413 417 * @package WordPress 414 418 * @subpackage Template 415 419 * @since 2.2.0 416 * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure .417 * @uses get_post_ custom() To get the current post enclosure metadata.420 * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure and 'atom_enclosures' hook on all atom enclosures. 421 * @uses get_post_meta() To get the current post enclosure metadata. 418 422 */ 419 423 function atom_enclosure() { 420 424 if ( post_password_required() ) 421 425 return; 422 426 423 foreach ( (array) get_post_custom() as $key => $val ) { 424 if ($key == 'enclosure') { 425 foreach ( (array) $val as $enc ) { 426 $enclosure = split("\n", $enc); 427 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); 428 } 429 } 427 $output = ''; 428 $post_id = get_the_ID(); 429 $encs = get_post_meta( $post_id, 'enclosure' ); 430 431 if ( !$encs ) 432 return; 433 434 foreach ( $encs as $enc ) { 435 $enclosure = array_map( 'trim', explode( "\n", $enc ) ); 436 $output .= apply_filters( 'atom_enclosure', "\t\t" . '<link href="' . htmlspecialchars( $enclosure[0] ) . '" rel="enclosure" length="' . $enclosure[1] . '" type="' . $enclosure[2] . '" />' . "\n", $enclosure ); 430 437 } 438 439 echo apply_filters( 'atom_enclosures', $output ); 431 440 } 432 441 433 442 /**