Exemplo n.º 1
0
 function sendFormSucceeded(\Nette\Forms\BootstrapUIForm $form)
 {
     $helpdesk = $this->database->table("helpdesk")->get(1);
     $helpdesk_admin = $helpdesk->related("helpdesk_emails", "helpdesk_id")->get(1);
     $helpdesk_customer = $helpdesk->related("helpdesk_emails", "helpdesk_id")->get(2);
     $arr = array("subject" => $form->values->name, "email" => $form->values->email, "message" => $form->values->message, "ipaddress" => getenv('REMOTE_ADDR'), "helpdesk_id" => 1, 'date_created' => date("Y-m-d H:i"), 'session_id' => session_id());
     if ($this->presenter->user->isLoggedIn()) {
         $arr["users_id"] = $this->presenter->template->member->id;
     }
     if ($helpdesk->fill_phone > 0) {
         $arr["phone"] = $form->values->phone;
     }
     $this->database->table("helpdesk_messages")->insert($arr);
     $params = array('name' => $form->values->name, 'email' => $form->values->email, 'phone' => $form->values->phone, 'message' => $form->values->message, 'ipaddress' => getenv('REMOTE_ADDR'), 'time' => date("Y-m-d H:i"), 'settings' => $this->presenter->template->settings);
     $latte = new \Latte\Engine();
     $latte->setLoader(new Latte\Loaders\StringLoader());
     //$latte->setTempDirectory(__DIR__ . '/../temp');
     $email_admin = $latte->renderToString($helpdesk_admin->body, $params);
     $email_customer = (string) $latte->renderToString($helpdesk_customer->body, $params);
     $mail = new \Nette\Mail\Message();
     $mail->setFrom($this->presenter->template->settings["contacts:email:hq"]);
     $mail->addTo($this->presenter->template->settings["contacts:email:hq"]);
     $mail->setHTMLBody($email_customer);
     $mailA = new \Nette\Mail\Message();
     $mailA->setFrom($this->presenter->template->settings["contacts:email:hq"]);
     $mailA->addTo($form->values->email);
     $mailA->setHTMLBody($email_admin);
     $mailer = new \Nette\Mail\SendmailMailer();
     $mailer->send($mail);
     $mailer->send($mailA);
     $this->presenter->flashMessage($this->presenter->translator->translate('messages.sign.thanksForMessage'), "error");
     $this->presenter->redirect(":Front:Contact:default");
 }
Exemplo n.º 2
0
 function sendFormSucceeded(\Nette\Forms\BootstrapUIForm $form)
 {
     $email = $form->getValues()->email;
     if ($form->values->layer == 'admin') {
         $lostPass = $this->database->table("helpdesk_emails")->where("template", "lostpass-admin")->fetch();
     } else {
         $lostPass = $this->database->table("helpdesk_emails")->where("template", "lostpass-member")->fetch();
     }
     if (!\Nette\Utils\Validators::isEmail($email)) {
         $this->presenter->flashMessage("Adresa je neplatná");
         $this->presenter->redirect(":Front:Sign:lostpass");
     }
     $passwordGenerate = \Nette\Utils\Random::generate(12, "987654321zyxwvutsrqponmlkjihgfedcba");
     if ($this->database->table('users')->where(array('email' => $email))->count() == 0) {
         $this->flashMessage("E-mail nenalezen");
         $this->presenter->redirect(":Front:Sign:lostpass");
     }
     $member = new \App\Model\MemberModel($this->database);
     $member->setActivation($email, $passwordGenerate);
     $latte = new \Latte\Engine();
     $latte->setLoader(new \Latte\Loaders\StringLoader());
     $params = array('code' => $passwordGenerate, 'email' => $email, 'settings' => $this->presenter->template->settings);
     $mail = new \Nette\Mail\Message();
     $mail->setFrom($this->presenter->template->settings['contacts:email:hq'])->addTo($email)->setSubject("Informace o novém hesle")->setHTMLBody($latte->renderToString($lostPass->body, $params));
     $mailer = new \Nette\Mail\SendmailMailer();
     $mailer->send($mail);
     $this->presenter->flashMessage('Informace o zapomenutém hesle odeslány', 'success');
     $this->presenter->redirect(this);
 }
 public static function install(Latte\Engine $latte)
 {
     $me = new static();
     $latte->addFilter('emphasize', array($me, 'filterEmphasize'));
     foreach (self::$set as $filter_name => $callback) {
         $latte->addFilter($filter_name, $callback);
     }
 }
Exemplo n.º 4
0
 /**
  * Funkce odesílající email s heslem po registraci.
  * 
  * Maily odesílá podle šablony v presenters/Emaily/novyucet.latte
  * 
  * @param string $jmeno Jméno člověka
  * @param string $heslo Heslo
  * @param string $email Email
  * @return integer Počet odeslaných mailů
  */
 public function sendRegistrace($jmeno, $heslo, $email)
 {
     $mail = new Message();
     $mail->setFrom($this->mailerFromAddress)->setSubject('Registrace na stránkách SVJ Čiklova 647/3');
     $mail->addTo($email, $jmeno);
     $latte = new \Latte\Engine();
     $params = array('email' => $email, 'heslo' => $heslo);
     $mail->setHtmlBody($latte->renderToString(self::templateFolder . 'novyucet.latte', $params));
     $this->mailer->send($mail);
     return 1;
 }
Exemplo n.º 5
0
 public function formContactSubmitted(Nette\Application\UI\Form $form)
 {
     $fd = $form->getValues();
     $latte = new \Latte\Engine();
     $params = array('text' => $fd->text);
     $mail = new Nette\Mail\Message();
     $mail->setFrom($fd->email)->addTo('*****@*****.**')->setSubject('Svatba ' . $fd->phone)->setHtmlBody($latte->renderToString('../app/presenters/templates/mail.latte', $params));
     $this->mailer->send($mail);
     $this->flashMessage("Email byl odeslán. Ozveme se :-)", "success");
     $this->redirect("this");
 }
Exemplo n.º 6
0
 function sendFormSucceeded(\Nette\Forms\BootstrapUIForm $form)
 {
     $emailDb = $this->database->table("helpdesk_emails")->get($form->values->id);
     $latte = new \Latte\Engine();
     $params = array('body' => "Body");
     $paramsTemplate = array('name' => "John Doe", 'phone' => "+420 123 456 789", 'email' => $this->presenter->template->settings["contacts:email:hq"], 'address' => "42.42.42.256", 'time' => date("j. n. Y H:i:s"), 'message' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " . "Aliquam purus lacus, tempor sit amet tincidunt ut, finibus non quam. " . "Quisque ac metus quis odio vestibulum consectetur congue id diam. " . "Sed ligula ante, suscipit sed purus ac, dignissim hendrerit nisi.<br /> " . "Praesent scelerisque nulla nec posuere accumsan. Etiam ac libero in " . "ipsum volutpat accumsan. Sed pretium sodales fermentum. Quisque sed feugiat odio. ");
     $latte->setLoader(new \Latte\Loaders\StringLoader());
     $renderedTemplate = $latte->renderToString($emailDb->body, $paramsTemplate);
     $mail = new \Nette\Mail\Message();
     $mail->setFrom($this->presenter->template->settings["site:title"] . ' <' . $this->presenter->template->settings["contacts:email:hq"] . '>')->addTo($form->values->email)->setSubject($emailDb->subject)->setHTMLBody($renderedTemplate);
     $this->presenter->mailer->send($mail);
     $this->presenter->redirect(this, array("id" => $form->values->id));
 }
Exemplo n.º 7
0
 public function scanRoutes($path)
 {
     $routes = [];
     $latte = new Latte\Engine();
     $macroSet = new Latte\Macros\MacroSet($latte->getCompiler());
     $macroSet->addMacro('url', function ($node) use(&$routes, &$file) {
         $routes[$node->args] = (string) $file;
     }, NULL, NULL, $macroSet::ALLOWED_IN_HEAD);
     foreach (Nette\Utils\Finder::findFiles('*.latte')->from($path) as $file) {
         $latte->compile($file);
     }
     return $routes;
 }
Exemplo n.º 8
0
 public function convert($filePathIn, $filePathOut)
 {
     $replace = [];
     $replace['js_app'] = file_get_contents(__DIR__ . "/../../templates/{$this->usedTemplate}/" . "{$this->usedTemplate}.js");
     $replace['js_bootstrap'] = file_get_contents(self::PATH_DIST_BOOTSTRAP_JS);
     $replace['css_app'] = file_get_contents(__DIR__ . "/../../templates/{$this->usedTemplate}/" . "{$this->usedTemplate}.css");
     $replace['css_bootstrap'] = file_get_contents(self::PATH_DIST_BOOTSTRAP_CSS);
     $replace['content'] = $this->mdParser->parse(file_get_contents($filePathIn));
     $output['html'] = $this->latte->renderToString(__DIR__ . "/../../templates/{$this->usedTemplate}/" . "{$this->usedTemplate}.latte", $replace);
     $output['pdf'] = "@todo :)";
     $this->fs->write("{$filePathOut}.html", $output['html']);
     $this->fs->write("{$filePathOut}.pdf", $output['pdf']);
 }
 /**
  * @dataProvider translateDataProvider
  */
 public function testTranslate($translated, $latteTpl, $expected, $arguments)
 {
     $translatorMock = $this->getMockForAbstractClass('Nette\\Localization\\ITranslator');
     $translatorMock->expects($this->any())->method('translate')->will($this->returnValue($translated));
     $latte = new Latte\Engine();
     $latte->addFilter('translate', array($translatorMock, 'translate'));
     $latte->onCompile[] = function ($engine) {
         Nedryse\Latte\Macros\TemplateMacroSet::install($engine->getCompiler());
     };
     $name = tempnam(sys_get_temp_dir(), 'name');
     file_put_contents($name, $latteTpl);
     $this->assertSame($expected, $latte->renderToString($name, $arguments));
     unlink($name);
 }
Exemplo n.º 10
0
function renderLatte($path, $parameters = array())
{
    global $App;
    global $View;
    global $wp_query;
    global $post;
    $fullParameters = array('App' => $App, 'baseUrl' => toPath(WP_HOME), 'basePath' => toRelativePath(WP_HOME), 'assetsUrl' => toPath(WP_HOME) . '/assets', 'assetsPath' => toRelativePath(WP_HOME) . '/assets', 'wp_query' => $wp_query, 'post' => $post, 'flashes' => getFlashSession()->flash ?: []);
    foreach ($View as $key => $val) {
        $fullParameters[$key] = $val;
    }
    foreach ($parameters as $key => $val) {
        $fullParameters[$key] = $val;
    }
    $latte = new Latte\Engine();
    $latte->setTempDirectory(TEMP_DIR . '/cache/latte');
    MangoPressTemplatingMacroSet::install($latte->getCompiler());
    Nette\Bridges\FormsLatte\FormMacros::install($latte->getCompiler());
    MangoPressTemplatingFilterSet::install($latte);
    return $latte->render($path, (array) $fullParameters);
}
Exemplo n.º 11
0
 /**
  * @param $to array|string
  * @param $params array
  * @param $template string
  * @return bool|string
  * @throws \Exception
  */
 public function send($to, $params, $template)
 {
     $latte = new \Latte\Engine();
     $mail = new Message();
     $mail->setFrom($this->fromEmail)->setHtmlBody($latte->renderToString($this->templateDir . '/' . $template, $params));
     if (!empty($this->archiveEmail)) {
         $mail->addBcc($this->archiveEmail);
     }
     if (is_string($to)) {
         $mail->addTo($to);
     } elseif (is_array($to) && count($to) > 0) {
         $mail->addTo($to[0]);
         for ($i = 1; $i < count($to); $i++) {
             $mail->addCc($to[$i]);
         }
     } else {
         return "Bad 'to' parameter";
     }
     $this->mailer->send($mail);
     return true;
 }
Exemplo n.º 12
0
 /**
  * @return  self
  */
 private function configure(array $config)
 {
     $configurator = new Configurator($config);
     $config = $configurator->getConfig();
     //$this->fs = new Filesystem(new Local(__DIR__ . '/../../'));
     $this->fs = new Filesystem(new Local('/'));
     $this->latte = new \Latte\Engine();
     $this->latte->setTempDirectory('/tmp');
     $mdParser = '\\cebe\\markdown\\' . $config['syntax'];
     $this->mdParser = new $mdParser();
     $this->mdParser->html5 = $config['html5'];
     return $this;
 }
Exemplo n.º 13
0
 function sendLoginFormSucceeded(\Nette\Forms\BootstrapUIForm $form)
 {
     $pwd = \Nette\Utils\Random::generate(10);
     $pwdEncrypted = \Nette\Security\Passwords::hash($pwd);
     $user = $this->database->table('users')->get($form->values->contact_id);
     $this->database->table("users")->get($user->id)->update(array("password" => $pwdEncrypted));
     if ($form->values->sendmail) {
         $latte = new \Latte\Engine();
         $latte->setLoader(new \Latte\Loaders\StringLoader());
         $params = array('username' => $user->username, 'email' => $user->email, 'password' => $pwd, 'settings' => $this->presenter->template->settings);
         $helpdesk = $this->database->table("helpdesk")->get(4);
         $helpdesk_resend_login = $helpdesk->related("helpdesk_emails", "helpdesk_id")->get(8);
         $helpdesk_resend = $latte->renderToString($helpdesk_resend_login->body, $params);
         $mail = new \Nette\Mail\Message();
         $mail->setFrom($this->presenter->template->settings["site:title"] . ' <' . $this->presenter->template->settings["contacts:email:hq"] . '>')->addTo($user->email)->setHTMLBody($helpdesk_resend);
         $mailer = new \Nette\Mail\SendmailMailer();
         $mailer->send($mail);
     } else {
         $this->presenter->flashMessage("pass", "success");
     }
     $this->presenter->redirect(this, array("id" => $form->values->contact_id, "pdd" => $pwd));
 }
Exemplo n.º 14
0
 public function createSunglassesSucceeded($form, $values)
 {
     unset($values['create']);
     unset($values['next']);
     $sessionCompetition = $this->getSession('sessionCompetition');
     /* if ($this->model->existEmail($values['email'])) {
        $sessionCompetition->finishMore = true;
        $this->redirect('default');
        } */
     $userCompetition = $this->model->saveCompetition($values);
     var_dump($userCompetition->competitionSunglassesid);
     $saveEmailData = array("email" => $values['email'], "type" => 1);
     $this->modelEmails->saveEmail($saveEmailData);
     $sessionCompetition->finishSucces = true;
     $latte = new \Latte\Engine();
     $params = array('orderId' => 123);
     $mail = new \Nette\Mail\Message();
     $mail->setFrom('CoMa <*****@*****.**>')->addTo('*****@*****.**')->setHtmlBody($latte->renderToString(__DIR__ . "/../presenters/templates/Email/confirmRegistration.latte", $params));
     $mailer = new \Nette\Mail\SendmailMailer();
     $mailer->send($mail);
     //$this->redirect('default');
 }
Exemplo n.º 15
0
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/Applications/MAMP/htdocs/orbinet/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\xampp\\htdocs\\TransportCompany\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
Exemplo n.º 17
0
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/www/Git/nette/app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/var/www/fakturace/app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
Exemplo n.º 19
0
 public function actionDoc($articleId)
 {
     try {
         $article = $this->articleFacade->findOneById($articleId);
         $latte = new \Latte\Engine();
         $latte->setTempDirectory("../temp/cache");
         $content["article"] = $article;
         $content["basePath"] = $this->getHttpRequest()->getUrl()->getBaseUrl();
         $result = $latte->renderToString(__DIR__ . "/templates/export/article/default.latte", $content);
         $fileName = \Nette\Utils\Strings::webalize($article->url);
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Content-Type: application/force-download");
         header("Content-Type: application/octet-stream");
         header("Content-Type: application/download");
         header("Content-Disposition: attachment;filename={$fileName}.doc");
         header("Content-Transfer-Encoding: binary ");
         echo $result;
         exit;
     } catch (EntityNotFoundException $ex) {
         \Tracy\Debugger::log($ex);
         $this->flashMessage("Požadovaný článek nebyl nalezen.", "alert-danger");
         $this->redirect("Articles:default");
     }
 }
Exemplo n.º 20
0
 function signUpFormSucceeded(\Nette\Forms\BootstrapUIForm $form)
 {
     $activationCode = \Nette\Utils\Random::generate(12, "987654321zyxwvutsrqponmlkjihgfedcba");
     $password = \Nette\Security\Passwords::hash($form->values->pwd);
     $arr = array("email" => $form->values->email, "username" => $form->values->username, "password" => $password, "activation" => $activationCode, "newsletter" => (bool) $form->values->newsletter, "state" => 0, "users_roles_id" => 4, "date_created" => date("Y-m-d H:i:s"));
     if ($this->presenter->template->settings['members:groups:enabled']) {
         $arr["categories_id"] = $form->values->group;
     }
     $userId = $this->database->table("users")->insert($arr);
     $this->database->table("users")->where(array("id" => $userId->id))->update(array("uid" => \Nette\Utils\Strings::padLeft($userId->id, 6, '0')));
     if ($this->template->settings['members:signup:contactEnabled']) {
         $arrContacts = array("categories_id" => 44, "users_id" => $userId, "name" => $form->values->name, "street" => $form->values->street, "city" => $form->values->city, "zip" => $form->values->zip, "countries_id" => 1);
         if ($this->presenter->template->settings['members:signup:companyEnabled']) {
             $arrContacts["company"] = $form->values->company;
             $arrContacts["vatin"] = $form->values->vatin;
             $arrContacts["vatid"] = $form->values->vatid;
         }
         $contactId = $this->database->table("contacts")->insert($arrContacts);
         $this->database->table("contacts")->get($contactId)->update(array("order" => $contactId));
     }
     if ($form->values->vatin) {
         $ares = new \h4kuna\Ares\Ares();
         $aresArr = $ares->loadData('')->toArray();
     }
     $latte = new \Latte\Engine();
     $latte->setLoader(new \Latte\Loaders\StringLoader());
     $params = array('username' => $form->values->username, 'activationCode' => $activationCode, 'settings' => $this->presenter->template->settings, 'form' => $form, 'aresArr' => $aresArr);
     $helpdesk = $this->database->table("helpdesk")->get(3);
     $helpdesk_signup_member = $helpdesk->related("helpdesk_emails", "helpdesk_id")->get(5);
     $helpdesk_signup_confirmbyadmin = $helpdesk->related("helpdesk_emails", "helpdesk_id")->get(6);
     $helpdesk_signup_adminconfirm = $helpdesk->related("helpdesk_emails", "helpdesk_id")->get(7);
     try {
         if ($this->presenter->template->settings['members:signup:confirmByAdmin']) {
             $email_signup_confirmbyamin = $latte->renderToString($helpdesk_signup_confirmbyadmin->body, $params);
             $email_signup_adminconfirm = $latte->renderToString($helpdesk_signup_adminconfirm->body, $params);
             $mail = new \Nette\Mail\Message();
             $mail->setFrom($this->presenter->template->settings['contacts:email:hq'])->addTo($form->values->email)->setHTMLBody($email_signup_confirmbyamin);
             $this->presenter->mailer->send($mail);
             $mailA = new \Nette\Mail\Message();
             $mailA->setFrom($this->presenter->template->settings['contacts:email:hq'])->addTo($this->presenter->template->settings['contacts:email:hq'])->setHTMLBody($email_signup_adminconfirm);
             $this->presenter->mailer->send($mailA);
             $this->flashMessage('Registrace byla dokončena. Po ověření Vám bude zaslán e-mail, po kterém se můžete přihlásit', 'note');
         } else {
             $email_signup_member = $latte->renderToString($helpdesk_signup_member->body, $params);
             $mail = new \Nette\Mail\Message();
             $mail->setFrom($this->presenter->template->settings['contacts:email:hq'])->addTo($form->values->email)->setHTMLBody($email_signup_member);
             $this->presenter->mailer->send($mail);
             $this->presenter->flashMessage('Vaše registrace proběhla úspěšně. Po ověření se můžete přihlásit.', 'note');
         }
         $this->presenter->redirect(":Front:Sign:ed");
     } catch (\Nette\Mail\SmtpException $e) {
         $this->presenter->flashMessage('E-mail nebyl odeslán' . $e->getMessage(), 'error');
         $this->presenter->redirect(":Front:Sign:up");
     }
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/www/plavbyolomouc.cz/rezervace.plavbyolomouc.cz/app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
Exemplo n.º 22
0
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('E:\\xampp\\htdocs\\pskeleton\\tests/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\xampp\\htdocs\\MyWallet\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/fuca/Projects/www/sportsclub/tests/tmp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Kdyby\Translation\Latte\TranslateMacros::install($service->getCompiler());
     $service->addFilter('translate', array($this->container->getService('translation.helpers'), 'translate'));
     $service->addFilter('getTranslator', array($this->container->getService('translation.helpers'), 'getTranslator'));
     $service->onCompile = $this->container->getService('events.manager')->createEvent(array('Latte\\Engine', 'onCompile'), $service->onCompile);
     return $service;
 }
Exemplo n.º 25
0
 /**
  * Returns HTML code of panel.
  * @return mixed
  */
 public function getPanel()
 {
     if ($this->countAll === 0 && $this->hideEmpty) {
         return;
     }
     $this->processMessage();
     $latte = new \Latte\Engine();
     $latte->setTempDirectory($this->fileMailer->getTempDirectory());
     return $latte->renderToString(__DIR__ . '/MailPanel.latte', ['messages' => $this->messages, 'countNew' => $this->countNew, 'countAll' => $this->countAll, 'show' => $this->show]);
 }
Exemplo n.º 26
0
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\Users\\Raiper34\\Desktop\\server\\root\\nette\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\wamp\\www\\rocnikovy_projekt\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\Users\\prcharom\\Desktop\\EasyPHP-DevServer-14.1VC9\\data\\localweb\\nastenka\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
Exemplo n.º 29
0
}
// trailing ? > remover
$checker->tasks[] = function (CodeChecker $checker, $s) {
    if ($checker->is('php,phpt')) {
        $tmp = rtrim($s);
        if (substr($tmp, -2) === '?>') {
            $checker->fix('contains closing PHP tag ?>');
            return substr($tmp, 0, -2);
        }
    }
};
// lint Latte templates
$checker->tasks[] = function (CodeChecker $checker, $s) {
    if ($checker->is('latte')) {
        try {
            $latte = new Latte\Engine();
            $latte->setLoader(new Latte\Loaders\StringLoader());
            $latte->compile($s);
        } catch (Latte\CompileException $e) {
            if (!preg_match('#Unknown (macro|attribute)#A', $e->getMessage())) {
                $checker->error($e->getMessage(), $e->sourceLine);
            }
        }
    }
};
// lint Neon
$checker->tasks[] = function (CodeChecker $checker, $s) {
    if ($checker->is('neon')) {
        try {
            Nette\Neon\Neon::decode($s);
        } catch (Nette\Neon\Exception $e) {
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/richmond/vhosts/nette-test/sandbox/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     $service->onCompile = $this->container->getService('events.manager')->createEvent(array('Latte\\Engine', 'onCompile'), $service->onCompile, NULL, FALSE);
     return $service;
 }