| @@ 104-125 (lines=22) @@ | ||
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | if (isset($res['query']['namespaces'])) { |
|
| 105 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 106 | if ($namespace['id'] < 0) { |
|
| 107 | continue; |
|
| 108 | } |
|
| 109 | ||
| 110 | if (isset($namespace['name'])) { |
|
| 111 | $name = $namespace['name']; |
|
| 112 | } elseif (isset($namespace['*'])) { |
|
| 113 | $name = $namespace['*']; |
|
| 114 | } else { |
|
| 115 | continue; |
|
| 116 | } |
|
| 117 | ||
| 118 | // FIXME: Figure out a way to i18n-ize this |
|
| 119 | if ($name === '') { |
|
| 120 | $name = 'Article'; |
|
| 121 | } |
|
| 122 | ||
| 123 | $result['namespaces'][$namespace['id']] = $name; |
|
| 124 | } |
|
| 125 | } |
|
| 126 | ||
| 127 | $this->cacheSave($cacheKey, $result, 'P7D'); |
|
| 128 | } catch (Exception $e) { |
|
| @@ 192-213 (lines=22) @@ | ||
| 189 | // } |
|
| 190 | } |
|
| 191 | ||
| 192 | if (isset($res['query']['namespaces'])) { |
|
| 193 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 194 | if ($namespace['id'] < 0) { |
|
| 195 | continue; |
|
| 196 | } |
|
| 197 | ||
| 198 | if (isset($namespace['name'])) { |
|
| 199 | $name = $namespace['name']; |
|
| 200 | } elseif (isset($namespace['*'])) { |
|
| 201 | $name = $namespace['*']; |
|
| 202 | } else { |
|
| 203 | continue; |
|
| 204 | } |
|
| 205 | ||
| 206 | // FIXME: Figure out a way to i18n-ize this |
|
| 207 | if ($name === '') { |
|
| 208 | $name = 'Article'; |
|
| 209 | } |
|
| 210 | ||
| 211 | $this->metadata['namespaces'][$namespace['id']] = $name; |
|
| 212 | } |
|
| 213 | } |
|
| 214 | ||
| 215 | return $this->metadata; |
|
| 216 | } |
|