2008-03-04 (²Ð)
¢£ ¥Õ¥¡¥¤¥ë¤ò include ¤¹¤ëºÝ¤Ë¥Õ¥£¥ë¥¿¤ò¤«¤±¤ëÊýË¡
¥¹¥È¥ê¡¼¥à¥é¥Ã¥Ñ¤ò»È¤Ã¤Æ´Ê°×¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¤òºî¤ëÊýË¡¤¬¾Ò²ð¤µ¤ì¤Æ¤¤¤Þ¤·¤¿¡£
- Mike Naberezny - Symfony Templates and Ruby’s ERb
- Akra’s DevNotes » Blog Archive » A View Stream with Zend_View
ÊýË¡¤È¤·¤Æ¤Ï¶½Ì£¿¼¤¤¤Î¤Ç¤¹¤¬¡¢¤Á¤ç¤Ã¤ÈÂ礲¤µ¤Ê´¶¤¸¤¬¤¹¤ë¤Î¤Ç¡¢ ƱÍͤΤ³¤È¤ò¤â¤Ã¤È´Êñ¤ÊÊýË¡¤Ç¤ä¤Ã¤Æ¤ß¤Þ¤·¤¿¡£ ÀèÆü¤Î¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó ¤ÈƱ¤¸¤è¤¦¤Ë¡¢
<?=...?> ¢ª <?php echo htmlspecialchars(..., ENT_QUOTES) ?>
¤È¤¤¤¦ÊÑ´¹¤ò¤µ¤»¤ë¤³¤È¤Ë¤·¤Þ¤¹¡£
include ¤ÎÂå¤ï¤ê¤Ë eval ¤ò»È¤¦
¾¤ÎÊýË¡¤ÈÈæ¤Ù¤Æ´Êñ¤Ç¹â®¤Ç¤¹¡£ ¤³¤ó¤Ê¥³¡¼¥É¤Ë¤Ê¤ê¤Þ¤¹¡£
<?php
class MyView
{
public function render($filename)
{
$buffer = file_get_contents($filename);
$buffer = $this->_prefilter($buffer);
extract(get_object_vars($this));
eval('?>' . $buffer);
}
protected function _prefilter($buffer)
{
$pattern = '/<\?=\s*(.*?)[;\s]*\?>/';
$replacement = '<?php echo htmlspecialchars($1, ENT_QUOTES) ?>';
return preg_replace($pattern, $replacement, $buffer);
}
}
¥´¥Á¥ã¥´¥Á¥ã½ñ¤¤Þ¤·¤¿¤¬¡¢Í×¤Ï include ¤ÎÂå¤ï¤ê¤Ë¡¢
eval('?>' . filter(file_get_contents($filename)));
¤Î¤è¤¦¤Ë½ñ¤±¤ÐÎɤ¤¤Ç¤¹¡£
¥¹¥È¥ê¡¼¥à¥Õ¥£¥ë¥¿¤ò»È¤¦
¥¹¥È¥ê¡¼¥à¥é¥Ã¥Ñ¤ò»È¤¦ÊýË¡¤Ë»÷¤Æ¤¤¤Þ¤¹¤¬¡¢ php://filter ¤È¤¤¤¦ PHP Æþ½ÐÎÏ¥¹¥È¥ê¡¼¥à¤ò»È¤¦¤È¡¢ ¥Õ¥¡¥¤¥ë¤òÆþ½ÐÎϤ¹¤ëºÝ¤Ë¥Õ¥£¥ë¥¿¤ò»Ü¤¹¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ç¤¹¡£
¶ñÂÎŪ¤Ë¤Ï¡¢¤³¤ó¤Ê¥³¡¼¥É¤Ë¤Ê¤ê¤Þ¤¹¡£
<?php
class short_tag_filter extends php_user_filter
{
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$pattern = '/<\?=\s*(.*?)[;\s]*\?>/';
$replacement = '<?php echo htmlspecialchars($1, ENT_QUOTES) ?>';
$bucket->data = preg_replace($pattern, $replacement, $bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
}
class MyView
{
public function __construct()
{
stream_filter_register('convert.short_tag', 'short_tag_filter');
}
public function render($filename)
{
extract(get_object_vars($this));
include 'php://filter/read=convert.short_tag/resource=' . $filename;
}
}
¤³¤Á¤é¤ÎÊýË¡¤Ï¡¢include °Ê³°¤Î¥Õ¥¡¥¤¥ëÆþ½ÐÎÏ´Ø¿ô¤È¤âÁȤ߹ç¤ï¤»¤é¤ì¤ë¤Ï¤º¤Ç¤¹¡£ »²¹Í¤Î¤¿¤á¤Ë¡¢¥Æ¥¹¥È¤Ë»È¤Ã¤¿¥³¡¼¥É¤òÃÖ¤¤¤Æ¤ª¤¤Þ¤¹¡£
¤³¤Î¥¨¥ó¥È¥ê¤Î³¤: 2008-03-30 (Æü)
[¥³¥á¥ó¥È¤ò½ñ¤¯]
ËÜÆü¤Î¥ê¥ó¥¯¸µ
- 3 google¸¡º÷(php eval include)
- 3 google¸¡º÷(php class include)
- 3 http://www.google.co.jp/reader/view/
- 2 google¸¡º÷(symfony myView)
- 2 google¸¡º÷(PHP eval include)
- 2 google¸¡º÷(php include replace)
- 2 google¸¡º÷(svg include)
- 2 google¸¡º÷(php mb_strimwidth include)
- 2 google¸¡º÷(PHP ½ÐÎÏ¡¡¥Õ¥£¥ë¥¿¥ê¥ó¥°¡¡regex)
- 2 http://www.google.co.jp/hws/search?q=php ´Ê°×¥Æ¥ó¥...
- 2 http://blog-search.yahoo.co.jp/search?ei=UTF-8&p=p...
- 1 google¸¡º÷(zend framework include)
- 1 google¸¡º÷(zend ¥Õ¥£¥ë¥¿)
- 1 google¸¡º÷(php include¤¹¤ë)
- 1 google¸¡º÷(php include eval)
- 1 google¸¡º÷(php ¥Õ¥¡¥¤¥ë include)
- 1 google¸¡º÷(Zend flamework ¥Õ¥£¥ë¥¿¡¼¡¡)
- 1 google¸¡º÷(¤ì¤Ö¤í¤°¡¡php)
- 1 google¸¡º÷(consumed php)
- 1 google¸¡º÷(PHP include eval)
- 1 google¸¡º÷(zend_View include)
- 1 google¸¡º÷(php filter)
- 1 google¸¡º÷(zend_view this extract)
- 1 google¸¡º÷(zend_view extract)
- 1 google¸¡º÷(£Ó£Ö£Ç¥Õ¥£¥ë¥¿¡¼)
- 1 google¸¡º÷(php include)
- 1 google¸¡º÷(Zend include)
- 1 google¸¡º÷(php zend framework include)
- 1 google¸¡º÷(PHP htmlspecialchars À©¸æÊ¸»ú)
- 1 google¸¡º÷(include file_get_contents)
- 1 google¸¡º÷(linux apache php include¥Õ¥¡¥¤¥ë)
- 1 google¸¡º÷(php include °Ê³°)
- 1 google¸¡º÷(php include ¥¹¥È¥ê¡¼¥à¥é¥Ã¥Ñ¡¼)
- 1 google¸¡º÷(GeSHi Filter)
- 1 google¸¡º÷(zend include)
- 1 google¸¡º÷(zend framework view filter)
- 1 google¸¡º÷(zend framework include)
- 1 google¸¡º÷(zend MyView)
- 1 google¸¡º÷(zend ½ÐÎÏ filter)
- 1 google¸¡º÷(vml eval)
- 1 google¸¡º÷(symfony templates php include)
- 1 google¸¡º÷(symfony myView)
- 1 google¸¡º÷(symfony myView)
- 1 google¸¡º÷(stream_filter_register CAKEPHP)
- 1 google¸¡º÷(stream_filter_register)
- 1 google¸¡º÷(php svg ½ÐÎϤ¹¤ë)
- 1 google¸¡º÷(php short_tag)
- 1 google¸¡º÷(php php_user_filter)
- 1 google¸¡º÷(php include __construct)
- 1 google¸¡º÷(php include ¥Õ¥£¥ë¥¿)
- 1 google¸¡º÷(php filter ¹â®)
- 1 google¸¡º÷(php filter)
- 1 google¸¡º÷(php ´Ê°×¥Æ¥ó¥×¥ì¡¼¥È include)
- 1 google¸¡º÷(php ¾¤Î¥Õ¥¡¥¤¥ë¤Îfunction¤ò»È¤¦)
- 1 google¸¡º÷(php ¥¯¥é¥¹ include)
- 1 google¸¡º÷(php ¥¯¥é¥¹ ¥Õ¥¡¥¤¥ë)
- 1 google¸¡º÷(php ¥¯¥é¥¹¡¡include function)
- 1 google¸¡º÷(php ¥¯¥é¥¹¡¡include)
- 1 google¸¡º÷(php¡¡eval include)
- 1 google¸¡º÷(php://filter/read)
- 1 google¸¡º÷(javascript innerhtml include PHP)
- 1 google¸¡º÷(jQuery file_get_contents)
- 1 google¸¡º÷(include php ÈϰÏ)
- 1 google¸¡º÷(include file_get_contents)
- 1 google¸¡º÷(filter¡¡php)
- 1 google¸¡º÷(filter¡¡³Ñ´Ý)
- 1 google¸¡º÷(cakephp file_get_contents ¥Æ¥ó¥×¥ì¡¼¥È)
- 1 google¸¡º÷(Zend include)
- 1 google¸¡º÷(SVG include)
- 1 google¸¡º÷(php¡¡¥Õ¥£¥ë¥¿)
- 1 google¸¡º÷(eval php ¥Õ¥¡¥¤¥ë)
- 1 google¸¡º÷(include PHP)
- 1 google¸¡º÷(jquery¡¡¥Õ¥£¥ë¥¿¥ê¥ó¥°)
- 1 google¸¡º÷(short_tag)
- 1 google¸¡º÷(php short_tag)
- 1 google¸¡º÷(php¡¡Àµµ¬É½¸½¡¡eval)
- 1 google¸¡º÷(symfony out filter)
- 1 google¸¡º÷(¤Ö¤í¤°¤ó¡¡include)
- 1 google¸¡º÷(PHP 5.2.5 include)
- 1 google¸¡º÷(php include ¹â®)
- 1 google¸¡º÷(php extends include)
- 1 google¸¡º÷(include php eval)
- 1 google¸¡º÷(zend framework include)
- 1 google¸¡º÷(php short_tag)
- 1 google¸¡º÷(php short_tag)
- 1 google¸¡º÷(php html include¡¡out)
- 1 google¸¡º÷(php filter)
- 1 google¸¡º÷(php class include)
- 1 google¸¡º÷(php class include)
- 1 google¸¡º÷(javascript include eval)
- 1 google¸¡º÷(javascript include°Ê³°)
- 1 google¸¡º÷(include public php)
- 1 google¸¡º÷(include¤Î¤«¤ï¤ê javascript)
- 1 google¸¡º÷(Zend_View include)
- 1 google¸¡º÷(PHP Class include)
- 1 google¸¡º÷(PHP ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏ¡¡¹â®)
- 1 google¸¡º÷(PHP¡¡include¡¡ÊýË¡)
- 1 google¸¡º÷(PHP¡¡class¡¡include)
- 1 google¸¡º÷(CentOS include¥Õ¥¡¥¤¥ë)
- 1 google¸¡º÷(php ¥Õ¥£¥ë¥¿)
