|
@@ -60,7 +60,7 @@ discard block |
|
|
block discarded – undo |
|
60
|
60
|
if (is_array($config)) { |
|
61
|
61
|
$config = new \Tight\Modules\Localize\LocalizeConfig($config); |
|
62
|
62
|
} else if (!$config instanceof \Tight\Modules\Localize\LocalizeConfig) { |
|
63
|
|
- throw new \InvalidArgumentException("Argument 1 passed to " . get_class($this) . " must be an array or an instance of Tight\Modules\Localize\LocalizeConfig"); |
|
|
63
|
+ throw new \InvalidArgumentException("Argument 1 passed to ".get_class($this)." must be an array or an instance of Tight\Modules\Localize\LocalizeConfig"); |
|
64
|
64
|
} |
|
65
|
65
|
parent::__construct("LocalizeModule", "v1.2"); |
|
66
|
66
|
$this->setConfig($config); |
|
@@ -171,7 +171,7 @@ discard block |
|
|
block discarded – undo |
|
171
|
171
|
} |
|
172
|
172
|
} |
|
173
|
173
|
foreach ($files as $element) { |
|
174
|
|
- $file = \Tight\Utils::getSlicedFile($directory . $element); |
|
|
174
|
+ $file = \Tight\Utils::getSlicedFile($directory.$element); |
|
175
|
175
|
//Removes extension |
|
176
|
176
|
$name = $file["name"]; |
|
177
|
177
|
$explode = explode($this->getConfig()->langSeparator, $name); |
|
@@ -195,17 +195,17 @@ discard block |
|
|
block discarded – undo |
|
195
|
195
|
private function getValuesFromJson() { |
|
196
|
196
|
$output = []; |
|
197
|
197
|
$folder = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder); |
|
198
|
|
- $fileName = $this->getConfig()->resourceFileName . $this->getConfig()->langSeparator . $this->locale . "." . $this->getConfig()->resourceFileType; |
|
199
|
|
- $file = $folder . $fileName; |
|
|
198
|
+ $fileName = $this->getConfig()->resourceFileName.$this->getConfig()->langSeparator.$this->locale.".".$this->getConfig()->resourceFileType; |
|
|
199
|
+ $file = $folder.$fileName; |
|
200
|
200
|
if (is_file($file)) { |
|
201
|
201
|
$output = json_decode(file_get_contents($file), JSON_FORCE_OBJECT); |
|
202
|
202
|
} else { |
|
203
|
|
- $fileName = $this->getConfig()->resourceFileName . "." . $this->getConfig()->resourceFileType; |
|
204
|
|
- $file = $folder . $fileName; |
|
|
203
|
+ $fileName = $this->getConfig()->resourceFileName.".".$this->getConfig()->resourceFileType; |
|
|
204
|
+ $file = $folder.$fileName; |
|
205
|
205
|
if (is_file($file)) { |
|
206
|
206
|
$output = json_decode(file_get_contents($file), JSON_FORCE_OBJECT); |
|
207
|
207
|
} else { |
|
208
|
|
- throw new \Tight\Exception\ModuleException("Resource file <strong>" . $file . "</strong> not found"); |
|
|
208
|
+ throw new \Tight\Exception\ModuleException("Resource file <strong>".$file."</strong> not found"); |
|
209
|
209
|
} |
|
210
|
210
|
} |
|
211
|
211
|
return $output; |
|
@@ -233,12 +233,12 @@ discard block |
|
|
block discarded – undo |
|
233
|
233
|
private function getXmlResources() { |
|
234
|
234
|
$output = null; |
|
235
|
235
|
if ($this->resourceFileType === LocalizeConfig::FILETYPE_XML) { |
|
236
|
|
- $file = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder) . $this->getConfig()->resourceFileName . "." . $this->resourceFileType; |
|
|
236
|
+ $file = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder).$this->getConfig()->resourceFileName.".".$this->resourceFileType; |
|
237
|
237
|
if (is_file($file)) { |
|
238
|
238
|
$xmlContent = file_get_contents($file); |
|
239
|
239
|
$output = new \SimpleXMLElement($xmlContent); |
|
240
|
240
|
} else { |
|
241
|
|
- throw new \Tight\Exception\ModuleException("Resource file <strong>" . $file . "</strong> does not exists"); |
|
|
241
|
+ throw new \Tight\Exception\ModuleException("Resource file <strong>".$file."</strong> does not exists"); |
|
242
|
242
|
} |
|
243
|
243
|
} |
|
244
|
244
|
return $output; |
|
@@ -263,8 +263,8 @@ discard block |
|
|
block discarded – undo |
|
263
|
263
|
$index++; |
|
264
|
264
|
} |
|
265
|
265
|
if (null == $locale) { |
|
266
|
|
- $fileName = $this->getConfig()->resourceFileName . "." . $this->getConfig()->resourceFileType; |
|
267
|
|
- throw new \Tight\Exception\ModuleException("Locale <strong>" . $this->locale . "</strong> not found at resource file <strong>" . $fileName . "</strong>"); |
|
|
266
|
+ $fileName = $this->getConfig()->resourceFileName.".".$this->getConfig()->resourceFileType; |
|
|
267
|
+ throw new \Tight\Exception\ModuleException("Locale <strong>".$this->locale."</strong> not found at resource file <strong>".$fileName."</strong>"); |
|
268
|
268
|
} |
|
269
|
269
|
return $this->parseXmlStringValues($locale); |
|
270
|
270
|
} |