- Timestamp:
- 2007/06/08 11:42:32 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel/data/smarty_extends/modifier.script_escape.php
r14464 r14525 1 1 <?php 2 2 /** 3 * Script¥¿¥°¤ò¥¨¥¹¥±¡¼¥× 4 * Á´¤Æ¤Î¥Ú¡¼¥¸¤ËŬÍѤµ¤ì¤ë 3 * Script¥¿¥°¤ò¥¨¥¹¥±¡¼¥×¤¹¤ë 5 4 * 6 * @param string $value ÆþÎÏ7 * @return string ½ÐÎÏ5 * @param string $value ÆþÎÏ 6 * @return string $value ¥Þ¥Ã¥Á¤·¤¿¾ì¹ç¤ÏÊÑ´¹¸å¤Îʸ»úÎ󡢤·¤Ê¤¤¾ì¹ç¤ÏÆþÎϤµ¤ì¤¿Ê¸»úÎó¤ò¤½¤Î¤Þ¤ÞÊÖ¤¹¡£ 8 7 */ 9 8 function smarty_modifier_script_escape($value) { 10 9 11 if ( empty($value)) { return;}10 if (is_array($value)) {return $value;} 12 11 13 return preg_replace("/<script.*?>|<\/script>/", '<script>', $value); 12 $pattern = "/<script.*?>|<\/script>/"; 13 $convert = "#####"; 14 15 if ( preg_match_all($pattern, $value, $matches) > 0) { 16 return preg_replace($pattern, $convert, $value); 17 } else { 18 return $value; 19 } 14 20 } 15 21 ?>
Note: See TracChangeset
for help on using the changeset viewer.