Use (int) rather than intval()
[lhc/web/wiklou.git] / includes / api / ApiFeedContributions.php
index 5bf8da9..ed3b7b8 100644 (file)
@@ -137,7 +137,7 @@ class ApiFeedContributions extends ApiBase {
                }
 
                // Hook completed and did not return a valid feed item
-               $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
+               $title = Title::makeTitle( (int)$row->page_namespace, $row->page_title );
                if ( $title && $title->userCan( 'read', $this->getUser() ) ) {
                        $date = $row->rev_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
@@ -172,33 +172,29 @@ class ApiFeedContributions extends ApiBase {
         * @return string
         */
        protected function feedItemDesc( RevisionRecord $revision ) {
-               if ( $revision ) {
-                       $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text();
-                       try {
-                               $content = $revision->getContent( SlotRecord::MAIN );
-                       } catch ( RevisionAccessException $e ) {
-                               $content = null;
-                       }
-
-                       if ( $content instanceof TextContent ) {
-                               // only textual content has a "source view".
-                               $html = nl2br( htmlspecialchars( $content->getNativeData() ) );
-                       } else {
-                               // XXX: we could get an HTML representation of the content via getParserOutput, but that may
-                               //     contain JS magic and generally may not be suitable for inclusion in a feed.
-                               //     Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method.
-                               // Compare also FeedUtils::formatDiffRow.
-                               $html = '';
-                       }
-
-                       $comment = $revision->getComment();
+               $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text();
+               try {
+                       $content = $revision->getContent( SlotRecord::MAIN );
+               } catch ( RevisionAccessException $e ) {
+                       $content = null;
+               }
 
-                       return '<p>' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg .
-                               htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) .
-                               "</p>\n<hr />\n<div>" . $html . '</div>';
+               if ( $content instanceof TextContent ) {
+                       // only textual content has a "source view".
+                       $html = nl2br( htmlspecialchars( $content->getText() ) );
+               } else {
+                       // XXX: we could get an HTML representation of the content via getParserOutput, but that may
+                       //     contain JS magic and generally may not be suitable for inclusion in a feed.
+                       //     Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method.
+                       // Compare also FeedUtils::formatDiffRow.
+                       $html = '';
                }
 
-               return '';
+               $comment = $revision->getComment();
+
+               return '<p>' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg .
+                       htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) .
+                       "</p>\n<hr />\n<div>" . $html . '</div>';
        }
 
        public function getAllowedParams() {