/** * Returns the HTML code for inclusion. * * @return string */ public function render() { $return = array(); // Render meta keywords tag if ($this->keywords) { $return[] = Ku_HTML::meta(implode(', ', $this->keywords), array('name' => 'keywords')); } // Render meta description tag if ($this->description) { $return[] = Ku_HTML::meta(implode(', ', $this->description), array('name' => 'description')); } // Render other meta tags foreach ($this->meta as $item) { $return[] = (string) $item; } // Render base tag if ($this->base) { $return[] = is_string($this->base) ? Ku_HTML::base($this->base) : (string) $this->base; } // Render title tag $title = is_array($this->title) ? implode($this->title_separator, $this->title) : $this->title; $return[] = is_string($title) ? '<title>' . HTML::chars($title, FALSE) . '</title>' : (string) $title; // Render styles foreach ($this->styles as $item) { $return[] = (string) $item; } // Render scripts foreach ($this->scripts as $item) { $return[] = (string) $item; } // Render links foreach ($this->links as $item) { $return[] = (string) $item; } // Remove empty lines $return = array_filter($return, 'strlen'); return implode("\n", $return); }
/** * Returns the HTML code of tag. * * @return string */ public function render() { $attributes = $this->getArrayCopy(); if ($this->_ignored) { $attributes = array_diff_key($attributes, $this->_ignored); } if ($this->_empty === FALSE and $this->_html) { $value = '<' . $this->_tag . HTML::attributes($attributes) . '>' . (string) $this->_html . '</' . $this->_tag . '>'; } elseif ($this->_empty === FALSE and $this->_cdata) { if (strpos($this->_cdata, "\n") !== FALSE) { $value = '<' . $this->_tag . HTML::attributes($attributes) . ">\n" . "// <![CDATA[\n" . (string) $this->_cdata . "\n" . "// ]]>\n" . '</' . $this->_tag . '>'; } else { $value = '<' . $this->_tag . HTML::attributes($attributes) . '>' . '/* <![CDATA[ */ ' . (string) $this->_cdata . ' /* ]]> */' . '</' . $this->_tag . '>'; } } elseif ($this->_short === TRUE) { // Short form of tag $value = '<' . $this->_tag . HTML::attributes($attributes) . ' />'; } else { // Full form of tag $value = '<' . $this->_tag . HTML::attributes($attributes) . '></' . $this->_tag . '>'; } return $this->_condition ? Ku_HTML::conditional_comments($this->_condition, $value) : $value; }