Overview
SHA1 Hash:43d40386493bfc8120bdfb97608235f5080df3c9
Date: 2012-05-04 05:26:15
User: bohwaz
Comment:Fix [e63327a3cb] liens wiki
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2012-05-04
05:26
[cab69d504a] Largeur à 72 (user: bohwaz, tags: trunk)
05:26
[43d4038649] Fix [e63327a3cb] liens wiki (user: bohwaz, tags: trunk)
2012-04-03
02:31
[222fa399fb] Problème de passage en literal : $www_url qui n'était pas interprété (user: bohwaz, tags: trunk)
Changes

Modified include/lib.utils.php from [f9207dda8d] to [f425d1f875].

304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
        $str = preg_replace('![^[:ascii:]]+!', '', $str);

        return $str;
    }

    static public function htmlLinksOnUrls($str)
    {
        return preg_replace_callback('!(?<=\s)((?:(ftp|https?|file|ed2k|ircs?)://|(magnet|mailto|data|tel|fax|geo|sips?|xmpp):)([^\s<]+))!',
            function ($match) {
                $proto = $match[2] ?: $match[3];
                $text = ($proto == 'http' || $proto == 'mailto') ? $match[4] : $match[1];
                return '<a class="'.$proto.'" href="'.htmlspecialchars($match[1], ENT_QUOTES, 'UTF-8').'">'.htmlspecialchars($text, ENT_QUOTES, 'UTF-8').'</a>';
            }, $str);
    }

................................................................................

        // Espaces typograhiques
        $str = preg_replace('/\h*([?!;:»])(\s+|$)/u', '&nbsp;$1$2', $str);
        $str = preg_replace('/(^|\s+)([«])\h*/u', '$1$2&nbsp;', $str);

        // Liens
        $str = preg_replace('/(?<!\\\\)\[([^-]+)->([^\]]+)\]/', '<a href="$2">$1</a>', $str);
        $str = preg_replace('/(?<!\\\\)\[([^\]]+)\]/', '<a href="$2">$1</a>', $str);

        return $str;
    }

    static public function mail($to, $subject, $content, $additional_headers = array())
    {
        // Création du contenu du message







|







 







|







304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
        $str = preg_replace('![^[:ascii:]]+!', '', $str);

        return $str;
    }

    static public function htmlLinksOnUrls($str)
    {
        return preg_replace_callback('!(?<=\s|^)((?:(ftp|https?|file|ed2k|ircs?)://|(magnet|mailto|data|tel|fax|geo|sips?|xmpp):)([^\s<]+))!',
            function ($match) {
                $proto = $match[2] ?: $match[3];
                $text = ($proto == 'http' || $proto == 'mailto') ? $match[4] : $match[1];
                return '<a class="'.$proto.'" href="'.htmlspecialchars($match[1], ENT_QUOTES, 'UTF-8').'">'.htmlspecialchars($text, ENT_QUOTES, 'UTF-8').'</a>';
            }, $str);
    }

................................................................................

        // Espaces typograhiques
        $str = preg_replace('/\h*([?!;:»])(\s+|$)/u', '&nbsp;$1$2', $str);
        $str = preg_replace('/(^|\s+)([«])\h*/u', '$1$2&nbsp;', $str);

        // Liens
        $str = preg_replace('/(?<!\\\\)\[([^-]+)->([^\]]+)\]/', '<a href="$2">$1</a>', $str);
        $str = preg_replace('/(?<!\\\\)\[([^\]]+)\]/', '<a href="$1">$1</a>', $str);

        return $str;
    }

    static public function mail($to, $subject, $content, $additional_headers = array())
    {
        // Création du contenu du message