source: branches/beta/data/smarty_extends/modifier.script_escape.php @ 14676

Revision 14676, 549 bytes checked in by adati, 16 years ago (diff)

1.4.0a-betaのマージ

RevLine 
[14392]1<?php
2/**
[14527]3 * Script¥¿¥°¤ò¥¨¥¹¥±¡¼¥×¤¹¤ë
[14392]4 *
[14527]5 * @param  string $value ÆþÎÏ
6 * @return string $value ¥Þ¥Ã¥Á¤·¤¿¾ì¹ç¤ÏÊÑ´¹¸å¤Îʸ»úÎ󡢤·¤Ê¤¤¾ì¹ç¤ÏÆþÎϤµ¤ì¤¿Ê¸»úÎó¤ò¤½¤Î¤Þ¤ÞÊÖ¤¹¡£
[14392]7 */
8function smarty_modifier_script_escape($value) {
9   
[14527]10    if (is_array($value)) {return $value;}
[14465]11   
[14527]12    $pattern = "/<script.*?>|<\/script>/";
[14676]13    $convert = "#script tag escaped#";
[14527]14   
[14530]15    if ( preg_match_all($pattern, $value, $matches) ) {
[14527]16        return preg_replace($pattern, $convert, $value);
17    } else {
18        return $value;
19    }
[14392]20}
21?>
Note: See TracBrowser for help on using the repository browser.