Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (34 sloc) 0.943 kb
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty ascii_to_numeric_character_reference modifier plugin
*
* Type: modifier<br>
* Name: ascii_to_numeric_character_reference<br>
* Purpose: convert ascii string to numeric character reference, especially for email address
* @link http://github.com/dopin/smarty_plugin_ascii_to_numeric_character_reference/tree/master
* gihub
* @author dopin http://github.com/dopin
* @param string
* @return string
*/
function smarty_modifier_ascii_to_numeric_character_reference($string)
{
$ncf = '';
$strings = preg_split('//', $string);
if(is_array($strings)){
array_shift($strings);
if(is_array($strings)) { array_pop($strings); }
foreach($strings as $v){
$ncf .= '&#x';
$ncf .= dechex(ord($v));
$ncf .= ';';
}
}
return $ncf;
}
/* vim: set expandtab: */
Jump to Line
Something went wrong with that request. Please try again.