@@ -19,9 +19,7 @@ |
||
| 19 | 19 | use Nette\Bridges; |
| 20 | 20 | use Nette\Forms; |
| 21 | 21 | use Nette\Localization; |
| 22 | - |
|
| 23 | 22 | use Latte; |
| 24 | - |
|
| 25 | 23 | use IPub; |
| 26 | 24 | use IPub\FormSlug; |
| 27 | 25 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // If template file was not defined before... |
| 101 | 101 | if ($this->template->getFile() === NULL) { |
| 102 | 102 | // ...try to get base control template file |
| 103 | - $templateFile = !empty($this->templateFile) ? $this->templateFile : __DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR .'default.latte'; |
|
| 103 | + $templateFile = !empty($this->templateFile) ? $this->templateFile : __DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.'default.latte'; |
|
| 104 | 104 | // ...& set it to template engine |
| 105 | 105 | $this->template->setFile($templateFile); |
| 106 | 106 | } |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | // Assign vars to template |
| 109 | 109 | $this->template->input = $input; |
| 110 | 110 | $this->template->value = $this->getValue(); |
| 111 | - $this->template->caption = $this->caption; |
|
| 111 | + $this->template->caption = $this->caption; |
|
| 112 | 112 | $this->template->_form = $this->getForm(); |
| 113 | 113 | // Component js settings |
| 114 | - $this->template->settings = [ |
|
| 114 | + $this->template->settings = [ |
|
| 115 | 115 | 'toggle' => $this->toggleBox, |
| 116 | 116 | 'onetime' => $this->onetimeAutoUpdate, |
| 117 | - 'fields' => (array_reduce($this->fields, function (array $result, Forms\Controls\BaseControl $row) { |
|
| 118 | - $result[] = '#'. $row->getHtmlId(); |
|
| 117 | + 'fields' => (array_reduce($this->fields, function(array $result, Forms\Controls\BaseControl $row) { |
|
| 118 | + $result[] = '#'.$row->getHtmlId(); |
|
| 119 | 119 | |
| 120 | 120 | return $result; |
| 121 | 121 | }, [])) |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $latte = new Latte\Engine; |
| 135 | 135 | |
| 136 | 136 | // Check for cache dir for latte files |
| 137 | - if (defined('TEMP_DIR') && ($cacheFolder = TEMP_DIR . DIRECTORY_SEPARATOR .'cache'. DIRECTORY_SEPARATOR .'latte' AND is_dir($cacheFolder))) { |
|
| 137 | + if (defined('TEMP_DIR') && ($cacheFolder = TEMP_DIR.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'latte' AND is_dir($cacheFolder))) { |
|
| 138 | 138 | $latte->setTempDirectory($cacheFolder); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | // Check if template file exists... |
| 181 | 181 | if (!is_file($templateFile)) { |
| 182 | 182 | // ...check if extension template is used |
| 183 | - if (is_file(__DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR . $templateFile)) { |
|
| 184 | - $templateFile = __DIR__ . DIRECTORY_SEPARATOR .'template'. DIRECTORY_SEPARATOR . $templateFile; |
|
| 183 | + if (is_file(__DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile)) { |
|
| 184 | + $templateFile = __DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile; |
|
| 185 | 185 | |
| 186 | 186 | } else { |
| 187 | 187 | // ...if not throw exception |
| 188 | - throw new Nette\FileNotFoundException('Template file "'. $templateFile .'" was not found.'); |
|
| 188 | + throw new Nette\FileNotFoundException('Template file "'.$templateFile.'" was not found.'); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | static::$registered = TRUE; |
| 208 | 208 | |
| 209 | - $class = function_exists('get_called_class')?get_called_class():__CLASS__; |
|
| 209 | + $class = function_exists('get_called_class') ? get_called_class() : __CLASS__; |
|
| 210 | 210 | Forms\Container::extensionMethod( |
| 211 | - $method, function (Forms\Container $form, $name, $label = NULL) use ($class) { |
|
| 211 | + $method, function(Forms\Container $form, $name, $label = NULL) use ($class) { |
|
| 212 | 212 | $component = new $class($label); |
| 213 | 213 | $form->addComponent($component, $name); |
| 214 | 214 | return $component; |
@@ -134,7 +134,7 @@ |
||
| 134 | 134 | $latte = new Latte\Engine; |
| 135 | 135 | |
| 136 | 136 | // Check for cache dir for latte files |
| 137 | - if (defined('TEMP_DIR') && ($cacheFolder = TEMP_DIR . DIRECTORY_SEPARATOR .'cache'. DIRECTORY_SEPARATOR .'latte' AND is_dir($cacheFolder))) { |
|
| 137 | + if (defined('TEMP_DIR') && ($cacheFolder = TEMP_DIR . DIRECTORY_SEPARATOR .'cache'. DIRECTORY_SEPARATOR .'latte' and is_dir($cacheFolder))) { |
|
| 138 | 138 | $latte->setTempDirectory($cacheFolder); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace IPub\FormSlug\Utils; |
| 16 | 16 | |
| 17 | -use Nette; |
|
| 18 | 17 | use Nette\Utils; |
| 19 | 18 | use Nette\Bridges; |
| 20 | 19 | |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if ($indent !== NULL) { |
| 91 | - return "\n" . str_repeat("\t", $indent - 1) . $s . "\n" . str_repeat("\t", max(0, $indent - 2)); |
|
| 91 | + return "\n".str_repeat("\t", $indent - 1).$s."\n".str_repeat("\t", max(0, $indent - 2)); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $s; |