diff --git a/libs/HTML/QuickForm2.php b/libs/HTML/QuickForm2.php
index 787b6001bdc97ab45d88d9087f2cfd2dda13b691..48d10de076084b5528901a9b4a390988228c68e2 100644
--- a/libs/HTML/QuickForm2.php
+++ b/libs/HTML/QuickForm2.php
@@ -46,12 +46,12 @@
 /**
  * Abstract base class for QuickForm2 containers
  */
-require_once 'HTML/QuickForm2/Container.php';
+// require_once 'HTML/QuickForm2/Container.php';
 
 /**
  * Data source for HTML_QuickForm2 objects based on superglobal arrays
  */
-require_once 'HTML/QuickForm2/DataSource/SuperGlobal.php';
+// require_once 'HTML/QuickForm2/DataSource/SuperGlobal.php';
 
 /**
  * Class representing a HTML form
diff --git a/libs/HTML/QuickForm2/Container.php b/libs/HTML/QuickForm2/Container.php
index b62a435f0628d95a35423c2bd03ba6b6f97e1688..e96a4ff12bbd19a76641091d89871780e45b9d62 100644
--- a/libs/HTML/QuickForm2/Container.php
+++ b/libs/HTML/QuickForm2/Container.php
@@ -46,7 +46,7 @@
 /**
  * Base class for all HTML_QuickForm2 elements
  */
-require_once 'HTML/QuickForm2/Node.php';
+// require_once 'HTML/QuickForm2/Node.php';
 
 /**
  * Abstract base class for simple QuickForm2 containers
@@ -433,7 +433,7 @@ abstract class HTML_QuickForm2_Container extends HTML_QuickForm2_Node
 
     public function __toString()
     {
-        require_once 'HTML/QuickForm2/Renderer.php';
+        // require_once 'HTML/QuickForm2/Renderer.php';
 
         return $this->render(HTML_QuickForm2_Renderer::factory('default'))->__toString();
     }
@@ -484,4 +484,4 @@ class HTML_QuickForm2_ContainerIterator extends RecursiveArrayIterator implement
     }
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Container/Fieldset.php b/libs/HTML/QuickForm2/Container/Fieldset.php
index bf362431c8fb987f2edf094894be0e08d628f085..7b6b9c982c44cf9b04471a748f06ce41df467c47 100644
--- a/libs/HTML/QuickForm2/Container/Fieldset.php
+++ b/libs/HTML/QuickForm2/Container/Fieldset.php
@@ -46,7 +46,7 @@
 /**
  * Base class for fieldsets
  */
-require_once 'HTML/QuickForm2/Container.php';
+// require_once 'HTML/QuickForm2/Container.php';
 
 /**
  * Concrete implementation of a container for fieldsets
@@ -89,4 +89,4 @@ class HTML_QuickForm2_Container_Fieldset extends HTML_QuickForm2_Container
         throw new HTML_QuickForm2_Exception('Not implemented');
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Container/Group.php b/libs/HTML/QuickForm2/Container/Group.php
index 4ef7b1b55228827d052535ba0abb72f5971dee85..970ff8fcb9516124f080c1476497ddaf69ca7450 100644
--- a/libs/HTML/QuickForm2/Container/Group.php
+++ b/libs/HTML/QuickForm2/Container/Group.php
@@ -46,7 +46,7 @@
 /**
  * Base class for all HTML_QuickForm2 containers
  */
-require_once 'HTML/QuickForm2/Container.php';
+// require_once 'HTML/QuickForm2/Container.php';
 
 /**
  * Base class for QuickForm2 groups of elements
@@ -317,7 +317,7 @@ class HTML_QuickForm2_Container_Group extends HTML_QuickForm2_Container
 
     public function __toString()
     {
-        require_once 'HTML/QuickForm2/Renderer.php';
+        // require_once 'HTML/QuickForm2/Renderer.php';
 
         return $this->render(
                    HTML_QuickForm2_Renderer::factory('default')
@@ -325,4 +325,4 @@ class HTML_QuickForm2_Container_Group extends HTML_QuickForm2_Container
                )->__toString();
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Controller.php b/libs/HTML/QuickForm2/Controller.php
index d2aa144fdcbebe1622dfb6afbb8eae9a76a16da4..440d1005a2a04271f36fce17bcbc14dde542786a 100644
--- a/libs/HTML/QuickForm2/Controller.php
+++ b/libs/HTML/QuickForm2/Controller.php
@@ -44,13 +44,13 @@
  */
 
 /** The class representing a page of a multipage form */
-require_once 'HTML/QuickForm2/Controller/Page.php';
+// require_once 'HTML/QuickForm2/Controller/Page.php';
 
 /** Object wrapping around session variable used to store controller data */
-require_once 'HTML/QuickForm2/Controller/SessionContainer.php';
+// require_once 'HTML/QuickForm2/Controller/SessionContainer.php';
 
 /** Class presenting the values stored in session by Controller as submitted ones */
-require_once 'HTML/QuickForm2/DataSource/Session.php';
+// require_once 'HTML/QuickForm2/DataSource/Session.php';
 
 /**
  * Class implementing the Page Controller pattern for multipage forms
@@ -295,7 +295,9 @@ class HTML_QuickForm2_Controller implements IteratorAggregate
             && in_array($actionName, array('next', 'back', 'submit', 'display', 'jump'))
         ) {
             $className = 'HTML_QuickForm2_Controller_Action_' . ucfirst($actionName);
-            HTML_QuickForm2_Loader::loadClass($className);
+            if (!class_exists($className)) {
+                HTML_QuickForm2_Loader::loadClass($className);
+            }
             $this->addHandler($actionName, new $className());
         }
         if (isset($this->handlers[$actionName])) {
@@ -503,4 +505,4 @@ class HTML_QuickForm2_Controller implements IteratorAggregate
         return new ArrayIterator($this->pages);
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Controller/Action/Back.php b/libs/HTML/QuickForm2/Controller/Action/Back.php
index 1e591b4a42cd3aa70512036d2c1c62975f3fa7f3..08ae890cbe3851621f32753f21d7930930c0dd45 100644
--- a/libs/HTML/QuickForm2/Controller/Action/Back.php
+++ b/libs/HTML/QuickForm2/Controller/Action/Back.php
@@ -44,7 +44,7 @@
  */
 
 /** Interface for Controller action handlers */
-require_once 'HTML/QuickForm2/Controller/Action.php';
+// require_once 'HTML/QuickForm2/Controller/Action.php';
 
 /**
  * Action handler for a 'back' button of wizard-type multipage form
diff --git a/libs/HTML/QuickForm2/Controller/Action/Direct.php b/libs/HTML/QuickForm2/Controller/Action/Direct.php
index 1c760a04325821ca6d2e87331574e571166bb3aa..0a96a9da422ec306135c33a6f4281f72ab9caaed 100644
--- a/libs/HTML/QuickForm2/Controller/Action/Direct.php
+++ b/libs/HTML/QuickForm2/Controller/Action/Direct.php
@@ -44,7 +44,7 @@
  */
 
 /** Interface for Controller action handlers */
-require_once 'HTML/QuickForm2/Controller/Action.php';
+// require_once 'HTML/QuickForm2/Controller/Action.php';
 
 /**
  * Action handler for going to a specific page of a multipage form
diff --git a/libs/HTML/QuickForm2/Controller/Action/Display.php b/libs/HTML/QuickForm2/Controller/Action/Display.php
index dc75a8dfe109204b1c4d35d970a727984a44a5b3..dd57aec83bdde1cdb22df0ef55d3ed5af962e68e 100644
--- a/libs/HTML/QuickForm2/Controller/Action/Display.php
+++ b/libs/HTML/QuickForm2/Controller/Action/Display.php
@@ -44,10 +44,10 @@
  */
 
 /** Interface for Controller action handlers */
-require_once 'HTML/QuickForm2/Controller/Action.php';
+// require_once 'HTML/QuickForm2/Controller/Action.php';
 
 /** Class presenting the values stored in session by Controller as submitted ones */
-require_once 'HTML/QuickForm2/DataSource/Session.php';
+// require_once 'HTML/QuickForm2/DataSource/Session.php';
 
 /**
  * Action handler for outputting the form
diff --git a/libs/HTML/QuickForm2/Controller/Action/Jump.php b/libs/HTML/QuickForm2/Controller/Action/Jump.php
index 4e29492f8354c6f722ed63ae41a2a5e27317603e..ecb8924e16c6727e414ff7a2d23d7d9114f8b5ce 100644
--- a/libs/HTML/QuickForm2/Controller/Action/Jump.php
+++ b/libs/HTML/QuickForm2/Controller/Action/Jump.php
@@ -44,7 +44,7 @@
  */
 
 /** Interface for Controller action handlers */
-require_once 'HTML/QuickForm2/Controller/Action.php';
+// require_once 'HTML/QuickForm2/Controller/Action.php';
 
 /**
  * This handler performs an HTTP redirect to a specific page
diff --git a/libs/HTML/QuickForm2/Controller/Action/Next.php b/libs/HTML/QuickForm2/Controller/Action/Next.php
index b01b9c641324f0554cf155ef629710301665ffab..41769427a6bc9113e8cae4ff4c59fed38f461f4d 100644
--- a/libs/HTML/QuickForm2/Controller/Action/Next.php
+++ b/libs/HTML/QuickForm2/Controller/Action/Next.php
@@ -44,7 +44,7 @@
  */
 
 /** Interface for Controller action handlers */
-require_once 'HTML/QuickForm2/Controller/Action.php';
+// require_once 'HTML/QuickForm2/Controller/Action.php';
 
 /**
  * Action handler for a 'next' button of wizard-type multipage form
diff --git a/libs/HTML/QuickForm2/Controller/Action/Submit.php b/libs/HTML/QuickForm2/Controller/Action/Submit.php
index 67fb436240d842bc6e0b36f86d3ad71014e3c3ab..db821a9b3d71fa769fa0079c49b6dc61bb8d2420 100644
--- a/libs/HTML/QuickForm2/Controller/Action/Submit.php
+++ b/libs/HTML/QuickForm2/Controller/Action/Submit.php
@@ -44,7 +44,7 @@
  */
 
 /** Interface for Controller action handlers */
-require_once 'HTML/QuickForm2/Controller/Action.php';
+// require_once 'HTML/QuickForm2/Controller/Action.php';
 
 /**
  * Action handler for a 'submit' button
diff --git a/libs/HTML/QuickForm2/Controller/DefaultAction.php b/libs/HTML/QuickForm2/Controller/DefaultAction.php
index d88a07a47b83621bffb33fe83c1c21b64306791f..37d1bc43cc78425e82eb6d6fa0a7797ca1623546 100644
--- a/libs/HTML/QuickForm2/Controller/DefaultAction.php
+++ b/libs/HTML/QuickForm2/Controller/DefaultAction.php
@@ -44,7 +44,7 @@
  */
 
 /** Class for <input type="image" /> elements */
-require_once 'HTML/QuickForm2/Element/InputImage.php';
+// require_once 'HTML/QuickForm2/Element/InputImage.php';
 
 /**
  * A hidden button used to submit the form when the user presses Enter
diff --git a/libs/HTML/QuickForm2/Controller/Page.php b/libs/HTML/QuickForm2/Controller/Page.php
index 1d639161d635bf93173a3bcbe13d2d6108520a1a..83564d0bee4dc3b4183b2a0e7e8bbd6c5e32ff82 100644
--- a/libs/HTML/QuickForm2/Controller/Page.php
+++ b/libs/HTML/QuickForm2/Controller/Page.php
@@ -180,7 +180,7 @@ abstract class HTML_QuickForm2_Controller_Page
     */
     public function setDefaultAction($actionName, $imageSrc = '')
     {
-        require_once 'HTML/QuickForm2/Controller/DefaultAction.php';
+        // require_once 'HTML/QuickForm2/Controller/DefaultAction.php';
 
         if (0 == count($this->form)) {
             $image = $this->form->appendChild(
@@ -255,4 +255,4 @@ abstract class HTML_QuickForm2_Controller_Page
         return $container->getValidationStatus($id);
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/DataSource/Array.php b/libs/HTML/QuickForm2/DataSource/Array.php
index 8bb2a2959e73aa88802a94da6c5268e627842203..ff05a103188883e25a61d63058e3bcd7d602262e 100644
--- a/libs/HTML/QuickForm2/DataSource/Array.php
+++ b/libs/HTML/QuickForm2/DataSource/Array.php
@@ -46,7 +46,7 @@
 /**
  * Interface for data sources used by HTML_QuickForm2 objects
  */
-require_once 'HTML/QuickForm2/DataSource.php';
+// require_once 'HTML/QuickForm2/DataSource.php';
 
 /**
  * Array-based data source for HTML_QuickForm2 objects
diff --git a/libs/HTML/QuickForm2/DataSource/Session.php b/libs/HTML/QuickForm2/DataSource/Session.php
index e4634557afdf7d15054bff588ca86242f917088e..d39738afeca2b08440b007f67ac2d082ef1bdf54 100644
--- a/libs/HTML/QuickForm2/DataSource/Session.php
+++ b/libs/HTML/QuickForm2/DataSource/Session.php
@@ -44,10 +44,10 @@
  */
 
 /** Interface for data sources containing submitted values */
-require_once 'HTML/QuickForm2/DataSource/Submit.php';
+// require_once 'HTML/QuickForm2/DataSource/Submit.php';
 
 /** Array-based data source for HTML_QuickForm2 objects */
-require_once 'HTML/QuickForm2/DataSource/Array.php';
+// require_once 'HTML/QuickForm2/DataSource/Array.php';
 
 /**
  * Class presenting the values stored in session by Controller as submitted ones
diff --git a/libs/HTML/QuickForm2/DataSource/Submit.php b/libs/HTML/QuickForm2/DataSource/Submit.php
index fa9f6d3648678d59802773ec79998a358c342d2f..9003c032d5ac29648247e19682ea698c1f7e76ca 100644
--- a/libs/HTML/QuickForm2/DataSource/Submit.php
+++ b/libs/HTML/QuickForm2/DataSource/Submit.php
@@ -46,7 +46,7 @@
 /**
  * Interface for data sources used by HTML_QuickForm2 objects
  */
-require_once 'HTML/QuickForm2/DataSource.php';
+// require_once 'HTML/QuickForm2/DataSource.php';
 
 /**
  * Interface for data sources containing submitted values
diff --git a/libs/HTML/QuickForm2/DataSource/SuperGlobal.php b/libs/HTML/QuickForm2/DataSource/SuperGlobal.php
index 38fd7906d74054e82b14fbe4050bbaf68168a841..8f9276efc5010065565df97e42011601fb78b668 100644
--- a/libs/HTML/QuickForm2/DataSource/SuperGlobal.php
+++ b/libs/HTML/QuickForm2/DataSource/SuperGlobal.php
@@ -46,12 +46,12 @@
 /**
  * Interface for data sources containing submitted values
  */
-require_once 'HTML/QuickForm2/DataSource/Submit.php';
+// require_once 'HTML/QuickForm2/DataSource/Submit.php';
 
 /**
  * Array-based data source for HTML_QuickForm2 objects
  */
-require_once 'HTML/QuickForm2/DataSource/Array.php';
+// require_once 'HTML/QuickForm2/DataSource/Array.php';
 
 /**
  * Data source for HTML_QuickForm2 objects based on superglobal arrays
diff --git a/libs/HTML/QuickForm2/Element.php b/libs/HTML/QuickForm2/Element.php
index b89e6b8b6f7c86d65289309b8ff6fd81810f81d9..1ce181fcb849eefd235f3bd5c139f86821c75191 100644
--- a/libs/HTML/QuickForm2/Element.php
+++ b/libs/HTML/QuickForm2/Element.php
@@ -46,7 +46,7 @@
 /**
  * Base class for all HTML_QuickForm2 elements
  */
-require_once 'HTML/QuickForm2/Node.php';
+// require_once 'HTML/QuickForm2/Node.php';
 
 /**
  * Abstract base class for simple QuickForm2 elements (not Containers)
diff --git a/libs/HTML/QuickForm2/Element/Button.php b/libs/HTML/QuickForm2/Element/Button.php
index 8fb87b1f1be44b2c42e52a4b130a5a678cfe36b3..b53f28902bfafc879e0b104a0004866c463c6540 100644
--- a/libs/HTML/QuickForm2/Element/Button.php
+++ b/libs/HTML/QuickForm2/Element/Button.php
@@ -46,7 +46,7 @@
 /**
  * Base class for simple HTML_QuickForm2 elements
  */
-require_once 'HTML/QuickForm2/Element.php';
+// require_once 'HTML/QuickForm2/Element.php';
 
 /**
  * Class for <button> elements
diff --git a/libs/HTML/QuickForm2/Element/Date.php b/libs/HTML/QuickForm2/Element/Date.php
index 4b98a8a457314280d0d77ec9f76c723aff5a365a..c1a26c0a0eed4dc4fc824f2951ebeb0b3d3fad1d 100644
--- a/libs/HTML/QuickForm2/Element/Date.php
+++ b/libs/HTML/QuickForm2/Element/Date.php
@@ -46,11 +46,11 @@
 /**
  * Base class for HTML_QuickForm2 group of elements
  */
-require_once 'HTML/QuickForm2/Container/Group.php';
+// require_once 'HTML/QuickForm2/Container/Group.php';
 /**
  * Base class for HTML_QuickForm2 select element
  */
-require_once 'HTML/QuickForm2/Element/Select.php';
+// require_once 'HTML/QuickForm2/Element/Select.php';
 
 /**
  * Class for a group of elements used to input dates (and times).
@@ -500,4 +500,4 @@ class HTML_QuickForm2_Element_Date extends HTML_QuickForm2_Container_Group
         )
     );
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Element/Input.php b/libs/HTML/QuickForm2/Element/Input.php
index 65024a05fdfa90eadcc8dac3586db259330fe14c..616464a98d57902b1c62897fbb0c9437798462f5 100644
--- a/libs/HTML/QuickForm2/Element/Input.php
+++ b/libs/HTML/QuickForm2/Element/Input.php
@@ -46,7 +46,7 @@
 /**
  * Base class for simple HTML_QuickForm2 elements (not Containers)
  */
-require_once 'HTML/QuickForm2/Element.php';
+// require_once 'HTML/QuickForm2/Element.php';
 
 /**
  * Base class for <input> elements
@@ -111,4 +111,4 @@ class HTML_QuickForm2_Element_Input extends HTML_QuickForm2_Element
                $this->getPersistentContent();
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Element/InputButton.php b/libs/HTML/QuickForm2/Element/InputButton.php
index b3a2ef7cf9ecb710b7cc41f22633e5f4913dd3fa..95d99b5d4a3966d4f2a03fa09b24b57b9ace55b7 100644
--- a/libs/HTML/QuickForm2/Element/InputButton.php
+++ b/libs/HTML/QuickForm2/Element/InputButton.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="button" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputCheckable.php b/libs/HTML/QuickForm2/Element/InputCheckable.php
index 5d9b30dff27a620ad0cd1dbfa9174c5414c4de33..9a152ec7c3fa44d659e3b55ef8e985fe080acd86 100644
--- a/libs/HTML/QuickForm2/Element/InputCheckable.php
+++ b/libs/HTML/QuickForm2/Element/InputCheckable.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Base class for <input> elements having 'checked' attribute (checkboxes and radios)
diff --git a/libs/HTML/QuickForm2/Element/InputCheckbox.php b/libs/HTML/QuickForm2/Element/InputCheckbox.php
index 7e2ab8e065b62caa5ea274ca8c6d906da7bcf5b7..70510b1b4b339f5eb59e94662ac86206f23d40d7 100644
--- a/libs/HTML/QuickForm2/Element/InputCheckbox.php
+++ b/libs/HTML/QuickForm2/Element/InputCheckbox.php
@@ -46,7 +46,7 @@
 /**
  * Base class for checkboxes and radios
  */
-require_once 'HTML/QuickForm2/Element/InputCheckable.php';
+// require_once 'HTML/QuickForm2/Element/InputCheckable.php';
 
 /**
  * Class for <input type="checkbox" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputFile.php b/libs/HTML/QuickForm2/Element/InputFile.php
index 8fdf99aa55c5f1f63b8184a0041b0e0184d109e3..fc52eca40072c80edf69a4d693e274dcf0bf31e8 100644
--- a/libs/HTML/QuickForm2/Element/InputFile.php
+++ b/libs/HTML/QuickForm2/Element/InputFile.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="file" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputHidden.php b/libs/HTML/QuickForm2/Element/InputHidden.php
index 578af01fa3cc4689ce37255084084f6bf8808ddf..deabc18e8317c4ea7b28c2663c005fc62f8f2b46 100644
--- a/libs/HTML/QuickForm2/Element/InputHidden.php
+++ b/libs/HTML/QuickForm2/Element/InputHidden.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="hidden" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputImage.php b/libs/HTML/QuickForm2/Element/InputImage.php
index 369bd49ee443e71d38f036eba8b190b4473b4fb5..86748ad82a5adce939bb0610dd6dcd81057c71ac 100644
--- a/libs/HTML/QuickForm2/Element/InputImage.php
+++ b/libs/HTML/QuickForm2/Element/InputImage.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="image" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputPassword.php b/libs/HTML/QuickForm2/Element/InputPassword.php
index 12a975f24006896c31bde86275c46c8f40cd4234..f820ad2a53b96ff36687177e923b1e129b12ea55 100644
--- a/libs/HTML/QuickForm2/Element/InputPassword.php
+++ b/libs/HTML/QuickForm2/Element/InputPassword.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="password" /> elements
@@ -68,4 +68,4 @@ class HTML_QuickForm2_Element_InputPassword extends HTML_QuickForm2_Element_Inpu
                $this->getPersistentContent();
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Element/InputRadio.php b/libs/HTML/QuickForm2/Element/InputRadio.php
index a005c71513a72f28b2b2639d95b29c223db741a9..265e17c57912642f5bb5ba8cf7025aacda59efbc 100644
--- a/libs/HTML/QuickForm2/Element/InputRadio.php
+++ b/libs/HTML/QuickForm2/Element/InputRadio.php
@@ -46,7 +46,7 @@
 /**
  * Base class for checkboxes and radios
  */
-require_once 'HTML/QuickForm2/Element/InputCheckable.php';
+// require_once 'HTML/QuickForm2/Element/InputCheckable.php';
 
 /**
  * Class for <input type="radio" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputReset.php b/libs/HTML/QuickForm2/Element/InputReset.php
index b6dd914582bfb08113ddd2aa1698a1514c0633ec..114dcf6033c5f3fc8ccc9b380aed56d94b2ff4fb 100644
--- a/libs/HTML/QuickForm2/Element/InputReset.php
+++ b/libs/HTML/QuickForm2/Element/InputReset.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="reset" /> elements
@@ -96,4 +96,4 @@ class HTML_QuickForm2_Element_InputReset extends HTML_QuickForm2_Element_Input
         return null;
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Element/InputSubmit.php b/libs/HTML/QuickForm2/Element/InputSubmit.php
index c538ad0a68a9a1971c18f1c3956b945139652af3..de286eaf2b47f6196dc67d6401474a38d1c6268a 100644
--- a/libs/HTML/QuickForm2/Element/InputSubmit.php
+++ b/libs/HTML/QuickForm2/Element/InputSubmit.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="submit" /> elements
diff --git a/libs/HTML/QuickForm2/Element/InputText.php b/libs/HTML/QuickForm2/Element/InputText.php
index 5b9e62ebf9643d84307a7fc60149d60a566d0a5d..03a4973013979826c9126420f5aee82a45ed58e2 100644
--- a/libs/HTML/QuickForm2/Element/InputText.php
+++ b/libs/HTML/QuickForm2/Element/InputText.php
@@ -46,7 +46,7 @@
 /**
  * Base class for <input> elements
  */
-require_once 'HTML/QuickForm2/Element/Input.php';
+// require_once 'HTML/QuickForm2/Element/Input.php';
 
 /**
  * Class for <input type="text" /> elements
diff --git a/libs/HTML/QuickForm2/Element/Select.php b/libs/HTML/QuickForm2/Element/Select.php
index ec7d5961946cb559167cfab0f40f259696389ac2..68030355439eec78ff8952208ceb65c5bb511af7 100644
--- a/libs/HTML/QuickForm2/Element/Select.php
+++ b/libs/HTML/QuickForm2/Element/Select.php
@@ -46,7 +46,7 @@
 /**
  * Base class for simple HTML_QuickForm2 elements
  */
-require_once 'HTML/QuickForm2/Element.php';
+// require_once 'HTML/QuickForm2/Element.php';
 
 
 /**
diff --git a/libs/HTML/QuickForm2/Element/Static.php b/libs/HTML/QuickForm2/Element/Static.php
index bfee75e1307d357497ae744272942a5512daf987..cf0bbba5bafd69a54dc841faaafe86296abc6771 100644
--- a/libs/HTML/QuickForm2/Element/Static.php
+++ b/libs/HTML/QuickForm2/Element/Static.php
@@ -46,7 +46,7 @@
 /**
  * Base class for simple HTML_QuickForm2 elements (not Containers)
  */
-require_once 'HTML/QuickForm2/Element.php';
+// require_once 'HTML/QuickForm2/Element.php';
 
 /**
  * Class for static elements that only contain text or markup
@@ -150,4 +150,4 @@ class HTML_QuickForm2_Element_Static extends HTML_QuickForm2_Element
         }
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Element/Textarea.php b/libs/HTML/QuickForm2/Element/Textarea.php
index ff6892d35c71afef91c2001ac2fadc24238403e5..4f883fe195737b16b3a60cb79af2895018f2c0f0 100644
--- a/libs/HTML/QuickForm2/Element/Textarea.php
+++ b/libs/HTML/QuickForm2/Element/Textarea.php
@@ -46,7 +46,7 @@
 /**
  * Base class for simple HTML_QuickForm2 elements
  */
-require_once 'HTML/QuickForm2/Element.php';
+// require_once 'HTML/QuickForm2/Element.php';
 
 /**
  * Class for <textarea> elements
diff --git a/libs/HTML/QuickForm2/Exception.php b/libs/HTML/QuickForm2/Exception.php
index 29e7a7f206eb434acae921792f65e673b34f1f43..9740574cfe074af6d0a871663d5e292575c46ca4 100644
--- a/libs/HTML/QuickForm2/Exception.php
+++ b/libs/HTML/QuickForm2/Exception.php
@@ -46,7 +46,7 @@
 /**
  * Base class for exceptions in PEAR
  */
-require_once 'PEAR/Exception.php';
+// require_once 'PEAR/Exception.php';
 
 /**
  * Base class for exceptions in HTML_QuickForm2 package
diff --git a/libs/HTML/QuickForm2/Factory.php b/libs/HTML/QuickForm2/Factory.php
index 5f3028edbe94f5457ecabf0f634661e509003e36..4665419b01b476adcd78337598bb0e3508e61345 100644
--- a/libs/HTML/QuickForm2/Factory.php
+++ b/libs/HTML/QuickForm2/Factory.php
@@ -46,7 +46,7 @@
 /**
  * Class with static methods for loading classes and files
  */
-require_once 'HTML/QuickForm2/Loader.php';
+// require_once 'HTML/QuickForm2/Loader.php';
 
 /**
  * Static factory class
@@ -166,7 +166,9 @@ class HTML_QuickForm2_Factory
             throw new HTML_QuickForm2_InvalidArgumentException("Element type '$type' is not known");
         }
         list($className, $includeFile) = self::$elementTypes[$type];
-        HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+        if (!class_exists($className)) {
+            HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+        }
         return new $className($name, $attributes, $data);
     }
 
@@ -218,7 +220,9 @@ class HTML_QuickForm2_Factory
             throw new HTML_QuickForm2_InvalidArgumentException("Rule '$type' is not known");
         }
         list($className, $includeFile) = self::$registeredRules[$type];
-        HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+        if (!class_exists($className)) {
+            HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+        }
         if (isset(self::$registeredRules[$type][2])) {
             $config = call_user_func(array($className, 'mergeConfig'), $config,
                                      self::$registeredRules[$type][2]);
diff --git a/libs/HTML/QuickForm2/JavascriptBuilder.php b/libs/HTML/QuickForm2/JavascriptBuilder.php
index 8723d059058aff8cdb11b01fb51c5fb2442b05f7..a1fe72899d48ed7bddd6bc7d2d921ce5842f0a41 100644
--- a/libs/HTML/QuickForm2/JavascriptBuilder.php
+++ b/libs/HTML/QuickForm2/JavascriptBuilder.php
@@ -46,7 +46,7 @@
 /**
  * Exception classes for HTML_QuickForm2
  */
-require_once 'HTML/QuickForm2/Exception.php';
+// require_once 'HTML/QuickForm2/Exception.php';
 
 /**
  * Javascript aggregator and builder class
diff --git a/libs/HTML/QuickForm2/Loader.php b/libs/HTML/QuickForm2/Loader.php
index f058d45dd5ef79dd1e482bd3eebfe7f159be2de1..f3549737408bc694dfb6db547dac6f39cdcaea89 100644
--- a/libs/HTML/QuickForm2/Loader.php
+++ b/libs/HTML/QuickForm2/Loader.php
@@ -46,7 +46,7 @@
 /**
  * Exception classes for HTML_QuickForm2
  */
-require_once 'HTML/QuickForm2/Exception.php';
+// require_once 'HTML/QuickForm2/Exception.php';
 
 /**
  * Class with static methods for loading classes and files 
diff --git a/libs/HTML/QuickForm2/Node.php b/libs/HTML/QuickForm2/Node.php
index ae770561bad1acb0044a01e8917f194d5ce9fadf..b957ec1477012239876c06ecd1f1cec079eb3d10 100644
--- a/libs/HTML/QuickForm2/Node.php
+++ b/libs/HTML/QuickForm2/Node.php
@@ -46,7 +46,7 @@
 /**
  * HTML_Common2 - base class for HTML elements
  */
-require_once 'HTML/Common2.php';
+// require_once 'HTML/Common2.php';
 
 // By default, we generate element IDs with numeric indexes appended even for
 // elements with unique names. If you want IDs to be equal to the element
@@ -58,17 +58,17 @@ if (null === HTML_Common2::getOption('id_force_append_index')) {
 /**
  * Exception classes for HTML_QuickForm2
  */
-require_once 'HTML/QuickForm2/Exception.php';
+// require_once 'HTML/QuickForm2/Exception.php';
 
 /**
  * Static factory class for QuickForm2 elements
  */
-require_once 'HTML/QuickForm2/Factory.php';
+// require_once 'HTML/QuickForm2/Factory.php';
 
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 
 /**
@@ -668,7 +668,7 @@ abstract class HTML_QuickForm2_Node extends HTML_Common2
     {
         foreach ($this->filters as $filter) {
             if (is_array($value) && !empty($filter['recursive'])) {
-                array_walk_recursive(&$value, 
+                array_walk_recursive($value, 
                     array('HTML_QuickForm2_Node', 'applyFilter'), $filter);
             } else {
                 self::applyFilter($value, null, $filter);
diff --git a/libs/HTML/QuickForm2/Renderer.php b/libs/HTML/QuickForm2/Renderer.php
index 3b696a5c03c1ef6bf3ff5574596cb2820e0bc7d0..67dbfe99a43a72190b4a840ef4049bec7c64e516 100644
--- a/libs/HTML/QuickForm2/Renderer.php
+++ b/libs/HTML/QuickForm2/Renderer.php
@@ -46,7 +46,7 @@
 /**
  * Class with static methods for loading classes and files
  */
-require_once 'HTML/QuickForm2/Loader.php';
+// require_once 'HTML/QuickForm2/Loader.php';
 
 /**
  * Abstract base class for QuickForm2 renderers
@@ -137,8 +137,12 @@ abstract class HTML_QuickForm2_Renderer
         }
 
         list ($className, $includeFile) = self::$_types[$type];
-        HTML_QuickForm2_Loader::loadClass($className, $includeFile);
-        HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_Renderer_Proxy');
+        if (!class_exists($className)) {
+            HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+        }
+        if (!class_exists('HTML_QuickForm2_Renderer_Proxy')) {
+            HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_Renderer_Proxy');
+        }
         return new HTML_QuickForm2_Renderer_Proxy(new $className, self::$_pluginClasses[$type]);
     }
 
@@ -280,7 +284,9 @@ abstract class HTML_QuickForm2_Renderer
     public function getJavascriptBuilder()
     {
         if (empty($this->jsBuilder)) {
-            HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_JavascriptBuilder');
+            if (!class_exists('HTML_QuickForm2_JavascriptBuilder')) {
+                HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_JavascriptBuilder');
+            }
             $this->jsBuilder = new HTML_QuickForm2_JavascriptBuilder();
         }
         return $this->jsBuilder;
diff --git a/libs/HTML/QuickForm2/Renderer/Array.php b/libs/HTML/QuickForm2/Renderer/Array.php
index 57f1dd70004f2ad73a83edbd6109a9915139ee2a..975aaed76ac4bd0f6d7b7f0c758e257ff1668aa7 100644
--- a/libs/HTML/QuickForm2/Renderer/Array.php
+++ b/libs/HTML/QuickForm2/Renderer/Array.php
@@ -47,7 +47,7 @@
 /**
  * Abstract base class for QuickForm2 renderers
  */
-require_once 'HTML/QuickForm2/Renderer.php';
+// require_once 'HTML/QuickForm2/Renderer.php';
 
 /**
  * A renderer for HTML_QuickForm2 building an array of form elements
diff --git a/libs/HTML/QuickForm2/Renderer/Default.php b/libs/HTML/QuickForm2/Renderer/Default.php
index a58f011fbea0b67b531fbf4bb1b97f5506269f45..c688889cb4b3277ffa02b4ac12f2a5d69ac9e192 100644
--- a/libs/HTML/QuickForm2/Renderer/Default.php
+++ b/libs/HTML/QuickForm2/Renderer/Default.php
@@ -46,7 +46,7 @@
 /**
  * Abstract base class for QuickForm2 renderers
  */
-require_once 'HTML/QuickForm2/Renderer.php';
+// require_once 'HTML/QuickForm2/Renderer.php';
 
 /**
  * Default renderer for QuickForm2
@@ -595,4 +595,4 @@ class HTML_QuickForm2_Renderer_Default extends HTML_QuickForm2_Renderer
         return $elTpl;
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Renderer/Proxy.php b/libs/HTML/QuickForm2/Renderer/Proxy.php
index 5b424ea1c08bbdce3a06be7d324fbcc3883d1b6f..d50c4bc7b6c94ba4edac5df5fea9fc23e8cf14a1 100644
--- a/libs/HTML/QuickForm2/Renderer/Proxy.php
+++ b/libs/HTML/QuickForm2/Renderer/Proxy.php
@@ -46,7 +46,7 @@
 /**
  * Abstract base class for QuickForm2 renderers
  */
-require_once 'HTML/QuickForm2/Renderer.php';
+// require_once 'HTML/QuickForm2/Renderer.php';
 
 /**
  * Proxy class for HTML_QuickForm2 renderers and their plugins
@@ -135,7 +135,9 @@ class HTML_QuickForm2_Renderer_Proxy extends HTML_QuickForm2_Renderer
         // any additional plugins since last __call()?
         for ($i = count($this->_plugins); $i < count($this->_pluginClasses); $i++) {
             list($className, $includeFile) = $this->_pluginClasses[$i];
-            HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+            if (!class_exists($className)) {
+                HTML_QuickForm2_Loader::loadClass($className, $includeFile);
+            }
             $this->addPlugin($i, new $className);
         }
         if (isset($this->_pluginMethods[$lower])) {
@@ -259,4 +261,4 @@ class HTML_QuickForm2_Renderer_Proxy extends HTML_QuickForm2_Renderer
                       " could not be converted to string", E_USER_ERROR);
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Renderer/Smarty.php b/libs/HTML/QuickForm2/Renderer/Smarty.php
new file mode 100644
index 0000000000000000000000000000000000000000..a670451d111e93748c4f5b29a9f335578cf5dbd4
--- /dev/null
+++ b/libs/HTML/QuickForm2/Renderer/Smarty.php
@@ -0,0 +1,292 @@
+<?php
+/**
+ * A renderer for HTML_QuickForm2 suitable for using with the Smarty template engine.
+ * See: http://www.smarty.net/
+ *
+ * PHP version 5
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2009, Alain D D Williams <addw@phcomp.co.uk>
+ * Based on the QuickForm2 Array renderer.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *    * The names of the authors may not be used to endorse or promote products
+ *      derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category   HTML
+ * @package    HTML_QuickForm2
+ * @author     Alain D D Williams <addw@phcomp.co.uk>
+ * @license    http://opensource.org/licenses/bsd-license.php New BSD License
+ * @version    SCCS: %W% %G% %U%
+ * @link       http://pear.php.net/package/HTML_QuickForm2
+ */
+
+/**
+ * This generates an array, bring in the array renderer and extend it a bit:
+ */
+// require_once 'HTML/QuickForm2/Renderer/Array.php';
+
+/**
+ * A renderer for HTML_QuickForm2 building an array of form elements
+ *
+ * Based on Array renderer from HTML_QuickForm 3.x package
+ *
+ * The form array structure is the following:
+ * <pre>
+ * array(
+ *   'id'               => form's "id" attribute (string),
+ *   'frozen'           => whether the form is frozen (bool),
+ *   'attributes'       => attributes for &lt;form&gt; tag (string),
+ *   // if form contains required elements:
+ *   'required_note'    => note about the required elements (string),
+ *   'requirednote'      => note about the required elements (string),
+ *                           NB: no '_' in the middle
+ *                           In old_compat this is a span style="font-size:80%;"
+ *                           with the '*' also color:#ff0000;
+ *                           Not old_compat it is in a div class="reqnote"
+ *   // if 'group_hiddens' option is true:
+ *   'hidden'           => array with html of hidden elements (array),
+ *   // if 'group_errors' option is true:
+ *   'errors' => array(
+ *     '1st element id' => 'Error for the 1st element',
+ *     ...
+ *     'nth element id' => 'Error for the nth element'
+ *   ),
+ *   'elements' => array(
+ *     element_1,
+ *     ...
+ *     element_N
+ *   )
+ *   '1st_elements_name'  => array for the 1st element,
+ *     ...                   references into 'elements' above
+ *   'nth_elements_name'  => array for the nth element,
+ *   )
+ * );
+ * </pre>
+ * Where element_i is an array of the form
+ * <pre>
+ * array(
+ *   'id'        => element id (string),
+ *   'name'      => element name (string),
+ *   'type'      => type of the element (string),
+ *   'frozen'    => whether element is frozen (bool),
+ *   // if element has a label:
+ *   'label'     => 'label for the element',
+ *   // note that if 'static_labels' option is true and element's label is an
+ *   // array then there will be several 'label_*' keys corresponding to
+ *   // labels' array keys
+ *   'required'  => whether element is required (bool),
+ *   // if a validation error is present and 'group_errors' option is false:
+ *   'error'     => error associated with the element (string),
+ *   // if some style was associated with an element:
+ *   'style'     => 'some information about element style (e.g. for Smarty)',
+ *
+ *   // if element is not a Container
+ *   'value'     => element value (mixed),
+ *   'html'      => HTML for the element (string),
+ *
+ *   // if element is a Container
+ *   'attributes' => container attributes (string)
+ *   // only for groups, if separator is set:
+ *   'separator'  => separator for group elements (mixed),
+ *   'elements'   => array(
+ *     element_1,
+ *     ...
+ *     element_N
+ *   )
+ *
+ * If the type is 'radio' an element (type = 'radio') is created for each choice that the user has,
+ * keyed by the 'id' value. An 'element' will be created having an array with one element key '0'.
+ * The 'id' above will be set to the value in 'name'.
+ * The 'type' of each element will be 'radio'
+ * );
+ * </pre>
+ *
+ * The following additional options are available:
+ * <ul>
+ *   <li>'old_compat'    - generate something compatible with an old renderer</li>
+ *   <li>'key_id'        - the key to elements is the field's 'id' rather than 'name'</li>
+ * </ul>
+ *
+ * While almost everything in this class is defined as public, its properties
+ * and those methods that are not published (i.e. not in array returned by
+ * exportMethods()) will be available to renderer plugins only.
+ *
+ * The following methods are published:
+ *   - {@link reset()}
+ *   - {@link toArray()}
+ *   - {@link setStyleForId()}
+ *
+ * @category   HTML
+ * @package    HTML_QuickForm2
+ * @author     Alain D D Williams <addw@phcomp.co.uk>
+ * @version    Release: SCCS: %W% %G% %U%
+ */
+class HTML_QuickForm2_Renderer_Smarty extends HTML_QuickForm2_Renderer_Array
+{
+   /**
+    * Constructor, adds new options
+    */
+    protected function __construct()
+    {
+        parent::__construct();
+        $this->options += array(
+            'old_compat' => false,
+            'key_id'     => false,
+            );
+    }
+
+   /**
+    * Creates an array with fields that are common to all elements
+    *
+    * @param    HTML_QuickForm2_Node    Element being rendered
+    *
+    * @return   array
+    */
+    public function buildCommonFields(HTML_QuickForm2_Node $element)
+    {
+        $keyn = $this->options['key_id'] ? 'id' : 'name';
+
+        $ary = array(
+            'id'     => $element->getId(),
+            'frozen' => $element->toggleFrozen(),
+            'name'   => $element->getName(),
+        );
+
+        // Key that we use for putting into arrays so that smarty can extract them.
+        // Note that the name may be empty.
+        $key_val = $ary[$keyn];
+        if($key_val == '')
+            $key_val = $ary['id'];
+
+        if ($labels = $element->getLabel()) {
+            if (!is_array($labels) || !$this->options['static_labels']) {
+                $ary['label'] = $labels;
+            } else {
+                foreach ($labels as $key => $label) {
+                    $key = is_int($key)? $key + 1: $key;
+                    if (1 === $key) {
+                        $ary['label'] = $label;
+                    } else {
+                        $ary['label_' . $key] = $label;
+                    }
+                }
+            }
+        }
+
+        // Smarty: group_errors under 'name' or 'id' depending on key_id option:
+        if (($error = $element->getError()) && $this->options['group_errors']) {
+            $this->array['errors'][$key_val] = $error;
+        } elseif ($error) {
+            $ary['error'] = $error;
+        }
+        if (isset($this->styles[$key_val])) {
+            $ary['style'] = $this->styles[$key_val];
+        }
+        if (!$element instanceof HTML_QuickForm2_Container) {
+            $ary['html']       = $element->__toString();
+        } else {
+            $ary['elements']   = array();
+            $ary['attributes'] = $element->getAttributes(true);
+        }
+        return $ary;
+    }
+
+    public function startForm(HTML_QuickForm2_Node $form)
+    {
+        if($this->options['old_compat'])
+            $this->options['group_hiddens'] = true;
+
+        parent::startForm($form);
+    }
+
+    public function finishForm(HTML_QuickForm2_Node $form)
+    {
+        parent::finishForm($form);
+
+        if ($this->hasRequired) {
+
+            // Create element 'requirednote' - note no '_'
+            if($this->options['old_compat']) {
+                // Old QuickForm had the requirednote styled & a different name:
+                $this->array['requirednote'] = preg_replace('|<em>([^<]+)</em>(.*)|',
+                    '<span style="font-size:80%; color:#ff0000;">$1</span><span style="font-size:80%;">$2</span>',
+                    $this->options['required_note']);
+            } else {
+                $this->array['requirednote'] = '<div class="reqnote">'. $this->options['required_note'] . '</div>';
+            }
+        }
+
+        // Create top level elements keyed by form field 'name' or 'id'
+        if(isset($this->array['elements']['0']))
+            $this->linkToLevelAbove($this->array, $this->array['elements']);
+
+        // For compat: it is expected that 'hidden' is a string, not an array:
+        if($this->options['old_compat'] && isset($this->array['hidden']) && is_array($this->array['hidden']))
+            $this->array['hidden'] = join(' ', $this->array['hidden']);
+    }
+
+    // Look through the elements (numerically indexed) array, make fields
+    // members of the level above. This is so that they can be easily accessed by smarty templates.
+    // If we find a group, recurse down. Used for smarty only.
+    // Key is 'name' or 'id'.
+    private function linkToLevelAbove(&$top, $elements, $inGroup = false)
+    {
+        $key = $this->options['key_id'] ? 'id' : 'name';
+
+        foreach($elements as &$elem) {
+            $top_key = $elem[$key];
+
+            // If in a group, convert something like inGrp[F4grp][F4_1] to F4_1
+            // Don't do if key_id as the value is a straight id.
+            if( !$this->options['key_id'] && $inGroup && $top_key != '') {
+                if(!(preg_match("/\[?([\w_]+)\]?$/i", $top_key, $match)))
+                    throw new HTML_QuickForm2_InvalidArgumentException(
+                        "linkToLevelAbove can't obtain the name from '$top_key'");
+                $top_key = $match[1];
+            }
+
+            // Radio buttons: several elements with the same name, make an array
+            if(isset($elem['type']) && $elem['type'] == 'radio') {
+                if( ! isset($top[$top_key]))
+                    $top[$top_key] = array('id' => $top_key, 'type' => 'radio', 'elements' => array(0));
+                $top[$top_key][$elem['id']] = &$elem;
+            } else    // Normal field, just link into the level above.
+                if( ! isset($top[$top_key]))
+                    $top[$top_key] = &$elem;    // Link into the level above
+
+            // If we have a group link its fields up to this level:
+            if(isset($elem['elements']['0']))
+                $this->linkToLevelAbove($elem, $elem['elements'], true);
+
+            // Link errors to the top level:
+            if(isset($elem['error']) && isset($this->array[$elem['error']]))
+                $this->array['errors'][$top_key] = $this->array[$elem['error']];
+        }
+    }
+
+    /**#@-*/
+}
diff --git a/libs/HTML/QuickForm2/Rule/Callback.php b/libs/HTML/QuickForm2/Rule/Callback.php
index c013d6b0332ca82a5c7787bd62de3501511b8ddd..c74aafcf7f397537b4be179c461194ed6c8253bf 100644
--- a/libs/HTML/QuickForm2/Rule/Callback.php
+++ b/libs/HTML/QuickForm2/Rule/Callback.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule checking the value via a callback function (method)
diff --git a/libs/HTML/QuickForm2/Rule/Compare.php b/libs/HTML/QuickForm2/Rule/Compare.php
index b6e83e59df9177a36c94ec098dcbe95e1e94737f..60dca9f5d340c36d2b3395fc47a22c9b8ab869cb 100644
--- a/libs/HTML/QuickForm2/Rule/Compare.php
+++ b/libs/HTML/QuickForm2/Rule/Compare.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule comparing the value of the field with some other value
diff --git a/libs/HTML/QuickForm2/Rule/Each.php b/libs/HTML/QuickForm2/Rule/Each.php
index 721c87950f86c6e31b9abbed5fa6a5a3bec103d2..2a0fb7e2aca418de0c8e1c31fc0b7a361eda3298 100644
--- a/libs/HTML/QuickForm2/Rule/Each.php
+++ b/libs/HTML/QuickForm2/Rule/Each.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Validates all elements in a Container using a template Rule
@@ -134,4 +134,4 @@ class HTML_QuickForm2_Rule_Each extends HTML_QuickForm2_Rule
         parent::setOwner($owner);
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Rule/Empty.php b/libs/HTML/QuickForm2/Rule/Empty.php
index 76808bb28826e26c40921b7098ede0076791da10..fe41f5e50ee1aa740b56ce9fb4f014e03d738495 100644
--- a/libs/HTML/QuickForm2/Rule/Empty.php
+++ b/libs/HTML/QuickForm2/Rule/Empty.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule checking that the field is empty
@@ -86,4 +86,4 @@ class HTML_QuickForm2_Rule_Empty extends HTML_QuickForm2_Rule
     }
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Rule/Length.php b/libs/HTML/QuickForm2/Rule/Length.php
index 178bbe35cb64bbc03773ad664fc2a5ece98eaae6..849aa41c2e6e08e4ea8b17de4d24e51aaf27c48f 100644
--- a/libs/HTML/QuickForm2/Rule/Length.php
+++ b/libs/HTML/QuickForm2/Rule/Length.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule checking the value's length
diff --git a/libs/HTML/QuickForm2/Rule/MaxFileSize.php b/libs/HTML/QuickForm2/Rule/MaxFileSize.php
index b879b1450287aa2709a6928ee64219e800ced0d9..1d0dcd25f47140876fdc9d9fe8b25102167a1291 100644
--- a/libs/HTML/QuickForm2/Rule/MaxFileSize.php
+++ b/libs/HTML/QuickForm2/Rule/MaxFileSize.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule checking that uploaded file size does not exceed the given limit
diff --git a/libs/HTML/QuickForm2/Rule/MimeType.php b/libs/HTML/QuickForm2/Rule/MimeType.php
index 067a41c1d09613579a3be637b59316451649cfbe..5dfa28275301127f7f5da61589c59f5509e31385 100644
--- a/libs/HTML/QuickForm2/Rule/MimeType.php
+++ b/libs/HTML/QuickForm2/Rule/MimeType.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule checking that uploaded file is of the correct MIME type
diff --git a/libs/HTML/QuickForm2/Rule/Nonempty.php b/libs/HTML/QuickForm2/Rule/Nonempty.php
index e815089072c952a81eb889be0d4c269da09791f1..2f541c0088a7f6cbd63426e2508c10fbf7660b27 100644
--- a/libs/HTML/QuickForm2/Rule/Nonempty.php
+++ b/libs/HTML/QuickForm2/Rule/Nonempty.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Rule checking that the field is not empty
diff --git a/libs/HTML/QuickForm2/Rule/NotCallback.php b/libs/HTML/QuickForm2/Rule/NotCallback.php
index ace4f83704dab0e9aa6fdaced9c22103f4de2f83..7f5cdef3662eda319f1e43a0d89cbcebb0262491 100644
--- a/libs/HTML/QuickForm2/Rule/NotCallback.php
+++ b/libs/HTML/QuickForm2/Rule/NotCallback.php
@@ -46,7 +46,7 @@
 /**
  * Rule checking the value via a callback function (method)
  */
-require_once 'HTML/QuickForm2/Rule/Callback.php';
+// require_once 'HTML/QuickForm2/Rule/Callback.php';
 
 /**
  * Rule checking the value via a callback function (method) with logical negation
@@ -77,4 +77,4 @@ class HTML_QuickForm2_Rule_NotCallback extends HTML_QuickForm2_Rule_Callback
         );
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Rule/NotRegex.php b/libs/HTML/QuickForm2/Rule/NotRegex.php
index acb787378729c756785fba07534f8a710d8d5801..9fe4357d577e5cf227e94e79806f4fe8b54a0a0c 100644
--- a/libs/HTML/QuickForm2/Rule/NotRegex.php
+++ b/libs/HTML/QuickForm2/Rule/NotRegex.php
@@ -46,7 +46,7 @@
 /**
  * Validates values using regular expressions
  */
-require_once 'HTML/QuickForm2/Rule/Regex.php';
+// require_once 'HTML/QuickForm2/Rule/Regex.php';
 
 /**
  * Checks that the element's value does not match a regular expression
@@ -103,4 +103,4 @@ class HTML_QuickForm2_Rule_NotRegex extends HTML_QuickForm2_Rule_Regex
                "; return value == '' || !regex.test(value); }";
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Rule/Regex.php b/libs/HTML/QuickForm2/Rule/Regex.php
index a3eeea30f3b20f7f926c126b1abb48bd0df34498..341b35ed8674364efb02ec9630971a1d4065a795 100644
--- a/libs/HTML/QuickForm2/Rule/Regex.php
+++ b/libs/HTML/QuickForm2/Rule/Regex.php
@@ -46,7 +46,7 @@
 /**
  * Base class for HTML_QuickForm2 rules
  */
-require_once 'HTML/QuickForm2/Rule.php';
+// require_once 'HTML/QuickForm2/Rule.php';
 
 /**
  * Validates values using regular expressions
@@ -130,4 +130,4 @@ class HTML_QuickForm2_Rule_Regex extends HTML_QuickForm2_Rule
                "; return value == '' || regex.test(value); }";
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libs/HTML/QuickForm2/Rule/Required.php b/libs/HTML/QuickForm2/Rule/Required.php
index 9fa3f3c1af38cf93e72c2d395a192502f7a5147a..af0b19244714545ab7acc43be8b4b579ad9adcc9 100644
--- a/libs/HTML/QuickForm2/Rule/Required.php
+++ b/libs/HTML/QuickForm2/Rule/Required.php
@@ -46,7 +46,7 @@
 /**
  * Rule checking that the form field is not empty
  */
-require_once 'HTML/QuickForm2/Rule/Nonempty.php';
+// require_once 'HTML/QuickForm2/Rule/Nonempty.php';
 
 /**
  * Rule for required elements