Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,14 @@ This will result in following HTML:
```

Creation of this file will handle your implementation of `DotBlue\WebImages\IProvider`.

### HTTPS

To toggle secured route flag use following syntax in your configuration:

```
webimages:
routes:
- mask: images/<id>-<width>x<height>.jpg
secured: true
```
6 changes: 6 additions & 0 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace DotBlue\WebImages;

use Nette\Application\Routers\Route as NetteRoute;
use Nette\DI;


Expand Down Expand Up @@ -56,11 +57,15 @@ public function loadConfiguration()
$definition = [
'mask' => $definition,
'defaults' => [],
'secured' => FALSE,
];
} else {
if (!isset($definition['defaults'])) {
$definition['defaults'] = [];
}
if (!isset($definition['secured'])) {
$definition['secured'] = FALSE;
}
}

if (!isset($definition['format'])) {
Expand All @@ -79,6 +84,7 @@ public function loadConfiguration()
$definition['mask'],
$definition['defaults'],
$this->prefix('@generator'),
$definition['secured'] ? NetteRoute::SECURED : 0,
])
->addTag($this->prefix('route'))
->setAutowired(FALSE);
Expand Down
10 changes: 5 additions & 5 deletions src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class Route extends Application\Routers\Route


/**
* @param string
* @param string
* @param array
* @param Validator
* @param Generator
* @param int|NULL
*/
public function __construct($mask, array $defaults, Generator $generator)
public function __construct($mask, array $defaults, Generator $generator, $flags = 0)
{
$this->defaults = $defaults;
$this->generator = $generator;
Expand All @@ -72,9 +72,9 @@ public function __construct($mask, array $defaults, Generator $generator)
};

$defaults['presenter'] = 'Nette:Micro';
$defaults['callback'] = $this;
$defaults['callback'] = \Closure::fromCallable($this);

parent::__construct($mask, $defaults);
parent::__construct($mask, $defaults, $flags);
}


Expand Down