summaryrefslogtreecommitdiffstats
path: root/library/vendor/Zend/View/Helper/HtmlList.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--library/vendor/Zend/View/Helper/HtmlList.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/library/vendor/Zend/View/Helper/HtmlList.php b/library/vendor/Zend/View/Helper/HtmlList.php
new file mode 100644
index 0000000..e080eb1
--- /dev/null
+++ b/library/vendor/Zend/View/Helper/HtmlList.php
@@ -0,0 +1,88 @@
+<?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_View
+ * @subpackage Helper
+ * @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$
+ */
+
+
+/**
+ * Zend_View_Helper_FormELement
+ */
+
+/**
+ * Helper for ordered and unordered lists
+ *
+ * @uses Zend_View_Helper_FormElement
+ * @category Zend
+ * @package Zend_View
+ * @subpackage Helper
+ * @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_View_Helper_HtmlList extends Zend_View_Helper_FormElement
+{
+
+ /**
+ * Generates a 'List' element.
+ *
+ * @param array $items Array with the elements of the list
+ * @param boolean $ordered Specifies ordered/unordered list; default unordered
+ * @param array $attribs Attributes for the ol/ul tag.
+ * @return string The list XHTML.
+ */
+ public function htmlList(array $items, $ordered = false, $attribs = false, $escape = true)
+ {
+ if (!is_array($items)) {
+ $e = new Zend_View_Exception('First param must be an array');
+ $e->setView($this->view);
+ throw $e;
+ }
+
+ $list = '';
+
+ foreach ($items as $item) {
+ if (!is_array($item)) {
+ if ($escape) {
+ $item = $this->view->escape($item);
+ }
+ $list .= '<li>' . $item . '</li>' . self::EOL;
+ } else {
+ if (6 < strlen($list)) {
+ $list = substr($list, 0, strlen($list) - 6)
+ . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
+ } else {
+ $list .= '<li>' . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
+ }
+ }
+ }
+
+ if ($attribs) {
+ $attribs = $this->_htmlAttribs($attribs);
+ } else {
+ $attribs = '';
+ }
+
+ $tag = 'ul';
+ if ($ordered) {
+ $tag = 'ol';
+ }
+
+ return '<' . $tag . $attribs . '>' . self::EOL . $list . '</' . $tag . '>' . self::EOL;
+ }
+}