summaryrefslogtreecommitdiffstats
path: root/library/vendor/Zend/Form/Decorator
diff options
context:
space:
mode:
Diffstat (limited to 'library/vendor/Zend/Form/Decorator')
-rw-r--r--library/vendor/Zend/Form/Decorator/Abstract.php251
-rw-r--r--library/vendor/Zend/Form/Decorator/Callback.php126
-rw-r--r--library/vendor/Zend/Form/Decorator/Captcha.php71
-rw-r--r--library/vendor/Zend/Form/Decorator/Description.php197
-rw-r--r--library/vendor/Zend/Form/Decorator/DtDdWrapper.php69
-rw-r--r--library/vendor/Zend/Form/Decorator/Errors.php76
-rw-r--r--library/vendor/Zend/Form/Decorator/Exception.php36
-rw-r--r--library/vendor/Zend/Form/Decorator/Fieldset.php156
-rw-r--r--library/vendor/Zend/Form/Decorator/File.php140
-rw-r--r--library/vendor/Zend/Form/Decorator/Form.php133
-rw-r--r--library/vendor/Zend/Form/Decorator/FormElements.php140
-rw-r--r--library/vendor/Zend/Form/Decorator/FormErrors.php514
-rw-r--r--library/vendor/Zend/Form/Decorator/HtmlTag.php253
-rw-r--r--library/vendor/Zend/Form/Decorator/Image.php152
-rw-r--r--library/vendor/Zend/Form/Decorator/Interface.php123
-rw-r--r--library/vendor/Zend/Form/Decorator/Label.php461
-rw-r--r--library/vendor/Zend/Form/Decorator/Marker/File/Interface.php33
-rw-r--r--library/vendor/Zend/Form/Decorator/PrepareElements.php89
-rw-r--r--library/vendor/Zend/Form/Decorator/Tooltip.php57
-rw-r--r--library/vendor/Zend/Form/Decorator/ViewHelper.php266
-rw-r--r--library/vendor/Zend/Form/Decorator/ViewScript.php190
21 files changed, 3533 insertions, 0 deletions
diff --git a/library/vendor/Zend/Form/Decorator/Abstract.php b/library/vendor/Zend/Form/Decorator/Abstract.php
new file mode 100644
index 0000000..93c5a05
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Abstract.php
@@ -0,0 +1,251 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Interface */
+
+/**
+ * Zend_Form_Decorator_Abstract
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+abstract class Zend_Form_Decorator_Abstract implements Zend_Form_Decorator_Interface
+{
+ /**
+ * Placement constants
+ */
+ const APPEND = 'APPEND';
+ const PREPEND = 'PREPEND';
+
+ /**
+ * Default placement: append
+ * @var string
+ */
+ protected $_placement = 'APPEND';
+
+ /**
+ * @var Zend_Form_Element|Zend_Form
+ */
+ protected $_element;
+
+ /**
+ * Decorator options
+ * @var array
+ */
+ protected $_options = array();
+
+ /**
+ * Separator between new content and old
+ * @var string
+ */
+ protected $_separator = PHP_EOL;
+
+ /**
+ * Constructor
+ *
+ * @param array|Zend_Config $options
+ * @return void
+ */
+ public function __construct($options = null)
+ {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ } elseif ($options instanceof Zend_Config) {
+ $this->setConfig($options);
+ }
+ }
+
+ /**
+ * Set options
+ *
+ * @param array $options
+ * @return Zend_Form_Decorator_Abstract
+ */
+ public function setOptions(array $options)
+ {
+ $this->_options = $options;
+ return $this;
+ }
+
+ /**
+ * Set options from config object
+ *
+ * @param Zend_Config $config
+ * @return Zend_Form_Decorator_Abstract
+ */
+ public function setConfig(Zend_Config $config)
+ {
+ return $this->setOptions($config->toArray());
+ }
+
+ /**
+ * Set option
+ *
+ * @param string $key
+ * @param mixed $value
+ * @return Zend_Form_Decorator_Abstract
+ */
+ public function setOption($key, $value)
+ {
+ $this->_options[(string) $key] = $value;
+ return $this;
+ }
+
+ /**
+ * Get option
+ *
+ * @param string $key
+ * @return mixed
+ */
+ public function getOption($key)
+ {
+ $key = (string) $key;
+ if (isset($this->_options[$key])) {
+ return $this->_options[$key];
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieve options
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
+ * Remove single option
+ *
+ * @param mixed $key
+ * @return void
+ */
+ public function removeOption($key)
+ {
+ if (null !== $this->getOption($key)) {
+ unset($this->_options[$key]);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Clear all options
+ *
+ * @return Zend_Form_Decorator_Abstract
+ */
+ public function clearOptions()
+ {
+ $this->_options = array();
+ return $this;
+ }
+
+ /**
+ * Set current form element
+ *
+ * @param Zend_Form_Element|Zend_Form $element
+ * @return Zend_Form_Decorator_Abstract
+ * @throws Zend_Form_Decorator_Exception on invalid element type
+ */
+ public function setElement($element)
+ {
+ if ((!$element instanceof Zend_Form_Element)
+ && (!$element instanceof Zend_Form)
+ && (!$element instanceof Zend_Form_DisplayGroup))
+ {
+ throw new Zend_Form_Decorator_Exception('Invalid element type passed to decorator');
+ }
+
+ $this->_element = $element;
+ return $this;
+ }
+
+ /**
+ * Retrieve current element
+ *
+ * @return Zend_Form_Element|Zend_Form
+ */
+ public function getElement()
+ {
+ return $this->_element;
+ }
+
+ /**
+ * Determine if decorator should append or prepend content
+ *
+ * @return string
+ */
+ public function getPlacement()
+ {
+ $placement = $this->_placement;
+ if (null !== ($placementOpt = $this->getOption('placement'))) {
+ $placementOpt = strtoupper($placementOpt);
+ switch ($placementOpt) {
+ case self::APPEND:
+ case self::PREPEND:
+ $placement = $this->_placement = $placementOpt;
+ break;
+ case false:
+ $placement = $this->_placement = null;
+ break;
+ default:
+ break;
+ }
+ $this->removeOption('placement');
+ }
+
+ return $placement;
+ }
+
+ /**
+ * Retrieve separator to use between old and new content
+ *
+ * @return string
+ */
+ public function getSeparator()
+ {
+ $separator = $this->_separator;
+ if (null !== ($separatorOpt = $this->getOption('separator'))) {
+ $separator = $this->_separator = (string) $separatorOpt;
+ $this->removeOption('separator');
+ }
+ return $separator;
+ }
+
+ /**
+ * Decorate content and/or element
+ *
+ * @param string $content
+ * @return string
+ * @throws Zend_Form_Decorator_Exception when unimplemented
+ */
+ public function render($content)
+ {
+ throw new Zend_Form_Decorator_Exception('render() not implemented');
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Callback.php b/library/vendor/Zend/Form/Decorator/Callback.php
new file mode 100644
index 0000000..fb759fd
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Callback.php
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Callback
+ *
+ * Execute an arbitrary callback to decorate an element. Callbacks should take
+ * three arguments, $content, $element, and $options:
+ *
+ * function mycallback($content, $element, array $options)
+ * {
+ * }
+ *
+ * and should return a string. ($options are whatever options were provided to
+ * the decorator.)
+ *
+ * To specify a callback, pass a valid callback as the 'callback' option.
+ *
+ * Callback results will be either appended, prepended, or replace the provided
+ * content. To replace the content, specify a placement of boolean false;
+ * defaults to append content.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Callback extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Callback
+ * @var string|array
+ */
+ protected $_callback;
+
+ /**
+ * Set callback
+ *
+ * @param callback $callback
+ * @return Zend_Form_Decorator_Callback
+ * @throws Zend_Form_Exception
+ */
+ public function setCallback($callback)
+ {
+ if (!is_callable($callback)) {
+ throw new Zend_Form_Exception('Invalid callback provided to callback decorator');
+ }
+ $this->_callback = $callback;
+ return $this;
+ }
+
+ /**
+ * Get registered callback
+ *
+ * If not previously registered, checks to see if it exists in registered
+ * options.
+ *
+ * @return null|string|array
+ */
+ public function getCallback()
+ {
+ if (null === $this->_callback) {
+ if (null !== ($callback = $this->getOption('callback'))) {
+ $this->setCallback($callback);
+ $this->removeOption('callback');
+ }
+ }
+
+ return $this->_callback;
+ }
+
+ /**
+ * Render
+ *
+ * If no callback registered, returns callback. Otherwise, gets return
+ * value of callback and either appends, prepends, or replaces passed in
+ * content.
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $callback = $this->getCallback();
+ if (null === $callback) {
+ return $content;
+ }
+
+ $placement = $this->getPlacement();
+ $separator = $this->getSeparator();
+
+ $response = call_user_func($callback, $content, $this->getElement(), $this->getOptions());
+
+ switch ($placement) {
+ case self::APPEND:
+ return $content . $separator . $response;
+ case self::PREPEND:
+ return $response . $separator . $content;
+ default:
+ // replace content
+ return $response;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Captcha.php b/library/vendor/Zend/Form/Decorator/Captcha.php
new file mode 100644
index 0000000..914189e
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Captcha.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** @see Zend_Form_Decorator_Abstract */
+
+/**
+ * Captcha generic decorator
+ *
+ * Adds captcha adapter output
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Captcha extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Render captcha
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ if (!method_exists($element, 'getCaptcha')) {
+ return $content;
+ }
+
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $placement = $this->getPlacement();
+ $separator = $this->getSeparator();
+
+ $captcha = $element->getCaptcha();
+ $markup = $captcha->render($view, $element);
+ switch ($placement) {
+ case 'PREPEND':
+ $content = $markup . $separator . $content;
+ break;
+ case 'APPEND':
+ default:
+ $content = $content . $separator . $markup;
+ }
+ return $content;
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Description.php b/library/vendor/Zend/Form/Decorator/Description.php
new file mode 100644
index 0000000..63dfdbc
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Description.php
@@ -0,0 +1,197 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Description
+ *
+ * Accepts the options:
+ * - separator: separator to use between label and content (defaults to PHP_EOL)
+ * - placement: whether to append or prepend label to content (defaults to prepend)
+ * - tag: if set, used to wrap the label in an additional HTML tag
+ * - class: if set, override default class used with HTML tag
+ * - escape: whether or not to escape description (true by default)
+ *
+ * Any other options passed will be used as HTML attributes of the HTML tag used.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Description extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Whether or not to escape the description
+ * @var bool
+ */
+ protected $_escape;
+
+ /**
+ * Default placement: append
+ * @var string
+ */
+ protected $_placement = 'APPEND';
+
+ /**
+ * HTML tag with which to surround description
+ * @var string
+ */
+ protected $_tag;
+
+ /**
+ * Set HTML tag with which to surround description
+ *
+ * @param string $tag
+ * @return Zend_Form_Decorator_Description
+ */
+ public function setTag($tag)
+ {
+ $this->_tag = (string) $tag;
+ return $this;
+ }
+
+ /**
+ * Get HTML tag, if any, with which to surround description
+ *
+ * @return string
+ */
+ public function getTag()
+ {
+ if (null === $this->_tag) {
+ $tag = $this->getOption('tag');
+ if (null !== $tag) {
+ $this->removeOption('tag');
+ } else {
+ $tag = 'p';
+ }
+
+ $this->setTag($tag);
+ return $tag;
+ }
+
+ return $this->_tag;
+ }
+
+ /**
+ * Get class with which to define description
+ *
+ * Defaults to 'hint'
+ *
+ * @return string
+ */
+ public function getClass()
+ {
+ $class = $this->getOption('class');
+ if (null === $class) {
+ $class = 'hint';
+ $this->setOption('class', $class);
+ }
+
+ return $class;
+ }
+
+ /**
+ * Set whether or not to escape description
+ *
+ * @param bool $flag
+ * @return Zend_Form_Decorator_Description
+ */
+ public function setEscape($flag)
+ {
+ $this->_escape = (bool) $flag;
+ return $this;
+ }
+
+ /**
+ * Get escape flag
+ *
+ * @return true
+ */
+ public function getEscape()
+ {
+ if (null === $this->_escape) {
+ if (null !== ($escape = $this->getOption('escape'))) {
+ $this->setEscape($escape);
+ $this->removeOption('escape');
+ } else {
+ $this->setEscape(true);
+ }
+ }
+
+ return $this->_escape;
+ }
+
+ /**
+ * Render a description
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $description = $element->getDescription();
+ $description = trim($description ?? '');
+
+ if (!empty($description) && (null !== ($translator = $element->getTranslator()))) {
+ $description = $translator->translate($description);
+ }
+
+ if (empty($description)) {
+ return $content;
+ }
+
+ $separator = $this->getSeparator();
+ $placement = $this->getPlacement();
+ $tag = $this->getTag();
+ $class = $this->getClass();
+ $escape = $this->getEscape();
+
+ $options = $this->getOptions();
+
+ if ($escape) {
+ $description = $view->escape($description);
+ }
+
+ if (!empty($tag)) {
+ $options['tag'] = $tag;
+ $decorator = new Zend_Form_Decorator_HtmlTag($options);
+ $description = $decorator->render($description);
+ }
+
+ switch ($placement) {
+ case self::PREPEND:
+ return $description . $separator . $content;
+ case self::APPEND:
+ default:
+ return $content . $separator . $description;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/DtDdWrapper.php b/library/vendor/Zend/Form/Decorator/DtDdWrapper.php
new file mode 100644
index 0000000..b569fab
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/DtDdWrapper.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_DtDdWrapper
+ *
+ * Creates an empty <dt> item, and wraps the content in a <dd>. Used as a
+ * default decorator for subforms and display groups.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_DtDdWrapper extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Default placement: surround content
+ * @var string
+ */
+ protected $_placement = null;
+
+ /**
+ * Render
+ *
+ * Renders as the following:
+ * <dt>$dtLabel</dt>
+ * <dd>$content</dd>
+ *
+ * $dtLabel can be set via 'dtLabel' option, defaults to '\&#160;'
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $elementName = $this->getElement()->getName();
+
+ $dtLabel = $this->getOption('dtLabel');
+ if( null === $dtLabel ) {
+ $dtLabel = '&#160;';
+ }
+
+ return '<dt id="' . $elementName . '-label">' . $dtLabel . '</dt>' .
+ '<dd id="' . $elementName . '-element">' . $content . '</dd>';
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Errors.php b/library/vendor/Zend/Form/Decorator/Errors.php
new file mode 100644
index 0000000..24fc3d9
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Errors.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Errors
+ *
+ * Any options passed will be used as HTML attributes of the ul tag for the errors.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Errors extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Render errors
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ // Get error messages
+ if ($element instanceof Zend_Form
+ && null !== $element->getElementsBelongTo()
+ ) {
+ $errors = $element->getMessages(null, true);
+ } else {
+ $errors = $element->getMessages();
+ }
+
+ if (empty($errors)) {
+ return $content;
+ }
+
+ $separator = $this->getSeparator();
+ $placement = $this->getPlacement();
+ $errors = $view->formErrors($errors, $this->getOptions());
+
+ switch ($placement) {
+ case self::APPEND:
+ return $content . $separator . $errors;
+ case self::PREPEND:
+ return $errors . $separator . $content;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Exception.php b/library/vendor/Zend/Form/Decorator/Exception.php
new file mode 100644
index 0000000..6d86f32
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Exception.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version $Id$
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Exception */
+
+/**
+ * Exception for Zend_Form component.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Form_Decorator_Exception extends Zend_Form_Exception
+{
+}
diff --git a/library/vendor/Zend/Form/Decorator/Fieldset.php b/library/vendor/Zend/Form/Decorator/Fieldset.php
new file mode 100644
index 0000000..036df2c
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Fieldset.php
@@ -0,0 +1,156 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Fieldset
+ *
+ * Any options passed will be used as HTML attributes of the fieldset tag.
+ *
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Fieldset extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Attribs that should be removed prior to rendering
+ * @var array
+ */
+ public $stripAttribs = array(
+ 'action',
+ 'enctype',
+ 'helper',
+ 'method',
+ 'name',
+ 'accept-charset',
+ );
+
+ /**
+ * Fieldset legend
+ * @var string
+ */
+ protected $_legend;
+
+ /**
+ * Default placement: surround content
+ * @var string
+ */
+ protected $_placement = null;
+
+ /**
+ * Get options
+ *
+ * Merges in element attributes as well.
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ $options = parent::getOptions();
+ if (null !== ($element = $this->getElement())) {
+ $attribs = $element->getAttribs();
+ $options = array_merge($attribs, $options);
+ $this->setOptions($options);
+ }
+ return $options;
+ }
+
+ /**
+ * Set legend
+ *
+ * @param string $value
+ * @return Zend_Form_Decorator_Fieldset
+ */
+ public function setLegend($value)
+ {
+ $this->_legend = (string) $value;
+ return $this;
+ }
+
+ /**
+ * Get legend
+ *
+ * @return string
+ */
+ public function getLegend()
+ {
+ $legend = $this->_legend;
+ if ((null === $legend) && (null !== ($element = $this->getElement()))) {
+ if (method_exists($element, 'getLegend')) {
+ $legend = $element->getLegend();
+ $this->setLegend($legend);
+ }
+ }
+ if ((null === $legend) && (null !== ($legend = $this->getOption('legend')))) {
+ $this->setLegend($legend);
+ $this->removeOption('legend');
+ }
+
+ return $legend;
+ }
+
+ /**
+ * Render a fieldset
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $legend = $this->getLegend();
+ $attribs = $this->getOptions();
+ $name = $element->getFullyQualifiedName();
+ $id = (string)$element->getId();
+
+ if ((!array_key_exists('id', $attribs) || $attribs['id'] == $id) && '' !== $id) {
+ $attribs['id'] = 'fieldset-' . $id;
+ }
+
+ if (null !== $legend) {
+ if (null !== ($translator = $element->getTranslator())) {
+ $legend = $translator->translate($legend);
+ }
+
+ $attribs['legend'] = $legend;
+ }
+
+ foreach (array_keys($attribs) as $attrib) {
+ $testAttrib = strtolower($attrib);
+ if (in_array($testAttrib, $this->stripAttribs)) {
+ unset($attribs[$attrib]);
+ }
+ }
+
+ return $view->fieldset($name, $content, $attribs);
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/File.php b/library/vendor/Zend/Form/Decorator/File.php
new file mode 100644
index 0000000..d7141de
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/File.php
@@ -0,0 +1,140 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/** Zend_Form_Decorator_Marker_File_Interface */
+
+/** Zend_File_Transfer_Adapter_Http */
+
+/**
+ * Zend_Form_Decorator_File
+ *
+ * Fixes the rendering for all subform and multi file elements
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_File
+ extends Zend_Form_Decorator_Abstract
+ implements Zend_Form_Decorator_Marker_File_Interface
+{
+ /**
+ * Attributes that should not be passed to helper
+ * @var array
+ */
+ protected $_attribBlacklist = array('helper', 'placement', 'separator', 'value');
+
+ /**
+ * Default placement: append
+ * @var string
+ */
+ protected $_placement = 'APPEND';
+
+ /**
+ * Get attributes to pass to file helper
+ *
+ * @return array
+ */
+ public function getAttribs()
+ {
+ $attribs = $this->getOptions();
+
+ if (null !== ($element = $this->getElement())) {
+ $attribs = array_merge($attribs, $element->getAttribs());
+ }
+
+ foreach ($this->_attribBlacklist as $key) {
+ if (array_key_exists($key, $attribs)) {
+ unset($attribs[$key]);
+ }
+ }
+
+ return $attribs;
+ }
+
+ /**
+ * Render a form file
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ if (!$element instanceof Zend_Form_Element) {
+ return $content;
+ }
+
+ $view = $element->getView();
+ if (!$view instanceof Zend_View_Interface) {
+ return $content;
+ }
+
+ $name = $element->getName();
+ $attribs = $this->getAttribs();
+ if (!array_key_exists('id', $attribs)) {
+ $attribs['id'] = $name;
+ }
+
+ $separator = $this->getSeparator();
+ $placement = $this->getPlacement();
+ $markup = array();
+ $size = $element->getMaxFileSize();
+ if ($size > 0) {
+ $element->setMaxFileSize(0);
+ $markup[] = $view->formHidden('MAX_FILE_SIZE', $size);
+ }
+
+ if (Zend_File_Transfer_Adapter_Http::isApcAvailable()) {
+ $markup[] = $view->formHidden(ini_get('apc.rfc1867_name'), uniqid(), array('id' => 'progress_key'));
+ } else if (Zend_File_Transfer_Adapter_Http::isUploadProgressAvailable()) {
+ $markup[] = $view->formHidden('UPLOAD_IDENTIFIER', uniqid(), array('id' => 'progress_key'));
+ }
+
+ $helper = $element->helper;
+ if ($element->isArray()) {
+ $name .= "[]";
+ $count = $element->getMultiFile();
+ for ($i = 0; $i < $count; ++$i) {
+ $htmlAttribs = $attribs;
+ $htmlAttribs['id'] .= '-' . $i;
+ $markup[] = $view->$helper($name, $htmlAttribs);
+ }
+ } else {
+ $markup[] = $view->$helper($name, $attribs);
+ }
+
+ $markup = implode($separator, $markup);
+
+ switch ($placement) {
+ case self::PREPEND:
+ return $markup . $separator . $content;
+ case self::APPEND:
+ default:
+ return $content . $separator . $markup;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Form.php b/library/vendor/Zend/Form/Decorator/Form.php
new file mode 100644
index 0000000..c885731
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Form.php
@@ -0,0 +1,133 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Form
+ *
+ * Render a Zend_Form object.
+ *
+ * Accepts following options:
+ * - separator: Separator to use between elements
+ * - helper: which view helper to use when rendering form. Should accept three
+ * arguments, string content, a name, and an array of attributes.
+ *
+ * Any other options passed will be used as HTML attributes of the form tag.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Form extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Default view helper
+ * @var string
+ */
+ protected $_helper = 'form';
+
+ /**
+ * Set view helper for rendering form
+ *
+ * @param string $helper
+ * @return Zend_Form_Decorator_Form
+ */
+ public function setHelper($helper)
+ {
+ $this->_helper = (string) $helper;
+ return $this;
+ }
+
+ /**
+ * Get view helper for rendering form
+ *
+ * @return string
+ */
+ public function getHelper()
+ {
+ if (null !== ($helper = $this->getOption('helper'))) {
+ $this->setHelper($helper);
+ $this->removeOption('helper');
+ }
+ return $this->_helper;
+ }
+
+ /**
+ * Retrieve decorator options
+ *
+ * Assures that form action and method are set, and sets appropriate
+ * encoding type if current method is POST.
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ if (null !== ($element = $this->getElement())) {
+ if ($element instanceof Zend_Form) {
+ $element->getAction();
+ $method = $element->getMethod();
+ if ($method == Zend_Form::METHOD_POST) {
+ $this->setOption('enctype', 'application/x-www-form-urlencoded');
+ }
+ foreach ($element->getAttribs() as $key => $value) {
+ $this->setOption($key, $value);
+ }
+ } elseif ($element instanceof Zend_Form_DisplayGroup) {
+ foreach ($element->getAttribs() as $key => $value) {
+ $this->setOption($key, $value);
+ }
+ }
+ }
+
+ if (isset($this->_options['method'])) {
+ $this->_options['method'] = strtolower($this->_options['method']);
+ }
+
+ return $this->_options;
+ }
+
+ /**
+ * Render a form
+ *
+ * Replaces $content entirely from currently set element.
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $form = $this->getElement();
+ $view = $form->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $helper = $this->getHelper();
+ $attribs = $this->getOptions();
+ $name = $form->getFullyQualifiedName();
+ $attribs['id'] = $form->getId();
+ return $view->$helper($name, $attribs, $content);
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/FormElements.php b/library/vendor/Zend/Form/Decorator/FormElements.php
new file mode 100644
index 0000000..c2fb136
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/FormElements.php
@@ -0,0 +1,140 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_FormElements
+ *
+ * Render all form elements registered with current form
+ *
+ * Accepts following options:
+ * - separator: Separator to use between elements
+ *
+ * Any other options passed will be used as HTML attributes of the form tag.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Merges given two belongsTo (array notation) strings
+ *
+ * @param string $baseBelongsTo
+ * @param string $belongsTo
+ * @return string
+ */
+ public function mergeBelongsTo($baseBelongsTo, $belongsTo)
+ {
+ $endOfArrayName = strpos($belongsTo, '[');
+
+ if ($endOfArrayName === false) {
+ return $baseBelongsTo . '[' . $belongsTo . ']';
+ }
+
+ $arrayName = substr($belongsTo, 0, $endOfArrayName);
+
+ return $baseBelongsTo . '[' . $arrayName . ']' . substr($belongsTo, $endOfArrayName);
+ }
+
+ /**
+ * Render form elements
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $form = $this->getElement();
+ if ((!$form instanceof Zend_Form) && (!$form instanceof Zend_Form_DisplayGroup)) {
+ return $content;
+ }
+
+ $belongsTo = ($form instanceof Zend_Form) ? $form->getElementsBelongTo() : null;
+ $elementContent = '';
+ $displayGroups = ($form instanceof Zend_Form) ? $form->getDisplayGroups() : array();
+ $separator = $this->getSeparator();
+ $translator = $form->getTranslator();
+ $items = array();
+ $view = $form->getView();
+ foreach ($form as $item) {
+ $item->setView($view);
+
+ // Set translator
+ if (!$item->hasTranslator()) {
+ $item->setTranslator($translator);
+ }
+
+ if ($item instanceof Zend_Form_Element) {
+ foreach ($displayGroups as $group) {
+ $elementName = $item->getName();
+ $element = $group->getElement($elementName);
+ if ($element) {
+ // Element belongs to display group; only render in that
+ // context.
+ continue 2;
+ }
+ }
+ $item->setBelongsTo($belongsTo);
+ } elseif (!empty($belongsTo) && ($item instanceof Zend_Form)) {
+ if ($item->isArray()) {
+ $name = $this->mergeBelongsTo($belongsTo, $item->getElementsBelongTo());
+ $item->setElementsBelongTo($name, true);
+ } else {
+ $item->setElementsBelongTo($belongsTo, true);
+ }
+ } elseif (!empty($belongsTo) && ($item instanceof Zend_Form_DisplayGroup)) {
+ foreach ($item as $element) {
+ $element->setBelongsTo($belongsTo);
+ }
+ }
+
+ $items[] = $item->render();
+
+ if (($item instanceof Zend_Form_Element_File)
+ || (($item instanceof Zend_Form)
+ && (Zend_Form::ENCTYPE_MULTIPART == $item->getEnctype()))
+ || (($item instanceof Zend_Form_DisplayGroup)
+ && (Zend_Form::ENCTYPE_MULTIPART == $item->getAttrib('enctype')))
+ ) {
+ if ($form instanceof Zend_Form) {
+ $form->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
+ } elseif ($form instanceof Zend_Form_DisplayGroup) {
+ $form->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART);
+ }
+ }
+ }
+ $elementContent = implode($separator, $items);
+
+ switch ($this->getPlacement()) {
+ case self::PREPEND:
+ return $elementContent . $separator . $content;
+ case self::APPEND:
+ default:
+ return $content . $separator . $elementContent;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/FormErrors.php b/library/vendor/Zend/Form/Decorator/FormErrors.php
new file mode 100644
index 0000000..70c9353
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/FormErrors.php
@@ -0,0 +1,514 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_FormErrors
+ *
+ * Displays all form errors in one view.
+ *
+ * Any options passed will be used as HTML attributes of the ul tag for the errors.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_FormErrors extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Default values for markup options
+ * @var array
+ */
+ protected $_defaults = array(
+ 'ignoreSubForms' => false,
+ 'showCustomFormErrors' => true,
+ 'onlyCustomFormErrors' => false,
+ 'markupElementLabelEnd' => '</b>',
+ 'markupElementLabelStart' => '<b>',
+ 'markupListEnd' => '</ul>',
+ 'markupListItemEnd' => '</li>',
+ 'markupListItemStart' => '<li>',
+ 'markupListStart' => '<ul class="form-errors">',
+ );
+
+ /**#@+
+ * Markup options
+ * @var string
+ */
+ protected $_ignoreSubForms;
+ protected $_showCustomFormErrors;
+ protected $_onlyCustomFormErrors;
+ protected $_markupElementLabelEnd;
+ protected $_markupElementLabelStart;
+ protected $_markupListEnd;
+ protected $_markupListItemEnd;
+ protected $_markupListItemStart;
+ protected $_markupListStart;
+ /**#@-*/
+
+ /**
+ * Whether or not to escape error label and error message
+ * @var bool
+ */
+ protected $_escape;
+
+ /**
+ * Render errors
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $form = $this->getElement();
+ if (!$form instanceof Zend_Form) {
+ return $content;
+ }
+
+ $view = $form->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $this->initOptions();
+ $markup = $this->_recurseForm($form, $view);
+
+ if (empty($markup)) {
+ return $content;
+ }
+
+ $markup = $this->getMarkupListStart()
+ . $markup
+ . $this->getMarkupListEnd();
+
+ switch ($this->getPlacement()) {
+ case self::APPEND:
+ return $content . $this->getSeparator() . $markup;
+ case self::PREPEND:
+ return $markup . $this->getSeparator() . $content;
+ }
+ }
+
+ /**
+ * Initialize options
+ *
+ * @return void
+ */
+ public function initOptions()
+ {
+ $this->getMarkupElementLabelEnd();
+ $this->getMarkupElementLabelStart();
+ $this->getMarkupListEnd();
+ $this->getMarkupListItemEnd();
+ $this->getMarkupListItemStart();
+ $this->getMarkupListStart();
+ $this->getPlacement();
+ $this->getSeparator();
+ $this->ignoreSubForms();
+ $this->getShowCustomFormErrors();
+ $this->getOnlyCustomFormErrors();
+ }
+
+ /**
+ * Retrieve markupElementLabelStart
+ *
+ * @return string
+ */
+ public function getMarkupElementLabelStart()
+ {
+ if (null === $this->_markupElementLabelStart) {
+ if (null === ($markupElementLabelStart = $this->getOption('markupElementLabelStart'))) {
+ $this->setMarkupElementLabelStart($this->_defaults['markupElementLabelStart']);
+ } else {
+ $this->setMarkupElementLabelStart($markupElementLabelStart);
+ $this->removeOption('markupElementLabelStart');
+ }
+ }
+
+ return $this->_markupElementLabelStart;
+ }
+
+ /**
+ * Set markupElementLabelStart
+ *
+ * @param string $markupElementLabelStart
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setMarkupElementLabelStart($markupElementLabelStart)
+ {
+ $this->_markupElementLabelStart = $markupElementLabelStart;
+ return $this;
+ }
+
+ /**
+ * Retrieve markupElementLabelEnd
+ *
+ * @return string
+ */
+ public function getMarkupElementLabelEnd()
+ {
+ if (null === $this->_markupElementLabelEnd) {
+ if (null === ($markupElementLabelEnd = $this->getOption('markupElementLabelEnd'))) {
+ $this->setMarkupElementLabelEnd($this->_defaults['markupElementLabelEnd']);
+ } else {
+ $this->setMarkupElementLabelEnd($markupElementLabelEnd);
+ $this->removeOption('markupElementLabelEnd');
+ }
+ }
+
+ return $this->_markupElementLabelEnd;
+ }
+
+ /**
+ * Set markupElementLabelEnd
+ *
+ * @param string $markupElementLabelEnd
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setMarkupElementLabelEnd($markupElementLabelEnd)
+ {
+ $this->_markupElementLabelEnd = $markupElementLabelEnd;
+ return $this;
+ }
+
+ /**
+ * Retrieve markupListStart
+ *
+ * @return string
+ */
+ public function getMarkupListStart()
+ {
+ if (null === $this->_markupListStart) {
+ if (null === ($markupListStart = $this->getOption('markupListStart'))) {
+ $this->setMarkupListStart($this->_defaults['markupListStart']);
+ } else {
+ $this->setMarkupListStart($markupListStart);
+ $this->removeOption('markupListStart');
+ }
+ }
+
+ return $this->_markupListStart;
+ }
+
+ /**
+ * Set markupListStart
+ *
+ * @param string $markupListStart
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setMarkupListStart($markupListStart)
+ {
+ $this->_markupListStart = $markupListStart;
+ return $this;
+ }
+
+ /**
+ * Retrieve markupListEnd
+ *
+ * @return string
+ */
+ public function getMarkupListEnd()
+ {
+ if (null === $this->_markupListEnd) {
+ if (null === ($markupListEnd = $this->getOption('markupListEnd'))) {
+ $this->setMarkupListEnd($this->_defaults['markupListEnd']);
+ } else {
+ $this->setMarkupListEnd($markupListEnd);
+ $this->removeOption('markupListEnd');
+ }
+ }
+
+ return $this->_markupListEnd;
+ }
+
+ /**
+ * Set markupListEnd
+ *
+ * @param string $markupListEnd
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setMarkupListEnd($markupListEnd)
+ {
+ $this->_markupListEnd = $markupListEnd;
+ return $this;
+ }
+
+ /**
+ * Retrieve markupListItemStart
+ *
+ * @return string
+ */
+ public function getMarkupListItemStart()
+ {
+ if (null === $this->_markupListItemStart) {
+ if (null === ($markupListItemStart = $this->getOption('markupListItemStart'))) {
+ $this->setMarkupListItemStart($this->_defaults['markupListItemStart']);
+ } else {
+ $this->setMarkupListItemStart($markupListItemStart);
+ $this->removeOption('markupListItemStart');
+ }
+ }
+
+ return $this->_markupListItemStart;
+ }
+
+ /**
+ * Set markupListItemStart
+ *
+ * @param string $markupListItemStart
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setMarkupListItemStart($markupListItemStart)
+ {
+ $this->_markupListItemStart = $markupListItemStart;
+ return $this;
+ }
+
+ /**
+ * Retrieve markupListItemEnd
+ *
+ * @return string
+ */
+ public function getMarkupListItemEnd()
+ {
+ if (null === $this->_markupListItemEnd) {
+ if (null === ($markupListItemEnd = $this->getOption('markupListItemEnd'))) {
+ $this->setMarkupListItemEnd($this->_defaults['markupListItemEnd']);
+ } else {
+ $this->setMarkupListItemEnd($markupListItemEnd);
+ $this->removeOption('markupListItemEnd');
+ }
+ }
+
+ return $this->_markupListItemEnd;
+ }
+
+ /**
+ * Set markupListItemEnd
+ *
+ * @param string $markupListItemEnd
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setMarkupListItemEnd($markupListItemEnd)
+ {
+ $this->_markupListItemEnd = $markupListItemEnd;
+ return $this;
+ }
+
+ /**
+ * Retrieve ignoreSubForms
+ *
+ * @return bool
+ */
+ public function ignoreSubForms()
+ {
+ if (null === $this->_ignoreSubForms) {
+ if (null === ($ignoreSubForms = $this->getOption('ignoreSubForms'))) {
+ $this->setIgnoreSubForms($this->_defaults['ignoreSubForms']);
+ } else {
+ $this->setIgnoreSubForms($ignoreSubForms);
+ $this->removeOption('ignoreSubForms');
+ }
+ }
+
+ return $this->_ignoreSubForms;
+ }
+
+ /**
+ * Set ignoreSubForms
+ *
+ * @param bool $ignoreSubForms
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setIgnoreSubForms($ignoreSubForms)
+ {
+ $this->_ignoreSubForms = (bool) $ignoreSubForms;
+ return $this;
+ }
+
+ /**
+ * Get showCustomFormErrors
+ *
+ * @return bool
+ */
+ public function getShowCustomFormErrors()
+ {
+ if (null === $this->_showCustomFormErrors) {
+ if (null === ($show = $this->getOption('showCustomFormErrors'))) {
+ $this->setShowCustomFormErrors($this->_defaults['showCustomFormErrors']);
+ } else {
+ $this->setShowCustomFormErrors($show);
+ $this->removeOption('showCustomFormErrors');
+ }
+ }
+ return $this->_showCustomFormErrors;
+ }
+
+ /**
+ * Set showCustomFormErrors
+ *
+ * @param bool $showCustomFormErrors
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setShowCustomFormErrors($showCustomFormErrors)
+ {
+ $this->_showCustomFormErrors = (bool)$showCustomFormErrors;
+ return $this;
+ }
+
+ /**
+ * Get onlyCustomFormErrors
+ *
+ * @return bool
+ */
+ public function getOnlyCustomFormErrors()
+ {
+ if (null === $this->_onlyCustomFormErrors) {
+ if (null === ($show = $this->getOption('onlyCustomFormErrors'))) {
+ $this->setOnlyCustomFormErrors($this->_defaults['onlyCustomFormErrors']);
+ } else {
+ $this->setOnlyCustomFormErrors($show);
+ $this->removeOption('onlyCustomFormErrors');
+ }
+ }
+ return $this->_onlyCustomFormErrors;
+ }
+
+ /**
+ * Set onlyCustomFormErrors, whether to display elements messages
+ * in addition to custom form messages.
+ *
+ * @param bool $onlyCustomFormErrors
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setOnlyCustomFormErrors($onlyCustomFormErrors)
+ {
+ $this->_onlyCustomFormErrors = (bool)$onlyCustomFormErrors;
+ return $this;
+ }
+
+ /**
+ * Set whether or not to escape error label and error message
+ *
+ * Sets also the 'escape' option for the view helper
+ *
+ * @param bool $flag
+ * @return Zend_Form_Decorator_FormErrors
+ */
+ public function setEscape($flag)
+ {
+ $this->_escape = (bool) $flag;
+
+ // Set also option for view helper
+ $this->setOption('escape', $this->_escape);
+ return $this;
+ }
+
+ /**
+ * Get escape flag
+ *
+ * @return bool
+ */
+ public function getEscape()
+ {
+ if (null === $this->_escape) {
+ if (null !== ($escape = $this->getOption('escape'))) {
+ $this->setEscape($escape);
+ } else {
+ $this->setEscape(true);
+ }
+ }
+
+ return $this->_escape;
+ }
+
+ /**
+ * Render element label
+ *
+ * @param Zend_Form_Element $element
+ * @param Zend_View_Interface $view
+ * @return string
+ */
+ public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
+ {
+ $label = $element->getLabel();
+ if (empty($label)) {
+ $label = $element->getName();
+
+ // Translate element name
+ if (null !== ($translator = $element->getTranslator())) {
+ $label = $translator->translate($label);
+ }
+ }
+
+ if ($this->getEscape()) {
+ $label = $view->escape($label);
+ }
+
+ return $this->getMarkupElementLabelStart()
+ . $label
+ . $this->getMarkupElementLabelEnd();
+ }
+
+ /**
+ * Recurse through a form object, rendering errors
+ *
+ * @param Zend_Form $form
+ * @param Zend_View_Interface $view
+ * @return string
+ */
+ protected function _recurseForm(Zend_Form $form, Zend_View_Interface $view)
+ {
+ $content = '';
+
+ $custom = $form->getCustomMessages();
+ if ($this->getShowCustomFormErrors() && count($custom)) {
+ $content .= $this->getMarkupListItemStart()
+ . $view->formErrors($custom, $this->getOptions())
+ . $this->getMarkupListItemEnd();
+ }
+ foreach ($form->getElementsAndSubFormsOrdered() as $subitem) {
+ if ($subitem instanceof Zend_Form_Element && !$this->getOnlyCustomFormErrors()) {
+ $messages = $subitem->getMessages();
+ if (count($messages)) {
+ $subitem->setView($view);
+ $content .= $this->getMarkupListItemStart()
+ . $this->renderLabel($subitem, $view)
+ . $view->formErrors($messages, $this->getOptions())
+ . $this->getMarkupListItemEnd();
+ }
+ } else if ($subitem instanceof Zend_Form && !$this->ignoreSubForms()) {
+ $markup = $this->_recurseForm($subitem, $view);
+
+ if (!empty($markup)) {
+ $content .= $this->getMarkupListStart()
+ . $markup
+ . $this->getMarkupListEnd();
+ }
+ }
+ }
+ return $content;
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/HtmlTag.php b/library/vendor/Zend/Form/Decorator/HtmlTag.php
new file mode 100644
index 0000000..47b9e21
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/HtmlTag.php
@@ -0,0 +1,253 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Form_Decorator_Abstract
+ */
+
+/**
+ * Zend_Form_Decorator_Element_HtmlTag
+ *
+ * Wraps content in an HTML block tag.
+ *
+ * Options accepted are:
+ * - tag: tag to use in decorator
+ * - noAttribs: do not render attributes in the opening tag
+ * - placement: 'append' or 'prepend'. If 'append', renders opening and
+ * closing tag after content; if prepend, renders opening and closing tag
+ * before content.
+ * - openOnly: render opening tag only
+ * - closeOnly: render closing tag only
+ *
+ * Any other options passed are processed as HTML attributes of the tag.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_HtmlTag extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Character encoding to use when escaping attributes
+ * @var string
+ */
+ protected $_encoding;
+
+ /**
+ * Placement; default to surround content
+ * @var string
+ */
+ protected $_placement = null;
+
+ /**
+ * HTML tag to use
+ * @var string
+ */
+ protected $_tag;
+
+ /**
+ * @var Zend_Filter
+ */
+ protected $_tagFilter;
+
+ /**
+ * Convert options to tag attributes
+ *
+ * @return string
+ */
+ protected function _htmlAttribs(array $attribs)
+ {
+ $xhtml = '';
+ $enc = $this->_getEncoding();
+ foreach ((array) $attribs as $key => $val) {
+ $key = htmlspecialchars($key, ENT_COMPAT, $enc);
+ if (is_array($val)) {
+ if (array_key_exists('callback', $val)
+ && is_callable($val['callback'])
+ ) {
+ $val = call_user_func($val['callback'], $this);
+ } else {
+ $val = implode(' ', $val);
+ }
+ }
+ $val = htmlspecialchars($val ?? '', ENT_COMPAT, $enc);
+ $xhtml .= " $key=\"$val\"";
+ }
+ return $xhtml;
+ }
+
+ /**
+ * Normalize tag
+ *
+ * Ensures tag is alphanumeric characters only, and all lowercase.
+ *
+ * @param string $tag
+ * @return string
+ */
+ public function normalizeTag($tag)
+ {
+ if (!isset($this->_tagFilter)) {
+ $this->_tagFilter = new Zend_Filter();
+ $this->_tagFilter->addFilter(new Zend_Filter_Alnum())
+ ->addFilter(new Zend_Filter_StringToLower());
+ }
+ return $this->_tagFilter->filter($tag);
+ }
+
+ /**
+ * Set tag to use
+ *
+ * @param string $tag
+ * @return Zend_Form_Decorator_HtmlTag
+ */
+ public function setTag($tag)
+ {
+ $this->_tag = $this->normalizeTag($tag);
+ return $this;
+ }
+
+ /**
+ * Get tag
+ *
+ * If no tag is registered, either via setTag() or as an option, uses 'div'.
+ *
+ * @return string
+ */
+ public function getTag()
+ {
+ if (null === $this->_tag) {
+ if (null === ($tag = $this->getOption('tag'))) {
+ $this->setTag('div');
+ } else {
+ $this->setTag($tag);
+ $this->removeOption('tag');
+ }
+ }
+
+ return $this->_tag;
+ }
+
+ /**
+ * Get the formatted open tag
+ *
+ * @param string $tag
+ * @param array $attribs
+ * @return string
+ */
+ protected function _getOpenTag($tag, array $attribs = null)
+ {
+ $html = '<' . $tag;
+ if (null !== $attribs) {
+ $html .= $this->_htmlAttribs($attribs);
+ }
+ $html .= '>';
+ return $html;
+ }
+
+ /**
+ * Get formatted closing tag
+ *
+ * @param string $tag
+ * @return string
+ */
+ protected function _getCloseTag($tag)
+ {
+ return '</' . $tag . '>';
+ }
+
+ /**
+ * Render content wrapped in an HTML tag
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $tag = $this->getTag();
+ $placement = $this->getPlacement();
+ $noAttribs = $this->getOption('noAttribs');
+ $openOnly = $this->getOption('openOnly');
+ $closeOnly = $this->getOption('closeOnly');
+ $this->removeOption('noAttribs');
+ $this->removeOption('openOnly');
+ $this->removeOption('closeOnly');
+
+ $attribs = null;
+ if (!$noAttribs) {
+ $attribs = $this->getOptions();
+ }
+
+ switch ($placement) {
+ case self::APPEND:
+ if ($closeOnly) {
+ return $content . $this->_getCloseTag($tag);
+ }
+ if ($openOnly) {
+ return $content . $this->_getOpenTag($tag, $attribs);
+ }
+ return $content
+ . $this->_getOpenTag($tag, $attribs)
+ . $this->_getCloseTag($tag);
+ case self::PREPEND:
+ if ($closeOnly) {
+ return $this->_getCloseTag($tag) . $content;
+ }
+ if ($openOnly) {
+ return $this->_getOpenTag($tag, $attribs) . $content;
+ }
+ return $this->_getOpenTag($tag, $attribs)
+ . $this->_getCloseTag($tag)
+ . $content;
+ default:
+ return (($openOnly || !$closeOnly) ? $this->_getOpenTag($tag, $attribs) : '')
+ . $content
+ . (($closeOnly || !$openOnly) ? $this->_getCloseTag($tag) : '');
+ }
+ }
+
+ /**
+ * Get encoding for use with htmlspecialchars()
+ *
+ * @return string
+ */
+ protected function _getEncoding()
+ {
+ if (null !== $this->_encoding) {
+ return $this->_encoding;
+ }
+
+ if (null === ($element = $this->getElement())) {
+ $this->_encoding = 'UTF-8';
+ } elseif (null === ($view = $element->getView())) {
+ $this->_encoding = 'UTF-8';
+ } elseif (!$view instanceof Zend_View_Abstract
+ && !method_exists($view, 'getEncoding')
+ ) {
+ $this->_encoding = 'UTF-8';
+ } else {
+ $this->_encoding = $view->getEncoding();
+ }
+ return $this->_encoding;
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Image.php b/library/vendor/Zend/Form/Decorator/Image.php
new file mode 100644
index 0000000..4ec01c1
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Image.php
@@ -0,0 +1,152 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Image
+ *
+ * Accepts the options:
+ * - separator: separator to use between image and content (defaults to PHP_EOL)
+ * - placement: whether to append or prepend label to content (defaults to append)
+ * - tag: if set, used to wrap the label in an additional HTML tag
+ *
+ * Any other options passed will be used as HTML attributes of the image tag.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Image extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Attributes that should not be passed to helper
+ * @var array
+ */
+ protected $_attribBlacklist = array('helper', 'placement', 'separator', 'tag');
+
+ /**
+ * Default placement: append
+ * @var string
+ */
+ protected $_placement = 'APPEND';
+
+ /**
+ * HTML tag with which to surround image
+ * @var string
+ */
+ protected $_tag;
+
+ /**
+ * Set HTML tag with which to surround label
+ *
+ * @param string $tag
+ * @return Zend_Form_Decorator_Image
+ */
+ public function setTag($tag)
+ {
+ $this->_tag = (string) $tag;
+ return $this;
+ }
+
+ /**
+ * Get HTML tag, if any, with which to surround label
+ *
+ * @return void
+ */
+ public function getTag()
+ {
+ if (null === $this->_tag) {
+ $tag = $this->getOption('tag');
+ if (null !== $tag) {
+ $this->removeOption('tag');
+ $this->setTag($tag);
+ }
+ return $tag;
+ }
+
+ return $this->_tag;
+ }
+
+ /**
+ * Get attributes to pass to image helper
+ *
+ * @return array
+ */
+ public function getAttribs()
+ {
+ $attribs = $this->getOptions();
+
+ if (null !== ($element = $this->getElement())) {
+ $attribs['alt'] = $element->getLabel();
+ $attribs = array_merge($attribs, $element->getAttribs());
+ }
+
+ foreach ($this->_attribBlacklist as $key) {
+ if (array_key_exists($key, $attribs)) {
+ unset($attribs[$key]);
+ }
+ }
+
+ return $attribs;
+ }
+
+ /**
+ * Render a form image
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $tag = $this->getTag();
+ $placement = $this->getPlacement();
+ $separator = $this->getSeparator();
+ $name = $element->getFullyQualifiedName();
+ $attribs = $this->getAttribs();
+ $attribs['id'] = $element->getId();
+
+ $image = $view->formImage($name, $element->getImageValue(), $attribs);
+
+ if (null !== $tag) {
+ $decorator = new Zend_Form_Decorator_HtmlTag();
+ $decorator->setOptions(array('tag' => $tag));
+ $image = $decorator->render($image);
+ }
+
+ switch ($placement) {
+ case self::PREPEND:
+ return $image . $separator . $content;
+ case self::APPEND:
+ default:
+ return $content . $separator . $image;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Interface.php b/library/vendor/Zend/Form/Decorator/Interface.php
new file mode 100644
index 0000000..5cc1171
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Interface.php
@@ -0,0 +1,123 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * Zend_Form_Decorator_Interface
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+interface Zend_Form_Decorator_Interface
+{
+ /**
+ * Constructor
+ *
+ * Accept options during initialization.
+ *
+ * @param array|Zend_Config $options
+ * @return void
+ */
+ public function __construct($options = null);
+
+ /**
+ * Set an element to decorate
+ *
+ * While the name is "setElement", a form decorator could decorate either
+ * an element or a form object.
+ *
+ * @param mixed $element
+ * @return Zend_Form_Decorator_Interface
+ */
+ public function setElement($element);
+
+ /**
+ * Retrieve current element
+ *
+ * @return mixed
+ */
+ public function getElement();
+
+ /**
+ * Set decorator options from an array
+ *
+ * @param array $options
+ * @return Zend_Form_Decorator_Interface
+ */
+ public function setOptions(array $options);
+
+ /**
+ * Set decorator options from a config object
+ *
+ * @param Zend_Config $config
+ * @return Zend_Form_Decorator_Interface
+ */
+ public function setConfig(Zend_Config $config);
+
+ /**
+ * Set a single option
+ *
+ * @param string $key
+ * @param mixed $value
+ * @return Zend_Form_Decorator_Interface
+ */
+ public function setOption($key, $value);
+
+ /**
+ * Retrieve a single option
+ *
+ * @param string $key
+ * @return mixed
+ */
+ public function getOption($key);
+
+ /**
+ * Retrieve decorator options
+ *
+ * @return array
+ */
+ public function getOptions();
+
+ /**
+ * Delete a single option
+ *
+ * @param string $key
+ * @return bool
+ */
+ public function removeOption($key);
+
+ /**
+ * Clear all options
+ *
+ * @return Zend_Form_Decorator_Interface
+ */
+ public function clearOptions();
+
+ /**
+ * Render the element
+ *
+ * @param string $content Content to decorate
+ * @return string
+ */
+ public function render($content);
+}
diff --git a/library/vendor/Zend/Form/Decorator/Label.php b/library/vendor/Zend/Form/Decorator/Label.php
new file mode 100644
index 0000000..c70c61e
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Label.php
@@ -0,0 +1,461 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Label
+ *
+ * Accepts the options:
+ * - separator: separator to use between label and content (defaults to PHP_EOL)
+ * - placement: whether to append or prepend label to content (defaults to prepend)
+ * - tag: if set, used to wrap the label in an additional HTML tag
+ * - tagClass: if tag option is set, used to add a class to the label wrapper
+ * - opt(ional)Prefix: a prefix to the label to use when the element is optional
+ * - opt(ional)Suffix: a suffix to the label to use when the element is optional
+ * - req(uired)Prefix: a prefix to the label to use when the element is required
+ * - req(uired)Suffix: a suffix to the label to use when the element is required
+ *
+ * Any other options passed will be used as HTML attributes of the label tag.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Placement constants
+ */
+ const IMPLICIT = 'IMPLICIT';
+ const IMPLICIT_PREPEND = 'IMPLICIT_PREPEND';
+ const IMPLICIT_APPEND = 'IMPLICIT_APPEND';
+
+ /**
+ * Default placement: prepend
+ * @var string
+ */
+ protected $_placement = 'PREPEND';
+
+ /**
+ * HTML tag with which to surround label
+ * @var string
+ */
+ protected $_tag;
+
+ /**
+ * Class for the HTML tag with which to surround label
+ * @var string
+ */
+ protected $_tagClass;
+
+ /**
+ * Set element ID
+ *
+ * @param string $id
+ * @return Zend_Form_Decorator_Label
+ */
+ public function setId($id)
+ {
+ $this->setOption('id', $id);
+ return $this;
+ }
+
+ /**
+ * Retrieve element ID (used in 'for' attribute)
+ *
+ * If none set in decorator, looks first for element 'id' attribute, and
+ * defaults to element name.
+ *
+ * @return string
+ */
+ public function getId()
+ {
+ $id = $this->getOption('id');
+ if (null === $id) {
+ if (null !== ($element = $this->getElement())) {
+ $id = $element->getId();
+ $this->setId($id);
+ }
+ }
+
+ return $id;
+ }
+
+ /**
+ * Set HTML tag with which to surround label
+ *
+ * @param string $tag
+ * @return Zend_Form_Decorator_Label
+ */
+ public function setTag($tag)
+ {
+ if (empty($tag)) {
+ $this->_tag = null;
+ } else {
+ $this->_tag = (string) $tag;
+ }
+
+ $this->removeOption('tag');
+
+ return $this;
+ }
+
+ /**
+ * Get HTML tag, if any, with which to surround label
+ *
+ * @return string
+ */
+ public function getTag()
+ {
+ if (null === $this->_tag) {
+ $tag = $this->getOption('tag');
+ if (null !== $tag) {
+ $this->removeOption('tag');
+ $this->setTag($tag);
+ }
+ return $tag;
+ }
+
+ return $this->_tag;
+ }
+
+ /**
+ * Set the class to apply to the HTML tag with which to surround label
+ *
+ * @param string $tagClass
+ * @return Zend_Form_Decorator_Label
+ */
+ public function setTagClass($tagClass)
+ {
+ if (empty($tagClass)) {
+ $this->_tagClass = null;
+ } else {
+ $this->_tagClass = (string) $tagClass;
+ }
+
+ $this->removeOption('tagClass');
+
+ return $this;
+ }
+
+ /**
+ * Get the class to apply to the HTML tag, if any, with which to surround label
+ *
+ * @return void
+ */
+ public function getTagClass()
+ {
+ if (null === $this->_tagClass) {
+ $tagClass = $this->getOption('tagClass');
+ if (null !== $tagClass) {
+ $this->removeOption('tagClass');
+ $this->setTagClass($tagClass);
+ }
+ }
+
+ return $this->_tagClass;
+ }
+
+ /**
+ * Get class with which to define label
+ *
+ * Appends either 'optional' or 'required' to class, depending on whether
+ * or not the element is required.
+ *
+ * @return string
+ */
+ public function getClass()
+ {
+ $class = '';
+ $element = $this->getElement();
+
+ $decoratorClass = $this->getOption('class');
+ if (!empty($decoratorClass)) {
+ $class .= ' ' . $decoratorClass;
+ }
+
+ $type = $element->isRequired() ? 'required' : 'optional';
+
+ if (!strstr($class, $type)) {
+ $class .= ' ' . $type;
+ $class = trim($class);
+ }
+
+ return $class;
+ }
+
+ /**
+ * Load an optional/required suffix/prefix key
+ *
+ * @param string $key
+ * @return void
+ */
+ protected function _loadOptReqKey($key)
+ {
+ if (!isset($this->$key)) {
+ $value = $this->getOption($key);
+ $this->$key = (string) $value;
+ if (null !== $value) {
+ $this->removeOption($key);
+ }
+ }
+ }
+
+ /**
+ * Overloading
+ *
+ * Currently overloads:
+ *
+ * - getOpt(ional)Prefix()
+ * - getOpt(ional)Suffix()
+ * - getReq(uired)Prefix()
+ * - getReq(uired)Suffix()
+ * - setOpt(ional)Prefix()
+ * - setOpt(ional)Suffix()
+ * - setReq(uired)Prefix()
+ * - setReq(uired)Suffix()
+ *
+ * @param string $method
+ * @param array $args
+ * @return mixed
+ * @throws Zend_Form_Exception for unsupported methods
+ */
+ public function __call($method, $args)
+ {
+ $tail = substr($method, -6);
+ $head = substr($method, 0, 3);
+ if (in_array($head, array('get', 'set'))
+ && (('Prefix' == $tail) || ('Suffix' == $tail))
+ ) {
+ $position = substr($method, -6);
+ $type = strtolower(substr($method, 3, 3));
+ switch ($type) {
+ case 'req':
+ $key = 'required' . $position;
+ break;
+ case 'opt':
+ $key = 'optional' . $position;
+ break;
+ default:
+ throw new Zend_Form_Exception(sprintf('Invalid method "%s" called in Label decorator, and detected as type %s', $method, $type));
+ }
+
+ switch ($head) {
+ case 'set':
+ if (0 === count($args)) {
+ throw new Zend_Form_Exception(sprintf('Method "%s" requires at least one argument; none provided', $method));
+ }
+ $value = array_shift($args);
+ $this->$key = $value;
+ return $this;
+ case 'get':
+ default:
+ if (null === ($element = $this->getElement())) {
+ $this->_loadOptReqKey($key);
+ } elseif (isset($element->$key)) {
+ $this->$key = (string) $element->$key;
+ } else {
+ $this->_loadOptReqKey($key);
+ }
+ return $this->$key;
+ }
+ }
+
+ throw new Zend_Form_Exception(sprintf('Invalid method "%s" called in Label decorator', $method));
+ }
+
+ /**
+ * Get label to render
+ *
+ * @return string
+ */
+ public function getLabel()
+ {
+ if (null === ($element = $this->getElement())) {
+ return '';
+ }
+
+ $label = $element->getLabel();
+ $label = trim($label ?? '');
+
+ if (empty($label)) {
+ return '';
+ }
+
+ $optPrefix = $this->getOptPrefix();
+ $optSuffix = $this->getOptSuffix();
+ $reqPrefix = $this->getReqPrefix();
+ $reqSuffix = $this->getReqSuffix();
+ $separator = $this->getSeparator();
+
+ if (!empty($label)) {
+ if ($element->isRequired()) {
+ $label = $reqPrefix . $label . $reqSuffix;
+ } else {
+ $label = $optPrefix . $label . $optSuffix;
+ }
+ }
+
+ return $label;
+ }
+
+ /**
+ * Determine if label should append, prepend or implicit content
+ *
+ * @return string
+ */
+ public function getPlacement()
+ {
+ $placement = $this->_placement;
+ if (null !== ($placementOpt = $this->getOption('placement'))) {
+ $placementOpt = strtoupper($placementOpt);
+ switch ($placementOpt) {
+ case self::APPEND:
+ case self::PREPEND:
+ case self::IMPLICIT:
+ case self::IMPLICIT_PREPEND:
+ case self::IMPLICIT_APPEND:
+ $placement = $this->_placement = $placementOpt;
+ break;
+ case false:
+ $placement = $this->_placement = null;
+ break;
+ default:
+ break;
+ }
+ $this->removeOption('placement');
+ }
+
+ return $placement;
+ }
+
+ /**
+ * Render a label
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $label = $this->getLabel();
+ $separator = $this->getSeparator();
+ $placement = $this->getPlacement();
+ $tag = $this->getTag();
+ $tagClass = $this->getTagClass();
+ $id = $this->getId();
+ $class = $this->getClass();
+ $options = $this->getOptions();
+
+
+ if (empty($label) && empty($tag)) {
+ return $content;
+ }
+
+ if (!empty($label)) {
+ $options['class'] = $class;
+ $label = trim($label);
+
+ switch ($placement) {
+ case self::IMPLICIT:
+ // Break was intentionally omitted
+
+ case self::IMPLICIT_PREPEND:
+ $options['escape'] = false;
+ $options['disableFor'] = true;
+
+ $label = $view->formLabel(
+ $element->getFullyQualifiedName(),
+ $label . $separator . $content,
+ $options
+ );
+ break;
+
+ case self::IMPLICIT_APPEND:
+ $options['escape'] = false;
+ $options['disableFor'] = true;
+
+ $label = $view->formLabel(
+ $element->getFullyQualifiedName(),
+ $content . $separator . $label,
+ $options
+ );
+ break;
+
+ case self::APPEND:
+ // Break was intentionally omitted
+
+ case self::PREPEND:
+ // Break was intentionally omitted
+
+ default:
+ $label = $view->formLabel(
+ $element->getFullyQualifiedName(),
+ $label,
+ $options
+ );
+ break;
+ }
+ } else {
+ $label = '&#160;';
+ }
+
+ if (null !== $tag) {
+ $decorator = new Zend_Form_Decorator_HtmlTag();
+ if (null !== $this->_tagClass) {
+ $decorator->setOptions(array('tag' => $tag,
+ 'id' => $id . '-label',
+ 'class' => $tagClass));
+ } else {
+ $decorator->setOptions(array('tag' => $tag,
+ 'id' => $id . '-label'));
+ }
+
+ $label = $decorator->render($label);
+ }
+
+ switch ($placement) {
+ case self::APPEND:
+ return $content . $separator . $label;
+
+ case self::PREPEND:
+ return $label . $separator . $content;
+
+ case self::IMPLICIT:
+ // Break was intentionally omitted
+
+ case self::IMPLICIT_PREPEND:
+ // Break was intentionally omitted
+
+ case self::IMPLICIT_APPEND:
+ return $label;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Marker/File/Interface.php b/library/vendor/Zend/Form/Decorator/Marker/File/Interface.php
new file mode 100644
index 0000000..40a4fe7
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Marker/File/Interface.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * Zend_Form_Decorator_Marker_File_Interface
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+interface Zend_Form_Decorator_Marker_File_Interface
+{
+}
diff --git a/library/vendor/Zend/Form/Decorator/PrepareElements.php b/library/vendor/Zend/Form/Decorator/PrepareElements.php
new file mode 100644
index 0000000..52ed93c
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/PrepareElements.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_FormElements */
+
+/**
+ * Zend_Form_Decorator_PrepareElements
+ *
+ * Render all form elements registered with current form
+ *
+ * Accepts following options:
+ * - separator: Separator to use between elements
+ *
+ * Any other options passed will be used as HTML attributes of the form tag.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_PrepareElements extends Zend_Form_Decorator_FormElements
+{
+ /**
+ * Render form elements
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $form = $this->getElement();
+ if ((!$form instanceof Zend_Form) && (!$form instanceof Zend_Form_DisplayGroup)) {
+ return $content;
+ }
+
+ $this->_recursivelyPrepareForm($form);
+
+ return $content;
+ }
+
+ protected function _recursivelyPrepareForm(Zend_Form $form)
+ {
+ $belongsTo = ($form instanceof Zend_Form) ? $form->getElementsBelongTo() : null;
+ $elementContent = '';
+ $separator = $this->getSeparator();
+ $translator = $form->getTranslator();
+ $view = $form->getView();
+
+ foreach ($form as $item) {
+ $item->setView($view)
+ ->setTranslator($translator);
+ if ($item instanceof Zend_Form_Element) {
+ $item->setBelongsTo($belongsTo);
+ } elseif (!empty($belongsTo) && ($item instanceof Zend_Form)) {
+ if ($item->isArray()) {
+ $name = $this->mergeBelongsTo($belongsTo, $item->getElementsBelongTo());
+ $item->setElementsBelongTo($name, true);
+ } else {
+ $item->setElementsBelongTo($belongsTo, true);
+ }
+ $this->_recursivelyPrepareForm($item);
+ } elseif (!empty($belongsTo) && ($item instanceof Zend_Form_DisplayGroup)) {
+ foreach ($item as $element) {
+ $element->setBelongsTo($belongsTo);
+ }
+ }
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/Tooltip.php b/library/vendor/Zend/Form/Decorator/Tooltip.php
new file mode 100644
index 0000000..2448b61
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/Tooltip.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_Tooltip
+ *
+ * Will translate the title attribute, if available
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id: Tooltip.php$
+ */
+class Zend_Form_Decorator_Tooltip extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Translates the title attribute if it is available, if the translator is available
+ * and if the translator is not disable on the element being rendered.
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ if (null !== ($title = $this->getElement()->getAttrib('title'))) {
+ if (null !== ($translator = $this->getElement()->getTranslator())) {
+ $title = $translator->translate($title);
+ }
+ }
+
+ $this->getElement()->setAttrib('title', $title);
+ return $content;
+ }
+
+}
diff --git a/library/vendor/Zend/Form/Decorator/ViewHelper.php b/library/vendor/Zend/Form/Decorator/ViewHelper.php
new file mode 100644
index 0000000..a0f71af
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/ViewHelper.php
@@ -0,0 +1,266 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_ViewHelper
+ *
+ * Decorate an element by using a view helper to render it.
+ *
+ * Accepts the following options:
+ * - separator: string with which to separate passed in content and generated content
+ * - placement: whether to append or prepend the generated content to the passed in content
+ * - helper: the name of the view helper to use
+ *
+ * Assumes the view helper accepts three parameters, the name, value, and
+ * optional attributes; these will be provided by the element.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_ViewHelper extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Element types that represent buttons
+ * @var array
+ */
+ protected $_buttonTypes = array(
+ 'Zend_Form_Element_Button',
+ 'Zend_Form_Element_Reset',
+ 'Zend_Form_Element_Submit',
+ );
+
+ /**
+ * View helper to use when rendering
+ * @var string
+ */
+ protected $_helper;
+
+ /**
+ * Set view helper to use when rendering
+ *
+ * @param string $helper
+ * @return Zend_Form_Decorator_Element_ViewHelper
+ */
+ public function setHelper($helper)
+ {
+ $this->_helper = (string) $helper;
+ return $this;
+ }
+
+ /**
+ * Retrieve view helper for rendering element
+ *
+ * @return string
+ */
+ public function getHelper()
+ {
+ if (null === $this->_helper) {
+ $options = $this->getOptions();
+ if (isset($options['helper'])) {
+ $this->setHelper($options['helper']);
+ $this->removeOption('helper');
+ } else {
+ $element = $this->getElement();
+ if (null !== $element) {
+ if (null !== ($helper = $element->getAttrib('helper'))) {
+ $this->setHelper($helper);
+ } else {
+ $type = $element->getType();
+ if ($pos = strrpos($type, '_')) {
+ $type = substr($type, $pos + 1);
+ }
+ $this->setHelper('form' . ucfirst($type));
+ }
+ }
+ }
+ }
+
+ return $this->_helper;
+ }
+
+ /**
+ * Get name
+ *
+ * If element is a Zend_Form_Element, will attempt to namespace it if the
+ * element belongs to an array.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ if (null === ($element = $this->getElement())) {
+ return '';
+ }
+
+ $name = $element->getName();
+
+ if (!$element instanceof Zend_Form_Element) {
+ return $name;
+ }
+
+ if (null !== ($belongsTo = $element->getBelongsTo())) {
+ $name = $belongsTo . '['
+ . $name
+ . ']';
+ }
+
+ if ($element->isArray()) {
+ $name .= '[]';
+ }
+
+ return $name;
+ }
+
+ /**
+ * Retrieve element attributes
+ *
+ * Set id to element name and/or array item.
+ *
+ * @return array
+ */
+ public function getElementAttribs()
+ {
+ if (null === ($element = $this->getElement())) {
+ return null;
+ }
+
+ $attribs = $element->getAttribs();
+ if (isset($attribs['helper'])) {
+ unset($attribs['helper']);
+ }
+
+ if (method_exists($element, 'getSeparator')) {
+ if (null !== ($listsep = $element->getSeparator())) {
+ $attribs['listsep'] = $listsep;
+ }
+ }
+
+ if (isset($attribs['id'])) {
+ return $attribs;
+ }
+
+ $id = $element->getName();
+
+ if ($element instanceof Zend_Form_Element) {
+ if (null !== ($belongsTo = $element->getBelongsTo())) {
+ $belongsTo = preg_replace('/\[([^\]]+)\]/', '-$1', $belongsTo);
+ $id = $belongsTo . '-' . $id;
+ }
+ }
+
+ $element->setAttrib('id', $id);
+ $attribs['id'] = $id;
+
+ return $attribs;
+ }
+
+ /**
+ * Get value
+ *
+ * If element type is one of the button types, returns the label.
+ *
+ * @param Zend_Form_Element $element
+ * @return string|null
+ */
+ public function getValue($element)
+ {
+ if (!$element instanceof Zend_Form_Element) {
+ return null;
+ }
+
+ foreach ($this->_buttonTypes as $type) {
+ if ($element instanceof $type) {
+ if (stristr($type, 'button')) {
+ $element->content = $element->getLabel();
+
+ return $element->getValue();
+ }
+ return $element->getLabel();
+ }
+ }
+
+ return $element->getValue();
+ }
+
+ /**
+ * Render an element using a view helper
+ *
+ * Determine view helper from 'viewHelper' option, or, if none set, from
+ * the element type. Then call as
+ * helper($element->getName(), $element->getValue(), $element->getAttribs())
+ *
+ * @param string $content
+ * @return string
+ * @throws Zend_Form_Decorator_Exception if element or view are not registered
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+
+ $view = $element->getView();
+ if (null === $view) {
+ throw new Zend_Form_Decorator_Exception('ViewHelper decorator cannot render without a registered view object');
+ }
+
+ if (method_exists($element, 'getMultiOptions')) {
+ $element->getMultiOptions();
+ }
+
+ $helper = $this->getHelper();
+ $separator = $this->getSeparator();
+ $value = $this->getValue($element);
+ $attribs = $this->getElementAttribs();
+ $name = $element->getFullyQualifiedName();
+ $id = $element->getId();
+ $attribs['id'] = $id;
+
+ $helperObject = $view->getHelper($helper);
+ if (method_exists($helperObject, 'setTranslator')) {
+ $helperObject->setTranslator($element->getTranslator());
+ }
+
+ // Check list separator
+ if (isset($attribs['listsep'])
+ && in_array($helper, array('formMultiCheckbox', 'formRadio', 'formSelect'))
+ ) {
+ $listsep = $attribs['listsep'];
+ unset($attribs['listsep']);
+
+ $elementContent = $view->$helper($name, $value, $attribs, $element->options, $listsep);
+ } else {
+ $elementContent = $view->$helper($name, $value, $attribs, $element->options);
+ }
+
+ switch ($this->getPlacement()) {
+ case self::APPEND:
+ return $content . $separator . $elementContent;
+ case self::PREPEND:
+ return $elementContent . $separator . $content;
+ default:
+ return $elementContent;
+ }
+ }
+}
diff --git a/library/vendor/Zend/Form/Decorator/ViewScript.php b/library/vendor/Zend/Form/Decorator/ViewScript.php
new file mode 100644
index 0000000..0a1a5a1
--- /dev/null
+++ b/library/vendor/Zend/Form/Decorator/ViewScript.php
@@ -0,0 +1,190 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/** Zend_Form_Decorator_Abstract */
+
+/**
+ * Zend_Form_Decorator_ViewScript
+ *
+ * Render a view script as a decorator
+ *
+ * Accepts the options:
+ * - separator: separator to use between view script content and provided content (defaults to PHP_EOL)
+ * - placement: whether to append or prepend view script content to provided content (defaults to prepend)
+ * - viewScript: view script to use
+ * - viewModule: module that view script is in (optional)
+ *
+ * The view script is rendered as a partial; the element being decorated is
+ * passed in as the 'element' variable:
+ * <code>
+ * // in view script:
+ * echo $this->element->getLabel();
+ * </code>
+ *
+ * Any options other than separator, placement, viewScript, and viewModule are passed to
+ * the partial as local variables.
+ *
+ * @category Zend
+ * @package Zend_Form
+ * @subpackage Decorator
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Form_Decorator_ViewScript extends Zend_Form_Decorator_Abstract
+{
+ /**
+ * Default placement: append
+ * @var string
+ */
+ protected $_placement = 'APPEND';
+
+ /**
+ * View script to render
+ * @var string
+ */
+ protected $_viewScript;
+
+ /**
+ * View script module
+ * @var string
+ */
+ protected $_viewModule;
+
+ /**
+ * Set view script
+ *
+ * @param string $script
+ * @return Zend_Form_Decorator_ViewScript
+ */
+ public function setViewScript($script)
+ {
+ $this->_viewScript = (string) $script;
+ return $this;
+ }
+
+ /**
+ * Get view script
+ *
+ * @return string|null
+ */
+ public function getViewScript()
+ {
+ if (null === $this->_viewScript) {
+ if (null !== ($element = $this->getElement())) {
+ if (null !== ($viewScript = $element->getAttrib('viewScript'))) {
+ $this->setViewScript($viewScript);
+ return $viewScript;
+ }
+ }
+
+ if (null !== ($viewScript = $this->getOption('viewScript'))) {
+ $this->setViewScript($viewScript)
+ ->removeOption('viewScript');
+ }
+ }
+
+ return $this->_viewScript;
+ }
+
+ /**
+ * Set view script module
+ *
+ * @param string $module
+ * @return Zend_Form_Decorator_ViewScript
+ */
+ public function setViewModule($viewModule)
+ {
+ $this->_viewModule = (string) $viewModule;
+ return $this;
+ }
+
+ /**
+ * Get view script module
+ *
+ * @return string|null
+ */
+ public function getViewModule()
+ {
+ if (null === $this->_viewModule) {
+ if (null !== ($element = $this->getElement())) {
+ if (null !== ($viewModule = $element->getAttrib('viewModule'))) {
+ $this->setViewModule($viewModule);
+ return $viewModule;
+ }
+ }
+
+ if (null !== ($viewModule = $this->getOption('viewModule'))) {
+ $this->setViewModule($viewModule)
+ ->removeOption('viewModule');
+ }
+ }
+
+ return $this->_viewModule;
+ }
+
+ /**
+ * Render a view script
+ *
+ * @param string $content
+ * @return string
+ */
+ public function render($content)
+ {
+ $element = $this->getElement();
+ $view = $element->getView();
+ if (null === $view) {
+ return $content;
+ }
+
+ $viewScript = $this->getViewScript();
+ if (empty($viewScript)) {
+ throw new Zend_Form_Exception('No view script registered with ViewScript decorator');
+ }
+
+ $separator = $this->getSeparator();
+ $placement = $this->getPlacement();
+
+ $vars = $this->getOptions();
+ $vars['element'] = $element;
+ $vars['content'] = $content;
+ $vars['decorator'] = $this;
+
+ $viewModule = $this->getViewModule();
+ if (empty($viewModule)) {
+ $renderedContent = $view->partial($viewScript, $vars);
+ } else {
+ $renderedContent = $view->partial($viewScript, $viewModule, $vars);
+ }
+
+ // Get placement again to see if it has changed
+ $placement = $this->getPlacement();
+
+ switch ($placement) {
+ case self::PREPEND:
+ return $renderedContent . $separator . $content;
+ case self::APPEND:
+ return $content . $separator . $renderedContent;
+ default:
+ return $renderedContent;
+ }
+ }
+}