[TASK] Refactor code of new form system extension
authorOliver Hader <oliver@typo3.org>
Mon, 19 Sep 2011 18:42:28 +0000 (20:42 +0200)
committerOliver Hader <oliver@typo3.org>
Mon, 19 Sep 2011 22:28:01 +0000 (00:28 +0200)
* remove superfluous __construct() methods
* fix PHPdoc comments and add type hints
* remove unused classes
* fix CGL issues

Change-Id: Ie859ea0a54a8234b5c5c8d6d16f0be6c947a9bc5
Resolves: #30046
Reviewed-on: http://review.typo3.org/5077
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
160 files changed:
typo3/sysext/form/Classes/Common.php
typo3/sysext/form/Classes/Controller/Form.php
typo3/sysext/form/Classes/Controller/Wizard.php
typo3/sysext/form/Classes/Domain/Factory/JsonToTyposcript.php
typo3/sysext/form/Classes/Domain/Factory/Typoscript.php
typo3/sysext/form/Classes/Domain/Factory/TyposcriptToJson.php
typo3/sysext/form/Classes/Domain/Model/Additional/Abstract.php
typo3/sysext/form/Classes/Domain/Model/Additional/Additional.php
typo3/sysext/form/Classes/Domain/Model/Additional/Error.php
typo3/sysext/form/Classes/Domain/Model/Additional/Interface.php [deleted file]
typo3/sysext/form/Classes/Domain/Model/Additional/Label.php
typo3/sysext/form/Classes/Domain/Model/Additional/Legend.php
typo3/sysext/form/Classes/Domain/Model/Additional/Mandatory.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Abstract.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Accept.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Acceptcharset.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Accesskey.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Action.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Alt.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Attributes.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Checked.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Class.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Cols.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Dir.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Disabled.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Enctype.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Id.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Interface.php [deleted file]
typo3/sysext/form/Classes/Domain/Model/Attributes/Label.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Lang.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Maxlength.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Method.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Multiple.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Name.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Readonly.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Rows.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Selected.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Size.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Src.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Style.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Tabindex.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Title.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Type.php
typo3/sysext/form/Classes/Domain/Model/Attributes/Value.php
typo3/sysext/form/Classes/Domain/Model/Content.php
typo3/sysext/form/Classes/Domain/Model/Element/Abstract.php
typo3/sysext/form/Classes/Domain/Model/Element/Button.php
typo3/sysext/form/Classes/Domain/Model/Element/Checkbox.php
typo3/sysext/form/Classes/Domain/Model/Element/Checkboxgroup.php
typo3/sysext/form/Classes/Domain/Model/Element/Container.php
typo3/sysext/form/Classes/Domain/Model/Element/Content.php
typo3/sysext/form/Classes/Domain/Model/Element/Fieldset.php
typo3/sysext/form/Classes/Domain/Model/Element/Fileupload.php
typo3/sysext/form/Classes/Domain/Model/Element/Hidden.php
typo3/sysext/form/Classes/Domain/Model/Element/Imagebutton.php
typo3/sysext/form/Classes/Domain/Model/Element/Optgroup.php
typo3/sysext/form/Classes/Domain/Model/Element/Option.php
typo3/sysext/form/Classes/Domain/Model/Element/Password.php
typo3/sysext/form/Classes/Domain/Model/Element/Radio.php
typo3/sysext/form/Classes/Domain/Model/Element/Radiogroup.php
typo3/sysext/form/Classes/Domain/Model/Element/Reset.php
typo3/sysext/form/Classes/Domain/Model/Element/Select.php
typo3/sysext/form/Classes/Domain/Model/Element/Submit.php
typo3/sysext/form/Classes/Domain/Model/Element/Textarea.php
typo3/sysext/form/Classes/Domain/Model/Element/Textline.php
typo3/sysext/form/Classes/Domain/Model/Form.php
typo3/sysext/form/Classes/Domain/Model/JSON/Button.php
typo3/sysext/form/Classes/Domain/Model/JSON/Checkbox.php
typo3/sysext/form/Classes/Domain/Model/JSON/Checkboxgroup.php
typo3/sysext/form/Classes/Domain/Model/JSON/Container.php
typo3/sysext/form/Classes/Domain/Model/JSON/Element.php
typo3/sysext/form/Classes/Domain/Model/JSON/Fieldset.php
typo3/sysext/form/Classes/Domain/Model/JSON/Form.php
typo3/sysext/form/Classes/Domain/Model/JSON/Header.php
typo3/sysext/form/Classes/Domain/Model/JSON/Hidden.php
typo3/sysext/form/Classes/Domain/Model/JSON/Name.php
typo3/sysext/form/Classes/Domain/Model/JSON/Password.php
typo3/sysext/form/Classes/Domain/Model/JSON/Radio.php
typo3/sysext/form/Classes/Domain/Model/JSON/Radiogroup.php
typo3/sysext/form/Classes/Domain/Model/JSON/Reset.php
typo3/sysext/form/Classes/Domain/Model/JSON/Select.php
typo3/sysext/form/Classes/Domain/Model/JSON/Submit.php
typo3/sysext/form/Classes/Domain/Model/JSON/Textarea.php
typo3/sysext/form/Classes/Domain/Model/JSON/Textline.php
typo3/sysext/form/Classes/Domain/Repository/Content.php
typo3/sysext/form/Classes/Exception/General.php [deleted file]
typo3/sysext/form/Classes/Exception/Loader.php [deleted file]
typo3/sysext/form/Classes/System/Elementcounter/Elementcounter.php
typo3/sysext/form/Classes/System/Filter/Alphabetic.php
typo3/sysext/form/Classes/System/Filter/Alphanumeric.php
typo3/sysext/form/Classes/System/Filter/Currency.php
typo3/sysext/form/Classes/System/Filter/Digit.php
typo3/sysext/form/Classes/System/Filter/Filter.php
typo3/sysext/form/Classes/System/Filter/Integer.php
typo3/sysext/form/Classes/System/Filter/Interface.php
typo3/sysext/form/Classes/System/Filter/Lowercase.php
typo3/sysext/form/Classes/System/Filter/Regexp.php
typo3/sysext/form/Classes/System/Filter/Removexss.php
typo3/sysext/form/Classes/System/Filter/Stripnewlines.php
typo3/sysext/form/Classes/System/Filter/Titlecase.php
typo3/sysext/form/Classes/System/Filter/Trim.php
typo3/sysext/form/Classes/System/Filter/Uppercase.php
typo3/sysext/form/Classes/System/Layout/Layout.php
typo3/sysext/form/Classes/System/Loader/Loader.php [deleted file]
typo3/sysext/form/Classes/System/Localization/Localization.php
typo3/sysext/form/Classes/System/Postprocessor/Mail.php
typo3/sysext/form/Classes/System/Postprocessor/Postprocessor.php
typo3/sysext/form/Classes/System/Request/Request.php
typo3/sysext/form/Classes/System/Validate/Abstract.php
typo3/sysext/form/Classes/System/Validate/Alphabetic.php
typo3/sysext/form/Classes/System/Validate/Alphanumeric.php
typo3/sysext/form/Classes/System/Validate/Between.php
typo3/sysext/form/Classes/System/Validate/Date.php
typo3/sysext/form/Classes/System/Validate/Digit.php
typo3/sysext/form/Classes/System/Validate/Email.php
typo3/sysext/form/Classes/System/Validate/Equals.php
typo3/sysext/form/Classes/System/Validate/Fileallowedtypes.php
typo3/sysext/form/Classes/System/Validate/Filemaximumsize.php
typo3/sysext/form/Classes/System/Validate/Fileminimumsize.php
typo3/sysext/form/Classes/System/Validate/Float.php
typo3/sysext/form/Classes/System/Validate/Greaterthan.php
typo3/sysext/form/Classes/System/Validate/Inarray.php
typo3/sysext/form/Classes/System/Validate/Integer.php
typo3/sysext/form/Classes/System/Validate/Ip.php
typo3/sysext/form/Classes/System/Validate/Length.php
typo3/sysext/form/Classes/System/Validate/Lessthan.php
typo3/sysext/form/Classes/System/Validate/Regexp.php
typo3/sysext/form/Classes/System/Validate/Required.php
typo3/sysext/form/Classes/System/Validate/Uri.php
typo3/sysext/form/Classes/System/Validate/Validate.php
typo3/sysext/form/Classes/View/Confirmation/Additional/Additional.php
typo3/sysext/form/Classes/View/Confirmation/Confirmation.php
typo3/sysext/form/Classes/View/Confirmation/Element/Abstract.php
typo3/sysext/form/Classes/View/Confirmation/Element/Container.php
typo3/sysext/form/Classes/View/Form/Additional/Additional.php
typo3/sysext/form/Classes/View/Form/Element/Abstract.php
typo3/sysext/form/Classes/View/Form/Element/Container.php
typo3/sysext/form/Classes/View/Mail/Html/Additional/Additional.php
typo3/sysext/form/Classes/View/Mail/Html/Element/Abstract.php
typo3/sysext/form/Classes/View/Mail/Html/Element/Container.php
typo3/sysext/form/Classes/View/Mail/Mail.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Abstract.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Checkbox.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Checkboxgroup.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Container.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Fieldset.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Fileupload.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Hidden.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Optgroup.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Option.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Radio.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Radiogroup.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Select.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Textarea.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/Textline.php
typo3/sysext/form/Classes/View/Wizard/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Wizard/Load.php
typo3/sysext/form/Classes/View/Wizard/Save.php
typo3/sysext/form/Classes/View/Wizard/Wizard.php
typo3/sysext/form/ext_autoload.php

index 5c88b94..d131077 100644 (file)
@@ -28,7 +28,6 @@
  * @package TYPO3
  * @subpackage form
  * @author Oliver Hader <oliver.hader@typo3.org>
- * @license http://www.gnu.org/copyleft/gpl.html
  */
 class tx_form_Common implements t3lib_Singleton {
        /**
@@ -100,7 +99,7 @@ class tx_form_Common implements t3lib_Singleton {
         */
        public function initializeFormObjects() {
                        // Assign new FORM objects
-               foreach($this->getFormObjects() as $formObject) {
+               foreach ($this->getFormObjects() as $formObject) {
                        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'][] = array(
                                $formObject,
                                'EXT:form/Classes/Controller/Form.php:&tx_form_Controller_Form'
@@ -122,5 +121,23 @@ class tx_form_Common implements t3lib_Singleton {
 
                return $this;
        }
+
+       /**
+        * Gets the last part of the current object's class name.
+        * e.g. for 'tx_form_View_Confirmation_Additional' it will be 'Additional'
+        *
+        * @param object $object The object to be used
+        * @param boolean $lowercase Whether to convert to lowercase
+        * @return string
+        */
+       public function getLastPartOfClassName($object, $lowercase = FALSE) {
+               $lastPart = preg_replace('/.*_([^_]*)$/', '${1}', get_class($object), 1);
+
+               if ($lowercase) {
+                       $lastPart = strtolower($lastPart);
+               }
+
+               return $lastPart;
+       }
 }
 ?>
\ No newline at end of file
index 1c55dce..de4aaac 100644 (file)
@@ -30,8 +30,6 @@
  * @package TYPO3
  * @subpackage form
  * @author Patrick Broens <patrick@patrickbroens.nl>
- * @license http://www.gnu.org/copyleft/gpl.html
- * @version $Id$
  */
 class tx_form_Controller_Form {
 
@@ -68,7 +66,7 @@ class tx_form_Controller_Form {
         * @param array $typoscript TS configuration for this cObject
         * @return void
         */
-       public function initialize($typoscript) {
+       public function initialize(array $typoscript) {
                t3lib_div::makeInstance(
                        'tx_form_System_Localization',
                        'LLL:EXT:form/Resources/Private/Language/locallang_controller.xml'
@@ -101,7 +99,7 @@ class tx_form_Controller_Form {
         */
        public function cObjGetSingleExt(
                $typoscriptObjectName,
-               $typoscript,
+               array $typoscript,
                $typoscriptKey,
                tslib_cObj $contentObject
        ) {
@@ -135,20 +133,17 @@ class tx_form_Controller_Form {
         * @return string HTML Output
         */
        public function execute() {
-               $content = '';
-
                        // Form
                if ($this->showForm()) {
                        $content = $this->renderForm();
-               } else {
-                               // Confirmation screen
-                       if ($this->showConfirmation()) {
-                               $content = $this->renderConfirmation();
 
-                               // We need the post processing
-                       } else {
-                               $content = $this->doPostProcessing();
-                       }
+                       // Confirmation screen
+               } elseif ($this->showConfirmation()) {
+                       $content = $this->renderConfirmation();
+
+                       // We need the post processing
+               } else {
+                       $content = $this->doPostProcessing();
                }
 
                return $content;
index 97886f5..df8757a 100644 (file)
@@ -33,8 +33,6 @@ require($BACK_PATH . 'template.php');
  * @package TYPO3
  * @subpackage form
  * @author Patrick Broens <patrick@patrickbroens.nl>
- * @license http://www.gnu.org/copyleft/gpl.html
- * @version $Id$
  */
 class tx_form_Controller_Wizard {
        /**
@@ -65,12 +63,8 @@ class tx_form_Controller_Wizard {
         * @return void
         */
        protected function indexAction() {
-               /** @var $repository tx_form_Domain_Repository_Content */
-               $repository = t3lib_div::makeInstance('tx_form_Domain_Repository_Content');
-
                /** @var $view tx_form_View_Wizard_Wizard */
-               $view = t3lib_div::makeInstance('tx_form_View_Wizard_Wizard');
-               $view->setRepository($repository);
+               $view = t3lib_div::makeInstance('tx_form_View_Wizard_Wizard', $this->getRepository());
                $view->render();
        }
 
@@ -82,12 +76,8 @@ class tx_form_Controller_Wizard {
         * @return void
         */
        protected function saveAction() {
-               /** @var $repository tx_form_Domain_Repository_Content */
-               $repository = t3lib_div::makeInstance('tx_form_Domain_Repository_Content');
-
                /** @var $view tx_form_View_Wizard_Save */
-               $view = t3lib_div::makeInstance('tx_form_View_Wizard_Save');
-               $view->setRepository($repository);
+               $view = t3lib_div::makeInstance('tx_form_View_Wizard_Save', $this->getRepository());
                $view->render();
        }
 
@@ -99,14 +89,19 @@ class tx_form_Controller_Wizard {
         * @return void
         */
        protected function loadAction() {
-               /** @var $repository tx_form_Domain_Repository_Content */
-               $repository = t3lib_div::makeInstance('tx_form_Domain_Repository_Content');
-
                /** @var $view tx_form_View_Wizard_Load */
-               $view = t3lib_div::makeInstance('tx_form_View_Wizard_Load');
-               $view->setRepository($repository);
+               $view = t3lib_div::makeInstance('tx_form_View_Wizard_Load', $this->getRepository());
                $view->render();
        }
+
+       /**
+        * Gets the repository object.
+        *
+        * @return tx_form_Domain_Repository_Content
+        */
+       protected function getRepository() {
+               return t3lib_div::makeInstance('tx_form_Domain_Repository_Content');
+       }
 }
 
 /** @var $wizard tx_form_Controller_Wizard */
index 7b1a1af..c5c233f 100644 (file)
@@ -55,14 +55,6 @@ class tx_form_Domain_Factory_JsonToTyposcript {
        protected $validationRulesCounter = 1;
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
-       /**
         * Convert JSON to TypoScript
         *
         * First a TypoScript array is constructed,
@@ -98,10 +90,10 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param boolean $childrenWithParentName Indicates if the children use the parent name
         * @return void
         */
-       protected function convertToTyposcriptArray($elements, &$parent, $childrenWithParentName = FALSE) {
+       protected function convertToTyposcriptArray(array $elements, array &$parent, $childrenWithParentName = FALSE) {
                if (is_array($elements)) {
                        $elementCounter = 10;
-                       foreach($elements as $element) {
+                       foreach ($elements as $element) {
                                if ($element['xtype']) {
                                        $this->elementId++;
                                        switch($element['xtype']) {
@@ -152,7 +144,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function getContainer($element, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+       protected function getContainer(array $element, array &$parent, $elementCounter, $childrenWithParentName = FALSE) {
                if ($element['elementContainer'] && $element['elementContainer']['items']) {
                        $this->convertToTyposcriptArray(
                                $element['elementContainer']['items'],
@@ -174,7 +166,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function getForm($element, &$parent, $elementCounter) {
+       protected function getForm(array $element, array &$parent, $elementCounter) {
                        // TODO: Put at the top of the form
                if (!empty($this->validationRules)) {
                        $parent[$elementCounter . '.']['rules'] = $this->validationRules;
@@ -193,11 +185,15 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param boolean $childrenWithParentName Indicates if the children use the parent name
         * @return void
         */
-       protected function getDefaultElementSetup($element, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
-               $parent[$elementCounter] = $this->getContentObjectType($element);
-               $parent[$elementCounter . '.'] = array();
-               if ($element['configuration']) {
-                       $this->setConfiguration($element, $parent, $elementCounter, $childrenWithParentName);
+       protected function getDefaultElementSetup(array $element, array &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+               $contentObjectType = $this->getContentObjectType($element);
+
+               if (is_null($contentObjectType) === FALSE) {
+                       $parent[$elementCounter] = $contentObjectType;
+                       $parent[$elementCounter . '.'] = array();
+                       if ($element['configuration']) {
+                               $this->setConfiguration($element, $parent, $elementCounter, $childrenWithParentName);
+                       }
                }
        }
 
@@ -207,7 +203,9 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param array $element The JSON array for this element
         * @return string The Content Object Type
         */
-       protected function getContentObjectType($element) {
+       protected function getContentObjectType(array $element) {
+               $contentObjectType = NULL;
+
                $shortXType = str_replace('typo3-form-wizard-elements-', '', $element['xtype']);
                list($category, $type) = explode('-', $shortXType);
 
@@ -247,7 +245,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param boolean $childrenWithParentName Indicates if the children use the parent name
         * @return void
         */
-       protected function setConfiguration($element, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+       protected function setConfiguration(array $element, array &$parent, $elementCounter, $childrenWithParentName = FALSE) {
                foreach ($element['configuration'] as $key => $value) {
                        switch ($key) {
                                case 'attributes':
@@ -297,7 +295,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param boolean $childrenWithParentName Indicates if the children use the parent name
         * @return void
         */
-       protected function setAttributes($attributes, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+       protected function setAttributes(array $attributes, array &$parent, $elementCounter, $childrenWithParentName = FALSE) {
                foreach ($attributes as $key => $value) {
                        if ($key === 'name' && $value === '' && !$childrenWithParentName) {
                                $value = $this->elementId;
@@ -318,7 +316,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setConfirmation($confirmation, &$parent, $elementCounter) {
+       protected function setConfirmation($confirmation, array &$parent, $elementCounter) {
                $parent[$elementCounter . '.']['confirmation'] = $confirmation;
        }
 
@@ -330,8 +328,8 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setFilters($filters, &$parent, $elementCounter) {
-               if (is_array($filters) && !empty($filters)) {
+       protected function setFilters(array $filters, array &$parent, $elementCounter) {
+               if (!empty($filters)) {
                        $parent[$elementCounter . '.']['filters'] = array();
                        $filterCounter = 1;
                        foreach ($filters as $name => $filterConfiguration) {
@@ -350,7 +348,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setLabel($label, &$parent, $elementCounter) {
+       protected function setLabel(array $label, array &$parent, $elementCounter) {
                if ($label['value'] != '') {
                        $parent[$elementCounter . '.']['label.']['value'] = $label['value'];
                }
@@ -369,7 +367,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setLayout($element, $value, &$parent, $elementCounter) {
+       protected function setLayout(array $element, $value, array &$parent, $elementCounter) {
                switch($element['xtype']) {
                        case 'typo3-form-wizard-elements-basic-button':
                        case 'typo3-form-wizard-elements-basic-fileupload':
@@ -410,7 +408,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setLegend($legend, &$parent, $elementCounter) {
+       protected function setLegend(array $legend, array &$parent, $elementCounter) {
                if ($legend['value'] != '') {
                        $parent[$elementCounter . '.']['legend.']['value'] = $legend['value'];
                }
@@ -429,7 +427,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setOptions($element, $options, &$parent, $elementCounter) {
+       protected function setOptions(array $element, array $options, array &$parent, $elementCounter) {
                if (is_array($options) && $element['xtype'] === 'typo3-form-wizard-elements-basic-select') {
                        $optionCounter = 10;
                        foreach ($options as $option) {
@@ -451,8 +449,8 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setPostProcessor($postProcessors, &$parent, $elementCounter) {
-               if (is_array($postProcessors) && !empty($postProcessors)) {
+       protected function setPostProcessor(array $postProcessors, array &$parent, $elementCounter) {
+               if (!empty($postProcessors)) {
                        $parent[$elementCounter . '.']['postProcessor'] = array();
                        $postProcessorCounter = 1;
                        foreach ($postProcessors as $name => $postProcessorConfiguration) {
@@ -473,7 +471,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setPrefix($prefix, &$parent, $elementCounter) {
+       protected function setPrefix($prefix, array &$parent, $elementCounter) {
                $parent[$elementCounter . '.']['prefix'] = $prefix;
        }
 
@@ -487,27 +485,25 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param array $validationRules The temporary storage array for the rules
         * @return void
         */
-       protected function setValidationRules($element, $validationRules) {
-               if (is_array($validationRules)) {
-                       foreach ($validationRules as $name => $ruleConfiguration) {
-                               if (
-                                       isset($element['configuration']['attributes']['name']) &&
-                                       $element['configuration']['attributes']['name'] != ''
-                               ) {
-                                       $ruleConfiguration['element'] = $element['configuration']['attributes']['name'];
-                               } elseif (
-                                       isset($element['configuration']['various']['name']) &&
-                                       $element['configuration']['various']['name'] != ''
-                               ) {
-                                       $ruleConfiguration['element'] = $element['configuration']['various']['name'];
-                               } else {
-                                       $ruleConfiguration['element'] = $this->elementId;
-                               }
-
-                               $this->validationRules[$this->validationRulesCounter] = $name;
-                               $this->validationRules[$this->validationRulesCounter . '.'] = $ruleConfiguration;
-                               $this->validationRulesCounter++;
+       protected function setValidationRules(array $element, array $validationRules) {
+               foreach ($validationRules as $name => $ruleConfiguration) {
+                       if (
+                               isset($element['configuration']['attributes']['name']) &&
+                               $element['configuration']['attributes']['name'] != ''
+                       ) {
+                               $ruleConfiguration['element'] = $element['configuration']['attributes']['name'];
+                       } elseif (
+                               isset($element['configuration']['various']['name']) &&
+                               $element['configuration']['various']['name'] != ''
+                       ) {
+                               $ruleConfiguration['element'] = $element['configuration']['various']['name'];
+                       } else {
+                               $ruleConfiguration['element'] = $this->elementId;
                        }
+
+                       $this->validationRules[$this->validationRulesCounter] = $name;
+                       $this->validationRules[$this->validationRulesCounter . '.'] = $ruleConfiguration;
+                       $this->validationRulesCounter++;
                }
        }
 
@@ -520,7 +516,7 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $elementCounter The element counter
         * @return void
         */
-       protected function setVarious($element, $various, &$parent, $elementCounter) {
+       protected function setVarious(array $element, array $various, array &$parent, $elementCounter) {
                foreach ($various as $key => $value) {
                        switch ($key) {
                                case 'headingSize':
@@ -551,14 +547,14 @@ class tx_form_Domain_Factory_JsonToTyposcript {
         * @param integer $tabCount The amount of tabs for indentation
         * @return string The formatted TypoScript string
         */
-       protected function typoscriptArrayToString($typoscriptArray, $addKey = '', $tabCount = -1) {
+       protected function typoscriptArrayToString(array $typoscriptArray, $addKey = '', $tabCount = -1) {
                $typoscript = '';
 
                if ($addKey != '') {
                        $typoscript .= str_repeat(chr(9), $tabCount) . str_replace('.', '', $addKey) . ' {' . chr(10);
                }
                $tabCount++;
-               foreach($typoscriptArray as $key => $value) {
+               foreach ($typoscriptArray as $key => $value) {
                        if (!is_array($value)) {
                                if (strstr($value, chr(10))) {
                                        $typoscript .= str_repeat(chr(9), $tabCount) . $key . ' (' . chr(10);
index 3bdfd06..6f7f7f7 100644 (file)
  * @subpackage form
  */
 class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
-
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor, fills the attributes
-        * and adds all form element objects
-        *
-        * @param array $arguments Typoscript configuration
-        * @return void
+        * @var tslib_cObj
         */
-       public function __construct() {
-       }
+       protected $localContentObject;
 
        /**
         * Build model from Typoscript
         *
         * @param array $typoscript Typoscript containing all configuration
-        * @return object The form object containing the child elements
+        * @return tx_form_Domain_Model_Form The form object containing the child elements
         */
        public function buildModelFromTyposcript(array $typoscript) {
                $this->setLayoutHandler($typoscript);
@@ -63,17 +56,18 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
         * Rendering of a "numerical array" of Form objects from TypoScript
         * Creates new object for each element found
         *
+        * @param tx_form_Domain_Model_Element_Abstract $parentElement Parent model object
         * @param array $arguments Configuration array
         * @throws Exception
         * @return void
         */
-       public function getChildElementsByIntegerKey(&$parentElement, $typoscript) {
+       public function getChildElementsByIntegerKey(tx_form_Domain_Model_Element_Abstract $parentElement, array $typoscript) {
                if (is_array($typoscript)) {
                        $keys = t3lib_TStemplate::sortedKeyList($typoscript);
                        foreach ($keys as $key) {
                                $class = $typoscript[$key];
                                if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($typoscript[$key . '.'])) {
+                                       if (isset($typoscript[$key . '.'])) {
                                                $elementArguments = $typoscript[$key . '.'];
                                        } else {
                                                $elementArguments = array();
@@ -82,7 +76,7 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
                                }
                        }
                } else {
-                       throw new Exception ('Container element with id=' . $this->elementId . ' has no configuration which means no children');
+                       throw new Exception ('Container element with id=' . $parentElement->getElementId() . ' has no configuration which means no children');
                }
        }
 
@@ -91,19 +85,20 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
         * This can be a derived Typoscript object by "<",
         * a form element, or a regular Typoscript object.
         *
-        * @param object $parentElement The parent for the new element
+        * @param tx_form_Domain_Model_Element_Abstract $parentElement The parent for the new element
         * @param string $class Classname for the element
         * @param array $arguments Configuration array
         * @return void
         */
-       public function setElementType(&$parentElement, $class, array $arguments) {
+       public function setElementType(tx_form_Domain_Model_Element_Abstract $parentElement, $class, array $arguments) {
                if (substr($class, 0, 1) == '<') {
                        $key = trim(substr($class, 1));
+                       /** @var $typoscriptParser t3lib_TSparser */
                        $typoscriptParser = t3lib_div::makeInstance('t3lib_TSparser');
                        $oldArguments = $arguments;
                        list($class, $arguments) = $typoscriptParser->getVal($key, $GLOBALS['TSFE']->tmpl->setup);
                        if (is_array($oldArguments) && count($oldArguments)) {
-                               $arguments = $this->joinTSarrays($arguments, $oldArguments);
+                               $arguments = $this->getLocalConentObject()->joinTSarrays($arguments, $oldArguments);
                        }
                        $GLOBALS['TT']->incStackPointer();
                        $contentObject['cObj'] = $class;
@@ -126,11 +121,12 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
        /**
         * Add child object to this element
         *
+        * @param tx_form_Domain_Model_Element_Abstract $parentElement Parent model object
         * @param string $class Type of element
         * @param array $arguments Configuration array
         * @return object
         */
-       public function addElement(&$parentElement, $class, array $arguments = array()) {
+       public function addElement(tx_form_Domain_Model_Element_Abstract $parentElement, $class, array $arguments = array()) {
                $element = $this->createElement($class, $arguments);
                $parentElement->addElement($element);
        }
@@ -141,17 +137,18 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
         *
         * @param string $class Type of element
         * @param array $arguments Configuration array
-        * @return object
+        * @return tx_form_Domain_Model_Element_Abstract
         */
        public function createElement($class, array $arguments = array()) {
                $class = strtolower((string) $class);
 
-               if($class === 'form') {
+               if ($class === 'form') {
                        $className = 'tx_form_Domain_Model_' . ucfirst($class);
                } else {
                        $className = 'tx_form_Domain_Model_Element_' . ucfirst($class);
                }
 
+               /** @var $object tx_form_Domain_Model_Element_Abstract */
                $object = t3lib_div::makeInstance($className);
 
                $this->setAttributes($object, $arguments);
@@ -162,7 +159,7 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
                $object->setValue($arguments['value']);
                $object->setName($arguments['name']);
 
-               if($class === 'content') {
+               if ($class === 'content') {
                        $object->setData($arguments['cObj'], $arguments['cObj.']);
                } else {
                        $object->setData($arguments['data']);
@@ -180,22 +177,24 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
        /**
         * Set the attributes
         *
-        * @param array $configuration Configuration
+        * @param tx_form_Domain_Model_Element_Abstract $element Model object
+        * @param array $arguments Arguments
+        * @return void
         */
-       public function setAttributes(&$element, $arguments) {
-               if($element->hasAllowedAttributes()) {
+       public function setAttributes(tx_form_Domain_Model_Element_Abstract $element, array $arguments) {
+               if ($element->hasAllowedAttributes()) {
                        $attributes = $element->getAllowedAttributes();
                        $mandatoryAttributes = $element->getMandatoryAttributes();
-                       foreach($attributes as $attribute => $value) {
-                               if(
+                       foreach ($attributes as $attribute => $value) {
+                               if (
                                        isset($arguments[$attribute]) ||
                                        isset($arguments[$attribute . '.']) ||
                                        in_array($attribute, $mandatoryAttributes) ||
                                        !empty($value)
                                ) {
-                                       if(!empty($arguments[$attribute])) {
+                                       if (!empty($arguments[$attribute])) {
                                                $value = $arguments[$attribute];
-                                       } elseif(!empty($arguments[$attribute . '.'])) {
+                                       } elseif (!empty($arguments[$attribute . '.'])) {
                                                $value = $arguments[$attribute . '.'];
                                        }
 
@@ -207,25 +206,27 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
                                }
                        }
                } else {
-                       throw new Exception ('The element with id=' . $elementId . ' has no default attributes set');
+                       throw new Exception ('The element with id=' . $element->getElementId() . ' has no default attributes set');
                }
        }
 
        /**
         * Set the additionals from Element Typoscript configuration
         *
+        * @param tx_form_Domain_Model_Element_Abstract $element Model object
+        * @param array $arguments Arguments
         * @return void
         */
-       public function setAdditionals(&$element, $arguments) {
-               if(!empty($arguments)) {
-                       if($element->hasAllowedAdditionals()) {
+       public function setAdditionals(tx_form_Domain_Model_Element_Abstract $element, array $arguments) {
+               if (!empty($arguments)) {
+                       if ($element->hasAllowedAdditionals()) {
                                $additionals = $element->getAllowedAdditionals();
-                               foreach($additionals as $additional) {
-                                       if(isset($arguments[$additional . '.']) || isset($arguments[$additional])) {
-                                               if(isset($arguments[$additional]) && isset($arguments[$additional . '.'])) {
+                               foreach ($additionals as $additional) {
+                                       if (isset($arguments[$additional . '.']) || isset($arguments[$additional])) {
+                                               if (isset($arguments[$additional]) && isset($arguments[$additional . '.'])) {
                                                        $value = $arguments[$additional . '.'];
                                                        $type = $arguments[$additional];
-                                               } elseif(isset($arguments[$additional . '.'])) {
+                                               } elseif (isset($arguments[$additional . '.'])) {
                                                        $value = $arguments[$additional . '.'];
                                                        $type = 'TEXT';
                                                } else {
@@ -239,13 +240,13 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
                                                        throw new Exception ('Cannot call user function for additional ' . ucfirst($additional));
                                                }
                                        }
-                                       if(isset($arguments['layout.'][$additional]) && $element->additionalIsSet($additional)) {
+                                       if (isset($arguments['layout.'][$additional]) && $element->additionalIsSet($additional)) {
                                                $layout = $arguments['layout.'][$additional];
                                                $element->setAdditionalLayout($additional, $layout);
                                        }
                                }
                        } else {
-                               throw new Exception ('The element with id=' . $elementId . ' has no additionals set');
+                               throw new Exception ('The element with id=' . $element->getElementId() . ' has no additionals set');
                        }
                }
        }
@@ -253,10 +254,11 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
        /**
         * Add the filters according to the settings in the Typoscript array
         *
+        * @param tx_form_Domain_Model_Element_Abstract $element Model object
         * @param array $arguments TypoScript
         * @return void
         */
-       protected function setFilters(&$element, $arguments) {
+       protected function setFilters(tx_form_Domain_Model_Element_Abstract $element, $arguments) {
                if (is_array($arguments)) {
                        $keys = t3lib_TStemplate::sortedKeyList($arguments);
                        foreach ($keys as $key) {
@@ -276,9 +278,13 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
         * @param array $typoscript TypoScript
         * @return tx_form_System_Layout The layout handler
         */
-       public function setLayoutHandler($typoscript) {
+       public function setLayoutHandler(array $typoscript) {
+               /** @var $layoutHandler tx_form_System_Layout */
                $layoutHandler = t3lib_div::makeInstance('tx_form_System_Layout'); // singleton
-               $layoutHandler->setLayout($typoscript['layout.']);
+
+               if (isset($typoscript['layout.'])) {
+                       $layoutHandler->setLayout($typoscript['layout.']);
+               }
 
                return $layoutHandler;
        }
@@ -310,8 +316,9 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
         * @param array $typoscript TypoScript
         * @return tx_form_System_Validate The validation object
         */
-       public function setRules($typoscript) {
+       public function setRules(array $typoscript) {
                $rulesTyposcript = isset($typoscript['rules.']) ? $typoscript['rules.'] : NULL;
+               /** @var $rulesClass tx_form_System_Validate */
                $rulesClass = t3lib_div::makeInstance('tx_form_System_Validate', $rulesTyposcript); // singleton
 
                if (is_array($rulesTyposcript)) {
@@ -330,5 +337,17 @@ class tx_form_Domain_Factory_Typoscript implements t3lib_Singleton {
 
                return $rulesClass;
        }
+
+       /**
+        * Gets the local content object.
+        *
+        * @return tslib_cObj
+        */
+       protected function getLocalConentObject() {
+               if (!isset($this->localContentObject)) {
+                       $this->localContentObject = t3lib_div::makeInstance('tslib_cObj');
+               }
+               return $this->localContentObject;
+       }
 }
 ?>
\ No newline at end of file
index 45f51da..50c0e8b 100644 (file)
  */
 class tx_form_Domain_Factory_TyposcriptToJson {
        /**
-        * Constructor
-        *
-        * @return void
+        * @var array
         */
-       public function __construct() {
-       }
+       protected $validationRules;
 
        /**
         * Convert TypoScript string to JSON
@@ -46,7 +43,7 @@ class tx_form_Domain_Factory_TyposcriptToJson {
         * @param string $typoscript TypoScript string containing all configuration for the form
         * @return string The JSON for the form
         */
-       public function convert($typoscript) {
+       public function convert(array $typoscript) {
                $this->setValidationRules($typoscript);
                $jsonObject = $this->createElement('form', $typoscript);
 
@@ -59,7 +56,7 @@ class tx_form_Domain_Factory_TyposcriptToJson {
         *
         * @param string $class Type of element
         * @param array $arguments Configuration array
-        * @return object
+        * @return tx_form_Domain_Model_JSON_Element
         */
        public function createElement($class, array $arguments = array()) {
                $class = strtolower((string) $class);
@@ -67,6 +64,7 @@ class tx_form_Domain_Factory_TyposcriptToJson {
 
                $this->addValidationRules($arguments);
 
+               /** @var $object tx_form_Domain_Model_JSON_Element */
                $object = t3lib_div::makeInstance($className);
                $object->setParameters($arguments);
 
@@ -81,16 +79,17 @@ class tx_form_Domain_Factory_TyposcriptToJson {
         * Rendering of a "numerical array" of Form objects from TypoScript
         * Creates new object for each element found
         *
+        * @param tx_form_Domain_Model_JSON_Element $parentElement Parent model object
         * @param array $arguments Configuration array
         * @return void
         */
-       protected function getChildElementsByIntegerKey(&$parentElement, $typoscript) {
+       protected function getChildElementsByIntegerKey(tx_form_Domain_Model_JSON_Element $parentElement, array $typoscript) {
                if (is_array($typoscript)) {
                        $keys = t3lib_TStemplate::sortedKeyList($typoscript);
                        foreach ($keys as $key) {
                                $class = $typoscript[$key];
                                if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($typoscript[$key . '.'])) {
+                                       if (isset($typoscript[$key . '.'])) {
                                                $elementArguments = $typoscript[$key . '.'];
                                        } else {
                                                $elementArguments = array();
@@ -107,12 +106,12 @@ class tx_form_Domain_Factory_TyposcriptToJson {
         * Checks if the typoscript object is part of the FORM or has a predefined
         * class for name or header object
         *
-        * @param object $parentElement The parent object
+        * @param tx_form_Domain_Model_JSON_Element $parentElement The parent object
         * @param string $class A predefined class
         * @param array $arguments Configuration array
         * @return void
         */
-       private function setElementType(&$parentElement, $class, array $arguments) {
+       private function setElementType(tx_form_Domain_Model_JSON_Element $parentElement, $class, array $arguments) {
                if (in_array($class, tx_form_Common::getInstance()->getFormObjects())) {
                        if (strstr($arguments['class'], 'predefined-name')) {
                                $class = 'NAME';
@@ -127,12 +126,12 @@ class tx_form_Domain_Factory_TyposcriptToJson {
        /**
         * Add child object to this element
         *
-        * @param object The parent object
+        * @param tx_form_Domain_Model_JSON_Element $parentElement The parent object
         * @param string $class Type of element
         * @param array $arguments Configuration array
         * @return void
         */
-       public function addElement(&$parentElement, $class, array $arguments) {
+       public function addElement(tx_form_Domain_Model_JSON_Element $parentElement, $class, array $arguments) {
                $element = $this->createElement($class, $arguments);
                $parentElement->addElement($element);
        }
@@ -143,7 +142,7 @@ class tx_form_Domain_Factory_TyposcriptToJson {
         * @param array $typoscript Configuration array
         * @return void
         */
-       protected function setValidationRules($typoscript) {
+       protected function setValidationRules(array $typoscript) {
                if (isset($typoscript['rules.']) && is_array($typoscript['rules.'])) {
                        $this->validationRules = $typoscript['rules.'];
                }
@@ -159,14 +158,14 @@ class tx_form_Domain_Factory_TyposcriptToJson {
         * @param array $arguments The element arguments
         * @return void
         */
-       protected function addValidationRules(&$arguments) {
+       protected function addValidationRules(array &$arguments) {
                $validationRulesAvailable = FALSE;
 
                if (!empty($this->validationRules) && isset($arguments['name'])) {
                        foreach ($this->validationRules as $key => $ruleName) {
                                if (intval($key) && !strstr($key, '.')) {
                                        $ruleConfiguration = array();
-                                       if(isset($this->validationRules[$key . '.'])) {
+                                       if (isset($this->validationRules[$key . '.'])) {
                                                $ruleConfiguration = $this->validationRules[$key . '.'];
                                                if (isset($ruleConfiguration['element']) && $ruleConfiguration['element'] === $arguments['name']) {
                                                        $arguments['validation'][$ruleName] = $ruleConfiguration;
index 70b4cee..04029de 100644 (file)
@@ -64,7 +64,6 @@ abstract class tx_form_Domain_Model_Additional_Abstract {
         *
         * @param string $type Type of the object
         * @param mixed $value Value of the object
-        * @return void
         */
        public function __construct($type, $value) {
                $this->localCobj = t3lib_div::makeInstance('tslib_cObj');
@@ -90,5 +89,12 @@ abstract class tx_form_Domain_Model_Additional_Abstract {
        public function setLayout($layout) {
                $this->layout = (string) $layout;
        }
+
+       /**
+        * Returns the value of the object
+        *
+        * @return string
+        */
+       abstract public function getValue();
 }
 ?>
\ No newline at end of file
index 005b149..3a5a9c2 100644 (file)
@@ -39,14 +39,6 @@ class tx_form_Domain_Model_Additional_Additional {
        protected $additional = array();
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
-       /**
         * Add an additional object to the additional array
         *
         * @param string $class Name of the additional
@@ -76,7 +68,7 @@ class tx_form_Domain_Model_Additional_Additional {
         * Get a specific additional object by using the key
         *
         * @param string $key Key of the additional
-        * @return string The additional object
+        * @return tx_form_Domain_Model_Additional_Abstract The additional object
         */
        public function getAdditionalObjectByKey($key) {
                return $this->additional[$key];
@@ -90,11 +82,7 @@ class tx_form_Domain_Model_Additional_Additional {
         * @return boolean
         */
        public function additionalIsSet($key) {
-               if (isset($this->additional[$key])) {
-                       return TRUE;
-               } else {
-                       return FALSE;
-               }
+               return isset($this->additional[$key]);
        }
 
        /**
@@ -105,7 +93,7 @@ class tx_form_Domain_Model_Additional_Additional {
         * @return void
         */
        public function setLayout($key, $layout) {
-               $this->additional[$key]->setLayout($layout);
+               $this->getAdditionalObjectByKey($key)->setLayout($layout);
        }
 
        /**
@@ -115,7 +103,7 @@ class tx_form_Domain_Model_Additional_Additional {
         * @return string The value of the additional
         */
        public function getValue($key) {
-               return $this->additional[$key]->getValue();
+               return $this->getAdditionalObjectByKey($key)->getValue();
        }
 }
 ?>
\ No newline at end of file
index 8a553f6..2d8f7b5 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Additional_Error extends tx_form_Domain_Model_Additional_Abstract implements tx_form_Domain_Model_Additional_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $type Type of the object
-        * @param mixed $value Value of the object
-        * @return void
-        */
-       public function __construct($type, $value) {
-               parent::__construct($type, $value);
-       }
-
+class tx_form_Domain_Model_Additional_Error extends tx_form_Domain_Model_Additional_Abstract {
        /**
         * Return the value of the object
         *
@@ -50,7 +38,7 @@ class tx_form_Domain_Model_Additional_Error extends tx_form_Domain_Model_Additio
        public function getValue() {
                $errors = array();
 
-               foreach($this->value as $error) {
+               foreach ($this->value as $error) {
                        $errors[] = $this->localCobj->cObjGetSingle($this->type, $error);
                }
 
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Interface.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Interface.php
deleted file mode 100644 (file)
index 6f86ed7..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Interface for additional
- *
- * @author Patrick Broens <patrick@patrickbroens.nl>
- * @package TYPO3
- * @subpackage form
- */
-interface tx_form_Domain_Model_Additional_Interface {
-
-       /**
-        * Return the value of the object
-        *
-        * @return string
-        */
-       public function getValue();
-}
-?>
\ No newline at end of file
index 0a42f9f..5b399ca 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Additional_Label extends tx_form_Domain_Model_Additional_Abstract implements tx_form_Domain_Model_Additional_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @return void
-        */
-       public function __construct($type, $value) {
-               parent::__construct($type, $value);
-       }
-
+class tx_form_Domain_Model_Additional_Label extends tx_form_Domain_Model_Additional_Abstract {
        /**
         * Return the value of the object
         *
index 2f34e87..e985468 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Additional_Legend extends tx_form_Domain_Model_Additional_Abstract implements tx_form_Domain_Model_Additional_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $type Type of the object
-        * @param mixed $value Value of the object
-        * @return void
-        */
-       public function __construct($type, $value) {
-               parent::__construct($type, $value);
-       }
-
+class tx_form_Domain_Model_Additional_Legend extends tx_form_Domain_Model_Additional_Abstract {
        /**
         * Return the value of the object
         *
index 39e5b2f..ea7df7b 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Additional_Mandatory extends tx_form_Domain_Model_Additional_Abstract implements tx_form_Domain_Model_Additional_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $type Type of the object
-        * @param mixed $value Value of the object
-        * @return void
-        */
-       public function __construct($type, $value) {
-               parent::__construct($type, $value);
-       }
-
+class tx_form_Domain_Model_Additional_Mandatory extends tx_form_Domain_Model_Additional_Abstract {
        /**
         * Return the value of the object
         *
@@ -50,7 +38,7 @@ class tx_form_Domain_Model_Additional_Mandatory extends tx_form_Domain_Model_Add
        public function getValue() {
                $messages = array();
 
-               foreach($this->value as $message) {
+               foreach ($this->value as $message) {
                        $messages[] = $this->localCobj->cObjGetSingle($this->type, $message);
                }
 
index 28aacd1..acfcf40 100644 (file)
@@ -73,5 +73,12 @@ abstract class tx_form_Domain_Model_Attributes_Abstract {
        public function setValue($value) {
                $this->value = (string) $value;
        }
+
+       /**
+        * Gets the accordant attribute value.
+        *
+        * @return string
+        */
+       abstract public function getValue();
 }
 ?>
\ No newline at end of file
index f215e0a..2e7422e 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Accept extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Accept extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'accept'.
+        * Gets the attribute 'accept'.
         * Used with the elements 'form', 'input'
         * Case Insensitive
         *
index 421a996..72b63ab 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Acceptcharset extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Acceptcharset extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'accept-charset'.
+        * Gets the attribute 'accept-charset'.
         * Used with the element 'form'
         * Case Insensitive
         *
index 42e107d..d9b7af3 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Accesskey extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Accesskey extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'accesskey'.
+        * Gets the attribute 'accesskey'.
         * Used with the element 'button, input, label, legend, textarea'
         * Not subject to case changes
         *
index 835f2af..54e7bfa 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Action extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Action extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'action'
+        * Gets the attribute 'action'
         * Used with the element 'form'
         * Lower case
         *
@@ -55,7 +43,7 @@ class tx_form_Domain_Model_Attributes_Action extends tx_form_Domain_Model_Attrib
        public function getValue() {
                $value = $this->value;
 
-               if(empty($value)) {
+               if (empty($value)) {
                        $value = $GLOBALS['TSFE']->id;
                }
 
index cf9031d..840a66a 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Alt extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Alt extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'alt'
+        * Gets the attribute 'alt'
         * Used with the element 'input'
         * Case sensitive
         *
index d9aa5e9..90b448f 100644 (file)
@@ -106,7 +106,7 @@ class tx_form_Domain_Model_Attributes_Attributes {
         * Get a specific attribute object by using the key
         *
         * @param string $key Key of the attribute
-        * @return string The attribute object
+        * @return tx_form_Domain_Model_Attributes_Abstract The attribute object
         */
        public function getAttributeObjectByKey($key) {
                return $this->attributes[$key];
@@ -130,10 +130,7 @@ class tx_form_Domain_Model_Attributes_Attributes {
         * @return boolean
         */
        public function hasAttribute($key) {
-               if(isset($this->attributes[$key])) {
-                       return TRUE;
-               }
-               return FALSE;
+               return isset($this->attributes[$key]);
        }
 
        /**
@@ -144,7 +141,7 @@ class tx_form_Domain_Model_Attributes_Attributes {
         * @return void
         */
        public function setValue($key, $value) {
-               $this->attributes[$key]->setValue($value);
+               $this->getAttributeObjectByKey($key)->setValue($value);
        }
 
        /**
@@ -154,9 +151,7 @@ class tx_form_Domain_Model_Attributes_Attributes {
         * @return string The content of the attribute
         */
        public function getValue($key) {
-               if($this->attributes[$key]) {
-                       return $this->attributes[$key]->getValue();
-               }
+               return $this->getAttributeObjectByKey($key)->getValue();
        }
 }
 ?>
\ No newline at end of file
index 9d0c7c0..c26cf94 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Checked extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Checked extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'checked'
+        * Gets the attribute 'checked'
         * Used with the element 'input' only if type attribute has the value
         * 'radio, checkbox'
         * Case insensitive
@@ -55,7 +43,7 @@ class tx_form_Domain_Model_Attributes_Checked extends tx_form_Domain_Model_Attri
         * @return string Attribute value
         */
        public function getValue() {
-               if((integer) $this->value === 1
+               if ((integer) $this->value === 1
                        || (boolean) $this->value === TRUE
                        || strtolower((string) $this->value === 'checked'))
                {
index 01b6d63..a1908fc 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Class extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Class extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'class'.
+        * Gets the attribute 'class'.
         * Used with all elements
         * Case Sensitive
         *
index d8e11a7..1ff6a1a 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Cols extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Cols extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'cols'.
+        * Gets the attribute 'cols'.
         * Used with the element 'textarea'
         * Not subject to case changes, because it's an integer
         *
@@ -58,7 +46,7 @@ class tx_form_Domain_Model_Attributes_Cols extends tx_form_Domain_Model_Attribut
         */
        public function getValue() {
                $value = (integer) $this->value;
-               if($value <= 0) {
+               if ($value <= 0) {
                        $attribute = 40;
                } else {
                        $attribute = $value;
index a0c52e9..4f97ed7 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Dir extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Dir extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'dir'.
+        * Gets the attribute 'dir'.
         * Used with all elements
         * Case Insensitive
         *
@@ -64,7 +52,7 @@ class tx_form_Domain_Model_Attributes_Dir extends tx_form_Domain_Model_Attribute
         */
        public function getValue() {
                $value = strtolower((string) $this->value);
-               if($value == 'ltr' || $value == 'rtl') {
+               if ($value == 'ltr' || $value == 'rtl') {
                        $attribute = $value;
                }
                return $attribute;
index 8c9b126..397296a 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Disabled extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Disabled extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'disabled'.
+        * Gets the attribute 'disabled'.
         * Used with the elements button, input, optgroup, option, select & textarea
         * Case Insensitive
         *
@@ -64,7 +52,7 @@ class tx_form_Domain_Model_Attributes_Disabled extends tx_form_Domain_Model_Attr
         * @return string Attribute value
         */
        public function getValue() {
-               if((integer) $this->value === 1
+               if ((integer) $this->value === 1
                        || (boolean) $this->value === TRUE
                        || strtolower((string) $this->value) === 'disabled')
                {
index beefa6a..4b093ae 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Enctype extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Enctype extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'enctype'.
+        * Gets the attribute 'enctype'.
         * Used with the element 'form'
         * Case Insensitive
         *
@@ -57,7 +45,7 @@ class tx_form_Domain_Model_Attributes_Enctype extends tx_form_Domain_Model_Attri
         */
        public function getValue() {
                $value = strtolower((string) $this->value);
-               if($value == 'multipart/form-data' || $value == 'application/x-www-form-urlencoded') {
+               if ($value == 'multipart/form-data' || $value == 'application/x-www-form-urlencoded') {
                        $attribute = $value;
                } elseif (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'])) {
                        $attribute = $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'];
index 5e4fee8..2a01724 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Id extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Id extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'id'.
+        * Gets the attribute 'id'.
         * Used with all elements
         * Case Sensitive
         *
@@ -55,22 +43,22 @@ class tx_form_Domain_Model_Attributes_Id extends tx_form_Domain_Model_Attributes
        public function getValue() {
                $value = (string) $this->value;
 
-               if($this->elementClassName === 'tx_form_Domain_Model_Form') {
-                       if(empty($value)) {
+               if ($this->elementClassName === 'tx_form_Domain_Model_Form') {
+                       if (empty($value)) {
                                $value = 'form-' . $GLOBALS['TSFE']->id;
                        }
-               } elseif(empty($value)) {
+               } elseif (empty($value)) {
                        $value = $this->elementId;
-                       if(is_integer($value)) {
+                       if (is_integer($value)) {
                                $value = 'field-' . $value;
                        }
                }
 
                        // Change spaces into hyphens
-               $attribute = preg_replace('/\s/' , '-', $value);
+               $attribute = preg_replace('/\s/', '-', $value);
 
                        // Change first non-letter to field-
-               if(preg_match('/^([^a-zA-Z]{1})/', $attribute)) {
+               if (preg_match('/^([^a-zA-Z]{1})/', $attribute)) {
                        $attribute = 'field-' . $attribute;
                }
                        // Remove non-word characters
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Interface.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Interface.php
deleted file mode 100644 (file)
index 3652464..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Interface for attributes
- *
- * @author Patrick Broens <patrick@patrickbroens.nl>
- * @package TYPO3
- * @subpackage form
- */
-interface tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Return attribute value, probably run through filter
-        *
-        * @return mixed
-        */
-       public function getValue();
-}
-?>
\ No newline at end of file
index fb07f29..c8cdfba 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Label extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Label extends tx_form_Domain_Model_Attributes_Abstract {
        /**
         * Defines the label usage of the linked document.
         * Used with optgroup and option
index b91f3a8..83825f6 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Lang extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Lang extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'lang'.
+        * Gets the attribute 'lang'.
         * Used with all elements
         * Case Insensitive
         *
index e542db2..3aae5ad 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Maxlength extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Maxlength extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'maxlength'.
+        * Gets the attribute 'maxlength'.
         * Used with element 'input'
         * Not subject to case changes, because it's an integer
         *
@@ -58,7 +46,7 @@ class tx_form_Domain_Model_Attributes_Maxlength extends tx_form_Domain_Model_Att
        public function getValue() {
                $value = (integer) $this->value;
 
-               if($value <= 0) {
+               if ($value <= 0) {
                        $attribute = 40;
                } else {
                        $attribute = $value;
index 732fc35..f4d4d27 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Method extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Method extends tx_form_Domain_Model_Attributes_Abstract {
        /**
         * Sets the attribute 'method'.
         * Used with element 'form'
@@ -56,7 +44,7 @@ class tx_form_Domain_Model_Attributes_Method extends tx_form_Domain_Model_Attrib
        public function getValue() {
                $value = strtolower((string) $this->value);
 
-               if($value == 'post' || $value == 'get') {
+               if ($value == 'post' || $value == 'get') {
                        $attribute = $value;
                } else {
                        $attribute = 'post';
index 16b0784..c6e1aac 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Multiple extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Multiple extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'multiple'.
+        * Gets the attribute 'multiple'.
         * Used with element 'select'
         * Case Insensitive
         *
@@ -53,7 +41,7 @@ class tx_form_Domain_Model_Attributes_Multiple extends tx_form_Domain_Model_Attr
         * @return string Attribute value
         */
        public function getValue() {
-               if((integer) $this->value === 1
+               if ((integer) $this->value === 1
                        || (boolean) $this->value === TRUE
                        || strtolower((string) $this->value) === 'multiple')
                {
index 2abf6a9..9f13d76 100644 (file)
@@ -29,7 +29,7 @@
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Name extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
+class tx_form_Domain_Model_Attributes_Name extends tx_form_Domain_Model_Attributes_Abstract {
 
        /**
         * Addition to the name value
@@ -46,17 +46,6 @@ class tx_form_Domain_Model_Attributes_Name extends tx_form_Domain_Model_Attribut
        protected $returnValueWithoutPrefix = FALSE;
 
        /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
-       /**
         * Return the name attribute without the prefix
         *
         * @return string
@@ -65,12 +54,12 @@ class tx_form_Domain_Model_Attributes_Name extends tx_form_Domain_Model_Attribut
                $value = (string) $this->value;
 
                        // Change spaces into hyphens
-               $value = preg_replace('/\s/' , '-', $value);
+               $value = preg_replace('/\s/', '-', $value);
 
                        // Remove non-word characters
                $value = preg_replace('/[^a-zA-Z0-9_\-]+/', '', $value);
 
-               if(empty($value)) {
+               if (empty($value)) {
                        $value = $this->elementId;
                }
 
@@ -78,7 +67,7 @@ class tx_form_Domain_Model_Attributes_Name extends tx_form_Domain_Model_Attribut
        }
 
        /**
-        * Sets the attribute 'name'.
+        * Gets the attribute 'name'.
         * Used with all elements
         * Case Insensitive
         *
@@ -94,7 +83,7 @@ class tx_form_Domain_Model_Attributes_Name extends tx_form_Domain_Model_Attribut
        public function getValue() {
                $value = $this->getValueWithoutPrefix();
 
-               if($this->returnValueWithoutPrefix === FALSE) {
+               if ($this->returnValueWithoutPrefix === FALSE) {
                        $requestHandler = t3lib_div::makeInstance('tx_form_System_Request');
                        $attribute = $requestHandler->getPrefix() . '[' . $value . ']' . $this->addition;
                } else {
index 56292a7..b0c62ce 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Readonly extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Readonly extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'readonly'.
+        * Gets the attribute 'readonly'.
         * Used with the elements input and textarea
         * Case Insensitive
         *
@@ -62,7 +50,7 @@ class tx_form_Domain_Model_Attributes_Readonly extends tx_form_Domain_Model_Attr
         * @return string Attribute value
         */
        public function getValue() {
-               if((integer) $this->value === 1
+               if ((integer) $this->value === 1
                        || (boolean) $this->value === TRUE
                        || strtolower((string) $this->value) === 'readonly')
                {
index 79c5c96..f4bd616 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Rows extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Rows extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'rows'.
+        * Gets the attribute 'rows'.
         * Used with the element 'textarea'
         * Not subject to case changes, because it's an integer
         *
@@ -58,7 +46,7 @@ class tx_form_Domain_Model_Attributes_Rows extends tx_form_Domain_Model_Attribut
        public function getValue() {
                $value = (integer) $this->value;
 
-               if($value <= 0) {
+               if ($value <= 0) {
                        $attribute = 80;
                } else {
                        $attribute = $value;
index 8e7da0d..a309a7e 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Selected extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Selected extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'selected'
+        * Gets the attribute 'selected'
         * Used with the element 'option'
         * Case insensitive
         *
         * @return string Attribute value
         */
        public function getValue() {
-               if((integer) $this->value === 1
+               if ((integer) $this->value === 1
                        || (boolean) $this->value === TRUE
                        || strtolower((string) $this->value) === 'selected')
                {
index cdf7fa7..67ff12d 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Size extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Size extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'size'.
+        * Gets the attribute 'size'.
         * Used with the element 'input'
         * Not subject to case changes, because it's an integer
         *
@@ -57,7 +45,7 @@ class tx_form_Domain_Model_Attributes_Size extends tx_form_Domain_Model_Attribut
        public function getValue() {
                $value = (integer) $this->value;
 
-               if($value <= 0) {
+               if ($value <= 0) {
                        $attribute = 40;
                } else {
                        $attribute = $value;
index e26426d..7e70e03 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Src extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Src extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'src'.
+        * Gets the attribute 'src'.
         * Used with the element 'input'
         * URI type definition
         *
index de9e358..fe16891 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Style extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Style extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'style'.
+        * Gets the attribute 'style'.
         * Used with all elements
         * Not subject to case changes
         *
index 442d292..35ad342 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Tabindex extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Tabindex extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'tabindex'.
+        * Gets the attribute 'tabindex'.
         * Used with the elements button, input, select and textarea
         * Not subject to case changes
         *
@@ -82,7 +70,7 @@ class tx_form_Domain_Model_Attributes_Tabindex extends tx_form_Domain_Model_Attr
        public function getValue() {
                $attribute = (integer) $this->value;
 
-               if($attribute < 0 || $attribute > 32767) {
+               if ($attribute < 0 || $attribute > 32767) {
                        $attribute = 0;
                }
 
index 5e5a1e7..6e7f0e1 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Title extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Title extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'title'.
+        * Gets the attribute 'title'.
         * Used with all elements
         * Case Sensitive
         *
index acc7c48..d5f6363 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Type extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
+class tx_form_Domain_Model_Attributes_Type extends tx_form_Domain_Model_Attributes_Abstract {
+       /**
+        * @var array
+        */
        protected $allowedValues = array(
                'text',
                'password',
@@ -45,18 +47,7 @@ class tx_form_Domain_Model_Attributes_Type extends tx_form_Domain_Model_Attribut
        );
 
        /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
-       /**
-        * Sets the attribute 'type'.
+        * Gets the attribute 'type'.
         * Used with all input elements
         * Case Insensitive
         *
@@ -67,7 +58,7 @@ class tx_form_Domain_Model_Attributes_Type extends tx_form_Domain_Model_Attribut
        public function getValue() {
                $attribute = strtolower((string) $this->value);
 
-               if(empty($attribute) || !in_array($attribute, $this->allowedValues)) {
+               if (empty($attribute) || !in_array($attribute, $this->allowedValues)) {
                        $attribute = 'text';
                }
 
index c7ca845..ec94967 100644 (file)
  * @package TYPO3
  * @subpackage form
  */
-class tx_form_Domain_Model_Attributes_Value extends tx_form_Domain_Model_Attributes_Abstract implements tx_form_Domain_Model_Attributes_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param string $value Attribute value
-        * @param integer $elementId The ID of the element
-        * @return void
-        */
-       public function __construct($value, $elementId) {
-               parent::__construct($value, $elementId);
-       }
-
+class tx_form_Domain_Model_Attributes_Value extends tx_form_Domain_Model_Attributes_Abstract {
        /**
-        * Sets the attribute 'value'.
+        * Gets the attribute 'value'.
         * Used with the elements input, option, button
         * The element or attribute definition itself gives case information.
         *
index 58a182b..43fd4fc 100644 (file)
@@ -29,8 +29,6 @@
  * @package TYPO3
  * @subpackage form
  * @author Patrick Broens <patrick@patrickbroens.nl>
- * @license http://www.gnu.org/copyleft/gpl.html
- * @version $Id$
  */
 class tx_form_Domain_Model_Content {
 
@@ -56,14 +54,6 @@ class tx_form_Domain_Model_Content {
        protected $typoscript = array();
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
-       /**
         * Sets the uid
         *
         * @param integer $uid The uid
index 221a56c..b1174bf 100644 (file)
@@ -56,14 +56,14 @@ abstract class tx_form_Domain_Model_Element_Abstract {
        /**
         * Attribute object
         *
-        * @var tx_form_Domain_Model_Attributes
+        * @var tx_form_Domain_Model_Attributes_Attributes
         */
        protected $attributes;
 
        /**
         * Additional object
         *
-        * @var tx_form_Domain_Model_Additional
+        * @var tx_form_Domain_Model_Additional_Additional
         */
        protected $additional;
 
@@ -107,6 +107,11 @@ abstract class tx_form_Domain_Model_Element_Abstract {
        protected $mandatoryAttributes = array();
 
        /**
+        * @var array
+        */
+       protected $allowedAttributes = array();
+
+       /**
         * The content object
         *
         * @var tslib_cObj
@@ -114,6 +119,26 @@ abstract class tx_form_Domain_Model_Element_Abstract {
        protected $localCobj;
 
        /**
+        * @var tx_form_System_Request
+        */
+       protected $requestHandler;
+
+       /**
+        * @var tx_form_System_Elementcounter
+        */
+       protected $elementCounter;
+
+       /**
+        * @var tx_form_System_Validate
+        */
+       protected $validateClass;
+
+       /**
+        * @var tx_form_System_Filter
+        */
+       protected $filter;
+
+       /**
         * Constructor
         *
         * @param integer $elementId Internal Id of the element
@@ -177,7 +202,7 @@ abstract class tx_form_Domain_Model_Element_Abstract {
        /**
         * Check to see if this element accepts the parent name instead of its own
         *
-        * @return void
+        * @return boolean
         */
        public function acceptsParentName() {
                return $this->acceptsParentName;
@@ -188,10 +213,10 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         *
         * @param string $attribute Name of the attribute
         * @param mixed $value Value of the attribute
-        * @return object
+        * @return tx_form_Domain_Model_Element_Abstract
         */
        public function setAttribute($attribute, $value) {
-               if(array_key_exists($attribute, $this->allowedAttributes)) {
+               if (array_key_exists($attribute, $this->allowedAttributes)) {
                        $this->attributes->addAttribute($attribute, $value);
                }
 
@@ -222,10 +247,7 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         * @return boolean TRUE if there is a list of allowed attributes
         */
        public function hasAllowedAttributes() {
-               if(isset($this->allowedAttributes)) {
-                       return TRUE;
-               }
-               return FALSE;
+               return (empty($this->allowedAttributes) === FALSE);
        }
 
        /**
@@ -234,10 +256,7 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         * @return boolean TRUE if there is a list of allowed additionals
         */
        public function hasAllowedAdditionals() {
-               if(isset($this->allowedAdditional)) {
-                       return TRUE;
-               }
-               return FALSE;
+               return (empty($this->allowedAdditional) === FALSE);
        }
 
        /**
@@ -310,11 +329,10 @@ abstract class tx_form_Domain_Model_Element_Abstract {
        /**
         * Load the attributes object
         *
-        * @return tx_form_Domain_Model_Attributes
+        * @return void
         */
        protected function createAttributes() {
                $className = 'tx_form_Domain_Model_Attributes_Attributes';
-
                $this->attributes = t3lib_div::makeInstance($className, $this->elementId);
        }
 
@@ -372,14 +390,10 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         * @return void
         */
        public function setMessagesFromValidation() {
-               if($this->validateClass->hasMessage($this->getName())) {
+               if ($this->validateClass->hasMessage($this->getName())) {
                        $messages = $this->validateClass->getMessagesByName($this->getName());
 
-                       try {
-                               $this->setAdditional('mandatory', 'COA', $messages);
-                       } catch (Exception $exception) {
-                               throw new Exception ('Cannot call user function for additional ' . ucfirst($additional));
-                       }
+                       $this->setAdditional('mandatory', 'COA', $messages);
                }
        }
 
@@ -389,14 +403,10 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         * @return void
         */
        public function setErrorsFromValidation() {
-               if($this->validateClass->hasErrors($this->getName())) {
+               if ($this->validateClass->hasErrors($this->getName())) {
                        $errors = $this->validateClass->getErrorsByName($this->getName());
 
-                       try {
-                               $this->setAdditional('error', 'COA', $errors);
-                       } catch (Exception $exception) {
-                               throw new Exception ('Cannot call user function for additional ' . ucfirst($additional));
-                       }
+                       $this->setAdditional('error', 'COA', $errors);
                }
        }
 
@@ -405,7 +415,7 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         *
         * @param string $additional Name of the additional
         * @param mixed $value Value of the additional
-        * @return object
+        * @return tx_form_Domain_Model_Element_Abstract
         */
        public function setAdditional($additional, $type, $value) {
                $this->additional->addAdditional($additional, $type, $value);
@@ -483,7 +493,7 @@ abstract class tx_form_Domain_Model_Element_Abstract {
         * Dummy function to check the request handler on input
         * and set submitted data right for elements
         *
-        * @return object
+        * @return tx_form_Domain_Model_Element_Abstract
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
                return $this;
index e05691a..1d8780f 100644 (file)
@@ -63,16 +63,6 @@ class tx_form_Domain_Model_Element_Button extends tx_form_Domain_Model_Element_A
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set the value of the button
         * Checks if value is set from Typoscript,
         * otherwise use localized value.
@@ -83,11 +73,12 @@ class tx_form_Domain_Model_Element_Button extends tx_form_Domain_Model_Element_A
         * @see tx_form_Domain_Model_Element::setValue()
         */
        public function setValue($value = '') {
+               /** @var $localizationHandler tx_form_System_Localization */
                $localizationHandler = t3lib_div::makeInstance('tx_form_System_Localization');
 
                $oldValue = $this->getAttributeValue('value');
-               if(empty($oldValue)) {
-                       if(!empty($value)) {
+               if (empty($oldValue)) {
+                       if (!empty($value)) {
                                $newValue = (string) $value;
                        } else {
                                $newValue = $localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_button.value');
index f509b2b..1b520e2 100644 (file)
@@ -72,23 +72,12 @@ class tx_form_Domain_Model_Element_Checkbox extends tx_form_Domain_Model_Element
        protected $acceptsParentName = TRUE;
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set the value of the checkbox
         *
         * If there is submitted data for this field
         * it will change the checked attribute
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Checkbox
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
@@ -97,16 +86,16 @@ class tx_form_Domain_Model_Element_Checkbox extends tx_form_Domain_Model_Element
                        $this->setAttribute('value', $this->value);
                }
 
-               if($this->requestHandler->has($this->getName())) {
+               if ($this->requestHandler->has($this->getName())) {
                        $submittedValue = $this->requestHandler->getByMethod($this->getName());
-                       if(is_array($submittedValue) && in_array($this->value, $submittedValue)) {
+                       if (is_array($submittedValue) && in_array($this->value, $submittedValue)) {
                                $this->setAttribute('checked', 'checked');
-                       } elseif($submittedValue === $this->value) {
+                       } elseif ($submittedValue === $this->value) {
                                $this->setAttribute('checked', 'checked');
-                       } elseif(is_array($submittedValue) && in_array('on', $submittedValue)) {
+                       } elseif (is_array($submittedValue) && in_array('on', $submittedValue)) {
                                $this->setAttribute('checked', 'checked');
                        }
-               } elseif($this->requestHandler->hasRequest()) {
+               } elseif ($this->requestHandler->hasRequest()) {
                        $this->attributes->removeAttribute('checked');
                }
                return $this;
@@ -117,17 +106,17 @@ class tx_form_Domain_Model_Element_Checkbox extends tx_form_Domain_Model_Element
         *
         * @param string $attribute Name of the attribute
         * @param mixed $value Value of the attribute
-        * @return object
+        * @return tx_form_Domain_Model_Element_Checkbox
         */
        public function setAttribute($attribute, $value) {
-               if(array_key_exists($attribute, $this->allowedAttributes)) {
+               if (array_key_exists($attribute, $this->allowedAttributes)) {
                        $this->attributes->addAttribute($attribute, $value);
                }
 
-               if($attribute === 'name') {
+               if ($attribute === 'name') {
+                       /** @var $nameAttribute tx_form_Domain_Model_Attributes_Name */
                        $nameAttribute = $this->attributes->getAttributeObjectByKey('name');
                        $nameAttribute->setAddition('[]');
-                       $this->attributes->setAttribute('name', $nameAttribute);
                }
 
                return $this;
index b4aa507..3a67d08 100644 (file)
  * @subpackage form
  */
 class tx_form_Domain_Model_Element_Checkboxgroup extends tx_form_Domain_Model_Element_Fieldset {
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor, fills the attributes
-        * and adds all child objects
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
        /**
         * Add child object to this element
         *
-        * @param object $element The child object
-        * @return object
+        * @param tx_form_Domain_Model_Element_Abstract $element The child object
+        * @return tx_form_Domain_Model_Element_Checkboxgroup
         */
-       public function addElement($element) {
+       public function addElement(tx_form_Domain_Model_Element_Abstract $element) {
                if ($element->acceptsParentName()) {
                        $element->setName($this->getName());
                        $element->attributes->setValue('name', $this->getName());
index 484b54b..25b2a4a 100644 (file)
@@ -39,21 +39,12 @@ class tx_form_Domain_Model_Element_Container extends tx_form_Domain_Model_Elemen
        protected $elements = array();
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Add child object to this element
         *
-        * @param object $element The child object
-        * @return object
+        * @param tx_form_Domain_Model_Element_Abstract $element The child object
+        * @return tx_form_Domain_Model_Element_Container
         */
-       public function addElement($element) {
+       public function addElement(tx_form_Domain_Model_Element_Abstract $element) {
                $this->elements[] = $element;
                return $this;
        }
index 7338994..4d0d803 100644 (file)
  * @subpackage form
  */
 class tx_form_Domain_Model_Element_Content extends tx_form_Domain_Model_Element_Abstract {
+       /**
+        * @var string
+        */
+       protected $objectName;
+
+       /**
+        * @var array
+        */
+       protected $objectConfiguration;
 
        /**
         * Allowed attributes for this object
@@ -45,25 +54,15 @@ class tx_form_Domain_Model_Element_Content extends tx_form_Domain_Model_Element_
        protected $mandatoryAttributes = array();
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set the content for the element
         *
-        * @param string $cObj The name of the object
-        * @param array $cObjDot The configuration of the object
+        * @param string $objectName The name of the object
+        * @param array $objectConfiguration The configuration of the object
         * @return void
         */
-       public function setData($cObj, $cObjDot) {
-               $this->cObj = $cObj;
-               $this->cObjDot = $cObjDot;
+       public function setData($objectName, array $objectConfiguration) {
+               $this->objectName = $objectName;
+               $this->objectConfiguration = $objectConfiguration;
        }
 
        /**
@@ -74,7 +73,10 @@ class tx_form_Domain_Model_Element_Content extends tx_form_Domain_Model_Element_
         * @return string
         */
        public function getData() {
-               $data = $this->localCobj->cObjGetSingle($this->cObj, $this->cObjDot);
+               $data = $this->localCobj->cObjGetSingle(
+                       $this->objectName,
+                       $this->objectConfiguration
+               );
 
                return $data;
        }
index f3ab8fb..cbc7c56 100644 (file)
@@ -43,16 +43,5 @@ class tx_form_Domain_Model_Element_Fieldset extends tx_form_Domain_Model_Element
                'lang' => '',
                'style' => '',
        );
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor, fills the attributes
-        * and adds all child objects
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index e3a4a74..78abc24 100644 (file)
@@ -69,15 +69,5 @@ class tx_form_Domain_Model_Element_Fileupload extends tx_form_Domain_Model_Eleme
                $uploadData = $this->requestHandler->get($this->name);
                return $uploadData['originalFilename'];
        }
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index 5c30c5a..33348f0 100644 (file)
@@ -56,26 +56,15 @@ class tx_form_Domain_Model_Element_Hidden extends tx_form_Domain_Model_Element_A
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Check the request handler on input of this field,
         * filter the submitted data and add this to the right
         * datapart of the element
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Hidden
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
-               if($this->requestHandler->has($this->getName())) {
+               if ($this->requestHandler->has($this->getName())) {
                        $value = $this->requestHandler->getByMethod($this->getName());
                        $value = $this->filter->filter($value);
 
index d1bfc3b..cf3c658 100644 (file)
@@ -62,15 +62,5 @@ class tx_form_Domain_Model_Element_Imagebutton extends tx_form_Domain_Model_Elem
                'name',
                'id'
        );
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index e0c9ea8..3d906d0 100644 (file)
@@ -51,36 +51,18 @@ class tx_form_Domain_Model_Element_Optgroup extends tx_form_Domain_Model_Element
         *
         * @var array
         */
-       protected $mandatoryAttributes = array(
-       );
-
-       /**
-        * Parent object
-        *
-        * @var object
-        */
-       protected $parentName;
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
+       protected $mandatoryAttributes = array();
 
        /**
         * Set the name of the parent object
         *
         * @param string $parentName Name of the parent
-        * @return object The element object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Optgroup The element object
         * @see tx_form_Domain_Model_Element::setParent()
         */
        public function setParentName($parentName) {
-               foreach($this->elements as $element) {
+               /** @var $element tx_form_Domain_Model_Element_Option */
+               foreach ($this->elements as $element) {
                        $element->setParentName($parentName);
                }
                return $this;
@@ -89,10 +71,10 @@ class tx_form_Domain_Model_Element_Optgroup extends tx_form_Domain_Model_Element
        /**
         * Add child object to this element
         *
-        * @param object $element The child object
-        * @return object
+        * @param tx_form_Domain_Model_Element_Option $element The child object
+        * @return tx_form_Domain_Model_Element_Optgroup
         */
-       public function addElement($element) {
+       public function addElement(tx_form_Domain_Model_Element_Option $element) {
                $this->elements[] = $element;
                return $this;
        }
index 86fb75b..8d4f2fe 100644 (file)
@@ -57,21 +57,11 @@ class tx_form_Domain_Model_Element_Option extends tx_form_Domain_Model_Element_A
        );
 
        /**
-        * Parent object
+        * Parent object name
         *
-        * @var object
+        * @var string
         */
-       protected $parentObject;
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
+       protected $parentName;
 
        /**
         * Returns the content of the option tag
@@ -87,8 +77,7 @@ class tx_form_Domain_Model_Element_Option extends tx_form_Domain_Model_Element_A
         * Set the name of the parent object
         *
         * @param string $parentName Name of the parent
-        * @return object The element object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Option The element object
         * @see tx_form_Domain_Model_Element::setParent()
         */
        public function setParentName($parentName) {
@@ -104,8 +93,7 @@ class tx_form_Domain_Model_Element_Option extends tx_form_Domain_Model_Element_A
         * If there is submitted data for this field
         * it will change the selected attribute
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Option
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
@@ -113,19 +101,19 @@ class tx_form_Domain_Model_Element_Option extends tx_form_Domain_Model_Element_A
                        $this->value = (string) $this->getElementId();
                        $this->setAttribute('value', $this->value);
                }
-               if(!empty($this->parentName)) {
-                       if($this->requestHandler->has($this->parentName)) {
+               if (!empty($this->parentName)) {
+                       if ($this->requestHandler->has($this->parentName)) {
                                $submittedValue = $this->requestHandler->getByMethod($this->parentName);
-                               if(is_array($submittedValue) && in_array($this->value, $submittedValue)) {
+                               if (is_array($submittedValue) && in_array($this->value, $submittedValue)) {
                                        $this->setAttribute('selected', 'selected');
-                               } elseif($submittedValue === $this->value) {
+                               } elseif ($submittedValue === $this->value) {
                                        $this->setAttribute('selected', 'selected');
-                               } elseif(is_array($submittedValue) && in_array('on', $submittedValue)) {
+                               } elseif (is_array($submittedValue) && in_array('on', $submittedValue)) {
                                        $this->setAttribute('selected', 'selected');
                                } else {
                                        $this->attributes->removeAttribute('selected');
                                }
-                       } elseif($this->requestHandler->hasRequest()) {
+                       } elseif ($this->requestHandler->hasRequest()) {
                                $this->attributes->removeAttribute('selected');
                        }
                }
index 82f9150..6aa9be8 100644 (file)
@@ -66,26 +66,15 @@ class tx_form_Domain_Model_Element_Password extends tx_form_Domain_Model_Element
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Check the request handler on input of this field,
         * filter the submitted data and add this to the right
         * datapart of the element
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Password
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
-               if($this->requestHandler->has($this->getName())) {
+               if ($this->requestHandler->has($this->getName())) {
                        $value = $this->requestHandler->getByMethod($this->getName());
                        $value = $this->filter->filter($value);
 
index d3f123a..e34afa0 100644 (file)
@@ -72,23 +72,12 @@ class tx_form_Domain_Model_Element_Radio extends tx_form_Domain_Model_Element_Ab
        protected $acceptsParentName = TRUE;
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set the value of the radiobutton
         *
         * If there is submitted data for this field
         * it will change the checked attribute
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Radio
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
@@ -97,12 +86,12 @@ class tx_form_Domain_Model_Element_Radio extends tx_form_Domain_Model_Element_Ab
                        $this->setAttribute('value', $this->value);
                }
 
-               if($this->requestHandler->has($this->getName())) {
+               if ($this->requestHandler->has($this->getName())) {
                        $submittedValue = $this->requestHandler->getByMethod($this->getName());
-                       if($submittedValue === $this->value) {
+                       if ($submittedValue === $this->value) {
                                $this->setAttribute('checked', 'checked');
                        }
-               } elseif($this->requestHandler->hasRequest()) {
+               } elseif ($this->requestHandler->hasRequest()) {
                        $this->attributes->removeAttribute('checked');
                }
                return $this;
index 69427be..8094a4d 100644 (file)
  * @subpackage form
  */
 class tx_form_Domain_Model_Element_Radiogroup extends tx_form_Domain_Model_Element_Fieldset {
-
-       /**
-        * Constructor
-        * Sets the configuration, calls parent constructor, fills the attributes
-        * and adds all child objects
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
        /**
         * Add child object to this element
         *
-        * @param object $element The child object
+        * @param tx_form_Domain_Model_Element_Radio $element The child object
         * @return object
         */
-       public function addElement($element) {
+       public function addElement(tx_form_Domain_Model_Element_Radio $element) {
                if ($element->acceptsParentName()) {
                        $element->setName($this->getName());
                        $element->attributes->setValue('name', $this->getName());
index ab69f74..28e33f0 100644 (file)
@@ -63,16 +63,6 @@ class tx_form_Domain_Model_Element_Reset extends tx_form_Domain_Model_Element_Ab
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set the value of the button
         * Checks if value is set from Typoscript,
         * otherwise use localized value.
@@ -87,8 +77,8 @@ class tx_form_Domain_Model_Element_Reset extends tx_form_Domain_Model_Element_Ab
 
                        // value not set from typoscript
                $oldValue = $this->getAttributeValue('value');
-               if(empty($oldValue)) {
-                       if(!empty($value)) {
+               if (empty($oldValue)) {
+                       if (!empty($value)) {
                                $newValue = (string) $value;
                        } else {
                                $newValue = $localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_reset.value');
index cd5bd1c..2aaac93 100644 (file)
@@ -60,22 +60,12 @@ class tx_form_Domain_Model_Element_Select extends tx_form_Domain_Model_Element_C
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Add child object to this element
         *
-        * @param object $element The child object
-        * @return object
+        * @param tx_form_Domain_Model_Element_Option $element The child object
+        * @return tx_form_Domain_Model_Element_Select
         */
-       public function addElement($element) {
+       public function addElement(tx_form_Domain_Model_Element_Option $element) {
                $element->setParentName($this->getName());
                $this->elements[] = $element;
                return $this;
@@ -86,10 +76,10 @@ class tx_form_Domain_Model_Element_Select extends tx_form_Domain_Model_Element_C
         *
         * @param string $attribute Name of the attribute
         * @param mixed $value Value of the attribute
-        * @return object
+        * @return tx_form_Domain_Model_Element_Select
         */
        public function setAttribute($attribute, $value) {
-               if(array_key_exists($attribute, $this->allowedAttributes)) {
+               if (array_key_exists($attribute, $this->allowedAttributes)) {
                        $this->attributes->addAttribute($attribute, $value);
                }
 
@@ -99,9 +89,9 @@ class tx_form_Domain_Model_Element_Select extends tx_form_Domain_Model_Element_C
                        || ($attribute === 'multiple'
                        && $this->attributes->hasAttribute('name')))
                {
+                       /** @var $nameAttribute tx_form_Domain_Model_Attributes_Name */
                        $nameAttribute = $this->attributes->getAttributeObjectByKey('name');
                        $nameAttribute->setAddition('[]');
-                       $this->attributes->setAttribute('name', $nameAttribute);
                }
 
                return $this;
index 2698d72..86ebada 100644 (file)
@@ -63,16 +63,6 @@ class tx_form_Domain_Model_Element_Submit extends tx_form_Domain_Model_Element_A
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set the value of the button
         * Checks if value is set from Typoscript,
         * otherwise use localized value.
@@ -83,12 +73,13 @@ class tx_form_Domain_Model_Element_Submit extends tx_form_Domain_Model_Element_A
         * @see tx_form_Domain_Model_Element::setValue()
         */
        public function setValue($value = '') {
+               /** @var $localizationHandler tx_form_System_Localization */
                $localizationHandler = t3lib_div::makeInstance('tx_form_System_Localization');
 
                        // value not set from typoscript
                $oldValue = $this->getAttributeValue('value');
-               if(empty($oldValue)) {
-                       if(!empty($value)) {
+               if (empty($oldValue)) {
+                       if (!empty($value)) {
                                $newValue = (string) $value;
                        } else {
                                $newValue = $localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_submit.value');
index 64584b8..556c077 100644 (file)
@@ -63,16 +63,6 @@ class tx_form_Domain_Model_Element_Textarea extends tx_form_Domain_Model_Element
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Returns the content of the textarea tag
         * <textarea>content</textarea>
         *
@@ -87,12 +77,11 @@ class tx_form_Domain_Model_Element_Textarea extends tx_form_Domain_Model_Element
         * filter the submitted data and add this to the right
         * datapart of the element
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Textarea
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
-               if($this->requestHandler->has($this->getName())) {
+               if ($this->requestHandler->has($this->getName())) {
                        $value = $this->requestHandler->getByMethod($this->getName());
 
                        $value = $this->filter->filter($value);
index 51dd356..64495a9 100644 (file)
@@ -66,26 +66,15 @@ class tx_form_Domain_Model_Element_Textline extends tx_form_Domain_Model_Element
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor and fills the attributes
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Check the request handler on input of this field,
         * filter the submitted data and add this to the right
         * datapart of the element
         *
-        * @return object
-        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @return tx_form_Domain_Model_Element_Textline
         * @see tx_form_Domain_Model_Element::checkFilterAndSetIncomingDataFromRequest()
         */
        public function checkFilterAndSetIncomingDataFromRequest() {
-               if($this->requestHandler->has($this->getName())) {
+               if ($this->requestHandler->has($this->getName())) {
                        $value = $this->requestHandler->getByMethod($this->getName());
                        $value = $this->filter->filter($value);
 
index 1260931..ac20713 100644 (file)
@@ -65,17 +65,6 @@ class tx_form_Domain_Model_Form extends tx_form_Domain_Model_Element_Container {
        );
 
        /**
-        * Constructor
-        * Sets the configuration, calls parent constructor, fills the attributes
-        * and adds all form element objects
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set a specific attribute by name and value
         *
         * @param string $attribute Name of the attribute
@@ -83,11 +72,11 @@ class tx_form_Domain_Model_Form extends tx_form_Domain_Model_Element_Container {
         * @return object
         */
        public function setAttribute($attribute, $value) {
-               if(array_key_exists($attribute, $this->allowedAttributes)) {
+               if (array_key_exists($attribute, $this->allowedAttributes)) {
                        $this->attributes->addAttribute($attribute, $value);
                }
 
-               if($attribute == 'id' || $attribute == 'name') {
+               if ($attribute == 'id' || $attribute == 'name') {
                        $this->equalizeNameAndIdAttribute();
                }
 
@@ -101,14 +90,17 @@ class tx_form_Domain_Model_Form extends tx_form_Domain_Model_Element_Container {
         * @return void
         */
        protected function equalizeNameAndIdAttribute() {
+               /** @var $nameAttribute tx_form_Domain_Model_Attributes_Name */
                $nameAttribute = $this->attributes->getAttributeObjectByKey('name');
                $idAttribute = $this->attributes->getAttributeObjectByKey('id');
-               if(is_object($nameAttribute) && is_object($idAttribute)) {
+
+               if (is_object($nameAttribute) && is_object($idAttribute)) {
                        $nameAttribute->setReturnValueWithoutPrefix(TRUE);
                        $this->attributes->setAttribute('name', $nameAttribute);
                        $nameAttributeValue = $nameAttribute->getValueWithoutPrefix();
                        $idAttributeValue = $idAttribute->getValue('id');
-                       if(!empty($nameAttributeValue) && !empty($idAttributeValue)) {
+
+                       if (!empty($nameAttributeValue) && !empty($idAttributeValue)) {
                                $this->attributes->setValue('id', $nameAttributeValue);
                        }
                }
index 80fe153..6602db9 100644 (file)
@@ -74,14 +74,5 @@ class tx_form_Domain_Model_JSON_Button extends tx_form_Domain_Model_JSON_Element
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index 5f7bf8f..2f6625d 100644 (file)
@@ -74,14 +74,5 @@ class tx_form_Domain_Model_JSON_Checkbox extends tx_form_Domain_Model_JSON_Eleme
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index bda4d73..4647aa1 100644 (file)
@@ -68,15 +68,6 @@ class tx_form_Domain_Model_JSON_Checkboxgroup extends tx_form_Domain_Model_JSON_
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
@@ -84,7 +75,7 @@ class tx_form_Domain_Model_JSON_Checkboxgroup extends tx_form_Domain_Model_JSON_
         * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Fieldset::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setOptions($parameters);
                $this->setVarious($parameters);
@@ -96,13 +87,13 @@ class tx_form_Domain_Model_JSON_Checkboxgroup extends tx_form_Domain_Model_JSON_
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setOptions($parameters) {
+       protected function setOptions(array $parameters) {
                if (is_array($parameters)) {
                        $keys = t3lib_TStemplate::sortedKeyList($parameters);
                        foreach ($keys as $key) {
                                $class = $parameters[$key];
                                if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($parameters[$key . '.']) && $class === 'CHECKBOX') {
+                                       if (isset($parameters[$key . '.']) && $class === 'CHECKBOX') {
                                                $childElementArguments = $parameters[$key . '.'];
                                                if (isset($childElementArguments['checked'])) {
                                                        $childElementArguments['attributes']['selected'] = 'selected';
@@ -125,7 +116,7 @@ class tx_form_Domain_Model_JSON_Checkboxgroup extends tx_form_Domain_Model_JSON_
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setVarious($parameters) {
+       protected function setVarious(array $parameters) {
                if (isset($parameters['name'])) {
                        $this->configuration['various']['name'] = $parameters['name'];
                }
index 9eb6c17..5b3d085 100644 (file)
@@ -41,21 +41,12 @@ class tx_form_Domain_Model_JSON_Container extends tx_form_Domain_Model_JSON_Elem
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Add an element to this container
         *
-        * @param object $element The element to add
+        * @param tx_form_Domain_Model_JSON_Element $element The element to add
         * @return void
         */
-       public function addElement($element) {
+       public function addElement(tx_form_Domain_Model_JSON_Element $element) {
                $this->elementContainer['items'][] = $element;
        }
 }
index 8a2195b..996563e 100644 (file)
@@ -61,20 +61,12 @@ class tx_form_Domain_Model_JSON_Element {
        protected $childElementsAllowed = TRUE;
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                foreach ($this->configuration as $key => $value) {
                        switch ($key) {
                                case 'attributes':
@@ -111,7 +103,7 @@ class tx_form_Domain_Model_JSON_Element {
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setAttributes($parameters) {
+       protected function setAttributes(array $parameters) {
                foreach ($this->allowedAttributes as $allowedAttribute) {
                        if (isset($parameters[$allowedAttribute])) {
                                $this->configuration['attributes'][$allowedAttribute] = $parameters[$allowedAttribute];
@@ -127,14 +119,14 @@ class tx_form_Domain_Model_JSON_Element {
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setFilters($parameters) {
+       protected function setFilters(array $parameters) {
                if (isset($parameters['filters.']) && is_array($parameters['filters.'])) {
                        $filters = $parameters['filters.'];
 
                        foreach ($filters as $key => $filterName) {
                                if (intval($key) && !strstr($key, '.')) {
                                        $filterConfiguration = array();
-                                       if(isset($filters[$key . '.'])) {
+                                       if (isset($filters[$key . '.'])) {
                                                $filterConfiguration = $filters[$key . '.'];
                                        }
                                        $this->configuration['filters'][$filterName] = $filterConfiguration;
@@ -151,7 +143,7 @@ class tx_form_Domain_Model_JSON_Element {
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setLabel($parameters) {
+       protected function setLabel(array $parameters) {
                if (isset($parameters['label']) && !isset($parameters['label.'])) {
                        $this->configuration['label']['value'] = $parameters['label'];
                } elseif (!isset($parameters['label']) && isset($parameters['label.'])) {
@@ -165,7 +157,7 @@ class tx_form_Domain_Model_JSON_Element {
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setLayout($parameters) {
+       protected function setLayout(array $parameters) {
                if (isset($parameters['layout'])) {
                        if ($this->configuration['layout'] === 'front') {
                                $this->configuration['layout'] = 'back';
@@ -181,7 +173,7 @@ class tx_form_Domain_Model_JSON_Element {
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setValidation($parameters) {
+       protected function setValidation(array $parameters) {
                if (isset($parameters['validation']) && is_array($parameters['validation'])) {
                        $this->configuration['validation'] = $parameters['validation'];
                } else {
index a053593..1f752de 100644 (file)
@@ -63,23 +63,13 @@ class tx_form_Domain_Model_JSON_Fieldset extends tx_form_Domain_Model_JSON_Conta
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Element::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setLegend($parameters);
        }
@@ -90,7 +80,7 @@ class tx_form_Domain_Model_JSON_Fieldset extends tx_form_Domain_Model_JSON_Conta
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setLegend($parameters) {
+       protected function setLegend(array $parameters) {
                if (isset($parameters['legend']) && !isset($parameters['legend.'])) {
                        $this->configuration['legend']['value'] = $parameters['legend'];
                } elseif (!isset($parameters['legend']) && isset($parameters['legend.'])) {
index c0f3c31..78b15f9 100644 (file)
@@ -69,23 +69,13 @@ class tx_form_Domain_Model_JSON_Form extends tx_form_Domain_Model_JSON_Container
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Container::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setPrefix($parameters);
                $this->setConfirmation($parameters);
@@ -98,7 +88,7 @@ class tx_form_Domain_Model_JSON_Form extends tx_form_Domain_Model_JSON_Container
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setConfirmation($parameters) {
+       protected function setConfirmation(array $parameters) {
                if (isset($parameters['confirmation'])) {
                        $this->configuration['confirmation'] = $parameters['confirmation'];
                }
@@ -110,14 +100,14 @@ class tx_form_Domain_Model_JSON_Form extends tx_form_Domain_Model_JSON_Container
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setPostProcessors($parameters) {
+       protected function setPostProcessors(array $parameters) {
                if (isset($parameters['postProcessor.']) && is_array($parameters['postProcessor.'])) {
                        $postProcessors = $parameters['postProcessor.'];
 
                        foreach ($postProcessors as $key => $postProcessorName) {
                                if (intval($key) && !strstr($key, '.')) {
                                        $postProcessorConfiguration = array();
-                                       if(isset($postProcessors[$key . '.'])) {
+                                       if (isset($postProcessors[$key . '.'])) {
                                                $postProcessorConfiguration = $postProcessors[$key . '.'];
                                        }
                                        $this->configuration['postProcessor'][$postProcessorName] = $postProcessorConfiguration;
@@ -139,7 +129,7 @@ class tx_form_Domain_Model_JSON_Form extends tx_form_Domain_Model_JSON_Container
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setPrefix($parameters) {
+       protected function setPrefix(array $parameters) {
                if (isset($parameters['prefix'])) {
                        $this->configuration['prefix'] = $parameters['prefix'];
                }
index ef182c0..24a0378 100644 (file)
@@ -65,23 +65,13 @@ class tx_form_Domain_Model_JSON_Header extends tx_form_Domain_Model_JSON_Element
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Element::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setVarious($parameters);
        }
@@ -94,7 +84,7 @@ class tx_form_Domain_Model_JSON_Header extends tx_form_Domain_Model_JSON_Element
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setVarious($parameters) {
+       protected function setVarious(array $parameters) {
                if (isset($parameters['wrap'])) {
                        preg_match('/<(h[1-5]{1}).*?>/', $parameters['wrap'], $matches);
                        if (!empty($matches)) {
index 43e3158..43ff4e7 100644 (file)
@@ -69,14 +69,5 @@ class tx_form_Domain_Model_JSON_Hidden extends tx_form_Domain_Model_JSON_Element
                'value'
 
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index ff7ec99..07849e0 100644 (file)
@@ -68,23 +68,13 @@ class tx_form_Domain_Model_JSON_Name extends tx_form_Domain_Model_JSON_Fieldset
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Fieldset::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setVarious($parameters);
        }
@@ -98,13 +88,13 @@ class tx_form_Domain_Model_JSON_Name extends tx_form_Domain_Model_JSON_Fieldset
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setVarious($parameters) {
+       protected function setVarious(array $parameters) {
                if (is_array($parameters)) {
                        $keys = t3lib_TStemplate::sortedKeyList($parameters);
                        foreach ($keys as $key) {
                                $class = $parameters[$key];
                                if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($parameters[$key . '.'])) {
+                                       if (isset($parameters[$key . '.'])) {
                                                $childElementArguments = $parameters[$key . '.'];
                                                if (in_array($childElementArguments['name'], array('prefix', 'suffix', 'middleName'))) {
                                                        $this->configuration['various'][$childElementArguments['name']] = TRUE;
index cf4925b..481e7a6 100644 (file)
@@ -77,14 +77,5 @@ class tx_form_Domain_Model_JSON_Password extends tx_form_Domain_Model_JSON_Eleme
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index 65fcec3..f0c2491 100644 (file)
@@ -74,14 +74,5 @@ class tx_form_Domain_Model_JSON_Radio extends tx_form_Domain_Model_JSON_Element
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index 4adf2dc..0a7515f 100644 (file)
@@ -68,23 +68,13 @@ class tx_form_Domain_Model_JSON_Radiogroup extends tx_form_Domain_Model_JSON_Fie
        );
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Fieldset::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setOptions($parameters);
                $this->setVarious($parameters);
@@ -96,13 +86,13 @@ class tx_form_Domain_Model_JSON_Radiogroup extends tx_form_Domain_Model_JSON_Fie
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setOptions($parameters) {
+       protected function setOptions(array $parameters) {
                if (is_array($parameters)) {
                        $keys = t3lib_TStemplate::sortedKeyList($parameters);
                        foreach ($keys as $key) {
                                $class = $parameters[$key];
                                if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($parameters[$key . '.']) && $class === 'RADIO') {
+                                       if (isset($parameters[$key . '.']) && $class === 'RADIO') {
                                                $childElementArguments = $parameters[$key . '.'];
                                                if (isset($childElementArguments['checked'])) {
                                                        $childElementArguments['attributes']['selected'] = 'selected';
@@ -125,7 +115,7 @@ class tx_form_Domain_Model_JSON_Radiogroup extends tx_form_Domain_Model_JSON_Fie
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setVarious($parameters) {
+       protected function setVarious(array $parameters) {
                if (isset($parameters['name'])) {
                        $this->configuration['various']['name'] = $parameters['name'];
                }
index 21df720..66fac60 100644 (file)
@@ -74,14 +74,5 @@ class tx_form_Domain_Model_JSON_Reset extends tx_form_Domain_Model_JSON_Element
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index e053285..fd75e75 100644 (file)
@@ -74,23 +74,13 @@ class tx_form_Domain_Model_JSON_Select extends tx_form_Domain_Model_JSON_Element
        protected $childElementsAllowed = FALSE;
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
-
-       /**
         * Set all the parameters for this object
         *
         * @param array $parameters Configuration array
         * @return void
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_Domain_Model_Json_Element::setParameters()
         */
-       public function setParameters($parameters) {
+       public function setParameters(array $parameters) {
                parent::setParameters($parameters);
                $this->setOptions($parameters);
        }
@@ -101,13 +91,13 @@ class tx_form_Domain_Model_JSON_Select extends tx_form_Domain_Model_JSON_Element
         * @param array $parameters Configuration array
         * @return void
         */
-       protected function setOptions($parameters) {
+       protected function setOptions(array $parameters) {
                if (is_array($parameters)) {
                        $keys = t3lib_TStemplate::sortedKeyList($parameters);
                        foreach ($keys as $key) {
                                $class = $parameters[$key];
                                if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($parameters[$key . '.']) && $class === 'OPTION') {
+                                       if (isset($parameters[$key . '.']) && $class === 'OPTION') {
                                                $childElementArguments = $parameters[$key . '.'];
                                                if (isset($childElementArguments['selected'])) {
                                                        $childElementArguments['attributes']['selected'] = $childElementArguments['selected'];
index dbfc187..264ecce 100644 (file)
@@ -74,14 +74,5 @@ class tx_form_Domain_Model_JSON_Submit extends tx_form_Domain_Model_JSON_Element
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index b2e1586..34e5a49 100644 (file)
@@ -75,14 +75,5 @@ class tx_form_Domain_Model_JSON_Textarea extends tx_form_Domain_Model_JSON_Eleme
                'tabindex',
                'title'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index 404c399..727f5d7 100644 (file)
@@ -77,14 +77,5 @@ class tx_form_Domain_Model_JSON_Textline extends tx_form_Domain_Model_JSON_Eleme
                'type',
                'value'
        );
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-               parent::__construct();
-       }
 }
 ?>
\ No newline at end of file
index e0a4729..6fdb445 100644 (file)
@@ -30,8 +30,6 @@
  * @package TYPO3
  * @subpackage form
  * @author Patrick Broens <patrick@patrickbroens.nl>
- * @license http://www.gnu.org/copyleft/gpl.html
- * @version $Id$
  */
 class tx_form_Domain_Repository_Content {
        /**
@@ -39,7 +37,7 @@ class tx_form_Domain_Repository_Content {
         *
         * Using the GET or POST variable 'P'
         *
-        * @return mixed|tx_form_Domain_Model_Content if found, FALSE if not
+        * @return boolean|tx_form_Domain_Model_Content if found, FALSE if not
         */
        public function getRecord() {
                $record = FALSE;
@@ -67,24 +65,16 @@ class tx_form_Domain_Repository_Content {
        /**
         * Check if the referenced record exists
         *
-        * @return TRUE if record exists, FALSE if not
+        * @return boolean TRUE if record exists, FALSE if not
         */
        public function hasRecord() {
-               $hasRecord = FALSE;
-
-               $record = $this->getRecord();
-
-               if ($record) {
-                       $hasRecord = TRUE;
-               }
-
-               return $hasRecord;
+               return ($this->getRecord() !== FALSE);
        }
 
        /**
         * Convert and save the incoming data of the FORM wizard
         *
-        * @return TRUE if succeeded, FALSE if not
+        * @return boolean TRUE if succeeded, FALSE if not
         */
        public function save() {
                $json = t3lib_div::_GP('configuration');
diff --git a/typo3/sysext/form/Classes/Exception/General.php b/typo3/sysext/form/Classes/Exception/General.php
deleted file mode 100644 (file)
index ac9d0f7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Patrick Broens <patrick@patrickbroens.nl>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-class tx_form_Exception_General extends Exception {
-
-       function __construct() {
-               parent::__construct('general error', 1000);
-       }
-
-       function _toString() {
-               return "tx_form_Exception_General at line {$this->getLine()} on {$this->getFile()} Message: {$this->getMessage()}";
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Exception/Loader.php b/typo3/sysext/form/Classes/Exception/Loader.php
deleted file mode 100644 (file)
index 8d404be..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Patrick Broens <patrick@patrickbroens.nl>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-class tx_form_Exception_Loader extends Exception {
-
-       function __construct() {
-               parent::__construct('file not found', 1100);
-       }
-
-       function _toString() {
-               return "tx_form_Exception_Loader at line {$this->getLine()} on {$this->getFile()} Message: {$this->getMessage()}";
-       }
-}
-?>
\ No newline at end of file
index 8666382..5d5fece 100644 (file)
@@ -39,14 +39,6 @@ class tx_form_System_Elementcounter implements t3lib_Singleton {
        protected $elementCounter = 1;
 
        /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
-       /**
         * Raise the element counter by one
         *
         * @return integer
index b225272..5f36b4c 100644 (file)
@@ -42,7 +42,6 @@ class tx_form_System_Filter_Alphabetic implements tx_form_System_Filter_Interfac
         * Constructor
         *
         * @param array $arguments Filter configuration
-        * @return void
         */
        public function __construct($arguments = array()) {
                $this->setAllowWhiteSpace($arguments['allowWhiteSpace']);
index 8b5819a..aa1ffc0 100644 (file)
@@ -42,7 +42,6 @@ class tx_form_System_Filter_Alphanumeric implements tx_form_System_Filter_Interf
         * Constructor
         *
         * @param array $arguments Filter configuration
-        * @return void
         */
        public function __construct($arguments = array()) {
                $this->setAllowWhiteSpace($arguments['allowWhiteSpace']);
index ea44497..8ab989e 100644 (file)
@@ -51,21 +51,20 @@ class tx_form_System_Filter_Currency implements tx_form_System_Filter_Interface
         * Constructor
         *
         * @param array $arguments Filter configuration
-        * @return void
         */
        public function __construct($arguments = array()) {
-               $this->setDecimalsPoint($arguments['decimalPoint'])
-                       ->setThousandSeparator($arguments['thousandSeparator']);
+               $this->setDecimalsPoint($arguments['decimalPoint']);
+               $this->setThousandSeparator($arguments['thousandSeparator']);
        }
 
        /**
         * Set the decimal point character
         *
         * @param string $decimalsPoint Character used for decimal point
-        * @return tx_form_Filter_Currency
+        * @return tx_form_System_Filter_Currency
         */
        public function setDecimalsPoint($decimalsPoint = '.') {
-               if(empty($decimalsPoint)) {
+               if (empty($decimalsPoint)) {
                        $this->decimalsPoint = '.';
                } else {
                        $this->decimalsPoint = (string) $decimalsPoint;
@@ -78,14 +77,14 @@ class tx_form_System_Filter_Currency implements tx_form_System_Filter_Interface
         * Set the thousand separator character
         *
         * @param string $thousandSeparator Character used for thousand separator
-        * @return tx_form_Filter_Currency
+        * @return tx_form_System_Filter_Currency
         */
        public function setThousandSeparator($thousandSeparator = ',') {
-               if(empty($thousandSeparator)) {
+               if (empty($thousandSeparator)) {
                        $this->thousandSeparator = ',';
-               } elseif($thousandSeparator === 'space') {
+               } elseif ($thousandSeparator === 'space') {
                        $this->thousandSeparator = ' ';
-               } elseif($thousandSeparator === 'none') {
+               } elseif ($thousandSeparator === 'none') {
                        $this->thousandSeparator = '';
                } else {
                        $this->thousandSeparator = (string) $thousandSeparator;
index 9a34da9..caae9df 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Digit implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
        /**
         * Return filtered value
         * Remove all but digits
index e5da46a..f32b9e4 100644 (file)
@@ -43,11 +43,8 @@ class tx_form_System_Filter implements tx_form_System_Filter_Interface {
         * Adds the removeXSS filter by default
         * Never remove these lines, otherwise the forms
         * will be vulnerable for XSS attacks
-        *
-        * @param array $arguments Filter configuration
-        * @return void
         */
-       public function __construct($arguments = array()) {
+       public function __construct() {
                $removeXssFilter = $this->makeFilter('removexss');
                $this->addFilter($removeXssFilter);
        }
@@ -55,12 +52,11 @@ class tx_form_System_Filter implements tx_form_System_Filter_Interface {
        /**
         * Add a filter object to the filter array
         *
-        * @param string $class Name of the filter
-        * @param mixed $value Typoscript configuration
-        * @return tx_form_Filter
+        * @param tx_form_System_Filter_Interface $filter The filter
+        * @return tx_form_System_Filter
         */
-       public function addFilter($filter) {
-               $this->filters[] = (object) $filter;
+       public function addFilter(tx_form_System_Filter_Interface $filter) {
+               $this->filters[] = $filter;
 
                return $this;
        }
@@ -71,26 +67,22 @@ class tx_form_System_Filter implements tx_form_System_Filter_Interface {
         *
         * @param string $class Name of the filter
         * @param array $arguments Configuration of the filter
-        * @return object The filter object
+        * @return tx_form_System_Filter_Interface The filter object
         */
-       public function makeFilter($class, $arguments = array()) {
-               $class = strtolower((string) $class);
-               $className = 'tx_form_System_Filter_' . ucfirst($class);
-
-               $filter = t3lib_div::makeInstance($className, $arguments);
-
-               return $filter;
+       public function makeFilter($class, array $arguments = NULL) {
+               return self::createFilter($class, $arguments);
        }
 
        /**
         * Go through all filters added to the array
         *
-        * @param  mixed $value
+        * @param mixed $value
         * @return mixed
         */
        public function filter($value) {
-               if(!empty($this->filters)) {
-                       foreach($this->filters as $filter) {
+               if (!empty($this->filters)) {
+                       /** @var $filter tx_form_System_Filter_Interface */
+                       foreach ($this->filters as $filter) {
                                $value = $filter->filter($value);
                        }
                }
@@ -100,19 +92,34 @@ class tx_form_System_Filter implements tx_form_System_Filter_Interface {
        /**
         * Call filter through this class with automatic instantiation of filter
         *
-        * @param $class
-        * @param $value
-        * @param $arguments
+        * @param string $class
+        * @param mixed $value
+        * @param array $arguments
         * @return mixed
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         */
        public static function get($class, $value, array $arguments = array()) {
+               return self::createFilter($class, $arguments)->filter($value);
+       }
+
+       /**
+        * Create a filter object according to class
+        * and sent some arguments
+        *
+        * @param string $class Name of the filter
+        * @param array $arguments Configuration of the filter
+        * @return tx_form_System_Filter_Interface The filter object
+        */
+       public static function createFilter($class, array $arguments = NULL) {
                $class = strtolower((string) $class);
                $className = 'tx_form_System_Filter_' . ucfirst($class);
 
-               $object = t3lib_div::makeInstance($className, $arguments);
+               if (is_null($arguments)) {
+                       $filter = t3lib_div::makeInstance($className);
+               } else {
+                       $filter = t3lib_div::makeInstance($className, $arguments);
+               }
 
-               return $object->filter($value);
+               return $filter;
        }
 }
 ?>
\ No newline at end of file
index 46ce09a..ef51049 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Integer implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
        /**
         * Cast to integer
         *
index a743745..0d5dc31 100644 (file)
@@ -34,7 +34,7 @@ interface tx_form_System_Filter_Interface {
        /**
         * Return filtered value
         *
-        * @param  mixed $value
+        * @param mixed $value
         * @return mixed
         */
        public function filter($value);
index 3394da7..c5cbb75 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Lowercase implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
        /**
         * Convert alphabetic characters to lowercase
         *
index df39e80..da9bc12 100644 (file)
@@ -42,9 +42,8 @@ class tx_form_System_Filter_Regexp implements tx_form_System_Filter_Interface {
         * Constructor
         *
         * @param array $arguments Filter configuration
-        * @return void
         */
-       public function __construct($arguments = array()) {
+       public function __construct(array $arguments = array()) {
                $this->setRegularExpression($arguments['expression']);
        }
 
index 4987365..e9118ea 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Removexss implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @param array $arguments Filter configuration
-        * @return void
-        */
-       public function __construct($arguments = array()) {
-       }
-
        /**
         * Return filtered value
         * Removes potential XSS code from the input string.
index ac950ee..964c139 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Stripnewlines implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
        /**
         * Strip newlines
         *
index 68b3e5c..0635090 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Titlecase implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
        /**
         * Convert alphabetic characters to title case
         *
index de47b82..43fa78d 100644 (file)
@@ -42,9 +42,8 @@ class tx_form_System_Filter_Trim implements tx_form_System_Filter_Interface {
         * Constructor
         *
         * @param array $arguments Filter configuration
-        * @return void
         */
-       public function __construct($arguments = array()) {
+       public function __construct(array $arguments = array()) {
                $this->setCharacterList($arguments['characterList']);
        }
 
index e1a5ef9..1241b33 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Filter_Uppercase implements tx_form_System_Filter_Interface {
-
-       /**
-        * Constructor
-        *
-        * @return void
-        */
-       public function __construct() {
-       }
-
        /**
         * Convert alphabetic characters to uppercase
         *
index 64e2ad6..7ba90ba 100644 (file)
@@ -42,9 +42,8 @@ class tx_form_System_Layout implements t3lib_Singleton {
         * Constructor
         *
         * @param $layout array Layout array from form configuration
-        * @return void
         */
-       public function __construct($layout = array()) {
+       public function __construct(array $layout = array()) {
                $this->setLayout($layout);
        }
 
@@ -54,15 +53,15 @@ class tx_form_System_Layout implements t3lib_Singleton {
         * otherwise it will look if there is a layout set in the form configuration
         * If both values are not assigned, take the default one
         *
-        * @param $elementName string Type of object
-        * @param $layoutDefault string The default layout of the object
-        * @param $layoutOverride string Assigned layout to this object
+        * @param string $elementName Type of object
+        * @param string $layoutDefault The default layout of the object
+        * @param string $layoutOverride Assigned layout to this object
         * @return string The new layout if changed
         */
        public function getLayoutByObject($elementName, $layoutDefault, $layoutOverride = '') {
-               if(!empty($layoutOverride)) {
+               if (!empty($layoutOverride)) {
                        $layout = $layoutOverride;
-               } elseif(!empty($this->layout[$elementName])) {
+               } elseif (!empty($this->layout[$elementName])) {
                        $layout = $this->layout[$elementName];
                } else {
                        $layout = $layoutDefault;
@@ -77,8 +76,8 @@ class tx_form_System_Layout implements t3lib_Singleton {
         * @param array $layout The layout array
         * @return tx_form_System_Layout
         */
-       public function setLayout($layout = array()) {
-               if(!empty($layout)) {
+       public function setLayout(array $layout = array()) {
+               if (!empty($layout)) {
                        $this->layout = $layout;
                }
 
diff --git a/typo3/sysext/form/Classes/System/Loader/Loader.php b/typo3/sysext/form/Classes/System/Loader/Loader.php
deleted file mode 100644 (file)
index c91132f..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Static methods for loading classes
- *
- * @author Patrick Broens <patrick@patrickbroens.nl>
- * @package TYPO3
- * @subpackage form
- */
-class tx_form_System_Loader {
-
-       /**
-        * Loads a file from a classname
-        * Underscores are converted to slashes for directories
-        *
-        * @param $class Classname
-        * @return $className
-        */
-       public static function loadClass($class, $directory) {
-               $class = strtolower((string) $class);
-               $directory = (string) $directory;
-
-               if(empty($class)) {
-                       $directoryForClassName = trim(strtolower($directory), '/');
-               } else {
-                       $directoryForClassName = strtolower($directory);
-               }
-               $className = 'tx_form_' . str_replace('/', '_', $directoryForClassName) . $class;
-
-               if (class_exists($className, FALSE)) {
-                       return $className;
-               }
-
-               $file = 'Classes/' . $directory . ucfirst($class) . '.php';
-               include_once(t3lib_extMgm::extPath('form') . $file);
-
-               if (!class_exists($className, FALSE)) {
-                       throw new tx_form_Exception_Loader ('File "' . $file . '" not found. Class "' . $className . '" does not exist.');
-               }
-
-               return $className;
-       }
-}
-?>
\ No newline at end of file
index df0d44a..c63e583 100644 (file)
@@ -41,8 +41,7 @@ class tx_form_System_Localization implements t3lib_Singleton {
        /**
         * Constructor
         *
-        * @param $localLanguageFile string File reference to the local language file
-        * @return void
+        * @param string $localLanguageFile File reference to the local language file
         */
        public function __construct($localLanguageFile) {
                $this->localLanguageFile = (string) $localLanguageFile;
@@ -51,7 +50,7 @@ class tx_form_System_Localization implements t3lib_Singleton {
        /**
         * Get a label from local language
         *
-        * @param $labelKey string Key to look for
+        * @param string $labelKey Key to look for
         * @return string
         */
        public function getLocalLanguageLabel($labelKey) {
index 17c77eb..109f724 100644 (file)
  * @subpackage form
  */
 class tx_form_System_Postprocessor_Mail {
+       /**
+        * @var tx_form_Domain_Model_Form
+        */
+       protected $form;
+
+       /**
+        * @var array
+        */
+       protected $typoScript;
+
+       /**
+        * @var t3lib_mail_Message
+        */
+       protected $mailMessage;
+
+       /**
+        * @var tx_form_System_Request
+        */
+       protected $requestHandler;
+
+       /**
+        * @var array
+        */
+       protected $dirtyHeaders = array();
 
        /**
         * Constructor
@@ -60,8 +84,11 @@ class tx_form_System_Postprocessor_Mail {
                $this->setCc();
                $this->setPriority();
                $this->setOrganization();
-               $this->setHtmlContent($htmlContent);
-               $this->setPlainContent($plainContent);
+
+               // @todo The whole content rendering seems to be missing here!
+
+               $this->setHtmlContent();
+               $this->setPlainContent();
                $this->addAttachments();
                $this->send();
 
@@ -178,7 +205,7 @@ class tx_form_System_Postprocessor_Mail {
        protected function setPriority() {
                $priority = 3;
                if ($this->typoScript['priority']) {
-                       $priority = t3lib_div::intInRange($valueList['priority'], 1, 5);
+                       $priority = t3lib_utility_Math::forceIntegerInRange($this->typoScript['priority'], 1, 5);
                }
                $this->mailMessage->setPriority($priority);
        }
@@ -226,6 +253,7 @@ class tx_form_System_Postprocessor_Mail {
         * @return void
         */
        protected function setHtmlContent() {
+               /** @var $view tx_form_View_Mail_Html */
                $view = t3lib_div::makeInstance(
                        'tx_form_View_Mail_Html',
                        $this->form,
@@ -243,6 +271,7 @@ class tx_form_System_Postprocessor_Mail {
         * @return void
         */
        protected function setPlainContent() {
+               /** @var $view tx_form_View_Mail_Plain */
                $view = t3lib_div::makeInstance(
                        'tx_form_View_Mail_Plain',
                        $this->form
@@ -252,17 +281,13 @@ class tx_form_System_Postprocessor_Mail {
        }
 
        /**
-        * Send the mail
-        *
+        * Sends the mail.
         * Sending the mail requires the recipient and message to be set.
         *
         * @return void
         */
        protected function send() {
-               if (
-                       $this->mailMessage->getTo() &&
-                       $this->mailMessage->getBody()
-               ) {
+               if ($this->mailMessage->getTo() && $this->mailMessage->getBody()) {
                        $this->mailMessage->send();
                }
        }
@@ -273,6 +298,7 @@ class tx_form_System_Postprocessor_Mail {
         * @return string HTML message from the mail view
         */
        protected function render() {
+               /** @var $view tx_form_View_Mail */
                $view = t3lib_div::makeInstance(
                        'tx_form_View_Mail',
                        $this->mailMessage,
@@ -306,6 +332,7 @@ class tx_form_System_Postprocessor_Mail {
                $formElements = $this->form->getElements();
                $values = $this->requestHandler->getByMethod();
 
+               /** @var $element tx_form_Domain_Model_Element_Abstract */
                foreach ($formElements as $element) {
                        if (is_a($element, 'tx_form_Domain_Model_Element_Fileupload')) {
                                $elementName = $element->getName();
index 4bfd402..930a157 100644 (file)
@@ -34,9 +34,8 @@ class tx_form_System_Postprocessor {
        /**
         * Constructor
         *
-        * @param $form tx_form_Domain_Model_Form Form domain model
-        * @param $typoscript array Post processor TypoScript settings
-        * @return void
+        * @param tx_form_Domain_Model_Form $form Form domain model
+        * @param array $typoScript Post processor TypoScript settings
         */
        public function __construct(tx_form_Domain_Model_Form $form, array $typoScript) {
                $this->form = $form;
@@ -56,14 +55,16 @@ class tx_form_System_Postprocessor {
 
                if (is_array($this->typoScript)) {
                        $keys = t3lib_TStemplate::sortedKeyList($this->typoScript);
-                       foreach ($keys as $key) {
+                       foreach ($keys as $key) {
+                               if (!intval($key) || strpos($key, '.') !== FALSE) {
+                                       continue;
+                               }
+
                                $className = 'tx_form_System_Postprocessor_' . ucfirst(strtolower($this->typoScript[$key]));
-                               if (intval($key) && !strstr($key, '.')) {
-                                       if(isset($this->typoScript[$key . '.'])) {
-                                               $processorArguments = $this->typoScript[$key . '.'];
-                                       } else {
-                                               $processorArguments = array();
-                                       }
+                               $processorArguments = array();
+
+                               if (isset($this->typoScript[$key . '.'])) {
+                                       $processorArguments = $this->typoScript[$key . '.'];
                                }
 
                                if (class_exists($className, TRUE)) {
index e3e8a1c..952291f 100644 (file)
@@ -57,16 +57,6 @@ class tx_form_System_Request implements t3lib_Singleton {
        protected $sessionData = array();
 
        /**
-        * Constructor
-        *
-        * @param string $prefix Proposal for prefix
-        * @param string $method The used method
-        * @return void
-        */
-       public function __construct() {
-       }
-
-       /**
         * Set the prefix used in the form
         * If prefix is available in configuration array of the object, it will take it from there.
         * Otherwise if not given at all, it will set it to default
@@ -75,11 +65,11 @@ class tx_form_System_Request implements t3lib_Singleton {
         * @return void
         */
        public function setPrefix($prefix = 'tx_form') {
-               if(empty($prefix)) {
+               if (empty($prefix)) {
                        $prefix = 'tx_form';
                }
 
-               $prefix = preg_replace('/\s/' , '_', (string) $prefix);
+               $prefix = preg_replace('/\s/', '_', (string) $prefix);
                $this->prefix = preg_replace('/[^a-zA-Z0-9_\-]/', '', $prefix);
        }
 
@@ -118,7 +108,7 @@ class tx_form_System_Request implements t3lib_Singleton {
                        $method = 'session';
                }
 
-               if(!in_array($method, $allowedMethods)) {
+               if (!in_array($method, $allowedMethods)) {
                        $method = 'post';
                }
 
@@ -202,7 +192,7 @@ class tx_form_System_Request implements t3lib_Singleton {
         * @return mixed Returns NULL if key does not exist
         */
        public function getQuery($key = NULL, $default = NULL) {
-               if($key === NULL) {
+               if ($key === NULL) {
                        return $_GET[$this->prefix];
                }
                return (isset($_GET[$this->prefix][$key])) ? $_GET[$this->prefix][$key] : $default;
@@ -218,7 +208,7 @@ class tx_form_System_Request implements t3lib_Singleton {
         * @return mixed Returns NULL if key does not exist
         */
        public function getPost($key = NULL, $default = NULL) {
-               if($key === NULL) {
+               if ($key === NULL) {
                        return $_POST[$this->prefix];
                }
                return (isset($_POST[$this->prefix][$key])) ? $_POST[$this->prefix][$key] : $default;
@@ -234,7 +224,7 @@ class tx_form_System_Request implements t3lib_Singleton {
         * @return mixed Returns NULL if key does not exist
         */
        public function getSession($key = NULL, $default = NULL) {
-               if($key === NULL) {
+               if ($key === NULL) {
                        return $this->sessionData;
                }
                return (isset($this->sessionData[$key])) ? $this->sessionData[$key] : $default;
@@ -251,11 +241,11 @@ class tx_form_System_Request implements t3lib_Singleton {
         * @return mixed The member, or FALSE when wrong method is used
         */
        public function getByMethod($key = NULL, $default = NULL) {
-               if($this->method === 'get') {
+               if ($this->method === 'get') {
                        return $this->getQuery($key, $default);
-               } elseif($this->method === 'post') {
+               } elseif ($this->method === 'post') {
                        return $this->getPost($key, $default);
-               } elseif($this->method === 'session') {
+               } elseif ($this->method === 'session') {
                        return $this->getSession($key, $default);
                } else {
                        return FALSE;
@@ -315,7 +305,7 @@ class tx_form_System_Request implements t3lib_Singleton {
                $formData = $this->getByMethod();
 
                if (isset($_FILES[$this->prefix]) && is_array($_FILES[$this->prefix])) {
-                       foreach($_FILES[$this->prefix]['tmp_name'] as $fieldName => $uploadedFile) {
+                       foreach ($_FILES[$this->prefix]['tmp_name'] as $fieldName => $uploadedFile) {
                                if (is_uploaded_file($uploadedFile)) {
                                        $tempFilename = t3lib_div::upload_to_tempfile($uploadedFile);
 
index 7b91aa7..3eaf010 100644 (file)
@@ -68,14 +68,14 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
        /**
         * Localization handler object
         *
-        * @var tx_form_Localizationhandler
+        * @var tx_form_System_Localization
         */
        protected $localizationHandler;
 
        /**
         * Request handler object
         *
-        * @var tx_form_Requesthandler
+        * @var tx_form_System_Request
         */
        protected $requestHandler;
 
@@ -156,7 +156,7 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
         * @return void
         */
        public function setMessage($message = '', $type = 'TEXT') {
-               if(empty($message)) {
+               if (empty($message)) {
                        if (!empty($type)) {
                                $message = $type;
                                $type = 'TEXT';
@@ -165,7 +165,7 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
                                $message = $this->getLocalLanguageLabel('message');
                        }
                        $value['value'] = $this->substituteValues($message);
-               } elseif(!is_array($message)) {
+               } elseif (!is_array($message)) {
                        $value['value'] = $this->substituteValues($message);
                } else {
                        $value = $message;
@@ -184,12 +184,12 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
         * When both are filled, it's supposed to be a cObj made by the administrator
         * In the last case, no markers will be substituted
         *
-        * @param mixed $message Message as string or TS
+        * @param mixed $error Message as string or TS
         * @param string $type Name of the cObj
         * @return void
         */
        public function setError($error = '', $type = 'TEXT') {
-               if(empty($error)) {
+               if (empty($error)) {
                        if (!empty($type)) {
                                $error = $type;
                                $type = 'TEXT';
@@ -198,7 +198,7 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
                                $error = $this->getLocalLanguageLabel('error');
                        }
                        $value['value'] = $this->substituteValues($error);
-               } elseif(!is_array($error)) {
+               } elseif (!is_array($error)) {
                        $value['value'] = $this->substituteValues($error);
                } else {
                        $value = $error;
@@ -215,7 +215,7 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
         * @return object The rule object
         */
        public function setShowMessage($show) {
-               if($show === NULL) {
+               if ($show === NULL) {
                        $this->showMessage = TRUE;
                } else {
                        $this->showMessage = (boolean) $show;
@@ -248,10 +248,11 @@ abstract class tx_form_System_Validate_Abstract implements tx_form_System_Valida
         * Get the local language label(s) for the message
         * In some cases this method will be override by rule class
         *
+        * @param string $type The type
         * @return string The local language message label
         */
        protected function getLocalLanguageLabel($type) {
-               $label = get_class($this) . '.' . $type;
+               $label = strtolower(get_class($this)) . '.' . $type;
                $message = $this->localizationHandler->getLocalLanguageLabel($label);
                return $message;
        }
index b4a0ad3..efedd92 100644 (file)
@@ -61,11 +61,10 @@ class tx_form_System_Validate_Alphabetic extends tx_form_System_Validate_Abstrac
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        if ($this->filter === NULL) {
                                $className = 'tx_form_System_Filter_Alphabetic';
@@ -88,7 +87,7 @@ class tx_form_System_Validate_Alphabetic extends tx_form_System_Validate_Abstrac
         * @return object Rule object
         */
        public function setAllowWhiteSpace($allowWhiteSpace) {
-               if($allowWhiteSpace === NULL) {
+               if ($allowWhiteSpace === NULL) {
                        $this->allowWhiteSpace = FALSE;
                } else {
                        $this->allowWhiteSpace = (boolean) $allowWhiteSpace;
@@ -102,14 +101,13 @@ class tx_form_System_Validate_Alphabetic extends tx_form_System_Validate_Abstrac
         * Overrides the abstract
         *
         * @return string The local language message label
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Abstract::_getLocalLanguageLabel()
         */
        protected function getLocalLanguageLabel() {
-               $label = get_class($this) . '.message';
+               $label = strtolower(get_class($this)) . '.message';
                $messages[] = $this->localizationHandler->getLocalLanguageLabel($label);
 
-               if($this->allowWhiteSpace) {
+               if ($this->allowWhiteSpace) {
                        $messages[] = $this->localizationHandler->getLocalLanguageLabel($label . '2');
                }
 
index 07b9bc5..8a05c3d 100644 (file)
@@ -54,11 +54,10 @@ class tx_form_System_Validate_Alphanumeric extends tx_form_System_Validate_Abstr
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        if ($this->filter === NULL) {
                                $className = 'tx_form_System_Filter_Alphanumeric';
@@ -81,7 +80,7 @@ class tx_form_System_Validate_Alphanumeric extends tx_form_System_Validate_Abstr
         * @return object Rule object
         */
        public function setAllowWhiteSpace($allowWhiteSpace) {
-               if($allowWhiteSpace === NULL) {
+               if ($allowWhiteSpace === NULL) {
                        $this->allowWhiteSpace = FALSE;
                } else {
                        $this->allowWhiteSpace = (boolean) $allowWhiteSpace;
@@ -95,14 +94,13 @@ class tx_form_System_Validate_Alphanumeric extends tx_form_System_Validate_Abstr
         * Overrides the abstract
         *
         * @return string The local language message label
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Abstract::_getLocalLanguageLabel()
         */
        protected function getLocalLanguageLabel() {
-               $label = get_class($this) . '.message';
+               $label = strtolower(get_class($this)) . '.message';
                $messages[] = $this->localizationHandler->getLocalLanguageLabel($label);
 
-               if($this->allowWhiteSpace) {
+               if ($this->allowWhiteSpace) {
                        $messages[] = $this->localizationHandler->getLocalLanguageLabel($label . '2');
                }
 
index 534c611..afca4e9 100644 (file)
@@ -71,18 +71,17 @@ class tx_form_System_Validate_Between extends tx_form_System_Validate_Abstract i
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
-                       if($this->inclusive) {
-                               if($value < $this->minimum || $value > $this->maximum) {
+                       if ($this->inclusive) {
+                               if ($value < $this->minimum || $value > $this->maximum) {
                                        return FALSE;
                                }
                        } else {
-                               if($value <= $this->minimum || $value >= $this->maximum) {
+                               if ($value <= $this->minimum || $value >= $this->maximum) {
                                        return FALSE;
                                }
                        }
@@ -121,7 +120,7 @@ class tx_form_System_Validate_Between extends tx_form_System_Validate_Abstract i
         * @return object Rule object
         */
        public function setInclusive($inclusive) {
-               if($inclusive === NULL) {
+               if ($inclusive === NULL) {
                        $this->inclusive = FALSE;
                } else {
                        $this->inclusive = (boolean) $inclusive;
@@ -134,15 +133,15 @@ class tx_form_System_Validate_Between extends tx_form_System_Validate_Abstract i
         * Get the local language label(s) for the message
         * Overrides the abstract
         *
+        * @param string $type The type
         * @return string The local language message label
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Abstract::_getLocalLanguageLabel()
         */
        protected function getLocalLanguageLabel($type) {
-               $label = get_class($this) . '.' . $type;
+               $label = strtolower(get_class($this)) . '.' . $type;
                $messages[] = $this->localizationHandler->getLocalLanguageLabel($label);
 
-               if($this->inclusive) {
+               if ($this->inclusive) {
                        $messages[] = $this->localizationHandler->getLocalLanguageLabel($label . '2');
                }
 
index 02a19b7..532824c 100644 (file)
@@ -54,11 +54,10 @@ class tx_form_System_Validate_Date extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
 
                        $parsedDate = strptime($value, $this->format);
@@ -79,7 +78,7 @@ class tx_form_System_Validate_Date extends tx_form_System_Validate_Abstract {
         * @return Rule object
         */
        public function setFormat($format) {
-               if($format === NULL) {
+               if ($format === NULL) {
                        $this->format = '%e-%m-%Y';
                } else {
                        $this->format = (string) $format;
@@ -133,92 +132,4 @@ class tx_form_System_Validate_Date extends tx_form_System_Validate_Abstract {
                return $humanReadableFormat;
        }
 }
-
-/**
- * Replacement for strptime
- *
- * The function strptime does not exist on PHP < 5.1.0RC1 and Windows
- * This function tries to do the same
- *
- * @param string $value Date input from user
- * @param string $format strftime format
- * @return array strptime formatted date
- * @author Patrick Broens <patrick@patrickbroens.nl>
- * @see http://php.net/manual/en/function.strptime.php
- */
-if(!function_exists('strptime')) {
-       function strptime($value, $format) {
-               static $expand = array(
-                       '%D' => '%m/%d/%y',
-                       '%T' => '%H:%M:%S',
-               );
-
-               static $mapConversionSpecifiers = array(
-                       '%S'=>'tm_sec',
-                       '%M'=>'tm_min',
-                       '%H'=>'tm_hour',
-                       '%d'=>'tm_mday',
-                       '%e'=>'tm_mday',
-                       '%m'=>'tm_mon',
-                       '%Y'=>'tm_year',
-                       '%y'=>'tm_year',
-                       '%W'=>'tm_wday',
-                       '%D'=>'tm_yday',
-                       '%u'=>'unparsed',
-               );
-
-               static $names = array(
-                       'Jan' => 1,
-                       'Feb' => 2,
-                       'Mar' => 3,
-                       'Apr' => 4,
-                       'May' => 5,
-                       'Jun' => 6,
-                       'Jul' => 7,
-                       'Aug' => 8,
-                       'Sep' => 9,
-                       'Oct' => 10,
-                       'Nov' => 11,
-                       'Dec' => 12,
-                       'Sun' => 0,
-                       'Mon' => 1,
-                       'Tue' => 2,
-                       'Wed' => 3,
-                       'Thu' => 4,
-                       'Fri' => 5,
-                       'Sat' => 6,
-               );
-
-               $format = str_replace(array_keys($expand), array_values($expand), $format);
-               $preg = preg_replace('/(%\w)/', '(\w+)', preg_quote($format));
-               preg_match_all('/(%\w)/', $format, $positions);
-               $positions = $positions[1];
-
-               if(preg_match("#$preg#", "$value", $extracted)) {
-                       foreach($positions as $position => $conversionSpecifier) {
-                               $extractedNumber = $extracted[$position + 1];
-                               if($parameter = $mapConversionSpecifiers[$conversionSpecifier]) {
-                                       $strptimeValue[$parameter] = ($extractedNumber > 0) ? (int) $extractedNumber : $extractedNumber;
-                               } else {
-                                       $strptimeValue['unparsed'] .= $extractedNumber . ' ';
-                               }
-                       }
-
-                       $strptimeValue['tm_wday'] = $names[substr($strptimeValue['tm_wday'], 0, 3)];
-
-                       if($strptimeValue['tm_year'] >= 1900) {
-                               $strptimeValue['tm_year'] -= 1900;
-                       } elseif($strptimeValue['tm_year'] > 0) {
-                               $strptimeValue['tm_year'] += 100;
-                       }
-
-                       if ($strptimeValue['tm_mon']) {
-                               $strptimeValue['tm_mon'] -= 1;
-                       } else {
-                               $strptimeValue['tm_mon'] = $names[substr($strptimeValue['tm_mon'], 0, 3)] - 1;
-                       }
-               }
-               return isset($strptimeValue) ? $strptimeValue : FALSE;
-       }
-}
 ?>
\ No newline at end of file
index 9c90bbb..806843a 100644 (file)
@@ -45,11 +45,10 @@ class tx_form_System_Validate_Digit extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        if ($this->filter === NULL) {
                                $className = 'tx_form_System_Filter_Digit';
index 7bc0345..c4e6f5e 100644 (file)
@@ -45,14 +45,13 @@ class tx_form_System_Validate_Email extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
 
-                       if(!preg_match('/^(?:(?#local-part)(?#quoted)"[^\"]*"|(?#non-quoted)[a-z0-9&+_-](?:\.?[a-z0-9&+_-]+)*)@(?:(?#domain)(?#domain-name)[a-z0-9](?:[a-z0-9-]*[a-z0-9])*(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])*)*|(?#ip)(\[)?(?:[01]?\d?\d|2[0-4]\d|25[0-5])(?:\.(?:[01]?\d?\d|2[0-4]\d|25[0-5])){3}(?(1)\]|))$/', $value)) {
+                       if (!preg_match('/^(?:(?#local-part)(?#quoted)"[^\"]*"|(?#non-quoted)[a-z0-9&+_-](?:\.?[a-z0-9&+_-]+)*)@(?:(?#domain)(?#domain-name)[a-z0-9](?:[a-z0-9-]*[a-z0-9])*(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])*)*|(?#ip)(\[)?(?:[01]?\d?\d|2[0-4]\d|25[0-5])(?:\.(?:[01]?\d?\d|2[0-4]\d|25[0-5])){3}(?(1)\]|))$/', $value)) {
                                return FALSE;
                        }
                }
index f4a4e6a..661eb61 100644 (file)
@@ -54,18 +54,17 @@ class tx_form_System_Validate_Equals extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
-                       if(!$this->requestHandler->has($this->field)) {
+               if ($this->requestHandler->has($this->fieldName)) {
+                       if (!$this->requestHandler->has($this->field)) {
                                return FALSE;
                        } else {
                                $value = $this->requestHandler->getByMethod($this->fieldName);
                                $comparisonValue = $this->requestHandler->getByMethod($this->field);
 
-                               if($value !== $comparisonValue) {
+                               if ($value !== $comparisonValue) {
                                        return FALSE;
                                }
                        }
index 80e0e10..f972373 100644 (file)
@@ -55,15 +55,14 @@ class tx_form_System_Validate_Fileallowedtypes extends tx_form_System_Validate_A
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $fileValue = $this->requestHandler->getByMethod($this->fieldName);
                        $value = strtolower($fileValue['type']);
 
-                       if(!in_array($value, $this->allowedTypes)) {
+                       if (!in_array($value, $this->allowedTypes)) {
                                return FALSE;
                        }
                }
index d063049..66612cb 100644 (file)
@@ -55,15 +55,14 @@ class tx_form_System_Validate_Filemaximumsize extends tx_form_System_Validate_Ab
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $fileValue = $this->requestHandler->getByMethod($this->fieldName);
                        $value = $fileValue['size'];
 
-                       if($value > $this->maximum) {
+                       if ($value > $this->maximum) {
                                return FALSE;
                        }
                }
index d2f93bf..e3d58df 100644 (file)
@@ -55,15 +55,14 @@ class tx_form_System_Validate_Fileminimumsize extends tx_form_System_Validate_Ab
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $fileValue = $this->requestHandler->getByMethod($this->fieldName);
                        $value = $fileValue['size'];
 
-                       if($value < $this->minimum) {
+                       if ($value < $this->minimum) {
                                return FALSE;
                        }
                }
index 9982728..77135da 100644 (file)
@@ -45,11 +45,10 @@ class tx_form_System_Validate_Float extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
 
                        $locale = localeconv();
@@ -59,7 +58,7 @@ class tx_form_System_Validate_Float extends tx_form_System_Validate_Abstract {
                        $valueFiltered = str_replace($locale['decimal_point'], '.', $valueFiltered);
                        $valueFiltered = str_replace($locale['mon_decimal_point'], '.', $valueFiltered);
 
-                       if($valueFiltered != strval(floatval($valueFiltered))) {
+                       if ($valueFiltered != strval(floatval($valueFiltered))) {
                                return FALSE;
                        }
                }
index 9aca661..b61f218 100644 (file)
@@ -54,13 +54,12 @@ class tx_form_System_Validate_Greaterthan extends tx_form_System_Validate_Abstra
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = (integer) $this->requestHandler->getByMethod($this->fieldName);
-                       if($value <= $this->minimum) {
+                       if ($value <= $this->minimum) {
                                return FALSE;
                        }
                }
index 3faa5c9..a79546d 100644 (file)
@@ -62,14 +62,13 @@ class tx_form_System_Validate_Inarray extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
 
-                       if(!in_array($value, $this->array, $this->strict)) {
+                       if (!in_array($value, $this->array, $this->strict)) {
                                return FALSE;
                        }
                }
index 248a484..0a43742 100644 (file)
@@ -45,11 +45,10 @@ class tx_form_System_Validate_Integer extends tx_form_System_Validate_Abstract {
         * Returns TRUE if submitted value validates according to rule
         *
         * @return boolean
-        * @author Patrick Broens <patrick@patrickbroens.nl>
         * @see tx_form_System_Validate_Interface::isValid()
         */
        public function isValid() {
-               if($this->requestHandler->has($this->fieldName)) {
+               if ($this->requestHandler->has($this->fieldName)) {
                     &nb