Added "relPathprefix" to TEMPLATE cObject and also added support for relative path...
authorKasper Skårhøj <kasper@typo3.org>
Fri, 7 May 2004 13:44:19 +0000 (13:44 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 7 May 2004 13:44:19 +0000 (13:44 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@276 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_parsehtml.php
typo3/sysext/cms/tslib/class.tslib_content.php

index 6215e61..e4dc0ed 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-05-07  Kasper Skårhøj,,,  <kasper@typo3.com>
+
+       * Added "relPathprefix" to TEMPLATE cObject and also added support for relative path substitution of references in url() wrappers in <style> tags. This will also fix THAT problem reported for automaketemplate.
+
 2004-04-30  Kasper Skårhøj,,,  <kasper@typo3.com>
 
        * Merged TYPO3_3-6-0 branch changes by robert into HEAD. See 3.6.0 branch change log if you want.
 2004-04-30  Kasper Skårhøj,,,  <kasper@typo3.com>
 
        * Merged TYPO3_3-6-0 branch changes by robert into HEAD. See 3.6.0 branch change log if you want.
index af1f14c..307ce9c 100644 (file)
@@ -816,9 +816,9 @@ class t3lib_parsehtml {
         * @return      string          Processed HTML content
         */
        function prefixResourcePath($main_prefix,$content,$alternatives=array())        {
         * @return      string          Processed HTML content
         */
        function prefixResourcePath($main_prefix,$content,$alternatives=array())        {
+
                $parts = $this->splitTags('td,table,body,img,input,form,link,script,a',$content);
                $parts = $this->splitTags('td,table,body,img,input,form,link,script,a',$content);
-               reset($parts);
-               while(list($k,$v)=each($parts)) {
+               foreach($parts as $k => $v)     {
                        if ($k%2)       {
                                $params = $this->get_tag_attributes($v,1);
                                $tagEnd = substr($v,-2)=='/>' ? ' />' : '>';    // Detect tag-ending so that it is re-applied correctly.
                        if ($k%2)       {
                                $params = $this->get_tag_attributes($v,1);
                                $tagEnd = substr($v,-2)=='/>' ? ' />' : '>';    // Detect tag-ending so that it is re-applied correctly.
@@ -871,8 +871,22 @@ class t3lib_parsehtml {
                                }
                        }
                }
                                }
                        }
                }
+               $content = implode('',$parts);
+
+                       // Fix <style> section:
+               $prefix = isset($alternatives['style']) ? $alternatives['style'] : $main_prefix;
+               if (strlen($prefix))    {
+                       $parts = $this->splitIntoBlock('style',$content);
+                       foreach($parts as $k => $v)     {
+                               if ($k%2)       {
+                                       $parts[$k] = eregi_replace('(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))','\1'.$prefix.'\2\3',$parts[$k]);
+                               }
+                       }
+                       debug($parts);
+                       $content = implode('',$parts);
+               }
 
 
-               return implode('',$parts);
+               return $content;
        }
 
        /**
        }
 
        /**
index ad0e4fd..71b3e96 100755 (executable)
@@ -2148,6 +2148,13 @@ class tslib_cObj {
                if ($conf['workOnSubpart'])     {
                        $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
                }
                if ($conf['workOnSubpart'])     {
                        $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
                }
+
+                       // Fixing all relative paths found:
+               if ($conf['relPathPrefix'])     {
+                       $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
+                       $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
+               }
+
                if ($content)   {
                        if ($conf['nonCachedSubst'])    {               // NON-CACHED:
                                        // Getting marks
                if ($content)   {
                        if ($conf['nonCachedSubst'])    {               // NON-CACHED:
                                        // Getting marks