| Server IP : 68.178.247.200 / Your IP : 216.73.217.108 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/x9dppmxs4rgd/www/wp-content/plugins/wpide/PHP-Parser/lib/PHPParser/ |
Upload File : |
<?php
class PHPParser_TemplateLoader
{
protected $parser;
protected $baseDir;
protected $suffix;
/**
* Constructs a filesystem template loader.
*
* The templates are loaded from {baseDir}/{name}{suffix}.
*
* @param PHPParser_Parser $parser A PHP parser instance
* @param string $baseDir The base directory to load templates from
* @param string $suffix An optional suffix to append after the template name
*/
public function __construct(PHPParser_Parser $parser, $baseDir, $suffix = '') {
if (!is_dir($baseDir)) {
throw new InvalidArgumentException(
sprintf('The specified base directory "%s" does not exist', $baseDir)
);
}
$this->parser = $parser;
$this->baseDir = $baseDir;
$this->suffix = $suffix;
}
/**
* Loads the template with the specified name.
*
* @param string $name The name of template
*
* @return PHPParser_Template The loaded template
*/
public function load($name) {
$file = $this->baseDir . '/' . $name . $this->suffix;
if (!is_file($file)) {
throw new InvalidArgumentException(
sprintf('The file "%s" does not exist', $file)
);
}
return new PHPParser_Template($this->parser, file_get_contents($file));
}
}