| @@ 107-128 (lines=22) @@ | ||
| 104 | } |
|
| 105 | } |
|
| 106 | ||
| 107 | if (isset($res['query']['namespaces'])) { |
|
| 108 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 109 | if ($namespace['id'] < 0) { |
|
| 110 | continue; |
|
| 111 | } |
|
| 112 | ||
| 113 | if (isset($namespace['name'])) { |
|
| 114 | $name = $namespace['name']; |
|
| 115 | } elseif (isset($namespace['*'])) { |
|
| 116 | $name = $namespace['*']; |
|
| 117 | } else { |
|
| 118 | continue; |
|
| 119 | } |
|
| 120 | ||
| 121 | // FIXME: Figure out a way to i18n-ize this |
|
| 122 | if ($name === '') { |
|
| 123 | $name = 'Article'; |
|
| 124 | } |
|
| 125 | ||
| 126 | $result['namespaces'][$namespace['id']] = $name; |
|
| 127 | } |
|
| 128 | } |
|
| 129 | ||
| 130 | $this->cacheSave($cacheKey, $result, 'P7D'); |
|
| 131 | } catch (Exception $e) { |
|
| @@ 170-191 (lines=22) @@ | ||
| 167 | // } |
|
| 168 | } |
|
| 169 | ||
| 170 | if (isset($res['query']['namespaces'])) { |
|
| 171 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 172 | if ($namespace['id'] < 0) { |
|
| 173 | continue; |
|
| 174 | } |
|
| 175 | ||
| 176 | if (isset($namespace['name'])) { |
|
| 177 | $name = $namespace['name']; |
|
| 178 | } elseif (isset($namespace['*'])) { |
|
| 179 | $name = $namespace['*']; |
|
| 180 | } else { |
|
| 181 | continue; |
|
| 182 | } |
|
| 183 | ||
| 184 | // FIXME: Figure out a way to i18n-ize this |
|
| 185 | if ($name === '') { |
|
| 186 | $name = 'Article'; |
|
| 187 | } |
|
| 188 | ||
| 189 | $this->metadata['namespaces'][$namespace['id']] = $name; |
|
| 190 | } |
|
| 191 | } |
|
| 192 | ||
| 193 | return $this->metadata; |
|
| 194 | } |
|