Ejemplo n.º 1
0
 public function render(Zend_Tag_ItemList $tags)
 {
     if (null === ($weightValues = $this->getClassList())) {
         $weightValues = range($this->getMinFontSize(), $this->getMaxFontSize());
     }
     $tags->spreadWeightValues($weightValues);
     $result = array();
     foreach ($tags as $tag) {
         if (null === ($classList = $this->getClassList())) {
             $attribute = sprintf('style="font-size: %d%s;"', $tag->getParam('weightValue'), $this->getFontSizeUnit());
         } else {
             $attribute = sprintf('class="%s"', htmlspecialchars($tag->getParam('weightValue')));
         }
         foreach ($this->getHtmlTags() as $key => $data) {
             if (is_array($data)) {
                 $htmlTag = $key;
                 $attributes = '';
                 foreach ($data as $param => $value) {
                     $attributes .= ' ' . $param . '="' . htmlspecialchars($value) . '"';
                 }
             } else {
                 $htmlTag = $data;
                 $attributes = '';
             }
             $tagHtml = sprintf('<%1$s%3$s>%2$s</%1$s>', $htmlTag, $tag->getTitle(), $attributes . ' ' . $attribute);
         }
         $result[] = $tagHtml;
     }
     return $result;
 }
Ejemplo n.º 2
0
 public function testSpreadWeightValuesWithEmptyValuesArray()
 {
     $list = new Zend_Tag_ItemList();
     try {
         $list->spreadWeightValues(array());
         $this->fail('An expected Zend_Tag_Exception was not raised');
     } catch (Zend_Tag_Exception $e) {
         $this->assertEquals($e->getMessage(), 'Value list may not be empty');
     }
 }