WordPress.org

Make WordPress Core

Changeset 5910


Ignore:
Timestamp:
08/21/2007 06:27:45 PM (11 years ago)
Author:
ryan
Message:

Deprecate permalink_single_rss(). Add the_permalink_rss() with accompanying filter. Props joostdevalk and Otto42. fixes #4654

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/export.php

    r5862 r5910  
    2626<option value="all" selected="selected"><?php _e('All'); ?></option>
    2727<?php
    28 $authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" ); 
     28$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
    2929foreach ( $authors as $id ) {
    3030    $o = get_userdata( $id );
     
    132132
    133133<!--
    134     This is a WordPress eXtended RSS file generated by WordPress as an export of 
    135     your blog. It contains information about your blog's posts, comments, and 
    136     categories. You may use this file to transfer that content from one site to 
     134    This is a WordPress eXtended RSS file generated by WordPress as an export of
     135    your blog. It contains information about your blog's posts, comments, and
     136    categories. You may use this file to transfer that content from one site to
    137137    another. This file is not intended to serve as a complete backup of your
    138138    blog.
     
    144144    3.  Choose "WordPress" from the list of importers.
    145145    4.  Upload this file using the form provided on that page.
    146     5.  You will first be asked to map the authors in this export file to users 
    147         on the blog. For each author, you may choose to map an existing user on 
     146    5.  You will first be asked to map the authors in this export file to users
     147        on the blog. For each author, you may choose to map an existing user on
    148148        the blog or to create a new user.
    149     6.  WordPress will then import each of the posts, comments, and categories 
     149    6.  WordPress will then import each of the posts, comments, and categories
    150150        contained in this file onto your blog.
    151151-->
     
    175175            $where = "WHERE ID IN (".join(',', $next_posts).")";
    176176            $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
    177                 foreach ($posts as $post) { 
     177                foreach ($posts as $post) {
    178178            start_wp(); ?>
    179179<item>
    180180<title><?php the_title_rss() ?></title>
    181 <link><?php permalink_single_rss() ?></link>
     181<link><?php the_permalink_rss() ?></link>
    182182<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    183183<dc:creator><?php the_author() ?></dc:creator>
  • trunk/wp-app.php

    r5843 r5910  
    11<?php
    2 /* 
     2/*
    33 * wp-app.php - Atom Publishing Protocol support for WordPress
    44 * Original code by: Elias Torres, http://torrez.us/archives/2006/08/31/491/
     
    167167        } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
    168168            $this->in_content = array();
    169             $this->is_xhtml = $attrs['type'] == 'xhtml'; 
     169            $this->is_xhtml = $attrs['type'] == 'xhtml';
    170170            array_push($this->in_content, array($tag,$this->depth));
    171171        } else if($tag == 'link') {
     
    183183
    184184        if(!empty($this->in_content)) {
    185             if($this->in_content[0][0] == $tag && 
     185            if($this->in_content[0][0] == $tag &&
    186186            $this->in_content[0][1] == $this->depth) {
    187187                array_shift($this->in_content);
     
    246246                }
    247247            }
    248         } 
     248        }
    249249        return $name;
    250250    }
     
    252252    function xml_escape($string)
    253253    {
    254              return str_replace(array('&','"',"'",'<','>'), 
    255                 array('&amp;','&quot;','&apos;','&lt;','&gt;'), 
     254             return str_replace(array('&','"',"'",'<','>'),
     255                array('&amp;','&quot;','&apos;','&lt;','&gt;'),
    256256                $string );
    257257    }
     
    285285
    286286        $this->selectors = array(
    287             '@/service@' => 
     287            '@/service@' =>
    288288                array('GET' => 'get_service'),
    289289            '@/categories@' =>
    290290                array('GET' => 'get_categories_xml'),
    291             '@/post/(\d+)@' => 
    292                 array('GET' => 'get_post', 
    293                         'PUT' => 'put_post', 
     291            '@/post/(\d+)@' =>
     292                array('GET' => 'get_post',
     293                        'PUT' => 'put_post',
    294294                        'DELETE' => 'delete_post'),
    295             '@/posts/?([^/]+)?@' => 
    296                 array('GET' => 'get_posts', 
     295            '@/posts/?([^/]+)?@' =>
     296                array('GET' => 'get_posts',
    297297                        'POST' => 'create_post'),
    298             '@/attachments/?(\d+)?@' => 
    299                 array('GET' => 'get_attachment', 
     298            '@/attachments/?(\d+)?@' =>
     299                array('GET' => 'get_attachment',
    300300                        'POST' => 'create_attachment'),
    301             '@/attachment/file/(\d+)@' => 
    302                 array('GET' => 'get_file', 
    303                         'PUT' => 'put_file', 
     301            '@/attachment/file/(\d+)@' =>
     302                array('GET' => 'get_file',
     303                        'PUT' => 'put_file',
    304304                        'DELETE' => 'delete_file'),
    305             '@/attachment/(\d+)@' => 
    306                 array('GET' => 'get_attachment', 
    307                         'PUT' => 'put_attachment', 
     305            '@/attachment/(\d+)@' =>
     306                array('GET' => 'get_attachment',
     307                        'PUT' => 'put_attachment',
    308308                        'DELETE' => 'delete_attachment'),
    309309        );
     
    325325        }
    326326
    327         // lame. 
     327        // lame.
    328328        if(strlen($path) == 0 || $path == '/') {
    329329            $path = '/service';
     
    355355        log_app('function','get_service()');
    356356        $entries_url = $this->get_entries_url();
    357         $categories_url = $this->get_categories_url(); 
     357        $categories_url = $this->get_categories_url();
    358358        $media_url = $this->get_attachments_url();
    359359        $accepted_content_types = join(',',$this->media_content_types);
    360360        $introspection = <<<EOD
    361 <service xmlns="http://purl.org/atom/app#" xmlns:atom="http://www.w3.org/2005/Atom"> 
    362     <workspace title="WordPress Workspace"> 
    363         <collection href="$entries_url" title="Posts"> 
    364         <atom:title>WordPress Posts</atom:title> 
    365         <accept>entry</accept> 
    366         <categories href="$categories_url" /> 
    367         </collection> 
    368         <collection href="$media_url" title="Media"> 
    369         <atom:title>WordPress Media</atom:title> 
    370         <accept>$accepted_content_types</accept> 
    371         </collection> 
    372     </workspace> 
     361<service xmlns="http://purl.org/atom/app#" xmlns:atom="http://www.w3.org/2005/Atom">
     362    <workspace title="WordPress Workspace">
     363        <collection href="$entries_url" title="Posts">
     364        <atom:title>WordPress Posts</atom:title>
     365        <accept>entry</accept>
     366        <categories href="$categories_url" />
     367        </collection>
     368        <collection href="$media_url" title="Media">
     369        <atom:title>WordPress Media</atom:title>
     370        <accept>$accepted_content_types</accept>
     371        </collection>
     372    </workspace>
    373373</service>
    374374
    375375EOD;
    376376
    377         $this->output($introspection, $this->INTROSPECTION_CONTENT_TYPE); 
     377        $this->output($introspection, $this->INTROSPECTION_CONTENT_TYPE);
    378378    }
    379379
     
    394394</app:categories>
    395395EOD;
    396     $this->output($output, $this->CATEGORIES_CONTENT_TYPE); 
     396    $this->output($output, $this->CATEGORIES_CONTENT_TYPE);
    397397}
    398398
     
    895895        $last_page = (int) ceil($total_count / $count);
    896896        $next_page = (($page + 1) > $last_page) ? NULL : $page + 1;
    897         $prev_page = ($page - 1) < 1 ? NULL : $page - 1; 
     897        $prev_page = ($page - 1) < 1 ? NULL : $page - 1;
    898898        $last_page = ((int)$last_page == 1 || (int)$last_page == 0) ? NULL : (int) $last_page;
    899899?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://purl.org/atom/app#" xml:lang="<?php echo get_option('rss_language'); ?>">
     
    913913<rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights>
    914914<generator uri="http://wordpress.com/" version="1.0.5-dc">WordPress.com Atom API</generator>
    915 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); 
     915<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
    916916$post = $GLOBALS['post'];
    917917?>
     
    935935        <link rel="edit-media" href="<?php $this->the_media_url() ?>" />
    936936    <?php } else { ?>
    937         <link href="<?php permalink_single_rss() ?>" />
     937        <link href="<?php the_permalink_rss() ?>" />
    938938        <link rel="edit" href="<?php $this->the_entry_url() ?>" />
    939939    <?php } ?>
     
    946946    </entry>
    947947<?php
    948     endwhile; 
     948    endwhile;
    949949    endif;
    950950?></feed>
    951 <?php 
     951<?php
    952952        $feed = ob_get_contents();
    953953        ob_end_clean();
     
    991991    <content type="<?php echo $GLOBALS['post']->post_mime_type ?>" src="<?php the_guid(); ?>"/>
    992992<?php } else { ?>
    993     <link href="<?php permalink_single_rss() ?>" />
     993    <link href="<?php the_permalink_rss() ?>" />
    994994    <link rel="edit" href="<?php $this->the_entry_url() ?>" />
    995995<?php } ?>
     
    10121012
    10131013        log_app('get_entry returning:',$entry);
    1014         return $entry; 
    1015     }
    1016 
    1017     function ok() { 
     1014        return $entry;
     1015    }
     1016
     1017    function ok() {
    10181018        log_app('Status','200: OK');
    10191019        header('Content-Type: text/plain');
     
    10221022    }
    10231023
    1024     function no_content() { 
     1024    function no_content() {
    10251025        log_app('Status','204: No Content');
    10261026        header('Content-Type: text/plain');
     
    11101110        nocache_headers();
    11111111        header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
    1112         header('WWW-Authenticate: Form action="' . get_option('siteurl') . '/wp-login.php"', false); 
     1112        header('WWW-Authenticate: Form action="' . get_option('siteurl') . '/wp-login.php"', false);
    11131113        header("HTTP/1.1 401 $msg");
    11141114        header('Status: ' . $msg);
     
    11601160        // http://www.besthostratings.com/articles/http-auth-php-cgi.html
    11611161        if(isset($_SERVER['HTTP_AUTHORIZATION'])) {
    1162             list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = 
     1162            list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
    11631163                explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
    11641164        }
     
    11991199
    12001200        foreach($types as $t) {
    1201             list($acceptedType,$acceptedSubtype) = explode('/',$t); 
     1201            list($acceptedType,$acceptedSubtype) = explode('/',$t);
    12021202            if($acceptedType == '*' || $acceptedType == $type) {
    12031203                if($acceptedSubtype == '*' || $acceptedSubtype == $subtype)
     
    12341234
    12351235        // Support for Conditional GET
    1236         if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 
     1236        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
    12371237            $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
    1238         else 
     1238        else
    12391239            $client_etag = false;
    12401240
  • trunk/wp-includes/deprecated.php

    r5569 r5910  
    237237    if ( !$cat )
    238238        return false;
    239     $cat_id = $cat->term_id;   
     239    $cat_id = $cat->term_id;
    240240
    241241    $args = add_query_arg('category', $cat_id, $args);
     
    267267        $cat = get_term_by('name', $cat_name, 'link_category');
    268268        if ( $cat )
    269             $cat_id = $cat->term_id;   
     269            $cat_id = $cat->term_id;
    270270
    271271        return get_linkobjects($cat_id, $orderby, $limit);
     
    315315        $links_array = array();
    316316        foreach ($links as $link) {
    317             $links_array[] = $link; 
     317            $links_array[] = $link;
    318318        }
    319319
     
    485485}
    486486
     487// Use the_permalink_rss()
     488function permalink_single_rss($file = '') {
     489    the_permalink_rss();
     490}
     491
    487492?>
  • trunk/wp-includes/feed-atom.php

    r5699 r5910  
    3232        </author>
    3333        <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
    34         <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
     34        <link rel="alternate" type="text/html" href="<?php the_permalink_rss() ?>" />
    3535        <id><?php the_guid(); ?></id>
    3636        <updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
     
    3939        <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
    4040<?php if ( !get_option('rss_use_excerpt') ) : ?>
    41         <content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
     41        <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
    4242<?php endif; ?>
    4343<?php atom_enclosure(); ?>
  • trunk/wp-includes/feed-rdf.php

    r5640 r5910  
    2828        <rdf:Seq>
    2929        <?php while (have_posts()): the_post(); ?>
    30             <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
     30            <rdf:li rdf:resource="<?php the_permalink_rss() ?>"/>
    3131        <?php endwhile; ?>
    3232        </rdf:Seq>
     
    3434</channel>
    3535<?php rewind_posts(); while (have_posts()): the_post(); ?>
    36 <item rdf:about="<?php permalink_single_rss() ?>">
     36<item rdf:about="<?php the_permalink_rss() ?>">
    3737    <title><?php the_title_rss() ?></title>
    38     <link><?php permalink_single_rss() ?></link>
     38    <link><?php the_permalink_rss() ?></link>
    3939     <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
    4040    <dc:creator><?php the_author() ?></dc:creator>
  • trunk/wp-includes/feed-rss.php

    r5640 r5910  
    2424        <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description>
    2525<?php } ?>
    26         <link><?php permalink_single_rss() ?></link>
     26        <link><?php the_permalink_rss() ?></link>
    2727        <?php do_action('rss_item'); ?>
    2828    </item>
  • trunk/wp-includes/feed-rss2-comments.php

    r5881 r5910  
    1818            printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
    1919    ?></title>
    20     <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
     20    <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
    2121    <description><?php bloginfo_rss("description") ?></description>
    2222    <pubDate><?php echo gmdate('r'); ?></pubDate>
    2323    <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
    2424
    25 <?php 
     25<?php
    2626if ( have_comments() ) : while ( have_comments() ) : the_comment();
    2727    $comment_post = get_post($comment->comment_post_ID);
  • trunk/wp-includes/feed-rss2.php

    r5640 r5910  
    2525    <item>
    2626        <title><?php the_title_rss() ?></title>
    27         <link><?php permalink_single_rss() ?></link>
     27        <link><?php the_permalink_rss() ?></link>
    2828        <comments><?php comments_link(); ?></comments>
    2929        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
  • trunk/wp-includes/feed.php

    r5755 r5910  
    7070}
    7171
    72 
    73 function permalink_single_rss($file = '') {
    74     echo get_permalink();
    75 }
    76 
     72function the_permalink_rss() {
     73    echo apply_filters('the_permalink_rss', get_permalink());
     74
     75}
    7776
    7877function comment_link() {
Note: See TracChangeset for help on using the changeset viewer.