Skip to content
This repository
Browse code

Move the rendering of HTML link elements to JDocumentRendererHead.

  • Loading branch information...
commit 7884e7d9456afac17558f6e90a0e7e86be8b14f2 1 parent c323ebe
Rouven Weßling authored May 20, 2011
8  libraries/joomla/document/html/html.php
@@ -188,9 +188,9 @@ public function mergeHeadData($data)
188 188
 	 */
189 189
 	public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array())
190 190
 	{
191  
-		$attribs = JArrayHelper::toString($attribs);
192  
-		$generatedTag = '<link href="'.$href.'" '.$relType.'="'.$relation.'" '.$attribs;
193  
-		$this->_links[] = $generatedTag;
  191
+		$this->_links[$href]['relation']	= $relation;
  192
+		$this->_links[$href]['relType']		= $relType;
  193
+		$this->_links[$href]['attribs']		= $attribs;
194 194
 	}
195 195
 
196 196
 	/**
@@ -207,7 +207,7 @@ public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array
207 207
 	public function addFavicon($href, $type = 'image/vnd.microsoft.icon', $relation = 'shortcut icon')
208 208
 	{
209 209
 		$href = str_replace('\\', '/', $href);
210  
-		$this->_links[] = '<link href="'.$href.'" rel="'.$relation.'" type="'.$type.'"';
  210
+		$this->addHeadLink($href, $relation, 'rel', array('type' => $type));
211 211
 	}
212 212
 
213 213
 	/**
9  libraries/joomla/document/html/renderer/head.php
@@ -82,8 +82,13 @@ public function fetchHead(&$document)
82 82
 		$buffer .= $tab.'<title>'.htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8').'</title>'.$lnEnd;
83 83
 
84 84
 		// Generate link declarations
85  
-		foreach ($document->_links as $link) {
86  
-			$buffer .= $tab.$link.$tagEnd.$lnEnd;
  85
+		foreach ($document->_links as $link => $linkAtrr)
  86
+		{
  87
+			$buffer .= $tab.'<link href="'.$link.'" '.$linkAtrr['relType'].'="'.$linkAtrr['relation'].'"';
  88
+			if ($temp = JArrayHelper::toString($linkAtrr['attribs'])) {
  89
+				$buffer .= ' '.$temp;
  90
+			}
  91
+			$buffer .= ' />'.$lnEnd;
87 92
 		}
88 93
 
89 94
 		// Generate stylesheet links

0 notes on commit 7884e7d

Please sign in to comment.
Something went wrong with that request. Please try again.