Added many events to the compiler as the first step to allow 3rd party integration with the compiler via plugins. gh-429

This commit is contained in:
2019-06-22 12:43:26 +02:00
parent e84105c3bd
commit 75656d940a
14 changed files with 227 additions and 21 deletions

View File

@ -253,6 +253,8 @@ class Compiler extends Infusion
*/
protected function setFileContent(&$name, &$path, &$bom, $view = null)
{
// Trigger Event: jcb_ce_onBeforeSetFileContent
$this->triggerEvent('jcb_ce_onBeforeSetFileContent', array(&$name, &$path, &$bom, &$view));
// set the file name
$this->fileContentStatic[$this->hhh . 'FILENAME' . $this->hhh] = $name;
// check if the file should get PHP opening
@ -263,6 +265,8 @@ class Compiler extends Infusion
}
// get content of the file
$string = ComponentbuilderHelper::getFileContents($path);
// Trigger Event: jcb_ce_onGetFileContents
$this->triggerEvent('jcb_ce_onGetFileContents', array(&$string, &$name, &$path, &$bom, &$view));
// see if we should add a BOM
if (strpos($string, $this->hhh . 'BOM' . $this->hhh) !== false)
{
@ -281,6 +285,8 @@ class Compiler extends Infusion
{
$answer = $this->setDynamicValues($answer);
}
// Trigger Event: jcb_ce_onBeforeSetFileContent
$this->triggerEvent('jcb_ce_onBeforeWriteFileContent', array(&$answer, &$name, &$path, &$bom, &$view));
// add answer back to file
$this->writeFile($path, $answer);
// count the file lines