]> git.sur5r.net Git - contagged/commitdiff
Added callto:// links for phone numbers
authorPhilipp Walker <pwalker@binatec.ch>
Wed, 3 Dec 2008 12:01:06 +0000 (13:01 +0100)
committerPhilipp Walker <pwalker@binatec.ch>
Wed, 3 Dec 2008 12:01:06 +0000 (13:01 +0100)
darcs-hash:20081203120106-f230f-2f05d0c18ce2595f5cac08837d117797d5f632f6.gz

inc/smarty/plugins/modifier.escape.php
templates/entry_show.tpl
templates/list_entry.tpl

index a2f52b232c1316ee9b7d0a2ea70cfc41c1b012c6..f32d7db90cc05a254119c0a5378068b3afb6777d 100644 (file)
@@ -33,7 +33,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-88
 
         case 'urlpathinfo':
             return str_replace('%2F','/',rawurlencode($string));
-            
+
         case 'quotes':
             // escape unescaped single quotes
             return preg_replace("%(?<!\\\\)'%", "\\'", $string);
@@ -45,7 +45,12 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-88
                 $return .= '%' . bin2hex($string[$x]);
             }
             return $return;
-            
+
+        case 'phone':
+            $return = str_replace('+','0',$string);
+            $return = preg_replace('/[^0-9]+/','',$return);
+            return $return;
+
         case 'hexentity':
             $return = '';
             for ($x=0; $x < strlen($string); $x++) {
@@ -63,11 +68,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-88
         case 'javascript':
             // escape quotes and backslashes, newlines, etc.
             return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
-            
+
         case 'mail':
             // safe way to display e-mail address on a web page
             return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string);
-            
+
         case 'nonstd':
            // escape non-standard chars, such as ms document quotes
            $_res = '';
index 25c2b61c6ff37878065af683b65f7dfd9ed44100..36de36c18f4d52482670c6f40b919d21ef2390f0 100644 (file)
@@ -47,7 +47,7 @@
 {if $entry.phone}
           <tr>
             <th>{$lang.phone}:</th>
-            <td>{$entry.phone|h}</td>
+            <td><a href="callto://{$entry.phone|escape:phone}">{$entry.phone|h}</a></td>
           </tr>
 {/if}
 {if $entry.switchboard}
 {if $entry.homephone}
           <tr>
             <th>{$lang.homephone}:</th>
-            <td>{$entry.homephone|h}</td>
+            <td><a href="callto://{$entry.homephone|escape:phone}">{$entry.homephone|h}</a></td>
           </tr>
 {/if}
 {if $entry.mobile}
           <tr>
             <th>{$lang.mobile}:</th>
-            <td>{$entry.mobile|h}</td>
+            <td><a href="callto://{$entry.mobile|escape:phone}">{$entry.mobile|h}</a></td>
           </tr>
 {/if}
 {if $entry.birthday}
index 847e8631aba27cd4624c1fbe52822c8a30c40567..05bcd7a1102371bbc2391af6b4bdd1b690ccc8f0 100644 (file)
@@ -11,7 +11,7 @@
         <a href="index.php?org={$entry.organization|escape:url}">{$entry.organization|h}</a>&nbsp;
     </td>
     <td>
-        {$entry.phone|h}&nbsp;
+        <a href="callto://{$entry.phone|escape:phone}">{$entry.phone|h}</a>&nbsp;
     </td>
     <td>
         <a href="mailto:{$entry.mail[0]|h}">{$entry.mail[0]|h}</a>&nbsp;