| @@ 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) { |
|
| @@ 125-146 (lines=22) @@ | ||
| 122 | // } |
|
| 123 | } |
|
| 124 | ||
| 125 | if (isset($res['query']['namespaces'])) { |
|
| 126 | foreach ($res['query']['namespaces'] as $namespace) { |
|
| 127 | if ($namespace['id'] < 0) { |
|
| 128 | continue; |
|
| 129 | } |
|
| 130 | ||
| 131 | if (isset($namespace['name'])) { |
|
| 132 | $name = $namespace['name']; |
|
| 133 | } elseif (isset($namespace['*'])) { |
|
| 134 | $name = $namespace['*']; |
|
| 135 | } else { |
|
| 136 | continue; |
|
| 137 | } |
|
| 138 | ||
| 139 | // FIXME: Figure out a way to i18n-ize this |
|
| 140 | if ($name === '') { |
|
| 141 | $name = 'Article'; |
|
| 142 | } |
|
| 143 | ||
| 144 | $this->metadata['namespaces'][$namespace['id']] = $name; |
|
| 145 | } |
|
| 146 | } |
|
| 147 | ||
| 148 | return $this->metadata; |
|
| 149 | } |
|