@@ 42-56 (lines=15) @@ | ||
39 | return isset($this->localeArr[$locale]) ? $this->localeArr[$locale] : $locale; |
|
40 | } |
|
41 | ||
42 | public function __get($property) |
|
43 | { |
|
44 | if (!method_exists($this, 'get'.ucfirst($property))) { |
|
45 | $locale = Sludio::getDefaultLocale(); |
|
46 | } else { |
|
47 | $locale = strtolower(substr($property, -2)); |
|
48 | $property = substr($property, 0, -2); |
|
49 | } |
|
50 | ||
51 | if (in_array($locale, array_keys($this->localeArr))) { |
|
52 | return $this->getVariableByLocale($property, $this->localeArr[$locale]); |
|
53 | } |
|
54 | ||
55 | return $this->{$property}; |
|
56 | } |
|
57 | ||
58 | public function __set($property, $value) |
|
59 | { |
|
@@ 58-68 (lines=11) @@ | ||
55 | return $this->{$property}; |
|
56 | } |
|
57 | ||
58 | public function __set($property, $value) |
|
59 | { |
|
60 | $locale = strtolower(substr($property, -2)); |
|
61 | if (in_array($locale, array_keys($this->localeArr))) { |
|
62 | $property = substr($property, 0, -2); |
|
63 | Sludio::updateTranslations(get_class($this), $this->localeArr[$locale], $property, $value, $this->getId()); |
|
64 | } |
|
65 | $this->{$property} = $value; |
|
66 | ||
67 | return $this; |
|
68 | } |
|
69 | ||
70 | protected function getTranslations() |
|
71 | { |