Changeset 1139 for trunk/wp-app.php
- Timestamp:
- 10/30/07 16:49:38 (1 year ago)
- Files:
-
- trunk/wp-app.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-app.php
r1125 r1139 13 13 require_once(ABSPATH . WPINC . '/post-template.php'); 14 14 require_once(ABSPATH . WPINC . '/atomlib.php'); 15 require_once(ABSPATH . WPINC . '/feed.php');16 15 17 16 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] ); … … 698 697 699 698 function get_feed($page = 1, $post_type = 'post') { 700 global $post, $wp, $wp_query, $posts, $wpdb, $blog_id ;699 global $post, $wp, $wp_query, $posts, $wpdb, $blog_id, $post_cache; 701 700 log_app('function',"get_feed($page, '$post_type')"); 702 701 ob_start(); … … 717 716 $wpdb = $GLOBALS['wpdb']; 718 717 $blog_id = (int) $GLOBALS['blog_id']; 718 $post_cache = $GLOBALS['post_cache']; 719 719 log_app('function',"query_posts(# " . print_r($wp_query, true) . "#)"); 720 720 … … 740 740 <link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" /> 741 741 <rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights> 742 < ?php the_generator( 'atom' ); ?>742 <generator uri="http://wordpress.com/" version="1.0.5-dc">WordPress.com Atom API</generator> 743 743 <?php if ( have_posts() ) { 744 744 while ( have_posts() ) { … … 757 757 log_app('function',"get_entry($postID, '$post_type')"); 758 758 ob_start(); 759 global $posts, $post, $wp_query, $wp, $wpdb, $blog_id ;759 global $posts, $post, $wp_query, $wp, $wpdb, $blog_id, $post_cache; 760 760 switch($post_type) { 761 761 case 'post': … … 786 786 xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>"> 787 787 <id><?php the_guid($GLOBALS['post']->ID); ?></id> 788 <?php list($content_type, $content) = prep_atom_text_construct(get_the_title()); ?>788 <?php list($content_type, $content) = $this->prep_content(get_the_title()); ?> 789 789 <title type="<?php echo $content_type ?>"><?php echo $content ?></title> 790 790 <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated> … … 807 807 <link href="<?php the_permalink_rss() ?>" /> 808 808 <?php if ( strlen( $GLOBALS['post']->post_content ) ) : 809 list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>809 list($content_type, $content) = $this->prep_content(get_the_content()); ?> 810 810 <content type="<?php echo $content_type ?>"><?php echo $content ?></content> 811 811 <?php endif; ?> … … 815 815 <category scheme="<?php bloginfo_rss('home') ?>" term="<?php echo $category->name?>" /> 816 816 <?php } ?> 817 <?php list($content_type, $content) = prep_atom_text_construct(get_the_excerpt()); ?>817 <?php list($content_type, $content) = $this->prep_content(get_the_excerpt()); ?> 818 818 <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary> 819 819 </entry> 820 820 <?php } 821 822 function prep_content($data) { 823 if (strpos($data, '<') === false && strpos($data, '&') === false) { 824 return array('text', $data); 825 } 826 827 $parser = xml_parser_create(); 828 xml_parse($parser, '<div>' . $data . '</div>', true); 829 $code = xml_get_error_code($parser); 830 xml_parser_free($parser); 831 832 if (!$code) { 833 if (strpos($data, '<') === false) { 834 return array('text', $data); 835 } else { 836 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>"; 837 return array('xhtml', $data); 838 } 839 } 840 841 if (strpos($data, ']]>') == false) { 842 return array('html', "<![CDATA[$data]]>"); 843 } else { 844 return array('html', htmlspecialchars($data)); 845 } 846 } 821 847 822 848 function ok() {
