@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | |
28 | 28 | const ERROR_UNSUPPORTED_FILE_EXTENSION = 40602; |
29 | 29 | |
30 | - /** |
|
31 | - * @var Localization_Scanner |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var Localization_Scanner |
|
32 | + */ |
|
33 | 33 | protected $scanner; |
34 | 34 | |
35 | - /** |
|
36 | - * @var Localization_Scanner_StringsCollection |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var Localization_Scanner_StringsCollection |
|
37 | + */ |
|
38 | 38 | protected $collection; |
39 | 39 | |
40 | 40 | protected $languageMappings = array( |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | $this->collection = $scanner->getCollection(); |
49 | 49 | } |
50 | 50 | |
51 | - /** |
|
52 | - * Parses a source file. Must have a valid supported file extension. |
|
53 | - * |
|
54 | - * @param string $path |
|
55 | - * @return Localization_Parser_Language |
|
56 | - * @throws Localization_Exception |
|
57 | - * |
|
58 | - * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
59 | - */ |
|
51 | + /** |
|
52 | + * Parses a source file. Must have a valid supported file extension. |
|
53 | + * |
|
54 | + * @param string $path |
|
55 | + * @return Localization_Parser_Language |
|
56 | + * @throws Localization_Exception |
|
57 | + * |
|
58 | + * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
59 | + */ |
|
60 | 60 | public function parseFile(string $path) : Localization_Parser_Language |
61 | 61 | { |
62 | 62 | $this->requireValidFile($path); |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | return $language; |
71 | 71 | } |
72 | 72 | |
73 | - /** |
|
74 | - * Parses the string for the specified language. |
|
75 | - * |
|
76 | - * @param string $languageID |
|
77 | - * @param string $code |
|
78 | - * @return Localization_Parser_Language |
|
79 | - * @throws Localization_Exception |
|
80 | - * |
|
81 | - * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
82 | - */ |
|
73 | + /** |
|
74 | + * Parses the string for the specified language. |
|
75 | + * |
|
76 | + * @param string $languageID |
|
77 | + * @param string $code |
|
78 | + * @return Localization_Parser_Language |
|
79 | + * @throws Localization_Exception |
|
80 | + * |
|
81 | + * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
82 | + */ |
|
83 | 83 | public function parseString(string $languageID, string $code) : Localization_Parser_Language |
84 | 84 | { |
85 | 85 | $this->requireValidLanguageID($languageID); |
@@ -128,29 +128,29 @@ discard block |
||
128 | 128 | ); |
129 | 129 | } |
130 | 130 | |
131 | - /** |
|
132 | - * Retrieves a list of all language IDs that are supported. |
|
133 | - * @return string[] IDs list like "PHP", "Javascript" |
|
134 | - */ |
|
131 | + /** |
|
132 | + * Retrieves a list of all language IDs that are supported. |
|
133 | + * @return string[] IDs list like "PHP", "Javascript" |
|
134 | + */ |
|
135 | 135 | public function getLanguageIDs() : array |
136 | 136 | { |
137 | 137 | return array_values($this->languageMappings); |
138 | 138 | } |
139 | 139 | |
140 | - /** |
|
141 | - * @var Localization_Parser_Language[] |
|
142 | - */ |
|
140 | + /** |
|
141 | + * @var Localization_Parser_Language[] |
|
142 | + */ |
|
143 | 143 | protected $languageParsers = array(); |
144 | 144 | |
145 | - /** |
|
146 | - * Creates a parser for the specified language, e.g. "PHP". |
|
147 | - * NOTE: Existing parser instances are re-used. |
|
148 | - * |
|
149 | - * @param string $languageID |
|
150 | - * @return Localization_Parser_Language |
|
151 | - * |
|
152 | - * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
153 | - */ |
|
145 | + /** |
|
146 | + * Creates a parser for the specified language, e.g. "PHP". |
|
147 | + * NOTE: Existing parser instances are re-used. |
|
148 | + * |
|
149 | + * @param string $languageID |
|
150 | + * @return Localization_Parser_Language |
|
151 | + * |
|
152 | + * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
153 | + */ |
|
154 | 154 | public function createLanguage(string $languageID) |
155 | 155 | { |
156 | 156 | $this->requireValidLanguageID($languageID); |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | return $this->languageParsers[$languageID]; |
166 | 166 | } |
167 | 167 | |
168 | - /** |
|
169 | - * Whether the specified file extension is supported. |
|
170 | - * |
|
171 | - * @param string $ext |
|
172 | - * @return bool |
|
173 | - */ |
|
168 | + /** |
|
169 | + * Whether the specified file extension is supported. |
|
170 | + * |
|
171 | + * @param string $ext |
|
172 | + * @return bool |
|
173 | + */ |
|
174 | 174 | public function isExtensionSupported(string $ext) : bool |
175 | 175 | { |
176 | 176 | $ext = strtolower($ext); |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Localization_Event_LocaleChanged extends Localization_Event |
22 | 22 | { |
23 | - /** |
|
24 | - * The locale that was used before the change, if any. |
|
25 | - * @return Localization_Locale|NULL |
|
26 | - */ |
|
23 | + /** |
|
24 | + * The locale that was used before the change, if any. |
|
25 | + * @return Localization_Locale|NULL |
|
26 | + */ |
|
27 | 27 | public function getPrevious() : ?Localization_Locale |
28 | 28 | { |
29 | 29 | $arg = $this->getArgument(1); |
@@ -34,38 +34,38 @@ discard block |
||
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | |
37 | - /** |
|
38 | - * The locale that is used now after the change. |
|
39 | - * @return Localization_Locale |
|
40 | - */ |
|
37 | + /** |
|
38 | + * The locale that is used now after the change. |
|
39 | + * @return Localization_Locale |
|
40 | + */ |
|
41 | 41 | public function getCurrent() : Localization_Locale |
42 | 42 | { |
43 | 43 | $arg = $this->getArgument(2); |
44 | 44 | return $arg['locale']; |
45 | 45 | } |
46 | 46 | |
47 | - /** |
|
48 | - * The namespace in which the locale change occurred. |
|
49 | - * @return string |
|
50 | - */ |
|
47 | + /** |
|
48 | + * The namespace in which the locale change occurred. |
|
49 | + * @return string |
|
50 | + */ |
|
51 | 51 | public function getNamespace() : string |
52 | 52 | { |
53 | 53 | return $this->getArgument(0); |
54 | 54 | } |
55 | 55 | |
56 | - /** |
|
57 | - * Whether the change occurred for an application locale. |
|
58 | - * @return bool |
|
59 | - */ |
|
56 | + /** |
|
57 | + * Whether the change occurred for an application locale. |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | 60 | public function isAppLocale() : bool |
61 | 61 | { |
62 | 62 | return $this->getNamespace() === Localization::NAMESPACE_APPLICATION; |
63 | 63 | } |
64 | 64 | |
65 | - /** |
|
66 | - * Whether the change occurred for a content locale. |
|
67 | - * @return bool |
|
68 | - */ |
|
65 | + /** |
|
66 | + * Whether the change occurred for a content locale. |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | 69 | public function isContentLocale() : bool |
70 | 70 | { |
71 | 71 | return $this->getNamespace() === Localization::NAMESPACE_CONTENT; |
@@ -4,24 +4,24 @@ discard block |
||
4 | 4 | |
5 | 5 | class Localization_Scanner |
6 | 6 | { |
7 | - /** |
|
8 | - * @var float |
|
9 | - */ |
|
7 | + /** |
|
8 | + * @var float |
|
9 | + */ |
|
10 | 10 | protected $timeStart; |
11 | 11 | |
12 | - /** |
|
13 | - * @var float |
|
14 | - */ |
|
12 | + /** |
|
13 | + * @var float |
|
14 | + */ |
|
15 | 15 | protected $timeEnd; |
16 | 16 | |
17 | - /** |
|
18 | - * @var array |
|
19 | - */ |
|
17 | + /** |
|
18 | + * @var array |
|
19 | + */ |
|
20 | 20 | protected $stringInfos = array(); |
21 | 21 | |
22 | - /** |
|
23 | - * @var string |
|
24 | - */ |
|
22 | + /** |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | protected $storageFile; |
26 | 26 | |
27 | 27 | /** |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | \AppUtils\FileHelper::saveAsJSON($data, $this->storageFile); |
92 | 92 | } |
93 | 93 | |
94 | - /** |
|
95 | - * @var Localization_Parser |
|
96 | - */ |
|
94 | + /** |
|
95 | + * @var Localization_Parser |
|
96 | + */ |
|
97 | 97 | protected $parser; |
98 | 98 | |
99 | 99 | public function getParser() |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | return $this->getCollection()->countWarnings(); |
150 | 150 | } |
151 | 151 | |
152 | - /** |
|
153 | - * Retrieves all warnings that have been registered |
|
154 | - * during the last search for translateable texts. |
|
155 | - * |
|
156 | - * @return \AppLocalize\Localization_Scanner_StringsCollection_Warning[] |
|
157 | - */ |
|
152 | + /** |
|
153 | + * Retrieves all warnings that have been registered |
|
154 | + * during the last search for translateable texts. |
|
155 | + * |
|
156 | + * @return \AppLocalize\Localization_Scanner_StringsCollection_Warning[] |
|
157 | + */ |
|
158 | 158 | public function getWarnings() |
159 | 159 | { |
160 | 160 | return $this->getCollection()->getWarnings(); |
@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class Localization_Scanner_StringsCollection_Warning |
8 | 8 | { |
9 | - /** |
|
10 | - * @var array |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var array |
|
11 | + */ |
|
12 | 12 | protected $data; |
13 | 13 | |
14 | 14 | public function __construct(array $data) |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class Localization_Scanner_StringHash |
15 | 15 | { |
16 | - /** |
|
17 | - * @var Localization_Scanner_StringsCollection |
|
18 | - */ |
|
16 | + /** |
|
17 | + * @var Localization_Scanner_StringsCollection |
|
18 | + */ |
|
19 | 19 | protected $collection; |
20 | 20 | |
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | 24 | protected $hash; |
25 | 25 | |
26 | - /** |
|
27 | - * @var Localization_Scanner_StringInfo[] |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var Localization_Scanner_StringInfo[] |
|
28 | + */ |
|
29 | 29 | protected $strings = array(); |
30 | 30 | |
31 | 31 | protected $sourceIDs = array(); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | return $entries; |
56 | 56 | } |
57 | 57 | |
58 | - /** |
|
59 | - * Retrieves all individual string locations where this text was found. |
|
60 | - * @return Localization_Scanner_StringInfo[] |
|
61 | - */ |
|
58 | + /** |
|
59 | + * Retrieves all individual string locations where this text was found. |
|
60 | + * @return Localization_Scanner_StringInfo[] |
|
61 | + */ |
|
62 | 62 | public function getStrings() |
63 | 63 | { |
64 | 64 | return $this->strings; |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | return count($this->strings); |
119 | 119 | } |
120 | 120 | |
121 | - /** |
|
122 | - * Retrieves the translated text, if any. |
|
123 | - * @return string |
|
124 | - */ |
|
121 | + /** |
|
122 | + * Retrieves the translated text, if any. |
|
123 | + * @return string |
|
124 | + */ |
|
125 | 125 | public function getTranslatedText() : string |
126 | 126 | { |
127 | 127 | $translator = Localization::getTranslator(); |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | return ''; |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Retrieves a list of all file names, with relative paths. |
|
139 | - * @return string[] |
|
140 | - */ |
|
137 | + /** |
|
138 | + * Retrieves a list of all file names, with relative paths. |
|
139 | + * @return string[] |
|
140 | + */ |
|
141 | 141 | public function getFiles() : array |
142 | 142 | { |
143 | 143 | $files = array(); |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | return $files; |
160 | 160 | } |
161 | 161 | |
162 | - /** |
|
163 | - * Retrieves a list of all file names this string is used in. |
|
164 | - * @return string[] |
|
165 | - */ |
|
162 | + /** |
|
163 | + * Retrieves a list of all file names this string is used in. |
|
164 | + * @return string[] |
|
165 | + */ |
|
166 | 166 | public function getFileNames() : array |
167 | 167 | { |
168 | 168 | $files = $this->getFiles(); |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | return $result; |
180 | 180 | } |
181 | 181 | |
182 | - /** |
|
183 | - * Retrieves a text comprised of all strings that are relevant |
|
184 | - * for a full text search, imploded together. Used in the search |
|
185 | - * function to find matching strings. |
|
186 | - * |
|
187 | - * @return string |
|
188 | - */ |
|
182 | + /** |
|
183 | + * Retrieves a text comprised of all strings that are relevant |
|
184 | + * for a full text search, imploded together. Used in the search |
|
185 | + * function to find matching strings. |
|
186 | + * |
|
187 | + * @return string |
|
188 | + */ |
|
189 | 189 | public function getSearchString() : string |
190 | 190 | { |
191 | 191 | $parts = array($this->getTranslatedText(), $this->getText()); |
@@ -6,39 +6,39 @@ |
||
6 | 6 | |
7 | 7 | abstract class Localization_Source |
8 | 8 | { |
9 | - /** |
|
10 | - * Human readable label for the source. |
|
11 | - * @var string |
|
12 | - */ |
|
9 | + /** |
|
10 | + * Human readable label for the source. |
|
11 | + * @var string |
|
12 | + */ |
|
13 | 13 | protected $label; |
14 | 14 | |
15 | - /** |
|
16 | - * Human readable group name to categorize the source. |
|
17 | - * @var string |
|
18 | - */ |
|
15 | + /** |
|
16 | + * Human readable group name to categorize the source. |
|
17 | + * @var string |
|
18 | + */ |
|
19 | 19 | protected $group; |
20 | 20 | |
21 | - /** |
|
22 | - * The folder in which the localization files are stored |
|
23 | - * @var string |
|
24 | - */ |
|
21 | + /** |
|
22 | + * The folder in which the localization files are stored |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | protected $storageFolder; |
26 | 26 | |
27 | - /** |
|
28 | - * @var string |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var string |
|
29 | + */ |
|
30 | 30 | protected $alias; |
31 | 31 | |
32 | - /** |
|
33 | - * Available during scanning. |
|
34 | - * @var Localization_Scanner_StringsCollection|NULL |
|
35 | - */ |
|
32 | + /** |
|
33 | + * Available during scanning. |
|
34 | + * @var Localization_Scanner_StringsCollection|NULL |
|
35 | + */ |
|
36 | 36 | protected $collection; |
37 | 37 | |
38 | - /** |
|
39 | - * Available during scanning. |
|
40 | - * @var Localization_Parser|NULL |
|
41 | - */ |
|
38 | + /** |
|
39 | + * Available during scanning. |
|
40 | + * @var Localization_Parser|NULL |
|
41 | + */ |
|
42 | 42 | protected $parser; |
43 | 43 | |
44 | 44 | public function __construct(string $alias, string $label, string $group, string $storageFolder) |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | const NAMESPACE_CONTENT = '__content'; |
54 | 54 | |
55 | - /** |
|
56 | - * Collection of all locales by namespace (application, content, custom...). |
|
57 | - * |
|
58 | - * @var array |
|
59 | - * @see Localization::addLocale() |
|
60 | - */ |
|
55 | + /** |
|
56 | + * Collection of all locales by namespace (application, content, custom...). |
|
57 | + * |
|
58 | + * @var array |
|
59 | + * @see Localization::addLocale() |
|
60 | + */ |
|
61 | 61 | protected static $locales = array(); |
62 | 62 | |
63 | 63 | /** |
@@ -66,57 +66,57 @@ discard block |
||
66 | 66 | */ |
67 | 67 | private static $initDone = false; |
68 | 68 | |
69 | - /** |
|
70 | - * Path to the file in which the scanner results are stored. |
|
71 | - * @var string |
|
72 | - * @see Localization::configure() |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Path to the file in which the scanner results are stored. |
|
71 | + * @var string |
|
72 | + * @see Localization::configure() |
|
73 | + */ |
|
74 | 74 | protected static $storageFile = ''; |
75 | 75 | |
76 | - /** |
|
77 | - * Path to the folder into which the client libraries are written. |
|
78 | - * @var string |
|
79 | - * @see Localization::setClientLibrariesFolder() |
|
80 | - */ |
|
76 | + /** |
|
77 | + * Path to the folder into which the client libraries are written. |
|
78 | + * @var string |
|
79 | + * @see Localization::setClientLibrariesFolder() |
|
80 | + */ |
|
81 | 81 | protected static $clientFolder = ''; |
82 | 82 | |
83 | - /** |
|
84 | - * If this key changes, client libraries are refreshed. |
|
85 | - * @var string |
|
86 | - * @see Localization::setClientLibrariesCacheKey() |
|
87 | - */ |
|
83 | + /** |
|
84 | + * If this key changes, client libraries are refreshed. |
|
85 | + * @var string |
|
86 | + * @see Localization::setClientLibrariesCacheKey() |
|
87 | + */ |
|
88 | 88 | protected static $clientCacheKey = ''; |
89 | 89 | |
90 | - /** |
|
91 | - * Whether the configuration has been made. |
|
92 | - * @var bool |
|
93 | - * @see Localization::configure() |
|
94 | - */ |
|
90 | + /** |
|
91 | + * Whether the configuration has been made. |
|
92 | + * @var bool |
|
93 | + * @see Localization::configure() |
|
94 | + */ |
|
95 | 95 | protected static $configured = false; |
96 | 96 | |
97 | - /** |
|
98 | - * Stores event listener instances. |
|
99 | - * @var array |
|
100 | - */ |
|
97 | + /** |
|
98 | + * Stores event listener instances. |
|
99 | + * @var array |
|
100 | + */ |
|
101 | 101 | protected static $listeners = array(); |
102 | 102 | |
103 | - /** |
|
104 | - * @var integer |
|
105 | - * @see Localization::addEventListener() |
|
106 | - */ |
|
103 | + /** |
|
104 | + * @var integer |
|
105 | + * @see Localization::addEventListener() |
|
106 | + */ |
|
107 | 107 | protected static $listenersCounter = 0; |
108 | 108 | |
109 | - /** |
|
110 | - * @var Localization_Translator|NULL |
|
111 | - */ |
|
109 | + /** |
|
110 | + * @var Localization_Translator|NULL |
|
111 | + */ |
|
112 | 112 | protected static $translator; |
113 | 113 | |
114 | - /** |
|
115 | - * Initializes the localization layer. This is done |
|
116 | - * automatically, and only once per request. |
|
117 | - * |
|
118 | - * (Called at the end of this file) |
|
119 | - */ |
|
114 | + /** |
|
115 | + * Initializes the localization layer. This is done |
|
116 | + * automatically, and only once per request. |
|
117 | + * |
|
118 | + * (Called at the end of this file) |
|
119 | + */ |
|
120 | 120 | public static function init() : void |
121 | 121 | { |
122 | 122 | if(self::$initDone) { |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | return self::getLocalesByNS(self::NAMESPACE_APPLICATION); |
156 | 156 | } |
157 | 157 | |
158 | - /** |
|
159 | - * Retrieves all locales in the specified namespace. |
|
160 | - * |
|
161 | - * @param string $namespace |
|
162 | - * @return Localization_Locale[] |
|
163 | - */ |
|
158 | + /** |
|
159 | + * Retrieves all locales in the specified namespace. |
|
160 | + * |
|
161 | + * @param string $namespace |
|
162 | + * @return Localization_Locale[] |
|
163 | + */ |
|
164 | 164 | public static function getLocalesByNS(string $namespace) |
165 | 165 | { |
166 | 166 | if(isset(self::$locales[$namespace])) { |
@@ -177,35 +177,35 @@ discard block |
||
177 | 177 | ); |
178 | 178 | } |
179 | 179 | |
180 | - /** |
|
181 | - * Adds an application locale to use in the application. |
|
182 | - * |
|
183 | - * @param string $localeName |
|
184 | - * @return Localization_Locale |
|
185 | - */ |
|
180 | + /** |
|
181 | + * Adds an application locale to use in the application. |
|
182 | + * |
|
183 | + * @param string $localeName |
|
184 | + * @return Localization_Locale |
|
185 | + */ |
|
186 | 186 | public static function addAppLocale(string $localeName) : Localization_Locale |
187 | 187 | { |
188 | 188 | return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
189 | 189 | } |
190 | 190 | |
191 | - /** |
|
192 | - * Adds a content locale to use for content in the application. |
|
193 | - * |
|
194 | - * @param string $localeName |
|
195 | - * @return Localization_Locale |
|
196 | - */ |
|
191 | + /** |
|
192 | + * Adds a content locale to use for content in the application. |
|
193 | + * |
|
194 | + * @param string $localeName |
|
195 | + * @return Localization_Locale |
|
196 | + */ |
|
197 | 197 | public static function addContentLocale(string $localeName) : Localization_Locale |
198 | 198 | { |
199 | 199 | return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
200 | 200 | } |
201 | 201 | |
202 | - /** |
|
203 | - * Adds a locale to the specified namespace. |
|
204 | - * |
|
205 | - * @param string $localeName |
|
206 | - * @param string $namespace |
|
207 | - * @return Localization_Locale |
|
208 | - */ |
|
202 | + /** |
|
203 | + * Adds a locale to the specified namespace. |
|
204 | + * |
|
205 | + * @param string $localeName |
|
206 | + * @param string $namespace |
|
207 | + * @return Localization_Locale |
|
208 | + */ |
|
209 | 209 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
210 | 210 | { |
211 | 211 | if(!isset(self::$locales[$namespace])) { |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | return new $className(); |
248 | 248 | } |
249 | 249 | |
250 | - /** |
|
251 | - * Retrieves the currency of the selected app locale. |
|
252 | - * |
|
253 | - * @return Localization_Currency |
|
254 | - */ |
|
250 | + /** |
|
251 | + * Retrieves the currency of the selected app locale. |
|
252 | + * |
|
253 | + * @return Localization_Currency |
|
254 | + */ |
|
255 | 255 | public static function getAppCurrency() : Localization_Currency |
256 | 256 | { |
257 | 257 | return self::getCurrencyNS(self::NAMESPACE_APPLICATION); |
@@ -288,44 +288,44 @@ discard block |
||
288 | 288 | return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION); |
289 | 289 | } |
290 | 290 | |
291 | - /** |
|
292 | - * Retrieves the name of the selected application locale. |
|
293 | - * |
|
294 | - * @return string |
|
295 | - */ |
|
291 | + /** |
|
292 | + * Retrieves the name of the selected application locale. |
|
293 | + * |
|
294 | + * @return string |
|
295 | + */ |
|
296 | 296 | public static function getAppLocaleName() : string |
297 | 297 | { |
298 | 298 | return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION); |
299 | 299 | } |
300 | 300 | |
301 | - /** |
|
302 | - * Retrieves the names of the available application locales. |
|
303 | - * @return string[] |
|
304 | - */ |
|
301 | + /** |
|
302 | + * Retrieves the names of the available application locales. |
|
303 | + * @return string[] |
|
304 | + */ |
|
305 | 305 | public static function getAppLocaleNames() : array |
306 | 306 | { |
307 | 307 | return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION); |
308 | 308 | } |
309 | 309 | |
310 | - /** |
|
311 | - * Retrieves the selected locale name in the specified namespace. |
|
312 | - * |
|
313 | - * @param string $namespace |
|
314 | - * @throws Localization_Exception |
|
315 | - * @return string |
|
316 | - */ |
|
310 | + /** |
|
311 | + * Retrieves the selected locale name in the specified namespace. |
|
312 | + * |
|
313 | + * @param string $namespace |
|
314 | + * @throws Localization_Exception |
|
315 | + * @return string |
|
316 | + */ |
|
317 | 317 | public static function getLocaleNameByNS(string $namespace) : string |
318 | 318 | { |
319 | 319 | return self::getSelectedKeyByNS('name', $namespace); |
320 | 320 | } |
321 | 321 | |
322 | - /** |
|
323 | - * Retrieves the selected locale instance for the specified namespace. |
|
324 | - * |
|
325 | - * @param string $namespace |
|
326 | - * @return Localization_Locale |
|
327 | - * @throws Localization_Exception |
|
328 | - */ |
|
322 | + /** |
|
323 | + * Retrieves the selected locale instance for the specified namespace. |
|
324 | + * |
|
325 | + * @param string $namespace |
|
326 | + * @return Localization_Locale |
|
327 | + * @throws Localization_Exception |
|
328 | + */ |
|
329 | 329 | public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale |
330 | 330 | { |
331 | 331 | return self::getSelectedKeyByNS('locale', $namespace); |
@@ -350,20 +350,20 @@ discard block |
||
350 | 350 | ); |
351 | 351 | } |
352 | 352 | |
353 | - /** |
|
354 | - * Stores the selected locale names by namespace. |
|
355 | - * @var array |
|
356 | - */ |
|
353 | + /** |
|
354 | + * Stores the selected locale names by namespace. |
|
355 | + * @var array |
|
356 | + */ |
|
357 | 357 | protected static $selected = array(); |
358 | 358 | |
359 | - /** |
|
360 | - * Selects the active locale for the specified namespace. |
|
361 | - * |
|
362 | - * @param string $localeName |
|
363 | - * @param string $namespace |
|
364 | - * @return Localization_Locale |
|
365 | - * @throws Localization_Exception |
|
366 | - */ |
|
359 | + /** |
|
360 | + * Selects the active locale for the specified namespace. |
|
361 | + * |
|
362 | + * @param string $localeName |
|
363 | + * @param string $namespace |
|
364 | + * @return Localization_Locale |
|
365 | + * @throws Localization_Exception |
|
366 | + */ |
|
367 | 367 | public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
368 | 368 | { |
369 | 369 | self::requireNamespace($namespace); |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | return $locale; |
400 | 400 | } |
401 | 401 | |
402 | - /** |
|
403 | - * Triggers the specified event, with the provided arguments. |
|
404 | - * |
|
405 | - * @param string $name The event name. |
|
406 | - * @param array $argsList |
|
407 | - * @see Localization_Event |
|
408 | - */ |
|
402 | + /** |
|
403 | + * Triggers the specified event, with the provided arguments. |
|
404 | + * |
|
405 | + * @param string $name The event name. |
|
406 | + * @param array $argsList |
|
407 | + * @see Localization_Event |
|
408 | + */ |
|
409 | 409 | protected static function triggerEvent(string $name, array $argsList) : Localization_Event |
410 | 410 | { |
411 | 411 | $class = '\AppLocalize\Localization_Event_'.$name; |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | return $event; |
427 | 427 | } |
428 | 428 | |
429 | - /** |
|
430 | - * Adds a listener to the specified event name. |
|
431 | - * |
|
432 | - * @param string $eventName |
|
433 | - * @param callable $callback |
|
434 | - * @param array $args Additional arguments to add to the event |
|
435 | - * @return int The listener number. |
|
436 | - */ |
|
429 | + /** |
|
430 | + * Adds a listener to the specified event name. |
|
431 | + * |
|
432 | + * @param string $eventName |
|
433 | + * @param callable $callback |
|
434 | + * @param array $args Additional arguments to add to the event |
|
435 | + * @return int The listener number. |
|
436 | + */ |
|
437 | 437 | public static function addEventListener(string $eventName, $callback, array $args=array()) : int |
438 | 438 | { |
439 | 439 | if(!isset(self::$listeners[$eventName])) { |
@@ -463,43 +463,43 @@ discard block |
||
463 | 463 | return self::$listenersCounter; |
464 | 464 | } |
465 | 465 | |
466 | - /** |
|
467 | - * Adds an event listener for the <code>LocaleChanged</code> event, |
|
468 | - * which is triggered every time a locale is changed in any of the |
|
469 | - * available namespaces. |
|
470 | - * |
|
471 | - * The first parameter of the callback is always the event instance. |
|
472 | - * |
|
473 | - * @param callable $callback The listener function to call. |
|
474 | - * @param array $args Optional indexed array with additional arguments to pass on to the callback function. |
|
475 | - * @return int |
|
476 | - * @see Localization_Event_LocaleChanged |
|
477 | - */ |
|
466 | + /** |
|
467 | + * Adds an event listener for the <code>LocaleChanged</code> event, |
|
468 | + * which is triggered every time a locale is changed in any of the |
|
469 | + * available namespaces. |
|
470 | + * |
|
471 | + * The first parameter of the callback is always the event instance. |
|
472 | + * |
|
473 | + * @param callable $callback The listener function to call. |
|
474 | + * @param array $args Optional indexed array with additional arguments to pass on to the callback function. |
|
475 | + * @return int |
|
476 | + * @see Localization_Event_LocaleChanged |
|
477 | + */ |
|
478 | 478 | public static function onLocaleChanged($callback, array $args=array()) : int |
479 | 479 | { |
480 | 480 | return self::addEventListener('LocaleChanged', $callback, $args); |
481 | 481 | } |
482 | 482 | |
483 | - /** |
|
484 | - * Selects the application locale to use. |
|
485 | - * |
|
486 | - * @param string $localeName |
|
487 | - * @return Localization_Locale |
|
488 | - */ |
|
483 | + /** |
|
484 | + * Selects the application locale to use. |
|
485 | + * |
|
486 | + * @param string $localeName |
|
487 | + * @return Localization_Locale |
|
488 | + */ |
|
489 | 489 | public static function selectAppLocale(string $localeName) : Localization_Locale |
490 | 490 | { |
491 | 491 | return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
492 | 492 | } |
493 | 493 | |
494 | - /** |
|
495 | - * Retrieves an application locale by its name. |
|
496 | - * Note that the locale must have been added first. |
|
497 | - * |
|
498 | - * @param string $localeName |
|
499 | - * @throws Localization_Exception |
|
500 | - * @return Localization_Locale |
|
501 | - * @see Localization::appLocaleExists() |
|
502 | - */ |
|
494 | + /** |
|
495 | + * Retrieves an application locale by its name. |
|
496 | + * Note that the locale must have been added first. |
|
497 | + * |
|
498 | + * @param string $localeName |
|
499 | + * @throws Localization_Exception |
|
500 | + * @return Localization_Locale |
|
501 | + * @see Localization::appLocaleExists() |
|
502 | + */ |
|
503 | 503 | public static function getAppLocaleByName(string $localeName) : Localization_Locale |
504 | 504 | { |
505 | 505 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION); |
@@ -533,22 +533,22 @@ discard block |
||
533 | 533 | return self::getLocalesByNS(self::NAMESPACE_CONTENT); |
534 | 534 | } |
535 | 535 | |
536 | - /** |
|
537 | - * Retrieves the names of all content locales that have been added. |
|
538 | - * @return string[] |
|
539 | - */ |
|
536 | + /** |
|
537 | + * Retrieves the names of all content locales that have been added. |
|
538 | + * @return string[] |
|
539 | + */ |
|
540 | 540 | public static function getContentLocaleNames() |
541 | 541 | { |
542 | 542 | return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT); |
543 | 543 | } |
544 | 544 | |
545 | - /** |
|
546 | - * Retrieves all locale names available in the specified namespace. |
|
547 | - * The names are sorted alphabetically. |
|
548 | - * |
|
549 | - * @param string $namespace |
|
550 | - * @return array|array |
|
551 | - */ |
|
545 | + /** |
|
546 | + * Retrieves all locale names available in the specified namespace. |
|
547 | + * The names are sorted alphabetically. |
|
548 | + * |
|
549 | + * @param string $namespace |
|
550 | + * @return array|array |
|
551 | + */ |
|
552 | 552 | public static function getLocaleNamesByNS(string $namespace) |
553 | 553 | { |
554 | 554 | self::requireNamespace($namespace); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | sort($names); |
559 | 559 | |
560 | 560 | return $names; |
561 | - } |
|
561 | + } |
|
562 | 562 | |
563 | 563 | /** |
564 | 564 | * Checks by the locale name if the specified locale is |
@@ -587,14 +587,14 @@ discard block |
||
587 | 587 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT); |
588 | 588 | } |
589 | 589 | |
590 | - /** |
|
591 | - * Retrieves a locale by its name in the specified namespace. |
|
592 | - * |
|
593 | - * @param string $localeName |
|
594 | - * @param string $namespace |
|
595 | - * @throws Localization_Exception |
|
596 | - * @return Localization_Locale |
|
597 | - */ |
|
590 | + /** |
|
591 | + * Retrieves a locale by its name in the specified namespace. |
|
592 | + * |
|
593 | + * @param string $localeName |
|
594 | + * @param string $namespace |
|
595 | + * @throws Localization_Exception |
|
596 | + * @return Localization_Locale |
|
597 | + */ |
|
598 | 598 | public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale |
599 | 599 | { |
600 | 600 | self::requireNamespace($namespace); |
@@ -654,10 +654,10 @@ discard block |
||
654 | 654 | return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
655 | 655 | } |
656 | 656 | |
657 | - /** |
|
658 | - * Checks whether the localization has been configured entirely. |
|
659 | - * @return bool |
|
660 | - */ |
|
657 | + /** |
|
658 | + * Checks whether the localization has been configured entirely. |
|
659 | + * @return bool |
|
660 | + */ |
|
661 | 661 | public static function isConfigured() : bool |
662 | 662 | { |
663 | 663 | return self::$configured; |
@@ -724,29 +724,29 @@ discard block |
||
724 | 724 | ); |
725 | 725 | } |
726 | 726 | |
727 | - /** |
|
728 | - * Injects a content locales selector element into the specified |
|
729 | - * HTML QuickForm2 container. |
|
730 | - * |
|
731 | - * @param string $elementName |
|
732 | - * @param \HTML_QuickForm2_Container $container |
|
733 | - * @param string $label |
|
734 | - * @return \HTML_QuickForm2_Element_Select |
|
735 | - */ |
|
727 | + /** |
|
728 | + * Injects a content locales selector element into the specified |
|
729 | + * HTML QuickForm2 container. |
|
730 | + * |
|
731 | + * @param string $elementName |
|
732 | + * @param \HTML_QuickForm2_Container $container |
|
733 | + * @param string $label |
|
734 | + * @return \HTML_QuickForm2_Element_Select |
|
735 | + */ |
|
736 | 736 | public static function injectContentLocalesSelector(string $elementName, \HTML_QuickForm2_Container $container, string $label='') : \HTML_QuickForm2_Element_Select |
737 | 737 | { |
738 | 738 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
739 | 739 | } |
740 | 740 | |
741 | - /** |
|
742 | - * Injects an app locales selector element into the specified |
|
741 | + /** |
|
742 | + * Injects an app locales selector element into the specified |
|
743 | 743 | * HTML QuickForm2 container. |
744 | 744 | * |
745 | - * @param string $elementName |
|
746 | - * @param \HTML_QuickForm2_Container $container |
|
747 | - * @param string $label |
|
748 | - * @return \HTML_QuickForm2_Element_Select |
|
749 | - */ |
|
745 | + * @param string $elementName |
|
746 | + * @param \HTML_QuickForm2_Container $container |
|
747 | + * @param string $label |
|
748 | + * @return \HTML_QuickForm2_Element_Select |
|
749 | + */ |
|
750 | 750 | public static function injectAppLocalesSelector(string $elementName, \HTML_QuickForm2_Container $container, string $label='') : \HTML_QuickForm2_Element_Select |
751 | 751 | { |
752 | 752 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
@@ -781,26 +781,26 @@ discard block |
||
781 | 781 | return $select; |
782 | 782 | } |
783 | 783 | |
784 | - /** |
|
785 | - * @var Localization_Source[] |
|
786 | - */ |
|
784 | + /** |
|
785 | + * @var Localization_Source[] |
|
786 | + */ |
|
787 | 787 | protected static $sources = array(); |
788 | 788 | |
789 | - /** |
|
790 | - * @var string[] |
|
791 | - */ |
|
789 | + /** |
|
790 | + * @var string[] |
|
791 | + */ |
|
792 | 792 | protected static $excludeFolders = array(); |
793 | 793 | |
794 | - /** |
|
795 | - * @var string[] |
|
796 | - */ |
|
794 | + /** |
|
795 | + * @var string[] |
|
796 | + */ |
|
797 | 797 | protected static $excludeFiles = array(); |
798 | 798 | |
799 | - /** |
|
800 | - * Retrieves all currently available sources. |
|
801 | - * |
|
802 | - * @return \AppLocalize\Localization_Source[] |
|
803 | - */ |
|
799 | + /** |
|
800 | + * Retrieves all currently available sources. |
|
801 | + * |
|
802 | + * @return \AppLocalize\Localization_Source[] |
|
803 | + */ |
|
804 | 804 | public static function getSources() |
805 | 805 | { |
806 | 806 | return self::$sources; |
@@ -832,10 +832,10 @@ discard block |
||
832 | 832 | return $source; |
833 | 833 | } |
834 | 834 | |
835 | - /** |
|
836 | - * Retrieves all sources grouped by their group name. |
|
837 | - * @return array |
|
838 | - */ |
|
835 | + /** |
|
836 | + * Retrieves all sources grouped by their group name. |
|
837 | + * @return array |
|
838 | + */ |
|
839 | 839 | public static function getSourcesGrouped() |
840 | 840 | { |
841 | 841 | $sources = self::getSources(); |
@@ -856,11 +856,11 @@ discard block |
||
856 | 856 | return $grouped; |
857 | 857 | } |
858 | 858 | |
859 | - /** |
|
860 | - * Checks whether a specific source exists by its ID. |
|
861 | - * @param string $sourceID |
|
862 | - * @return boolean |
|
863 | - */ |
|
859 | + /** |
|
860 | + * Checks whether a specific source exists by its ID. |
|
861 | + * @param string $sourceID |
|
862 | + * @return boolean |
|
863 | + */ |
|
864 | 864 | public static function sourceExists(string $sourceID) : bool |
865 | 865 | { |
866 | 866 | $sources = self::getSources(); |
@@ -873,11 +873,11 @@ discard block |
||
873 | 873 | return false; |
874 | 874 | } |
875 | 875 | |
876 | - /** |
|
877 | - * Checks whether a specific source exists by its alias. |
|
878 | - * @param string $sourceAlias |
|
879 | - * @return boolean |
|
880 | - */ |
|
876 | + /** |
|
877 | + * Checks whether a specific source exists by its alias. |
|
878 | + * @param string $sourceAlias |
|
879 | + * @return boolean |
|
880 | + */ |
|
881 | 881 | public static function sourceAliasExists(string $sourceAlias) : bool |
882 | 882 | { |
883 | 883 | $sources = self::getSources(); |
@@ -890,13 +890,13 @@ discard block |
||
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | - /** |
|
894 | - * Retrieves a localization source by its ID. |
|
895 | - * |
|
896 | - * @param string $sourceID |
|
897 | - * @throws Localization_Exception |
|
898 | - * @return Localization_Source |
|
899 | - */ |
|
893 | + /** |
|
894 | + * Retrieves a localization source by its ID. |
|
895 | + * |
|
896 | + * @param string $sourceID |
|
897 | + * @throws Localization_Exception |
|
898 | + * @return Localization_Source |
|
899 | + */ |
|
900 | 900 | public static function getSourceByID(string $sourceID) : Localization_Source |
901 | 901 | { |
902 | 902 | $sources = self::getSources(); |
@@ -942,12 +942,12 @@ discard block |
||
942 | 942 | ); |
943 | 943 | } |
944 | 944 | |
945 | - /** |
|
946 | - * Creates the scanner instance that is used to find |
|
947 | - * all translateable strings in the application. |
|
948 | - * |
|
949 | - * @return Localization_Scanner |
|
950 | - */ |
|
945 | + /** |
|
946 | + * Creates the scanner instance that is used to find |
|
947 | + * all translateable strings in the application. |
|
948 | + * |
|
949 | + * @return Localization_Scanner |
|
950 | + */ |
|
951 | 951 | public static function createScanner() : Localization_Scanner |
952 | 952 | { |
953 | 953 | self::requireConfiguration(); |
@@ -960,14 +960,14 @@ discard block |
||
960 | 960 | // FIXME: TODO: Add this |
961 | 961 | } |
962 | 962 | |
963 | - /** |
|
964 | - * Configures the localization for the application: |
|
965 | - * sets the location of the required files and folders. |
|
966 | - * Also updated the client library files as needed. |
|
967 | - * |
|
968 | - * @param string $storageFile Where to store the file analysis storage file. |
|
969 | - * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
|
970 | - */ |
|
963 | + /** |
|
964 | + * Configures the localization for the application: |
|
965 | + * sets the location of the required files and folders. |
|
966 | + * Also updated the client library files as needed. |
|
967 | + * |
|
968 | + * @param string $storageFile Where to store the file analysis storage file. |
|
969 | + * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
|
970 | + */ |
|
971 | 971 | public static function configure(string $storageFile, string $clientLibrariesFolder='') |
972 | 972 | { |
973 | 973 | self::$configured = true; |
@@ -983,17 +983,17 @@ discard block |
||
983 | 983 | } |
984 | 984 | } |
985 | 985 | |
986 | - /** |
|
987 | - * Sets a key that is used to verify whether the client |
|
988 | - * libraries have to be refreshed. A common use is to set |
|
989 | - * this to the application's version number to guarantee |
|
990 | - * new texts are automatically used with each release. |
|
991 | - * |
|
992 | - * NOTE: Otherwise files are refreshed only when saving |
|
993 | - * them in the editor UI. |
|
994 | - * |
|
995 | - * @param string $key |
|
996 | - */ |
|
986 | + /** |
|
987 | + * Sets a key that is used to verify whether the client |
|
988 | + * libraries have to be refreshed. A common use is to set |
|
989 | + * this to the application's version number to guarantee |
|
990 | + * new texts are automatically used with each release. |
|
991 | + * |
|
992 | + * NOTE: Otherwise files are refreshed only when saving |
|
993 | + * them in the editor UI. |
|
994 | + * |
|
995 | + * @param string $key |
|
996 | + */ |
|
997 | 997 | public static function setClientLibrariesCacheKey(string $key) |
998 | 998 | { |
999 | 999 | self::$clientCacheKey = $key; |
@@ -1004,48 +1004,48 @@ discard block |
||
1004 | 1004 | return self::$clientCacheKey; |
1005 | 1005 | } |
1006 | 1006 | |
1007 | - /** |
|
1008 | - * Sets the folder where client libraries are to be stored. |
|
1009 | - * @param string $folder |
|
1010 | - */ |
|
1007 | + /** |
|
1008 | + * Sets the folder where client libraries are to be stored. |
|
1009 | + * @param string $folder |
|
1010 | + */ |
|
1011 | 1011 | public static function setClientLibrariesFolder(string $folder) |
1012 | 1012 | { |
1013 | 1013 | self::$clientFolder = $folder; |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - /** |
|
1017 | - * Retrieves the path to the folder in which the client |
|
1018 | - * libraries should be stored. |
|
1019 | - * |
|
1020 | - * NOTE: Can return an empty string, when this is disabled. |
|
1021 | - * |
|
1022 | - * @return string |
|
1023 | - */ |
|
1016 | + /** |
|
1017 | + * Retrieves the path to the folder in which the client |
|
1018 | + * libraries should be stored. |
|
1019 | + * |
|
1020 | + * NOTE: Can return an empty string, when this is disabled. |
|
1021 | + * |
|
1022 | + * @return string |
|
1023 | + */ |
|
1024 | 1024 | public static function getClientLibrariesFolder() : string |
1025 | 1025 | { |
1026 | 1026 | return self::$clientFolder; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - /** |
|
1030 | - * Writes / updates the client library files on disk, |
|
1031 | - * at the location specified in the {@link Localization::configure()} |
|
1032 | - * method. |
|
1033 | - * |
|
1034 | - * @see Localization_ClientGenerator |
|
1035 | - * @param bool $force Whether to refresh the files, even if they exist. |
|
1036 | - */ |
|
1029 | + /** |
|
1030 | + * Writes / updates the client library files on disk, |
|
1031 | + * at the location specified in the {@link Localization::configure()} |
|
1032 | + * method. |
|
1033 | + * |
|
1034 | + * @see Localization_ClientGenerator |
|
1035 | + * @param bool $force Whether to refresh the files, even if they exist. |
|
1036 | + */ |
|
1037 | 1037 | public static function writeClientFiles(bool $force=false) : void |
1038 | 1038 | { |
1039 | 1039 | self::createGenerator()->writeFiles($force); |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - /** |
|
1043 | - * Creates a new instance of the client generator class |
|
1044 | - * that is used to write the localization files into the |
|
1045 | - * target folder on disk. |
|
1046 | - * |
|
1047 | - * @return Localization_ClientGenerator |
|
1048 | - */ |
|
1042 | + /** |
|
1043 | + * Creates a new instance of the client generator class |
|
1044 | + * that is used to write the localization files into the |
|
1045 | + * target folder on disk. |
|
1046 | + * |
|
1047 | + * @return Localization_ClientGenerator |
|
1048 | + */ |
|
1049 | 1049 | public static function createGenerator() : Localization_ClientGenerator |
1050 | 1050 | { |
1051 | 1051 | return new Localization_ClientGenerator(); |
@@ -1088,13 +1088,13 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - /** |
|
1092 | - * Creates the editor instance that can be used to |
|
1093 | - * display the localization UI to edit translateable |
|
1094 | - * strings in the browser. |
|
1095 | - * |
|
1096 | - * @return \AppLocalize\Localization_Editor |
|
1097 | - */ |
|
1091 | + /** |
|
1092 | + * Creates the editor instance that can be used to |
|
1093 | + * display the localization UI to edit translateable |
|
1094 | + * strings in the browser. |
|
1095 | + * |
|
1096 | + * @return \AppLocalize\Localization_Editor |
|
1097 | + */ |
|
1098 | 1098 | public static function createEditor() : Localization_Editor |
1099 | 1099 | { |
1100 | 1100 | self::requireConfiguration(); |
@@ -1102,10 +1102,10 @@ discard block |
||
1102 | 1102 | return new Localization_Editor(); |
1103 | 1103 | } |
1104 | 1104 | |
1105 | - /** |
|
1106 | - * Retrieves a list of all available source IDs. |
|
1107 | - * @return string[] |
|
1108 | - */ |
|
1105 | + /** |
|
1106 | + * Retrieves a list of all available source IDs. |
|
1107 | + * @return string[] |
|
1108 | + */ |
|
1109 | 1109 | public static function getSourceIDs() |
1110 | 1110 | { |
1111 | 1111 | $ids = array(); |
@@ -1132,9 +1132,9 @@ discard block |
||
1132 | 1132 | return $aliases; |
1133 | 1133 | } |
1134 | 1134 | |
1135 | - /** |
|
1136 | - * Resets all locales to the built-in locale. |
|
1137 | - */ |
|
1135 | + /** |
|
1136 | + * Resets all locales to the built-in locale. |
|
1137 | + */ |
|
1138 | 1138 | public static function reset() : void |
1139 | 1139 | { |
1140 | 1140 | self::$locales = array(); |
@@ -1166,22 +1166,22 @@ discard block |
||
1166 | 1166 | 'de_CH' |
1167 | 1167 | ); |
1168 | 1168 | |
1169 | - /** |
|
1170 | - * Retrieves a list of all supported locales. |
|
1171 | - * |
|
1172 | - * @return array |
|
1173 | - */ |
|
1169 | + /** |
|
1170 | + * Retrieves a list of all supported locales. |
|
1171 | + * |
|
1172 | + * @return array |
|
1173 | + */ |
|
1174 | 1174 | public static function getSupportedLocaleNames() : array |
1175 | 1175 | { |
1176 | 1176 | return self::$supportedLocales; |
1177 | 1177 | } |
1178 | 1178 | |
1179 | - /** |
|
1180 | - * Checks whether the specified locale is supported. |
|
1181 | - * |
|
1182 | - * @param string $localeName |
|
1183 | - * @return bool |
|
1184 | - */ |
|
1179 | + /** |
|
1180 | + * Checks whether the specified locale is supported. |
|
1181 | + * |
|
1182 | + * @param string $localeName |
|
1183 | + * @return bool |
|
1184 | + */ |
|
1185 | 1185 | public static function isLocaleSupported(string $localeName) : bool |
1186 | 1186 | { |
1187 | 1187 | return in_array($localeName, self::$supportedLocales); |
@@ -34,54 +34,54 @@ discard block |
||
34 | 34 | |
35 | 35 | const ERROR_NO_SOURCES_AVAILABLE = 40001; |
36 | 36 | |
37 | - /** |
|
38 | - * @var string |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var string |
|
39 | + */ |
|
40 | 40 | protected $installPath; |
41 | 41 | |
42 | - /** |
|
43 | - * @var Localization_Source[] |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var Localization_Source[] |
|
44 | + */ |
|
45 | 45 | protected $sources; |
46 | 46 | |
47 | - /** |
|
48 | - * @var \AppUtils\Request |
|
49 | - */ |
|
47 | + /** |
|
48 | + * @var \AppUtils\Request |
|
49 | + */ |
|
50 | 50 | protected $request; |
51 | 51 | |
52 | - /** |
|
53 | - * @var Localization_Source |
|
54 | - */ |
|
52 | + /** |
|
53 | + * @var Localization_Source |
|
54 | + */ |
|
55 | 55 | protected $activeSource; |
56 | 56 | |
57 | - /** |
|
58 | - * @var Localization_Scanner |
|
59 | - */ |
|
57 | + /** |
|
58 | + * @var Localization_Scanner |
|
59 | + */ |
|
60 | 60 | protected $scanner; |
61 | 61 | |
62 | - /** |
|
63 | - * @var Localization_Locale[] |
|
64 | - */ |
|
62 | + /** |
|
63 | + * @var Localization_Locale[] |
|
64 | + */ |
|
65 | 65 | protected $appLocales = array(); |
66 | 66 | |
67 | - /** |
|
68 | - * @var Localization_Locale |
|
69 | - */ |
|
67 | + /** |
|
68 | + * @var Localization_Locale |
|
69 | + */ |
|
70 | 70 | protected $activeAppLocale; |
71 | 71 | |
72 | - /** |
|
73 | - * @var Localization_Editor_Filters |
|
74 | - */ |
|
72 | + /** |
|
73 | + * @var Localization_Editor_Filters |
|
74 | + */ |
|
75 | 75 | protected $filters; |
76 | 76 | |
77 | - /** |
|
78 | - * @var string[]string |
|
79 | - */ |
|
77 | + /** |
|
78 | + * @var string[]string |
|
79 | + */ |
|
80 | 80 | protected $requestParams = array(); |
81 | 81 | |
82 | - /** |
|
83 | - * @var string |
|
84 | - */ |
|
82 | + /** |
|
83 | + * @var string |
|
84 | + */ |
|
85 | 85 | protected $varPrefix = 'applocalize_'; |
86 | 86 | |
87 | 87 | public function __construct() |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | return $this->request; |
101 | 101 | } |
102 | 102 | |
103 | - /** |
|
104 | - * Adds a request parameter that will be persisted in all URLs |
|
105 | - * within the editor. This can be used when integrating the |
|
106 | - * editor in an existing page that needs specific request params. |
|
107 | - * |
|
108 | - * @param string $name |
|
109 | - * @param string $value |
|
110 | - * @return Localization_Editor |
|
111 | - */ |
|
103 | + /** |
|
104 | + * Adds a request parameter that will be persisted in all URLs |
|
105 | + * within the editor. This can be used when integrating the |
|
106 | + * editor in an existing page that needs specific request params. |
|
107 | + * |
|
108 | + * @param string $name |
|
109 | + * @param string $value |
|
110 | + * @return Localization_Editor |
|
111 | + */ |
|
112 | 112 | public function addRequestParam(string $name, string $value) : Localization_Editor |
113 | 113 | { |
114 | 114 | $this->requestParams[$name] = $value; |
@@ -263,34 +263,34 @@ discard block |
||
263 | 263 | </a> |
264 | 264 | <div class="dropdown-menu" aria-labelledby="dropdown01"> |
265 | 265 | <?php |
266 | - foreach($this->sources as $source) |
|
267 | - { |
|
268 | - ?> |
|
266 | + foreach($this->sources as $source) |
|
267 | + { |
|
268 | + ?> |
|
269 | 269 | <a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>"> |
270 | 270 | <?php |
271 | - if($source->getID() === $this->activeSource->getID()) |
|
272 | - { |
|
273 | - ?> |
|
271 | + if($source->getID() === $this->activeSource->getID()) |
|
272 | + { |
|
273 | + ?> |
|
274 | 274 | <b><?php echo $source->getLabel() ?></b> |
275 | 275 | <?php |
276 | - } |
|
277 | - else |
|
278 | - { |
|
279 | - echo $source->getLabel(); |
|
280 | - } |
|
281 | - ?> |
|
276 | + } |
|
277 | + else |
|
278 | + { |
|
279 | + echo $source->getLabel(); |
|
280 | + } |
|
281 | + ?> |
|
282 | 282 | <?php |
283 | - $untranslated = $source->countUntranslated($this->scanner); |
|
284 | - if($untranslated > 0) { |
|
285 | - ?> |
|
283 | + $untranslated = $source->countUntranslated($this->scanner); |
|
284 | + if($untranslated > 0) { |
|
285 | + ?> |
|
286 | 286 | (<span class="text-danger" title="<?php pt('%1$s texts have not been translated in this text source.', $untranslated) ?>"><?php echo $untranslated ?></span>) |
287 | 287 | <?php |
288 | - } |
|
289 | - ?> |
|
288 | + } |
|
289 | + ?> |
|
290 | 290 | </a> |
291 | 291 | <?php |
292 | - } |
|
293 | - ?> |
|
292 | + } |
|
293 | + ?> |
|
294 | 294 | </div> |
295 | 295 | </li> |
296 | 296 | <li class="nav-item dropdown"> |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | </a> |
300 | 300 | <div class="dropdown-menu" aria-labelledby="dropdown01"> |
301 | 301 | <?php |
302 | - foreach($this->appLocales as $locale) |
|
303 | - { |
|
304 | - ?> |
|
302 | + foreach($this->appLocales as $locale) |
|
303 | + { |
|
304 | + ?> |
|
305 | 305 | <a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>"> |
306 | 306 | <?php echo $locale->getLabel() ?> |
307 | 307 | </a> |
308 | 308 | <?php |
309 | - } |
|
310 | - ?> |
|
309 | + } |
|
310 | + ?> |
|
311 | 311 | </div> |
312 | 312 | </li> |
313 | 313 | <li class="nav-item"> |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | </a> |
318 | 318 | </li> |
319 | 319 | <?php |
320 | - if($this->scanner->hasWarnings()) { |
|
321 | - ?> |
|
320 | + if($this->scanner->hasWarnings()) { |
|
321 | + ?> |
|
322 | 322 | <li class="nav-item"> |
323 | 323 | <a href="<?php echo $this->getWarningsURL() ?>"> |
324 | 324 | <span class="badge badge-warning" title="<?php pts('The last scan for translateable texts reported warnings.'); pts('Click for details.'); ?>" data-toggle="tooltip"> |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | </a> |
329 | 329 | </li> |
330 | 330 | <?php |
331 | - } |
|
332 | - ?> |
|
331 | + } |
|
332 | + ?> |
|
333 | 333 | </ul> |
334 | 334 | <?php |
335 | 335 | } |
@@ -345,36 +345,36 @@ discard block |
||
345 | 345 | </a> |
346 | 346 | <?php |
347 | 347 | } |
348 | - ?> |
|
348 | + ?> |
|
349 | 349 | </div> |
350 | 350 | </nav> |
351 | 351 | <main role="main" class="container"> |
352 | 352 | <div> |
353 | 353 | <?php |
354 | - if(empty($this->appLocales)) |
|
355 | - { |
|
356 | - ?> |
|
354 | + if(empty($this->appLocales)) |
|
355 | + { |
|
356 | + ?> |
|
357 | 357 | <div class="alert alert-danger"> |
358 | 358 | <i class="fa fa-exclamation-triangle"></i> |
359 | 359 | <b><?php pt('Nothing to translate:') ?></b> |
360 | 360 | <?php pt('No application locales were added to translate to.') ?> |
361 | 361 | </div> |
362 | 362 | <?php |
363 | - } |
|
364 | - else if($this->request->getBool($this->getVarName('warnings'))) |
|
365 | - { |
|
366 | - echo $this->renderWarnings(); |
|
367 | - } |
|
368 | - else |
|
369 | - { |
|
370 | - ?> |
|
363 | + } |
|
364 | + else if($this->request->getBool($this->getVarName('warnings'))) |
|
365 | + { |
|
366 | + echo $this->renderWarnings(); |
|
367 | + } |
|
368 | + else |
|
369 | + { |
|
370 | + ?> |
|
371 | 371 | <h1><?php echo $this->activeSource->getLabel() ?></h1> |
372 | 372 | <?php |
373 | - if(!empty($_SESSION['localization_messages'])) |
|
374 | - { |
|
375 | - foreach($_SESSION['localization_messages'] as $def) |
|
376 | - { |
|
377 | - ?> |
|
373 | + if(!empty($_SESSION['localization_messages'])) |
|
374 | + { |
|
375 | + foreach($_SESSION['localization_messages'] as $def) |
|
376 | + { |
|
377 | + ?> |
|
378 | 378 | <div class="alert alert-<?php echo $def['type'] ?>" role="alert"> |
379 | 379 | <?php echo $def['text'] ?> |
380 | 380 | <button type="button" class="close" data-dismiss="alert" aria-label="<?php pt('Close') ?>" title="<?php pt('Dismiss this message.') ?>" data-toggle="tooltip"> |
@@ -382,28 +382,28 @@ discard block |
||
382 | 382 | </button> |
383 | 383 | </div> |
384 | 384 | <?php |
385 | - } |
|
385 | + } |
|
386 | 386 | |
387 | - // reset the messages after having displayed them |
|
388 | - $_SESSION['localization_messages'] = array(); |
|
389 | - } |
|
390 | - ?> |
|
387 | + // reset the messages after having displayed them |
|
388 | + $_SESSION['localization_messages'] = array(); |
|
389 | + } |
|
390 | + ?> |
|
391 | 391 | <p> |
392 | 392 | <?php |
393 | - pt( |
|
394 | - 'You are translating to %1$s', |
|
395 | - '<span class="badge badge-info">'. |
|
396 | - $this->activeAppLocale->getLabel(). |
|
397 | - '</span>' |
|
393 | + pt( |
|
394 | + 'You are translating to %1$s', |
|
395 | + '<span class="badge badge-info">'. |
|
396 | + $this->activeAppLocale->getLabel(). |
|
397 | + '</span>' |
|
398 | 398 | ); |
399 | - ?><br> |
|
399 | + ?><br> |
|
400 | 400 | <?php pt('Found %1$s texts to translate.', $this->activeSource->countUntranslated($this->scanner)) ?> |
401 | 401 | </p> |
402 | 402 | <br> |
403 | 403 | <?php |
404 | - if(!$this->scanner->isScanAvailable()) |
|
405 | - { |
|
406 | - ?> |
|
404 | + if(!$this->scanner->isScanAvailable()) |
|
405 | + { |
|
406 | + ?> |
|
407 | 407 | <div class="alert alert-primary" role="alert"> |
408 | 408 | <b><?php pt('No texts found:') ?></b> |
409 | 409 | <?php pt('The source folders have not been scanned yet.') ?> |
@@ -415,15 +415,15 @@ discard block |
||
415 | 415 | </a> |
416 | 416 | </p> |
417 | 417 | <?php |
418 | - } |
|
419 | - else |
|
420 | - { |
|
421 | - echo $this->filters->renderForm(); |
|
422 | - echo $this->renderList(); |
|
423 | - } |
|
418 | + } |
|
419 | + else |
|
420 | + { |
|
421 | + echo $this->filters->renderForm(); |
|
422 | + echo $this->renderList(); |
|
423 | + } |
|
424 | 424 | |
425 | - } |
|
426 | - ?> |
|
425 | + } |
|
426 | + ?> |
|
427 | 427 | </div> |
428 | 428 | </main> |
429 | 429 | </body> |
@@ -441,22 +441,22 @@ discard block |
||
441 | 441 | <h1><?php pt('Warnings') ?></h1> |
442 | 442 | <p class="abstract"> |
443 | 443 | <?php |
444 | - pts('The following shows all texts where the system decided that they cannot be translated.'); |
|
445 | - ?> |
|
444 | + pts('The following shows all texts where the system decided that they cannot be translated.'); |
|
445 | + ?> |
|
446 | 446 | </p> |
447 | 447 | <dl> |
448 | 448 | <?php |
449 | - $warnings = $this->scanner->getWarnings(); |
|
449 | + $warnings = $this->scanner->getWarnings(); |
|
450 | 450 | |
451 | - foreach($warnings as $warning) |
|
452 | - { |
|
453 | - ?> |
|
451 | + foreach($warnings as $warning) |
|
452 | + { |
|
453 | + ?> |
|
454 | 454 | <dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt> |
455 | 455 | <dd><?php echo $warning->getMessage() ?></dd> |
456 | 456 | <?php |
457 | - } |
|
457 | + } |
|
458 | 458 | |
459 | - ?> |
|
459 | + ?> |
|
460 | 460 | </dl> |
461 | 461 | <?php |
462 | 462 | |
@@ -525,13 +525,13 @@ discard block |
||
525 | 525 | <form method="post"> |
526 | 526 | <div class="form-hiddens"> |
527 | 527 | <?php |
528 | - $params = $this->getRequestParams(); |
|
529 | - foreach($params as $name => $value) { |
|
530 | - ?> |
|
528 | + $params = $this->getRequestParams(); |
|
529 | + foreach($params as $name => $value) { |
|
530 | + ?> |
|
531 | 531 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
532 | 532 | <?php |
533 | - } |
|
534 | - ?> |
|
533 | + } |
|
534 | + ?> |
|
535 | 535 | </div> |
536 | 536 | <table class="table table-hover"> |
537 | 537 | <thead> |
@@ -544,20 +544,20 @@ discard block |
||
544 | 544 | </thead> |
545 | 545 | <tbody> |
546 | 546 | <?php |
547 | - foreach($keep as $string) |
|
548 | - { |
|
549 | - $this->renderListEntry($string); |
|
550 | - } |
|
551 | - ?> |
|
547 | + foreach($keep as $string) |
|
548 | + { |
|
549 | + $this->renderListEntry($string); |
|
550 | + } |
|
551 | + ?> |
|
552 | 552 | </tbody> |
553 | 553 | </table> |
554 | 554 | <?php |
555 | - if($pager->hasPages()) |
|
556 | - { |
|
557 | - $prevUrl = $this->getPaginationURL($pager->getPreviousPage()); |
|
558 | - $nextUrl = $this->getPaginationURL($pager->getNextPage()); |
|
555 | + if($pager->hasPages()) |
|
556 | + { |
|
557 | + $prevUrl = $this->getPaginationURL($pager->getPreviousPage()); |
|
558 | + $nextUrl = $this->getPaginationURL($pager->getNextPage()); |
|
559 | 559 | |
560 | - ?> |
|
560 | + ?> |
|
561 | 561 | <nav aria-label="<?php pt('Navigate available pages of texts.') ?>"> |
562 | 562 | <ul class="pagination"> |
563 | 563 | <li class="page-item"> |
@@ -566,20 +566,20 @@ discard block |
||
566 | 566 | </a> |
567 | 567 | </li> |
568 | 568 | <?php |
569 | - $numbers = $pager->getPageNumbers(); |
|
570 | - foreach($numbers as $number) |
|
571 | - { |
|
572 | - $url = $this->getPaginationURL($number); |
|
569 | + $numbers = $pager->getPageNumbers(); |
|
570 | + foreach($numbers as $number) |
|
571 | + { |
|
572 | + $url = $this->getPaginationURL($number); |
|
573 | 573 | |
574 | - ?> |
|
574 | + ?> |
|
575 | 575 | <li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>"> |
576 | 576 | <a class="page-link" href="<?php echo $url ?>"> |
577 | 577 | <?php echo $number ?> |
578 | 578 | </a> |
579 | 579 | </li> |
580 | 580 | <?php |
581 | - } |
|
582 | - ?> |
|
581 | + } |
|
582 | + ?> |
|
583 | 583 | <li class="page-item"> |
584 | 584 | <a class="page-link" href="<?php echo $nextUrl ?>"> |
585 | 585 | <i class="fa fa-arrow-right"></i> |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | </ul> |
589 | 589 | </nav> |
590 | 590 | <?php |
591 | - } |
|
592 | - ?> |
|
591 | + } |
|
592 | + ?> |
|
593 | 593 | <br> |
594 | 594 | <p> |
595 | 595 | <button type="submit" name="<?php echo $this->getVarName('save') ?>" value="yes" class="btn btn-primary"> |
@@ -647,48 +647,48 @@ discard block |
||
647 | 647 | <div class="files-list"> |
648 | 648 | <p> |
649 | 649 | <?php |
650 | - $totalFiles = count($files); |
|
650 | + $totalFiles = count($files); |
|
651 | 651 | |
652 | - if($totalFiles == 1) |
|
653 | - { |
|
654 | - pt('Found in a single file:'); |
|
655 | - } |
|
656 | - else |
|
657 | - { |
|
658 | - pt('Found in %1$s files:', $totalFiles); |
|
659 | - } |
|
660 | - ?> |
|
652 | + if($totalFiles == 1) |
|
653 | + { |
|
654 | + pt('Found in a single file:'); |
|
655 | + } |
|
656 | + else |
|
657 | + { |
|
658 | + pt('Found in %1$s files:', $totalFiles); |
|
659 | + } |
|
660 | + ?> |
|
661 | 661 | </p> |
662 | 662 | <div class="files-scroller"> |
663 | 663 | <ul> |
664 | 664 | <?php |
665 | - $locations = $string->getStrings(); |
|
665 | + $locations = $string->getStrings(); |
|
666 | 666 | |
667 | - foreach($locations as $location) |
|
668 | - { |
|
669 | - $file = $location->getSourceFile(); |
|
670 | - $line = $location->getLine(); |
|
667 | + foreach($locations as $location) |
|
668 | + { |
|
669 | + $file = $location->getSourceFile(); |
|
670 | + $line = $location->getLine(); |
|
671 | 671 | |
672 | - $icon = ''; |
|
672 | + $icon = ''; |
|
673 | 673 | |
674 | - $ext = \AppUtils\FileHelper::getExtension($file); |
|
674 | + $ext = \AppUtils\FileHelper::getExtension($file); |
|
675 | 675 | |
676 | - if($ext == 'php') { |
|
677 | - $icon = 'fab fa-php'; |
|
678 | - } else if($ext == 'js') { |
|
679 | - $icon = 'fab fa-js-square'; |
|
680 | - } else { |
|
681 | - $icon = 'fas fa-file-code'; |
|
682 | - } |
|
676 | + if($ext == 'php') { |
|
677 | + $icon = 'fab fa-php'; |
|
678 | + } else if($ext == 'js') { |
|
679 | + $icon = 'fab fa-js-square'; |
|
680 | + } else { |
|
681 | + $icon = 'fas fa-file-code'; |
|
682 | + } |
|
683 | 683 | |
684 | - ?> |
|
684 | + ?> |
|
685 | 685 | <li> |
686 | 686 | <i class="<?php echo $icon ?>"></i> |
687 | 687 | <?php echo $file ?><span class="line-number">:<?php echo $line ?></span> |
688 | 688 | </li> |
689 | 689 | <?php |
690 | - } |
|
691 | - ?> |
|
690 | + } |
|
691 | + ?> |
|
692 | 692 | </ul> |
693 | 693 | </div> |
694 | 694 | </div> |
@@ -899,13 +899,13 @@ discard block |
||
899 | 899 | ); |
900 | 900 | } |
901 | 901 | |
902 | - /** |
|
903 | - * Sets the application name shown in the main navigation |
|
904 | - * in the user interface. |
|
905 | - * |
|
906 | - * @param string $name |
|
907 | - * @return Localization_Editor |
|
908 | - */ |
|
902 | + /** |
|
903 | + * Sets the application name shown in the main navigation |
|
904 | + * in the user interface. |
|
905 | + * |
|
906 | + * @param string $name |
|
907 | + * @return Localization_Editor |
|
908 | + */ |
|
909 | 909 | public function setAppName(string $name) : Localization_Editor |
910 | 910 | { |
911 | 911 | $this->setOption('appname', $name); |
@@ -922,27 +922,27 @@ discard block |
||
922 | 922 | return t('Localization editor'); |
923 | 923 | } |
924 | 924 | |
925 | - /** |
|
926 | - * Selects the default source to use if none has been |
|
927 | - * explicitly selected. |
|
928 | - * |
|
929 | - * @param string $sourceID |
|
930 | - */ |
|
925 | + /** |
|
926 | + * Selects the default source to use if none has been |
|
927 | + * explicitly selected. |
|
928 | + * |
|
929 | + * @param string $sourceID |
|
930 | + */ |
|
931 | 931 | public function selectDefaultSource(string $sourceID) : Localization_Editor |
932 | 932 | { |
933 | 933 | $this->setOption('default-source', $sourceID); |
934 | 934 | return $this; |
935 | 935 | } |
936 | 936 | |
937 | - /** |
|
938 | - * Sets an URL that the translators can use to go back to |
|
939 | - * the main application, for example if it is integrated into |
|
940 | - * an existing application. |
|
941 | - * |
|
942 | - * @param string $url The URL to use for the link |
|
943 | - * @param string $label Label of the link |
|
944 | - * @return Localization_Editor |
|
945 | - */ |
|
937 | + /** |
|
938 | + * Sets an URL that the translators can use to go back to |
|
939 | + * the main application, for example if it is integrated into |
|
940 | + * an existing application. |
|
941 | + * |
|
942 | + * @param string $url The URL to use for the link |
|
943 | + * @param string $label Label of the link |
|
944 | + * @return Localization_Editor |
|
945 | + */ |
|
946 | 946 | public function setBackURL(string $url, string $label) : Localization_Editor |
947 | 947 | { |
948 | 948 | $this->setOption('back-url', $url); |
@@ -20,25 +20,25 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Localization_Editor_Filters |
22 | 22 | { |
23 | - /** |
|
24 | - * @var Localization_Editor |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var Localization_Editor |
|
25 | + */ |
|
26 | 26 | protected $editor; |
27 | 27 | |
28 | - /** |
|
29 | - * @var \AppUtils\Request |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var \AppUtils\Request |
|
30 | + */ |
|
31 | 31 | |
32 | 32 | protected $request; |
33 | 33 | |
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | 37 | protected $sessionName = 'localize_filters'; |
38 | 38 | |
39 | - /** |
|
40 | - * @var string[]string |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var string[]string |
|
41 | + */ |
|
42 | 42 | protected $vars = array( |
43 | 43 | 'resetfilter' => '', |
44 | 44 | 'filter' => '', |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | <form class="form-inline"> |
192 | 192 | <div class="form-hiddens"> |
193 | 193 | <?php |
194 | - $params = $this->editor->getRequestParams(); |
|
195 | - foreach($params as $name => $value) { |
|
196 | - ?> |
|
194 | + $params = $this->editor->getRequestParams(); |
|
195 | + foreach($params as $name => $value) { |
|
196 | + ?> |
|
197 | 197 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
198 | 198 | <?php |
199 | - } |
|
200 | - ?> |
|
199 | + } |
|
200 | + ?> |
|
201 | 201 | </div> |
202 | 202 | <div class="form-row"> |
203 | 203 | <div class="col-auto"> |
@@ -205,42 +205,42 @@ discard block |
||
205 | 205 | </div> |
206 | 206 | <div class="col-auto"> |
207 | 207 | <?php |
208 | - echo $this->renderSelect( |
|
209 | - $this->vars['status'], |
|
210 | - array( |
|
211 | - array( |
|
212 | - 'value' => '', |
|
213 | - 'label' => t('Status...') |
|
214 | - ), |
|
215 | - array( |
|
216 | - 'value' => 'untranslated', |
|
217 | - 'label' => t('Not translated') |
|
218 | - ), |
|
219 | - array( |
|
220 | - 'value' => 'translated', |
|
221 | - 'label' => t('Translated') |
|
222 | - ) |
|
223 | - ) |
|
224 | - ); |
|
208 | + echo $this->renderSelect( |
|
209 | + $this->vars['status'], |
|
210 | + array( |
|
211 | + array( |
|
212 | + 'value' => '', |
|
213 | + 'label' => t('Status...') |
|
214 | + ), |
|
215 | + array( |
|
216 | + 'value' => 'untranslated', |
|
217 | + 'label' => t('Not translated') |
|
218 | + ), |
|
219 | + array( |
|
220 | + 'value' => 'translated', |
|
221 | + 'label' => t('Translated') |
|
222 | + ) |
|
223 | + ) |
|
224 | + ); |
|
225 | 225 | |
226 | - echo $this->renderSelect( |
|
227 | - $this->vars['location'], |
|
228 | - array( |
|
229 | - array( |
|
230 | - 'value' => '', |
|
231 | - 'label' => t('Location...') |
|
232 | - ), |
|
233 | - array( |
|
234 | - 'value' => 'client', |
|
235 | - 'label' => t('Clientside') |
|
236 | - ), |
|
237 | - array( |
|
238 | - 'value' => 'server', |
|
239 | - 'label' => t('Serverside') |
|
240 | - ) |
|
241 | - ) |
|
242 | - ); |
|
243 | - ?> |
|
226 | + echo $this->renderSelect( |
|
227 | + $this->vars['location'], |
|
228 | + array( |
|
229 | + array( |
|
230 | + 'value' => '', |
|
231 | + 'label' => t('Location...') |
|
232 | + ), |
|
233 | + array( |
|
234 | + 'value' => 'client', |
|
235 | + 'label' => t('Clientside') |
|
236 | + ), |
|
237 | + array( |
|
238 | + 'value' => 'server', |
|
239 | + 'label' => t('Serverside') |
|
240 | + ) |
|
241 | + ) |
|
242 | + ); |
|
243 | + ?> |
|
244 | 244 | </div> |
245 | 245 | <div class="col-auto"> |
246 | 246 | <button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip"> |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | </form> |
256 | 256 | <p> |
257 | 257 | <small class="text-muted"><?php |
258 | - pts('Hint:'); |
|
259 | - pt('Search works in translated and untranslated text, as well as the file name.') |
|
260 | - ?></small> |
|
258 | + pts('Hint:'); |
|
259 | + pt('Search works in translated and untranslated text, as well as the file name.') |
|
260 | + ?></small> |
|
261 | 261 | </p> |
262 | 262 | <br> |
263 | 263 | <?php |