Output Filters

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 16. Extending Smarty With Plugins
利用插件扩展smarty
Next

Output Filters输出过滤器

/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File: outputfilter.protect_email.php
 * Type: outputfilter
 * Name: protect_email
 * Purpose: Converts @ sign in email addresses to %40 as 
 * a simple protection against spambots
 * -------------------------------------------------------------
 */
 function smarty_outputfilter_protect_email($output, &$smarty)
 {
 return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
 '$1%40$2', $output);
 }
 

Prev 来源:PHP中文社区 Home Next
Prefilters/Postfilters[预滤器/后滤器] Up [源]Resources