PluginProbe
HyperPay Payments / 5.3.0
HyperPay Payments v5.3.0
6.6.0 trunk 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.1.0 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.5 4.0.0 4.0.2 All 34 releases
hyperpay-gateways / src / App / View.php

View.php in HyperPay Payments 5.3.0, at src/App/View.php

35 lines 792 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hyperpay\Gateways\App;
4
5 if (! defined('ABSPATH')) exit;
6
7 use Hyperpay\Gateways\Main;
8
9 final class View
10 {
11 public static function render($name, $params = [])
12 {
13 $loader = new \Twig\Loader\FilesystemLoader(Main::ROOT_PATH . "/assets/templates");
14 $twig = new \Twig\Environment($loader);
15
16 $params = static::esc($params);
17
18 echo $twig->render($name, $params);
19 return;
20 }
21
22 public static function esc($value)
23 {
24 if (is_array($value)) {
25 $esc_values = [];
26 foreach ($value as $key => $nested_value) {
27 $esc_values[$key] = static::esc($nested_value);
28 }
29 return $esc_values;
30 }
31
32 return esc_html($value);
33 }
34 }
35