From 7a50782b8b594f89e5f80022ebc81db1bfcc0905 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 30 Jul 2013 19:09:52 +0300 Subject: [PATCH] remove redundand class --- ipf/shortcuts.php | 17 ++++++++++++----- ipf/template/context/request.php | 18 ------------------ 2 files changed, 12 insertions(+), 23 deletions(-) delete mode 100644 ipf/template/context/request.php 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); - } -} - -- 2.49.0