mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 20:12:14 +09:00
fix #1510 이미지 경로 전에 cond사용이 제한되는 문제 고침
- `>`문자열로 img태그의 종료점을 찾으므로 `cond`속성을 먼저 사용할 경우 제한될 수 있었음 - test case 추가
This commit is contained in:
parent
98cc32a2ce
commit
f6a538a655
2 changed files with 17 additions and 2 deletions
|
|
@ -236,7 +236,7 @@ class TemplateHandler
|
||||||
$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
|
$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
|
||||||
|
|
||||||
// replace value of src in img/input/script tag
|
// replace value of src in img/input/script tag
|
||||||
$buff = preg_replace_callback('/<(?:img|input|script)[^<>]*src="(?!https?:\/\/|[\/\{])([^"]+)"/is', array($this, '_replacePath'), $buff);
|
$buff = preg_replace_callback('/<(?:img|input|script)(?(?=[[:space:]]+?cond=")[[:space:]]+?cond="[^"]+"|)[^<>]*[[:space:]]src="(?!https?:\/\/|[\/\{])([^"]+)"/is', array($this, '_replacePath'), $buff);
|
||||||
|
|
||||||
// replace loop and cond template syntax
|
// replace loop and cond template syntax
|
||||||
$buff = $this->_parseInline($buff);
|
$buff = $this->_parseInline($buff);
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
|
||||||
// issue 584
|
// issue 584
|
||||||
array(
|
array(
|
||||||
'<img cond="$oBodex->display_extra_images[\'mobile\'] && $arr_extra && $arr_extra->bodex->mobile" src="./images/common/mobile.gif" title="mobile" alt="mobile" />',
|
'<img cond="$oBodex->display_extra_images[\'mobile\'] && $arr_extra && $arr_extra->bodex->mobile" src="./images/common/mobile.gif" title="mobile" alt="mobile" />',
|
||||||
PHP_EOL . 'if($__Context->oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?><img src="./images/common/mobile.gif" title="mobile" alt="mobile" /><?php } ?>'
|
PHP_EOL . 'if($__Context->oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?><img src="/xe/tests/unit/classes/template/images/common/mobile.gif" title="mobile" alt="mobile" /><?php } ?>'
|
||||||
),
|
),
|
||||||
// issue 831
|
// issue 831
|
||||||
array(
|
array(
|
||||||
|
|
@ -230,6 +230,21 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
|
||||||
'{@ eval(\'$val = $document_srl;\')}',
|
'{@ eval(\'$val = $document_srl;\')}',
|
||||||
PHP_EOL . 'eval(\'$__Context->val = $__Context->document_srl;\') ?>'
|
PHP_EOL . 'eval(\'$__Context->val = $__Context->document_srl;\') ?>'
|
||||||
),
|
),
|
||||||
|
// https://github.com/xpressengine/xe-core/issues/1510
|
||||||
|
array(
|
||||||
|
'<img cond="$foo->bar" src="../common/mobile.gif" />',
|
||||||
|
PHP_EOL . 'if($__Context->foo->bar){ ?><img src="/xe/tests/unit/classes/common/mobile.gif" /><?php } ?>'
|
||||||
|
),
|
||||||
|
// https://github.com/xpressengine/xe-core/issues/1510
|
||||||
|
array(
|
||||||
|
'<img cond="$foo->bar > 100" alt="a!@#$%^&*()_-=[]{}?/" src="../common/mobile.gif" />',
|
||||||
|
PHP_EOL . 'if($__Context->foo->bar > 100){ ?><img alt="a!@#$%^&*()_-=[]{}?/" src="/xe/tests/unit/classes/common/mobile.gif" /><?php } ?>'
|
||||||
|
),
|
||||||
|
// https://github.com/xpressengine/xe-core/issues/1510
|
||||||
|
array(
|
||||||
|
'<img src="../common/mobile.gif" cond="$foo->bar" />',
|
||||||
|
PHP_EOL . 'if($__Context->foo->bar){ ?><img src="/xe/tests/unit/classes/common/mobile.gif" /><?php } ?>'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue