Make WordPress Core


Ignore:
Timestamp:
02/23/2007 11:47:57 PM (18 years ago)
Author:
ryan
Message:

Proper atom enclosures. Props rob1n. fixes #1464

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/feed.php

    r4929 r4930  
    174174        return;
    175175
    176     $custom_fields = get_post_custom();
    177     if ( is_array($custom_fields) ) {
    178         while ( list($key, $val) = each($custom_fields) ) {
    179             if ( $key == 'enclosure' ) {
    180                 if ( is_array($val) ) {
    181                     foreach ( (array) $val as $enc ) {
    182                         $enclosure = split( "\n", $enc );
    183                         print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
    184                     }
    185                 }
     176    foreach (get_post_custom() as $k => $v) {
     177        if ($key == 'enclosure') {
     178            foreach ((array)$val as $enc) {
     179                $enclosure = split("\n", $enc);
     180                echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
    186181            }
    187182        }
     
    189184}
    190185
     186function atom_enclosure() {
     187    global $id, $post;
     188    if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
     189        return;
     190
     191    foreach (get_post_custom() as $k => $v) {
     192        if ($key == 'enclosure') {
     193            foreach ((array)$val as $enc) {
     194                $enclosure = split("\n", $enc);
     195                echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
     196            }
     197        }
     198    }
     199}
     200
    191201?>
Note: See TracChangeset for help on using the changeset viewer.