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のマージ

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