Changeset 6273
- Timestamp:
- 10/19/2007 03:42:30 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
wp-app.php (modified) (4 diffs)
-
wp-includes/feed-atom.php (modified) (2 diffs)
-
wp-includes/feed.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-app.php
r6229 r6273 13 13 require_once(ABSPATH . WPINC . '/post-template.php'); 14 14 require_once(ABSPATH . WPINC . '/atomlib.php'); 15 require_once(ABSPATH . WPINC . '/feed.php'); 15 16 16 17 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] ); … … 785 786 xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>"> 786 787 <id><?php the_guid($GLOBALS['post']->ID); ?></id> 787 <?php list($content_type, $content) = $this->prep_content(get_the_title()); ?>788 <?php list($content_type, $content) = prep_atom_text_construct(get_the_title()); ?> 788 789 <title type="<?php echo $content_type ?>"><?php echo $content ?></title> 789 790 <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated> … … 806 807 <link href="<?php the_permalink_rss() ?>" /> 807 808 <?php if ( strlen( $GLOBALS['post']->post_content ) ) : 808 list($content_type, $content) = $this->prep_content(get_the_content()); ?>809 list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?> 809 810 <content type="<?php echo $content_type ?>"><?php echo $content ?></content> 810 811 <?php endif; ?> … … 814 815 <category scheme="<?php bloginfo_rss('home') ?>" term="<?php echo $category->name?>" /> 815 816 <?php } ?> 816 <?php list($content_type, $content) = $this->prep_content(get_the_excerpt()); ?>817 <?php list($content_type, $content) = prep_atom_text_construct(get_the_excerpt()); ?> 817 818 <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary> 818 819 </entry> 819 820 <?php } 820 821 function prep_content($data) {822 if (strpos($data, '<') === false && strpos($data, '&') === false) {823 return array('text', $data);824 }825 826 $parser = xml_parser_create();827 xml_parse($parser, '<div>' . $data . '</div>', true);828 $code = xml_get_error_code($parser);829 xml_parser_free($parser);830 831 if (!$code) {832 if (strpos($data, '<') === false) {833 return array('text', $data);834 } else {835 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";836 return array('xhtml', $data);837 }838 }839 840 if (strpos($data, ']]>') == false) {841 return array('html', "<![CDATA[$data]]>");842 } else {843 return array('html', htmlspecialchars($data));844 }845 }846 821 847 822 function ok() { -
trunk/wp-includes/feed-atom.php
r6195 r6273 31 31 <?php endif; ?> 32 32 </author> 33 <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title> 33 <?php list($content_type, $content) = prep_atom_text_construct(get_the_title()); ?> 34 <title type="<?php echo $content_type ?>"><?php echo $content ?></title> 34 35 <link rel="alternate" type="text/html" href="<?php the_permalink_rss() ?>" /> 35 36 <id><?php the_guid(); ?></id> … … 37 38 <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published> 38 39 <?php the_category_rss('atom') ?> 39 <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> 40 <?php list($content_type, $content) = prep_atom_text_construct(get_the_excerpt()); ?> 41 <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary> 40 42 <?php if ( !get_option('rss_use_excerpt') ) : ?> 41 <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content> 43 <?php list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?> 44 <content type="<?php echo $content_type ?>" xml:base="<?php the_permalink_rss()?>"><?php echo $content ?></content> 42 45 <?php endif; ?> 43 46 <?php atom_enclosure(); ?> -
trunk/wp-includes/feed.php
r6125 r6273 251 251 } 252 252 253 /** 254 * prep_atom_text_construct() - determine if given string of data is 255 * type text, html, or xhtml, per RFC 4287 section 3.1. 256 * 257 * In the case of WordPress, text is defined as containing no markup, 258 * xhtml is defined as "well formed", and html as tag soup (i.e., the rest). 259 * 260 * Container div tags are added to xhtml values, per section 3.1.1.3. 261 * 262 * @package WordPress 263 * @subpackage Feed 264 * 265 * @param string $data input string 266 * @return array $result array(type, value) 267 * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1 268 */ 269 function prep_atom_text_construct($data) { 270 if (strpos($data, '<') === false && strpos($data, '&') === false) { 271 return array('text', $data); 272 } 273 274 $parser = xml_parser_create(); 275 xml_parse($parser, '<div>' . $data . '</div>', true); 276 $code = xml_get_error_code($parser); 277 xml_parser_free($parser); 278 279 if (!$code) { 280 if (strpos($data, '<') === false) { 281 return array('text', $data); 282 } else { 283 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>"; 284 return array('xhtml', $data); 285 } 286 } 287 288 if (strpos($data, ']]>') == false) { 289 return array('html', "<![CDATA[$data]]>"); 290 } else { 291 return array('html', htmlspecialchars($data)); 292 } 293 } 294 253 295 ?>
Note: See TracChangeset
for help on using the changeset viewer.