Ticket #4654: 4654.diff
| File 4654.diff, 17.1 KB (added by , 18 years ago) |
|---|
-
wp-admin/export.php
25 25 <select name="author"> 26 26 <option value="all" selected="selected"><?php _e('All'); ?></option> 27 27 <?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" ); 29 29 foreach ( $authors as $id ) { 30 30 $o = get_userdata( $id ); 31 31 echo "<option value='$o->ID'>$o->display_name</option>"; … … 129 129 ?> 130 130 131 131 <!-- 132 This is a WordPress eXtended RSS file generated by WordPress as an export of 133 your blog. It contains information about your blog's posts, comments, and 134 categories. You may use this file to transfer that content from one site to 132 This is a WordPress eXtended RSS file generated by WordPress as an export of 133 your blog. It contains information about your blog's posts, comments, and 134 categories. You may use this file to transfer that content from one site to 135 135 another. This file is not intended to serve as a complete backup of your 136 136 blog. 137 137 … … 141 141 2. Go to Manage > Import in the blog's admin. 142 142 3. Choose "WordPress" from the list of importers. 143 143 4. Upload this file using the form provided on that page. 144 5. You will first be asked to map the authors in this export file to users 145 on the blog. For each author, you may choose to map an existing user on 144 5. You will first be asked to map the authors in this export file to users 145 on the blog. For each author, you may choose to map an existing user on 146 146 the blog or to create a new user. 147 6. WordPress will then import each of the posts, comments, and categories 147 6. WordPress will then import each of the posts, comments, and categories 148 148 contained in this file onto your blog. 149 149 --> 150 150 … … 172 172 while ( $next_posts = array_splice($post_ids, 0, 20) ) { 173 173 $where = "WHERE ID IN (".join(',', $next_posts).")"; 174 174 $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC"); 175 foreach ($posts as $post) { 175 foreach ($posts as $post) { 176 176 start_wp(); ?> 177 177 <item> 178 178 <title><?php the_title_rss() ?></title> 179 <link><?php permalink_single_rss() ?></link>179 <link><?php the_permalink_rss() ?></link> 180 180 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate> 181 181 <dc:creator><?php the_author() ?></dc:creator> 182 182 <?php the_category_rss() ?> -
wp-app.php
1 1 <?php 2 /* 2 /* 3 3 * wp-app.php - Atom Publishing Protocol support for WordPress 4 4 * Original code by: Elias Torres, http://torrez.us/archives/2006/08/31/491/ 5 5 * Modified by: Dougal Campbell, http://dougal.gunters.org/ … … 166 166 array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}"); 167 167 } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { 168 168 $this->in_content = array(); 169 $this->is_xhtml = $attrs['type'] == 'xhtml'; 169 $this->is_xhtml = $attrs['type'] == 'xhtml'; 170 170 array_push($this->in_content, array($tag,$this->depth)); 171 171 } else if($tag == 'link') { 172 172 array_push($this->entry->links, $attrs); … … 182 182 $tag = array_pop(split(":", $name)); 183 183 184 184 if(!empty($this->in_content)) { 185 if($this->in_content[0][0] == $tag && 185 if($this->in_content[0][0] == $tag && 186 186 $this->in_content[0][1] == $this->depth) { 187 187 array_shift($this->in_content); 188 188 if($this->is_xhtml) { … … 245 245 } 246 246 } 247 247 } 248 } 248 } 249 249 return $name; 250 250 } 251 251 252 252 function xml_escape($string) 253 253 { 254 return str_replace(array('&','"',"'",'<','>'), 255 array('&','"',''','<','>'), 254 return str_replace(array('&','"',"'",'<','>'), 255 array('&','"',''','<','>'), 256 256 $string ); 257 257 } 258 258 } … … 284 284 $this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME'])); 285 285 286 286 $this->selectors = array( 287 '@/service@' => 287 '@/service@' => 288 288 array('GET' => 'get_service'), 289 289 '@/categories@' => 290 290 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', 294 294 'DELETE' => 'delete_post'), 295 '@/posts/?([^/]+)?@' => 296 array('GET' => 'get_posts', 295 '@/posts/?([^/]+)?@' => 296 array('GET' => 'get_posts', 297 297 'POST' => 'create_post'), 298 '@/attachments/?(\d+)?@' => 299 array('GET' => 'get_attachment', 298 '@/attachments/?(\d+)?@' => 299 array('GET' => 'get_attachment', 300 300 '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', 304 304 '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', 308 308 'DELETE' => 'delete_attachment'), 309 309 ); 310 310 } … … 324 324 $method = 'GET'; 325 325 } 326 326 327 // lame. 327 // lame. 328 328 if(strlen($path) == 0 || $path == '/') { 329 329 $path = '/service'; 330 330 } … … 354 354 function get_service() { 355 355 log_app('function','get_service()'); 356 356 $entries_url = $this->get_entries_url(); 357 $categories_url = $this->get_categories_url(); 357 $categories_url = $this->get_categories_url(); 358 358 $media_url = $this->get_attachments_url(); 359 359 $accepted_content_types = join(',',$this->media_content_types); 360 360 $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> 373 373 </service> 374 374 375 375 EOD; 376 376 377 $this->output($introspection, $this->INTROSPECTION_CONTENT_TYPE); 377 $this->output($introspection, $this->INTROSPECTION_CONTENT_TYPE); 378 378 } 379 379 380 380 function get_categories_xml() { … … 393 393 $categories 394 394 </app:categories> 395 395 EOD; 396 $this->output($output, $this->CATEGORIES_CONTENT_TYPE); 396 $this->output($output, $this->CATEGORIES_CONTENT_TYPE); 397 397 } 398 398 399 399 /* … … 894 894 $total_count = $this->get_posts_count(); 895 895 $last_page = (int) ceil($total_count / $count); 896 896 $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; 898 898 $last_page = ((int)$last_page == 1 || (int)$last_page == 0) ? NULL : (int) $last_page; 899 899 ?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://purl.org/atom/app#" xml:lang="<?php echo get_option('rss_language'); ?>"> 900 900 <id><?php $this->the_entries_url() ?></id> … … 912 912 <link rel="self" type="application/atom+xml" href="<?php $this->the_entries_url() ?>" /> 913 913 <rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights> 914 914 <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(); 916 916 $post = $GLOBALS['post']; 917 917 ?> 918 918 <entry> … … 934 934 <link rel="edit" href="<?php $this->the_entry_url() ?>" /> 935 935 <link rel="edit-media" href="<?php $this->the_media_url() ?>" /> 936 936 <?php } else { ?> 937 <link href="<?php permalink_single_rss() ?>" />937 <link href="<?php the_permalink_rss() ?>" /> 938 938 <link rel="edit" href="<?php $this->the_entry_url() ?>" /> 939 939 <?php } ?> 940 940 <?php foreach(get_the_category() as $category) { ?> … … 945 945 <?php endif; ?> 946 946 </entry> 947 947 <?php 948 endwhile; 948 endwhile; 949 949 endif; 950 950 ?></feed> 951 <?php 951 <?php 952 952 $feed = ob_get_contents(); 953 953 ob_end_clean(); 954 954 return $feed; … … 990 990 <link rel="edit-media" href="<?php $this->the_media_url() ?>" /> 991 991 <content type="<?php echo $GLOBALS['post']->post_mime_type ?>" src="<?php the_guid(); ?>"/> 992 992 <?php } else { ?> 993 <link href="<?php permalink_single_rss() ?>" />993 <link href="<?php the_permalink_rss() ?>" /> 994 994 <link rel="edit" href="<?php $this->the_entry_url() ?>" /> 995 995 <?php } ?> 996 996 <?php foreach(get_the_category() as $category) { ?> … … 1011 1011 ob_end_clean(); 1012 1012 1013 1013 log_app('get_entry returning:',$entry); 1014 return $entry; 1014 return $entry; 1015 1015 } 1016 1016 1017 function ok() { 1017 function ok() { 1018 1018 log_app('Status','200: OK'); 1019 1019 header('Content-Type: text/plain'); 1020 1020 status_header('200'); 1021 1021 exit; 1022 1022 } 1023 1023 1024 function no_content() { 1024 function no_content() { 1025 1025 log_app('Status','204: No Content'); 1026 1026 header('Content-Type: text/plain'); 1027 1027 status_header('204'); … … 1109 1109 log_app('Status','401: Auth Required'); 1110 1110 nocache_headers(); 1111 1111 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); 1113 1113 header("HTTP/1.1 401 $msg"); 1114 1114 header('Status: ' . $msg); 1115 1115 header('Content-Type: plain/text'); … … 1159 1159 // if using mod_rewrite/ENV hack 1160 1160 // http://www.besthostratings.com/articles/http-auth-php-cgi.html 1161 1161 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']) = 1163 1163 explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); 1164 1164 } 1165 1165 … … 1198 1198 log_app("get_accepted_content_type", "type=$type, subtype=$subtype"); 1199 1199 1200 1200 foreach($types as $t) { 1201 list($acceptedType,$acceptedSubtype) = explode('/',$t); 1201 list($acceptedType,$acceptedSubtype) = explode('/',$t); 1202 1202 if($acceptedType == '*' || $acceptedType == $type) { 1203 1203 if($acceptedSubtype == '*' || $acceptedSubtype == $subtype) 1204 1204 return $type; … … 1233 1233 @header("ETag: $wp_etag"); 1234 1234 1235 1235 // Support for Conditional GET 1236 if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 1236 if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 1237 1237 $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']); 1238 else 1238 else 1239 1239 $client_etag = false; 1240 1240 1241 1241 $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']); -
wp-includes/deprecated.php
236 236 $cat = get_term_by('name', $cat_name, 'link_category'); 237 237 if ( !$cat ) 238 238 return false; 239 $cat_id = $cat->term_id; 239 $cat_id = $cat->term_id; 240 240 241 241 $args = add_query_arg('category', $cat_id, $args); 242 242 wp_get_links($args); … … 266 266 $cat_id = -1; 267 267 $cat = get_term_by('name', $cat_name, 'link_category'); 268 268 if ( $cat ) 269 $cat_id = $cat->term_id; 269 $cat_id = $cat->term_id; 270 270 271 271 return get_linkobjects($cat_id, $orderby, $limit); 272 272 } … … 314 314 315 315 $links_array = array(); 316 316 foreach ($links as $link) { 317 $links_array[] = $link; 317 $links_array[] = $link; 318 318 } 319 319 320 320 return $links_array; … … 484 484 the_permalink(); 485 485 } 486 486 487 // Use the_permalink_rss() 488 function permalink_single_rss($file = '') { 489 the_permalink_rss(); 490 } 491 487 492 ?> 493 No newline at end of file -
wp-includes/feed-atom.php
31 31 <?php endif; ?> 32 32 </author> 33 33 <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() ?>" /> 35 35 <id><?php the_guid(); ?></id> 36 36 <updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated> 37 37 <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published> 38 38 <?php the_category_rss('atom') ?> 39 39 <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> 40 40 <?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> 42 42 <?php endif; ?> 43 43 <?php atom_enclosure(); ?> 44 44 <?php do_action('atom_entry'); ?> -
wp-includes/feed-rdf.php
27 27 <items> 28 28 <rdf:Seq> 29 29 <?php while (have_posts()): the_post(); ?> 30 <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>30 <rdf:li rdf:resource="<?php the_permalink_rss() ?>"/> 31 31 <?php endwhile; ?> 32 32 </rdf:Seq> 33 33 </items> 34 34 </channel> 35 35 <?php rewind_posts(); while (have_posts()): the_post(); ?> 36 <item rdf:about="<?php permalink_single_rss() ?>">36 <item rdf:about="<?php the_permalink_rss() ?>"> 37 37 <title><?php the_title_rss() ?></title> 38 <link><?php permalink_single_rss() ?></link>38 <link><?php the_permalink_rss() ?></link> 39 39 <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date> 40 40 <dc:creator><?php the_author() ?></dc:creator> 41 41 <?php the_category_rss('rdf') ?> -
wp-includes/feed-rss.php
23 23 <?php } else { // use content ?> 24 24 <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description> 25 25 <?php } ?> 26 <link><?php permalink_single_rss() ?></link>26 <link><?php the_permalink_rss() ?></link> 27 27 <?php do_action('rss_item'); ?> 28 28 </item> 29 29 <?php endwhile; ?> -
wp-includes/feed-rss2-comments.php
1 1 <?php 2 2 header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true); 3 3 4 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; 4 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; 5 5 ?> 6 6 <!-- generator="wordpress/<?php echo $wp_version ?>" --> 7 <rss version="2.0" 7 <rss version="2.0" 8 8 xmlns:content="http://purl.org/rss/1.0/modules/content/"> 9 9 <channel> 10 10 <title><?php … … 15 15 else 16 16 printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); 17 17 ?></title> 18 <link><?php (is_single()) ? permalink_single_rss() : bloginfo_rss("url") ?></link>18 <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link> 19 19 <description><?php bloginfo_rss("description") ?></description> 20 20 <pubDate><?php echo gmdate('r'); ?></pubDate> 21 21 <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator> 22 22 23 <?php 23 <?php 24 24 if ( have_comments() ) : while ( have_comments() ) : the_comment(); 25 25 $comment_post = get_post($comment->comment_post_ID); 26 26 get_post_custom($comment_post->ID); -
wp-includes/feed-rss2.php
24 24 <?php while( have_posts()) : the_post(); ?> 25 25 <item> 26 26 <title><?php the_title_rss() ?></title> 27 <link><?php permalink_single_rss() ?></link>27 <link><?php the_permalink_rss() ?></link> 28 28 <comments><?php comments_link(); ?></comments> 29 29 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate> 30 30 <dc:creator><?php the_author() ?></dc:creator> -
wp-includes/feed.php
69 69 echo apply_filters('the_excerpt_rss', $output); 70 70 } 71 71 72 function the_permalink_rss() { 73 echo apply_filters('the_permalink_rss', get_permalink()); 72 74 73 function permalink_single_rss($file = '') {74 echo get_permalink();75 75 } 76 76 77 78 77 function comment_link() { 79 78 echo get_comment_link(); 80 79 }