File modules/cms/generator/filter/ScriptFilter.class.php
Last commit: Fri Feb 17 02:02:18 2023 +0100 Jan Dankert Refactoring: Script-context should be the same in all environments; New: DslPdf for creating PDF with scriptbox ;)
1 <?php 2 3 4 namespace cms\generator\filter; 5 6 7 use cms\generator\dsl\CMSDslInterpreter; 8 use dsl\DslException; 9 use util\exception\GeneratorException; 10 use util\Text; 11 12 class ScriptFilter extends AbstractFilter 13 { 14 public $script; 15 16 public function filter( $value ) 17 { 18 $interpreter = new CMSDslInterpreter(); 19 $interpreter->setContext( $this->context ); 20 $interpreter->setValue( $value ); 21 22 try { 23 $interpreter->runCode( $this->script ); 24 return $interpreter->getOutput(); 25 } 26 catch( DslException $e ) { 27 throw new GeneratorException('Script error in filter script'."\n".Text::makeLineNumbers($this->script),$e); 28 } 29 } 30 }
Downloadmodules/cms/generator/filter/ScriptFilter.class.php
History Fri, 17 Feb 2023 02:02:18 +0100 Jan Dankert Refactoring: Script-context should be the same in all environments; New: DslPdf for creating PDF with scriptbox ;) Tue, 14 Feb 2023 21:22:00 +0100 Jan Dankert New: ScriptFilter for filtering file values with the script language.