@@ -17,8 +17,6 @@ |
||
| 17 | 17 | use Nette; |
| 18 | 18 | use Nette\Application; |
| 19 | 19 | use Nette\Localization; |
| 20 | -use Nette\Utils; |
|
| 21 | - |
|
| 22 | 20 | use IPub; |
| 23 | 21 | use IPub\FlashMessages; |
| 24 | 22 | use IPub\FlashMessages\Exceptions; |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | $messages = $this->sessionStorage->get(FlashMessages\SessionStorage::KEY_MESSAGES); |
| 151 | 151 | |
| 152 | 152 | // Assign vars to template |
| 153 | - $this->template->flashes = $messages ? $messages : []; |
|
| 154 | - $this->template->useTitle = $this->useTitle; |
|
| 155 | - $this->template->useOverlay = $this->useOverlay; |
|
| 153 | + $this->template->flashes = $messages ? $messages : []; |
|
| 154 | + $this->template->useTitle = $this->useTitle; |
|
| 155 | + $this->template->useOverlay = $this->useOverlay; |
|
| 156 | 156 | |
| 157 | 157 | // Check if translator is available |
| 158 | 158 | if ($this->getTranslator() instanceof Localization\ITranslator) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // If template was not defined before... |
| 163 | 163 | if ($this->template->getFile() === NULL) { |
| 164 | 164 | // ...try to get base component template file |
| 165 | - $templateFile = !empty($this->templateFile) ? $this->templateFile : __DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR .'default'. DIRECTORY_SEPARATOR .'default.latte'; |
|
| 165 | + $templateFile = !empty($this->templateFile) ? $this->templateFile : __DIR__ . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'default.latte'; |
|
| 166 | 166 | $this->template->setFile($templateFile); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -191,12 +191,12 @@ discard block |
||
| 191 | 191 | $template = basename($templateFile, '.latte'); |
| 192 | 192 | |
| 193 | 193 | // ...check if extension template is used |
| 194 | - if (is_file(__DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR .'default.latte')) { |
|
| 195 | - $templateFile = __DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR .'default.latte'; |
|
| 194 | + if (is_file(__DIR__ . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR . 'default.latte')) { |
|
| 195 | + $templateFile = __DIR__ . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR . 'default.latte'; |
|
| 196 | 196 | |
| 197 | 197 | } else { |
| 198 | 198 | // ...if not throw exception |
| 199 | - throw new Exceptions\FileNotFoundException('Template file "'. $templateFile .'" was not found.'); |
|
| 199 | + throw new Exceptions\FileNotFoundException('Template file "' . $templateFile . '" was not found.'); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
@@ -14,9 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace IPub\FlashMessages\Events; |
| 16 | 16 | |
| 17 | -use Nette; |
|
| 18 | 17 | use Nette\Application; |
| 19 | - |
|
| 20 | 18 | use IPub; |
| 21 | 19 | use IPub\FlashMessages; |
| 22 | 20 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $messages = $this->sessionStorage->get(FlashMessages\SessionStorage::KEY_MESSAGES, []); |
| 44 | 44 | |
| 45 | - foreach($messages as $key => $message) { |
|
| 45 | + foreach ($messages as $key => $message) { |
|
| 46 | 46 | if ($message->isDisplayed()) { |
| 47 | 47 | unset($messages[$key]); |
| 48 | 48 | } |
@@ -16,10 +16,8 @@ |
||
| 16 | 16 | |
| 17 | 17 | use Nette; |
| 18 | 18 | use Nette\Localization; |
| 19 | - |
|
| 20 | 19 | use Kdyby; |
| 21 | 20 | use Kdyby\Translation; |
| 22 | - |
|
| 23 | 21 | use IPub; |
| 24 | 22 | use IPub\FlashMessages\Adapters; |
| 25 | 23 | use IPub\FlashMessages\Entities; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | */ |
| 85 | 85 | public static function register(Nette\Configurator $config, $extensionName = 'flashMessages') |
| 86 | 86 | { |
| 87 | - $config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
| 87 | + $config->onCompile[] = function(Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
| 88 | 88 | $compiler->addExtension($extensionName, new FlashMessagesExtension()); |
| 89 | 89 | }; |
| 90 | 90 | } |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | class Message extends Nette\Object implements IMessage |
| 25 | 25 | { |
| 26 | - const LEVEL_INFO = 'info'; |
|
| 26 | + const LEVEL_INFO = 'info'; |
|
| 27 | 27 | const LEVEL_SUCCESS = 'success'; |
| 28 | 28 | const LEVEL_WARNING = 'warning'; |
| 29 | - const LEVEL_ERROR = 'error'; |
|
| 29 | + const LEVEL_ERROR = 'error'; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @var string |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __construct(Localization\ITranslator $translator = NULL, Adapters\IPhraseAdapter $phraseAdapter) |
| 71 | 71 | { |
| 72 | - $this->translator = $translator; |
|
| 73 | - $this->phraseAdapter = $phraseAdapter; |
|
| 72 | + $this->translator = $translator; |
|
| 73 | + $this->phraseAdapter = $phraseAdapter; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * Define session keys |
| 24 | 24 | */ |
| 25 | - const KEY_MESSAGES = 'messages'; |
|
| 26 | - const KEY_IMPORTANT = 'important'; |
|
| 25 | + const KEY_MESSAGES = 'messages'; |
|
| 26 | + const KEY_IMPORTANT = 'important'; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @var Http\SessionSection |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | function __construct($message, $count, $parameters = []) |
| 43 | 43 | { |
| 44 | - $this->parameters = $parameters; |
|
| 45 | - $this->count = $count; |
|
| 46 | - $this->message = $message; |
|
| 44 | + $this->parameters = $parameters; |
|
| 45 | + $this->count = $count; |
|
| 46 | + $this->message = $message; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |