[Typo3-dev] SimulateStaticDocuments and Google

Michael Stucki michael at typo3.org
Mon Feb 7 16:07:36 CET 2005


Hello Georg,

I'm fine with your suggestion. Please rise it as a bug in the TYPO3
bugtracker and I will take care of this.

Regards, michael

(Fullquote because the mail is quite old already...)

Georg Rehfeld wrote:
> 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

-- 
Want support? Please read the list rules first: http://typo3.org/1438.0.html




More information about the TYPO3-dev mailing list