@@ -16,7 +16,6 @@ |
||
| 16 | 16 | /** |
| 17 | 17 | * Log mail messages to eml file |
| 18 | 18 | * @param string $type |
| 19 | - * @param string $text |
|
| 20 | 19 | * @return void |
| 21 | 20 | */ |
| 22 | 21 | public function log($type, Nette\Mail\Message $mail); |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | |
| 9 | 9 | namespace Ublaboo\Mailing; |
| 10 | 10 | |
| 11 | -use Nette, |
|
| 12 | - Ublaboo; |
|
| 11 | +use Nette; |
|
| 12 | +use Ublaboo; |
|
| 13 | 13 | |
| 14 | 14 | abstract class Mail extends Nette\Object |
| 15 | 15 | { |
@@ -172,7 +172,7 @@ |
||
| 172 | 172 | /** |
| 173 | 173 | * Convert class name to underscore and set latte file extension |
| 174 | 174 | */ |
| 175 | - $this->underscore_name = lcfirst(preg_replace_callback('/(?<=.)([A-Z])/', function ($m) { |
|
| 175 | + $this->underscore_name = lcfirst(preg_replace_callback('/(?<=.)([A-Z])/', function($m) { |
|
| 176 | 176 | return '_' . strtolower($m[1]); |
| 177 | 177 | }, $class_name)); |
| 178 | 178 | |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | |
| 9 | 9 | namespace Ublaboo\Mailing; |
| 10 | 10 | |
| 11 | -use Nette, |
|
| 12 | - Nette\Mail\Message, |
|
| 13 | - Ublaboo; |
|
| 11 | +use Nette; |
|
| 12 | +use Nette\Mail\Message; |
|
| 13 | +use Ublaboo; |
|
| 14 | 14 | |
| 15 | 15 | class MailFactory extends Nette\Object |
| 16 | 16 | { |
@@ -85,21 +85,21 @@ |
||
| 85 | 85 | $this->message = new Message; |
| 86 | 86 | |
| 87 | 87 | if (class_exists($type)) { |
| 88 | - $mail = new $type( |
|
| 89 | - $this->config, |
|
| 90 | - $this->mails, |
|
| 91 | - $this->mailer, |
|
| 92 | - $this->message, |
|
| 93 | - $this->linkGenerator, |
|
| 94 | - $this->templateFactory, |
|
| 95 | - $this->logger, |
|
| 96 | - $args |
|
| 97 | - ); |
|
| 98 | - |
|
| 99 | - $mail->setBasePath($this->mail_images_base_path); |
|
| 100 | - |
|
| 101 | - return $mail; |
|
| 102 | - } |
|
| 88 | + $mail = new $type( |
|
| 89 | + $this->config, |
|
| 90 | + $this->mails, |
|
| 91 | + $this->mailer, |
|
| 92 | + $this->message, |
|
| 93 | + $this->linkGenerator, |
|
| 94 | + $this->templateFactory, |
|
| 95 | + $this->logger, |
|
| 96 | + $args |
|
| 97 | + ); |
|
| 98 | + |
|
| 99 | + $mail->setBasePath($this->mail_images_base_path); |
|
| 100 | + |
|
| 101 | + return $mail; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | throw new MailCreationException("Email [$type] does not exist"); |
| 105 | 105 | } |
@@ -30,7 +30,6 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * Log mail messages to eml file |
| 32 | 32 | * @param string $type |
| 33 | - * @param string $text |
|
| 34 | 33 | * @return void |
| 35 | 34 | */ |
| 36 | 35 | public function log($type, Nette\Mail\Message $mail) |
@@ -57,8 +57,8 @@ |
||
| 57 | 57 | { |
| 58 | 58 | preg_match('/^((([0-9]{4})-[0-9]{2})-[0-9]{2}).*/', $timestamp, $fragments); |
| 59 | 59 | |
| 60 | - $year_dir = $this->log_directory . '/' . $fragments[3]; |
|
| 61 | - $month_dir = $year_dir . '/' . $fragments[2]; |
|
| 60 | + $year_dir = $this->log_directory . '/' . $fragments[3]; |
|
| 61 | + $month_dir = $year_dir . '/' . $fragments[2]; |
|
| 62 | 62 | $day_dir = $month_dir . '/' . $fragments[1]; |
| 63 | 63 | $file = $day_dir . '/' . $type . static::LOG_EXTENSION; |
| 64 | 64 | |
@@ -14,45 +14,45 @@ |
||
| 14 | 14 | class MailingExtension extends Nette\DI\CompilerExtension |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - private $defaults = [ |
|
| 18 | - 'do' => Mail::CONFIG_BOTH, |
|
| 19 | - 'log_directory' => '%appDir%/../log/mails', |
|
| 20 | - 'mail_images_base_path' => '%wwwDir%', |
|
| 21 | - 'mails' => [] |
|
| 22 | - ]; |
|
| 17 | + private $defaults = [ |
|
| 18 | + 'do' => Mail::CONFIG_BOTH, |
|
| 19 | + 'log_directory' => '%appDir%/../log/mails', |
|
| 20 | + 'mail_images_base_path' => '%wwwDir%', |
|
| 21 | + 'mails' => [] |
|
| 22 | + ]; |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | - public function loadConfiguration() |
|
| 26 | - { |
|
| 27 | - $config = $this->_getConfig(); |
|
| 25 | + public function loadConfiguration() |
|
| 26 | + { |
|
| 27 | + $config = $this->_getConfig(); |
|
| 28 | 28 | |
| 29 | - $builder = $this->getContainerBuilder(); |
|
| 29 | + $builder = $this->getContainerBuilder(); |
|
| 30 | 30 | |
| 31 | - $builder->addDefinition($this->prefix('mailLogger')) |
|
| 32 | - ->setClass('Ublaboo\Mailing\MailLogger') |
|
| 33 | - ->setArguments([$config['log_directory']]); |
|
| 31 | + $builder->addDefinition($this->prefix('mailLogger')) |
|
| 32 | + ->setClass('Ublaboo\Mailing\MailLogger') |
|
| 33 | + ->setArguments([$config['log_directory']]); |
|
| 34 | 34 | |
| 35 | - $builder->addDefinition($this->prefix('mailFactory')) |
|
| 36 | - ->setClass('Ublaboo\Mailing\MailFactory') |
|
| 37 | - ->setArguments([$config['do'], $config['mail_images_base_path'], $config['mails']]); |
|
| 38 | - } |
|
| 35 | + $builder->addDefinition($this->prefix('mailFactory')) |
|
| 36 | + ->setClass('Ublaboo\Mailing\MailFactory') |
|
| 37 | + ->setArguments([$config['do'], $config['mail_images_base_path'], $config['mails']]); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - private function _getConfig() |
|
| 42 | - { |
|
| 43 | - $config = $this->validateConfig($this->defaults, $this->config); |
|
| 41 | + private function _getConfig() |
|
| 42 | + { |
|
| 43 | + $config = $this->validateConfig($this->defaults, $this->config); |
|
| 44 | 44 | |
| 45 | - $config['log_directory'] = Nette\DI\Helpers::expand( |
|
| 46 | - $config['log_directory'], |
|
| 47 | - $this->getContainerBuilder()->parameters |
|
| 48 | - ); |
|
| 45 | + $config['log_directory'] = Nette\DI\Helpers::expand( |
|
| 46 | + $config['log_directory'], |
|
| 47 | + $this->getContainerBuilder()->parameters |
|
| 48 | + ); |
|
| 49 | 49 | |
| 50 | - $config['mail_images_base_path'] = Nette\DI\Helpers::expand( |
|
| 51 | - $config['mail_images_base_path'], |
|
| 52 | - $this->getContainerBuilder()->parameters |
|
| 53 | - ); |
|
| 50 | + $config['mail_images_base_path'] = Nette\DI\Helpers::expand( |
|
| 51 | + $config['mail_images_base_path'], |
|
| 52 | + $this->getContainerBuilder()->parameters |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - return $config; |
|
| 56 | - } |
|
| 55 | + return $config; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | } |