Skip to content

Instantly share code, notes, and snippets.

@jdlrobson
Created August 23, 2017 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdlrobson/6962dc5a4441f6edb955da7f2d246837 to your computer and use it in GitHub Desktop.
Save jdlrobson/6962dc5a4441f6edb955da7f2d246837 to your computer and use it in GitHub Desktop.
p.diff
diff --git a/includes/specials/SpecialMobileLanguages.php b/includes/specials/SpecialMobileLanguages.php
index 735645e..d30655c 100644
--- a/includes/specials/SpecialMobileLanguages.php
+++ b/includes/specials/SpecialMobileLanguages.php
@@ -22,22 +22,11 @@ class SpecialMobileLanguages extends MobileSpecialPage {
* @return array
*/
private function getLanguages() {
- $api = new ApiMain(
- new DerivativeRequest(
- $this->getRequest(),
- [
- 'action' => 'query',
- 'prop' => 'langlinks',
- 'llprop' => 'url',
- 'lllimit' => 'max',
- 'titles' => $this->title->getPrefixedText()
- ]
- )
- );
-
- $api->execute();
- $data = (array)$api->getResult()->getResultData( [ 'query', 'pages' ],
- [ 'Strip' => 'all' ] );
+ $url = 'https://ml.m.wikipedia.org/w/api.php?action=query&format=json&prop=langlinks&titles=%E0%B4%B5%E0%B4%BF%E0%B4%95%E0%B5%8D%E0%B4%95%E0%B4%BF%E0%B4%AA%E0%B5%80%E0%B4%A1%E0%B4%BF%E0%B4%AF%3A%E0%B4%B5%E0%B4%BF%E0%B4%95%E0%B5%8D%E0%B4%95%E0%B4%BF%E0%B4%B8%E0%B4%82%E0%B4%97%E0%B4%AE%E0%B5%8B%E0%B4%A4%E0%B5%8D%E0%B4%B8%E0%B4%B5%E0%B4%82+-+2013&formatversion=2&llprop=url';
+ $resp = file_get_contents( $url, false );
+ $json = json_decode( $resp, true );
+ $data = $json['query']['pages'];
+ var_dump($data);
return $this->processLanguages( $data );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment