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