diff --git a/system/typemill/Controllers/ControllerApiSystemExtensions.php b/system/typemill/Controllers/ControllerApiSystemExtensions.php index 7343e1c..40cb4b2 100644 --- a/system/typemill/Controllers/ControllerApiSystemExtensions.php +++ b/system/typemill/Controllers/ControllerApiSystemExtensions.php @@ -57,7 +57,9 @@ class ControllerApiSystemExtensions extends Controller $license = new License(); $urlinfo = $this->c->get('urlinfo'); - if(!$license->checkIfTest($urlinfo)) + $test = $license->checkIfTest($urlinfo); + + if($license->checkIfTest($urlinfo) !== true) { # checks if license is valid and returns scope $licenseScope = $license->getLicenseScope($urlinfo); diff --git a/system/typemill/Events/OnTwigGlobalsLoaded.php b/system/typemill/Events/OnTwigGlobalsLoaded.php new file mode 100644 index 0000000..119c462 --- /dev/null +++ b/system/typemill/Events/OnTwigGlobalsLoaded.php @@ -0,0 +1,14 @@ + NULL, 'flash' => NULL, 'assets' => NULL]; +$TwigGlobals = $dispatcher->dispatch(new OnTwigGlobalsLoaded($TwigGlobals), 'onTwigGlobalsLoaded')->getData(); + +# echo '
'; +# print_r($TwigGlobals); +# die(); + /**************************** * OTHER CONTAINER ITEMS * ****************************/ @@ -298,7 +306,7 @@ $container->set('assets', function() use ($assets){ return $assets; }); * TWIG TO CONTAINER * ****************************/ -$container->set('view', function() use ($settings, $urlinfo, $translations, $dispatcher) { +$container->set('view', function() use ($settings, $TwigGlobals, $urlinfo, $translations, $dispatcher) { $twig = Twig::create( [ @@ -314,10 +322,12 @@ $container->set('view', function() use ($settings, $urlinfo, $translations, $dis 'autoescape' => false ] ); - - $twig->getEnvironment()->addGlobal('errors', NULL); - $twig->getEnvironment()->addGlobal('flash', NULL); - $twig->getEnvironment()->addGlobal('assets', NULL); + + foreach($TwigGlobals as $name => $feature) + { +# echo $name . ';'; + $twig->getEnvironment()->addGlobal($name, $feature); + } # add extensions $twig->addExtension(new DebugExtension());