[wp-cvs] wordpress/wp-includes feed-functions.php, NONE, 1.1 comment-functions.php, 1.11, 1.12 template-functions-author.php, 1.16, 1.17 template-functions-category.php, 1.46, 1.47 template-functions-general.php, 1.61, 1.62 template-functions-links.php, 1.46, 1.47 template-functions-post.php, 1.37, 1.38 template-functions.php, 1.54, 1.55 vars.php, 1.42, 1.43

Matthew Mullenweg saxmatt at users.sourceforge.net
Fri Jan 7 22:02:02 GMT 2005


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25435/wp-includes

Modified Files:
	comment-functions.php template-functions-author.php 
	template-functions-category.php template-functions-general.php 
	template-functions-links.php template-functions-post.php 
	template-functions.php vars.php 
Added Files:
	feed-functions.php 
Log Message:
Some feed template function cleanup.

--- NEW FILE: feed-functions.php ---
<?php

function bloginfo_rss($show='') {
    $info = strip_tags(get_bloginfo($show));
    echo convert_chars($info);
}

function the_title_rss() {
	$title = get_the_title();
	$title = apply_filters('the_title', $title);
	$title = apply_filters('the_title_rss', $title);
	echo $title;
}

function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
	$content = get_the_content($more_link_text, $stripteaser, $more_file);
	$content = apply_filters('the_content', $content);
	if ($cut && !$encode_html) {
		$encode_html = 2;
	}
	if ($encode_html == 1) {
		$content = wp_specialchars($content);
		$cut = 0;
	} elseif ($encode_html == 0) {
		$content = make_url_footnote($content);
	} elseif ($encode_html == 2) {
		$content = strip_tags($content);
	}
	if ($cut) {
		$blah = explode(' ', $content);
		if (count($blah) > $cut) {
			$k = $cut;
			$use_dotdotdot = 1;
		} else {
			$k = count($blah);
			$use_dotdotdot = 0;
		}
		for ($i=0; $i<$k; $i++) {
			$excerpt .= $blah[$i].' ';
		}
		$excerpt .= ($use_dotdotdot) ? '...' : '';
		$content = $excerpt;
	}
	$content = str_replace(']]>', ']]&gt;', $content);
	echo $content;
}

function the_excerpt_rss() {
	$output = get_the_excerpt(true);
	echo apply_filters('the_excerpt_rss', $output);
}

function permalink_single_rss($file = '') {
    echo get_permalink();
}

function comment_link_rss() {
	echo get_comments_link();
}

function comment_author_rss() {
	$author = apply_filters('comment_author_rss', get_comment_author() );
	echo $author;
}

function comment_text_rss() {
	$comment_text = get_comment_text();
	$comment_text = apply_filters('comment_text_rss', $comment_text);
	echo $comment_text;
}

function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'wp-commentsrss2.php') {
	$url = comments_rss($commentsrssfilename);
	echo "<a href='$url'>$link_text</a>";
}

function comments_rss($commentsrssfilename = 'wp-commentsrss2.php') {
	global $id;
	global $querystring_start, $querystring_equal, $querystring_separator;

	if ('' != get_settings('permalink_structure'))
		$url = trailingslashit( get_permalink() ) . 'feed/';
	else
		$url = get_settings('siteurl') . "/$commentsrssfilename?p=$id";

	return $url;
}

function get_author_rss_link($echo = false, $author_id, $author_nicename) {
       global $querystring_start, $querystring_equal;
       $auth_ID = $author_id;
       $permalink_structure = get_settings('permalink_structure');

       if ('' == $permalink_structure) {
           $file = get_settings('siteurl') . '/wp-rss2.php';
           $link = $file . $querystring_start . 'author' . $querystring_equal . $author_id;
       } else {
           $link = get_author_link(0, $author_id, $author_nicename);
           $link = $link . "feed/";
       }

       if ($echo) echo $link;
       return $link;
}

function get_category_rss_link($echo = false, $category_id, $category_nicename) {
       global $querystring_start, $querystring_equal;
       $cat_ID = $category_id;
       $permalink_structure = get_settings('permalink_structure');

       if ('' == $permalink_structure) {
               $file = get_settings('siteurl') . '/wp-rss2.php';
        $link = $file . $querystring_start . 'cat' . $querystring_equal . $category_id;
       } else {
        $link = get_category_link(0, $category_id, $category_nicename);
               $link = $link . "feed/";
       }

       if ($echo) echo $link;
       return $link;
}

function the_category_rss($type = 'rss') {
    $categories = get_the_category();
    $the_list = '';
    foreach ($categories as $category) {
        $category->cat_name = convert_chars($category->cat_name);
        if ('rdf' == $type) {
            $the_list .= "\n\t<dc:subject>$category->cat_name</dc:subject>";
        } else {
            $the_list .= "\n\t<category>$category->cat_name</category>";
        }
    }
    echo apply_filters('the_category_rss', $the_list);
}

function rss_enclosure() {
	global $id;
	$custom_fields = get_post_custom();
	if( is_array( $custom_fields ) ) {
		while( list( $key, $val ) = each( $custom_fields ) ) { 
			if( $key == 'enclosure' ) {
				if (is_array($val)) {
					foreach($val as $enc) {
						$enclosure = split( "\n", $enc );
						print "<enclosure url='".trim( $enclosure[ 0 ] )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
					}
				}
			}
		}
	}
}

?>
Index: template-functions-links.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-links.php,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** template-functions-links.php	24 Dec 2004 01:34:47 -0000	1.46
--- template-functions-links.php	7 Jan 2005 22:01:59 -0000	1.47
***************
*** 23,30 ****
  }
  
- function permalink_single_rss($file = '') {
-     echo get_permalink();
- }
- 
  function get_permalink($id = false) {
  	global $post, $wpdb;
--- 23,26 ----

Index: template-functions-post.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-post.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** template-functions-post.php	4 Jan 2005 23:30:10 -0000	1.37
--- template-functions-post.php	7 Jan 2005 22:01:59 -0000	1.38
***************
*** 40,50 ****
  }
  
- function the_title_rss() {
- 	$title = get_the_title();
- 	$title = apply_filters('the_title', $title);
- 	$title = apply_filters('the_title_rss', $title);
- 	echo $title;
- }
- 
  function get_the_title($id = 0) {
  	global $post, $wpdb;
--- 40,43 ----
***************
*** 60,63 ****
--- 53,71 ----
  }
  
+ function get_the_guid( $id = 0 ) {
+ 	global $post, $wpdb;
+ 	$guid = $post->guid;
+ 
+ 	if ( 0 != $id )
+ 		$title = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE ID = $id");
+ 	$guid = apply_filters('get_the_guid', $guid);
+ 	return $guid;
+ }
+ 
+ function the_guid( $id = 0 ) {
+ 	echo get_the_guid();
+ }
+ 
+ 
  function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
      $content = get_the_content($more_link_text, $stripteaser, $more_file);
***************
*** 67,103 ****
  }
  
- function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
- 	$content = get_the_content($more_link_text, $stripteaser, $more_file);
- 	$content = apply_filters('the_content', $content);
- 	if ($cut && !$encode_html) {
- 		$encode_html = 2;
- 	}
- 	if ($encode_html == 1) {
- 		$content = wp_specialchars($content);
- 		$cut = 0;
- 	} elseif ($encode_html == 0) {
- 		$content = make_url_footnote($content);
- 	} elseif ($encode_html == 2) {
- 		$content = strip_tags($content);
- 	}
- 	if ($cut) {
- 		$blah = explode(' ', $content);
- 		if (count($blah) > $cut) {
- 			$k = $cut;
- 			$use_dotdotdot = 1;
- 		} else {
- 			$k = count($blah);
- 			$use_dotdotdot = 0;
- 		}
- 		for ($i=0; $i<$k; $i++) {
- 			$excerpt .= $blah[$i].' ';
- 		}
- 		$excerpt .= ($use_dotdotdot) ? '...' : '';
- 		$content = $excerpt;
- 	}
- 	$content = str_replace(']]>', ']]&gt;', $content);
- 	echo $content;
- }
- 
  function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
      global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
--- 75,78 ----
***************
*** 143,182 ****
  }
  
- function the_excerpt_rss($cut = 0, $encode_html = FALSE) {
-     $output = get_the_excerpt(true);
- 
-     $output = convert_chars($output);
-     if ($cut && !$encode_html) {
-         $encode_html = 2;
-     }
-     if ($encode_html == 1) {
-         $output = wp_specialchars($output);
-         $cut = 0;
-     } elseif ($encode_html === 0) {
-         $output = make_url_footnote($output);
-     } elseif ($encode_html == 2) {
-         $output = strip_tags($output);
-         $output = str_replace('&', '&amp;', $output);
-     }
-     if ($cut) {
-         $excerpt = '';
-         $blah = explode(' ', $output);
-         if (count($blah) > $cut) {
-             $k = $cut;
-             $use_dotdotdot = 1;
-         } else {
-             $k = count($blah);
-             $use_dotdotdot = 0;
-         }
-         for ($i=0; $i<$k; $i++) {
-             $excerpt .= $blah[$i].' ';
-         }
-         $excerpt .= ($use_dotdotdot) ? '...' : '';
-         $output = $excerpt;
-     }
-     $output = str_replace(']]>', ']]&gt;', $output);
-     echo apply_filters('the_excerpt_rss', $output);
- }
- 
  function get_the_excerpt($fakeit = true) {
      global $id, $post;
--- 118,121 ----

Index: template-functions-category.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-category.php,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** template-functions-category.php	4 Jan 2005 23:29:13 -0000	1.46
--- template-functions-category.php	7 Jan 2005 22:01:59 -0000	1.47
***************
*** 44,64 ****
  }
  
- function get_category_rss_link($echo = false, $category_id, $category_nicename) {
-        global $querystring_start, $querystring_equal;
-        $cat_ID = $category_id;
-        $permalink_structure = get_settings('permalink_structure');
- 
-        if ('' == $permalink_structure) {
-                $file = get_settings('siteurl') . '/wp-rss2.php';
-         $link = $file . $querystring_start . 'cat' . $querystring_equal . $category_id;
-        } else {
-         $link = get_category_link(0, $category_id, $category_nicename);
-                $link = $link . "feed/";
-        }
- 
-        if ($echo) echo $link;
-        return $link;
- }
- 
  function the_category($separator = '', $parents='') {
      $categories = get_the_category();
--- 44,47 ----
***************
*** 119,136 ****
  }
  
- function the_category_rss($type = 'rss') {
-     $categories = get_the_category();
-     $the_list = '';
-     foreach ($categories as $category) {
-         $category->cat_name = convert_chars($category->cat_name);
-         if ('rdf' == $type) {
-             $the_list .= "\n\t<dc:subject>$category->cat_name</dc:subject>";
-         } else {
-             $the_list .= "\n\t<category>$category->cat_name</category>";
-         }
-     }
-     echo apply_filters('the_category_rss', $the_list);
- }
- 
  function get_the_category_by_ID($cat_ID) {
      global $cache_categories, $wpdb;
--- 102,105 ----

Index: template-functions-author.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-author.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** template-functions-author.php	24 Dec 2004 01:34:47 -0000	1.16
--- template-functions-author.php	7 Jan 2005 22:01:59 -0000	1.17
***************
*** 141,161 ****
  }
  
- function get_author_rss_link($echo = false, $author_id, $author_nicename) {
-        global $querystring_start, $querystring_equal;
-        $auth_ID = $author_id;
-        $permalink_structure = get_settings('permalink_structure');
- 
-        if ('' == $permalink_structure) {
-            $file = get_settings('siteurl') . '/wp-rss2.php';
-            $link = $file . $querystring_start . 'author' . $querystring_equal . $author_id;
-        } else {
-            $link = get_author_link(0, $author_id, $author_nicename);
-            $link = $link . "feed/";
-        }
- 
-        if ($echo) echo $link;
-        return $link;
- }
- 
  function wp_list_authors($args = '') {
  	parse_str($args, $r);
--- 141,144 ----

Index: vars.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/vars.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** vars.php	6 Jan 2005 22:51:44 -0000	1.42
--- vars.php	7 Jan 2005 22:01:59 -0000	1.43
***************
*** 159,162 ****
--- 159,163 ----
  
  add_filter('comment_excerpt', 'convert_chars');
+ add_filter('the_excerpt_rss', 'convert_chars');
  
  // Places to balance tags on input

Index: comment-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/comment-functions.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** comment-functions.php	6 Jan 2005 23:10:28 -0000	1.11
--- comment-functions.php	7 Jan 2005 22:01:58 -0000	1.12
***************
*** 61,68 ****
  }
  
- function comment_link_rss() {
- 	echo get_comments_link();
- }
- 
  function comments_popup_script($width=400, $height=400, $file='') {
      global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
--- 61,64 ----
***************
*** 146,154 ****
  }
  
- function comment_author_rss() {
- 	$author = apply_filters('comment_author_rss', get_comment_author() );
- 	echo $author;
- }
- 
  function get_comment_author_email() {
  	global $comment;
--- 142,145 ----
***************
*** 245,254 ****
  }
  
- function comment_text_rss() {
- 	$comment_text = get_comment_text();
- 	$comment_text = apply_filters('comment_text_rss', $comment_text);
- 	echo $comment_text;
- }
- 
  function get_comment_excerpt() {
  	global $comment;
--- 236,239 ----
***************
*** 300,320 ****
  }
  
- function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'wp-commentsrss2.php') {
- 	$url = comments_rss($commentsrssfilename);
- 	echo "<a href='$url'>$link_text</a>";
- }
- 
- function comments_rss($commentsrssfilename = 'wp-commentsrss2.php') {
- 	global $id;
- 	global $querystring_start, $querystring_equal, $querystring_separator;
- 
- 	if ('' != get_settings('permalink_structure'))
- 		$url = trailingslashit( get_permalink() ) . 'feed/';
- 	else
- 		$url = get_settings('siteurl') . "/$commentsrssfilename?p=$id";
- 
- 	return $url;
- }
- 
  function get_trackback_url() {
  	global $id;
--- 285,288 ----

Index: template-functions-general.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-general.php,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** template-functions-general.php	2 Jan 2005 02:47:45 -0000	1.61
--- template-functions-general.php	7 Jan 2005 22:01:59 -0000	1.62
***************
*** 62,75 ****
  }
  
- function bloginfo_rss($show='') {
-     $info = strip_tags(get_bloginfo($show));
-     echo convert_chars($info);
- }
- 
- function bloginfo_unicode($show='') {
-     $info = get_bloginfo($show);
-     echo convert_chars($info);
- }
- 
  function get_bloginfo($show='') {
  
--- 62,65 ----
***************
*** 612,628 ****
  }
  
! function the_time($d='', $echo = true) {
!     global $id, $post;
!     if ($d=='') {
!         $the_time = mysql2date(get_settings('time_format'), $post->post_date);
!     } else {
!         $the_time = mysql2date($d, $post->post_date);
!     }
!     $the_time = apply_filters('the_time', $the_time);
!     if ($echo) {
!         echo $the_time;
!     } else {
!         return $the_time;
!     }
  }
  
--- 602,625 ----
  }
  
! function the_time( $d = '' ) {
! 	echo apply_filters('the_time', get_the_time( $d ) );
! }
! 
! function get_the_time( $d = '' ) {
! 	global $id, $post;
! 	if ( '' == $d )
! 		$the_time = date( get_settings('time_format'), get_post_time() );
! 	else
! 		$the_time = mysql2date( $d, get_post_time() );
! 	return apply_filters('get_the_time', $the_time);
! }
! 
! function get_post_time( $gmt = false ) { // returns timestamp
! 	global $post;
! 	if ( $gmt )
! 		$time = mysql2date('U', $post->post_date_gmt);
! 	else
! 		$time = mysql2date('U', $post->post_date);
! 	return apply_filters('get_the_time', $time);
  }
  

Index: template-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** template-functions.php	16 Dec 2004 23:18:15 -0000	1.54
--- template-functions.php	7 Jan 2005 22:01:59 -0000	1.55
***************
*** 20,22 ****
--- 20,24 ----
  require($curpath . 'comment-functions.php');
  
+ require($curpath . 'feed-functions.php');
+ 
  ?>
\ No newline at end of file



More information about the cvs mailing list