Warning: Can't use blame annotator:
svn blame failed on branches/version-2/data/smarty_extends/modifier.script_escape.php: バイナリファイル 'file:///home/svn/open/branches/version-2/data/smarty_extends/modifier.script_escape.php' に対しては blame で各行の最終変更者を計算できません 195004

source: branches/version-2/data/smarty_extends/modifier.script_escape.php @ 17464

Revision 17464, 596 bytes checked in by adachi, 16 years ago (diff)

#321 scriptタグが小文字しかエスケープされない不具合の修正

  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
RevLine 
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:/i";
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.