Skip to content

Instantly share code, notes, and snippets.

@jdlrobson jdlrobson/p.diff
Created Aug 23, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.