Ticket #33591: 33591.4.diff
File 33591.4.diff, 1.9 KB (added by , 9 years ago) |
---|
-
feed.php
501 501 foreach ( (array) get_post_custom() as $key => $val ) { 502 502 if ($key == 'enclosure') { 503 503 foreach ( (array) $val as $enc ) { 504 $enclosure = explode("\n", $enc); 504 $enclosure = explode( "\n", $enc ); 505 506 $new_enclosure = array( 'href' => trim( htmlspecialchars( $enclosure[0] ) ) ); 507 unset( $enclosure[0] ); 508 509 $mimes = get_allowed_mime_types(); 510 $mime_valid = false; 511 512 foreach ( $enclosure as $enclosure_key => $item ) { 513 514 if ( ! isset( $new_enclosure['length'] ) ) { 515 if ( is_numeric( $item ) ) { 516 $new_enclosure['length'] = trim( htmlspecialchars( $item ) ); 517 unset( $enclosure[$enclosure_key] ); 518 } 519 } 520 521 if ( ! isset( $new_enclosure['type'] ) ) { 522 foreach ( $mimes as $type => $mime ) { 523 if ( strpos( $mime, $item ) !== false ) { 524 $new_enclosure['type'] = trim( htmlspecialchars( $item ) ); 525 unset( $enclosure[$enclosure_key] ); 526 break; 527 } 528 } 529 } 530 531 } 532 533 $new_enclosure = array_merge( $new_enclosure, array_values( $enclosure ) ); 534 505 535 /** 506 536 * Filter the atom enclosure HTML link tag for the current post. 507 537 * … … 509 539 * 510 540 * @param string $html_link_tag The HTML link tag with a URI and other attributes. 511 541 */ 512 echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ). '" />' . "\n" );542 echo apply_filters( 'atom_enclosure', '<link href="' . $new_enclosure['href'] . '" rel="enclosure" length="' . $new_enclosure['length'] . '" type="' . $new_enclosure['type'] . '" />' . "\n" ); 513 543 } 514 544 } 515 545 }