Added autoloader to plugin loader, executor improvements
This commit is contained in:
38
plugins/executor/Helper.php
Normal file
38
plugins/executor/Helper.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace VfxApply\Plugin\Executor;
|
||||
|
||||
use VfxApply\Plugin;
|
||||
use VfxApply\Input;
|
||||
use VfxApply\Output;
|
||||
use VfxApply\Preset;
|
||||
|
||||
class Helper
|
||||
{
|
||||
protected $body;
|
||||
|
||||
protected $script;
|
||||
|
||||
public function __construct($body)
|
||||
{
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
public function setScript(Script $script)
|
||||
{
|
||||
$this->script = $script;
|
||||
}
|
||||
|
||||
public function call(array $env)
|
||||
{
|
||||
$body = "<?php ".preg_replace_callback('/(\{\{\%([a-z]+)\}\})/', function ($m) use ($env) {
|
||||
return $env[$m[2]];
|
||||
}, $this->body);
|
||||
|
||||
$tmpname = tempnam(null, "vfxhelper");
|
||||
file_put_contents($tmpname, $body);
|
||||
passthru("php {$tmpname}");
|
||||
unlink($tmpname);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user