本文整理汇总了PHP中TemplateEngine::clearActivatedTemplates方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateEngine::clearActivatedTemplates方法的具体用法?PHP TemplateEngine::clearActivatedTemplates怎么用?PHP TemplateEngine::clearActivatedTemplates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateEngine
的用法示例。
在下文中一共展示了TemplateEngine::clearActivatedTemplates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/** Handle some event
*
* Call this function to make TSunic do some job. This method will search
* for the requested module and function and run it providing the given
* parameters
*
* @param string $event
* If running internally, enter the event here
* @param array|string $parameters
* Parameters for event function (internal-run only!)
*
* @return bool|mix
*/
public function run($event = NULL, $parameters = NULL)
{
$this->internal_run = false;
// is internal run?
if (!empty($event)) {
// internal
$this->internal_run = true;
// get parameter-string
$parameter_string = '';
if (!($parameters === false)) {
// put values in array
if (!is_array($parameters)) {
$parameters = array($parameters);
}
// create parameter-string for function
foreach ($parameters as $index => $value) {
// use nowdoc to define string (TRICKY!)
$parameters[$index] = '<<<\'EOD\'' . chr(10) . $value . chr(10) . 'EOD' . chr(10);
}
$parameter_string = implode(',', $parameters);
}
} else {
// external
// delete old activated templates
$this->Tmpl->clearActivatedTemplates();
// redirect, if back-link
if ($this->isIndex() and isset($_GET['back'])) {
$this->redirect('this');
}
// get event
$event = $this->Input->get('event');
if (empty($event)) {
if ($this->isAjax()) {
return false;
}
$this->redirect('default');
exit;
}
}
$this->Log->log(6, "Run: {$event}");
// get path and file-object
$path = '#runtime#functions/' . $event . '.func.php';
$File = $this->get('$$$File', array($path));
// does file exists?
if (!$File->isFile()) {
// function doesn't exist
if ($this->internal_run or $this->isAjax()) {
return false;
}
// page not found!
$this->Log->alert('error', '{CLASS__TSUNIC__PAGE_NOT_FOUND}');
$this->redirect('back');
}
// include function
$File->includeFile();
// run function
if (!$this->internal_run or empty($parameter_string)) {
$return = $event();
} else {
$to_eval = '$return = ' . $event . '(' . $parameter_string . ');';
try {
@eval($to_eval);
} catch (Exception $e) {
// invalid function
$this->throwError('Fatale error: Requested function is invalid! (' . $this->Input->get('event') . ')');
}
}
if (!$this->internal_run or $return === NULL) {
return true;
}
return $return;
}