MINOR Added public keyword for methods (style guidelines)

This commit is contained in:
Stig Lindqvist 2012-05-04 13:39:08 +12:00
parent c036af79ab
commit 816edabd3f
17 changed files with 51 additions and 51 deletions

View File

@ -13,7 +13,7 @@ class FieldEditor extends FormField {
* *
* @return String * @return String
*/ */
function FieldHolder() { public function FieldHolder() {
return $this->renderWith("FieldEditor"); return $this->renderWith("FieldEditor");
} }
@ -46,7 +46,7 @@ class FieldEditor extends FormField {
* *
* @return ViewableData_Customised * @return ViewableData_Customised
*/ */
function performReadonlyTransformation() { public function performReadonlyTransformation() {
$clone = clone $this; $clone = clone $this;
$clone->readonly = true; $clone->readonly = true;
$fields = $clone->Fields(); $fields = $clone->Fields();
@ -62,7 +62,7 @@ class FieldEditor extends FormField {
* *
* @return DataObjectSet * @return DataObjectSet
*/ */
function Fields() { public function Fields() {
// Don't return any fields unless we actually have the dependent parameters set on the form field // Don't return any fields unless we actually have the dependent parameters set on the form field
if($this->form && $this->form->getRecord() && $this->name) { if($this->form && $this->form->getRecord() && $this->name) {
$relationName = $this->name; $relationName = $this->name;
@ -89,7 +89,7 @@ class FieldEditor extends FormField {
* *
* @return DataObjectSet * @return DataObjectSet
*/ */
function CreatableFields() { public function CreatableFields() {
$fields = ClassInfo::subclassesFor('EditableFormField'); $fields = ClassInfo::subclassesFor('EditableFormField');
if($fields) { if($fields) {
@ -117,7 +117,7 @@ class FieldEditor extends FormField {
* *
* @param DataObject Record to Save it In * @param DataObject Record to Save it In
*/ */
function saveInto(DataObject $record) { public function saveInto(DataObject $record) {
$name = $this->name; $name = $this->name;
$fieldSet = $record->$name(); $fieldSet = $record->$name();

View File

@ -7,7 +7,7 @@
class SubmittedFormReportField extends FormField { class SubmittedFormReportField extends FormField {
function Field() { public function Field() {
Requirements::css(FRAMEWORK_DIR . "/css/SubmittedFormReportField.css"); Requirements::css(FRAMEWORK_DIR . "/css/SubmittedFormReportField.css");
Requirements::javascript("userforms/javascript/UserForm.js"); Requirements::javascript("userforms/javascript/UserForm.js");
return $this->renderWith("SubmittedFormReportField"); return $this->renderWith("SubmittedFormReportField");
@ -18,7 +18,7 @@ class SubmittedFormReportField extends FormField {
* *
* @return ComponentSet * @return ComponentSet
*/ */
function Submissions() { public function Submissions() {
$pageStart = isset($_REQUEST['start']) && is_numeric($_REQUEST['start']) ? $_REQUEST['start'] : 0; $pageStart = isset($_REQUEST['start']) && is_numeric($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$pageLength = 10; $pageLength = 10;
@ -37,7 +37,7 @@ class SubmittedFormReportField extends FormField {
return $items; return $items;
} }
function getSubmissions() { public function getSubmissions() {
return $this->customise(array( return $this->customise(array(
'Submissions' => $this->Submissions() 'Submissions' => $this->Submissions()
))->renderWith(array('SubmittedFormReportField')); ))->renderWith(array('SubmittedFormReportField'));
@ -48,7 +48,7 @@ class SubmittedFormReportField extends FormField {
* *
* @return int * @return int
*/ */
function RecordID() { public function RecordID() {
return $this->form->getRecord()->ID; return $this->form->getRecord()->ID;
} }

View File

@ -221,8 +221,8 @@ class UserDefinedForm extends Page {
* *
* @return Page * @return Page
*/ */
public function duplicate() { public function duplicate($doWrite = true) {
$page = parent::duplicate(); $page = parent::duplicate($doWrite);
// the form fields // the form fields
if($this->Fields()) { if($this->Fields()) {
@ -329,7 +329,7 @@ class UserDefinedForm_Controller extends Page_Controller {
* *
* @return Form|false * @return Form|false
*/ */
function Form() { public function Form() {
$fields = $this->getFormFields(); $fields = $this->getFormFields();
if(!$fields) return false; if(!$fields) return false;
@ -359,7 +359,7 @@ class UserDefinedForm_Controller extends Page_Controller {
* *
* @return FieldSet * @return FieldSet
*/ */
function getFormFields() { public function getFormFields() {
$fields = new FieldList(); $fields = new FieldList();
if($this->Fields()) { if($this->Fields()) {
@ -417,7 +417,7 @@ class UserDefinedForm_Controller extends Page_Controller {
* *
* @return FieldSet * @return FieldSet
*/ */
function getFormActions() { public function getFormActions() {
$submitText = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit'); $submitText = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
$actions = new FieldList( $actions = new FieldList(
@ -439,7 +439,7 @@ class UserDefinedForm_Controller extends Page_Controller {
* *
* @return RequiredFields * @return RequiredFields
*/ */
function getRequiredFields() { public function getRequiredFields() {
$required = new RequiredFields(); $required = new RequiredFields();
$rules = array(); $rules = array();
@ -496,7 +496,7 @@ JS
* Allows complex rules to be created * Allows complex rules to be created
* @return void * @return void
*/ */
function generateConditionalJavascript() { public function generateConditionalJavascript() {
$default = ""; $default = "";
$rules = ""; $rules = "";
@ -625,7 +625,7 @@ JS
* @param Array array to convert * @param Array array to convert
* @return JSON * @return JSON
*/ */
function array2json($array) { public function array2json($array) {
foreach($array as $key => $value) foreach($array as $key => $value)
if(is_array( $value )) { if(is_array( $value )) {
$result[] = "$key:" . $this->array2json($value); $result[] = "$key:" . $this->array2json($value);
@ -643,7 +643,7 @@ JS
* @param Form Form * @param Form Form
* @return Redirection * @return Redirection
*/ */
function process($data, $form) { public function process($data, $form) {
Session::set("FormInfo.{$form->FormName()}.data",$data); Session::set("FormInfo.{$form->FormName()}.data",$data);
Session::clear("FormInfo.{$form->FormName()}.errors"); Session::clear("FormInfo.{$form->FormName()}.errors");
@ -797,7 +797,7 @@ JS
* *
* @return ViewableData * @return ViewableData
*/ */
function finished() { public function finished() {
$referrer = isset($_GET['referrer']) ? urldecode($_GET['referrer']) : null; $referrer = isset($_GET['referrer']) ? urldecode($_GET['referrer']) : null;
return $this->customise(array( return $this->customise(array(
@ -879,11 +879,11 @@ class UserDefinedForm_EmailRecipient extends DataObject {
return $fields; return $fields;
} }
function canEdit() { public function canEdit() {
return $this->Form()->canEdit(); return $this->Form()->canEdit();
} }
function canDelete() { public function canDelete() {
return $this->Form()->canDelete(); return $this->Form()->canDelete();
} }
} }
@ -899,7 +899,7 @@ class UserDefinedForm_SubmittedFormEmail extends Email {
protected $ss_template = "SubmittedFormEmail"; protected $ss_template = "SubmittedFormEmail";
protected $data; protected $data;
function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
} }
} }

View File

@ -13,7 +13,7 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
static $plural_name = "Checkbox Groups"; static $plural_name = "Checkbox Groups";
function getFormField() { public function getFormField() {
$optionSet = $this->Options(); $optionSet = $this->Options();
$options = array(); $options = array();
@ -22,7 +22,7 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
return new CheckboxSetField($this->Name, $this->Title, $optionMap); return new CheckboxSetField($this->Name, $this->Title, $optionMap);
} }
function getValueFromData($data) { public function getValueFromData($data) {
$result = ''; $result = '';
$entries = (isset($data[$this->Name])) ? $data[$this->Name] : false; $entries = (isset($data[$this->Name])) ? $data[$this->Name] : false;

View File

@ -13,7 +13,7 @@ class EditableDateField extends EditableFormField {
static $plural_name = 'Date Fields'; static $plural_name = 'Date Fields';
function getFieldConfiguration() { public function getFieldConfiguration() {
$default = ($this->getSetting('DefaultToToday')) ? $this->getSetting('DefaultToToday') : false; $default = ($this->getSetting('DefaultToToday')) ? $this->getSetting('DefaultToToday') : false;
$label = _t('EditableFormField.DEFAULTTOTODAY', 'Default to Today?'); $label = _t('EditableFormField.DEFAULTTOTODAY', 'Default to Today?');
@ -22,7 +22,7 @@ class EditableDateField extends EditableFormField {
); );
} }
function populateFromPostData($data) { public function populateFromPostData($data) {
$fieldPrefix = 'Default-'; $fieldPrefix = 'Default-';
if(empty($data['Default']) && !empty($data[$fieldPrefix.'Year']) && !empty($data[$fieldPrefix.'Month']) && !empty($data[$fieldPrefix.'Day'])) { if(empty($data['Default']) && !empty($data[$fieldPrefix.'Year']) && !empty($data[$fieldPrefix.'Month']) && !empty($data[$fieldPrefix.'Day'])) {

View File

@ -16,7 +16,7 @@ class EditableDropdown extends EditableMultipleOptionField {
/** /**
* @return DropdownField * @return DropdownField
*/ */
function getFormField() { public function getFormField() {
$optionSet = $this->Options(); $optionSet = $this->Options();
$options = array(); $options = array();

View File

@ -13,7 +13,7 @@ class EditableEmailField extends EditableFormField {
static $plural_name = 'Email Fields'; static $plural_name = 'Email Fields';
function getFormField() { public function getFormField() {
return new EmailField($this->Name, $this->Title); return new EmailField($this->Name, $this->Title);
} }

View File

@ -65,7 +65,7 @@ class EditableFormField extends DataObject {
* *
* @return String * @return String
*/ */
function EditSegment() { public function EditSegment() {
return $this->renderWith('EditableFormField'); return $this->renderWith('EditableFormField');
} }
@ -113,7 +113,7 @@ class EditableFormField extends DataObject {
* *
* @return bool * @return bool
*/ */
function getShowOnLoad() { public function getShowOnLoad() {
return ($this->getSetting('ShowOnLoad') == "Show" || $this->getSetting('ShowOnLoad') == '') ? true : false; return ($this->getSetting('ShowOnLoad') == "Show" || $this->getSetting('ShowOnLoad') == '') ? true : false;
} }
@ -260,7 +260,7 @@ class EditableFormField extends DataObject {
* *
* @return TextField * @return TextField
*/ */
function TitleField() { public function TitleField() {
$label = _t('EditableFormField.ENTERQUESTION', 'Enter Question'); $label = _t('EditableFormField.ENTERQUESTION', 'Enter Question');
$field = new TextField('Title', $label, $this->getField('Title')); $field = new TextField('Title', $label, $this->getField('Title'));
@ -274,7 +274,7 @@ class EditableFormField extends DataObject {
} }
/** Returns the Title for rendering in the front-end (with XML values escaped) */ /** Returns the Title for rendering in the front-end (with XML values escaped) */
function getTitle() { public function getTitle() {
return Convert::raw2att($this->getField('Title')); return Convert::raw2att($this->getField('Title'));
} }
@ -443,7 +443,7 @@ class EditableFormField extends DataObject {
* *
* @return bool * @return bool
*/ */
function showInReports() { public function showInReports() {
return true; return true;
} }

View File

@ -11,7 +11,7 @@ class EditableFormHeading extends EditableFormField {
static $plural_name = 'Headings'; static $plural_name = 'Headings';
function getFieldConfiguration() { public function getFieldConfiguration() {
$levels = array( $levels = array(
'1' => '1', '1' => '1',
'2' => '2', '2' => '2',
@ -37,18 +37,18 @@ class EditableFormHeading extends EditableFormField {
return $options; return $options;
} }
function getFormField() { public function getFormField() {
$labelField = new HeaderField($this->Name,$this->Title, $this->getSetting('Level')); $labelField = new HeaderField($this->Name,$this->Title, $this->getSetting('Level'));
$labelField->addExtraClass('FormHeading'); $labelField->addExtraClass('FormHeading');
return $labelField; return $labelField;
} }
function showInReports() { public function showInReports() {
return false; return false;
} }
function getFieldValidationOptions() { public function getFieldValidationOptions() {
return false; return false;
} }
} }

View File

@ -13,7 +13,7 @@ class EditableLiteralField extends EditableFormField {
static $plural_name = 'HTML Blocks'; static $plural_name = 'HTML Blocks';
function getFieldConfiguration() { public function getFieldConfiguration() {
return new FieldList( return new FieldList(
new TextareaField( new TextareaField(
$this->getSettingName('Content'), $this->getSettingName('Content'),
@ -27,7 +27,7 @@ class EditableLiteralField extends EditableFormField {
); );
} }
function getFormField() { public function getFormField() {
return new LiteralField("LiteralField[$this->ID]", return new LiteralField("LiteralField[$this->ID]",
"<div id='$this->Name' class='field text'> "<div id='$this->Name' class='field text'>
<label class='left'>$this->Title</label> <label class='left'>$this->Title</label>
@ -36,7 +36,7 @@ class EditableLiteralField extends EditableFormField {
); );
} }
function showInReports() { public function showInReports() {
return (!$this->getSetting('HideFromReports')); return (!$this->getSetting('HideFromReports'));
} }
} }

View File

@ -11,7 +11,7 @@ class EditableMemberListField extends EditableFormField {
static $plural_name = 'Member List Fields'; static $plural_name = 'Member List Fields';
function getFieldConfiguration() { public function getFieldConfiguration() {
$groupID = ($this->getSetting('GroupID')) ? $this->getSetting('GroupID') : 0; $groupID = ($this->getSetting('GroupID')) ? $this->getSetting('GroupID') : 0;
$groups = DataObject::get("Group"); $groups = DataObject::get("Group");
@ -24,7 +24,7 @@ class EditableMemberListField extends EditableFormField {
return $fields; return $fields;
} }
function getFormField() { public function getFormField() {
if ($this->getSetting('GroupID')) { if ($this->getSetting('GroupID')) {
$members = Member::mapInGroups($this->getSetting('GroupID')); $members = Member::mapInGroups($this->getSetting('GroupID'));
@ -34,7 +34,7 @@ class EditableMemberListField extends EditableFormField {
return false; return false;
} }
function getValueFromData($data) { public function getValueFromData($data) {
if(isset($data[$this->Name])) { if(isset($data[$this->Name])) {
$value = Convert::raw2sql($data[$this->Name]); $value = Convert::raw2sql($data[$this->Name]);

View File

@ -13,7 +13,7 @@ class EditableRadioField extends EditableMultipleOptionField {
static $plural_name = 'Radio fields'; static $plural_name = 'Radio fields';
function getFormField() { public function getFormField() {
$optionSet = $this->Options(); $optionSet = $this->Options();
$options = array(); $options = array();

View File

@ -13,7 +13,7 @@ class EditableTextField extends EditableFormField {
static $plural_name = 'Text Fields'; static $plural_name = 'Text Fields';
function getFieldConfiguration() { public function getFieldConfiguration() {
$fields = parent::getFieldConfiguration(); $fields = parent::getFieldConfiguration();
$min = ($this->getSetting('MinLength')) ? $this->getSetting('MinLength') : ''; $min = ($this->getSetting('MinLength')) ? $this->getSetting('MinLength') : '';
@ -37,7 +37,7 @@ class EditableTextField extends EditableFormField {
/** /**
* @return TextareaField|TextField * @return TextareaField|TextField
*/ */
function getFormField() { public function getFormField() {
if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) { if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
return new TextareaField($this->Name, $this->Title, $this->getSetting('Rows')); return new TextareaField($this->Name, $this->Title, $this->getSetting('Rows'));
} }

View File

@ -18,7 +18,7 @@ class SubmittedFileField extends SubmittedFormField {
* *
* @return string * @return string
*/ */
function getFormattedValue() { public function getFormattedValue() {
$link = $this->getLink(); $link = $this->getLink();
$title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File'); $title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File');
@ -34,7 +34,7 @@ class SubmittedFileField extends SubmittedFormField {
* *
* @return string * @return string
*/ */
function getLink() { public function getLink() {
if($file = $this->UploadedFile()) { if($file = $this->UploadedFile()) {
if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) { if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) {
return $this->UploadedFile()->URL; return $this->UploadedFile()->URL;

View File

@ -24,7 +24,7 @@ class SubmittedFormField extends DataObject {
* *
* @return String * @return String
*/ */
function getFormattedValue() { public function getFormattedValue() {
return nl2br($this->dbObject('Value')->ATT()); return nl2br($this->dbObject('Value')->ATT());
} }
} }

View File

@ -20,7 +20,7 @@ class UserFormsVersionedTask extends MigrationTask {
* Publish the existing forms. * Publish the existing forms.
* *
*/ */
function run($request) { public function run($request) {
$forms = Versioned::get_by_stage('UserDefinedForm', 'Live'); $forms = Versioned::get_by_stage('UserDefinedForm', 'Live');
if($forms) { if($forms) {

View File

@ -40,7 +40,7 @@ class FieldEditorTest extends FunctionalTest {
class FieldEditorTest_Controller extends Controller { class FieldEditorTest_Controller extends Controller {
function Form() { public function Form() {
return new Form($this, 'Form', new FieldList(new FieldEditor('Fields')), new FieldList()); return new Form($this, 'Form', new FieldList(new FieldEditor('Fields')), new FieldList());
} }
} }