source: branches/feature-module-paygent/data/smarty_extends/modifier.script_escape.php @ 15056

Revision 15056, 559 bytes checked in by adati, 14 years ago (diff)

relブランチのマージ(r12156-r15055)

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>|javascript:/";
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.