| 1 | <?php |
| 2 | /** |
| 3 | * Smarty plugin |
| 4 | * @package Smarty |
| 5 | * @subpackage plugins |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | function smarty_modifier_preview($node_content) |
| 10 | { |
| 11 | |
| 12 | if (!empty($_POST['no_html'])) { |
| 13 | $node_content=htmlspecialchars($node_content); |
| 14 | } |
| 15 | |
| 16 | require(INCLUDE_DIR.'htmlparse.inc'); |
| 17 | global $htmlparse; |
| 18 | htmlparser::htmlparse($node_content); |
| 19 | |
| 20 | if (!empty($htmlparse)) { |
| 21 | $error=$htmlparse; |
| 22 | echo "<span class='most_important'> $error </span>"; |
| 23 | return false; |
| 24 | } |
| 25 | |
| 26 | $node_content = EregI_Replace("((( )|(\n)|(^))+)(http://|ftp://|https://)([[:alnum:]][^,[:space:]]*)","\\2<a target='_blank'href=\"\\6\\7\">\\6\\7</a>",$node_content); |
| 27 | $node_content=strip_tags($node_content,'<a><b><i><u><img><br><p><font>'); |
| 28 | $node_content=str_replace("\n","<br>",$node_content); |
| 29 | return $node_content; |
| 30 | |
| 31 | } |
| 32 | |
| 33 | /* vim: set expandtab: */ |
| 34 | |
| 35 | ?> |