mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Merge pull request #1009 from kijin/pr/context-tpl-vars
Context 클래스에서 static 속성과 인스턴스 속성을 분명히 구분
This commit is contained in:
commit
c707b3915d
4 changed files with 375 additions and 373 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -344,22 +344,27 @@ class TemplateHandler
|
|||
*/
|
||||
private function _fetch($filename)
|
||||
{
|
||||
$__Context = Context::getInstance();
|
||||
// Import Context and lang as local variables.
|
||||
$__Context = Context::getAll();
|
||||
$__Context->tpl_path = $this->path;
|
||||
|
||||
global $lang;
|
||||
|
||||
// Start the output buffer.
|
||||
$__ob_level_before_fetch = ob_get_level();
|
||||
ob_start();
|
||||
|
||||
// Include the compiled template.
|
||||
include $filename;
|
||||
|
||||
// Fetch contents of the output buffer until the buffer level is the same as before.
|
||||
$contents = '';
|
||||
while (ob_get_level() > $__ob_level_before_fetch)
|
||||
{
|
||||
$contents .= ob_get_clean();
|
||||
}
|
||||
|
||||
// insert template path comment tag
|
||||
if(config('debug.enabled') && Rhymix\Framework\Debug::isEnabledForCurrentUser())
|
||||
// Insert template path comment tag.
|
||||
if(config('debug.enabled') && Rhymix\Framework\Debug::isEnabledForCurrentUser() && !starts_with('<!DOCTYPE', $contents))
|
||||
{
|
||||
$sign = PHP_EOL . '<!-- Template %s : ' . $this->web_path . $this->filename . ' -->' . PHP_EOL;
|
||||
$contents = sprintf($sign, 'start') . $contents . sprintf($sign, 'end');
|
||||
|
|
@ -979,7 +984,7 @@ class TemplateHandler
|
|||
}
|
||||
|
||||
return preg_replace_callback('@(?<!::|\\\\|(?<!eval\()\')\$([a-z_][a-z0-9_]*)@i', function($matches) {
|
||||
if (preg_match('/^(?:GLOBALS|_SERVER|_COOKIE|_GET|_POST|_REQUEST|__Context|this)$/', $matches[1]))
|
||||
if (preg_match('/^(?:GLOBALS|_SERVER|_COOKIE|_GET|_POST|_REQUEST|__Context|this|lang)$/', $matches[1]))
|
||||
{
|
||||
return '$' . $matches[1];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ require dirname(__FILE__) . '/common/autoload.php';
|
|||
* @brief Initialize by creating Context object
|
||||
* Set all Request Argument/Environment variables
|
||||
**/
|
||||
$oContext = Context::getInstance();
|
||||
$oContext->init();
|
||||
Context::init();
|
||||
|
||||
/**
|
||||
* @brief Initialize and execute Module Handler
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
|
|||
// issue 512 - ignores <marquee>
|
||||
array(
|
||||
'<div class="topimgContex"><marquee direction="up" scrollamount="1" height="130" loop="infinity" behavior="lscro">{$lang->sl_show_topimgtext}</marquee></div>',
|
||||
'?><div class="topimgContex"><marquee direction="up" scrollamount="1" height="130" loop="infinity" behavior="lscro"><?php echo $__Context->lang->sl_show_topimgtext ?></marquee></div>'
|
||||
'?><div class="topimgContex"><marquee direction="up" scrollamount="1" height="130" loop="infinity" behavior="lscro"><?php echo $lang->sl_show_topimgtext ?></marquee></div>'
|
||||
),
|
||||
// issue 584
|
||||
array(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue