r102851 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102850‎ | r102851 | r102852 >
Date:09:57, 12 November 2011
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* Renamed member variables to begin with a lower case
* Moved constant definitions from the constructor to the class definition
* Removed default values from the class definition for members that are always set in the constructor
Modified paths:
  • /trunk/phase3/includes/Feed.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Feed.php
@@ -39,33 +39,33 @@
4040 /**
4141 * @var Title
4242 */
43 - var $Title = 'Wiki';
44 - var $Description = '';
45 - var $Url = '';
46 - var $Date = '';
47 - var $Author = '';
48 - var $UniqueId = '';
49 - var $RSSIsPermalink;
 43+ var $title;
 44+ var $description;
 45+ var $url;
 46+ var $date;
 47+ var $author;
 48+ var $uniqueId;
 49+ var $comments;
 50+ var $rssIsPermalink = false;
5051
5152 /**
5253 * Constructor
5354 *
54 - * @param $Title String|Title Item's title
55 - * @param $Description String
56 - * @param $Url String: URL uniquely designating the item.
57 - * @param $Date String: Item's date
58 - * @param $Author String: Author's user name
59 - * @param $Comments String
 55+ * @param $title String|Title Item's title
 56+ * @param $description String
 57+ * @param $url String: URL uniquely designating the item.
 58+ * @param $date String: Item's date
 59+ * @param $author String: Author's user name
 60+ * @param $comments String
6061 */
61 - function __construct( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
62 - $this->Title = $Title;
63 - $this->Description = $Description;
64 - $this->Url = $Url;
65 - $this->UniqueId = $Url;
66 - $this->RSSIsPermalink = false;
67 - $this->Date = $Date;
68 - $this->Author = $Author;
69 - $this->Comments = $Comments;
 62+ function __construct( $title, $description, $url, $date = '', $author = '', $comments = '' ) {
 63+ $this->title = $title;
 64+ $this->description = $description;
 65+ $this->url = $url;
 66+ $this->uniqueId = $url;
 67+ $this->date = $date;
 68+ $this->author = $author;
 69+ $this->comments = $comments;
7070 }
7171
7272 /**
@@ -86,8 +86,8 @@
8787 * @return String
8888 */
8989 public function getUniqueId() {
90 - if ( $this->UniqueId ) {
91 - return $this->xmlEncode( $this->UniqueId );
 90+ if ( $this->uniqueId ) {
 91+ return $this->xmlEncode( $this->uniqueId );
9292 }
9393 }
9494
@@ -95,11 +95,11 @@
9696 * set the unique id of an item
9797 *
9898 * @param $uniqueId String: unique id for the item
99 - * @param $RSSisPermalink Boolean: set to true if the guid (unique id) is a permalink (RSS feeds only)
 99+ * @param $rssIsPermalink Boolean: set to true if the guid (unique id) is a permalink (RSS feeds only)
100100 */
101 - public function setUniqueId($uniqueId, $RSSisPermalink = false) {
102 - $this->UniqueId = $uniqueId;
103 - $this->RSSIsPermalink = $RSSisPermalink;
 101+ public function setUniqueId( $uniqueId, $rssIsPermalink = false ) {
 102+ $this->uniqueId = $uniqueId;
 103+ $this->rssIsPermalink = $rssIsPermalink;
104104 }
105105
106106 /**
@@ -108,7 +108,7 @@
109109 * @return String
110110 */
111111 public function getTitle() {
112 - return $this->xmlEncode( $this->Title );
 112+ return $this->xmlEncode( $this->title );
113113 }
114114
115115 /**
@@ -117,7 +117,7 @@
118118 * @return String
119119 */
120120 public function getUrl() {
121 - return $this->xmlEncode( $this->Url );
 121+ return $this->xmlEncode( $this->url );
122122 }
123123
124124 /**
@@ -126,7 +126,7 @@
127127 * @return String
128128 */
129129 public function getDescription() {
130 - return $this->xmlEncode( $this->Description );
 130+ return $this->xmlEncode( $this->description );
131131 }
132132
133133 /**
@@ -145,7 +145,7 @@
146146 * @return String
147147 */
148148 public function getDate() {
149 - return $this->Date;
 149+ return $this->date;
150150 }
151151
152152 /**
@@ -154,7 +154,7 @@
155155 * @return String
156156 */
157157 public function getAuthor() {
158 - return $this->xmlEncode( $this->Author );
 158+ return $this->xmlEncode( $this->author );
159159 }
160160
161161 /**
@@ -163,7 +163,7 @@
164164 * @return String
165165 */
166166 public function getComments() {
167 - return $this->xmlEncode( $this->Comments );
 167+ return $this->xmlEncode( $this->comments );
168168 }
169169
170170 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r102861Per Nikerabbit, fix undefined variable notice from r102851ialex12:13, 12 November 2011
r109196MFT r102851, r102861reedy19:57, 17 January 2012
r109197MFT r102851, r102861reedy19:58, 17 January 2012
r109532* (bug 33818) GoogleNewsSitemap failing to return feeds...reedy14:29, 19 January 2012
r109542Fix object munging to fix (bug 33818) GoogleNewsSitemap failing to return feeds...reedy16:20, 19 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   12:11, 12 November 2011

PHP Notice: Undefined property: FeedItem::$RSSIsPermalink in /www/w/includes/Feed.php on line 309

#Comment by IAlex (talk | contribs)   12:13, 12 November 2011

Fixed in r102861.

#Comment by MaxSem (talk | contribs)   17:40, 11 January 2012

I need this revision and its friend r102861 backported to release branch because FeaturedFeeds (ab)uses this class and consistency would really help.

Status & tagging log