Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs/HTML
diff options
context:
space:
mode:
authorrobocoder <anthon.pang@gmail.com>2010-07-06 22:18:59 +0400
committerrobocoder <anthon.pang@gmail.com>2010-07-06 22:18:59 +0400
commit6ed0125bd7fc55d452cbb3ee6e467786fb18c379 (patch)
tree4c59557ff9efeddb24edcba078d1b450a50a9b75 /libs/HTML
parent657a4852ee3741c23acba77ebf4050dbca72c734 (diff)
Synced up with PEAR svn repository revision 301028
* add HTML_QuickForm2_Renderer_Smarty * comment out require_once * let autoloaders try loading class first - http://pear.php.net/bugs/bug.php?id=17568 * HTML_QuickForm_Node - http://pear.php.net/bugs/17557 git-svn-id: http://dev.piwik.org/svn/trunk@2437 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/HTML')
-rw-r--r--libs/HTML/QuickForm2.php4
-rw-r--r--libs/HTML/QuickForm2/Container.php6
-rw-r--r--libs/HTML/QuickForm2/Container/Fieldset.php4
-rw-r--r--libs/HTML/QuickForm2/Container/Group.php6
-rw-r--r--libs/HTML/QuickForm2/Controller.php12
-rw-r--r--libs/HTML/QuickForm2/Controller/Action/Back.php2
-rw-r--r--libs/HTML/QuickForm2/Controller/Action/Direct.php2
-rw-r--r--libs/HTML/QuickForm2/Controller/Action/Display.php4
-rw-r--r--libs/HTML/QuickForm2/Controller/Action/Jump.php2
-rw-r--r--libs/HTML/QuickForm2/Controller/Action/Next.php2
-rw-r--r--libs/HTML/QuickForm2/Controller/Action/Submit.php2
-rw-r--r--libs/HTML/QuickForm2/Controller/DefaultAction.php2
-rw-r--r--libs/HTML/QuickForm2/Controller/Page.php4
-rw-r--r--libs/HTML/QuickForm2/DataSource/Array.php2
-rw-r--r--libs/HTML/QuickForm2/DataSource/Session.php4
-rw-r--r--libs/HTML/QuickForm2/DataSource/Submit.php2
-rw-r--r--libs/HTML/QuickForm2/DataSource/SuperGlobal.php4
-rw-r--r--libs/HTML/QuickForm2/Element.php2
-rw-r--r--libs/HTML/QuickForm2/Element/Button.php2
-rw-r--r--libs/HTML/QuickForm2/Element/Date.php6
-rw-r--r--libs/HTML/QuickForm2/Element/Input.php4
-rw-r--r--libs/HTML/QuickForm2/Element/InputButton.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputCheckable.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputCheckbox.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputFile.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputHidden.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputImage.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputPassword.php4
-rw-r--r--libs/HTML/QuickForm2/Element/InputRadio.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputReset.php4
-rw-r--r--libs/HTML/QuickForm2/Element/InputSubmit.php2
-rw-r--r--libs/HTML/QuickForm2/Element/InputText.php2
-rw-r--r--libs/HTML/QuickForm2/Element/Select.php2
-rw-r--r--libs/HTML/QuickForm2/Element/Static.php4
-rw-r--r--libs/HTML/QuickForm2/Element/Textarea.php2
-rw-r--r--libs/HTML/QuickForm2/Exception.php2
-rw-r--r--libs/HTML/QuickForm2/Factory.php10
-rw-r--r--libs/HTML/QuickForm2/JavascriptBuilder.php2
-rw-r--r--libs/HTML/QuickForm2/Loader.php2
-rw-r--r--libs/HTML/QuickForm2/Node.php10
-rw-r--r--libs/HTML/QuickForm2/Renderer.php14
-rw-r--r--libs/HTML/QuickForm2/Renderer/Array.php2
-rw-r--r--libs/HTML/QuickForm2/Renderer/Default.php4
-rw-r--r--libs/HTML/QuickForm2/Renderer/Proxy.php8
-rw-r--r--libs/HTML/QuickForm2/Renderer/Smarty.php292
-rw-r--r--libs/HTML/QuickForm2/Rule/Callback.php2
-rw-r--r--libs/HTML/QuickForm2/Rule/Compare.php2
-rw-r--r--libs/HTML/QuickForm2/Rule/Each.php4
-rw-r--r--libs/HTML/QuickForm2/Rule/Empty.php4
-rw-r--r--libs/HTML/QuickForm2/Rule/Length.php2
-rw-r--r--libs/HTML/QuickForm2/Rule/MaxFileSize.php2
-rw-r--r--libs/HTML/QuickForm2/Rule/MimeType.php2
-rw-r--r--libs/HTML/QuickForm2/Rule/Nonempty.php2
-rw-r--r--libs/HTML/QuickForm2/Rule/NotCallback.php4
-rw-r--r--libs/HTML/QuickForm2/Rule/NotRegex.php4
-rw-r--r--libs/HTML/QuickForm2/Rule/Regex.php4
-rw-r--r--libs/HTML/QuickForm2/Rule/Required.php2
57 files changed, 399 insertions, 93 deletions
diff --git a/libs/HTML/QuickForm2.php b/libs/HTML/QuickForm2.php
index 787b6001bd..48d10de076 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 b62a435f06..e96a4ff12b 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 bf362431c8..7b6b9c982c 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 4ef7b1b552..970ff8fcb9 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 d2aa144fdc..440d1005a2 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 1e591b4a42..08ae890cbe 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 1c760a0432..0a96a9da42 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 dc75a8dfe1..dd57aec83b 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 4e29492f83..ecb8924e16 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 b01b9c6413..41769427a6 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 67fb436240..db821a9b3d 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 d88a07a47b..37d1bc43cc 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 1d639161d6..83564d0bee 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 8bb2a2959e..ff05a10318 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 e4634557af..d39738afec 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 fa9f6d3648..9003c032d5 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 38fd7906d7..8f9276efc5 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 b89e6b8b6f..1ce181fcb8 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 8fb87b1f1b..b53f28902b 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 4b98a8a457..c1a26c0a0e 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 65024a05fd..616464a98d 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 b3a2ef7cf9..95d99b5d4a 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 5d9b30dff2..9a152ec7c3 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 7e2ab8e065..70510b1b4b 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 8fdf99aa55..fc52eca400 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 578af01fa3..deabc18e83 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 369bd49ee4..86748ad82a 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 12a975f240..f820ad2a53 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 a005c71513..265e17c579 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 b6dd914582..114dcf6033 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 c538ad0a68..de286eaf2b 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 5b9e62ebf9..03a4973013 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 ec7d596194..6803035543 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 bfee75e130..cf0bbba5ba 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 ff6892d35c..4f883fe195 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 29e7a7f206..9740574cfe 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 5f3028edbe..4665419b01 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 8723d05905..a1fe72899d 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 f058d45dd5..f354973740 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 ae770561ba..b957ec1477 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 3b696a5c03..67dbfe99a4 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 57f1dd7000..975aaed76a 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 a58f011fbe..c688889cb4 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 5b424ea1c0..d50c4bc7b6 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 0000000000..a670451d11
--- /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 c013d6b033..c74aafcf7f 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 b6e83e59df..60dca9f5d3 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 721c87950f..2a0fb7e2ac 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 76808bb288..fe41f5e50e 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 178bbe35cb..849aa41c2e 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 b879b14502..1d0dcd25f4 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 067a41c1d0..5dfa282753 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 e815089072..2f541c0088 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 ace4f83704..7f5cdef366 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 acb7873787..9fe4357d57 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 a3eeea30f3..341b35ed86 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 9fa3f3c1af..af0b192447 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