Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Presenters;
  4.  
  5. use Nette;
  6.  
  7. class BasePresenter extends Nette\Application\UI\Presenter {
  8.  
  9.  
  10. protected function startup() {
  11. parent::startup();
  12. $this->template->developerBar = $this->context->parameters['settings']['developerBar'];
  13. $this->template->facebookAppId = $this->context->parameters['facebook']['appId'];
  14. }
  15.  
  16.  
  17.  
  18. public function createTemplate($class = NULL){
  19. $template = parent::createTemplate($class);
  20. $template->addFilter('czechdateproject', function($date){
  21. $czechMonths = ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'];
  22. return $czechMonths[$date->format('n') - 1];
  23. });
  24. $template->addFilter('czechdatebusiness', function($date){
  25. $czechMonths = ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'];
  26. return $czechMonths[$date->format('n') - 1];
  27. });
  28. $template->addFilter('readTime', function($text){
  29. return floor(str_word_count(strip_tags(trim($text))) / 160);
  30. });
  31. $template->addFilter('numberZip', function($number){
  32. $zipcode = substr($number, 0, 3)." ".substr($number, 3, 2);
  33. return $zipcode;
  34. });
  35. return $template;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement