View: Formater une URL proprement pour URL Rewriting

  1. 11 years ago by mikaweb and saved by 1 other
    1. function format_url( $url, $type = '' ){
    2.         $url = preg_replace("`\[.*\]`U","",$url);
    3.         $url = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$url);
    4.         $url = htmlentities($url, ENT_COMPAT);
    5.         $url = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i","\\1", $url );
    6.         $url = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $url);
    7.         $url = ( $url == "" ) ? $type : strtolower(trim($url, '-'));
    8.         return $url;
    9. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/554"></script>

0 comment about "Formater une URL proprement pour URL Rewriting"