Ticket #5328: feed-filter.diff
| File feed-filter.diff, 17.9 KB (added by , 18 years ago) |
|---|
-
wp-includes/default-filters.php
108 108 add_filter('single_post_title', 'wptexturize'); 109 109 110 110 // RSS filters 111 add_filter('feed_format', 'wp_feed_selector'); 111 112 add_filter('the_title_rss', 'strip_tags'); 112 113 add_filter('the_title_rss', 'ent2ncr', 8); 113 114 add_filter('the_title_rss', 'wp_specialchars'); -
wp-includes/link-template.php
226 226 } 227 227 } 228 228 229 function get_feed_link($feed=' rss2') {229 function get_feed_link($feed='') { 230 230 global $wp_rewrite; 231 231 $do_perma = 0; 232 232 $feed_url = get_option('siteurl'); … … 239 239 $permalink = $wp_rewrite->get_comment_feed_permastruct(); 240 240 } 241 241 242 if ( 'rss2'== $feed )242 if ( get_default_feed() == $feed ) 243 243 $feed = ''; 244 244 245 245 $permalink = str_replace('%feed%', $feed, $permalink); … … 255 255 return apply_filters('feed_link', $output, $feed); 256 256 } 257 257 258 function get_post_comments_feed_link($post_id = '', $feed = ' rss2') {258 function get_post_comments_feed_link($post_id = '', $feed = '') { 259 259 global $id; 260 260 261 261 if ( empty($post_id) ) … … 263 263 264 264 if ( '' != get_option('permalink_structure') ) { 265 265 $url = trailingslashit( get_permalink($post_id) ) . 'feed'; 266 if ( 'rss2' != $feed)266 if ( ('' != $feed) && (get_default_feed() != $feed) ) 267 267 $url .= "/$feed"; 268 268 $url = user_trailingslashit($url, 'single_feed'); 269 269 } else { -
wp-includes/general-template.php
83 83 case 'description': 84 84 $output = get_option('blogdescription'); 85 85 break; 86 case 'feed_type_name': 87 $output = get_feed_info( 'display_name' ); 88 break; 89 case 'feed_type_short_name': 90 $output = get_feed_info( 'short_name' ); 91 break; 92 case 'feed_type_long_name': 93 $output = get_feed_info( 'long_name' ); 94 break; 95 case 'feed_mime_type': 96 $output = get_feed_info( 'mime_type' ); 97 break; 86 98 case 'rdf_url': 87 99 $output = get_feed_link('rdf'); 88 100 break; … … 92 104 case 'rss2_url': 93 105 $output = get_feed_link('rss2'); 94 106 break; 107 case 'feed_url': 108 return bloginfo(get_default_feed()."_url"); 95 109 case 'atom_url': 96 110 $output = get_feed_link('atom'); 97 111 break; 112 case 'comments_feed_url': 113 return bloginfo('comments_'.get_default_feed()."_url"); 98 114 case 'comments_atom_url': 99 115 $output = get_feed_link('comments_atom'); 100 116 break; … … 195 211 196 212 if ( !empty($tag) ) { 197 213 $tag = get_term($tag, 'post_tag', OBJECT, 'display'); 198 if ( is_wp_error( $tag ) ) 214 if ( is_wp_error( $tag ) ) 199 215 return $tag; 200 216 if ( ! empty($tag->name) ) 201 217 $title = apply_filters('single_tag_title', $tag->name); … … 291 307 292 308 if ( !empty($tag_id) ) { 293 309 $my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display'); 294 if ( is_wp_error( $my_tag ) ) 310 if ( is_wp_error( $my_tag ) ) 295 311 return false; 296 312 $my_tag_name = apply_filters('single_tag_title', $my_tag->name); 297 313 if ( !empty($my_tag_name) ) { … … 969 985 e = e ? e : window.event; 970 986 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 971 987 var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 972 if(typeof i == 'undefined')988 if(typeof i == 'undefined') 973 989 return true; 974 990 tinyMCE.execCommand("mceStartTyping"); 975 991 this.blur(); … … 983 999 e = e ? e : window.event; 984 1000 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 985 1001 var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 986 if(typeof i == 'undefined')1002 if(typeof i == 'undefined') 987 1003 return true; 988 1004 tinyMCE.execCommand("mceStartTyping"); 989 1005 this.blur(); … … 1042 1058 extract($args, EXTR_SKIP); 1043 1059 1044 1060 // Who knows what else people pass in $args 1045 $total = (int) $total;1061 $total = (int) $total; 1046 1062 if ( $total < 2 ) 1047 1063 return; 1048 1064 $current = (int) $current; -
wp-includes/feed.php
1 1 <?php 2 2 3 /** 4 * get_default_feed() - determines the default feed format using the 5 * pluggable 'feed-format' filter. 6 * 7 * @package WordPress 8 * @subpackage Feed 9 * @since 2.4 10 * 11 * @return string $result feed format name (rss2, atom, rdf, rss) 12 */ 13 function get_default_feed() { 14 return apply_filters('feed_format','name'); 15 } 16 17 /** 18 * get_feed_info() - retrieves the name, mime_type, display_name, short_name 19 * or long_name of the default feed type using the pluggable feed_format 20 * filter. 21 * 22 * @package WordPress 23 * @subpackage Feed 24 * @since 2.4 25 * 26 * @param string $attr desired feed attribute 27 * @return string $result the value of the desired feed attribute 28 */ 29 function get_feed_info($attr) { 30 return apply_filters('feed_format',$attr); 31 } 32 33 /** 34 * wp_feed_selector() - the default 'feed_format' filter. This one is 35 * selects rss2, others could select rss, rdf, or atom. For the given 36 * feed type, a name, mime_type, display_name, short_name, or 37 * long_name may be obtained using this filter. 38 * 39 * Custom themes and plugin combinations could define additional 40 * attributes. 41 * 42 * @package WordPress 43 * @subpackage Feed 44 * @since 2.4 45 * 46 * @param string $attr desired feed attribute 47 * @return string $result the value of the desired feed attribute 48 */ 49 function wp_feed_selector($attr = 'name') { 50 switch ( $attr ) : 51 case 'mime_type' : 52 return 'application/rss+xml'; 53 case 'display_name' : 54 return 'RSS 2.0'; 55 case 'short_name' : 56 return 'RSS'; 57 case 'long_name' : 58 return '<abbr title="Really Simple Syndication">RSS</abbr>'; 59 default : 60 // must be 'rss2', 'rss', 'rdf', or 'atom' 61 return 'rss2'; 62 endswitch; 63 } 64 3 65 function get_bloginfo_rss($show = '') { 4 66 $info = strip_tags(get_bloginfo($show)); 5 67 return apply_filters('get_bloginfo_rss', convert_chars($info)); … … 99 161 100 162 101 163 function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'nolongerused') { 164 comments_feed_link($link_text); 165 } 166 167 function comments_feed_link($link_text = '') { 168 if ( '' == $link_text ) $link_text = get_feed_info('display_name'); 102 169 $url = get_post_comments_feed_link(); 103 170 echo "<a href='$url'>$link_text</a>"; 104 171 } 105 172 106 107 173 function comments_rss($commentsrssfilename = 'nolongerused') { 108 174 return get_post_comments_feed_link(); 109 175 } … … 114 180 $permalink_structure = get_option('permalink_structure'); 115 181 116 182 if ( '' == $permalink_structure ) { 117 $link = get_option('home') . '?feed= rss2&author=' . $author_id;183 $link = get_option('home') . '?feed='.get_default_feed().'&author=' . $author_id; 118 184 } else { 119 185 $link = get_author_posts_url($author_id, $author_nicename); 120 186 $link = trailingslashit($link) . user_trailingslashit('feed', 'feed'); … … 151 217 $permalink_structure = get_option('permalink_structure'); 152 218 153 219 if ( '' == $permalink_structure ) { 154 $link = get_option('home') . "?feed=$feed&cat=" . $cat_id;220 $link = get_option('home') . '?feed='.get_default_feed()."&cat=" . $cat_ID; 155 221 } else { 156 222 $link = get_category_link($cat_id); 157 223 if( 'rss2' == $feed ) … … 215 281 echo get_the_category_rss($type); 216 282 } 217 283 218 function get_tag_feed_link($tag_id, $feed = ' rss2') {284 function get_tag_feed_link($tag_id, $feed = '') { 219 285 $tag_id = (int) $tag_id; 286 if ( $feed = '' ) $feed = get_default_feed(); 220 287 221 288 $tag = get_tag($tag_id); 222 289 … … 229 296 $link = get_option('home') . "?feed=$feed&tag=" . $tag->slug; 230 297 } else { 231 298 $link = get_tag_link($tag->term_id); 232 if ( 'rss2'== $feed )299 if ( get_default_feed() == $feed ) 233 300 $feed_link = 'feed'; 234 301 else 235 302 $feed_link = "feed/$feed"; … … 292 359 * 293 360 * @package WordPress 294 361 * @subpackage Feed 295 * @since 2.4 362 * @since 2.4 296 363 * 297 364 * @param string $data input string 298 365 * @return array $result array(type, value) … … 311 378 if (!$code) { 312 379 if (strpos($data, '<') === false) { 313 380 return array('text', $data); 314 } else {381 } else { 315 382 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>"; 316 383 return array('xhtml', $data); 317 }384 } 318 385 } 319 386 320 387 if (strpos($data, ']]>') == false) { -
wp-includes/functions.php
95 95 // see http://en.wikipedia.org/wiki/Byte 96 96 $quant = array( 97 97 // ========================= Origin ==== 98 'TB' => 1099511627776, // pow( 1024, 4)99 'GB' => 1073741824, // pow( 1024, 3)100 'MB' => 1048576, // pow( 1024, 2)101 'kB' => 1024, // pow( 1024, 1)102 'B ' => 1, // pow( 1024, 0)98 'TB' => 1099511627776, // pow( 1024, 4) 99 'GB' => 1073741824, // pow( 1024, 3) 100 'MB' => 1048576, // pow( 1024, 2) 101 'kB' => 1024, // pow( 1024, 1) 102 'B ' => 1, // pow( 1024, 0) 103 103 ); 104 104 105 105 foreach ( $quant as $unit => $mag ) … … 404 404 405 405 406 406 function gzip_compression() { 407 if ( !get_option( 'gzipcompression' ) || ini_get( 'zlib.output_compression' ) == 'On' || ini_get( 'zlib.output_compression_level' ) > 0 || ini_get( 'output_handler' ) == 'ob_gzhandler' || !extension_loaded( 'zlib' ) )407 if ( !get_option( 'gzipcompression' ) || ini_get( 'zlib.output_compression' ) == 'On' || ini_get( 'zlib.output_compression_level' ) > 0 || ini_get( 'output_handler' ) == 'ob_gzhandler' || !extension_loaded( 'zlib' ) ) 408 408 return false; 409 409 ob_start( 'ob_gzhandler' ); 410 410 } … … 861 861 $feed = preg_replace( '/^_+/', '', $feed ); 862 862 863 863 if ( $feed == '' || $feed == 'feed' ) 864 $feed = 'rss2';864 $feed = get_default_feed(); 865 865 866 866 $hook = 'do_feed_' . $feed; 867 867 do_action( $hook, $wp_query->is_comment_feed ); … … 911 911 function is_blog_installed() { 912 912 global $wpdb; 913 913 914 // Check cache first. If options table goes away and we have true cached, oh well. 914 // Check cache first. If options table goes away and we have true cached, oh well. 915 915 if ( wp_cache_get('is_blog_installed') ) 916 916 return true; 917 917 … … 1167 1167 $trans['add']['bookmark'] = array( __( 'Are you sure you want to add this link?' ), false ); 1168 1168 $trans['delete']['bookmark'] = array( __( 'Are you sure you want to delete this link: "%s"?' ), 'use_id' ); 1169 1169 $trans['update']['bookmark'] = array( __( 'Are you sure you want to edit this link: "%s"?' ), 'use_id' ); 1170 $trans['bulk']['bookmarks'] = array( __( 'Are you sure you want to bulk modify links?' ), false ); 1170 $trans['bulk']['bookmarks'] = array( __( 'Are you sure you want to bulk modify links?' ), false ); 1171 1171 1172 $trans['add']['page'] = array( __( 'Are you sure you want to add this page?' ), false );1172 $trans['add']['page'] = array( __( 'Are you sure you want to add this page?' ), false ); 1173 1173 $trans['delete']['page'] = array( __( 'Are you sure you want to delete this page: "%s"?' ), 'get_the_title' ); 1174 1174 $trans['update']['page'] = array( __( 'Are you sure you want to edit this page: "%s"?' ), 'get_the_title' ); 1175 1175 … … 1177 1177 $trans['activate']['plugin'] = array( __( 'Are you sure you want to activate this plugin: "%s"?' ), 'use_id' ); 1178 1178 $trans['deactivate']['plugin'] = array( __( 'Are you sure you want to deactivate this plugin: "%s"?' ), 'use_id' ); 1179 1179 1180 $trans['add']['post'] = array( __( 'Are you sure you want to add this post?' ), false );1180 $trans['add']['post'] = array( __( 'Are you sure you want to add this post?' ), false ); 1181 1181 $trans['delete']['post'] = array( __( 'Are you sure you want to delete this post: "%s"?' ), 'get_the_title' ); 1182 1182 $trans['update']['post'] = array( __( 'Are you sure you want to edit this post: "%s"?' ), 'get_the_title' ); 1183 1183 1184 $trans['add']['user'] = array( __( 'Are you sure you want to add this user?' ), false );1184 $trans['add']['user'] = array( __( 'Are you sure you want to add this user?' ), false ); 1185 1185 $trans['delete']['users'] = array( __( 'Are you sure you want to delete users?' ), false ); 1186 $trans['bulk']['users'] = array( __( 'Are you sure you want to bulk modify users?' ), false );1186 $trans['bulk']['users'] = array( __( 'Are you sure you want to bulk modify users?' ), false ); 1187 1187 $trans['update']['user'] = array( __( 'Are you sure you want to edit this user: "%s"?' ), 'get_author_name' ); 1188 1188 $trans['update']['profile'] = array( __( 'Are you sure you want to modify the profile for: "%s"?' ), 'get_author_name' ); 1189 1189 1190 1190 $trans['update']['options'] = array( __( 'Are you sure you want to edit your settings?' ), false ); 1191 1191 $trans['update']['permalink'] = array( __( 'Are you sure you want to change your permalink structure to: %s?' ), 'use_id' ); 1192 $trans['edit']['file'] = array( __( 'Are you sure you want to edit this file: "%s"?' ), 'use_id' );1193 $trans['edit']['theme'] = array( __( 'Are you sure you want to edit this theme file: "%s"?' ), 'use_id' );1192 $trans['edit']['file'] = array( __( 'Are you sure you want to edit this file: "%s"?' ), 'use_id' ); 1193 $trans['edit']['theme'] = array( __( 'Are you sure you want to edit this theme file: "%s"?' ), 'use_id' ); 1194 1194 $trans['switch']['theme'] = array( __( 'Are you sure you want to switch to this theme: "%s"?' ), 'use_id' ); 1195 1195 1196 1196 if ( isset( $trans[$verb][$noun] ) ) { … … 1219 1219 1220 1220 $title = __( 'WordPress Confirmation' ); 1221 1221 // Remove extra layer of slashes. 1222 $_POST = stripslashes_deep( $_POST );1222 $_POST = stripslashes_deep( $_POST ); 1223 1223 if ( $_POST ) { 1224 1224 $q = http_build_query( $_POST ); 1225 1225 $q = explode( ini_get( 'arg_separator.output' ), $q); … … 1264 1264 $message = "<p>$message</p>"; 1265 1265 } 1266 1266 1267 if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL ) 1268 $admin_dir = WP_SITEURL . '/wp-admin/'; 1267 if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL ) 1268 $admin_dir = WP_SITEURL . '/wp-admin/'; 1269 1269 elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) ) 1270 $admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/'; 1270 $admin_dir = get_bloginfo( 'wpurl' ) . '/wp-admin/'; 1271 1271 elseif ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false ) 1272 1272 $admin_dir = ''; 1273 1273 else … … 1484 1484 return abs( intval( $maybeint ) ); 1485 1485 } 1486 1486 1487 ?> 1488 No newline at end of file 1487 ?> -
wp-content/themes/default/footer.php
5 5 <p> 6 6 <?php bloginfo('name'); ?> is proudly powered by 7 7 <a href="http://wordpress.org/">WordPress</a> 8 <br /><a href="<?php bloginfo(' rss2_url'); ?>">Entries (RSS)</a>9 and <a href="<?php bloginfo('comments_ rss2_url'); ?>">Comments (RSS)</a>.8 <br /><a href="<?php bloginfo('feed_url'); ?>">Entries (<?php bloginfo('feed_type_short_name'); ?>)</a> 9 and <a href="<?php bloginfo('comments_feed_url'); ?>">Comments (<?php bloginfo('feed_type_short_name'); ?>)</a>. 10 10 <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --> 11 11 </p> 12 12 </div> -
wp-content/themes/default/single.php
27 27 /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> 28 28 on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> 29 29 and is filed under <?php the_category(', ') ?>. 30 You can follow any responses to this entry through the <?php comments_ rss_link('RSS 2.0'); ?> feed.30 You can follow any responses to this entry through the <?php comments_feed_link(); ?> feed. 31 31 32 32 <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { 33 33 // Both Comments and Pings are open ?> -
wp-content/themes/default/header.php
7 7 <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title> 8 8 9 9 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> 10 <link rel="alternate" type=" application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />10 <link rel="alternate" type="<?php bloginfo('feed_mime_type'); ?>" title="<?php bloginfo('name'); ?> <?php bloginfo('feed_type_short_name'); ?> Feed" href="<?php bloginfo('feed_url'); ?>" /> 11 11 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 12 12 13 13 <style type="text/css" media="screen"> -
wp-content/themes/default/attachment.php
28 28 /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> 29 29 on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> 30 30 and is filed under <?php the_category(', ') ?>. 31 You can follow any responses to this entry through the <?php comments_ rss_link('RSS 2.0'); ?> feed.31 You can follow any responses to this entry through the <?php comments_feed_link(); ?> feed. 32 32 33 33 <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { 34 34 // Both Comments and Pings are open ?>