Author: francois.b
Date: 2010-04-27 11:20:48 +0200 (Tue, 27 Apr 2010)
New Revision: 29268
Modified:
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/loader/sfUoWidgetDefaultLoader.class.php
Log:
[sfUnobstrusiveWidgetPlugin] updated default loader to prevent many inclusion
of the same JS or CSS file
Modified:
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/loader/sfUoWidgetDefaultLoader.class.php
===================================================================
---
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/loader/sfUoWidgetDefaultLoader.class.php
2010-04-27 08:06:22 UTC (rev 29267)
+++
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/loader/sfUoWidgetDefaultLoader.class.php
2010-04-27 09:20:48 UTC (rev 29268)
@@ -74,7 +74,7 @@
{
if (false !== ($pos = strpos($content, '</head>')))
{
- $html = $this->getAssetsAsHtml();
+ $html = $this->getAssetsAsHtml($content);
if ($html)
{
@@ -155,20 +155,30 @@
}
}
- protected function getAssetsAsHtml()
+ protected function getAssetsAsHtml($content)
{
$assets = array();
foreach ($this->javascripts as $javascript)
{
- $assets[] = sprintf(self::TEMPLATE_JAVASCRIPT,
$this->request->getRelativeUrlRoot().$javascript);
+ $js = $this->request->getRelativeUrlRoot().$javascript;
+
+ if (false === strpos($js, $content))
+ {
+ $assets[] = sprintf(self::TEMPLATE_JAVASCRIPT, $js);
+ }
}
foreach ($this->stylesheets as $media => $stylesheets)
{
foreach ($stylesheets as $stylesheet)
{
- $assets[] = sprintf(self::TEMPLATE_STYLESHEET, $media,
$this->request->getRelativeUrlRoot().$stylesheet);
+ $css = $this->request->getRelativeUrlRoot().$stylesheet;
+
+ if (false === strpos($css, $content))
+ {
+ $assets[] = sprintf(self::TEMPLATE_STYLESHEET, $media, $css);
+ }
}
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" 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.com/group/symfony-svn?hl=en.