Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Share some code :)

edited July 2006 in Vanilla 1.0 Help
Hi, congratulations for this amazing piece of software :) I've been looking at your code and it's a little bit too OO for me to comprehend. I was wondering if you could share the code that is resposible for creating SEF URL's. I was wondering how did you made the coversion from čćžšđ to cczsd (like in this discussion -> ), because there are more character that this 5 that need to be converted to make shure that your application isn't user brakeable... Thank you for your time...


  • Options
    Anybody? :)
  • Options
    As far as I know that's done with the Friendly URLs extension, and that doesn't use any code, but instead a .htaccess file with mod_rewrite rules. So basically it's your webserver changing the čćžšđ to cczsd, probably because it's configured to not allow characters like that.
  • Options
    I know you need .htaccess to handle "SE friendly URLs", but when I create a new Discussion and submitit to the server, Vanillas PHP code is the one that takes my title (čćžšđ) and converts it to (cczsd) before inserting it into the database...
  • Options
    I believe the conversion is done in the CleanupString function in library/Framework/Framework.Functions.php
  • Options
    You are right, that's what I was looking for :)

    If somebody else needs it, here it is

    function CleanupString($InString) { $Code = explode(',', '<,>,&#039;,&,",À,Á,Â,Ã,Ä,&Auml;,Å,Ā,Ą,Ă,Æ,Ç,Ć,Č,Ĉ,Ċ,Ď,Đ,Ð,È,É,Ê,Ë,Ē,Ę,Ě,Ĕ,Ė,Ĝ,Ğ,Ġ,Ģ,Ĥ,Ħ,Ì,Í,Î,Ï,Ī,Ĩ,Ĭ,Į,İ,IJ,Ĵ,Ķ,Ł,Ľ,Ĺ,Ļ,Ŀ,Ñ,Ń,Ň,Ņ,Ŋ,Ò,Ó,Ô,Õ,Ö,&Ouml;,Ø,Ō,Ő,Ŏ,Œ,Ŕ,Ř,Ŗ,Ś,Š,Ş,Ŝ,Ș,Ť,Ţ,Ŧ,Ț,Ù,Ú,Û,Ü,Ū,&Uuml;,Ů,Ű,Ŭ,Ũ,Ų,Ŵ,Ý,Ŷ,Ÿ,Ź,Ž,Ż,Þ,Þ,à,á,â,ã,ä,&auml;,å,ā,ą,ă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o,p,r,s,t,u,f,h,c,ch,sh,sch,y,y,e,yu,ya'); $sReturn = $InString; $sReturn = str_replace($Code, $Translation, $sReturn); $sReturn = urldecode($sReturn); $sReturn = preg_replace('/[^A-Za-z0-9 ]/', '', $sReturn); $sReturn = str_replace(' ', '-', $sReturn); return strtolower(str_replace('--', '-', $sReturn)); }
  • Options
    Wow that's a whole loada special characters!
  • Options
    woaw, holy moley1
  • Options
    edited July 2006
    I knew there was a reason I was looking for an already made solution, rather then doing it myself :)
This discussion has been closed.