r101800 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101799‎ | r101800 | r101801 >
Date:09:21, 3 November 2011
Author:ialex
Status:ok
Tags:
Comment:
* Set constant default values in class definition and not constructor
* Added getTitle()
* Mark constructor and getArticle() as public
* Removed a PHP4-ism in constructor
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -55,7 +55,7 @@
5656 */
5757 var $mTitle;
5858 private $mContextTitle = null;
59 - var $action;
 59+ var $action = 'submit';
6060 var $isConflict = false;
6161 var $isCssJsSubpage = false;
6262 var $isCssSubpage = false;
@@ -96,15 +96,15 @@
9797
9898 # Placeholders for text injection by hooks (must be HTML)
9999 # extensions should take care to _append_ to the present value
100 - public $editFormPageTop; // Before even the preview
101 - public $editFormTextTop;
102 - public $editFormTextBeforeContent;
103 - public $editFormTextAfterWarn;
104 - public $editFormTextAfterTools;
105 - public $editFormTextBottom;
106 - public $editFormTextAfterContent;
107 - public $previewTextAfterContent;
108 - public $mPreloadText;
 100+ public $editFormPageTop = ''; // Before even the preview
 101+ public $editFormTextTop = '';
 102+ public $editFormTextBeforeContent = '';
 103+ public $editFormTextAfterWarn = '';
 104+ public $editFormTextAfterTools = '';
 105+ public $editFormTextBottom = '';
 106+ public $editFormTextAfterContent = '';
 107+ public $previewTextAfterContent = '';
 108+ public $mPreloadText = '';
109109
110110 /* $didSave should be set to true whenever an article was succesfully altered. */
111111 public $didSave = false;
@@ -116,31 +116,27 @@
117117 * @todo document
118118 * @param $article Article
119119 */
120 - function __construct( $article ) {
121 - $this->mArticle =& $article;
 120+ public function __construct( $article ) {
 121+ $this->mArticle = $article;
122122 $this->mTitle = $article->getTitle();
123 - $this->action = 'submit';
124 -
125 - # Placeholders for text injection by hooks (empty per default)
126 - $this->editFormPageTop =
127 - $this->editFormTextTop =
128 - $this->editFormTextBeforeContent =
129 - $this->editFormTextAfterWarn =
130 - $this->editFormTextAfterTools =
131 - $this->editFormTextBottom =
132 - $this->editFormTextAfterContent =
133 - $this->previewTextAfterContent =
134 - $this->mPreloadText = "";
135123 }
136124
137125 /**
138126 * @return Article
139127 */
140 - function getArticle() {
 128+ public function getArticle() {
141129 return $this->mArticle;
142130 }
143131
144132 /**
 133+ * @since 1.19
 134+ * @return Title
 135+ */
 136+ public function getTitle() {
 137+ return $this->mTitle;
 138+ }
 139+
 140+ /**
145141 * Set the context Title object
146142 *
147143 * @param $title Title object or null

Status & tagging log