Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
New event 'Vvveb\System\Core\View','compile:after'
givanz51df7d59cdb2
diff --git a/system/core/view.php b/system/core/view.phpold mode 100755new mode 100644index 23799c3..30b5b88--- a/system/core/view.php+++ b/system/core/view.php@@ -22,6 +22,8 @@namespace Vvveb\System\Core;+use function Vvveb\__;+use function Vvveb\addTranslationDomain;use function Vvveb\config;use function Vvveb\isEditor;use Vvveb\System\Component\Component;@@ -78,6 +80,9 @@ class View {$this->theme = config(APP . '.theme', 'default');}+ $domain = $this->theme . '-domain';+ addTranslationDomain($domain);+$this->htmlPath = DIR_THEME . $this->theme . DS;$this->templatePath = DIR_THEME . $this->theme . DS; //\Vvveb\config(APP . '.theme', 'default') . DS;@@ -203,7 +208,7 @@ class View {$templateFile = DIR_PUBLIC . $template;} else {FrontController::notFound(true, [- 'message' => 'Html template not found!',+ 'message' => __('Html template not found!'),'file' => $templatePath . $template,]);}@@ -245,7 +250,8 @@ class View {}}- //$vtpl = new vtpl($selector, $this->componentCount);+ list($this->template, $filename, $this->tplFile) =+ Event :: trigger(__CLASS__,__FUNCTION__, $this->template, $filename, $this->tplFile, $this->templateEngine, $this);$errors = $this->templateEngine->loadHtmlTemplate($filename);//if no template defined use the default@@ -261,7 +267,7 @@ class View {} else {$this->tplFile = DIR_TEMPLATE . 'common.tpl';}- //die();+//$this->tplFile = $pluginName . DS . APP . DS . 'template' . DS . $nameSpace;$this->templateEngine->loadTemplateFile($this->tplFile);/*@@ -274,12 +280,11 @@ class View {if (! file_exists(DIR_TEMPLATE . $this->tplFile)) {$this->tplFile = 'common.tpl';}-$this->templateEngine->loadTemplateFileFromPath($this->tplFile);}- Event :: trigger(__CLASS__,__FUNCTION__, $this->template, $filename, $this->tplFile, $this->templateEngine, $this);-+ list($this->template, $filename, $this->tplFile) =+ Event :: trigger(__CLASS__,__FUNCTION__ . ':after', $this->template, $filename, $this->tplFile, $this->templateEngine, $this);$this->templateEngine->saveCompiledTemplate($file);}@@ -304,6 +309,8 @@ class View {. str_replace([DS, '/', '\\'] , '_', $filename). ($this->isEditor ? '-edit' : '');+ list($filename, $compiledFilename) = Event :: trigger(__CLASS__,__FUNCTION__, $filename, $compiledFilename, $this);+$this->compiledTemplate = $compiledFilename;$this->serviceTemplate = $compiledFilename;$this->tplFile = str_replace('.html', '.tpl', $filename);@@ -346,7 +353,11 @@ class View {if ($this->_type == 'text') {if (isset($this->text)) {- echo $this->text;+ if ($output) {+ echo $this->text;+ } else {+ return $this->text;+ }}return;@@ -359,13 +370,18 @@ class View {$jsonFlags = JSON_PRETTY_PRINT;//}ob_start();+if (isset($this->json)) {- echo json_encode($this->json, $jsonFlags);+ $json = json_encode($this->json, $jsonFlags);} else {- echo json_encode($this, $jsonFlags);+ $json = json_encode($this, $jsonFlags);}- return ob_end_flush();+ if ($output) {+ echo $json;+ } else {+ return $json;+ }} else { //htmlif (! $this->template) {self::template();