@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use Nette\Application; |
| 19 | 19 | use Nette\Localization; |
| 20 | 20 | use Nette\Utils; |
| 21 | - |
|
| 22 | 21 | use IPub; |
| 23 | 22 | use IPub\VisualPaginator; |
| 24 | 23 | use IPub\VisualPaginator\Exceptions; |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | protected $templateFile; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var int |
|
| 62 | - */ |
|
| 63 | - protected $displayRelatedPages; |
|
| 60 | + /** |
|
| 61 | + * @var int |
|
| 62 | + */ |
|
| 63 | + protected $displayRelatedPages; |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * @var Localization\ITranslator |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct( |
| 89 | 89 | $templateFile = NULL, |
| 90 | - $displayRelatedPages = NULL, |
|
| 90 | + $displayRelatedPages = NULL, |
|
| 91 | 91 | Nette\ComponentModel\IContainer $parent = NULL, $name = NULL |
| 92 | 92 | ) { |
| 93 | 93 | // TODO: remove, only for tests |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if ($templateFile) { |
| 97 | 97 | $this->setTemplateFile($templateFile); |
| 98 | 98 | } |
| 99 | - $this->displayRelatedPages = (int)$displayRelatedPages; |
|
| 99 | + $this->displayRelatedPages = (int)$displayRelatedPages; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $steps = [$page]; |
| 233 | 233 | |
| 234 | 234 | } else { |
| 235 | - $relatedPages = $this->displayRelatedPages ?: 3; |
|
| 235 | + $relatedPages = $this->displayRelatedPages ?: 3; |
|
| 236 | 236 | $arr = range(max($paginator->firstPage, $page - $relatedPages), min($paginator->lastPage, $page + $relatedPages)); |
| 237 | 237 | $count = 4; |
| 238 | 238 | $quotient = ($paginator->pageCount - 1) / $count; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if ($templateFile) { |
| 97 | 97 | $this->setTemplateFile($templateFile); |
| 98 | 98 | } |
| 99 | - $this->displayRelatedPages = (int)$displayRelatedPages; |
|
| 99 | + $this->displayRelatedPages = (int) $displayRelatedPages; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | // Check if control has template |
| 108 | 108 | if ($this->template instanceof Nette\Bridges\ApplicationLatte\Template) { |
| 109 | 109 | // Assign vars to template |
| 110 | - $this->template->steps = $this->getSteps(); |
|
| 111 | - $this->template->paginator = $this->getPaginator(); |
|
| 110 | + $this->template->steps = $this->getSteps(); |
|
| 111 | + $this->template->paginator = $this->getPaginator(); |
|
| 112 | 112 | $this->template->handle = 'showPage!'; |
| 113 | 113 | $this->template->useAjax = $this->useAjax; |
| 114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | // If template was not defined before... |
| 121 | 121 | if ($this->template->getFile() === NULL) { |
| 122 | 122 | // ...try to get base component template file |
| 123 | - $templateFile = !empty($this->templateFile) ? $this->templateFile : __DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR .'default.latte'; |
|
| 123 | + $templateFile = !empty($this->templateFile) ? $this->templateFile : __DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.'default.latte'; |
|
| 124 | 124 | $this->template->setFile($templateFile); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | // Check if template file exists... |
| 180 | 180 | if (!is_file($templateFile)) { |
| 181 | 181 | // ...check if extension template is used |
| 182 | - if (is_file(__DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR . $templateFile)) { |
|
| 183 | - $templateFile = __DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR . $templateFile; |
|
| 182 | + if (is_file(__DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile)) { |
|
| 183 | + $templateFile = __DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile; |
|
| 184 | 184 | |
| 185 | 185 | } else { |
| 186 | 186 | // ...if not throw exception |
| 187 | - throw new Exceptions\FileNotFoundException('Template file "'. $templateFile .'" was not found.'); |
|
| 187 | + throw new Exceptions\FileNotFoundException('Template file "'.$templateFile.'" was not found.'); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | |
| 17 | 17 | use Nette; |
| 18 | 18 | use Nette\DI; |
| 19 | -use Nette\PhpGenerator as Code; |
|
| 20 | 19 | |
| 21 | 20 | class VisualPaginatorExtension extends DI\CompilerExtension |
| 22 | 21 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public static function register(Nette\Configurator $config, $extensionName = 'visualPaginator') |
| 53 | 53 | { |
| 54 | - $config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
| 54 | + $config->onCompile[] = function(Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
| 55 | 55 | $compiler->addExtension($extensionName, new VisualPaginatorExtension()); |
| 56 | 56 | }; |
| 57 | 57 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | function getTranslationResources() |
| 65 | 65 | { |
| 66 | 66 | return array( |
| 67 | - __DIR__ . '/../Translations' |
|
| 67 | + __DIR__.'/../Translations' |
|
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -14,4 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace IPub\VisualPaginator\Exceptions; |
| 16 | 16 | |
| 17 | -class FileNotFoundException extends IOException implements IException {} |
|
| 18 | 17 | \ No newline at end of file |
| 18 | +class FileNotFoundException extends IOException implements IException |
|
| 19 | +{ |
|
| 20 | +} |
|
| 19 | 21 | \ No newline at end of file |
@@ -14,4 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace IPub\VisualPaginator\Exceptions; |
| 16 | 16 | |
| 17 | -interface IException {} |
|
| 18 | 17 | \ No newline at end of file |
| 18 | +interface IException |
|
| 19 | +{ |
|
| 20 | +} |
|
| 19 | 21 | \ No newline at end of file |
@@ -14,4 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace IPub\VisualPaginator\Exceptions; |
| 16 | 16 | |
| 17 | -class IOException extends \RuntimeException implements IException {} |
|
| 18 | 17 | \ No newline at end of file |
| 18 | +class IOException extends \RuntimeException implements IException |
|
| 19 | +{ |
|
| 20 | +} |
|
| 19 | 21 | \ No newline at end of file |
@@ -30,7 +30,8 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * @param Components\IControl $visualPaginatorFactory |
| 32 | 32 | */ |
| 33 | - public function injectVisualPaginator(Components\IControl $visualPaginatorFactory) { |
|
| 33 | + public function injectVisualPaginator(Components\IControl $visualPaginatorFactory) |
|
| 34 | + { |
|
| 34 | 35 | $this->visualPaginatorFactory = $visualPaginatorFactory; |
| 35 | 36 | } |
| 36 | 37 | } |