Author: jablko
Date: Wed Oct 21 15:59:36 2009
New Revision: 3791

Log:
Fix links to nonexistent stylesheets by simplifying stylesheet_tag() helper. 
Drop unused polymorphism, make consistent with image_tag()

Modified:
   trunk/lib/vendor/symfony/lib/helper/AssetHelper.php

Modified: trunk/lib/vendor/symfony/lib/helper/AssetHelper.php
==============================================================================
--- trunk/lib/vendor/symfony/lib/helper/AssetHelper.php Wed Oct 21 15:51:43 
2009        (r3790)
+++ trunk/lib/vendor/symfony/lib/helper/AssetHelper.php Wed Oct 21 15:59:36 
2009        (r3791)
@@ -194,49 +194,28 @@
  * @return string XHTML compliant <link> tag(s)
  * @see    stylesheet_path
  */
-function stylesheet_tag()
+function stylesheet_tag($source, $options = array())
 {
-  $sources = func_get_args();
-  $sourceOptions = (func_num_args() > 1 && is_array($sources[func_num_args() - 
1])) ? array_pop($sources) : array();
-
-  $html = '';
-  foreach ($sources as $source)
+  if (!is_array($options))
   {
-    $absolute = false;
-    if (isset($sourceOptions['absolute']))
-    {
-      unset($sourceOptions['absolute']);
-      $absolute = true;
-    }
-
-    $condition = null;
-    if (isset($sourceOptions['condition']))
-    {
-      $condition = $sourceOptions['condition'];
-      unset($sourceOptions['condition']);
-    }
+    $options = array();
+  }
 
-    if (!isset($sourceOptions['raw_name']))
-    {
-      $source = stylesheet_path($source, $absolute);
-    }
-    else
-    {
-      unset($sourceOptions['raw_name']);
-    }
+  $options += array('absolute' => false);
 
-    $options = array_merge(array('rel' => 'stylesheet', 'type' => 'text/css', 
'media' => 'screen', 'href' => $source), $sourceOptions);
-    $tag = tag('link', $options);
+  if (empty($options['raw_name']))
+  {
+    $source = stylesheet_path($source, $options['absolute']);
+  }
 
-    if (!is_null($condition))
-    {
-      $tag = comment_as_conditional($condition, $tag);
-    }
+  $tag = tag('link', array_diff_key($options + array('rel' => 'stylesheet', 
'type' => 'text/css', 'media' => 'screen', 'href' => $source), array('absolute' 
=> 'abosolute', 'condition' => 'condition', 'raw_name' => 'raw_name')));
 
-    $html .= $tag."\n";
+  if (isset($options['condition']))
+  {
+    $tag = comment_as_conditional($options['condition'], $tag);
   }
 
-  return $html;
+  return $tag."\n";
 }
 
 /**

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to