Am 15.12.2013 08:58, schrieb A.L.E.C:
On 12/15/2013 05:40 AM, nyx-network wrote:
And except a # and * too.

RFC 3966 specifies the format.

This is my function to format tel urls. It should be RFC 3966 compliant:

function rcmail_render_tel_value($tel, $col)
{
    $tel_formatted = $tel;
    $tel_formatted = str_replace('(0)', '', $tel_formatted);
    if(substr($tel, 0, 1) == '+'){
      $tel_formatted = '00' . substr($tel_formatted, 1);
    }
    else{
      $tel_formatted = $tel;
    }
    $tel_formatted = preg_replace('/[^0-9 \-\/]+/', '', $tel_formatted);
    if(substr($tel_formatted, 0, 2) == '00'){
      $tel_formatted = '+' . substr($tel_formatted, 2);
    }
$tel_formatted = str_replace(array('-', '/', ' '), array('-', '-', '-'), $tel_formatted);
    return html::a(array(
        'href' => 'tel:' . $tel_formatted,
        'class' => 'tel',
    ), Q($tel));
}

_______________________________________________
Roundcube Development discussion mailing list
[email protected]
http://lists.roundcube.net/mailman/listinfo/dev

Reply via email to