r93040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93039‎ | r93040 | r93041 >
Date:04:14, 25 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Follow-up to r92609 - made all class fields private, removed unnecessary initializations, and added some now-necessary getter and setter methods; also updated handling of SFTemplateField class
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormClasses.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormClasses.php
@@ -13,11 +13,11 @@
1414 * @ingroup SF
1515 */
1616 class SFForm {
17 - var $mFormName = null;
18 - var $mTemplates = null;
19 - var $mPageNameFormula = null;
20 - var $mCreateTitle = null;
21 - var $mEditTitle = null;
 17+ private $mFormName;
 18+ private $mTemplates;
 19+ private $mPageNameFormula;
 20+ private $mCreateTitle;
 21+ private $mEditTitle;
2222
2323 static function create( $formName, $templates ) {
2424 $form = new SFForm();
@@ -26,6 +26,10 @@
2727 return $form;
2828 }
2929
 30+ function getFormName() {
 31+ return $this->mFormName;
 32+ }
 33+
3034 function setPageNameFormula( $pageNameFormula ) {
3135 $this->mPageNameFormula = $pageNameFormula;
3236 }
@@ -107,11 +111,11 @@
108112 * @ingroup SF
109113 */
110114 class SFTemplateInForm {
111 - var $template_name;
112 - var $label;
113 - var $allow_multiple;
114 - var $max_allowed;
115 - var $fields;
 115+ private $template_name;
 116+ private $label;
 117+ private $allow_multiple;
 118+ private $max_allowed;
 119+ private $fields;
116120
117121 /**
118122 * For a field name and its attached property name located in the
@@ -120,9 +124,7 @@
121125 */
122126 function handlePropertySettingInTemplate( $fieldName, $propertyName, $isList, &$templateFields, $templateText ) {
123127 global $wgContLang;
124 - $templateField = SFTemplateField::create( $fieldName, $wgContLang->ucfirst( $fieldName ) );
125 - $templateField->setSemanticProperty( $propertyName );
126 - $templateField->is_list = $isList;
 128+ $templateField = SFTemplateField::create( $fieldName, $wgContLang->ucfirst( $fieldName ), $propertyName, $isList );
127129 $cur_pos = stripos( $templateText, $fieldName );
128130 $templateFields[$cur_pos] = $templateField;
129131 }
@@ -233,7 +235,7 @@
234236 return $templateFields;
235237 }
236238
237 - static function create( $name, $label, $allow_multiple, $max_allowed = null ) {
 239+ static function create( $name, $label = null, $allow_multiple = null, $max_allowed = null ) {
238240 $tif = new SFTemplateInForm();
239241 $tif->template_name = str_replace( '_', ' ', $name );
240242 $tif->fields = array();
@@ -248,6 +250,14 @@
249251 return $tif;
250252 }
251253
 254+ function getTemplateName() {
 255+ return $this->template_name;
 256+ }
 257+
 258+ function getFields() {
 259+ return $this->fields;
 260+ }
 261+
252262 function creationHTML( $template_num ) {
253263 $checked_str = ( $this->allow_multiple ) ? "checked" : "";
254264 $template_str = wfMsg( 'sf_createform_template' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92609Added three new methods to SFForm: setPageNameFormula(), setCreateTitle() and...yaron04:28, 20 July 2011