Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move the rendering of HTML link elements to JDocumentRendererHead.

  • Loading branch information...
commit 7884e7d9456afac17558f6e90a0e7e86be8b14f2 1 parent c323ebe
@realityking realityking authored
View
8 libraries/joomla/document/html/html.php
@@ -188,9 +188,9 @@ public function mergeHeadData($data)
*/
public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array())
{
- $attribs = JArrayHelper::toString($attribs);
- $generatedTag = '<link href="'.$href.'" '.$relType.'="'.$relation.'" '.$attribs;
- $this->_links[] = $generatedTag;
+ $this->_links[$href]['relation'] = $relation;
+ $this->_links[$href]['relType'] = $relType;
+ $this->_links[$href]['attribs'] = $attribs;
}
/**
@@ -207,7 +207,7 @@ public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array
public function addFavicon($href, $type = 'image/vnd.microsoft.icon', $relation = 'shortcut icon')
{
$href = str_replace('\\', '/', $href);
- $this->_links[] = '<link href="'.$href.'" rel="'.$relation.'" type="'.$type.'"';
+ $this->addHeadLink($href, $relation, 'rel', array('type' => $type));
}
/**
View
9 libraries/joomla/document/html/renderer/head.php
@@ -82,8 +82,13 @@ public function fetchHead(&$document)
$buffer .= $tab.'<title>'.htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8').'</title>'.$lnEnd;
// Generate link declarations
- foreach ($document->_links as $link) {
- $buffer .= $tab.$link.$tagEnd.$lnEnd;
+ foreach ($document->_links as $link => $linkAtrr)
+ {
+ $buffer .= $tab.'<link href="'.$link.'" '.$linkAtrr['relType'].'="'.$linkAtrr['relation'].'"';
+ if ($temp = JArrayHelper::toString($linkAtrr['attribs'])) {
+ $buffer .= ' '.$temp;
+ }
+ $buffer .= ' />'.$lnEnd;
}
// Generate stylesheet links
Please sign in to comment.
Something went wrong with that request. Please try again.