Esempio n. 1
0
 /**
  * Convert a FeedItem to an FeedSMItem.
  * This is to make sitemap feed get along with normal MediaWiki feeds.
  * @param FeedItem Original item.
  * @return FeedSMItem Converted item.
  */
 public static function newFromFeedItem(FeedItem $item)
 {
     // @todo FIXME: This is borked (esp. on history), but better than a fatal (not by much).
     // maybe try and get title from url?
     $title = Title::newFromText($item->getTitle());
     if (!$title) {
         throw new MWException('Error getting title object from string in FeedItem.');
     }
     $date = $item->getDate();
     return new FeedSMItem($title, $date);
 }
Esempio n. 2
0
    /**
     * Output a given item.
     * @param FeedItem $item
     */
    function outItem($item)
    {
        global $wgMimeType;
        // @codingStandardsIgnoreStart Ignore long lines and formatting issues.
        ?>
	<entry>
		<id><?php 
        print $item->getUniqueId();
        ?>
</id>
		<title><?php 
        print $item->getTitle();
        ?>
</title>
		<link rel="alternate" type="<?php 
        print $wgMimeType;
        ?>
" href="<?php 
        print wfExpandUrl($item->getUrl(), PROTO_CURRENT);
        ?>
"/>
		<?php 
        if ($item->getDate()) {
            ?>
		<updated><?php 
            print $this->formatTime($item->getDate());
            ?>
Z</updated>
		<?php 
        }
        ?>

		<summary type="html"><?php 
        print $item->getDescription();
        ?>
</summary>
		<?php 
        if ($item->getAuthor()) {
            ?>
<author><name><?php 
            print $item->getAuthor();
            ?>
</name></author><?php 
        }
        ?>
	</entry>

<?php 
        /* @todo FIXME: Need to add comments
        	<?php if( $item->getComments() ) { ?><dc:comment><?php print $item->getComments() ?></dc:comment><?php }?>
        	  */
    }