Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Move the rendering of HTML link elements to JDocumentRendererHead.
Browse files Browse the repository at this point in the history
  • Loading branch information
realityking committed May 22, 2011
1 parent c323ebe commit 7884e7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libraries/joomla/document/html/html.php
Expand Up @@ -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;
}

/**
Expand All @@ -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));
}

/**
Expand Down
9 changes: 7 additions & 2 deletions libraries/joomla/document/html/renderer/head.php
Expand Up @@ -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
Expand Down

0 comments on commit 7884e7d

Please sign in to comment.