@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return array Sorted list of "accept" options |
21 | 21 | */ |
22 | -$sortAccept = function ($header) { |
|
22 | +$sortAccept = function ($header) |
|
23 | +{ |
|
23 | 24 | $matches = array(); |
24 | 25 | foreach (explode(',', $header) as $option) { |
25 | 26 | $option = array_map('trim', explode(';', $option)); |
@@ -52,7 +53,8 @@ discard block |
||
52 | 53 | * |
53 | 54 | * @return string|NULL a matched option, or NULL if no match |
54 | 55 | */ |
55 | -$matchAccept = function ($header, $supported) use ($sortAccept) { |
|
56 | +$matchAccept = function ($header, $supported) use ($sortAccept) |
|
57 | +{ |
|
56 | 58 | $matches = $sortAccept($header); |
57 | 59 | foreach ($matches as $key => $q) { |
58 | 60 | if (isset($supported[$key])) { |
@@ -83,7 +85,8 @@ discard block |
||
83 | 85 | * |
84 | 86 | * @return string The negotiated language result or the supplied default. |
85 | 87 | */ |
86 | -$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) { |
|
88 | +$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) |
|
89 | +{ |
|
87 | 90 | $supp = array(); |
88 | 91 | foreach ($supported as $lang => $isSupported) { |
89 | 92 | if ($isSupported) { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return array Sorted list of "accept" options |
21 | 21 | */ |
22 | -$sortAccept = function ($header) { |
|
22 | +$sortAccept = function($header) { |
|
23 | 23 | $matches = array(); |
24 | 24 | foreach (explode(',', $header) as $option) { |
25 | 25 | $option = array_map('trim', explode(';', $option)); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string|NULL a matched option, or NULL if no match |
54 | 54 | */ |
55 | -$matchAccept = function ($header, $supported) use ($sortAccept) { |
|
55 | +$matchAccept = function($header, $supported) use ($sortAccept) { |
|
56 | 56 | $matches = $sortAccept($header); |
57 | 57 | foreach ($matches as $key => $q) { |
58 | 58 | if (isset($supported[$key])) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return string The negotiated language result or the supplied default. |
85 | 85 | */ |
86 | -$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) { |
|
86 | +$negotiateLanguage = function($supported, $default = 'en-US') use ($matchAccept) { |
|
87 | 87 | $supp = array(); |
88 | 88 | foreach ($supported as $lang => $isSupported) { |
89 | 89 | if ($isSupported) { |
@@ -162,27 +162,27 @@ discard block |
||
162 | 162 | // Merge the pokedex, pokemon translation and rarity file into a new array |
163 | 163 | ########################################################################## |
164 | 164 | |
165 | -$pokedex_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json'); |
|
166 | -$pokemons = json_decode($pokedex_file); |
|
165 | +$pokedex_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json'); |
|
166 | +$pokemons = json_decode($pokedex_file); |
|
167 | 167 | |
168 | 168 | $pokedex_rarity_file = SYS_PATH.'/core/json/pokedex.rarity.json'; |
169 | 169 | // initial create of pokedex.rarity.json if it doesn't exist |
170 | 170 | if (!is_file($pokedex_rarity_file)) { |
171 | 171 | include_once(SYS_PATH.'/core/cron/pokedex.rarity.php'); |
172 | 172 | } |
173 | -$pokedex_rarity_file_content = file_get_contents($pokedex_rarity_file); |
|
174 | -$pokemons_rarity = json_decode($pokedex_rarity_file_content); |
|
173 | +$pokedex_rarity_file_content = file_get_contents($pokedex_rarity_file); |
|
174 | +$pokemons_rarity = json_decode($pokedex_rarity_file_content); |
|
175 | 175 | |
176 | 176 | foreach ($pokemons->pokemon as $pokeid => $pokemon) { |
177 | 177 | // Merge name and description from translation files |
178 | - $pokemon->name = $pokemon_trans->pokemon->$pokeid->name; |
|
179 | - $pokemon->description = $pokemon_trans->pokemon->$pokeid->description; |
|
178 | + $pokemon->name = $pokemon_trans->pokemon->$pokeid->name; |
|
179 | + $pokemon->description = $pokemon_trans->pokemon->$pokeid->description; |
|
180 | 180 | |
181 | 181 | // Replace quick and charge move with translation |
182 | - $quick_move = $pokemon->quick_move; |
|
183 | - $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move; |
|
184 | - $charge_move = $pokemon->charge_move; |
|
185 | - $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move; |
|
182 | + $quick_move = $pokemon->quick_move; |
|
183 | + $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move; |
|
184 | + $charge_move = $pokemon->charge_move; |
|
185 | + $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move; |
|
186 | 186 | |
187 | 187 | // Replace types with translation |
188 | 188 | foreach ($pokemon->types as &$type) { |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | |
193 | 193 | // Resolve candy_id to candy_name |
194 | 194 | if (isset($pokemon->candy_id)) { |
195 | - $candy_id = $pokemon->candy_id; |
|
196 | - $pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name; |
|
195 | + $candy_id = $pokemon->candy_id; |
|
196 | + $pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name; |
|
197 | 197 | unset($pokemon->candy_id); |
198 | 198 | } |
199 | 199 | // Convert move numbers to names |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | // Translate typecolors array keys as well |
230 | 230 | $types_temp = new stdClass(); |
231 | 231 | foreach ($pokemons->typecolors as $type => $color) { |
232 | - $type_trans = $pokemon_trans->types->$type; |
|
233 | - $types_temp->$type_trans = $color; |
|
232 | + $type_trans = $pokemon_trans->types->$type; |
|
233 | + $types_temp->$type_trans = $color; |
|
234 | 234 | } |
235 | 235 | // Replace typecolors array with translated one |
236 | 236 | $pokemons->typecolors = $types_temp; |