Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / View / Helper / HtmlList.php
bloba1dc4ef51c6a2ceb76f0f4695fdaabec50ccd650
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\View\Helper;
12 /**
13 * Helper for ordered and unordered lists
15 class HtmlList extends AbstractHtmlElement
17 /**
18 * Generates a 'List' element.
20 * @param array $items Array with the elements of the list
21 * @param bool $ordered Specifies ordered/unordered list; default unordered
22 * @param array $attribs Attributes for the ol/ul tag.
23 * @param bool $escape Escape the items.
24 * @return string The list XHTML.
26 public function __invoke(array $items, $ordered = false, $attribs = false, $escape = true)
28 $list = '';
30 foreach ($items as $item) {
31 if (!is_array($item)) {
32 if ($escape) {
33 $escaper = $this->getView()->plugin('escapeHtml');
34 $item = $escaper($item);
36 $list .= '<li>' . $item . '</li>' . self::EOL;
37 } else {
38 $itemLength = 5 + strlen(self::EOL);
39 if ($itemLength < strlen($list)) {
40 $list = substr($list, 0, strlen($list) - $itemLength)
41 . $this($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
42 } else {
43 $list .= '<li>' . $this($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
48 if ($attribs) {
49 $attribs = $this->htmlAttribs($attribs);
50 } else {
51 $attribs = '';
54 $tag = ($ordered) ? 'ol' : 'ul';
56 return '<' . $tag . $attribs . '>' . self::EOL . $list . '</' . $tag . '>' . self::EOL;