From: Andrey Kutejko Date: Tue, 30 Jul 2013 16:09:52 +0000 (+0300) Subject: remove redundand class X-Git-Tag: 0.5~105 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=7a50782b8b594f89e5f80022ebc81db1bfcc0905;p=ipf.git remove redundand class --- diff --git a/ipf/shortcuts.php b/ipf/shortcuts.php index 04bd11a..986e8f2 100644 --- a/ipf/shortcuts.php +++ b/ipf/shortcuts.php @@ -17,12 +17,19 @@ final class IPF_Shortcuts public static function RenderToString($tplfile, $params=array(), $request=null) { - $tmpl = new IPF_Template_File($tplfile); - if (is_null($request)) { - $context = new IPF_Template_Context($params); - } else { - $context = new IPF_Template_Context_Request($request, $params); + if ($request) { + $params = array_merge(array('request' => $request), $params); + foreach (IPF::get('template_context_processors', array()) as $proc) { + IPF::loadFunction($proc); + $params = array_merge($proc($request), $params); + } + foreach (IPF_Project::getInstance()->appList() as $app) { + $params = array_merge($app->templateContext($request), $params); + } } + $context = new IPF_Template_Context($params); + + $tmpl = new IPF_Template_File($tplfile); return $tmpl->render($context); } diff --git a/ipf/template/context/request.php b/ipf/template/context/request.php deleted file mode 100644 index 1d4684d..0000000 --- a/ipf/template/context/request.php +++ /dev/null @@ -1,18 +0,0 @@ - $request), $vars); - foreach (IPF::get('template_context_processors', array()) as $proc) { - IPF::loadFunction($proc); - $vars = array_merge($proc($request), $vars); - } - foreach (IPF_Project::getInstance()->appList() as $app) { - $vars = array_merge($app->templateContext($request), $vars); - } - parent::__construct($vars); - } -} -