Source of file HtmlCloud.php
Size: 2,119 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Tag/Cloud/Decorator/HtmlCloud.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Tag\Cloud\Decorator; /** * Simple HTML decorator for clouds */ class HtmlCloud extends AbstractCloud { /** * List of HTML tags * * @var array */ protected $htmlTags = array( 'ul' => array('class' => 'zend-tag-cloud'), ); /** * Separator for the single tags * * @var string */ protected $separator = ' '; /** * Set the HTML tags surrounding all tags * * @param array $htmlTags * @return HTMLCloud */ public function setHTMLTags(array $htmlTags) { $this->htmlTags = $htmlTags; return $this; } /** * Retrieve HTML tag map * * @return array */ public function getHTMLTags() { return $this->htmlTags; } /** * Set the separator between the single tags * * @param string * @return HTMLCloud */ public function setSeparator($separator) { $this->separator = $separator; return $this; } /** * Get tag separator * * @return string */ public function getSeparator() { return $this->separator; } /** * Defined by Zend\Tag\Cloud\Decorator\Cloud * * @param array $tags * @throws Exception\InvalidArgumentException * @return string */ public function render($tags) { if (!is_array($tags)) { throw new Exception\InvalidArgumentException(sprintf( 'HtmlCloud::render() expects an array argument; received "%s"', (is_object($tags) ? get_class($tags) : gettype($tags)) )); } $cloudHTML = implode($this->getSeparator(), $tags); $cloudHTML = $this->wrapTag($cloudHTML); return $cloudHTML; } } |