PluginProbe
GetResponse Forms by Optin Cat / 1.3.6
GetResponse Forms by Optin Cat v1.3.6
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
getresponse / includes / classes / Mustache / LambdaHelper.php

LambdaHelper.php in GetResponse Forms by Optin Cat 1.3.6, at includes/classes/Mustache/LambdaHelper.php

50 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of Mustache.php.
5 *
6 * (c) 2010-2014 Justin Hileman
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 /**
13 * Mustache Lambda Helper.
14 *
15 * Passed as the second argument to section lambdas (higher order sections),
16 * giving them access to a `render` method for rendering a string with the
17 * current context.
18 */
19 class Mustache_LambdaHelper
20 {
21 private $mustache;
22 private $context;
23
24 /**
25 * Mustache Lambda Helper constructor.
26 *
27 * @param Mustache_Engine $mustache Mustache engine instance.
28 * @param Mustache_Context $context Rendering context.
29 */
30 public function __construct(Mustache_Engine $mustache, Mustache_Context $context)
31 {
32 $this->mustache = $mustache;
33 $this->context = $context;
34 }
35
36 /**
37 * Render a string as a Mustache template with the current rendering context.
38 *
39 * @param string $string
40 *
41 * @return string Rendered template.
42 */
43 public function render($string)
44 {
45 return $this->mustache
46 ->loadLambda((string) $string)
47 ->renderInternal($this->context);
48 }
49 }
50