mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
Populate 'user' property of TemplateHandler instances
This commit is contained in:
parent
45e930f04c
commit
11883fb965
1 changed files with 7 additions and 1 deletions
|
|
@ -20,6 +20,11 @@ class TemplateHandler
|
|||
private $skipTags = NULL;
|
||||
private $handler_mtime = 0;
|
||||
private static $rootTpl = NULL;
|
||||
|
||||
/**
|
||||
* Context variables accessible as $this in template files
|
||||
*/
|
||||
public $user = FALSE;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
|
|
@ -29,6 +34,7 @@ class TemplateHandler
|
|||
{
|
||||
$this->config = new stdClass;
|
||||
$this->handler_mtime = filemtime(__FILE__);
|
||||
$this->user = Context::get('logged_info');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -818,7 +824,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)$/', $matches[1]))
|
||||
if (preg_match('/^(?:GLOBALS|_SERVER|_COOKIE|_GET|_POST|_REQUEST|__Context|this)$/', $matches[1]))
|
||||
{
|
||||
return '$' . $matches[1];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue