| @@ 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) { |
|
| @@ 205-226 (lines=22) @@ | ||
| 202 | // } |
|
| 203 | } |
|
| 204 | ||
| 205 | if (isset($res['query']['namespaces'])) { |
|
| 206 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 207 | if ($namespace['id'] < 0) { |
|
| 208 | continue; |
|
| 209 | } |
|
| 210 | ||
| 211 | if (isset($namespace['name'])) { |
|
| 212 | $name = $namespace['name']; |
|
| 213 | } elseif (isset($namespace['*'])) { |
|
| 214 | $name = $namespace['*']; |
|
| 215 | } else { |
|
| 216 | continue; |
|
| 217 | } |
|
| 218 | ||
| 219 | // FIXME: Figure out a way to i18n-ize this |
|
| 220 | if ($name === '') { |
|
| 221 | $name = 'Article'; |
|
| 222 | } |
|
| 223 | ||
| 224 | $this->metadata['namespaces'][$namespace['id']] = $name; |
|
| 225 | } |
|
| 226 | } |
|
| 227 | ||
| 228 | return $this->metadata; |
|
| 229 | } |
|