| @@ 113-134 (lines=22) @@ | ||
| 110 | } |
|
| 111 | } |
|
| 112 | ||
| 113 | if (isset($res['query']['namespaces'])) { |
|
| 114 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 115 | if ($namespace['id'] < 0) { |
|
| 116 | continue; |
|
| 117 | } |
|
| 118 | ||
| 119 | if (isset($namespace['name'])) { |
|
| 120 | $name = $namespace['name']; |
|
| 121 | } elseif (isset($namespace['*'])) { |
|
| 122 | $name = $namespace['*']; |
|
| 123 | } else { |
|
| 124 | continue; |
|
| 125 | } |
|
| 126 | ||
| 127 | // FIXME: Figure out a way to i18n-ize this |
|
| 128 | if ($name === '') { |
|
| 129 | $name = 'Article'; |
|
| 130 | } |
|
| 131 | ||
| 132 | $result['namespaces'][$namespace['id']] = $name; |
|
| 133 | } |
|
| 134 | } |
|
| 135 | ||
| 136 | $this->cacheSave($cacheKey, $result, 'P7D'); |
|
| 137 | } catch (Exception $e) { |
|
| @@ 225-246 (lines=22) @@ | ||
| 222 | // } |
|
| 223 | } |
|
| 224 | ||
| 225 | if (isset($res['query']['namespaces'])) { |
|
| 226 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 227 | if ($namespace['id'] < 0) { |
|
| 228 | continue; |
|
| 229 | } |
|
| 230 | ||
| 231 | if (isset($namespace['name'])) { |
|
| 232 | $name = $namespace['name']; |
|
| 233 | } elseif (isset($namespace['*'])) { |
|
| 234 | $name = $namespace['*']; |
|
| 235 | } else { |
|
| 236 | continue; |
|
| 237 | } |
|
| 238 | ||
| 239 | // FIXME: Figure out a way to i18n-ize this |
|
| 240 | if ($name === '') { |
|
| 241 | $name = 'Article'; |
|
| 242 | } |
|
| 243 | ||
| 244 | $this->metadata['namespaces'][$namespace['id']] = $name; |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||
| 248 | return $this->metadata; |
|
| 249 | } |
|