| version 1.8, 2003/01/13 12:49:05 |
version 1.9, 2003/01/13 12:56:26 |
|
|
| return str_replace(' ', ' ', htmlspecialchars($str)); |
return str_replace(' ', ' ', htmlspecialchars($str)); |
| } /* }}} */ |
} /* }}} */ |
| |
|
| /** common/str/fnc.escape_email.php - escape e-mail address |
/** |
| |
* Escapes e-mail address. |
| |
* |
| |
* @param string $email e-mail address |
| |
* @param string $mode url - does URL escaping |
| |
* html - does HTML escaping |
| |
* hypertext_link - creates hypertext link |
| |
* @param string $attr when creating hypertext link, additional |
| |
* attributes may be added |
| |
* @return string escaped e-mail added |
| */ |
*/ |
| function escape_email($email, $mode = 'create_hypertext', $attributes = '') /* {{{ */ |
function escape_email($email, $mode = 'hypertext_link', $attr = '')/* {{{ */ |
| { |
{ |
| /* Code borrowed from Smarty template engine; |
/* Code borrowed from Smarty template engine; |
| Smarty-2.1.0/plugins/modifier.escape.php file */ |
Smarty-2.1.0/plugins/modifier.escape.php file */ |
|
|
| break; |
break; |
| case 'html': |
case 'html': |
| for ($x = 0; $x < strlen($email); $x++) { |
for ($x = 0; $x < strlen($email); $x++) { |
| $ret .= (ord($email[$x]) > 127 ? $email[$x] : '&#x'.bin2hex($email[$x]).';'); |
$ret .= (ord($email[$x]) > 127 |
| |
? $email[$x] : '&#x'.bin2hex($email[$x]).';'); |
| } |
} |
| break; |
break; |
| default: |
default: |
| case 'create_hypertext': |
case 'hypertext_link': |
| is_array($attributes) && $attributes = join(' ', $attributes); |
is_array($attr) && $attr = join(' ', $attr); |
| $attributes != '' && $attributes .= ' '; |
$attr != '' && $attr .= ' '; |
| $ret = '<a '.$attributes.'href="mailto:' |
$ret = '<a '.$attr.'href="mailto:' |
| . escape_email($email, 'url') . '">' |
. Platon::escape_email($email, 'url') . '">' |
| . escape_email($email, 'html') . '</a>'; |
. Platon::escape_email($email, 'html') . '</a>'; |
| break; |
break; |
| } |
} |
| return $ret; |
return $ret; |
|
|
| * |
* |
| * @param mixed $url string URL or array from Platon::glue_url() |
* @param mixed $url string URL or array from Platon::glue_url() |
| * @return string path without scriptname |
* @return string path without scriptname |
| * @access public |
|
| */ |
*/ |
| function get_path_without_scriptname($url) /* {{{ */ |
function get_path_without_scriptname($url) /* {{{ */ |
| { |
{ |
|
|
| * @return string glued url |
* @return string glued url |
| * @author Tomas V.V.Cox <cox@idecnet.com> |
* @author Tomas V.V.Cox <cox@idecnet.com> |
| * @date 19/Feb/2001 |
* @date 19/Feb/2001 |
| * @access public |
|
| */ |
*/ |
| function glue_url($url) /* {{{ */ |
function glue_url($url) /* {{{ */ |
| { |
{ |