Make WordPress Core

Changeset 6273 for trunk/wp-app.php


Ignore:
Timestamp:
10/19/2007 03:42:30 PM (19 years ago)
Author:
westi
Message:

Refactor atom support to share code. Fixes #5181 props rubys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-app.php

    r6229 r6273  
    1313require_once(ABSPATH . WPINC . '/post-template.php');
    1414require_once(ABSPATH . WPINC . '/atomlib.php');
     15require_once(ABSPATH . WPINC . '/feed.php');
    1516
    1617$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
     
    785786       xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
    786787        <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()); ?>
    788789        <title type="<?php echo $content_type ?>"><?php echo $content ?></title>
    789790        <updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
     
    806807        <link href="<?php the_permalink_rss() ?>" />
    807808<?php if ( strlen( $GLOBALS['post']->post_content ) ) :
    808 list($content_type, $content) = $this->prep_content(get_the_content()); ?>
     809list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
    809810        <content type="<?php echo $content_type ?>"><?php echo $content ?></content>
    810811<?php endif; ?>
     
    814815        <category scheme="<?php bloginfo_rss('home') ?>" term="<?php echo $category->name?>" />
    815816<?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()); ?>
    817818        <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary>
    818819</entry>
    819820<?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         }
    846821
    847822        function ok() {
Note: See TracChangeset for help on using the changeset viewer.