sm = $sm; $this->ghps = $ghps; $this->headerManager = $hm; $this->footerManager = $fm; $this->jPassing = $jPassing; $this->vueLoader = $vueLoader; $this->rs = $rs; $this->em = $em; $this->frontMode = true; $this->headerPackages['js'] = ""; $this->headerPackages['css'] = ""; $this->footerPackages['js'] = ""; $this->footerPackages['css'] = ""; } protected function exec(){ $this->jPassing->set('LOCALE_CODE', $this->rs->getCurrentRequest()->getLocale()); } /** * @param Response $response * @return Response */ public function getHooks(Response $response) { $this->exec(); $content = $response->getContent(); $head = $this->headerManager->getCompiledHeader(); $foot = $this->footerManager->getCompiledHeader(); $passing = $this->jPassing->build(); if(!empty($passing)) $head = $this->headerPackages['css'].PHP_EOL.$passing.PHP_EOL.$this->headerPackages['js'].$head; else $head = $this->headerPackages['css'].PHP_EOL.$this->headerPackages['js'].$head; $foot = $this->footerPackages['css'].PHP_EOL.$this->footerPackages['js'].$foot; //vuejs $vueJsComponents = $this->vueLoader->build(); $content = str_replace( '', $head.'', $content ); $content = str_replace( '', $foot.'', $content ); $content = str_replace( '', PHP_EOL.$vueJsComponents, $content ); //only if http2 pusher is activated $http2Pusher = (bool)$this->sm->get('CORE.HTTP2.PUSHER',"0",true,"core"); if($http2Pusher){ $this->ghps->setResponse($response); preg_match_all("/ghps->pushJs($jsUrl); } } preg_match_all("/ghps->pushCss($cssUrl); } } $response = $this->ghps->buildResponse(); } $response->setContent($content); return $response; } /** * useful with package * @param bool $b */ function setFrontMode($b = true){ $this->frontMode = $b; } function setBackMode(){ $this->setFrontMode(false); } /** * @return bool */ function isFrontMode(){ return $this->frontMode; } }