[Typo3-dev] SimulateStaticDocuments and Google

Georg Rehfeld georg.rehfeld at gmx.de
Tue Feb 1 05:17:33 CET 2005


Michael Stucki wrote:

>>It's definitely 3.6.2 and 3.7.0. I try to find the value tomorrow (it's
>>a very, very, very simple change)
> 
> I'm curious! To me this looks very hardcoded, see class.tslib_fe.php,
> function "makeSimulFileName".

Michael, for T3 3.7.0 you are right, it's hardcoded in the

   if ($titleChars) {
     ...
   }

at the beginning of that function. While on this, I also would like
to collapse multiple '-_' to just one (be it configurable or not).

So a proposed change would be (similar to unified diff):

     if ($titleChars)        {
         $out = $this->csConvObj->specCharsToASCII($this->renderCharset, 
$inTitle);

+       // replace all invalid chars with a hyphen (-)
-       $out= 
ereg_replace('[^[:alnum:]_-]','_',trim(substr($out,0,$titleChars)));
+       $out= 
ereg_replace('[^[:alnum:]-]','-',trim(substr($out,0,$titleChars)));

+       // remove all replacements at end of title string
-       $out= ereg_replace('_*$','',$out);
+       $out= ereg_replace('\-*$','',$out);

+       // remove all replacements in front of title string
-       $out= ereg_replace('^_*','',$out);
+       $out= ereg_replace('^-*','',$out);

+       // make just one replacement out of several consecutive
+       $out= ereg_replace('\-+','-',$out);
         if ($out)       $out.='.';
     }

Note: this is UNCHECKED yet (and I'm used to do PHP pereg instead of
ereg, and am too lazy to check up the correc syntax this morning ...
but you all get the point, at least from the comments?).

regards, Georg
-- 
  ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   georg.rehfeld.nospam at gmx.de    +49 (40) 23 53 27 10





More information about the TYPO3-dev mailing list