| 1 |
<?php |
| 2 |
|
| 3 |
namespace BitCode\BitForm\Core\Util; |
| 4 |
|
| 5 |
class Render |
| 6 |
{ |
| 7 |
public static function loadFile($path, $data) |
| 8 |
{ |
| 9 |
$file = BITFORMS_PLUGIN_DIR_PATH . $path . '.php'; |
| 10 |
extract($data); |
| 11 |
|
| 12 |
ob_start(); |
| 13 |
|
| 14 |
include $file; |
| 15 |
|
| 16 |
return ob_get_clean(); |
| 17 |
} |
| 18 |
|
| 19 |
public static function view($path, $data = []) |
| 20 |
{ |
| 21 |
status_header(200); |
| 22 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Return value of self::loadFile() is internally escaped before output. |
| 23 |
echo self::loadFile($path, $data); |
| 24 |
|
| 25 |
exit(200); |
| 26 |
} |
| 27 |
} |
| 28 |
|