Ticket #33591: 33591.5.diff
File 33591.5.diff, 1.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/feed.php
502 502 foreach ( (array) get_post_custom() as $key => $val ) { 503 503 if ($key == 'enclosure') { 504 504 foreach ( (array) $val as $enc ) { 505 $enclosure = explode("\n", $enc); 505 506 /* Since enclosures are passed-in line-delimited, 507 * the best we can do is attempt to validate the values 508 * before rendering them. 509 */ 510 $enclosure = explode( "\n", $enc ); 511 512 $url = ''; 513 $legth = ''; 514 $type = ''; 515 516 if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) { 517 $url = $enclosure[0]; 518 } 519 520 if ( isset( $enclosure[1] && is_numeric( $enclosure[1] ) ) { 521 $length = $enclosure[1]; 522 } 523 524 if ( isset( $enclosure[2] && in_array( $enclosure[2], get_allowed_mime_types() ) ) { 525 $type = $enclosure[2]; 526 } 527 528 $html_link_tag = '<link href="' . esc_url ( $url ) . '" rel="enclosure" length="' . esc_attr( $length ) . '" type="' . esc_attr( $type ) . '" />' . "\n"; 529 506 530 /** 507 531 * Filters the atom enclosure HTML link tag for the current post. 508 532 * … … 510 534 * 511 535 * @param string $html_link_tag The HTML link tag with a URI and other attributes. 512 536 */ 513 echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n");537 echo apply_filters( 'atom_enclosure', $html_link_tag ); 514 538 } 515 539 } 516 540 }