Add the resolved URL of each langlink to the API's action=parse output
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 28 Jan 2011 01:09:47 +0000 (01:09 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 28 Jan 2011 01:09:47 +0000 (01:09 +0000)
includes/api/ApiParse.php

index 5500829..5c5ff56 100644 (file)
@@ -324,7 +324,12 @@ class ApiParse extends ApiBase {
                foreach ( $links as $link ) {
                        $entry = array();
                        $bits = explode( ':', $link, 2 );
+                       $title = Title::newFromText( $link );
+                       
                        $entry['lang'] = $bits[0];
+                       if ( $title ) {
+                               $entry['url'] = $title->getFullURL();
+                       }
                        $this->getResult()->setContent( $entry, $bits[1] );
                        $result[] = $entry;
                }