Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions library/Rain/Tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,27 @@ public function draw($templateFilePath, $toString = FALSE) {
extract($this->var);
// Merge local and static configurations
$this->config = $this->objectConf + static::$conf;

//create context
$context = $this->getPlugins()->createContext(array(
'conf' => $this->config,
));

// Execute plugins, before_draw
$this->getPlugins()->run('beforeDraw', $context);

ob_start();
require $this->checkTemplate($templateFilePath);
$html = ob_get_clean();
//updating code
$context->code = ob_get_clean();

// Execute plugins, before_parse
$context = $this->getPlugins()->createContext(array(
'code' => $html,
'conf' => $this->config,
));
// Execute plugins, after_draw
$this->getPlugins()->run('afterDraw', $context);
$html = $context->code;

if ($toString)
return $html;
return $context->code;
else
echo $html;
echo $context->code;
}

/**
Expand All @@ -138,23 +142,28 @@ public function drawString($string, $toString = false) {
extract($this->var);
// Merge local and static configurations
$this->config = $this->objectConf + static::$conf;

//create context
$context = $this->getPlugins()->createContext(array(
'conf' => $this->config,
));

// Execute plugins, before_draw
$this->getPlugins()->run('beforeDraw', $context);

ob_start();
require $this->checkString($string);
$html = ob_get_clean();
$context->code = ob_get_clean();


// Execute plugins, before_parse
$context = $this->getPlugins()->createContext(array(
'code' => $html,
'conf' => $this->config,
));
// Execute plugins, after_parse
$this->getPlugins()->run('afterDraw', $context);
$html = $context->code;

if ($toString)
return $html;
return $context->code;
else
echo $html;
echo $context->code;

}

/**
Expand Down